summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--.qmake.conf2
-rwxr-xr-xbin/syncqt.pl57
-rw-r--r--config.tests/common/c++98default/c++98default.cpp (renamed from config.tests/unix/iodbc/iodbc.cpp)12
-rw-r--r--config.tests/common/c++98default/c++98default.pro3
-rw-r--r--config.tests/common/c++default/c++default.cpp1
-rw-r--r--config.tests/common/c++default/c++default.pro14
-rw-r--r--config.tests/common/libproxy/libproxy.pro1
-rw-r--r--config.tests/common/pch/header.h1
-rw-r--r--config.tests/common/pch/pch.pro4
-rw-r--r--config.tests/common/pch/source.cpp (renamed from mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h)9
-rw-r--r--config.tests/common/verifyspec/verifyspec.cpp1
-rw-r--r--config.tests/common/verifyspec/verifyspec.pro1
-rw-r--r--config.tests/mac/corewlan/corewlan.pro1
-rw-r--r--config.tests/qpa/direct2d/direct2d.pro1
-rw-r--r--config.tests/qpa/egl-x11/egl-x11.pro9
-rw-r--r--config.tests/qpa/egl/egl.pro7
-rw-r--r--config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp1
-rw-r--r--config.tests/qpa/eglfs-brcm/eglfs-brcm.pro8
-rw-r--r--config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp10
-rw-r--r--config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro12
-rw-r--r--config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro2
-rw-r--r--config.tests/qpa/eglfs-mali/eglfs-mali.pro2
-rw-r--r--config.tests/qpa/eglfs-viv/eglfs-viv.cpp1
-rw-r--r--config.tests/qpa/eglfs-viv/eglfs-viv.pro9
-rw-r--r--config.tests/qpa/gbm/gbm.pro2
-rw-r--r--config.tests/qpa/kms/kms.pro2
-rw-r--r--config.tests/qpa/mirclient/mirclient.pro2
-rw-r--r--config.tests/qpa/wayland-server/wayland-server.pro2
-rw-r--r--config.tests/qpa/xcb-glx/xcb-glx.pro3
-rw-r--r--config.tests/qpa/xcb-render/xcb-render.pro3
-rw-r--r--config.tests/qpa/xcb-syslibs/xcb-syslibs.pro3
-rw-r--r--config.tests/qpa/xcb-syslibs/xcb.cpp3
-rw-r--r--config.tests/qpa/xcb-xkb/xcb-xkb.cpp3
-rw-r--r--config.tests/qpa/xcb-xkb/xcb-xkb.pro3
-rw-r--r--config.tests/qpa/xcb-xlib/xcb-xlib.pro3
-rw-r--r--config.tests/qpa/xcb/xcb.cpp4
-rw-r--r--config.tests/qpa/xcb/xcb.pro3
-rw-r--r--config.tests/unix/alsa/alsa.pro1
-rwxr-xr-xconfig.tests/unix/arch.test77
-rwxr-xr-xconfig.tests/unix/bsymbolic_functions.test31
-rwxr-xr-xconfig.tests/unix/compile.test109
-rw-r--r--config.tests/unix/cups/cups.pro1
-rw-r--r--config.tests/unix/db2/db2.pro1
-rw-r--r--config.tests/unix/dbus/dbus.pro6
-rw-r--r--config.tests/unix/doubleconversion/doubleconversion.pro1
-rw-r--r--config.tests/unix/fontconfig/fontconfig.pro1
-rw-r--r--config.tests/unix/freetype/freetype.pro1
-rwxr-xr-xconfig.tests/unix/fvisibility.test74
-rw-r--r--config.tests/unix/getaddrinfo/getaddrinfo.pro1
-rw-r--r--config.tests/unix/getifaddrs/getifaddrs.pro1
-rw-r--r--config.tests/unix/gnu-libiconv/gnu-libiconv.pro1
-rw-r--r--config.tests/unix/gstreamer/gstreamer.pro18
-rw-r--r--config.tests/unix/harfbuzz/harfbuzz.pro1
-rw-r--r--config.tests/unix/ibase/ibase.pro1
-rw-r--r--config.tests/unix/icu/icu.pro6
-rw-r--r--config.tests/unix/iodbc/iodbc.pro3
-rw-r--r--config.tests/unix/ipv6ifname/ipv6ifname.pro1
-rw-r--r--config.tests/unix/javascriptcore-jit/hwcap_test.cpp44
-rw-r--r--config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro2
-rw-r--r--config.tests/unix/journald/journald.pro7
-rw-r--r--config.tests/unix/lgmon/lgmon.pro1
-rw-r--r--config.tests/unix/libdl/libdl.pro2
-rw-r--r--config.tests/unix/libinput/libinput.pro2
-rw-r--r--config.tests/unix/libjpeg/libjpeg.pro1
-rw-r--r--config.tests/unix/libpng/libpng.pro6
-rw-r--r--config.tests/unix/libudev/libudev.pro2
-rw-r--r--config.tests/unix/mtdev/mtdev.pro3
-rw-r--r--config.tests/unix/mysql/mysql.cpp3
-rw-r--r--config.tests/unix/mysql/mysql.pro1
-rw-r--r--config.tests/unix/mysql_r/mysql_r.pro3
-rw-r--r--config.tests/unix/oci/oci.pro1
-rw-r--r--config.tests/unix/odbc/odbc.cpp4
-rw-r--r--config.tests/unix/odbc/odbc.pro2
-rw-r--r--config.tests/unix/opengldesktop/opengldesktop.pro6
-rw-r--r--config.tests/unix/opengles2/opengles2.pro7
-rw-r--r--config.tests/unix/opengles3/opengles3.pro7
-rw-r--r--config.tests/unix/opengles31/opengles31.pro6
-rw-r--r--config.tests/unix/openvg/openvg.pro19
-rw-r--r--config.tests/unix/pcre/pcre.pro1
-rw-r--r--config.tests/unix/pps/pps.pro1
-rwxr-xr-xconfig.tests/unix/precomp.test54
-rw-r--r--config.tests/unix/psql/psql.pro1
-rw-r--r--config.tests/unix/pulseaudio/pulseaudio.pro1
-rw-r--r--config.tests/unix/qqnx_imf/qqnx_imf.pro1
-rw-r--r--config.tests/unix/reduce_exports/fvisibility.c (renamed from config.tests/x11/mitshm/mitshm.cpp)35
-rw-r--r--config.tests/unix/reduce_exports/reduce_exports.pro5
-rw-r--r--config.tests/unix/reduce_relocs/bsymbolic_functions.c (renamed from config.tests/x11/xfixes/xfixes.cpp)19
-rw-r--r--config.tests/unix/reduce_relocs/reduce_relocs.pro5
-rw-r--r--config.tests/unix/sctp/sctp.cpp (renamed from config.tests/unix/stdint/main.cpp)23
-rw-r--r--config.tests/unix/sctp/sctp.pro3
-rw-r--r--config.tests/unix/shivavg/shivavg.cpp49
-rw-r--r--config.tests/unix/shivavg/shivavg.pro11
-rw-r--r--config.tests/unix/slog2/slog2.pro1
-rw-r--r--config.tests/unix/sqlite2/sqlite2.pro1
-rw-r--r--config.tests/unix/stdint/stdint.pro3
-rw-r--r--config.tests/unix/tds/tds.pro1
-rw-r--r--config.tests/unix/tslib/tslib.pro1
-rw-r--r--config.tests/unix/zlib/zlib.pro1
-rw-r--r--config.tests/win/directwrite/directwrite.pro1
-rw-r--r--config.tests/win/directwrite2/directwrite2.pro1
-rw-r--r--config.tests/x11/glxfbconfig/glxfbconfig.cpp49
-rw-r--r--config.tests/x11/glxfbconfig/glxfbconfig.pro10
-rw-r--r--config.tests/x11/mitshm/mitshm.pro5
-rwxr-xr-xconfig.tests/x11/notype.test49
-rw-r--r--config.tests/x11/notype/notypetest.pro5
-rw-r--r--config.tests/x11/opengl/opengl.cpp47
-rw-r--r--config.tests/x11/opengl/opengl.pro11
-rw-r--r--config.tests/x11/xcursor/xcursor.cpp64
-rw-r--r--config.tests/x11/xcursor/xcursor.pro4
-rw-r--r--config.tests/x11/xfixes/xfixes.pro3
-rw-r--r--config.tests/x11/xinput2/xinput2.pro1
-rw-r--r--config.tests/x11/xkb/xkb.cpp69
-rw-r--r--config.tests/x11/xkb/xkb.pro3
-rw-r--r--config.tests/x11/xrandr/xrandr.pro4
-rw-r--r--config.tests/x11/xrender/xrender.pro1
-rw-r--r--config.tests/x11/xshape/xshape.cpp49
-rw-r--r--config.tests/x11/xshape/xshape.pro3
-rw-r--r--config.tests/x11/xsync/xsync.pro3
-rw-r--r--config_help.txt299
-rwxr-xr-xconfigure6055
-rw-r--r--configure.bat25
-rw-r--r--configure.json1195
-rw-r--r--configure.pri550
-rw-r--r--doc/global/config.qdocconf2
-rw-r--r--doc/global/externalsites/qt-webpages.qdoc4
-rw-r--r--doc/global/qt-cpp-defines.qdocconf1
-rw-r--r--examples/corelib/ipc/ipc.pro2
-rw-r--r--examples/corelib/threads/mandelbrot/mandelbrotwidget.h14
-rw-r--r--examples/corelib/threads/mandelbrot/renderthread.h2
-rw-r--r--examples/corelib/threads/semaphores/semaphores.cpp4
-rw-r--r--examples/corelib/threads/waitconditions/waitconditions.cpp4
-rw-r--r--examples/corelib/tools/contiguouscache/randomlistmodel.h4
-rw-r--r--examples/dbus/dbus.pro5
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/gui/analogclock/main.cpp4
-rw-r--r--examples/gui/doc/src/openglwindow.qdoc12
-rw-r--r--examples/gui/doc/src/rasterwindow.qdoc15
-rw-r--r--examples/gui/gui.pro4
-rw-r--r--examples/gui/openglwindow/main.cpp4
-rw-r--r--examples/gui/openglwindow/openglwindow.cpp7
-rw-r--r--examples/gui/openglwindow/openglwindow.h5
-rw-r--r--examples/gui/rasterwindow/rasterwindow.cpp10
-rw-r--r--examples/gui/rasterwindow/rasterwindow.h7
-rw-r--r--examples/network/bearermonitor/bearermonitor.pro3
-rw-r--r--examples/network/bearermonitor/sessionwidget.h2
-rw-r--r--examples/network/blockingfortuneclient/fortunethread.h2
-rw-r--r--examples/network/googlesuggest/googlesuggest.h2
-rw-r--r--examples/network/multistreamclient/chatconsumer.cpp93
-rw-r--r--examples/network/multistreamclient/chatconsumer.h79
-rw-r--r--examples/network/multistreamclient/client.cpp219
-rw-r--r--examples/network/multistreamclient/client.h92
-rw-r--r--examples/network/multistreamclient/consumer.h75
-rw-r--r--examples/network/multistreamclient/main.cpp60
-rw-r--r--examples/network/multistreamclient/movieconsumer.cpp83
-rw-r--r--examples/network/multistreamclient/movieconsumer.h74
-rw-r--r--examples/network/multistreamclient/multistreamclient.pro16
-rw-r--r--examples/network/multistreamclient/timeconsumer.cpp94
-rw-r--r--examples/network/multistreamclient/timeconsumer.h79
-rw-r--r--examples/network/multistreamserver/animation.gifbin0 -> 42629 bytes
-rw-r--r--examples/network/multistreamserver/chatprovider.cpp77
-rw-r--r--examples/network/multistreamserver/chatprovider.h67
-rw-r--r--examples/network/multistreamserver/main.cpp61
-rw-r--r--examples/network/multistreamserver/movieprovider.cpp73
-rw-r--r--examples/network/multistreamserver/movieprovider.h73
-rw-r--r--examples/network/multistreamserver/multistreamserver.pro24
-rw-r--r--examples/network/multistreamserver/provider.h76
-rw-r--r--examples/network/multistreamserver/server.cpp171
-rw-r--r--examples/network/multistreamserver/server.h91
-rw-r--r--examples/network/multistreamserver/timeprovider.cpp79
-rw-r--r--examples/network/multistreamserver/timeprovider.h65
-rw-r--r--examples/network/network-chat/connection.h2
-rw-r--r--examples/network/network-chat/server.h2
-rw-r--r--examples/network/network.pro13
-rw-r--r--examples/network/shared/sctpchannels.h62
-rw-r--r--examples/network/threadedfortuneserver/fortuneserver.h2
-rw-r--r--examples/network/threadedfortuneserver/fortunethread.h2
-rw-r--r--examples/network/torrent/connectionmanager.cpp2
-rw-r--r--examples/network/torrent/filemanager.h2
-rw-r--r--examples/network/torrent/mainwindow.cpp6
-rw-r--r--examples/network/torrent/mainwindow.h4
-rw-r--r--examples/network/torrent/metainfo.cpp2
-rw-r--r--examples/network/torrent/peerwireclient.h14
-rw-r--r--examples/network/torrent/torrentclient.cpp4
-rw-r--r--examples/network/torrent/torrentclient.h2
-rw-r--r--examples/network/torrent/torrentserver.h2
-rw-r--r--examples/network/torrent/trackerclient.h2
-rw-r--r--examples/opengl/2dpainting/glwidget.h2
-rw-r--r--examples/opengl/2dpainting/widget.h2
-rw-r--r--examples/opengl/contextinfo/renderwindow.h2
-rw-r--r--examples/opengl/cube/mainwidget.h12
-rw-r--r--examples/opengl/hellogl2/glwidget.h14
-rw-r--r--examples/opengl/hellogl2/window.h2
-rw-r--r--examples/opengl/hellowindow/hellowindow.h4
-rw-r--r--examples/opengl/legacy/framebufferobject2/framebufferobject2.pro2
-rw-r--r--examples/opengl/legacy/framebufferobject2/glwidget.h12
-rw-r--r--examples/opengl/legacy/grabber/glwidget.h10
-rw-r--r--examples/opengl/legacy/grabber/grabber.pro2
-rw-r--r--examples/opengl/legacy/hellogl/glwidget.h14
-rw-r--r--examples/opengl/legacy/hellogl/hellogl.pro2
-rw-r--r--examples/opengl/legacy/hellogl/window.h2
-rw-r--r--examples/opengl/legacy/legacy.pro2
-rw-r--r--examples/opengl/legacy/overpainting/glwidget.h14
-rw-r--r--examples/opengl/legacy/overpainting/overpainting.pro2
-rw-r--r--examples/opengl/legacy/pbuffers/glwidget.h10
-rw-r--r--examples/opengl/legacy/pbuffers/pbuffers.pro2
-rw-r--r--examples/opengl/legacy/pbuffers2/pbuffers2.pro2
-rw-r--r--examples/opengl/legacy/samplebuffers/glwidget.h8
-rw-r--r--examples/opengl/legacy/samplebuffers/samplebuffers.pro2
-rw-r--r--examples/opengl/paintedwindow/paintedwindow.h4
-rw-r--r--examples/opengl/qopenglwidget/glwidget.h6
-rw-r--r--examples/opengl/qopenglwindow/main.cpp6
-rw-r--r--examples/opengl/textures/glwidget.h16
-rw-r--r--examples/opengl/threadedqopenglwidget/glwidget.h2
-rw-r--r--examples/qpa/windows/window.h14
-rw-r--r--examples/sql/books/bookdelegate.h8
-rw-r--r--examples/sql/drilldown/imageitem.h4
-rw-r--r--examples/sql/drilldown/view.h2
-rw-r--r--examples/sql/querymodel/customsqlmodel.h2
-rw-r--r--examples/sql/querymodel/editablesqlmodel.h4
-rw-r--r--examples/sql/sqlbrowser/browser.h2
-rw-r--r--examples/touch/fingerpaint/mainwindow.h2
-rw-r--r--examples/touch/fingerpaint/scribblearea.h6
-rw-r--r--examples/touch/knobs/knob.h2
-rw-r--r--examples/touch/pinchzoom/graphicsview.h2
-rw-r--r--examples/touch/pinchzoom/mouse.h8
-rw-r--r--examples/widgets/animation/animatedtiles/main.cpp12
-rw-r--r--examples/widgets/animation/appchooser/main.cpp8
-rw-r--r--examples/widgets/animation/easing/animation.h2
-rw-r--r--examples/widgets/animation/moveblocks/main.cpp12
-rw-r--r--examples/widgets/animation/states/main.cpp6
-rw-r--r--examples/widgets/animation/stickman/graphicsview.h4
-rw-r--r--examples/widgets/animation/stickman/lifecycle.cpp6
-rw-r--r--examples/widgets/animation/stickman/node.h12
-rw-r--r--examples/widgets/animation/stickman/rectbutton.h6
-rw-r--r--examples/widgets/animation/stickman/stickman.h6
-rw-r--r--examples/widgets/animation/sub-attaq/boat.h2
-rw-r--r--examples/widgets/animation/sub-attaq/boat_p.h18
-rw-r--r--examples/widgets/animation/sub-attaq/pixmapitem.h4
-rw-r--r--examples/widgets/animation/sub-attaq/qanimationstate.h6
-rw-r--r--examples/widgets/animation/sub-attaq/states.h22
-rw-r--r--examples/widgets/animation/sub-attaq/submarine.h2
-rw-r--r--examples/widgets/animation/sub-attaq/submarine_p.h6
-rw-r--r--examples/widgets/desktop/screenshot/screenshot.h2
-rw-r--r--examples/widgets/desktop/systray/window.h4
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.h8
-rw-r--r--examples/widgets/dialogs/licensewizard/licensewizard.h14
-rw-r--r--examples/widgets/draganddrop/draganddrop.pro2
-rw-r--r--examples/widgets/draganddrop/draggableicons/dragwidget.h8
-rw-r--r--examples/widgets/draganddrop/draggabletext/dragwidget.h6
-rw-r--r--examples/widgets/draganddrop/dropsite/droparea.h8
-rw-r--r--examples/widgets/draganddrop/fridgemagnets/dragwidget.h8
-rw-r--r--examples/widgets/draganddrop/puzzle/pieceslist.h8
-rw-r--r--examples/widgets/draganddrop/puzzle/puzzle.pro6
-rw-r--r--examples/widgets/draganddrop/puzzle/puzzlewidget.h12
-rw-r--r--examples/widgets/effects/blurpicker/blureffect.h2
-rw-r--r--examples/widgets/effects/blurpicker/blurpicker.h6
-rw-r--r--examples/widgets/effects/lighting/lighting.h2
-rw-r--r--examples/widgets/gestures/imagegestures/imagewidget.h8
-rw-r--r--examples/widgets/graphicsview/basicgraphicslayouts/layoutitem.h8
-rw-r--r--examples/widgets/graphicsview/boxes/boxes.pro6
-rw-r--r--examples/widgets/graphicsview/boxes/glbuffers.h14
-rw-r--r--examples/widgets/graphicsview/boxes/main.cpp2
-rw-r--r--examples/widgets/graphicsview/boxes/qtbox.h32
-rw-r--r--examples/widgets/graphicsview/boxes/scene.h26
-rw-r--r--examples/widgets/graphicsview/chip/chip.h12
-rw-r--r--examples/widgets/graphicsview/chip/view.h2
-rw-r--r--examples/widgets/graphicsview/collidingmice/mouse.h8
-rw-r--r--examples/widgets/graphicsview/diagramscene/arrow.h8
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramitem.h6
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramscene.h6
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramtextitem.h8
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/coloritem.h10
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/main.cpp2
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/robot.h26
-rw-r--r--examples/widgets/graphicsview/elasticnodes/edge.h6
-rw-r--r--examples/widgets/graphicsview/elasticnodes/graphwidget.h8
-rw-r--r--examples/widgets/graphicsview/elasticnodes/node.h14
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/customproxy.h12
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/main.cpp4
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.h10
-rw-r--r--examples/widgets/graphicsview/graphicsview.pro2
-rw-r--r--examples/widgets/graphicsview/padnavigator/padnavigator.h2
-rw-r--r--examples/widgets/graphicsview/padnavigator/roundrectitem.h4
-rw-r--r--examples/widgets/graphicsview/padnavigator/splashitem.h4
-rw-r--r--examples/widgets/graphicsview/simpleanchorlayout/main.cpp2
-rw-r--r--examples/widgets/graphicsview/weatheranchorlayout/main.cpp12
-rw-r--r--examples/widgets/itemviews/addressbook/tablemodel.h16
-rw-r--r--examples/widgets/itemviews/chart/pieview.h40
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h4
-rw-r--r--examples/widgets/itemviews/editabletreemodel/treemodel.h26
-rw-r--r--examples/widgets/itemviews/fetchmore/filelistmodel.h8
-rw-r--r--examples/widgets/itemviews/frozencolumn/freezetablewidget.h6
-rw-r--r--examples/widgets/itemviews/interview/model.h16
-rw-r--r--examples/widgets/itemviews/pixelator/imagemodel.h8
-rw-r--r--examples/widgets/itemviews/pixelator/pixeldelegate.h4
-rw-r--r--examples/widgets/itemviews/puzzle/piecesmodel.h16
-rw-r--r--examples/widgets/itemviews/puzzle/puzzle.pro5
-rw-r--r--examples/widgets/itemviews/puzzle/puzzlewidget.h12
-rw-r--r--examples/widgets/itemviews/simpledommodel/dommodel.h14
-rw-r--r--examples/widgets/itemviews/simpletreemodel/treemodel.h14
-rw-r--r--examples/widgets/itemviews/spinboxdelegate/delegate.h8
-rw-r--r--examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h6
-rw-r--r--examples/widgets/itemviews/spreadsheet/spreadsheetitem.h6
-rw-r--r--examples/widgets/itemviews/stardelegate/stardelegate.h10
-rw-r--r--examples/widgets/itemviews/stardelegate/stareditor.h8
-rw-r--r--examples/widgets/layouts/borderlayout/borderlayout.h18
-rw-r--r--examples/widgets/layouts/flowlayout/flowlayout.h20
-rw-r--r--examples/widgets/mainwindows/application/mainwindow.h2
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.cpp6
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.h12
-rw-r--r--examples/widgets/mainwindows/mdi/mainwindow.h2
-rw-r--r--examples/widgets/mainwindows/mdi/mdichild.h2
-rw-r--r--examples/widgets/mainwindows/menus/mainwindow.h2
-rw-r--r--examples/widgets/mainwindows/sdi/mainwindow.h2
-rw-r--r--examples/widgets/painting/affine/affine.pro4
-rw-r--r--examples/widgets/painting/affine/xform.h12
-rw-r--r--examples/widgets/painting/basicdrawing/renderarea.h6
-rw-r--r--examples/widgets/painting/composition/composition.cpp2
-rw-r--r--examples/widgets/painting/composition/composition.h12
-rw-r--r--examples/widgets/painting/composition/composition.pro6
-rw-r--r--examples/widgets/painting/concentriccircles/circlewidget.h6
-rw-r--r--examples/widgets/painting/deform/pathdeform.h12
-rw-r--r--examples/widgets/painting/gradients/gradients.h10
-rw-r--r--examples/widgets/painting/painterpaths/renderarea.h6
-rw-r--r--examples/widgets/painting/pathstroke/pathstroke.h16
-rw-r--r--examples/widgets/painting/shared/arthurstyle.h20
-rw-r--r--examples/widgets/painting/shared/arthurwidgets.h8
-rw-r--r--examples/widgets/painting/shared/hoverpoints.h2
-rw-r--r--examples/widgets/painting/shared/shared.pri2
-rw-r--r--examples/widgets/painting/transformations/renderarea.h6
-rw-r--r--examples/widgets/richtext/syntaxhighlighter/highlighter.h2
-rw-r--r--examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro7
-rw-r--r--examples/widgets/richtext/textedit/textedit.h2
-rw-r--r--examples/widgets/scroller/graphicsview/main.cpp18
-rw-r--r--examples/widgets/statemachine/factorial/main.cpp8
-rw-r--r--examples/widgets/statemachine/pingpong/main.cpp10
-rw-r--r--examples/widgets/statemachine/rogue/movementtransition.h4
-rw-r--r--examples/widgets/statemachine/rogue/window.h4
-rw-r--r--examples/widgets/statemachine/trafficlight/main.cpp2
-rw-r--r--examples/widgets/tools/completer/fsmodel.h2
-rw-r--r--examples/widgets/tools/customcompleter/textedit.h4
-rw-r--r--examples/widgets/tools/echoplugin/plugin/echoplugin.h2
-rw-r--r--examples/widgets/tools/i18n/languagechooser.h4
-rw-r--r--examples/widgets/tools/plugandpaint/app/app.pro13
-rw-r--r--examples/widgets/tools/plugandpaint/app/paintarea.h10
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro1
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h16
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro1
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h4
-rw-r--r--examples/widgets/tools/settingseditor/settingstree.h4
-rw-r--r--examples/widgets/tools/settingseditor/variantdelegate.h8
-rw-r--r--examples/widgets/tools/styleplugin/plugin/simplestyle.h2
-rw-r--r--examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h2
-rw-r--r--examples/widgets/tools/tools.pro3
-rw-r--r--examples/widgets/tools/treemodelcompleter/treemodelcompleter.h4
-rw-r--r--examples/widgets/tools/undo/commands.h24
-rw-r--r--examples/widgets/tools/undo/document.h8
-rw-r--r--examples/widgets/tools/undoframework/commands.h16
-rw-r--r--examples/widgets/tools/undoframework/diagramitem.h2
-rw-r--r--examples/widgets/tools/undoframework/diagramscene.h4
-rw-r--r--examples/widgets/tutorials/modelview/1_readonly/mymodel.h6
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting/mymodel.h6
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h6
-rw-r--r--examples/widgets/tutorials/modelview/4_headers/mymodel.h8
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/mymodel.h10
-rw-r--r--examples/widgets/widgets.pro4
-rw-r--r--examples/widgets/widgets/analogclock/analogclock.h2
-rw-r--r--examples/widgets/widgets/calculator/button.h2
-rw-r--r--examples/widgets/widgets/charactermap/characterwidget.h8
-rw-r--r--examples/widgets/widgets/codeeditor/codeeditor.h6
-rw-r--r--examples/widgets/widgets/elidedlabel/elidedlabel.h2
-rw-r--r--examples/widgets/widgets/elidedlabel/testwidget.h2
-rw-r--r--examples/widgets/widgets/icons/icons.pro11
-rw-r--r--examples/widgets/widgets/icons/iconsizespinbox.h4
-rw-r--r--examples/widgets/widgets/icons/imagedelegate.h6
-rw-r--r--examples/widgets/widgets/imageviewer/imageviewer.pro5
-rw-r--r--examples/widgets/widgets/mousebuttons/buttontester.h8
-rw-r--r--examples/widgets/widgets/movie/movie.pro7
-rw-r--r--examples/widgets/widgets/scribble/mainwindow.h2
-rw-r--r--examples/widgets/widgets/scribble/scribblearea.h10
-rw-r--r--examples/widgets/widgets/shapedclock/shapedclock.h10
-rw-r--r--examples/widgets/widgets/styles/norwegianwoodstyle.h14
-rw-r--r--examples/widgets/widgets/tablet/tabletapplication.h2
-rw-r--r--examples/widgets/widgets/tablet/tabletcanvas.h6
-rw-r--r--examples/widgets/widgets/tetrix/tetrixboard.h10
-rw-r--r--examples/widgets/widgets/tooltips/sortingbox.h12
-rw-r--r--examples/widgets/widgets/wiggly/wigglywidget.h4
-rw-r--r--examples/widgets/windowcontainer/windowcontainer.cpp16
-rw-r--r--examples/xml/saxbookmarks/xbelhandler.h10
-rw-r--r--mkspecs/common/clang-mac.conf1
-rw-r--r--mkspecs/common/ios.conf6
-rw-r--r--mkspecs/common/linux-android.conf1
-rw-r--r--mkspecs/common/linux.conf5
-rw-r--r--mkspecs/common/mac.conf6
-rw-r--r--mkspecs/common/msvc-base.conf2
-rw-r--r--mkspecs/common/tvos.conf20
-rw-r--r--mkspecs/common/uikit.conf11
-rw-r--r--mkspecs/common/uikit/GLES2/gl2.h (renamed from mkspecs/common/ios/GLES2/gl2.h)0
-rw-r--r--mkspecs/common/watchos.conf20
-rw-r--r--mkspecs/common/wince/qmake.conf84
-rw-r--r--mkspecs/common/wince/qplatformdefs.h129
-rw-r--r--mkspecs/common/winrt_winphone/qmake.conf3
-rw-r--r--mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp2
-rw-r--r--mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf4
-rw-r--r--mkspecs/devices/linux-colibri-vf-g++/qmake.conf17
-rw-r--r--mkspecs/devices/linux-colibri-vf-g++/qplatformdefs.h (renamed from mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h)3
-rw-r--r--mkspecs/devices/linux-rpi3-g++/qmake.conf7
-rw-r--r--mkspecs/features/android/android_deployment_settings.prf2
-rw-r--r--mkspecs/features/configure.prf40
-rw-r--r--mkspecs/features/configure_base.prf51
-rw-r--r--mkspecs/features/create_cmake.prf4
-rw-r--r--mkspecs/features/ctest_testcase_common.prf5
-rw-r--r--mkspecs/features/default_post.prf23
-rw-r--r--mkspecs/features/default_pre.prf49
-rw-r--r--mkspecs/features/java.prf2
-rw-r--r--mkspecs/features/mac/default_post.prf8
-rw-r--r--mkspecs/features/mac/default_pre.prf4
-rw-r--r--mkspecs/features/mac/sdk.prf80
-rw-r--r--mkspecs/features/mac/toolchain.prf5
-rw-r--r--mkspecs/features/moc.prf33
-rw-r--r--mkspecs/features/no_debug_info.prf3
-rw-r--r--mkspecs/features/qfeatures.prf4
-rw-r--r--mkspecs/features/qml_plugin.prf6
-rw-r--r--mkspecs/features/qpa/basicunixfontdatabase.prf2
-rw-r--r--mkspecs/features/qpa/genericunixfontdatabase.prf2
-rw-r--r--mkspecs/features/qt.prf20
-rw-r--r--mkspecs/features/qt_android_deps.prf2
-rw-r--r--mkspecs/features/qt_app.prf4
-rw-r--r--mkspecs/features/qt_build_config.prf27
-rw-r--r--mkspecs/features/qt_build_extra.prf3
-rw-r--r--mkspecs/features/qt_common.prf15
-rw-r--r--mkspecs/features/qt_configure.prf1783
-rw-r--r--mkspecs/features/qt_docs.prf15
-rw-r--r--mkspecs/features/qt_functions.prf35
-rw-r--r--mkspecs/features/qt_helper_lib.prf8
-rw-r--r--mkspecs/features/qt_module.prf24
-rw-r--r--mkspecs/features/qt_module_headers.prf42
-rw-r--r--mkspecs/features/qt_module_pris.prf49
-rw-r--r--mkspecs/features/qt_parts.prf5
-rw-r--r--mkspecs/features/qt_plugin.prf13
-rw-r--r--mkspecs/features/qt_tool.prf2
-rw-r--r--mkspecs/features/resolve_config.prf2
-rw-r--r--mkspecs/features/resources.prf2
-rw-r--r--mkspecs/features/testcase.prf5
-rw-r--r--mkspecs/features/toolchain.prf42
-rw-r--r--mkspecs/features/uikit/bitcode.prf15
-rw-r--r--mkspecs/features/uikit/default_post.prf104
-rw-r--r--mkspecs/features/uikit/default_pre.prf22
-rwxr-xr-xmkspecs/features/uikit/device_destinations.sh (renamed from mkspecs/macx-ios-clang/ios_destinations.sh)18
-rwxr-xr-xmkspecs/features/uikit/devices.pl (renamed from mkspecs/macx-ios-clang/ios_devices.pl)0
-rw-r--r--mkspecs/features/uikit/exclusive_builds_post.prf (renamed from mkspecs/macx-ios-clang/features/exclusive_builds_post.prf)0
-rw-r--r--mkspecs/features/uikit/qt.prf (renamed from mkspecs/macx-ios-clang/features/qt.prf)22
-rw-r--r--mkspecs/features/uikit/qt_config.prf (renamed from mkspecs/macx-ios-clang/features/qt_config.prf)9
-rw-r--r--mkspecs/features/uikit/qt_parts.prf (renamed from mkspecs/macx-ios-clang/features/qt_parts.prf)0
-rw-r--r--mkspecs/features/uikit/resolve_config.prf11
-rw-r--r--mkspecs/features/uikit/sdk.prf (renamed from mkspecs/macx-ios-clang/features/sdk.prf)4
-rw-r--r--mkspecs/features/uikit/testcase.prf (renamed from mkspecs/macx-ios-clang/features/testcase.prf)0
-rw-r--r--mkspecs/features/uikit/testcase_targets.prf (renamed from mkspecs/macx-ios-clang/features/testcase_targets.prf)0
-rw-r--r--mkspecs/features/uikit/xcodebuild.mk (renamed from mkspecs/macx-ios-clang/xcodebuild.mk)33
-rw-r--r--mkspecs/features/uikit/xcodebuild.prf (renamed from mkspecs/macx-ios-clang/features/xcodebuild.prf)18
-rw-r--r--mkspecs/features/unix/opengl.prf2
-rw-r--r--mkspecs/features/unix/openvg.prf4
-rw-r--r--mkspecs/features/win32/console.prf3
-rw-r--r--mkspecs/features/win32/opengl.prf41
-rw-r--r--mkspecs/features/win32/openvg.prf2
-rw-r--r--mkspecs/features/win32/qt_config.prf10
-rw-r--r--mkspecs/features/win32/windows.prf2
-rw-r--r--mkspecs/features/winrt/default_pre.prf14
-rw-r--r--mkspecs/hurd-g++/qmake.conf4
-rw-r--r--mkspecs/integrity-armv7-imx6/qmake.conf1
-rw-r--r--mkspecs/integrity-armv7/qmake.conf1
-rw-r--r--mkspecs/integrity-x86/qmake.conf1
-rw-r--r--mkspecs/macx-clang-32/qmake.conf6
-rw-r--r--mkspecs/macx-clang/qmake.conf6
-rw-r--r--mkspecs/macx-g++-32/qmake.conf2
-rw-r--r--mkspecs/macx-g++/qmake.conf2
-rw-r--r--mkspecs/macx-g++40/qmake.conf2
-rw-r--r--mkspecs/macx-g++42/qmake.conf2
-rw-r--r--mkspecs/macx-ios-clang/Info.plist.lib2
-rw-r--r--mkspecs/macx-ios-clang/features/default_post.prf97
-rw-r--r--mkspecs/macx-ios-clang/features/default_pre.prf21
-rw-r--r--mkspecs/macx-ios-clang/features/resolve_config.prf68
-rw-r--r--mkspecs/macx-ios-clang/qmake.conf16
-rw-r--r--mkspecs/macx-llvm/qmake.conf2
-rw-r--r--mkspecs/macx-tvos-clang/Info.plist.app41
-rw-r--r--mkspecs/macx-tvos-clang/Info.plist.lib22
-rw-r--r--mkspecs/macx-tvos-clang/qmake.conf21
-rw-r--r--mkspecs/macx-tvos-clang/qplatformdefs.h34
-rw-r--r--mkspecs/macx-watchos-clang/Info.plist.app35
-rw-r--r--mkspecs/macx-watchos-clang/Info.plist.lib22
-rw-r--r--mkspecs/macx-watchos-clang/qmake.conf21
-rw-r--r--mkspecs/macx-watchos-clang/qplatformdefs.h34
-rw-r--r--mkspecs/qnx-aarch64le-qcc/qmake.conf4
-rw-r--r--mkspecs/qnx-armle-v7-qcc/qmake.conf2
-rw-r--r--mkspecs/qnx-x86-64-qcc/qmake.conf4
-rw-r--r--mkspecs/qnx-x86-qcc/qmake.conf2
-rw-r--r--mkspecs/wince60standard-armv4i-msvc2005/qmake.conf27
-rw-r--r--mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h41
-rw-r--r--mkspecs/wince60standard-x86-msvc2005/qmake.conf27
-rw-r--r--mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf29
-rw-r--r--mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h41
-rw-r--r--mkspecs/wince70embedded-x86-msvc2008/qmake.conf27
-rw-r--r--mkspecs/wince80colibri-armv7-msvc2012/qmake.conf45
-rw-r--r--mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h41
-rw-r--r--qmake/Makefile.unix12
-rw-r--r--qmake/Makefile.win327
-rw-r--r--qmake/doc/src/qmake-manual.qdoc166
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp18
-rw-r--r--qmake/generators/makefile.cpp25
-rw-r--r--qmake/generators/makefile.h3
-rw-r--r--qmake/generators/makefiledeps.cpp13
-rw-r--r--qmake/generators/makefiledeps.h4
-rw-r--r--qmake/generators/unix/unixmake.cpp26
-rw-r--r--qmake/generators/unix/unixmake2.cpp66
-rw-r--r--qmake/generators/win32/cesdkhandler.cpp368
-rw-r--r--qmake/generators/win32/cesdkhandler.h89
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp40
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h8
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp79
-rw-r--r--qmake/generators/win32/winmakefile.cpp6
-rw-r--r--qmake/library/proitems.cpp13
-rw-r--r--qmake/library/proitems.h11
-rw-r--r--qmake/library/qmakebuiltins.cpp334
-rw-r--r--qmake/library/qmakeevaluator.cpp22
-rw-r--r--qmake/library/qmakeevaluator.h12
-rw-r--r--qmake/library/qmakeglobals.cpp11
-rw-r--r--qmake/library/qmakeglobals.h2
-rw-r--r--qmake/library/qmakeparser.cpp46
-rw-r--r--qmake/library/qmakeparser.h9
-rw-r--r--qmake/main.cpp38
-rw-r--r--qmake/project.cpp3
-rw-r--r--qmake/project.h5
-rw-r--r--qmake/qmake.pri6
-rw-r--r--qtbase.pro93
-rw-r--r--src/3rdparty/android/LICENSE11
-rw-r--r--src/3rdparty/android/qt_attribution.json11
-rw-r--r--src/3rdparty/angle/SYSTEMINFO_LICENSE22
-rw-r--r--src/3rdparty/angle/TRACEEVENT_LICENSE27
-rw-r--r--src/3rdparty/angle/qt_attribution.json61
-rw-r--r--src/3rdparty/atspi2/LICENSE482
-rw-r--r--src/3rdparty/atspi2/qt_attribution.json11
-rw-r--r--src/3rdparty/double-conversion/include/double-conversion/utils.h2
-rw-r--r--src/3rdparty/double-conversion/qt_attribution.json14
-rw-r--r--src/3rdparty/easing/LICENSE (renamed from src/3rdparty/easing/legal.qdoc)10
-rw-r--r--src/3rdparty/easing/qt_attribution.json11
-rw-r--r--src/3rdparty/forkfd/LICENSE19
-rw-r--r--src/3rdparty/forkfd/qt_attribution.json12
-rw-r--r--src/3rdparty/freebsd/LICENSE31
-rw-r--r--src/3rdparty/freebsd/qt_attribution.json17
-rw-r--r--src/3rdparty/freetype/freetype.pro2
-rw-r--r--src/3rdparty/freetype/qt_attribution.json13
-rw-r--r--src/3rdparty/freetype_dependency.pri8
-rw-r--r--src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro8
-rw-r--r--src/3rdparty/harfbuzz-ng/qt_attribution.json25
-rw-r--r--src/3rdparty/harfbuzz/qt_attribution.json17
-rw-r--r--src/3rdparty/harfbuzz_dependency.pri6
-rw-r--r--src/3rdparty/iaccessible2/LICENSE38
-rw-r--r--src/3rdparty/iaccessible2/qt_attribution.json17
-rw-r--r--src/3rdparty/libjpeg/LICENSE50
-rw-r--r--src/3rdparty/libjpeg/qt_attribution.json13
-rw-r--r--src/3rdparty/libpng/qt_attribution.json15
-rw-r--r--src/3rdparty/md4/qt_attribution.json10
-rw-r--r--src/3rdparty/md5/qt_attribution.json11
-rw-r--r--src/3rdparty/pcre/pcre.pro2
-rw-r--r--src/3rdparty/pcre/qt_attribution.json15
-rw-r--r--src/3rdparty/pcre_dependency.pri6
-rw-r--r--src/3rdparty/pixman/LICENSE20
-rw-r--r--src/3rdparty/pixman/qt_attribution.json13
-rw-r--r--src/3rdparty/png_dependency.pri15
-rw-r--r--src/3rdparty/rfc6234/LICENSE34
-rw-r--r--src/3rdparty/rfc6234/qt_attribution.json12
-rw-r--r--src/3rdparty/sha1/qt_attribution.json12
-rw-r--r--src/3rdparty/sha3/BRG_ENDIAN_LICENSE21
-rw-r--r--src/3rdparty/sha3/CC0_LICENSE99
-rw-r--r--src/3rdparty/sha3/qt_attribution.json29
-rw-r--r--src/3rdparty/sqlite.pri2
-rw-r--r--src/3rdparty/sqlite/qt_attribution.json12
-rw-r--r--src/3rdparty/wintab/qt_attribution.json12
-rw-r--r--src/3rdparty/xcb/LICENSE23
-rw-r--r--src/3rdparty/xcb/qt_attribution.json24
-rw-r--r--src/3rdparty/xkbcommon-x11.pri10
-rw-r--r--src/3rdparty/xkbcommon.pri11
-rw-r--r--src/3rdparty/xkbcommon/qt_attribution.json26
-rw-r--r--src/3rdparty/zlib/LICENSE28
-rw-r--r--src/3rdparty/zlib/gzguts.h4
-rw-r--r--src/3rdparty/zlib/qt_attribution.json15
-rw-r--r--src/3rdparty/zlib/zutil.h4
-rw-r--r--src/3rdparty/zlib_dependency.pri8
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java205
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/EditMenu.java142
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java155
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java77
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java42
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java7
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java1
-rw-r--r--src/angle/src/common/common.pri3
-rw-r--r--src/angle/src/compiler/preprocessor/preprocessor.pro3
-rw-r--r--src/angle/src/compiler/translator.pro3
-rw-r--r--src/angle/src/config.pri2
-rw-r--r--src/concurrent/concurrent.pro4
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.cpp75
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in2
-rw-r--r--src/corelib/Qt5CoreMacros.cmake3
-rw-r--r--src/corelib/animation/qanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qvariantanimation_p.h4
-rw-r--r--src/corelib/arch/arch.pri4
-rw-r--r--src/corelib/arch/qatomic_msvc.h42
-rw-r--r--src/corelib/codecs/codecs.pri28
-rw-r--r--src/corelib/codecs/cp949codetbl_p.h2
-rw-r--r--src/corelib/codecs/qbig5codec_p.h1
-rw-r--r--src/corelib/codecs/qeuckrcodec_p.h1
-rw-r--r--src/corelib/codecs/qgb18030codec_p.h1
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp2
-rw-r--r--src/corelib/codecs/qiconvcodec_p.h7
-rw-r--r--src/corelib/codecs/qicucodec.cpp10
-rw-r--r--src/corelib/codecs/qicucodec_p.h2
-rw-r--r--src/corelib/codecs/qisciicodec_p.h1
-rw-r--r--src/corelib/codecs/qjiscodec.cpp2
-rw-r--r--src/corelib/codecs/qjpunicode_p.h2
-rw-r--r--src/corelib/codecs/qlatincodec_p.h1
-rw-r--r--src/corelib/codecs/qsimplecodec_p.h1
-rw-r--r--src/corelib/codecs/qtextcodec.cpp6
-rw-r--r--src/corelib/codecs/qtextcodec_p.h1
-rw-r--r--src/corelib/codecs/qtsciicodec_p.h1
-rw-r--r--src/corelib/codecs/qutfcodec.cpp87
-rw-r--r--src/corelib/codecs/qwindowscodec.cpp2
-rw-r--r--src/corelib/codecs/qwindowscodec_p.h1
-rw-r--r--src/corelib/configure.json611
-rw-r--r--src/corelib/corelib.pro19
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp36
-rw-r--r--src/corelib/doc/src/animation.qdoc2
-rw-r--r--src/corelib/doc/src/qtcore-index.qdoc14
-rw-r--r--src/corelib/global/qcompilerdetection.h26
-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/qfeatures.txt6
-rw-r--r--src/corelib/global/qflags.h9
-rw-r--r--src/corelib/global/qglobal.cpp413
-rw-r--r--src/corelib/global/qglobal.h125
-rw-r--r--src/corelib/global/qglobal_p.h62
-rw-r--r--src/corelib/global/qhooks.cpp2
-rw-r--r--src/corelib/global/qhooks_p.h2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp43
-rw-r--r--src/corelib/global/qlibraryinfo.h11
-rw-r--r--src/corelib/global/qlogging.cpp12
-rw-r--r--src/corelib/global/qnamespace.h8
-rw-r--r--src/corelib/global/qnamespace.qdoc33
-rw-r--r--src/corelib/global/qnumeric_p.h4
-rw-r--r--src/corelib/global/qprocessordetection.h2
-rw-r--r--src/corelib/global/qsysinfo.h20
-rw-r--r--src/corelib/global/qsystemdetection.h20
-rw-r--r--src/corelib/global/qt_windows.h17
-rw-r--r--src/corelib/io/io.pri39
-rw-r--r--src/corelib/io/qabstractfileengine_p.h1
-rw-r--r--src/corelib/io/qdatastream.cpp1
-rw-r--r--src/corelib/io/qdatastream.h5
-rw-r--r--src/corelib/io/qdatastream_p.h1
-rw-r--r--src/corelib/io/qdataurl_p.h1
-rw-r--r--src/corelib/io/qdebug.h4
-rw-r--r--src/corelib/io/qdebug_p.h1
-rw-r--r--src/corelib/io/qdir.cpp10
-rw-r--r--src/corelib/io/qdiriterator.cpp1
-rw-r--r--src/corelib/io/qfileselector.cpp13
-rw-r--r--src/corelib/io/qfileselector_p.h2
-rw-r--r--src/corelib/io/qfilesystemengine.cpp29
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp7
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp260
-rw-r--r--src/corelib/io/qfilesystementry_p.h1
-rw-r--r--src/corelib/io/qfilesystemiterator_win.cpp5
-rw-r--r--src/corelib/io/qfilesystemmetadata_p.h16
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm8
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling_p.h6
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp10
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h6
-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.cpp45
-rw-r--r--src/corelib/io/qiodevice_p.h4
-rw-r--r--src/corelib/io/qipaddress_p.h7
-rw-r--r--src/corelib/io/qlockfile.cpp13
-rw-r--r--src/corelib/io/qlockfile_p.h1
-rw-r--r--src/corelib/io/qlockfile_unix.cpp4
-rw-r--r--src/corelib/io/qlockfile_win.cpp4
-rw-r--r--src/corelib/io/qloggingregistry_p.h1
-rw-r--r--src/corelib/io/qprocess.cpp14
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qprocess_win.cpp4
-rw-r--r--src/corelib/io/qprocess_wince.cpp308
-rw-r--r--src/corelib/io/qresource.cpp4
-rw-r--r--src/corelib/io/qsettings.cpp106
-rw-r--r--src/corelib/io/qsettings_mac.cpp55
-rw-r--r--src/corelib/io/qsettings_p.h4
-rw-r--r--src/corelib/io/qsettings_win.cpp10
-rw-r--r--src/corelib/io/qstandardpaths.h7
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm4
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp42
-rw-r--r--src/corelib/io/qstorageinfo_p.h3
-rw-r--r--src/corelib/io/qtemporaryfile.cpp27
-rw-r--r--src/corelib/io/qtemporaryfile_p.h5
-rw-r--r--src/corelib/io/qtextstream.cpp3
-rw-r--r--src/corelib/io/qtextstream_p.h1
-rw-r--r--src/corelib/io/qtldurl_p.h1
-rw-r--r--src/corelib/io/qurl.cpp62
-rw-r--r--src/corelib/io/qurl.h16
-rw-r--r--src/corelib/io/qurl_p.h1
-rw-r--r--src/corelib/io/qurltlds_p.h2
-rw-r--r--src/corelib/io/qwindowspipereader.cpp17
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp5
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h1
-rw-r--r--src/corelib/io/qwinoverlappedionotifier_p.h1
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp58
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h10
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel_p.h2
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h11
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp35
-rw-r--r--src/corelib/json/qjson.cpp4
-rw-r--r--src/corelib/json/qjson_p.h20
-rw-r--r--src/corelib/json/qjsondocument.cpp4
-rw-r--r--src/corelib/json/qjsonparser_p.h1
-rw-r--r--src/corelib/json/qjsonvalue.cpp3
-rw-r--r--src/corelib/json/qjsonwriter_p.h2
-rw-r--r--src/corelib/kernel/kernel.pri45
-rw-r--r--src/corelib/kernel/qcfsocketnotifier_p.h1
-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_mac_p.h2
-rw-r--r--src/corelib/kernel/qcore_unix_p.h5
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp45
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp34
-rw-r--r--src/corelib/kernel/qcorecmdlineargs_p.h89
-rw-r--r--src/corelib/kernel/qcoreglobaldata_p.h1
-rw-r--r--src/corelib/kernel/qcrashhandler_p.h2
-rw-r--r--src/corelib/kernel/qdeadlinetimer.cpp811
-rw-r--r--src/corelib/kernel/qdeadlinetimer.h191
-rw-r--r--src/corelib/kernel/qdeadlinetimer_p.h (renamed from src/corelib/io/qurl_mac.mm)54
-rw-r--r--src/corelib/kernel/qelapsedtimer.cpp (renamed from src/corelib/tools/qelapsedtimer.cpp)7
-rw-r--r--src/corelib/kernel/qelapsedtimer.h (renamed from src/corelib/tools/qelapsedtimer.h)0
-rw-r--r--src/corelib/kernel/qelapsedtimer_generic.cpp (renamed from src/corelib/tools/qelapsedtimer_generic.cpp)9
-rw-r--r--src/corelib/kernel/qelapsedtimer_mac.cpp (renamed from src/corelib/tools/qelapsedtimer_mac.cpp)29
-rw-r--r--src/corelib/kernel/qelapsedtimer_unix.cpp (renamed from src/corelib/tools/qelapsedtimer_unix.cpp)14
-rw-r--r--src/corelib/kernel/qelapsedtimer_win.cpp (renamed from src/corelib/tools/qelapsedtimer_win.cpp)71
-rw-r--r--src/corelib/kernel/qeventdispatcher_cf.mm16
-rw-r--r--src/corelib/kernel/qeventdispatcher_cf_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp266
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_winrt.cpp113
-rw-r--r--src/corelib/kernel/qeventdispatcher_winrt_p.h1
-rw-r--r--src/corelib/kernel/qeventloop_p.h1
-rw-r--r--src/corelib/kernel/qfunctions_fake_env_p.h6
-rw-r--r--src/corelib/kernel/qfunctions_p.h6
-rw-r--r--src/corelib/kernel/qfunctions_wince.cpp407
-rw-r--r--src/corelib/kernel/qfunctions_wince.h473
-rw-r--r--src/corelib/kernel/qjni_p.h2
-rw-r--r--src/corelib/kernel/qjnihelpers.cpp132
-rw-r--r--src/corelib/kernel/qjnihelpers_p.h14
-rw-r--r--src/corelib/kernel/qmath.h22
-rw-r--r--src/corelib/kernel/qmetaobject.cpp23
-rw-r--r--src/corelib/kernel/qmetaobject.h11
-rw-r--r--src/corelib/kernel/qmetaobject_moc_p.h2
-rw-r--r--src/corelib/kernel/qmetaobject_p.h15
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder_p.h1
-rw-r--r--src/corelib/kernel/qmetatype.cpp10
-rw-r--r--src/corelib/kernel/qmetatype.h23
-rw-r--r--src/corelib/kernel/qmetatype_p.h1
-rw-r--r--src/corelib/kernel/qmimedata.cpp4
-rw-r--r--src/corelib/kernel/qobject.cpp81
-rw-r--r--src/corelib/kernel/qobject.h4
-rw-r--r--src/corelib/kernel/qobject_impl.h16
-rw-r--r--src/corelib/kernel/qobject_p.h1
-rw-r--r--src/corelib/kernel/qobjectdefs.h11
-rw-r--r--src/corelib/kernel/qobjectdefs_impl.h46
-rw-r--r--src/corelib/kernel/qppsattribute_p.h1
-rw-r--r--src/corelib/kernel/qppsobject.cpp24
-rw-r--r--src/corelib/kernel/qsharedmemory_win.cpp8
-rw-r--r--src/corelib/kernel/qsystemerror.cpp25
-rw-r--r--src/corelib/kernel/qsystemerror_p.h1
-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.cpp72
-rw-r--r--src/corelib/kernel/qtimer.h99
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp3
-rw-r--r--src/corelib/kernel/qtimerinfo_unix_p.h2
-rw-r--r--src/corelib/kernel/qtranslator.cpp5
-rw-r--r--src/corelib/kernel/qtranslator_p.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp6
-rw-r--r--src/corelib/mimetypes/mimetypes.pri6
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern.cpp2
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern_p.h2
-rw-r--r--src/corelib/mimetypes/qmimemagicrule_p.h2
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp40
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp9
-rw-r--r--src/corelib/mimetypes/qmimetype_p.h1
-rw-r--r--src/corelib/mimetypes/qmimetypeparser.cpp2
-rw-r--r--src/corelib/plugin/plugin.pri4
-rw-r--r--src/corelib/plugin/qelfparser_p.h2
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp12
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h64
-rw-r--r--src/corelib/plugin/qlibrary.cpp8
-rw-r--r--src/corelib/plugin/qlibrary_p.h1
-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/qmachparser_p.h2
-rw-r--r--src/corelib/plugin/qpluginloader.cpp5
-rw-r--r--src/corelib/plugin/qsystemlibrary.cpp16
-rw-r--r--src/corelib/plugin/qsystemlibrary_p.h6
-rw-r--r--src/corelib/plugin/quuid.cpp37
-rw-r--r--src/corelib/plugin/quuid.h6
-rw-r--r--src/corelib/plugin/quuid_darwin.mm75
-rw-r--r--src/corelib/statemachine/qabstractstate_p.h8
-rw-r--r--src/corelib/statemachine/qhistorystate_p.h6
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h1
-rw-r--r--src/corelib/statemachine/qsignaltransition.h1
-rw-r--r--src/corelib/statemachine/qstate.h1
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp12
-rw-r--r--src/corelib/statemachine/qstatemachine.h2
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h6
-rw-r--r--src/corelib/statemachine/statemachine.pri10
-rw-r--r--src/corelib/thread/qfuture.h25
-rw-r--r--src/corelib/thread/qfutureinterface.h10
-rw-r--r--src/corelib/thread/qfutureinterface_p.h1
-rw-r--r--src/corelib/thread/qmutex.cpp55
-rw-r--r--src/corelib/thread/qmutex.h57
-rw-r--r--src/corelib/thread/qmutex_p.h2
-rw-r--r--src/corelib/thread/qmutex_win.cpp4
-rw-r--r--src/corelib/thread/qmutexpool_p.h5
-rw-r--r--src/corelib/thread/qorderedmutexlocker_p.h1
-rw-r--r--src/corelib/thread/qreadwritelock_p.h2
-rw-r--r--src/corelib/thread/qthread.cpp4
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
-rw-r--r--src/corelib/thread/qthread_win.cpp44
-rw-r--r--src/corelib/thread/qwaitcondition.h3
-rw-r--r--src/corelib/thread/qwaitcondition.qdoc15
-rw-r--r--src/corelib/thread/qwaitcondition_win.cpp5
-rw-r--r--src/corelib/tools/qalgorithms.h209
-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/qbytedata_p.h1
-rw-r--r--src/corelib/tools/qchar.h12
-rw-r--r--src/corelib/tools/qcollator_p.h1
-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.cpp1051
-rw-r--r--src/corelib/tools/qdatetime.h89
-rw-r--r--src/corelib/tools/qdatetime_p.h71
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp11
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h1
-rw-r--r--src/corelib/tools/qfreelist_p.h1
-rw-r--r--src/corelib/tools/qharfbuzz_p.h2
-rw-r--r--src/corelib/tools/qhash.cpp20
-rw-r--r--src/corelib/tools/qhash.h21
-rw-r--r--src/corelib/tools/qline.cpp23
-rw-r--r--src/corelib/tools/qline.h14
-rw-r--r--src/corelib/tools/qlinkedlist.h16
-rw-r--r--src/corelib/tools/qlist.h5
-rw-r--r--src/corelib/tools/qlocale.cpp1
-rw-r--r--src/corelib/tools/qlocale_data_p.h2
-rw-r--r--src/corelib/tools/qlocale_mac.mm3
-rw-r--r--src/corelib/tools/qlocale_p.h1
-rw-r--r--src/corelib/tools/qlocale_win.cpp122
-rw-r--r--src/corelib/tools/qpodlist_p.h1
-rw-r--r--src/corelib/tools/qpoint.h13
-rw-r--r--src/corelib/tools/qrect.h13
-rw-r--r--src/corelib/tools/qregexp.cpp6
-rw-r--r--src/corelib/tools/qringbuffer.cpp46
-rw-r--r--src/corelib/tools/qringbuffer_p.h9
-rw-r--r--src/corelib/tools/qscopedpointer.cpp42
-rw-r--r--src/corelib/tools/qscopedpointer.h45
-rw-r--r--src/corelib/tools/qscopedpointer_p.h2
-rw-r--r--src/corelib/tools/qsharedpointer.cpp112
-rw-r--r--src/corelib/tools/qsharedpointer.h14
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h162
-rw-r--r--src/corelib/tools/qsimd.cpp29
-rw-r--r--src/corelib/tools/qsimd_p.h66
-rw-r--r--src/corelib/tools/qsize.h13
-rw-r--r--src/corelib/tools/qstring.cpp248
-rw-r--r--src/corelib/tools/qstring.h213
-rw-r--r--src/corelib/tools/qstringiterator_p.h1
-rw-r--r--src/corelib/tools/qstringlist.cpp40
-rw-r--r--src/corelib/tools/qstringlist.h9
-rw-r--r--src/corelib/tools/qtimezoneprivate_data_p.h2
-rw-r--r--src/corelib/tools/qtimezoneprivate_win.cpp6
-rw-r--r--src/corelib/tools/qtools_p.h2
-rw-r--r--src/corelib/tools/qunicodetables_p.h2
-rw-r--r--src/corelib/tools/qunicodetools.cpp4
-rw-r--r--src/corelib/tools/qunicodetools_p.h1
-rw-r--r--src/corelib/tools/tools.pri36
-rw-r--r--src/corelib/xml/qxmlstream.cpp24
-rw-r--r--src/corelib/xml/qxmlstream_p.h16
-rw-r--r--src/corelib/xml/qxmlutils_p.h1
-rw-r--r--src/dbus/dbus.pro17
-rw-r--r--src/dbus/qdbus_symbols_p.h2
-rw-r--r--src/dbus/qdbusabstractadaptor.h2
-rw-r--r--src/dbus/qdbusabstractadaptor_p.h1
-rw-r--r--src/dbus/qdbusabstractinterface.h1
-rw-r--r--src/dbus/qdbusabstractinterface_p.h1
-rw-r--r--src/dbus/qdbusargument.h2
-rw-r--r--src/dbus/qdbusargument_p.h1
-rw-r--r--src/dbus/qdbusconnection.cpp35
-rw-r--r--src/dbus/qdbusconnection.h2
-rw-r--r--src/dbus/qdbusconnection_p.h5
-rw-r--r--src/dbus/qdbusconnectioninterface.h1
-rw-r--r--src/dbus/qdbusconnectionmanager_p.h1
-rw-r--r--src/dbus/qdbuscontext.h1
-rw-r--r--src/dbus/qdbuscontext_p.h2
-rw-r--r--src/dbus/qdbuserror.h2
-rw-r--r--src/dbus/qdbusextratypes.h2
-rw-r--r--src/dbus/qdbusintegrator.cpp13
-rw-r--r--src/dbus/qdbusintegrator_p.h1
-rw-r--r--src/dbus/qdbusinterface.h1
-rw-r--r--src/dbus/qdbusinterface_p.h1
-rw-r--r--src/dbus/qdbusinternalfilters.cpp6
-rw-r--r--src/dbus/qdbusintrospection_p.h2
-rw-r--r--src/dbus/qdbusmarshaller.cpp8
-rw-r--r--src/dbus/qdbusmessage.h2
-rw-r--r--src/dbus/qdbusmessage_p.h1
-rw-r--r--src/dbus/qdbusmetaobject_p.h8
-rw-r--r--src/dbus/qdbusmetatype.cpp2
-rw-r--r--src/dbus/qdbusmetatype.h1
-rw-r--r--src/dbus/qdbusmetatype_p.h1
-rw-r--r--src/dbus/qdbuspendingcall.h6
-rw-r--r--src/dbus/qdbuspendingcall_p.h1
-rw-r--r--src/dbus/qdbuspendingreply.h3
-rw-r--r--src/dbus/qdbusreply.h3
-rw-r--r--src/dbus/qdbusserver.h2
-rw-r--r--src/dbus/qdbusservicewatcher.h4
-rw-r--r--src/dbus/qdbusthreaddebug_p.h2
-rw-r--r--src/dbus/qdbusunixfiledescriptor.h2
-rw-r--r--src/dbus/qdbusutil_p.h5
-rw-r--r--src/dbus/qdbusvirtualobject.h4
-rw-r--r--src/dbus/qdbusxmlgenerator.cpp6
-rw-r--r--src/dbus/qdbusxmlparser.cpp11
-rw-r--r--src/dbus/qdbusxmlparser_p.h5
-rw-r--r--src/dbus/qtdbusglobal.h (renamed from src/dbus/qdbusmacros.h)4
-rw-r--r--src/dbus/qtdbusglobal_p.h (renamed from config.tests/x11/notype/notypetest.cpp)27
-rw-r--r--src/gui/accessible/accessible.pri2
-rw-r--r--src/gui/accessible/qaccessible.h2
-rw-r--r--src/gui/accessible/qaccessiblebridge.h1
-rw-r--r--src/gui/accessible/qaccessiblecache_p.h2
-rw-r--r--src/gui/accessible/qaccessibleobject.h1
-rw-r--r--src/gui/accessible/qaccessibleplugin.h1
-rw-r--r--src/gui/accessible/qplatformaccessibility.h4
-rw-r--r--src/gui/animation/qguivariantanimation.cpp5
-rw-r--r--src/gui/configure.json1095
-rw-r--r--src/gui/configure.pri67
-rw-r--r--src/gui/doc/src/qtgui.qdoc13
-rw-r--r--src/gui/gui.pro16
-rw-r--r--src/gui/image/image.pri14
-rw-r--r--src/gui/image/qbitmap.h1
-rw-r--r--src/gui/image/qbmphandler_p.h1
-rw-r--r--src/gui/image/qgifhandler.pri3
-rw-r--r--src/gui/image/qicon.h2
-rw-r--r--src/gui/image/qicon_p.h2
-rw-r--r--src/gui/image/qiconengine.h2
-rw-r--r--src/gui/image/qiconengineplugin.h1
-rw-r--r--src/gui/image/qiconloader.cpp38
-rw-r--r--src/gui/image/qiconloader_p.h2
-rw-r--r--src/gui/image/qimage.cpp79
-rw-r--r--src/gui/image/qimage.h10
-rw-r--r--src/gui/image/qimage_conversions.cpp43
-rw-r--r--src/gui/image/qimage_darwin.mm141
-rw-r--r--src/gui/image/qimage_p.h5
-rw-r--r--src/gui/image/qimage_sse4.cpp2
-rw-r--r--src/gui/image/qimageiohandler.h1
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h1
-rw-r--r--src/gui/image/qimagereader.cpp71
-rw-r--r--src/gui/image/qimagereader.h1
-rw-r--r--src/gui/image/qimagewriter.cpp25
-rw-r--r--src/gui/image/qimagewriter.h1
-rw-r--r--src/gui/image/qjpeghandler.pri11
-rw-r--r--src/gui/image/qmovie.h3
-rw-r--r--src/gui/image/qpaintengine_pic_p.h10
-rw-r--r--src/gui/image/qpicture.h1
-rw-r--r--src/gui/image/qpicture_p.h1
-rw-r--r--src/gui/image/qpictureformatplugin.h1
-rw-r--r--src/gui/image/qpixmap.cpp14
-rw-r--r--src/gui/image/qpixmap.h1
-rw-r--r--src/gui/image/qpixmap_blitter.cpp12
-rw-r--r--src/gui/image/qpixmap_blitter_p.h1
-rw-r--r--src/gui/image/qpixmap_raster.cpp21
-rw-r--r--src/gui/image/qpixmap_raster_p.h2
-rw-r--r--src/gui/image/qpixmap_win.cpp170
-rw-r--r--src/gui/image/qpixmapcache.h1
-rw-r--r--src/gui/image/qpixmapcache_p.h1
-rw-r--r--src/gui/image/qplatformpixmap.h1
-rw-r--r--src/gui/image/qpnghandler.cpp49
-rw-r--r--src/gui/image/qpnghandler.pri4
-rw-r--r--src/gui/image/qpnghandler_p.h7
-rw-r--r--src/gui/image/qppmhandler_p.h7
-rw-r--r--src/gui/image/qxbmhandler_p.h7
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/image/qxpmhandler_p.h7
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp48
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h1
-rw-r--r--src/gui/itemmodels/qstandarditemmodel_p.h1
-rw-r--r--src/gui/kernel/kernel.pri4
-rw-r--r--src/gui/kernel/qclipboard.cpp8
-rw-r--r--src/gui/kernel/qclipboard.h1
-rw-r--r--src/gui/kernel/qcursor.h1
-rw-r--r--src/gui/kernel/qcursor_p.h2
-rw-r--r--src/gui/kernel/qdnd.cpp35
-rw-r--r--src/gui/kernel/qdnd_p.h1
-rw-r--r--src/gui/kernel/qdrag.h1
-rw-r--r--src/gui/kernel/qevent.cpp139
-rw-r--r--src/gui/kernel/qevent.h31
-rw-r--r--src/gui/kernel/qevent_p.h7
-rw-r--r--src/gui/kernel/qgenericplugin.h1
-rw-r--r--src/gui/kernel/qgenericpluginfactory.h1
-rw-r--r--src/gui/kernel/qguiapplication.cpp56
-rw-r--r--src/gui/kernel/qguiapplication.h4
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qguivariant.cpp3
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp9
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h10
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h1
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h1
-rw-r--r--src/gui/kernel/qinputmethod.h1
-rw-r--r--src/gui/kernel/qinputmethod_p.h1
-rw-r--r--src/gui/kernel/qkeymapper_p.h1
-rw-r--r--src/gui/kernel/qkeysequence.cpp10
-rw-r--r--src/gui/kernel/qkeysequence.h2
-rw-r--r--src/gui/kernel/qkeysequence_p.h1
-rw-r--r--src/gui/kernel/qoffscreensurface.h1
-rw-r--r--src/gui/kernel/qopenglcontext.cpp15
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qopenglwindow.cpp2
-rw-r--r--src/gui/kernel/qopenglwindow.h2
-rw-r--r--src/gui/kernel/qpaintdevicewindow.cpp3
-rw-r--r--src/gui/kernel/qpaintdevicewindow.h1
-rw-r--r--src/gui/kernel/qpaintdevicewindow_p.h1
-rw-r--r--src/gui/kernel/qpalette.h1
-rw-r--r--src/gui/kernel/qpixelformat.h2
-rw-r--r--src/gui/kernel/qplatformclipboard.h2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp10
-rw-r--r--src/gui/kernel/qplatformcursor.h9
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp95
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h70
-rw-r--r--src/gui/kernel/qplatformdrag.h2
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.h1
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h1
-rw-r--r--src/gui/kernel/qplatforminputcontext.h1
-rw-r--r--src/gui/kernel/qplatforminputcontext_p.h1
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory_p.h1
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin_p.h1
-rw-r--r--src/gui/kernel/qplatformintegration.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.h4
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_p.h1
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.h1
-rw-r--r--src/gui/kernel/qplatformmenu.h4
-rw-r--r--src/gui/kernel/qplatformnativeinterface.h1
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h1
-rw-r--r--src/gui/kernel/qplatformopenglcontext.h1
-rw-r--r--src/gui/kernel/qplatformscreen.h1
-rw-r--r--src/gui/kernel/qplatformscreen_p.h2
-rw-r--r--src/gui/kernel/qplatformservices.h2
-rw-r--r--src/gui/kernel/qplatformsessionmanager.h1
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.h1
-rw-r--r--src/gui/kernel/qplatformsurface.h1
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.h1
-rw-r--r--src/gui/kernel/qplatformtheme.cpp25
-rw-r--r--src/gui/kernel/qplatformtheme.h13
-rw-r--r--src/gui/kernel/qplatformtheme_p.h4
-rw-r--r--src/gui/kernel/qplatformthemefactory_p.h1
-rw-r--r--src/gui/kernel/qplatformthemeplugin.h1
-rw-r--r--src/gui/kernel/qplatformwindow.h1
-rw-r--r--src/gui/kernel/qplatformwindow_p.h1
-rw-r--r--src/gui/kernel/qrasterwindow.h1
-rw-r--r--src/gui/kernel/qscreen.cpp4
-rw-r--r--src/gui/kernel/qscreen.h1
-rw-r--r--src/gui/kernel/qscreen_p.h1
-rw-r--r--src/gui/kernel/qsessionmanager.h1
-rw-r--r--src/gui/kernel/qsessionmanager_p.h1
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h1
-rw-r--r--src/gui/kernel/qshortcutmap_p.h1
-rw-r--r--src/gui/kernel/qsimpledrag_p.h1
-rw-r--r--src/gui/kernel/qstylehints.cpp32
-rw-r--r--src/gui/kernel/qstylehints.h5
-rw-r--r--src/gui/kernel/qsurface.h1
-rw-r--r--src/gui/kernel/qsurfaceformat.h8
-rw-r--r--src/gui/kernel/qt_gui_pch.h2
-rw-r--r--src/gui/kernel/qtguiglobal.h (renamed from src/plugins/platforms/eglfs/qeglfshooks.h)26
-rw-r--r--src/gui/kernel/qtguiglobal_p.h58
-rw-r--r--src/gui/kernel/qtouchdevice.h1
-rw-r--r--src/gui/kernel/qtouchdevice_p.h1
-rw-r--r--src/gui/kernel/qwindow.cpp13
-rw-r--r--src/gui/kernel/qwindow.h1
-rw-r--r--src/gui/kernel/qwindow_p.h1
-rw-r--r--src/gui/kernel/qwindowdefs.h2
-rw-r--r--src/gui/kernel/qwindowdefs_win.h11
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp22
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h5
-rw-r--r--src/gui/math3d/qgenericmatrix.h1
-rw-r--r--src/gui/math3d/qmatrix4x4.h1
-rw-r--r--src/gui/math3d/qquaternion.h1
-rw-r--r--src/gui/math3d/qvector2d.h1
-rw-r--r--src/gui/math3d/qvector3d.h1
-rw-r--r--src/gui/math3d/qvector4d.h1
-rw-r--r--src/gui/opengl/opengl.pri17
-rw-r--r--src/gui/opengl/qopengl.h28
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray_p.h1
-rw-r--r--src/gui/opengl/qopengl_p.h1
-rw-r--r--src/gui/opengl/qopenglbuffer.h2
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage_p.h2
-rw-r--r--src/gui/opengl/qopengldebug.h2
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp4
-rw-r--r--src/gui/opengl/qopenglengineshadermanager_p.h1
-rw-r--r--src/gui/opengl/qopenglengineshadersource_p.h1
-rw-r--r--src/gui/opengl/qopenglextensions_p.h1
-rw-r--r--src/gui/opengl/qopenglextrafunctions.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp9
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h7
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.cpp10
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.cpp20
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.cpp30
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.cpp40
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.cpp50
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.cpp55
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp60
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp65
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp70
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.cpp50
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp80
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.cpp55
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp90
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.cpp60
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp95
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.cpp65
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp100
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.cpp70
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp105
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.cpp75
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp110
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.cpp80
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp115
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.cpp85
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp125
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.cpp90
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_es2.h2
-rw-r--r--src/gui/opengl/qopenglgradientcache_p.h1
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h2
-rw-r--r--src/gui/opengl/qopenglpaintdevice_p.h1
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp6
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h1
-rw-r--r--src/gui/opengl/qopenglpixeltransferoptions.h2
-rw-r--r--src/gui/opengl/qopenglqueryhelper_p.h2
-rw-r--r--src/gui/opengl/qopenglshadercache_p.h2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp17
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h2
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/opengl/qopengltexture.h2
-rw-r--r--src/gui/opengl/qopengltexture_p.h1
-rw-r--r--src/gui/opengl/qopengltextureblitter.cpp194
-rw-r--r--src/gui/opengl/qopengltextureblitter.h (renamed from src/gui/opengl/qopengltextureblitter_p.h)27
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h1
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h7
-rw-r--r--src/gui/opengl/qopengltexturehelper_p.h2
-rw-r--r--src/gui/opengl/qopengltimerquery.h2
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h2
-rw-r--r--src/gui/opengl/qopenglversionfunctionsfactory_p.h3
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.h2
-rw-r--r--src/gui/painting/painting.pri15
-rw-r--r--src/gui/painting/qbackingstore.cpp1
-rw-r--r--src/gui/painting/qbackingstore.h1
-rw-r--r--src/gui/painting/qbezier_p.h1
-rw-r--r--src/gui/painting/qblendfunctions_p.h1
-rw-r--r--src/gui/painting/qblittable_p.h1
-rw-r--r--src/gui/painting/qbrush.cpp59
-rw-r--r--src/gui/painting/qbrush.h1
-rw-r--r--src/gui/painting/qcolor.cpp366
-rw-r--r--src/gui/painting/qcolor.h15
-rw-r--r--src/gui/painting/qcolor_p.cpp381
-rw-r--r--src/gui/painting/qcolor_p.h8
-rw-r--r--src/gui/painting/qcompositionfunctions.cpp104
-rw-r--r--src/gui/painting/qcoregraphics.mm565
-rw-r--r--src/gui/painting/qcoregraphics_p.h121
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h1
-rw-r--r--src/gui/painting/qcssutil.cpp2
-rw-r--r--src/gui/painting/qdatabuffer_p.h1
-rw-r--r--src/gui/painting/qdrawhelper.cpp1420
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp309
-rw-r--r--src/gui/painting/qdrawhelper_p.h28
-rw-r--r--src/gui/painting/qdrawhelper_sse4.cpp16
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp9
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h1
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h25
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h1
-rw-r--r--src/gui/painting/qfixed_p.h1
-rw-r--r--src/gui/painting/qmatrix.h1
-rw-r--r--src/gui/painting/qmemrotate_p.h1
-rw-r--r--src/gui/painting/qoutlinemapper_p.h1
-rw-r--r--src/gui/painting/qpagedpaintdevice.h1
-rw-r--r--src/gui/painting/qpagedpaintdevice_p.h1
-rw-r--r--src/gui/painting/qpagelayout.h1
-rw-r--r--src/gui/painting/qpagesize.cpp2
-rw-r--r--src/gui/painting/qpagesize.h1
-rw-r--r--src/gui/painting/qpaintdevice.h1
-rw-r--r--src/gui/painting/qpaintengine.h1
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp18
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h1
-rw-r--r--src/gui/painting/qpaintengine_p.h6
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h1
-rw-r--r--src/gui/painting/qpaintengineex_p.h1
-rw-r--r--src/gui/painting/qpainter.cpp10
-rw-r--r--src/gui/painting/qpainter.h1
-rw-r--r--src/gui/painting/qpainter_p.h1
-rw-r--r--src/gui/painting/qpainterpath.cpp7
-rw-r--r--src/gui/painting/qpainterpath.h1
-rw-r--r--src/gui/painting/qpainterpath_p.h1
-rw-r--r--src/gui/painting/qpathclipper.cpp4
-rw-r--r--src/gui/painting/qpathclipper_p.h1
-rw-r--r--src/gui/painting/qpathsimplifier_p.h1
-rw-r--r--src/gui/painting/qpdf.cpp9
-rw-r--r--src/gui/painting/qpdf_p.h2
-rw-r--r--src/gui/painting/qpdfwriter.h2
-rw-r--r--src/gui/painting/qpen.h1
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp38
-rw-r--r--src/gui/painting/qplatformbackingstore.h7
-rw-r--r--src/gui/painting/qpolygon.cpp15
-rw-r--r--src/gui/painting/qpolygon.h1
-rw-r--r--src/gui/painting/qpolygonclipper_p.h1
-rw-r--r--src/gui/painting/qrasterizer_p.h2
-rw-r--r--src/gui/painting/qrbtree_p.h (renamed from src/gui/opengl/qrbtree_p.h)2
-rw-r--r--src/gui/painting/qregion.cpp160
-rw-r--r--src/gui/painting/qregion.h18
-rw-r--r--src/gui/painting/qrgb.h2
-rw-r--r--src/gui/painting/qrgba64.h2
-rw-r--r--src/gui/painting/qrgba64_p.h101
-rw-r--r--src/gui/painting/qstroker_p.h1
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp3
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h3
-rw-r--r--src/gui/painting/qtransform.cpp12
-rw-r--r--src/gui/painting/qtransform.h1
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp (renamed from src/gui/opengl/qtriangulatingstroker.cpp)0
-rw-r--r--src/gui/painting/qtriangulatingstroker_p.h (renamed from src/gui/opengl/qtriangulatingstroker_p.h)1
-rw-r--r--src/gui/painting/qtriangulator.cpp (renamed from src/gui/opengl/qtriangulator.cpp)17
-rw-r--r--src/gui/painting/qtriangulator_p.h (renamed from src/gui/opengl/qtriangulator_p.h)1
-rw-r--r--src/gui/painting/qvectorpath_p.h1
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp28
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h4
-rw-r--r--src/gui/text/qabstracttextdocumentlayout_p.h1
-rw-r--r--src/gui/text/qcssparser.cpp93
-rw-r--r--src/gui/text/qcssparser_p.h23
-rw-r--r--src/gui/text/qcssscanner.cpp863
-rw-r--r--src/gui/text/qdistancefield.cpp70
-rw-r--r--src/gui/text/qdistancefield_p.h24
-rw-r--r--src/gui/text/qfont.cpp29
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfont_p.h3
-rw-r--r--src/gui/text/qfontdatabase.cpp36
-rw-r--r--src/gui/text/qfontdatabase.h1
-rw-r--r--src/gui/text/qfontengine.cpp27
-rw-r--r--src/gui/text/qfontengine_ft.cpp55
-rw-r--r--src/gui/text/qfontengine_ft_p.h1
-rw-r--r--src/gui/text/qfontengine_p.h6
-rw-r--r--src/gui/text/qfontengine_qpf2.cpp5
-rw-r--r--src/gui/text/qfontengine_qpf2_p.h1
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h2
-rw-r--r--src/gui/text/qfontinfo.h1
-rw-r--r--src/gui/text/qfontmetrics.cpp36
-rw-r--r--src/gui/text/qfontmetrics.h3
-rw-r--r--src/gui/text/qfontsubset.cpp4
-rw-r--r--src/gui/text/qfontsubset_p.h1
-rw-r--r--src/gui/text/qfragmentmap_p.h2
-rw-r--r--src/gui/text/qglyphrun.h1
-rw-r--r--src/gui/text/qglyphrun_p.h1
-rw-r--r--src/gui/text/qharfbuzzng_p.h1
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp6
-rw-r--r--src/gui/text/qplatformfontdatabase.h2
-rw-r--r--src/gui/text/qrawfont.cpp30
-rw-r--r--src/gui/text/qrawfont.h2
-rw-r--r--src/gui/text/qrawfont_p.h1
-rw-r--r--src/gui/text/qstatictext.h1
-rw-r--r--src/gui/text/qstatictext_p.h1
-rw-r--r--src/gui/text/qsyntaxhighlighter.h2
-rw-r--r--src/gui/text/qtextcursor.cpp8
-rw-r--r--src/gui/text/qtextcursor.h1
-rw-r--r--src/gui/text/qtextcursor_p.h1
-rw-r--r--src/gui/text/qtextdocument.cpp8
-rw-r--r--src/gui/text/qtextdocument.h1
-rw-r--r--src/gui/text/qtextdocument_p.cpp15
-rw-r--r--src/gui/text/qtextdocument_p.h6
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp2
-rw-r--r--src/gui/text/qtextdocumentfragment.h1
-rw-r--r--src/gui/text/qtextdocumentfragment_p.h1
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp13
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h1
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp5
-rw-r--r--src/gui/text/qtextdocumentwriter.h1
-rw-r--r--src/gui/text/qtextengine.cpp28
-rw-r--r--src/gui/text/qtextengine_p.h2
-rw-r--r--src/gui/text/qtextformat.h1
-rw-r--r--src/gui/text/qtextformat_p.h1
-rw-r--r--src/gui/text/qtexthtmlparser.cpp6
-rw-r--r--src/gui/text/qtexthtmlparser_p.h1
-rw-r--r--src/gui/text/qtextimagehandler.cpp4
-rw-r--r--src/gui/text/qtextimagehandler_p.h1
-rw-r--r--src/gui/text/qtextlayout.cpp6
-rw-r--r--src/gui/text/qtextlayout.h1
-rw-r--r--src/gui/text/qtextlist.h1
-rw-r--r--src/gui/text/qtextobject.h1
-rw-r--r--src/gui/text/qtextobject_p.h1
-rw-r--r--src/gui/text/qtextodfwriter.cpp6
-rw-r--r--src/gui/text/qtextodfwriter_p.h8
-rw-r--r--src/gui/text/qtextoption.h1
-rw-r--r--src/gui/text/qtexttable.h2
-rw-r--r--src/gui/text/qtexttable_p.h1
-rw-r--r--src/gui/text/qzip.cpp10
-rw-r--r--src/gui/text/qzipreader_p.h1
-rw-r--r--src/gui/text/qzipwriter_p.h2
-rw-r--r--src/gui/text/text.pri2
-rw-r--r--src/gui/util/qabstractlayoutstyleinfo_p.h1
-rw-r--r--src/gui/util/qdesktopservices.h1
-rw-r--r--src/gui/util/qgridlayoutengine_p.h1
-rw-r--r--src/gui/util/qhexstring_p.h2
-rw-r--r--src/gui/util/qlayoutpolicy_p.h1
-rw-r--r--src/gui/util/qvalidator.cpp15
-rw-r--r--src/gui/util/qvalidator.h1
-rw-r--r--src/network/access/access.pri9
-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.pri17
-rw-r--r--src/network/access/http2/http2frames.cpp495
-rw-r--r--src/network/access/http2/http2frames_p.h185
-rw-r--r--src/network/access/http2/http2protocol.cpp156
-rw-r--r--src/network/access/http2/http2protocol_p.h175
-rw-r--r--src/network/access/http2/http2streams.cpp (renamed from src/corelib/tools/qdatetime_mac.mm)68
-rw-r--r--src/network/access/http2/http2streams_p.h102
-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/qabstractnetworkcache.h1
-rw-r--r--src/network/access/qabstractnetworkcache_p.h1
-rw-r--r--src/network/access/qabstractprotocolhandler_p.h4
-rw-r--r--src/network/access/qftp.cpp2
-rw-r--r--src/network/access/qftp_p.h7
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp1218
-rw-r--r--src/network/access/qhttp2protocolhandler_p.h208
-rw-r--r--src/network/access/qhttpmultipart.h1
-rw-r--r--src/network/access/qhttpmultipart_p.h1
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp18
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h21
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp78
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h9
-rw-r--r--src/network/access/qhttpnetworkheader_p.h3
-rw-r--r--src/network/access/qhttpnetworkreply.cpp5
-rw-r--r--src/network/access/qhttpnetworkreply_p.h7
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp14
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h7
-rw-r--r--src/network/access/qhttpprotocolhandler.cpp7
-rw-r--r--src/network/access/qhttpprotocolhandler_p.h1
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp11
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h1
-rw-r--r--src/network/access/qnetworkaccessauthenticationmanager_p.h1
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccesscache_p.h1
-rw-r--r--src/network/access/qnetworkaccesscachebackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessfilebackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessftpbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp81
-rw-r--r--src/network/access/qnetworkaccessmanager.h4
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h8
-rw-r--r--src/network/access/qnetworkcookie.cpp4
-rw-r--r--src/network/access/qnetworkcookie.h1
-rw-r--r--src/network/access/qnetworkcookie_p.h1
-rw-r--r--src/network/access/qnetworkcookiejar.h1
-rw-r--r--src/network/access/qnetworkcookiejar_p.h1
-rw-r--r--src/network/access/qnetworkdiskcache.cpp2
-rw-r--r--src/network/access/qnetworkdiskcache.h1
-rw-r--r--src/network/access/qnetworkdiskcache_p.h1
-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.h80
-rw-r--r--src/network/access/qnetworkreply.h1
-rw-r--r--src/network/access/qnetworkreply_p.h1
-rw-r--r--src/network/access/qnetworkreplydataimpl_p.h1
-rw-r--r--src/network/access/qnetworkreplyfileimpl.cpp150
-rw-r--r--src/network/access/qnetworkreplyfileimpl_p.h13
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp48
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h1
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h1
-rw-r--r--src/network/access/qnetworkrequest.cpp8
-rw-r--r--src/network/access/qnetworkrequest.h3
-rw-r--r--src/network/access/qnetworkrequest_p.h1
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp8
-rw-r--r--src/network/access/qspdyprotocolhandler_p.h1
-rw-r--r--src/network/bearer/qbearerengine_p.h1
-rw-r--r--src/network/bearer/qbearerplugin_p.h1
-rw-r--r--src/network/bearer/qnetworkconfigmanager.h1
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.h1
-rw-r--r--src/network/bearer/qnetworkconfiguration.h2
-rw-r--r--src/network/bearer/qnetworkconfiguration_p.h1
-rw-r--r--src/network/bearer/qnetworksession.h1
-rw-r--r--src/network/bearer/qnetworksession_p.h1
-rw-r--r--src/network/bearer/qsharednetworksession_p.h1
-rw-r--r--src/network/configure.json274
-rw-r--r--src/network/configure.pri12
-rw-r--r--src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp53
-rw-r--r--src/network/doc/snippets/code/src_network_socket_qudpsocket.cpp9
-rw-r--r--src/network/kernel/kernel.pri21
-rw-r--r--src/network/kernel/qauthenticator.cpp14
-rw-r--r--src/network/kernel/qauthenticator.h1
-rw-r--r--src/network/kernel/qauthenticator_p.h1
-rw-r--r--src/network/kernel/qdnslookup.h1
-rw-r--r--src/network/kernel/qdnslookup_p.h1
-rw-r--r--src/network/kernel/qhostaddress.cpp122
-rw-r--r--src/network/kernel/qhostaddress.h13
-rw-r--r--src/network/kernel/qhostaddress_p.h1
-rw-r--r--src/network/kernel/qhostinfo.h1
-rw-r--r--src/network/kernel/qhostinfo_p.h1
-rw-r--r--src/network/kernel/qhostinfo_win.cpp11
-rw-r--r--src/network/kernel/qnetworkdatagram.cpp535
-rw-r--r--src/network/kernel/qnetworkdatagram.h123
-rw-r--r--src/network/kernel/qnetworkdatagram_p.h23
-rw-r--r--src/network/kernel/qnetworkfunctions_wince.h96
-rw-r--r--src/network/kernel/qnetworkinterface.cpp4
-rw-r--r--src/network/kernel/qnetworkinterface.h1
-rw-r--r--src/network/kernel/qnetworkinterface_p.h7
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp2
-rw-r--r--src/network/kernel/qnetworkinterface_win.cpp8
-rw-r--r--src/network/kernel/qnetworkproxy.cpp37
-rw-r--r--src/network/kernel/qnetworkproxy.h9
-rw-r--r--src/network/kernel/qnetworkproxy_generic.cpp2
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp131
-rw-r--r--src/network/kernel/qnetworkproxy_p.h9
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp30
-rw-r--r--src/network/kernel/qtnetworkglobal.h (renamed from config.tests/unix/openvg/openvg.cpp)34
-rw-r--r--src/network/kernel/qtnetworkglobal_p.h58
-rw-r--r--src/network/kernel/qurlinfo_p.h1
-rw-r--r--src/network/network.pro1
-rw-r--r--src/network/socket/qabstractsocket.cpp157
-rw-r--r--src/network/socket/qabstractsocket.h2
-rw-r--r--src/network/socket/qabstractsocket_p.h12
-rw-r--r--src/network/socket/qabstractsocketengine_p.h12
-rw-r--r--src/network/socket/qhttpsocketengine.cpp22
-rw-r--r--src/network/socket/qhttpsocketengine_p.h7
-rw-r--r--src/network/socket/qlocalserver.h1
-rw-r--r--src/network/socket/qlocalserver_p.h2
-rw-r--r--src/network/socket/qlocalsocket.h1
-rw-r--r--src/network/socket/qlocalsocket_p.h2
-rw-r--r--src/network/socket/qnativesocketengine.cpp126
-rw-r--r--src/network/socket/qnativesocketengine_p.h28
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp182
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp59
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp18
-rw-r--r--src/network/socket/qnativesocketengine_winrt_p.h2
-rw-r--r--src/network/socket/qnet_unix_p.h1
-rw-r--r--src/network/socket/qsctpserver.cpp250
-rw-r--r--src/network/socket/qsctpserver.h77
-rw-r--r--src/network/socket/qsctpserver_p.h76
-rw-r--r--src/network/socket/qsctpsocket.cpp547
-rw-r--r--src/network/socket/qsctpsocket.h82
-rw-r--r--src/network/socket/qsctpsocket_p.h90
-rw-r--r--src/network/socket/qsocks5socketengine.cpp66
-rw-r--r--src/network/socket/qsocks5socketengine_p.h7
-rw-r--r--src/network/socket/qtcpserver.cpp39
-rw-r--r--src/network/socket/qtcpserver.h4
-rw-r--r--src/network/socket/qtcpserver_p.h9
-rw-r--r--src/network/socket/qtcpsocket.h1
-rw-r--r--src/network/socket/qtcpsocket_p.h7
-rw-r--r--src/network/socket/qudpsocket.cpp126
-rw-r--r--src/network/socket/qudpsocket.h5
-rw-r--r--src/network/socket/socket.pri29
-rw-r--r--src/network/ssl/qasn1element_p.h7
-rw-r--r--src/network/ssl/qssl.h2
-rw-r--r--src/network/ssl/qssl_p.h1
-rw-r--r--src/network/ssl/qsslcertificate.cpp2
-rw-r--r--src/network/ssl/qsslcertificate.h1
-rw-r--r--src/network/ssl/qsslcertificate_p.h7
-rw-r--r--src/network/ssl/qsslcertificateextension.h1
-rw-r--r--src/network/ssl/qsslcertificateextension_p.h1
-rw-r--r--src/network/ssl/qsslcipher.h1
-rw-r--r--src/network/ssl/qsslcipher_p.h1
-rw-r--r--src/network/ssl/qsslconfiguration.cpp78
-rw-r--r--src/network/ssl/qsslconfiguration.h9
-rw-r--r--src/network/ssl/qsslconfiguration_p.h8
-rw-r--r--src/network/ssl/qsslcontext_openssl.cpp61
-rw-r--r--src/network/ssl/qsslcontext_openssl_p.h1
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.cpp324
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.h118
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters_dummy.cpp (renamed from config.tests/x11/xsync/xsync.cpp)31
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters_openssl.cpp164
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters_p.h78
-rw-r--r--src/network/ssl/qsslellipticcurve.h2
-rw-r--r--src/network/ssl/qsslerror.h1
-rw-r--r--src/network/ssl/qsslkey.h1
-rw-r--r--src/network/ssl/qsslkey_p.cpp16
-rw-r--r--src/network/ssl/qsslkey_p.h4
-rw-r--r--src/network/ssl/qsslpresharedkeyauthenticator.h2
-rw-r--r--src/network/ssl/qsslpresharedkeyauthenticator_p.h1
-rw-r--r--src/network/ssl/qsslsocket.cpp28
-rw-r--r--src/network/ssl/qsslsocket.h3
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp187
-rw-r--r--src/network/ssl/qsslsocket_mac_p.h1
-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.h8
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp39
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h54
-rw-r--r--src/network/ssl/qsslsocket_p.h12
-rw-r--r--src/network/ssl/qsslsocket_winrt.cpp4
-rw-r--r--src/network/ssl/qsslsocket_winrt_p.h1
-rw-r--r--src/network/ssl/ssl.pri64
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp6
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h6
-rw-r--r--src/opengl/opengl.pro4
-rw-r--r--src/opengl/qgl.cpp3
-rw-r--r--src/opengl/qglframebufferobject_p.h6
-rw-r--r--src/opengl/qglpixelbuffer_p.h6
-rw-r--r--src/openglextensions/openglextensions.pro4
-rw-r--r--src/platformsupport/accessibility/accessibility.pri2
-rw-r--r--src/platformsupport/cglconvenience/cglconvenience.mm23
-rw-r--r--src/platformsupport/clipboard/qmacmime.mm7
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenuadaptor.cpp4
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenutypes.cpp13
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenutypes_p.h2
-rw-r--r--src/platformsupport/dbusmenu/qdbusplatformmenu.cpp4
-rw-r--r--src/platformsupport/dbusmenu/qdbusplatformmenu_p.h2
-rw-r--r--src/platformsupport/dbustray/qdbustrayicon.cpp4
-rw-r--r--src/platformsupport/dbustray/qdbustrayicon_p.h4
-rw-r--r--src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp3
-rw-r--r--src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h2
-rw-r--r--src/platformsupport/devicediscovery/devicediscovery.pri7
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_static.cpp8
-rw-r--r--src/platformsupport/eglconvenience/eglconvenience.pri6
-rw-r--r--src/platformsupport/eglconvenience/qeglstreamconvenience_p.h4
-rw-r--r--src/platformsupport/eventdispatchers/eventdispatchers.pri5
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h6
-rw-r--r--src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp4
-rw-r--r--src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h6
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore.cpp7
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore_p.h1
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp15
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler.cpp5
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler_p.h1
-rw-r--r--src/platformsupport/fontdatabases/basic/basic.pri4
-rw-r--r--src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp3
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/fontconfig.pri2
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp8
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h1
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp2
-rw-r--r--src/platformsupport/fontdatabases/fontdatabases.pri25
-rw-r--r--src/platformsupport/fontdatabases/mac/coretext.pri7
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm263
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h9
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm61
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h8
-rw-r--r--src/platformsupport/glxconvenience/glxconvenience.pri6
-rw-r--r--src/platformsupport/graphics/qrasterbackingstore.cpp22
-rw-r--r--src/platformsupport/graphics/qrasterbackingstore_p.h9
-rw-r--r--src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri5
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp5
-rw-r--r--src/platformsupport/input/evdevmouse/evdevmouse.pri5
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp5
-rw-r--r--src/platformsupport/input/evdevtablet/evdevtablet.pri5
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp4
-rw-r--r--src/platformsupport/input/evdevtouch/evdevtouch.pri10
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp60
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h5
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp4
-rw-r--r--src/platformsupport/input/input.pri10
-rw-r--r--src/platformsupport/input/libinput/libinput.pri15
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp2
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp13
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping.cpp91
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping_p.h (renamed from src/gui/image/qnativeimage_p.h)33
-rw-r--r--src/platformsupport/input/shared/shared.pri5
-rw-r--r--src/platformsupport/input/tslib/tslib.pri2
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp22
-rw-r--r--src/platformsupport/linuxaccessibility/linuxaccessibility.pri2
-rw-r--r--src/platformsupport/platformcompositor/platformcompositor.pri2
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositor.cpp41
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositor_p.h9
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp8
-rw-r--r--src/platformsupport/platformsupport.pro6
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp47
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes_p.h5
-rw-r--r--src/platformsupport/themes/qabstractfileiconengine.cpp129
-rw-r--r--src/platformsupport/themes/qabstractfileiconengine_p.h96
-rw-r--r--src/platformsupport/themes/themes.pri6
-rw-r--r--src/plugins/bearer/bearer.pro5
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp16
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h6
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp14
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm20
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp38
-rw-r--r--src/plugins/bearer/linux_common/qofonoservice_linux.cpp12
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp118
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h36
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp30
-rw-r--r--src/plugins/bearer/nla/nla.pro6
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp12
-rw-r--r--src/plugins/generic/bsdkeyboard/bsdkeyboard.json3
-rw-r--r--src/plugins/generic/bsdkeyboard/bsdkeyboard.pro16
-rw-r--r--src/plugins/generic/bsdkeyboard/main.cpp59
-rw-r--r--src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp408
-rw-r--r--src/plugins/generic/bsdkeyboard/qbsdkeyboard.h139
-rw-r--r--src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h622
-rw-r--r--src/plugins/generic/bsdmouse/bsdmouse.json3
-rw-r--r--src/plugins/generic/bsdmouse/bsdmouse.pro16
-rw-r--r--src/plugins/generic/bsdmouse/main.cpp58
-rw-r--r--src/plugins/generic/bsdmouse/qbsdmouse.cpp165
-rw-r--r--src/plugins/generic/bsdmouse/qbsdmouse.h70
-rw-r--r--src/plugins/generic/generic.pro15
-rw-r--r--src/plugins/generic/tslib/tslib.pro2
-rw-r--r--src/plugins/generic/tuiotouch/qoscbundle.cpp23
-rw-r--r--src/plugins/generic/tuiotouch/qoscbundle_p.h19
-rw-r--r--src/plugins/generic/tuiotouch/qoscmessage.cpp25
-rw-r--r--src/plugins/generic/tuiotouch/qoscmessage_p.h18
-rw-r--r--src/plugins/generic/tuiotouch/qtuiocursor_p.h1
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp277
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler_p.h8
-rw-r--r--src/plugins/generic/tuiotouch/qtuiotoken_p.h145
-rw-r--r--src/plugins/generic/tuiotouch/tuiotouch.pro4
-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.pro7
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro15
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp (renamed from src/gui/image/qjpeghandler.cpp)25
-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/compose/compose.pro7
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp8
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.cpp5
-rw-r--r--src/plugins/platforminputcontexts/platforminputcontexts.pro3
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp34
-rw-r--r--src/plugins/platforms/android/androidjniinput.h4
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp201
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.h14
-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/android/qandroidplatformtheme.cpp2
-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/cocoa.pro2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.mm13
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm21
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h24
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm74
-rw-r--r--src/plugins/platforms/cocoa/qcocoaclipboard.h7
-rw-r--r--src/plugins/platforms/cocoa/qcocoaclipboard.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h32
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm555
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm17
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm26
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm195
-rw-r--r--src/plugins/platforms/cocoa/qcocoamimetypes.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaresources.qrc5
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemsettings.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm96
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm62
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm49
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm84
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.h1
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm7
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm87
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm2
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac_p.h3
-rw-r--r--src/plugins/platforms/cocoa/qt_mac_p.h54
-rw-r--r--src/plugins/platforms/cocoa/qt_menu.nib/classes.nib59
-rw-r--r--src/plugins/platforms/cocoa/qt_menu.nib/info.nib18
-rw-r--r--src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nibbin5560 -> 0 bytes
-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/qwindowsdirect2dpaintengine.cpp2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp2
-rw-r--r--src/plugins/platforms/directfb/directfb.pro5
-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.pri21
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscontext.cpp (renamed from src/plugins/platforms/eglfs/qeglfscontext.cpp)10
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscontext_p.h (renamed from src/plugins/platforms/eglfs/qeglfscontext.h)13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor.cpp (renamed from src/plugins/platforms/eglfs/qeglfscursor.cpp)174
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor_p.h (renamed from src/plugins/platforms/eglfs/qeglfscursor.h)30
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp (renamed from src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp)110
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h (renamed from src/plugins/platforms/eglfs/qeglfsdeviceintegration.h)20
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsglobal_p.h (renamed from src/plugins/platforms/eglfs/qeglfsglobal.h)20
-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.h67
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration.cpp (renamed from src/plugins/platforms/eglfs/qeglfsintegration.cpp)50
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration_p.h (renamed from src/plugins/platforms/eglfs/qeglfsintegration.h)15
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp (renamed from src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp)4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h (renamed from src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h)13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp (renamed from src/plugins/platforms/eglfs/qeglfsscreen.cpp)31
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen_p.h (renamed from src/plugins/platforms/eglfs/qeglfsscreen.h)16
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp (renamed from src/plugins/platforms/eglfs/qeglfswindow.cpp)15
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h (renamed from src/plugins/platforms/eglfs/qeglfswindow.h)17
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro15
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro4
-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.pro12
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h3
-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/qeglfskmsgbmscreen.cpp13
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h5
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro12
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp33
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h15
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp19
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp26
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h10
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro12
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp116
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h13
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp29
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h11
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp17
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h10
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro4
-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.pro5
-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.pro5
-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.pro6
-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.pro4
-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)28
-rw-r--r--src/plugins/platforms/eglfs/qeglfsmain.cpp2
-rw-r--r--src/plugins/platforms/haiku/qhaikuclipboard.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/qiosbackingstore.mm29
-rw-r--r--src/plugins/platforms/ios/qiosclipboard.h7
-rw-r--r--src/plugins/platforms/ios/qiosclipboard.mm4
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm3
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm2
-rw-r--r--src/plugins/platforms/ios/qiosfiledialog.h4
-rw-r--r--src/plugins/platforms/ios/qiosfileenginefactory.h4
-rw-r--r--src/plugins/platforms/ios/qiosglobal.h11
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm26
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.h4
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm22
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h11
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm14
-rw-r--r--src/plugins/platforms/ios/qiosmenu.h2
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm6
-rw-r--r--src/plugins/platforms/ios/qiosmessagedialog.h4
-rw-r--r--src/plugins/platforms/ios/qiosplatformaccessibility.h4
-rw-r--r--src/plugins/platforms/ios/qiosplatformaccessibility.mm6
-rw-r--r--src/plugins/platforms/ios/qiosscreen.h2
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm57
-rw-r--r--src/plugins/platforms/ios/qiostextinputoverlay.mm22
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.h10
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm14
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm12
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.h11
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm72
-rw-r--r--src/plugins/platforms/ios/qioswindow.h4
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm4
-rw-r--r--src/plugins/platforms/ios/quiaccessibilityelement.h3
-rw-r--r--src/plugins/platforms/ios/quiaccessibilityelement.mm6
-rw-r--r--src/plugins/platforms/ios/quiview.h8
-rw-r--r--src/plugins/platforms/ios/quiview.mm82
-rw-r--r--src/plugins/platforms/linuxfb/linuxfb.pro2
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp14
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp8
-rw-r--r--src/plugins/platforms/minimal/minimal.pro3
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp10
-rw-r--r--src/plugins/platforms/mirclient/qmirclientbackingstore.cpp8
-rw-r--r--src/plugins/platforms/offscreen/offscreen.pro4
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp22
-rw-r--r--src/plugins/platforms/openwfd/openwf.pro3
-rw-r--r--src/plugins/platforms/platforms.pro29
-rw-r--r--src/plugins/platforms/qnx/qnx.pro8
-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.cpp19
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp4
-rw-r--r--src/plugins/platforms/vnc/main.cpp (renamed from src/gui/image/qnativeimage.cpp)37
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp680
-rw-r--r--src/plugins/platforms/vnc/qvnc_p.h417
-rw-r--r--src/plugins/platforms/vnc/qvncclient.cpp662
-rw-r--r--src/plugins/platforms/vnc/qvncclient.h149
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.cpp148
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.h85
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp187
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.h93
-rw-r--r--src/plugins/platforms/vnc/vnc.json3
-rw-r--r--src/plugins/platforms/vnc/vnc.pro27
-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.cpp211
-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.cpp265
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp365
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp181
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp103
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h5
-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.cpp168
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.h11
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp185
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h22
-rw-r--r--src/plugins/platforms/windows/windows.pri59
-rw-r--r--src/plugins/platforms/windows/windows.pro2
-rw-r--r--src/plugins/platforms/winrt/qwinrtinputcontext.cpp56
-rw-r--r--src/plugins/platforms/winrt/qwinrtinputcontext.h4
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp83
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.h5
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro5
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri28
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp14
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro4
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro8
-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.cpp28
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h13
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp9
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp32
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbsessionmanager.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbsessionmanager.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp9
-rw-r--r--src/plugins/platforms/xcb/xcb-plugin.pro2
-rw-r--r--src/plugins/platforms/xcb/xcb.pro3
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro60
-rw-r--r--src/plugins/platformthemes/gtk3/gtk3.pro5
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp3
-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/platformthemes/platformthemes.pro3
-rw-r--r--src/plugins/plugins.pro11
-rw-r--r--src/plugins/printsupport/cups/cups.pro2
-rw-r--r--src/plugins/printsupport/printsupport.pro6
-rw-r--r--src/plugins/sqldrivers/db2/db2.pro7
-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)3
-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.pro8
-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.pro7
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp (renamed from src/sql/drivers/mysql/qsql_mysql.cpp)9
-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.pro9
-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.pro8
-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.pro7
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp (renamed from src/sql/drivers/psql/qsql_psql.cpp)4
-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.pro19
-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.pro13
-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)2
-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.pro7
-rw-r--r--src/printsupport/configure.json72
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog.h2
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog_p.h1
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog.h2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_p.h1
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix_p.h2
-rw-r--r--src/printsupport/dialogs/qprintdialog.h1
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp1
-rw-r--r--src/printsupport/dialogs/qprintdialog_win.cpp2
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.cpp2
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.h2
-rw-r--r--src/printsupport/kernel/kernel.pri3
-rw-r--r--src/printsupport/kernel/qcups_p.h2
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha.cpp2
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha_p.h2
-rw-r--r--src/printsupport/kernel/qpaintengine_preview_p.h1
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.h1
-rw-r--r--src/printsupport/kernel/qplatformprintersupport.h1
-rw-r--r--src/printsupport/kernel/qplatformprintplugin.cpp4
-rw-r--r--src/printsupport/kernel/qplatformprintplugin.h6
-rw-r--r--src/printsupport/kernel/qprint_p.h5
-rw-r--r--src/printsupport/kernel/qprintdevice_p.h1
-rw-r--r--src/printsupport/kernel/qprintengine.h1
-rw-r--r--src/printsupport/kernel/qprintengine_pdf.cpp2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp8
-rw-r--r--src/printsupport/kernel/qprintengine_win_p.h2
-rw-r--r--src/printsupport/kernel/qprinter.h2
-rw-r--r--src/printsupport/kernel/qprinter_p.h2
-rw-r--r--src/printsupport/kernel/qprinterinfo.h1
-rw-r--r--src/printsupport/kernel/qprinterinfo_p.h2
-rw-r--r--src/printsupport/kernel/qtprintsupportglobal.h3
-rw-r--r--src/printsupport/kernel/qtprintsupportglobal_p.h57
-rw-r--r--src/printsupport/widgets/qcupsjobwidget_p.h11
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.h1
-rw-r--r--src/printsupport/widgets/widgets.pri2
-rw-r--r--src/sql/configure.json201
-rw-r--r--src/sql/configure.pri89
-rw-r--r--src/sql/doc/src/qtsql.qdoc13
-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/kernel.pri3
-rw-r--r--src/sql/kernel/qsqlcachedresult_p.h1
-rw-r--r--src/sql/kernel/qsqldatabase.cpp117
-rw-r--r--src/sql/kernel/qsqldatabase.h2
-rw-r--r--src/sql/kernel/qsqldriver.h2
-rw-r--r--src/sql/kernel/qsqldriver_p.h1
-rw-r--r--src/sql/kernel/qsqldriverplugin.h2
-rw-r--r--src/sql/kernel/qsqlerror.h2
-rw-r--r--src/sql/kernel/qsqlfield.h2
-rw-r--r--src/sql/kernel/qsqlindex.h1
-rw-r--r--src/sql/kernel/qsqlnulldriver_p.h1
-rw-r--r--src/sql/kernel/qsqlquery.h2
-rw-r--r--src/sql/kernel/qsqlrecord.h2
-rw-r--r--src/sql/kernel/qsqlresult.h2
-rw-r--r--src/sql/kernel/qsqlresult_p.h1
-rw-r--r--src/sql/kernel/qtsqlglobal.h (renamed from src/sql/kernel/qsql.h)4
-rw-r--r--src/sql/kernel/qtsqlglobal_p.h (renamed from src/corelib/global/qconfig-dist.h)25
-rw-r--r--src/sql/models/qsqlquerymodel.h1
-rw-r--r--src/sql/models/qsqlquerymodel_p.h1
-rw-r--r--src/sql/models/qsqlrelationaldelegate.h2
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.h14
-rw-r--r--src/sql/models/qsqltablemodel.h1
-rw-r--r--src/sql/models/qsqltablemodel_p.h1
-rw-r--r--src/sql/sql.pro1
-rw-r--r--src/src.pro42
-rw-r--r--src/testlib/3rdparty/CALLGRIND_LICENSE.txt35
-rw-r--r--src/testlib/3rdparty/CYCLE_LICENSE.txt18
-rw-r--r--src/testlib/3rdparty/LINUX_LICENSE.txt351
-rw-r--r--src/testlib/3rdparty/qt_attribution.json42
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp9
-rw-r--r--src/testlib/doc/src/qttest-index.qdoc13
-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/qteamcitylogger.cpp12
-rw-r--r--src/testlib/qtest.h5
-rw-r--r--src/testlib/qtestblacklist.cpp11
-rw-r--r--src/testlib/qtestcase.cpp87
-rw-r--r--src/testlib/qtestcase.h41
-rw-r--r--src/testlib/qtestcase.qdoc22
-rw-r--r--src/testlib/qtestmouse.h4
-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.pro13
-rw-r--r--src/tools/moc/generator.cpp7
-rw-r--r--src/tools/moc/keywords.cpp375
-rw-r--r--src/tools/moc/main.cpp70
-rw-r--r--src/tools/moc/moc.cpp105
-rw-r--r--src/tools/moc/moc.h42
-rw-r--r--src/tools/moc/preprocessor.cpp77
-rw-r--r--src/tools/moc/preprocessor.h1
-rw-r--r--src/tools/moc/token.h3
-rw-r--r--src/tools/moc/util/generate_keywords.cpp3
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp8
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp4
-rw-r--r--src/tools/qlalr/lalr.cpp2
-rw-r--r--src/tools/qlalr/lalr.h1
-rw-r--r--src/tools/qlalr/main.cpp2
-rw-r--r--src/tools/qlalr/recognizer.cpp6
-rw-r--r--src/tools/rcc/rcc.cpp4
-rw-r--r--src/tools/uic/cpp/cppextractimages.cpp5
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.cpp21
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp50
-rw-r--r--src/tools/uic/databaseinfo.cpp2
-rw-r--r--src/tools/uic/main.cpp2
-rw-r--r--src/tools/uic/uic.cpp1
-rw-r--r--src/tools/uic/utils.h8
-rw-r--r--src/widgets/accessible/accessible.pri2
-rw-r--r--src/widgets/accessible/complexwidgets.cpp24
-rw-r--r--src/widgets/accessible/complexwidgets_p.h1
-rw-r--r--src/widgets/accessible/itemviews.cpp28
-rw-r--r--src/widgets/accessible/itemviews_p.h7
-rw-r--r--src/widgets/accessible/qaccessiblemenu_p.h1
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidget.h1
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp4
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory_p.h1
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgets_p.h1
-rw-r--r--src/widgets/accessible/rangecontrols_p.h1
-rw-r--r--src/widgets/accessible/simplewidgets.cpp6
-rw-r--r--src/widgets/accessible/simplewidgets_p.h1
-rw-r--r--src/widgets/accessible/widgets.pro2
-rw-r--r--src/widgets/configure.json567
-rw-r--r--src/widgets/configure.pri8
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp16
-rw-r--r--src/widgets/dialogs/qcolordialog.h1
-rw-r--r--src/widgets/dialogs/qdialog.cpp27
-rw-r--r--src/widgets/dialogs/qdialog.h8
-rw-r--r--src/widgets/dialogs/qdialog_p.h5
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp28
-rw-r--r--src/widgets/dialogs/qerrormessage.h1
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp14
-rw-r--r--src/widgets/dialogs/qfiledialog.h1
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h6
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp2
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp13
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h1
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h3
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp10
-rw-r--r--src/widgets/dialogs/qfontdialog.h1
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h1
-rw-r--r--src/widgets/dialogs/qfscompleter_p.h6
-rw-r--r--src/widgets/dialogs/qinputdialog.h1
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp77
-rw-r--r--src/widgets/dialogs/qmessagebox.h5
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp19
-rw-r--r--src/widgets/dialogs/qprogressdialog.h1
-rw-r--r--src/widgets/dialogs/qsidebar_p.h1
-rw-r--r--src/widgets/dialogs/qwizard.cpp8
-rw-r--r--src/widgets/dialogs/qwizard.h1
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp252
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h4
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp1
-rw-r--r--src/widgets/effects/qgraphicseffect.h1
-rw-r--r--src/widgets/effects/qgraphicseffect_p.h1
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h1
-rw-r--r--src/widgets/graphicsview/qgraph_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp15
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.h1
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.h1
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.h1
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp7
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.h1
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.h1
-rw-r--r--src/widgets/graphicsview/qgraphicstransform_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp15
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.h1
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.h1
-rw-r--r--src/widgets/graphicsview/qsimplex_p.h1
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp4
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.h1
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate_p.h1
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp6
-rw-r--r--src/widgets/itemviews/qabstractitemview.h1
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h1
-rw-r--r--src/widgets/itemviews/qbsptree_p.h1
-rw-r--r--src/widgets/itemviews/qcolumnview.h1
-rw-r--r--src/widgets/itemviews/qcolumnview_p.h1
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip_p.h1
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.h1
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp20
-rw-r--r--src/widgets/itemviews/qdirmodel.h1
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp131
-rw-r--r--src/widgets/itemviews/qfileiconprovider.h1
-rw-r--r--src/widgets/itemviews/qfileiconprovider_p.h1
-rw-r--r--src/widgets/itemviews/qheaderview.cpp4
-rw-r--r--src/widgets/itemviews/qheaderview.h1
-rw-r--r--src/widgets/itemviews/qheaderview_p.h1
-rw-r--r--src/widgets/itemviews/qitemdelegate.h1
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.h1
-rw-r--r--src/widgets/itemviews/qitemeditorfactory_p.h2
-rw-r--r--src/widgets/itemviews/qlistview.h1
-rw-r--r--src/widgets/itemviews/qlistview_p.h1
-rw-r--r--src/widgets/itemviews/qlistwidget.h1
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h1
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.h1
-rw-r--r--src/widgets/itemviews/qtableview.cpp3
-rw-r--r--src/widgets/itemviews/qtableview.h1
-rw-r--r--src/widgets/itemviews/qtableview_p.h1
-rw-r--r--src/widgets/itemviews/qtablewidget.h1
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h1
-rw-r--r--src/widgets/itemviews/qtreeview.cpp9
-rw-r--r--src/widgets/itemviews/qtreeview.h1
-rw-r--r--src/widgets/itemviews/qtreeview_p.h1
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp4
-rw-r--r--src/widgets/itemviews/qtreewidget.h1
-rw-r--r--src/widgets/itemviews/qtreewidget_p.h1
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.h2
-rw-r--r--src/widgets/itemviews/qwidgetitemdata_p.h1
-rw-r--r--src/widgets/kernel/kernel.pri8
-rw-r--r--src/widgets/kernel/qaction.cpp21
-rw-r--r--src/widgets/kernel/qaction.h1
-rw-r--r--src/widgets/kernel/qaction_p.h1
-rw-r--r--src/widgets/kernel/qactiongroup.h1
-rw-r--r--src/widgets/kernel/qapplication.cpp100
-rw-r--r--src/widgets/kernel/qapplication.h14
-rw-r--r--src/widgets/kernel/qapplication_p.h10
-rw-r--r--src/widgets/kernel/qboxlayout.h1
-rw-r--r--src/widgets/kernel/qdesktopwidget.h1
-rw-r--r--src/widgets/kernel/qdesktopwidget_p.h1
-rw-r--r--src/widgets/kernel/qformlayout.cpp330
-rw-r--r--src/widgets/kernel/qformlayout.h16
-rw-r--r--src/widgets/kernel/qgesture.h1
-rw-r--r--src/widgets/kernel/qgesture_p.h1
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp2
-rw-r--r--src/widgets/kernel/qgesturemanager_p.h1
-rw-r--r--src/widgets/kernel/qgesturerecognizer.h2
-rw-r--r--src/widgets/kernel/qgridlayout.cpp10
-rw-r--r--src/widgets/kernel/qgridlayout.h1
-rw-r--r--src/widgets/kernel/qlayout.cpp7
-rw-r--r--src/widgets/kernel/qlayout.h1
-rw-r--r--src/widgets/kernel/qlayout_p.h1
-rw-r--r--src/widgets/kernel/qlayoutengine_p.h1
-rw-r--r--src/widgets/kernel/qlayoutitem.h1
-rw-r--r--src/widgets/kernel/qmacgesturerecognizer_p.h1
-rw-r--r--src/widgets/kernel/qopenglwidget.h2
-rw-r--r--src/widgets/kernel/qshortcut.cpp9
-rw-r--r--src/widgets/kernel/qshortcut.h1
-rw-r--r--src/widgets/kernel/qsizepolicy.h1
-rw-r--r--src/widgets/kernel/qstackedlayout.h1
-rw-r--r--src/widgets/kernel/qstandardgestures_p.h1
-rw-r--r--src/widgets/kernel/qt_widgets_pch.h2
-rw-r--r--src/widgets/kernel/qtooltip.h1
-rw-r--r--src/widgets/kernel/qtwidgetsglobal.h (renamed from config.tests/x11/xrandr/xrandr.cpp)30
-rw-r--r--src/widgets/kernel/qtwidgetsglobal_p.h (renamed from src/widgets/kernel/qwidgetsfunctions_wince.h)34
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp2
-rw-r--r--src/widgets/kernel/qwhatsthis.h1
-rw-r--r--src/widgets/kernel/qwidget.cpp42
-rw-r--r--src/widgets/kernel/qwidget.h1
-rw-r--r--src/widgets/kernel/qwidget_p.h1
-rw-r--r--src/widgets/kernel/qwidgetaction.h1
-rw-r--r--src/widgets/kernel/qwidgetaction_p.h1
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp29
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h4
-rw-r--r--src/widgets/kernel/qwidgetsfunctions_wince.cpp120
-rw-r--r--src/widgets/kernel/qwidgetwindow_p.h1
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp9
-rw-r--r--src/widgets/kernel/qwindowcontainer_p.h1
-rw-r--r--src/widgets/kernel/win.pri6
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h1
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h1
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h1
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h1
-rw-r--r--src/widgets/styles/qandroidstyle_p.h1
-rw-r--r--src/widgets/styles/qcommonstyle.cpp43
-rw-r--r--src/widgets/styles/qcommonstyle.h1
-rw-r--r--src/widgets/styles/qcommonstyle_p.h1
-rw-r--r--src/widgets/styles/qcommonstylepixmaps_p.h2
-rw-r--r--src/widgets/styles/qdrawutil.h1
-rw-r--r--src/widgets/styles/qfusionstyle.cpp18
-rw-r--r--src/widgets/styles/qfusionstyle_p.h1
-rw-r--r--src/widgets/styles/qfusionstyle_p_p.h1
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm430
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h1
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h1
-rw-r--r--src/widgets/styles/qpixmapstyle_p.h1
-rw-r--r--src/widgets/styles/qpixmapstyle_p_p.h1
-rw-r--r--src/widgets/styles/qproxystyle.cpp11
-rw-r--r--src/widgets/styles/qproxystyle.h1
-rw-r--r--src/widgets/styles/qproxystyle_p.h1
-rw-r--r--src/widgets/styles/qstyle.cpp5
-rw-r--r--src/widgets/styles/qstyle.h4
-rw-r--r--src/widgets/styles/qstyle_wince.qrc97
-rw-r--r--src/widgets/styles/qstyleanimation_p.h1
-rw-r--r--src/widgets/styles/qstylefactory.cpp24
-rw-r--r--src/widgets/styles/qstylefactory.h1
-rw-r--r--src/widgets/styles/qstylehelper.cpp2
-rw-r--r--src/widgets/styles/qstylehelper_p.h2
-rw-r--r--src/widgets/styles/qstyleoption.h1
-rw-r--r--src/widgets/styles/qstylepainter.h1
-rw-r--r--src/widgets/styles/qstyleplugin.h1
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h1
-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.cpp55
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h1
-rw-r--r--src/widgets/styles/qwindowsstyle_p_p.h1
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp62
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p.h1
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h1
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp319
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p.h1
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h164
-rw-r--r--src/widgets/styles/styles.pri36
-rw-r--r--src/widgets/util/qcolormap.h1
-rw-r--r--src/widgets/util/qcompleter.cpp12
-rw-r--r--src/widgets/util/qcompleter.h1
-rw-r--r--src/widgets/util/qcompleter_p.h1
-rw-r--r--src/widgets/util/qflickgesture.cpp10
-rw-r--r--src/widgets/util/qflickgesture_p.h1
-rw-r--r--src/widgets/util/qscroller.h1
-rw-r--r--src/widgets/util/qscroller_p.h1
-rw-r--r--src/widgets/util/qscrollerproperties.h1
-rw-r--r--src/widgets/util/qscrollerproperties_p.h1
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp29
-rw-r--r--src/widgets/util/qsystemtrayicon.h1
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h7
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp10
-rw-r--r--src/widgets/util/qsystemtrayicon_wince.cpp301
-rw-r--r--src/widgets/util/qundogroup.h1
-rw-r--r--src/widgets/util/qundostack.cpp4
-rw-r--r--src/widgets/util/qundostack.h1
-rw-r--r--src/widgets/util/qundostack_p.h1
-rw-r--r--src/widgets/util/qundoview.h1
-rw-r--r--src/widgets/util/util.pri4
-rw-r--r--src/widgets/widgets.pro1
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp4
-rw-r--r--src/widgets/widgets/qabstractbutton.h1
-rw-r--r--src/widgets/widgets/qabstractbutton_p.h1
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp8
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h1
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h1
-rw-r--r--src/widgets/widgets/qabstractslider.cpp2
-rw-r--r--src/widgets/widgets/qabstractslider.h1
-rw-r--r--src/widgets/widgets/qabstractslider_p.h1
-rw-r--r--src/widgets/widgets/qabstractspinbox.h1
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h1
-rw-r--r--src/widgets/widgets/qbuttongroup.h1
-rw-r--r--src/widgets/widgets/qbuttongroup_p.h1
-rw-r--r--src/widgets/widgets/qcalendarwidget.h1
-rw-r--r--src/widgets/widgets/qcheckbox.cpp4
-rw-r--r--src/widgets/widgets/qcheckbox.h1
-rw-r--r--src/widgets/widgets/qcombobox.cpp4
-rw-r--r--src/widgets/widgets/qcombobox.h1
-rw-r--r--src/widgets/widgets/qcombobox_p.h1
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.cpp9
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.h1
-rw-r--r--src/widgets/widgets/qdatetimeedit.h1
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h1
-rw-r--r--src/widgets/widgets/qdial.h1
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp10
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.h1
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp11
-rw-r--r--src/widgets/widgets/qdockarealayout_p.h3
-rw-r--r--src/widgets/widgets/qdockwidget.cpp6
-rw-r--r--src/widgets/widgets/qdockwidget.h1
-rw-r--r--src/widgets/widgets/qdockwidget_p.h1
-rw-r--r--src/widgets/widgets/qeffects.cpp17
-rw-r--r--src/widgets/widgets/qfocusframe.h1
-rw-r--r--src/widgets/widgets/qfontcombobox.h1
-rw-r--r--src/widgets/widgets/qframe.h1
-rw-r--r--src/widgets/widgets/qframe_p.h1
-rw-r--r--src/widgets/widgets/qgroupbox.cpp4
-rw-r--r--src/widgets/widgets/qgroupbox.h1
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp12
-rw-r--r--src/widgets/widgets/qkeysequenceedit.h1
-rw-r--r--src/widgets/widgets/qkeysequenceedit_p.h1
-rw-r--r--src/widgets/widgets/qlabel.cpp4
-rw-r--r--src/widgets/widgets/qlabel.h1
-rw-r--r--src/widgets/widgets/qlabel_p.h1
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp9
-rw-r--r--src/widgets/widgets/qlcdnumber.h1
-rw-r--r--src/widgets/widgets/qlineedit.cpp14
-rw-r--r--src/widgets/widgets/qlineedit.h1
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.h1
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm5
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.h5
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm5
-rw-r--r--src/widgets/widgets/qmainwindow.cpp12
-rw-r--r--src/widgets/widgets/qmainwindow.h4
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp6
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h1
-rw-r--r--src/widgets/widgets/qmdiarea.cpp5
-rw-r--r--src/widgets/widgets/qmdiarea.h1
-rw-r--r--src/widgets/widgets/qmdiarea_p.h1
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp12
-rw-r--r--src/widgets/widgets/qmdisubwindow.h1
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h1
-rw-r--r--src/widgets/widgets/qmenu.cpp30
-rw-r--r--src/widgets/widgets/qmenu.h17
-rw-r--r--src/widgets/widgets/qmenu_mac.mm5
-rw-r--r--src/widgets/widgets/qmenu_p.h43
-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.cpp83
-rw-r--r--src/widgets/widgets/qmenubar.h12
-rw-r--r--src/widgets/widgets/qmenubar_p.h54
-rw-r--r--src/widgets/widgets/qplaintextedit.h1
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h1
-rw-r--r--src/widgets/widgets/qprogressbar.h1
-rw-r--r--src/widgets/widgets/qpushbutton.cpp10
-rw-r--r--src/widgets/widgets/qpushbutton.h1
-rw-r--r--src/widgets/widgets/qpushbutton_p.h1
-rw-r--r--src/widgets/widgets/qradiobutton.cpp4
-rw-r--r--src/widgets/widgets/qradiobutton.h1
-rw-r--r--src/widgets/widgets/qrubberband.h1
-rw-r--r--src/widgets/widgets/qscrollarea.h1
-rw-r--r--src/widgets/widgets/qscrollarea_p.h2
-rw-r--r--src/widgets/widgets/qscrollbar.cpp10
-rw-r--r--src/widgets/widgets/qscrollbar.h1
-rw-r--r--src/widgets/widgets/qscrollbar_p.h1
-rw-r--r--src/widgets/widgets/qsizegrip.h1
-rw-r--r--src/widgets/widgets/qslider.cpp4
-rw-r--r--src/widgets/widgets/qslider.h1
-rw-r--r--src/widgets/widgets/qspinbox.h1
-rw-r--r--src/widgets/widgets/qsplashscreen.h1
-rw-r--r--src/widgets/widgets/qsplitter.cpp5
-rw-r--r--src/widgets/widgets/qsplitter.h1
-rw-r--r--src/widgets/widgets/qsplitter_p.h1
-rw-r--r--src/widgets/widgets/qstackedwidget.h1
-rw-r--r--src/widgets/widgets/qstatusbar.cpp3
-rw-r--r--src/widgets/widgets/qstatusbar.h1
-rw-r--r--src/widgets/widgets/qtabbar.cpp28
-rw-r--r--src/widgets/widgets/qtabbar.h6
-rw-r--r--src/widgets/widgets/qtabbar_p.h4
-rw-r--r--src/widgets/widgets/qtabwidget.h1
-rw-r--r--src/widgets/widgets/qtextbrowser.h1
-rw-r--r--src/widgets/widgets/qtextedit.h1
-rw-r--r--src/widgets/widgets/qtextedit_p.h1
-rw-r--r--src/widgets/widgets/qtoolbar.cpp15
-rw-r--r--src/widgets/widgets/qtoolbar.h7
-rw-r--r--src/widgets/widgets/qtoolbar_p.h1
-rw-r--r--src/widgets/widgets/qtoolbararealayout_p.h1
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h1
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h1
-rw-r--r--src/widgets/widgets/qtoolbarseparator_p.h1
-rw-r--r--src/widgets/widgets/qtoolbox.h1
-rw-r--r--src/widgets/widgets/qtoolbutton.h1
-rw-r--r--src/widgets/widgets/qwidgetanimator_p.h7
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h2
-rw-r--r--src/widgets/widgets/qwidgetresizehandler_p.h1
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h1
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p_p.h1
-rw-r--r--src/widgets/widgets/widgets.pri16
-rw-r--r--src/winmain/qtmain_win.cpp59
-rw-r--r--src/winmain/winmain.pro6
-rw-r--r--src/xml/configure.json16
-rw-r--r--src/xml/qtxmlglobal.h3
-rw-r--r--src/xml/sax/qxml.h11
-rw-r--r--sync.profile12
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp4
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro4
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp15
-rw-r--r--tests/auto/corelib/codecs/utf8/tst_utf8.cpp12
-rw-r--r--tests/auto/corelib/corelib.pro2
-rw-r--r--tests/auto/corelib/global/qflags/qflags.pro4
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp16
-rw-r--r--tests/auto/corelib/global/qlogging/test/test.pro4
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp4
-rw-r--r--tests/auto/corelib/global/qtendian/qtendian.pro4
-rw-r--r--tests/auto/corelib/io/io.pro6
-rw-r--r--tests/auto/corelib/io/largefile/largefile.pro2
-rw-r--r--tests/auto/corelib/io/largefile/tst_largefile.cpp16
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp45
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp61
-rw-r--r--tests/auto/corelib/io/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp27
-rw-r--r--tests/auto/corelib/io/qfile/qfile.pro7
-rw-r--r--tests/auto/corelib/io/qfile/test/test.pro1
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp99
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp97
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp11
-rw-r--r--tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp6
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp8
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.pro2
-rw-r--r--tests/auto/corelib/io/qprocess/qprocess.pri3
-rw-r--r--tests/auto/corelib/io/qprocess/qprocess.pro2
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp5
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp4
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp11
-rw-r--r--tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro2
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp151
-rw-r--r--tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp14
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp26
-rw-r--r--tests/auto/corelib/io/qstorageinfo/BLACKLIST2
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp4
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp11
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp22
-rw-r--r--tests/auto/corelib/io/qurlinternal/qurlinternal.pro2
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp24
-rw-r--r--tests/auto/corelib/json/json.pro4
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp57
-rw-r--r--tests/auto/corelib/kernel/kernel.pro6
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro2
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp2
-rw-r--r--tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro5
-rw-r--r--tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp625
-rw-r--r--tests/auto/corelib/kernel/qelapsedtimer/qelapsedtimer.pro (renamed from tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro)0
-rw-r--r--tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp (renamed from tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp)0
-rw-r--r--tests/auto/corelib/kernel/qeventloop/qeventloop.pro4
-rw-r--r--tests/auto/corelib/kernel/qmetatype/qmetatype.pro4
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp4
-rw-r--r--tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro3
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp537
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp7
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro2
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp101
-rw-r--r--tests/auto/corelib/kernel/qvariant/qvariant.pro4
-rw-r--r--tests/auto/corelib/kernel/qvariant/stream/qt5.0/qdatetime.binbin40 -> 40 bytes
-rw-r--r--tests/auto/corelib/mimetypes/mimetypes.pro2
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp25
-rw-r--r--tests/auto/corelib/plugin/plugin.pro3
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/test/test.pro3
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/lib.pro1
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro1
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp17
-rw-r--r--tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp7
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro2
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst/tst.pro2
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp5
-rw-r--r--tests/auto/corelib/thread/qmutex/qmutex.pro1
-rw-r--r--tests/auto/corelib/thread/qmutex/tst_qmutex.cpp1065
-rw-r--r--tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp6
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp20
-rw-r--r--tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp2
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp24
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp14
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp3
-rw-r--r--tests/auto/corelib/tools/qcollator/qcollator.pro4
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp6
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp17
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp166
-rw-r--r--tests/auto/corelib/tools/qfreelist/qfreelist.pro2
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp68
-rw-r--r--tests/auto/corelib/tools/qlatin1string/qlatin1string.pro4
-rw-r--r--tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp30
-rw-r--r--tests/auto/corelib/tools/qline/tst_qline.cpp77
-rw-r--r--tests/auto/corelib/tools/qlocale/test/test.pro2
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp22
-rw-r--r--tests/auto/corelib/tools/qregexp/tst_qregexp.cpp20
-rw-r--r--tests/auto/corelib/tools/qregularexpression/qregularexpression.pro2
-rw-r--r--tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp26
-rw-r--r--tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp26
-rw-r--r--tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp4
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp149
-rw-r--r--tests/auto/corelib/tools/qstring/qstring.pro8
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp80
-rw-r--r--tests/auto/corelib/tools/qstringapisymmetry/.gitignore1
-rw-r--r--tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro5
-rw-r--r--tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp262
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp14
-rw-r--r--tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp14
-rw-r--r--tests/auto/corelib/tools/qstringref/tst_qstringref.cpp43
-rw-r--r--tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp4
-rw-r--r--tests/auto/corelib/tools/qtimezone/qtimezone.pro2
-rw-r--r--tests/auto/corelib/tools/qvector/qvector.pro2
-rw-r--r--tests/auto/corelib/tools/qversionnumber/qversionnumber.pro4
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp13
-rw-r--r--tests/auto/corelib/tools/tools.pro2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp63
-rw-r--r--tests/auto/dbus/dbus.pro2
-rw-r--r--tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp2
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp75
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h21
-rw-r--r--tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro2
-rw-r--r--tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro5
-rw-r--r--tests/auto/dbus/qdbustype/qdbustype.pro5
-rw-r--r--tests/auto/gui/gui.pro4
-rw-r--r--tests/auto/gui/image/image.pro2
-rw-r--r--tests/auto/gui/image/qicoimageformat/qicoimageformat.pro9
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp8
-rw-r--r--tests/auto/gui/image/qimage/qimage.pro2
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp202
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp12
-rw-r--r--tests/auto/gui/image/qmovie/qmovie.pro5
-rw-r--r--tests/auto/gui/image/qpixmap/qpixmap.pro4
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp33
-rw-r--r--tests/auto/gui/kernel/kernel.pro6
-rw-r--r--tests/auto/gui/kernel/noqteventloop/noqteventloop.pro2
-rw-r--r--tests/auto/gui/kernel/qclipboard/copier/main.cpp2
-rw-r--r--tests/auto/gui/kernel/qclipboard/paster/main.cpp4
-rw-r--r--tests/auto/gui/kernel/qclipboard/test/test.pro4
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp6
-rw-r--r--tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp12
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp18
-rw-r--r--tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp12
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp16
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp4
-rw-r--r--tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp21
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp56
-rw-r--r--tests/auto/gui/kernel/qwindow/BLACKLIST4
-rw-r--r--tests/auto/gui/kernel/qwindow/qwindow.pro2
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp9
-rw-r--r--tests/auto/gui/painting/painting.pro2
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp52
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp63
-rw-r--r--tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp21
-rw-r--r--tests/auto/gui/painting/qpathclipper/qpathclipper.pro2
-rw-r--r--tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp77
-rw-r--r--tests/auto/gui/painting/qregion/tst_qregion.cpp40
-rw-r--r--tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp2
-rw-r--r--tests/auto/gui/qopengl/qopengl.pro2
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp2
-rw-r--r--tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp60
-rw-r--r--tests/auto/gui/text/qcssparser/qcssparser.pro12
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp114
-rw-r--r--tests/auto/gui/text/qfont/BLACKLIST2
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp31
-rw-r--r--tests/auto/gui/text/qfontcache/tst_qfontcache.cpp2
-rw-r--r--tests/auto/gui/text/qfontdatabase/qfontdatabase.pro7
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp20
-rw-r--r--tests/auto/gui/text/qglyphrun/qglyphrun.pro11
-rw-r--r--tests/auto/gui/text/qrawfont/testdata.qrc1
-rw-r--r--tests/auto/gui/text/qrawfont/testfont_os2_v1.ttfbin0 -> 72960 bytes
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp30
-rw-r--r--tests/auto/gui/text/qstatictext/qstatictext.pro2
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp21
-rw-r--r--tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro2
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp2
-rw-r--r--tests/auto/gui/text/qzip/qzip.pro7
-rw-r--r--tests/auto/gui/text/qzip/tst_qzip.cpp2
-rw-r--r--tests/auto/gui/text/text.pro8
-rw-r--r--tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp2
-rw-r--r--tests/auto/network/access/access.pro7
-rw-r--r--tests/auto/network/access/hpack/hpack.pro6
-rw-r--r--tests/auto/network/access/hpack/tst_hpack.cpp852
-rw-r--r--tests/auto/network/access/http2/certs/fluke.cert75
-rw-r--r--tests/auto/network/access/http2/certs/fluke.key15
-rw-r--r--tests/auto/network/access/http2/http2.pro8
-rw-r--r--tests/auto/network/access/http2/http2srv.cpp640
-rw-r--r--tests/auto/network/access/http2/http2srv.h168
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp441
-rw-r--r--tests/auto/network/access/qftp/qftp.pro9
-rw-r--r--tests/auto/network/access/qftp/tst_qftp.cpp9
-rw-r--r--tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro2
-rw-r--r--tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp182
-rw-r--r--tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro2
-rw-r--r--tests/auto/network/access/qnetworkreply/qnetworkreply.pro2
-rw-r--r--tests/auto/network/access/qnetworkreply/test/test.pro3
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp45
-rw-r--r--tests/auto/network/kernel/kernel.pro3
-rw-r--r--tests/auto/network/kernel/qauthenticator/qauthenticator.pro2
-rw-r--r--tests/auto/network/kernel/qhostaddress/qhostaddress.pro8
-rw-r--r--tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp50
-rw-r--r--tests/auto/network/kernel/qhostinfo/qhostinfo.pro8
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp8
-rw-r--r--tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro5
-rw-r--r--tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp146
-rw-r--r--tests/auto/network/socket/platformsocketengine/platformsocketengine.pri10
-rw-r--r--tests/auto/network/socket/platformsocketengine/platformsocketengine.pro2
-rw-r--r--tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp9
-rw-r--r--tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro2
-rw-r--r--tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp4
-rw-r--r--tests/auto/network/socket/qlocalsocket/test/test.pro8
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp2
-rw-r--r--tests/auto/network/socket/qsctpsocket/qsctpsocket.pro6
-rw-r--r--tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp488
-rw-r--r--tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro2
-rw-r--r--tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp4
-rw-r--r--tests/auto/network/socket/qtcpserver/crashingServer/main.cpp8
-rw-r--r--tests/auto/network/socket/qtcpserver/test/test.pro11
-rw-r--r--tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp39
-rw-r--r--tests/auto/network/socket/qtcpsocket/qtcpsocket.pro4
-rw-r--r--tests/auto/network/socket/qtcpsocket/test/test.pro8
-rw-r--r--tests/auto/network/socket/qudpsocket/test/test.pro6
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp121
-rw-r--r--tests/auto/network/socket/socket.pro8
-rw-r--r--tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro2
-rw-r--r--tests/auto/network/ssl/qsslcipher/qsslcipher.pro2
-rw-r--r--tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro8
-rw-r--r--tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp163
-rw-r--r--tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro2
-rw-r--r--tests/auto/network/ssl/qsslerror/qsslerror.pro2
-rw-r--r--tests/auto/network/ssl/qsslkey/qsslkey.pro4
-rw-r--r--tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp61
-rw-r--r--tests/auto/network/ssl/qsslsocket/qsslsocket.pro16
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp397
-rw-r--r--tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro10
-rw-r--r--tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro10
-rw-r--r--tests/auto/network/ssl/ssl.pro13
-rw-r--r--tests/auto/opengl/qgl/BLACKLIST8
-rw-r--r--tests/auto/opengl/qglthreads/qglthreads.pro7
-rw-r--r--tests/auto/other/compiler/compiler.pro4
-rw-r--r--tests/auto/other/gestures/gestures.pro2
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp5
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp11
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp28
-rw-r--r--tests/auto/other/languagechange/tst_languagechange.cpp12
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp2
-rw-r--r--tests/auto/other/other.pro9
-rw-r--r--tests/auto/other/qaccessibility/qaccessibility.pro8
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp41
-rw-r--r--tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp30
-rw-r--r--tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp26
-rw-r--r--tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp26
-rw-r--r--tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp30
-rw-r--r--tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp26
-rw-r--r--tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp30
-rw-r--r--tests/auto/other/toolsupport/tst_toolsupport.cpp21
-rw-r--r--tests/auto/other/windowsmobile/test/ddhelper.cpp148
-rw-r--r--tests/auto/other/windowsmobile/test/test.pro23
-rw-r--r--tests/auto/other/windowsmobile/test/testQMenuBar_current.pngbin22964 -> 0 bytes
-rw-r--r--tests/auto/other/windowsmobile/test/testSimpleWidget_current.pngbin23841 -> 0 bytes
-rw-r--r--tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp195
-rw-r--r--tests/auto/other/windowsmobile/test/windowsmobile.qrc6
-rw-r--r--tests/auto/other/windowsmobile/testQMenuBar/main.cpp98
-rw-r--r--tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro5
-rw-r--r--tests/auto/other/windowsmobile/windowsmobile.pro9
-rw-r--r--tests/auto/sql/kernel/qsql/qsql.pro6
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro14
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h28
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp31
-rw-r--r--tests/auto/sql/kernel/qsqldriver/qsqldriver.pro13
-rw-r--r--tests/auto/sql/kernel/qsqlquery/qsqlquery.pro9
-rw-r--r--tests/auto/sql/kernel/qsqlthread/qsqlthread.pro11
-rw-r--r--tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro8
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro13
-rw-r--r--tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro10
-rw-r--r--tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp36
-rw-r--r--tests/auto/testlib/selftests/crashes/tst_crashes.cpp2
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.lightxml68
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.teamcity64
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.txt64
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xml68
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xunitxml4
-rw-r--r--tests/auto/tools/moc/moc.pro3
-rw-r--r--tests/auto/tools/moc/namespace.h77
-rw-r--r--tests/auto/tools/moc/namespace_no_merge.h (renamed from tests/auto/qtest-config.h)52
-rw-r--r--tests/auto/tools/moc/parse-defines.h3
-rw-r--r--tests/auto/tools/moc/subdir/extradefines.h1
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp275
-rw-r--r--tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro2
-rw-r--r--tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro2
-rw-r--r--tests/auto/tools/qmakelib/evaltest.cpp190
-rw-r--r--tests/auto/tools/qmakelib/parsertest.cpp2
-rw-r--r--tests/auto/tools/qmakelib/testdata/include/inc.pri2
-rw-r--r--tests/auto/widgets/dialogs/dialogs.pro2
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp8
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro14
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp3
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro15
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp52
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp42
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/BLACKLIST1
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp5
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp20
-rw-r--r--tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro7
-rw-r--r--tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/graphicsview.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp11
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp34
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp27
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro13
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp48
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp55
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp12
-rw-r--r--tests/auto/widgets/itemviews/itemviews.pro2
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp11
-rw-r--r--tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp3
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro2
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp23
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro2
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp45
-rw-r--r--tests/auto/widgets/itemviews/qlistview/qlistview.pro2
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp48
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp13
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp9
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp133
-rw-r--r--tests/auto/widgets/kernel/qapplication/test/test.pro2
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp50
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp237
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp43
-rw-r--r--tests/auto/widgets/kernel/qlayout/qlayout.pro8
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST2
-rw-r--r--tests/auto/widgets/kernel/qwidget/qwidget.pro6
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp476
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro5
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp6
-rw-r--r--tests/auto/widgets/styles/qstyle/qstyle.pro6
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp54
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST2
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro2
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp54
-rw-r--r--tests/auto/widgets/styles/styles.pro4
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp10
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp21
-rw-r--r--tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp4
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp12
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro2
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp28
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp6
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp61
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp40
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp28
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp15
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp32
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp22
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp6
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro2
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp6
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp17
-rw-r--r--tests/auto/widgets/widgets/widgets.pro4
-rw-r--r--tests/auto/xml/dom/qdom/qdom.pro5
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp110
-rw-r--r--tests/baselineserver/shared/baselineprotocol.cpp3
-rw-r--r--tests/benchmarks/benchmarks.pro1
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/main.cpp5
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro7
-rw-r--r--tests/benchmarks/corelib/io/qfile/main.cpp7
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/main.cpp4
-rw-r--r--tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp7
-rw-r--r--tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp32
-rw-r--r--tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro6
-rw-r--r--tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp183
-rw-r--r--tests/benchmarks/corelib/thread/thread.pro1
-rw-r--r--tests/benchmarks/corelib/tools/containers-sequential/main.cpp7
-rw-r--r--tests/benchmarks/corelib/tools/qcryptographichash/main.cpp9
-rw-r--r--tests/benchmarks/dbus/qdbustype/qdbustype.pro5
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp3
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro7
-rw-r--r--tests/benchmarks/gui/image/qimagereader/qimagereader.pro21
-rw-r--r--tests/benchmarks/gui/text/qtextdocument/main.cpp71
-rw-r--r--tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro7
-rw-r--r--tests/benchmarks/gui/text/text.pro3
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp18
-rw-r--r--tests/benchmarks/network/kernel/kernel.pro2
-rw-r--r--tests/benchmarks/network/network.pro4
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp3
-rw-r--r--tests/benchmarks/widgets/widgets.pro3
-rw-r--r--tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp (renamed from tests/auto/other/windowsmobile/test/ddhelper.h)49
-rw-r--r--tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro6
-rw-r--r--tests/benchmarks/widgets/widgets/widgets.pro3
-rw-r--r--tests/manual/diaglib/debugproxystyle.cpp42
-rw-r--r--tests/manual/diaglib/debugproxystyle.h1
-rw-r--r--tests/manual/diaglib/qwindowdump.cpp2
-rw-r--r--tests/manual/manual.pro12
-rw-r--r--tests/manual/qopenglcontext/qopenglcontextwindow.h2
-rw-r--r--tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp4
-rw-r--r--tests/manual/qopengltextureblitter/qopengltextureblitwindow.h2
-rw-r--r--tests/manual/qsysinfo/main.cpp13
-rw-r--r--tests/shared/filesystem.h2
-rw-r--r--tests/tests.pro2
-rw-r--r--tools/configure/configureapp.cpp3574
-rw-r--r--tools/configure/configureapp.h86
-rw-r--r--tools/configure/environment.cpp238
-rw-r--r--tools/configure/environment.h12
-rw-r--r--tools/configure/main.cpp30
-rw-r--r--util/lexgen/configfile.h1
-rw-r--r--util/lexgen/css3-simplified.lexgen (renamed from util/lexgen/css2-simplified.lexgen)6
2910 files changed, 57235 insertions, 49126 deletions
diff --git a/.gitignore b/.gitignore
index 50b53db3f7..8d73829def 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,10 @@ demos/*/*[.]app
config.tests/*/*/*
!config.tests/*/*/*[.]*
config.tests/*/*/*[.]app
+config.tests/arch/arch
+config.tests/configure.cfg
+config.tests/conftest-out
+config.tests/conftest.cpp
callgrind.out.*
pcviewer.cfg
@@ -112,8 +116,10 @@ bin/qt.conf
bin/servicefw*
bin/sfwlisten*
configure.cache
+config.opt
config.status
config.summary
+config.log
mkspecs/default
mkspecs/default-host
mkspecs/qconfig.pri
diff --git a/.qmake.conf b/.qmake.conf
index 8fbdbb6e6e..8c302d7039 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -4,4 +4,4 @@ CONFIG += warning_clean
QT_SOURCE_TREE = $$PWD
QT_BUILD_TREE = $$shadowed($$PWD)
-MODULE_VERSION = 5.7.1
+MODULE_VERSION = 5.8.0
diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index 97288c5a3e..8a49da3891 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -200,9 +200,11 @@ sub shouldMasterInclude {
}
######################################################################
-# Syntax: classNames(iheader, clean)
+# Syntax: classNames(iheader, clean, requires)
# Params: iheader, string, filename to parse for classname "symlinks"
# (out) clean, boolean, will be set to false if the header isn't clean
+# (out) requires, string, will be set to non-empty if the header
+# requires a feature
#
# Purpose: Scans through iheader to find all classnames that should be
# synced into library's include structure.
@@ -210,8 +212,9 @@ sub shouldMasterInclude {
######################################################################
sub classNames {
my @ret;
- my ($iheader, $clean) = @_;
+ my ($iheader, $clean, $requires) = @_;
$$clean = 1;
+ $$requires = "";
my $ihdrbase = basename($iheader);
my $classname = $classnames{$ihdrbase};
@@ -236,6 +239,7 @@ sub classNames {
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
$line .= ";" if($line =~ m/^QT_WARNING_(PUSH|POP|DISABLE_\w+\(.*\))[\r\n]*$/); # qt macros
+ $$requires = $1 if ($line =~ m/^QT_REQUIRE_CONFIG\((.*)\);[\r\n]*$/);
$parsable .= " " . $line;
}
}
@@ -333,8 +337,8 @@ sub check_header {
my ($lib, $header, $iheader, $public_header, $private_header) = @_;
my $header_skip_qt_begin_namespace_test = 0;
+ return if ($ignore_for_include_check{$header});
if ($public_header) {
- return if ($ignore_for_include_check{$header});
$header_skip_qt_begin_namespace_test = 1 if ($ignore_for_qt_begin_namespace_check{$header});
}
@@ -706,6 +710,21 @@ sub isQpaHeader
return 0;
}
+sub globosort($$) {
+ my ($a, $b) = @_;
+ if ($a =~ /^q(.*)global\.h$/) {
+ my $sa = $1;
+ if ($b =~ /^q(.*)global\.h$/) {
+ my $sb = $1;
+ # Compare stems so qglobal.h (empty stem) is first:
+ return $sa cmp $sb;
+ }
+ return -1; # $a is global, so before $b
+ }
+ return +1 if $b =~ /^q.*global\.h$/; # $a not global, so after $b
+ return $a cmp $b;
+}
+
# check if this is an in-source build, and if so use that as the basedir too
$basedir = locateSyncProfile($out_basedir);
if ($basedir) {
@@ -879,6 +898,10 @@ loadSyncProfile(\$basedir, \$out_basedir);
@modules_to_sync = keys(%modules) if($#modules_to_sync == -1);
+for my $p (keys %inject_headers) {
+ push @ignore_for_include_check, @{$inject_headers{$p}};
+}
+
my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate;
%ignore_for_include_check = map { $_ => 1 } @ignore_for_include_check;
%ignore_for_qt_begin_namespace_check = map { $_ => 1 } @ignore_for_qt_begin_namespace_check;
@@ -910,10 +933,7 @@ foreach my $lib (@modules_to_sync) {
my $pri_clean_files = "";
my $libcapitals = uc($lib);
- my $master_contents =
- "#ifndef QT_".$libcapitals."_MODULE_H\n" .
- "#define QT_".$libcapitals."_MODULE_H\n" .
- "#include <$lib/${lib}Depends>\n";
+ my %master_contents = ();
#remove the old files
if($remove_stale) {
@@ -930,6 +950,8 @@ foreach my $lib (@modules_to_sync) {
foreach my $subdir (@subdirs) {
if (opendir DIR, $subdir) {
foreach my $t (sort { $b cmp $a } readdir(DIR)) {
+ next if ($t =~ /\.pri$/);
+ next if ($t =~ /^qt[a-z0-9]+-config(_p)?\.h$/);
my $file = "$subdir/$t";
if(-d $file) {
push @subdirs, $file unless($t eq "." || $t eq "..");
@@ -980,6 +1002,7 @@ foreach my $lib (@modules_to_sync) {
#calc files and "copy" them
foreach my $subdir (@subdirs) {
my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
+ @headers = grep(!/^qt[a-z0-9]+-config(_p)?\.h$/, @headers);
if (defined $inject_headers{$subdir}) {
foreach my $if (@{$inject_headers{$subdir}}) {
@headers = grep(!/^\Q$if\E$/, @headers); #in case we configure'd previously
@@ -1010,6 +1033,7 @@ foreach my $lib (@modules_to_sync) {
}
my $clean_header;
+ my $requires;
my $iheader = $subdir . "/" . $header;
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
if ($check_includes) {
@@ -1018,7 +1042,7 @@ foreach my $lib (@modules_to_sync) {
&& $header =~ /_p\.h$/ && $subdir !~ /3rdparty/;
check_header($lib, $header, $iheader, $public_header, $private_header);
}
- my @classes = $public_header && (!$minimal && $is_qt) ? classNames($iheader, \$clean_header) : ();
+ my @classes = $public_header && (!$minimal && $is_qt) ? classNames($iheader, \$clean_header, \$requires) : ();
if($showonly) {
print "$header [$lib]\n";
foreach(@classes) {
@@ -1052,7 +1076,7 @@ foreach my $lib (@modules_to_sync) {
my $injection = "";
if($public_header) {
#put it into the master file
- $master_contents .= "#include \"$public_header\"\n" if (!$shadow && shouldMasterInclude($iheader));
+ $master_contents{$public_header} = $requires if (!$shadow && shouldMasterInclude($iheader));
#deal with the install directives
foreach my $class (@classes) {
@@ -1067,7 +1091,7 @@ foreach my $lib (@modules_to_sync) {
$injection .= ":$class";
}
$pri_install_files.= "$pri_install_iheader ";;
- $pri_clean_files .= "$pri_install_iheader " if ($clean_header);
+ $pri_clean_files .= "$pri_install_iheader".($requires ? ":".$requires : "")." " if ($clean_header);
}
elsif ($qpa_header) {
$pri_install_qpafiles.= "$pri_install_iheader ";;
@@ -1106,8 +1130,17 @@ foreach my $lib (@modules_to_sync) {
}
}
- # close the master include:
- $master_contents .=
+ # populate the master include:
+ my $master_contents =
+ "#ifndef QT_".$libcapitals."_MODULE_H\n" .
+ "#define QT_".$libcapitals."_MODULE_H\n" .
+ "#include <$lib/${lib}Depends>\n" .
+ join("", map {
+ my $rq = $master_contents{$_};
+ ($rq ? "#if QT_CONFIG($rq)\n" : "") .
+ "#include \"$_\"\n" .
+ ($rq ? "#endif\n" : "")
+ } sort globosort keys %master_contents) .
"#include \"".lc($lib)."version.h\"\n" .
"#endif\n";
diff --git a/config.tests/unix/iodbc/iodbc.cpp b/config.tests/common/c++98default/c++98default.cpp
index 3ce12390c2..5edcf2d76c 100644
--- a/config.tests/unix/iodbc/iodbc.cpp
+++ b/config.tests/common/c++98default/c++98default.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the configuration of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,10 +37,8 @@
**
****************************************************************************/
-#include <sql.h>
-#include <sqlext.h>
+#if __cplusplus >= 201103L
+#error "compiler uses c++11 or higher by default"
+#endif
-int main(int, char **)
-{
- return 0;
-}
+int main(int, char **) {}
diff --git a/config.tests/common/c++98default/c++98default.pro b/config.tests/common/c++98default/c++98default.pro
new file mode 100644
index 0000000000..97cf2d7b20
--- /dev/null
+++ b/config.tests/common/c++98default/c++98default.pro
@@ -0,0 +1,3 @@
+TEMPLATE = app
+CONFIG -= c++11 c++14 c++1z
+SOURCES = c++98default.cpp
diff --git a/config.tests/common/c++default/c++default.cpp b/config.tests/common/c++default/c++default.cpp
deleted file mode 100644
index 018963beb3..0000000000
--- a/config.tests/common/c++default/c++default.cpp
+++ /dev/null
@@ -1 +0,0 @@
-__cplusplus
diff --git a/config.tests/common/c++default/c++default.pro b/config.tests/common/c++default/c++default.pro
deleted file mode 100644
index 7e6bcefe69..0000000000
--- a/config.tests/common/c++default/c++default.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TEMPLATE = aux
-CONFIG -= qt c++11
-PREPROCESSOR_SOURCES += c++default.cpp
-
-preprocessor.commands = $(CXX) $(CXXFLAGS) $(INCPATH) -o $@ -E $<
-msvc:preprocessor.commands = $(CXX) $(CXXFLAGS) $(INCPATH) -E ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT}
-preprocessor.output = ${QMAKE_FILE_BASE}.ii
-preprocessor.input = PREPROCESSOR_SOURCES
-preprocessor.variable_out = GENERATED_FILES
-QMAKE_EXTRA_COMPILERS += preprocessor
-
-all.target = all
-all.depends += c++default.ii
-QMAKE_EXTRA_TARGETS += all
diff --git a/config.tests/common/libproxy/libproxy.pro b/config.tests/common/libproxy/libproxy.pro
index 51de2021ff..e3183d99e7 100644
--- a/config.tests/common/libproxy/libproxy.pro
+++ b/config.tests/common/libproxy/libproxy.pro
@@ -1,4 +1,3 @@
SOURCES = libproxy.cpp
CONFIG -= qt dylib
mac:CONFIG -= app_bundle
-LIBS += -lproxy
diff --git a/config.tests/common/pch/header.h b/config.tests/common/pch/header.h
new file mode 100644
index 0000000000..ebc22c4fb0
--- /dev/null
+++ b/config.tests/common/pch/header.h
@@ -0,0 +1 @@
+#define HEADER_H
diff --git a/config.tests/common/pch/pch.pro b/config.tests/common/pch/pch.pro
new file mode 100644
index 0000000000..f6384b71e1
--- /dev/null
+++ b/config.tests/common/pch/pch.pro
@@ -0,0 +1,4 @@
+CONFIG += precompile_header
+PRECOMPILED_DIR = .pch
+PRECOMPILED_HEADER = header.h
+SOURCES = source.cpp
diff --git a/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h b/config.tests/common/pch/source.cpp
index 780b7ef124..855672ffa8 100644
--- a/mkspecs/wince70embedded-x86-msvc2008/qplatformdefs.h
+++ b/config.tests/common/pch/source.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the qmake spec of the Qt Toolkit.
+** This file is part of the configuration of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,5 +37,8 @@
**
****************************************************************************/
-#include "../common/wince/qplatformdefs.h"
+#ifndef HEADER_H
+#error no go
+#endif
+int main() { return 0; }
diff --git a/config.tests/common/verifyspec/verifyspec.cpp b/config.tests/common/verifyspec/verifyspec.cpp
new file mode 100644
index 0000000000..bd5560bf02
--- /dev/null
+++ b/config.tests/common/verifyspec/verifyspec.cpp
@@ -0,0 +1 @@
+int main(int, char **) {}
diff --git a/config.tests/common/verifyspec/verifyspec.pro b/config.tests/common/verifyspec/verifyspec.pro
new file mode 100644
index 0000000000..d78ed2985a
--- /dev/null
+++ b/config.tests/common/verifyspec/verifyspec.pro
@@ -0,0 +1 @@
+SOURCES = verifyspec.cpp
diff --git a/config.tests/mac/corewlan/corewlan.pro b/config.tests/mac/corewlan/corewlan.pro
index 8db0c8c1e7..97e864f476 100644
--- a/config.tests/mac/corewlan/corewlan.pro
+++ b/config.tests/mac/corewlan/corewlan.pro
@@ -1,3 +1,2 @@
OBJECTIVE_SOURCES = corewlantest.mm
-LIBS += -framework CoreWLAN -framework Foundation
CONFIG -= qt
diff --git a/config.tests/qpa/direct2d/direct2d.pro b/config.tests/qpa/direct2d/direct2d.pro
index ab62a1da5c..98527b12a7 100644
--- a/config.tests/qpa/direct2d/direct2d.pro
+++ b/config.tests/qpa/direct2d/direct2d.pro
@@ -1,4 +1,3 @@
SOURCES = direct2d.cpp
-LIBS += -ld2d1 -ldwrite -ld3d11
CONFIG -= qt
CONFIG += console
diff --git a/config.tests/qpa/egl-x11/egl-x11.pro b/config.tests/qpa/egl-x11/egl-x11.pro
index aceb03dd78..fd8479ba35 100644
--- a/config.tests/qpa/egl-x11/egl-x11.pro
+++ b/config.tests/qpa/egl-x11/egl-x11.pro
@@ -1,12 +1,3 @@
SOURCES = egl-x11.cpp
-for(p, QMAKE_LIBDIR_EGL) {
- LIBS += -L$$p
-}
-
-!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
-!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
-
CONFIG -= qt
-
-LIBS += -lxcb -lX11 -lX11-xcb
diff --git a/config.tests/qpa/egl/egl.pro b/config.tests/qpa/egl/egl.pro
index b5396dab15..2c4ae07e64 100644
--- a/config.tests/qpa/egl/egl.pro
+++ b/config.tests/qpa/egl/egl.pro
@@ -1,10 +1,3 @@
SOURCES = egl.cpp
-for(p, QMAKE_LIBDIR_EGL) {
- LIBS += -L$$p
-}
-
-!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
-!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
-
CONFIG -= qt
diff --git a/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp b/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp
index 8a46ec9fff..e6ba06f89b 100644
--- a/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp
+++ b/config.tests/qpa/eglfs-brcm/eglfs-brcm.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include <EGL/egl.h>
-#include <GLES2/gl2.h>
#include <bcm_host.h>
int main(int, char **)
diff --git a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro
index d8b1c3ec7e..d4afa460f7 100644
--- a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro
+++ b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro
@@ -1,11 +1,3 @@
SOURCES = eglfs-brcm.cpp
CONFIG -= qt
-
-INCLUDEPATH += $$QMAKE_INCDIR_EGL
-
-for(p, QMAKE_LIBDIR_EGL) {
- LIBS += -L$$p
-}
-
-LIBS += -lEGL -lGLESv2 -lbcm_host
diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp
index a2d69905e5..fa3e9d33f7 100644
--- a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp
+++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.cpp
@@ -37,23 +37,13 @@
**
****************************************************************************/
-// Test both EGLDevice/Output/Stream and DRM as we only use them in combination.
-//
-// Other KMS/DRM tests relying on pkgconfig for libdrm are not suitable since
-// some systems do not use pkgconfig for the graphics stuff.
-
-#include <stdlib.h>
-#include <stdint.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <xf86drm.h>
-#include <xf86drmMode.h>
int main(int, char **)
{
EGLDeviceEXT device = 0;
EGLStreamKHR stream = 0;
EGLOutputLayerEXT layer = 0;
- drmModeCrtcPtr currentMode = drmModeGetCrtc(0, 0);
return EGL_DRM_CRTC_EXT;
}
diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro
index d0945465a0..2f20d993f5 100644
--- a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro
+++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro
@@ -1,15 +1,3 @@
SOURCES = eglfs-egldevice.cpp
-for(p, QMAKE_LIBDIR_EGL) {
- LIBS += -L$$p
-}
-
-INCLUDEPATH += $$QMAKE_INCDIR_EGL
-LIBS += $$QMAKE_LIBS_EGL
-CONFIG += link_pkgconfig
-!contains(QT_CONFIG, no-pkg-config) {
- PKGCONFIG += libdrm
-} else {
- LIBS += -ldrm
-}
CONFIG -= qt
diff --git a/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro
index 85bcf6484a..de6f85f20f 100644
--- a/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro
+++ b/config.tests/qpa/eglfs-mali-2/eglfs-mali-2.pro
@@ -1,5 +1,3 @@
SOURCES = eglfs-mali-2.cpp
CONFIG -= qt
-
-LIBS += -lEGL -lGLESv2
diff --git a/config.tests/qpa/eglfs-mali/eglfs-mali.pro b/config.tests/qpa/eglfs-mali/eglfs-mali.pro
index 132918c4bc..80f8282842 100644
--- a/config.tests/qpa/eglfs-mali/eglfs-mali.pro
+++ b/config.tests/qpa/eglfs-mali/eglfs-mali.pro
@@ -1,5 +1,3 @@
SOURCES = eglfs-mali.cpp
CONFIG -= qt
-
-LIBS += -lEGL -lGLESv2
diff --git a/config.tests/qpa/eglfs-viv/eglfs-viv.cpp b/config.tests/qpa/eglfs-viv/eglfs-viv.cpp
index 96935a2aa0..e6e17919dc 100644
--- a/config.tests/qpa/eglfs-viv/eglfs-viv.cpp
+++ b/config.tests/qpa/eglfs-viv/eglfs-viv.cpp
@@ -39,7 +39,6 @@
#include <EGL/egl.h>
#include <EGL/eglvivante.h>
-#include <GLES2/gl2.h>
int main(int, char **)
{
diff --git a/config.tests/qpa/eglfs-viv/eglfs-viv.pro b/config.tests/qpa/eglfs-viv/eglfs-viv.pro
index 3b36dc533f..2c3dc5cb01 100644
--- a/config.tests/qpa/eglfs-viv/eglfs-viv.pro
+++ b/config.tests/qpa/eglfs-viv/eglfs-viv.pro
@@ -5,12 +5,3 @@ integrity {
DEFINES += LINUX=1 EGL_API_FB=1
}
CONFIG -= qt
-
-LIBS += -lEGL -lGLESv2 -lGAL
-
-for(p, QMAKE_LIBDIR_OPENGL_ES2) {
- exists($$p):LIBS += -L$$p
-}
-
-!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
-!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
diff --git a/config.tests/qpa/gbm/gbm.pro b/config.tests/qpa/gbm/gbm.pro
index 19177062a8..1c08eb4e67 100644
--- a/config.tests/qpa/gbm/gbm.pro
+++ b/config.tests/qpa/gbm/gbm.pro
@@ -1,4 +1,2 @@
SOURCES = gbm.cpp
-CONFIG += link_pkgconfig
-PKGCONFIG += gbm
CONFIG -= qt
diff --git a/config.tests/qpa/kms/kms.pro b/config.tests/qpa/kms/kms.pro
index 5147bc82da..c823914308 100644
--- a/config.tests/qpa/kms/kms.pro
+++ b/config.tests/qpa/kms/kms.pro
@@ -1,4 +1,2 @@
SOURCES = kms.cpp
-CONFIG += link_pkgconfig
-PKGCONFIG += libdrm
CONFIG -= qt
diff --git a/config.tests/qpa/mirclient/mirclient.pro b/config.tests/qpa/mirclient/mirclient.pro
index b397c2d08a..3e87194e4e 100644
--- a/config.tests/qpa/mirclient/mirclient.pro
+++ b/config.tests/qpa/mirclient/mirclient.pro
@@ -1,4 +1,2 @@
SOURCES = mirclient.cpp
-CONFIG += link_pkgconfig
-PKGCONFIG += egl mirclient ubuntu-platform-api
CONFIG -= qt
diff --git a/config.tests/qpa/wayland-server/wayland-server.pro b/config.tests/qpa/wayland-server/wayland-server.pro
index c07740d20f..969bc542bb 100644
--- a/config.tests/qpa/wayland-server/wayland-server.pro
+++ b/config.tests/qpa/wayland-server/wayland-server.pro
@@ -1,5 +1,3 @@
SOURCES = wl.cpp
CONFIG -= qt
-CONFIG += link_pkgconfig
-PKGCONFIG += wayland-server
diff --git a/config.tests/qpa/xcb-glx/xcb-glx.pro b/config.tests/qpa/xcb-glx/xcb-glx.pro
index d7fd1d7208..8086e3a388 100644
--- a/config.tests/qpa/xcb-glx/xcb-glx.pro
+++ b/config.tests/qpa/xcb-glx/xcb-glx.pro
@@ -1,5 +1,2 @@
SOURCES = xcb-glx.cpp
CONFIG -= qt
-
-LIBS += -lxcb -lxcb-glx
-
diff --git a/config.tests/qpa/xcb-render/xcb-render.pro b/config.tests/qpa/xcb-render/xcb-render.pro
index 3248b66a67..7555fa9b61 100644
--- a/config.tests/qpa/xcb-render/xcb-render.pro
+++ b/config.tests/qpa/xcb-render/xcb-render.pro
@@ -1,5 +1,2 @@
SOURCES = xcb-render.cpp
CONFIG -= qt
-
-LIBS += -lxcb -lxcb-render -lxcb-render-util
-
diff --git a/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro b/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro
index 23eedb03a7..6363ae90ee 100644
--- a/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro
+++ b/config.tests/qpa/xcb-syslibs/xcb-syslibs.pro
@@ -1,5 +1,2 @@
SOURCES = xcb.cpp
CONFIG -= qt
-
-LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-randr
-
diff --git a/config.tests/qpa/xcb-syslibs/xcb.cpp b/config.tests/qpa/xcb-syslibs/xcb.cpp
index 0e1bd76e6c..00d0da1b6c 100644
--- a/config.tests/qpa/xcb-syslibs/xcb.cpp
+++ b/config.tests/qpa/xcb-syslibs/xcb.cpp
@@ -57,8 +57,5 @@ int main(int, char **)
xcb_connection_t *connection = xcb_connect("", &primaryScreen);
- // This won't compile unless libxcb >= 1.5 which defines XCB_ATOM_PRIMARY.
- int xcbAtomPrimary = XCB_ATOM_PRIMARY;
-
return 0;
}
diff --git a/config.tests/qpa/xcb-xkb/xcb-xkb.cpp b/config.tests/qpa/xcb-xkb/xcb-xkb.cpp
index 6a88944aee..9685649633 100644
--- a/config.tests/qpa/xcb-xkb/xcb-xkb.cpp
+++ b/config.tests/qpa/xcb-xkb/xcb-xkb.cpp
@@ -51,6 +51,9 @@ int main(int, char **)
xcb_connection_t *connection = xcb_connect("", &primaryScreen);
+ // This takes more arguments in xcb-xkb < 1.10.
+ xcb_xkb_get_kbd_by_name_unchecked(NULL, 0, 0, 0, 0);
+
// This won't compile unless libxcb >= 1.5 which defines XCB_ATOM_PRIMARY.
int xcbAtomPrimary = XCB_ATOM_PRIMARY;
diff --git a/config.tests/qpa/xcb-xkb/xcb-xkb.pro b/config.tests/qpa/xcb-xkb/xcb-xkb.pro
index a684a869d3..804be7b894 100644
--- a/config.tests/qpa/xcb-xkb/xcb-xkb.pro
+++ b/config.tests/qpa/xcb-xkb/xcb-xkb.pro
@@ -1,5 +1,2 @@
SOURCES = xcb-xkb.cpp
CONFIG -= qt
-
-LIBS += -lxcb -lxcb-xkb
-
diff --git a/config.tests/qpa/xcb-xlib/xcb-xlib.pro b/config.tests/qpa/xcb-xlib/xcb-xlib.pro
index 03250b4480..0e98a00fd0 100644
--- a/config.tests/qpa/xcb-xlib/xcb-xlib.pro
+++ b/config.tests/qpa/xcb-xlib/xcb-xlib.pro
@@ -1,5 +1,2 @@
SOURCES = xcb-xlib.cpp
CONFIG -= qt
-
-LIBS += -lxcb -lX11 -lX11-xcb
-
diff --git a/config.tests/qpa/xcb/xcb.cpp b/config.tests/qpa/xcb/xcb.cpp
index a5b419e695..efb4f0ca2e 100644
--- a/config.tests/qpa/xcb/xcb.cpp
+++ b/config.tests/qpa/xcb/xcb.cpp
@@ -43,5 +43,9 @@ int main(int, char **)
{
int primaryScreen = 0;
xcb_connection_t *t = xcb_connect("", &primaryScreen);
+
+ // This won't compile unless libxcb >= 1.5 which defines XCB_ATOM_PRIMARY.
+ int xcbAtomPrimary = XCB_ATOM_PRIMARY;
+
return 0;
}
diff --git a/config.tests/qpa/xcb/xcb.pro b/config.tests/qpa/xcb/xcb.pro
index a48fdbd15f..6363ae90ee 100644
--- a/config.tests/qpa/xcb/xcb.pro
+++ b/config.tests/qpa/xcb/xcb.pro
@@ -1,5 +1,2 @@
SOURCES = xcb.cpp
CONFIG -= qt
-
-LIBS += -lxcb
-
diff --git a/config.tests/unix/alsa/alsa.pro b/config.tests/unix/alsa/alsa.pro
index 6d5d55bcfd..211e9bc899 100644
--- a/config.tests/unix/alsa/alsa.pro
+++ b/config.tests/unix/alsa/alsa.pro
@@ -1,3 +1,2 @@
SOURCES = alsatest.cpp
-LIBS+=-lasound
CONFIG -= qt dylib
diff --git a/config.tests/unix/arch.test b/config.tests/unix/arch.test
deleted file mode 100755
index cfb47def4f..0000000000
--- a/config.tests/unix/arch.test
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/sh
-
-QMKSPEC=$1
-VERBOSE=$2
-SRCDIR=$3
-OUTDIR=$4
-RESULTFILE=$5
-TARGET=$6
-QMAKE=$7
-QTCONF=$8
-shift 8
-
-if [ "$TARGET" = "host" ]; then
- VARPREFIX="CFG_HOST"
- PROSUFFIX="_host"
-else
- VARPREFIX="CFG"
- PROSUFFIX=""
-fi
-
-LFLAGS="$SYSROOT_FLAG"
-CXXFLAGS="$SYSROOT_FLAG"
-
-while [ "$#" -gt 0 ]; do
- PARAM=$1
- case $PARAM in
- -L*|-l*)
- LFLAGS="$LFLAGS \"$PARAM\""
- ;;
- -I*)
- INC=`echo $PARAM | sed -e 's/^-I//'`
- INCLUDEPATH="$INCLUDEPATH \"$INC\""
- ;;
- -D*)
- CXXFLAGS="$CXXFLAGS \"$PARAM\""
- ;;
- *) ;;
- esac
- shift
-done
-
-# debuggery
-[ "$VERBOSE" = "yes" ] && echo "Determining architecture... ($*)"
-
-# build a test program but don't run it
-test -d "$OUTDIR/config.tests/arch" || mkdir -p "$OUTDIR/config.tests/arch"
-cd "$OUTDIR/config.tests/arch"
-[ -f Makefile ] && $MAKE distclean >/dev/null 2>&1
-OUTDIR=$OUTDIR "$QMAKE" -qtconf "$QTCONF" -nocache -spec "$QMKSPEC" "LIBS+=$LFLAGS" "QMAKE_CXXFLAGS+=$CXXFLAGS" "INCLUDEPATH+=$INCLUDEPATH" "CONFIG-=app_bundle" "$SRCDIR/config.tests/arch/arch$PROSUFFIX.pro" >/dev/null 2>&1 || echo "qmake is broken" >&2
-
-
-ARCH=""
-[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1
-
-if [ -f ./arch.exe ]; then
- binary=./arch.exe
-elif [ -f ./arch ]; then
- binary=./arch
-elif [ -f ./libarch.so ]; then
- binary=./libarch.so
-else
- [ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!"
- exit 2
-fi
-
-if strings - $binary 2>/dev/null | \
- awk -F: '/\=\=Qt\=magic\=Qt\=\= Architecture/ { print "'$VARPREFIX'_ARCH=\"" $2 "\"" }
- /\=\=Qt\=magic\=Qt\=\= Sub-architecture/ { print "'$VARPREFIX'_CPUFEATURES=\"" $2 "\"" }' > "$RESULTFILE"
-then
- [ "$VERBOSE" = "yes" ] && echo " Found architecture in binary" && \
- cat "$RESULTFILE"
-else
- [ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!"
- exit 2
-fi
-
-$MAKE distclean >/dev/null 2>&1
diff --git a/config.tests/unix/bsymbolic_functions.test b/config.tests/unix/bsymbolic_functions.test
deleted file mode 100755
index 4d66ee6de0..0000000000
--- a/config.tests/unix/bsymbolic_functions.test
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-BSYMBOLIC_FUNCTIONS_SUPPORT=no
-COMPILER=$1
-VERBOSE=$2
-
-
-cat >>bsymbolic_functions.c << EOF
-#if !(defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64))
-#error "Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129)."
-#endif
-
-int main() { return 0; }
-EOF
-
-if [ "$VERBOSE" = "yes" ] ; then
- echo $COMPILER $SYSROOT_FLAG -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c
- $COMPILER $SYSROOT_FLAG -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c && BSYMBOLIC_FUNCTIONS_SUPPORT=yes
-else
- $COMPILER $SYSROOT_FLAG -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c >/dev/null 2>&1 && BSYMBOLIC_FUNCTIONS_SUPPORT=yes
-fi
-rm -f bsymbolic_functions.c libtest.so
-
-# done
-if [ "$BSYMBOLIC_FUNCTIONS_SUPPORT" != "yes" ]; then
- [ "$VERBOSE" = "yes" ] && echo "Symbolic function binding disabled."
- exit 0
-else
- [ "$VERBOSE" = "yes" ] && echo "Symbolic function binding enabled."
- exit 1
-fi
diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test
deleted file mode 100755
index f5db1847b8..0000000000
--- a/config.tests/unix/compile.test
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/sh
-
-SUCCESS=no
-QMKSPEC=$1
-XPLATFORM=`basename "$1"`
-QMAKE_CONFIG=$2
-VERBOSE=$3
-SRCDIR=$4
-OUTDIR=$5
-TEST=$6
-EXE=`basename "$6"`
-DESCRIPTION=$7
-QMAKE=$8
-QTCONF=$9
-shift 9
-LFLAGS="$SYSROOT_FLAG"
-INCLUDEPATH=""
-CFLAGS="$SYSROOT_FLAG"
-CXXFLAGS="$SYSROOT_FLAG"
-MAC_ARCH_CXXFLAGS=""
-MAC_ARCH_LFLAGS=""
-QMAKE_ARGS=
-while [ "$#" -gt 0 ]; do
- PARAM=$1
- case $PARAM in
- -config)
- QMAKE_CONFIG="$QMAKE_CONFIG $2"
- shift
- ;;
- -framework)
- LFLAGS="$LFLAGS -framework \"$2\""
- shift
- ;;
- -arch)
- MAC_ARCH_CFLAGS="$MAC_ARCH_CFLAGS -arch $2"
- MAC_ARCH_CXXFLAGS="$MAC_ARCH_CXXFLAGS -arch $2"
- MAC_ARCH_LFLAGS="$MAC_ARCH_LFLAGS -arch $2"
- shift
- ;;
- -F*|-m*|-x*)
- LFLAGS="$LFLAGS \"$PARAM\""
- CFLAGS="$CFLAGS \"$PARAM\""
- CXXFLAGS="$CXXFLAGS \"$PARAM\""
- ;;
- -L*|-l*|-pthread)
- LFLAGS="$LFLAGS \"$PARAM\""
- ;;
- -I*)
- INC=`echo $PARAM | sed -e 's/^-I//'`
- INCLUDEPATH="$INCLUDEPATH \"$INC\""
- ;;
- -f*|-D*)
- CFLAGS="$CFLAGS \"$PARAM\""
- CXXFLAGS="$CXXFLAGS \"$PARAM\""
- ;;
- -Qoption)
- # Two-argument form for the Sun Compiler
- CFLAGS="$CFLAGS $PARAM \"$2\""
- CXXFLAGS="$CXXFLAGS $PARAM \"$2\""
- shift
- ;;
- *)
- QMAKE_ARGS="$QMAKE_ARGS $PARAM"
- ;;
- esac
- shift
-done
-
-test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST"
-
-cd "$OUTDIR/$TEST"
-
-test -r Makefile && $MAKE distclean >/dev/null 2>&1
-# Make sure output from possible previous tests is gone
-rm -f "$EXE" "${EXE}.exe"
-
-set -- \
- "$QMAKE" \
- -qtconf "$QTCONF" \
- -nocache \
- -spec "$QMKSPEC" \
- "CONFIG+=$QMAKE_CONFIG" \
- "CONFIG+=android_app" \
- "CONFIG-=debug_and_release app_bundle lib_bundle" \
- "LIBS+=$LFLAGS" \
- "LIBS+=$MAC_ARCH_LFLAGS" \
- "INCLUDEPATH*=$INCLUDEPATH" \
- "QMAKE_CFLAGS*=$CFLAGS" \
- "QMAKE_CFLAGS+=$MAC_ARCH_CFLAGS" \
- "QMAKE_CXXFLAGS*=$CXXFLAGS" \
- "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" \
- $QMAKE_ARGS \
- "$SRCDIR/$TEST/$EXE.pro" \
- -o "$OUTDIR/$TEST/Makefile"
-if [ "$VERBOSE" = "yes" ]; then
- echo
- OUTDIR=$OUTDIR "$@" && $MAKE && SUCCESS=yes
-else
- OUTDIR=$OUTDIR "$@" >/dev/null 2>&1 && $MAKE >/dev/null 2>&1 && SUCCESS=yes
-fi
-
-# done
-if [ "$SUCCESS" != "yes" ]; then
- [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION disabled." || echo " no."
- exit 1
-else
- [ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION enabled." || echo " yes."
- exit 0
-fi
diff --git a/config.tests/unix/cups/cups.pro b/config.tests/unix/cups/cups.pro
index 3f8ca99d0f..d19ce7d9a6 100644
--- a/config.tests/unix/cups/cups.pro
+++ b/config.tests/unix/cups/cups.pro
@@ -1,3 +1,2 @@
SOURCES = cups.cpp
CONFIG -= qt dylib
-LIBS += -lcups
diff --git a/config.tests/unix/db2/db2.pro b/config.tests/unix/db2/db2.pro
index b7316051f9..ef233fc184 100644
--- a/config.tests/unix/db2/db2.pro
+++ b/config.tests/unix/db2/db2.pro
@@ -1,3 +1,2 @@
SOURCES = db2.cpp
CONFIG -= qt dylib
-LIBS += -ldb2
diff --git a/config.tests/unix/dbus/dbus.pro b/config.tests/unix/dbus/dbus.pro
index c2a01ea269..f9d793b867 100644
--- a/config.tests/unix/dbus/dbus.pro
+++ b/config.tests/unix/dbus/dbus.pro
@@ -1,2 +1,8 @@
SOURCES = dbus.cpp
CONFIG -= qt
+
+CONFIG += build_all
+CONFIG(debug, debug|release): \
+ LIBS += $$LIBS_DEBUG
+else: \
+ LIBS += $$LIBS_RELEASE
diff --git a/config.tests/unix/doubleconversion/doubleconversion.pro b/config.tests/unix/doubleconversion/doubleconversion.pro
index ae435b9293..8253d0c2a5 100644
--- a/config.tests/unix/doubleconversion/doubleconversion.pro
+++ b/config.tests/unix/doubleconversion/doubleconversion.pro
@@ -1,4 +1,3 @@
SOURCES = doubleconversion.cpp
CONFIG -= qt
CONFIG += console
-LIBS += -ldouble-conversion
diff --git a/config.tests/unix/fontconfig/fontconfig.pro b/config.tests/unix/fontconfig/fontconfig.pro
index 8360774035..82dcfc80a0 100644
--- a/config.tests/unix/fontconfig/fontconfig.pro
+++ b/config.tests/unix/fontconfig/fontconfig.pro
@@ -1,4 +1,3 @@
SOURCES = fontconfig.cpp
CONFIG -= qt
-LIBS += -lfreetype -lfontconfig
include(../../unix/freetype/freetype.pri)
diff --git a/config.tests/unix/freetype/freetype.pro b/config.tests/unix/freetype/freetype.pro
index c0cc02d564..1a9f06909a 100644
--- a/config.tests/unix/freetype/freetype.pro
+++ b/config.tests/unix/freetype/freetype.pro
@@ -1,4 +1,3 @@
SOURCES = freetype.cpp
CONFIG -= qt
-LIBS += -lfreetype
include(freetype.pri)
diff --git a/config.tests/unix/fvisibility.test b/config.tests/unix/fvisibility.test
deleted file mode 100755
index 621af95e63..0000000000
--- a/config.tests/unix/fvisibility.test
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-
-FVISIBILITY_SUPPORT=no
-COMPILER=$1
-VERBOSE=$2
-
-CMDLINE=
-
-
-RunCompileTest() {
- cat >>fvisibility.c << EOF
-#if defined(__GNUC__)
-# if (__GNUC__ < 4)
-# error "GCC3 with backported visibility patch is known to miscompile Qt"
-# endif
-__attribute((visibility("default"))) void blah();
-#elif defined(__SUNPRO_CC)
-# if (__SUNPRO_CC < 0x0550)
-# error "SunStudio 8 or later is required for ELF visibility"
-# endif
-__global void blah();
-#else
-# error "GCC4+ or SunStudio 8+ are required to support ELF visibility"
-#endif
-EOF
-
- if [ "$VERBOSE" = "yes" ] ; then
- echo $COMPILER -c $CMDLINE fvisibility.c
- $COMPILER -c $CMDLINE fvisibility.c && FVISIBILITY_SUPPORT=yes
- else
- $COMPILER -c $CMDLINE fvisibility.c >/dev/null 2>&1 && FVISIBILITY_SUPPORT=yes
- fi
- rm -f fvisibility.c fvisibility.o
-}
-
-
-case "$COMPILER" in
-*g++*|*c++*|*qcc*)
- CMDLINE="-fvisibility=hidden"
- RunCompileTest
- ;;
-
-aCC*)
- ;;
-
-icpc)
- ICPC_VERSION=`icpc -dumpversion`
- case "$ICPC_VERSION" in
- 8.*|9.*|10.0)
- # 8.x, 9.x, and 10.0 don't support symbol visibility
- ;;
- *)
- # the compile test works for the intel compiler because it mimics gcc's behavior
- CMDLINE="-fvisibility=hidden"
- RunCompileTest
- ;;
- esac
- ;;
-
-CC)
- # This should be SunStudio. If not, it'll get caught.
- CMDLINE="-xldscope=hidden"
- RunCompileTest
- ;;
-esac
-
-# done
-if [ "$FVISIBILITY_SUPPORT" != "yes" ]; then
- [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control disabled."
- exit 0
-else
- [ "$VERBOSE" = "yes" ] && echo "Symbol visibility control enabled."
- exit 1
-fi
diff --git a/config.tests/unix/getaddrinfo/getaddrinfo.pro b/config.tests/unix/getaddrinfo/getaddrinfo.pro
index cc739118fa..18e40971e5 100644
--- a/config.tests/unix/getaddrinfo/getaddrinfo.pro
+++ b/config.tests/unix/getaddrinfo/getaddrinfo.pro
@@ -1,3 +1,2 @@
SOURCES = getaddrinfotest.cpp
CONFIG -= qt dylib
-LIBS += $$QMAKE_LIBS_NETWORK
diff --git a/config.tests/unix/getifaddrs/getifaddrs.pro b/config.tests/unix/getifaddrs/getifaddrs.pro
index 14a89f87b8..db2956a338 100644
--- a/config.tests/unix/getifaddrs/getifaddrs.pro
+++ b/config.tests/unix/getifaddrs/getifaddrs.pro
@@ -1,4 +1,3 @@
SOURCES = getifaddrs.cpp
CONFIG -= qt
QT =
-LIBS += $$QMAKE_LIBS_NETWORK
diff --git a/config.tests/unix/gnu-libiconv/gnu-libiconv.pro b/config.tests/unix/gnu-libiconv/gnu-libiconv.pro
index 1ecf94390a..4008f882eb 100644
--- a/config.tests/unix/gnu-libiconv/gnu-libiconv.pro
+++ b/config.tests/unix/gnu-libiconv/gnu-libiconv.pro
@@ -1,3 +1,2 @@
SOURCES = gnu-libiconv.cpp
CONFIG -= qt dylib
-LIBS += -liconv
diff --git a/config.tests/unix/gstreamer/gstreamer.pro b/config.tests/unix/gstreamer/gstreamer.pro
index a5e158fa21..7b6fbb4d75 100644
--- a/config.tests/unix/gstreamer/gstreamer.pro
+++ b/config.tests/unix/gstreamer/gstreamer.pro
@@ -1,22 +1,4 @@
SOURCES += gstreamer.cpp
-CONFIG += link_pkgconfig
-
-gst-0.10 {
- PKGCONFIG_PRIVATE += \
- gstreamer-0.10 \
- gstreamer-base-0.10 \
- gstreamer-audio-0.10 \
- gstreamer-video-0.10 \
- gstreamer-pbutils-0.10
-} else:gst-1.0 {
- PKGCONFIG_PRIVATE += \
- gstreamer-1.0 \
- gstreamer-base-1.0 \
- gstreamer-audio-1.0 \
- gstreamer-video-1.0 \
- gstreamer-pbutils-1.0
-}
-
CONFIG -= qt
diff --git a/config.tests/unix/harfbuzz/harfbuzz.pro b/config.tests/unix/harfbuzz/harfbuzz.pro
index 32edd6e358..71a7c355cb 100644
--- a/config.tests/unix/harfbuzz/harfbuzz.pro
+++ b/config.tests/unix/harfbuzz/harfbuzz.pro
@@ -1,3 +1,2 @@
SOURCES = harfbuzz.cpp
CONFIG -= qt dylib
-LIBS += -lharfbuzz
diff --git a/config.tests/unix/ibase/ibase.pro b/config.tests/unix/ibase/ibase.pro
index 58787851e1..8c47f66954 100644
--- a/config.tests/unix/ibase/ibase.pro
+++ b/config.tests/unix/ibase/ibase.pro
@@ -1,3 +1,2 @@
SOURCES = ibase.cpp
CONFIG -= qt dylib
-LIBS += -lgds
diff --git a/config.tests/unix/icu/icu.pro b/config.tests/unix/icu/icu.pro
index f92d7cdfb8..eeed0eaff3 100644
--- a/config.tests/unix/icu/icu.pro
+++ b/config.tests/unix/icu/icu.pro
@@ -2,4 +2,8 @@ SOURCES = icu.cpp
CONFIG += console
CONFIG -= qt dylib
-include($$PWD/../../../src/3rdparty/icu_dependency.pri)
+CONFIG += build_all
+CONFIG(debug, debug|release): \
+ LIBS += $$LIBS_DEBUG
+else: \
+ LIBS += $$LIBS_RELEASE
diff --git a/config.tests/unix/iodbc/iodbc.pro b/config.tests/unix/iodbc/iodbc.pro
deleted file mode 100644
index 68a0bd0ef4..0000000000
--- a/config.tests/unix/iodbc/iodbc.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = iodbc.cpp
-CONFIG -= qt dylib
-LIBS += -liodbc
diff --git a/config.tests/unix/ipv6ifname/ipv6ifname.pro b/config.tests/unix/ipv6ifname/ipv6ifname.pro
index 88203a782c..7574dce180 100644
--- a/config.tests/unix/ipv6ifname/ipv6ifname.pro
+++ b/config.tests/unix/ipv6ifname/ipv6ifname.pro
@@ -1,4 +1,3 @@
SOURCES = ipv6ifname.cpp
CONFIG -= qt
QT =
-LIBS += $$QMAKE_LIBS_NETWORK
diff --git a/config.tests/unix/javascriptcore-jit/hwcap_test.cpp b/config.tests/unix/javascriptcore-jit/hwcap_test.cpp
deleted file mode 100644
index 560476963a..0000000000
--- a/config.tests/unix/javascriptcore-jit/hwcap_test.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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 <asm/hwcap.h>
-
-int main (int argc, char **argv)
-{
- return 0;
-}
diff --git a/config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro b/config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro
deleted file mode 100644
index 0d5a20d7f3..0000000000
--- a/config.tests/unix/javascriptcore-jit/javascriptcore-jit.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = hwcap_test.cpp
-CONFIG -= qt dylib
diff --git a/config.tests/unix/journald/journald.pro b/config.tests/unix/journald/journald.pro
index ea765642e6..deb28ae97f 100644
--- a/config.tests/unix/journald/journald.pro
+++ b/config.tests/unix/journald/journald.pro
@@ -1,10 +1,3 @@
SOURCES = journald.c
-CONFIG += link_pkgconfig
-
-packagesExist(libsystemd): \
- PKGCONFIG_PRIVATE += libsystemd
-else: \
- PKGCONFIG_PRIVATE += libsystemd-journal
-
CONFIG -= qt
diff --git a/config.tests/unix/lgmon/lgmon.pro b/config.tests/unix/lgmon/lgmon.pro
index 7bd094dc86..33633b19f8 100644
--- a/config.tests/unix/lgmon/lgmon.pro
+++ b/config.tests/unix/lgmon/lgmon.pro
@@ -1,3 +1,2 @@
SOURCES = lgmon.cpp
CONFIG -= qt
-LIBS += -llgmon
diff --git a/config.tests/unix/libdl/libdl.pro b/config.tests/unix/libdl/libdl.pro
deleted file mode 100644
index 4016395d35..0000000000
--- a/config.tests/unix/libdl/libdl.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-include(../dlopen/dlopen.pro)
-LIBS += -ldl
diff --git a/config.tests/unix/libinput/libinput.pro b/config.tests/unix/libinput/libinput.pro
index 150119c504..941a0b73ef 100644
--- a/config.tests/unix/libinput/libinput.pro
+++ b/config.tests/unix/libinput/libinput.pro
@@ -1,4 +1,2 @@
SOURCES = libinput.cpp
CONFIG -= qt
-LIBS += $$QMAKE_LIBS_LIBINPUT
-INCLUDEPATH += $$QMAKE_INCDIR_LIBINPUT
diff --git a/config.tests/unix/libjpeg/libjpeg.pro b/config.tests/unix/libjpeg/libjpeg.pro
index 01329a11fe..173249c634 100644
--- a/config.tests/unix/libjpeg/libjpeg.pro
+++ b/config.tests/unix/libjpeg/libjpeg.pro
@@ -1,3 +1,2 @@
SOURCES = libjpeg.cpp
CONFIG -= qt dylib
-LIBS += -ljpeg
diff --git a/config.tests/unix/libpng/libpng.pro b/config.tests/unix/libpng/libpng.pro
index cdca43171c..72e5e77b06 100644
--- a/config.tests/unix/libpng/libpng.pro
+++ b/config.tests/unix/libpng/libpng.pro
@@ -1,8 +1,2 @@
SOURCES = libpng.cpp
CONFIG -= qt dylib
-!contains(QT_CONFIG, no-pkg-config) {
- CONFIG += link_pkgconfig
- PKGCONFIG += libpng
-} else {
- LIBS += -lpng
-}
diff --git a/config.tests/unix/libudev/libudev.pro b/config.tests/unix/libudev/libudev.pro
index 28b8980e2e..b557e7b17b 100644
--- a/config.tests/unix/libudev/libudev.pro
+++ b/config.tests/unix/libudev/libudev.pro
@@ -1,4 +1,2 @@
SOURCES = libudev.cpp
CONFIG -= qt
-LIBS += $$QMAKE_LIBS_LIBUDEV
-INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
diff --git a/config.tests/unix/mtdev/mtdev.pro b/config.tests/unix/mtdev/mtdev.pro
index 4c7f76c89f..14111c6dc6 100644
--- a/config.tests/unix/mtdev/mtdev.pro
+++ b/config.tests/unix/mtdev/mtdev.pro
@@ -1,6 +1,3 @@
SOURCES = mtdev.cpp
-CONFIG += link_pkgconfig
-PKGCONFIG_PRIVATE += mtdev
-
CONFIG -= qt
diff --git a/config.tests/unix/mysql/mysql.cpp b/config.tests/unix/mysql/mysql.cpp
index 697148cbcb..3f83cb1e68 100644
--- a/config.tests/unix/mysql/mysql.cpp
+++ b/config.tests/unix/mysql/mysql.cpp
@@ -36,6 +36,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
+#include <windows.h>
+#endif
#include "mysql.h"
diff --git a/config.tests/unix/mysql/mysql.pro b/config.tests/unix/mysql/mysql.pro
index 06d1880f08..745f9ee0fb 100644
--- a/config.tests/unix/mysql/mysql.pro
+++ b/config.tests/unix/mysql/mysql.pro
@@ -1,3 +1,2 @@
SOURCES = mysql.cpp
CONFIG -= qt dylib
-LIBS += -lmysqlclient
diff --git a/config.tests/unix/mysql_r/mysql_r.pro b/config.tests/unix/mysql_r/mysql_r.pro
deleted file mode 100644
index 096da69487..0000000000
--- a/config.tests/unix/mysql_r/mysql_r.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = ../mysql/mysql.cpp
-CONFIG -= qt dylib
-LIBS += -lmysqlclient_r
diff --git a/config.tests/unix/oci/oci.pro b/config.tests/unix/oci/oci.pro
index 3ffda1ddd7..c9aec08ee0 100644
--- a/config.tests/unix/oci/oci.pro
+++ b/config.tests/unix/oci/oci.pro
@@ -1,3 +1,2 @@
SOURCES = oci.cpp
CONFIG -= qt dylib
-LIBS += -lclntsh
diff --git a/config.tests/unix/odbc/odbc.cpp b/config.tests/unix/odbc/odbc.cpp
index f4a52f9dac..fc36f121c4 100644
--- a/config.tests/unix/odbc/odbc.cpp
+++ b/config.tests/unix/odbc/odbc.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#ifdef __MINGW32__
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
#include <windows.h>
#endif
#include <sql.h>
@@ -45,5 +45,7 @@
int main(int, char **)
{
+ SQLHANDLE env;
+ SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
return 0;
}
diff --git a/config.tests/unix/odbc/odbc.pro b/config.tests/unix/odbc/odbc.pro
index 70f3b668da..6c72dc7b1c 100644
--- a/config.tests/unix/odbc/odbc.pro
+++ b/config.tests/unix/odbc/odbc.pro
@@ -1,4 +1,2 @@
SOURCES = odbc.cpp
CONFIG -= qt dylib
-mingw:LIBS += -lodbc32
-else:LIBS += -lodbc
diff --git a/config.tests/unix/opengldesktop/opengldesktop.pro b/config.tests/unix/opengldesktop/opengldesktop.pro
index c3e700c50a..22c0be247d 100644
--- a/config.tests/unix/opengldesktop/opengldesktop.pro
+++ b/config.tests/unix/opengldesktop/opengldesktop.pro
@@ -1,11 +1,5 @@
SOURCES = opengldesktop.cpp
-INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
-
-for(p, QMAKE_LIBDIR_OPENGL) {
- exists($$p):LIBS += -L$$p
-}
CONFIG -= qt
-LIBS += $$QMAKE_LIBS_OPENGL
mac:DEFINES += Q_OS_MAC
diff --git a/config.tests/unix/opengles2/opengles2.pro b/config.tests/unix/opengles2/opengles2.pro
index da30b453c6..c84563f62e 100644
--- a/config.tests/unix/opengles2/opengles2.pro
+++ b/config.tests/unix/opengles2/opengles2.pro
@@ -1,12 +1,7 @@
SOURCES = opengles2.cpp
-INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
-
-for(p, QMAKE_LIBDIR_OPENGL_ES2) {
- LIBS += -L$$p
-}
CONFIG -= qt
-LIBS += $$QMAKE_LIBS_OPENGL_ES2
+
mac {
DEFINES += BUILD_ON_MAC
}
diff --git a/config.tests/unix/opengles3/opengles3.pro b/config.tests/unix/opengles3/opengles3.pro
index 720985f14d..956a3bc102 100644
--- a/config.tests/unix/opengles3/opengles3.pro
+++ b/config.tests/unix/opengles3/opengles3.pro
@@ -3,14 +3,9 @@
# the library.
SOURCES = opengles3.cpp
-INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
-
-for(p, QMAKE_LIBDIR_OPENGL_ES2) {
- LIBS += -L$$p
-}
CONFIG -= qt
-LIBS += $$QMAKE_LIBS_OPENGL_ES2
+
mac {
DEFINES += BUILD_ON_MAC
}
diff --git a/config.tests/unix/opengles31/opengles31.pro b/config.tests/unix/opengles31/opengles31.pro
index 225180e1c6..7895be9efc 100644
--- a/config.tests/unix/opengles31/opengles31.pro
+++ b/config.tests/unix/opengles31/opengles31.pro
@@ -3,11 +3,5 @@
# the library.
SOURCES = opengles31.cpp
-INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
-
-for(p, QMAKE_LIBDIR_OPENGL_ES2) {
- LIBS += -L$$p
-}
CONFIG -= qt
-LIBS += $$QMAKE_LIBS_OPENGL_ES2
diff --git a/config.tests/unix/openvg/openvg.pro b/config.tests/unix/openvg/openvg.pro
deleted file mode 100644
index 4bbde99230..0000000000
--- a/config.tests/unix/openvg/openvg.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-SOURCES += openvg.cpp
-
-!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG
-!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG
-!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG
-
-# Some OpenVG engines (e.g. ShivaVG) are implemented on top of OpenGL.
-# Add the extra includes and libraries for that case.
-openvg_on_opengl {
- !isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
- !isEmpty(QMAKE_LIBDIR_OPENGL): LIBS += -L$$QMAKE_LIBDIR_OPENGL
- !isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL
-}
-
-lower_case_includes {
- DEFINES += QT_LOWER_CASE_VG_INCLUDES
-}
-
-CONFIG -= qt
diff --git a/config.tests/unix/pcre/pcre.pro b/config.tests/unix/pcre/pcre.pro
index 7b8bfc6545..a47e6d1e96 100644
--- a/config.tests/unix/pcre/pcre.pro
+++ b/config.tests/unix/pcre/pcre.pro
@@ -1,3 +1,2 @@
SOURCES = pcre.cpp
CONFIG -= qt dylib
-LIBS += -lpcre16
diff --git a/config.tests/unix/pps/pps.pro b/config.tests/unix/pps/pps.pro
index 21bdeedbfb..af9b339f97 100644
--- a/config.tests/unix/pps/pps.pro
+++ b/config.tests/unix/pps/pps.pro
@@ -1,3 +1,2 @@
SOURCES = pps.cpp
CONFIG -= qt
-LIBS += -lpps
diff --git a/config.tests/unix/precomp.test b/config.tests/unix/precomp.test
deleted file mode 100755
index 0b8377b21a..0000000000
--- a/config.tests/unix/precomp.test
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-
-PRECOMP_SUPPORT=no
-COMPILER=$1
-VERBOSE=$2
-
-case "$COMPILER" in
-*icpc)
- cat >header.h <<EOF
-#define HEADER_H
-
-EOF
- >header.cpp
- cat >source.cpp <<EOF
-#ifndef HEADER_H
-#error no go
-#endif
-
-EOF
-
- rm -f header.pchi
- $COMPILER -pch-create header.pchi -include header.h -c header.cpp -o header.o >/dev/null 2>&1 \
- && $COMPILER -pch-use header.pchi -include header.h -c source.cpp -o source.o >/dev/null 2>&1 \
- && PRECOMP_SUPPORT=yes
-
- rm -f header.h header.cpp source.cpp
- rm -f header.pchi header.o source.o
- ;;
-
-*g++*|c++|*qcc*)
- case `"$COMPILER" -dumpversion 2>/dev/null` in
- 3.*)
- ;;
- *)
-
- >precomp_header.h
- if $COMPILER -x c-header precomp_header.h >/dev/null 2>&1; then
- $COMPILER -x c++-header precomp_header.h && PRECOMP_SUPPORT=yes
- fi
- rm -f precomp_header.h precomp_header.h.gch
- ;;
- esac
- ;;
-esac
-
-
-# done
-if [ "$PRECOMP_SUPPORT" != "yes" ]; then
- [ "$VERBOSE" = "yes" ] && echo "Precompiled-headers support disabled."
- exit 0
-else
- [ "$VERBOSE" = "yes" ] && echo "Precompiled-headers support enabled."
- exit 1
-fi
diff --git a/config.tests/unix/psql/psql.pro b/config.tests/unix/psql/psql.pro
index d0f3761bfb..dae7375be5 100644
--- a/config.tests/unix/psql/psql.pro
+++ b/config.tests/unix/psql/psql.pro
@@ -1,3 +1,2 @@
SOURCES = psql.cpp
CONFIG -= qt dylib
-LIBS *= -lpq
diff --git a/config.tests/unix/pulseaudio/pulseaudio.pro b/config.tests/unix/pulseaudio/pulseaudio.pro
index d75b16f41e..5e36c0aa81 100644
--- a/config.tests/unix/pulseaudio/pulseaudio.pro
+++ b/config.tests/unix/pulseaudio/pulseaudio.pro
@@ -1,3 +1,2 @@
SOURCES = pulseaudio.cpp
CONFIG -= qt
-LIBS +=
diff --git a/config.tests/unix/qqnx_imf/qqnx_imf.pro b/config.tests/unix/qqnx_imf/qqnx_imf.pro
index c51adb65ad..e1a2d9cecb 100644
--- a/config.tests/unix/qqnx_imf/qqnx_imf.pro
+++ b/config.tests/unix/qqnx_imf/qqnx_imf.pro
@@ -1,3 +1,2 @@
SOURCES = qqnx_imf.cpp
CONFIG -= qt
-LIBS += -linput_client
diff --git a/config.tests/x11/mitshm/mitshm.cpp b/config.tests/unix/reduce_exports/fvisibility.c
index fcc25d6eb4..71af9d99a3 100644
--- a/config.tests/x11/mitshm/mitshm.cpp
+++ b/config.tests/unix/reduce_exports/fvisibility.c
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the config.tests of the Qt Toolkit.
+** This file is part of the configuration of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,25 +37,16 @@
**
****************************************************************************/
-#ifdef Q_OS_HPUX
-#error "MITSHM not supported on HP-UX."
+#if defined(__GNUC__)
+# if (__GNUC__ < 4)
+# error "GCC3 with backported visibility patch is known to miscompile Qt"
+# endif
+__attribute((visibility("default"))) void blah();
+#elif defined(__SUNPRO_CC)
+# if (__SUNPRO_CC < 0x0550)
+# error "SunStudio 8 or later is required for ELF visibility"
+# endif
+__global void blah();
#else
-#include <X11/Xlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-
-int main(int, char **)
-{
- Display *dpy = 0;
- int minor;
- int major;
- int pixmaps;
- if (dpy && XShmQueryVersion(dpy, &major, &minor, &pixmaps)) {
- minor = 0;
- major = 0;
- pixmaps = 0;
- }
- return 0;
-}
+# error "GCC4+ or SunStudio 8+ are required to support ELF visibility"
#endif
diff --git a/config.tests/unix/reduce_exports/reduce_exports.pro b/config.tests/unix/reduce_exports/reduce_exports.pro
new file mode 100644
index 0000000000..dc8adc2637
--- /dev/null
+++ b/config.tests/unix/reduce_exports/reduce_exports.pro
@@ -0,0 +1,5 @@
+TEMPLATE = lib
+CONFIG += dll hide_symbols
+SOURCES = fvisibility.c
+
+isEmpty(QMAKE_CFLAGS_HIDESYMS): error("Nope")
diff --git a/config.tests/x11/xfixes/xfixes.cpp b/config.tests/unix/reduce_relocs/bsymbolic_functions.c
index 12e402f175..36ff410c81 100644
--- a/config.tests/x11/xfixes/xfixes.cpp
+++ b/config.tests/unix/reduce_relocs/bsymbolic_functions.c
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the config.tests of the Qt Toolkit.
+** This file is part of the configuration of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,17 +37,8 @@
**
****************************************************************************/
-#include <X11/Xlib.h>
-#include <X11/extensions/Xfixes.h>
-
-#if XFIXES_MAJOR < 2
-# error "Required Xfixes version 2.0 not found."
+#if !(defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64))
+# error Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129).
#endif
-int main(int, char **)
-{
- XFixesSelectionNotifyEvent event;
- event.type = 0;
- return 0;
-}
-
+int main() { return 0; }
diff --git a/config.tests/unix/reduce_relocs/reduce_relocs.pro b/config.tests/unix/reduce_relocs/reduce_relocs.pro
new file mode 100644
index 0000000000..2f23465a3f
--- /dev/null
+++ b/config.tests/unix/reduce_relocs/reduce_relocs.pro
@@ -0,0 +1,5 @@
+TEMPLATE = lib
+CONFIG += dll bsymbolic_functions
+SOURCES = bsymbolic_functions.c
+
+isEmpty(QMAKE_LFLAGS_BSYMBOLIC_FUNC): error("Nope")
diff --git a/config.tests/unix/stdint/main.cpp b/config.tests/unix/sctp/sctp.cpp
index f232e8bb85..61c33d5fc5 100644
--- a/config.tests/unix/stdint/main.cpp
+++ b/config.tests/unix/sctp/sctp.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the config.tests of the Qt Toolkit.
@@ -37,11 +37,26 @@
**
****************************************************************************/
-/* Check for the presence of stdint.h */
-#include <stdint.h>
+/*
+ Sample program for configure to test for SCTP sockets support
+ on target platforms.
+*/
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
int main()
{
+ int fd;
+ sctp_initmsg sctpInitMsg;
+ socklen_t sctpInitMsgSize = sizeof(sctpInitMsg);
+
+ fd = socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP);
+ if (fd == -1 || getsockopt(fd, SOL_SCTP, SCTP_INITMSG, &sctpInitMsg,
+ &sctpInitMsgSize) != 0)
+ return 1;
+
return 0;
}
-
diff --git a/config.tests/unix/sctp/sctp.pro b/config.tests/unix/sctp/sctp.pro
new file mode 100644
index 0000000000..2138254732
--- /dev/null
+++ b/config.tests/unix/sctp/sctp.pro
@@ -0,0 +1,3 @@
+SOURCES = sctp.cpp
+CONFIG -= qt
+QT =
diff --git a/config.tests/unix/shivavg/shivavg.cpp b/config.tests/unix/shivavg/shivavg.cpp
deleted file mode 100644
index 33fb7d226d..0000000000
--- a/config.tests/unix/shivavg/shivavg.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests 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 <vg/openvg.h>
-
-int main(int, char **)
-{
- VGint i;
- i = 2;
- vgFlush();
- vgDestroyContextSH();
- return 0;
-}
diff --git a/config.tests/unix/shivavg/shivavg.pro b/config.tests/unix/shivavg/shivavg.pro
deleted file mode 100644
index 39d7bcc78a..0000000000
--- a/config.tests/unix/shivavg/shivavg.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-SOURCES += shivavg.cpp
-
-!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG
-!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS += -L$$QMAKE_LIBDIR_OPENVG
-!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG
-
-!isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
-!isEmpty(QMAKE_LIBDIR_OPENGL): LIBS += -L$$QMAKE_LIBDIR_OPENGL
-!isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL
-
-CONFIG -= qt
diff --git a/config.tests/unix/slog2/slog2.pro b/config.tests/unix/slog2/slog2.pro
index e65460bb94..269a88a383 100644
--- a/config.tests/unix/slog2/slog2.pro
+++ b/config.tests/unix/slog2/slog2.pro
@@ -1,3 +1,2 @@
SOURCES = slog2.cpp
CONFIG -= qt
-LIBS += -lslog2
diff --git a/config.tests/unix/sqlite2/sqlite2.pro b/config.tests/unix/sqlite2/sqlite2.pro
index 7e69fdf2f3..b1252721dc 100644
--- a/config.tests/unix/sqlite2/sqlite2.pro
+++ b/config.tests/unix/sqlite2/sqlite2.pro
@@ -1,3 +1,2 @@
SOURCES = sqlite2.cpp
CONFIG -= qt dylib
-LIBS += -lsqlite
diff --git a/config.tests/unix/stdint/stdint.pro b/config.tests/unix/stdint/stdint.pro
deleted file mode 100644
index 9975484889..0000000000
--- a/config.tests/unix/stdint/stdint.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = main.cpp
-CONFIG -= x11 qt
-
diff --git a/config.tests/unix/tds/tds.pro b/config.tests/unix/tds/tds.pro
index 6712779d58..f60fc0a602 100644
--- a/config.tests/unix/tds/tds.pro
+++ b/config.tests/unix/tds/tds.pro
@@ -1,3 +1,2 @@
SOURCES = tds.cpp
CONFIG -= qt dylib
-LIBS += -lsybdb
diff --git a/config.tests/unix/tslib/tslib.pro b/config.tests/unix/tslib/tslib.pro
index 1191120b89..6fc652dd96 100644
--- a/config.tests/unix/tslib/tslib.pro
+++ b/config.tests/unix/tslib/tslib.pro
@@ -1,3 +1,2 @@
SOURCES = tslib.cpp
CONFIG -= qt
-LIBS += -lts
diff --git a/config.tests/unix/zlib/zlib.pro b/config.tests/unix/zlib/zlib.pro
index d9bd03e5df..6a6b324611 100644
--- a/config.tests/unix/zlib/zlib.pro
+++ b/config.tests/unix/zlib/zlib.pro
@@ -1,3 +1,2 @@
SOURCES = zlib.cpp
CONFIG -= qt dylib
-LIBS += -lz
diff --git a/config.tests/win/directwrite/directwrite.pro b/config.tests/win/directwrite/directwrite.pro
index 9a4612ca11..88ff6ee2b8 100644
--- a/config.tests/win/directwrite/directwrite.pro
+++ b/config.tests/win/directwrite/directwrite.pro
@@ -1,4 +1,3 @@
SOURCES = directwrite.cpp
-LIBS += -ldwrite
CONFIG -= qt
CONFIG += console
diff --git a/config.tests/win/directwrite2/directwrite2.pro b/config.tests/win/directwrite2/directwrite2.pro
index ec37247017..5d6fe24a4b 100644
--- a/config.tests/win/directwrite2/directwrite2.pro
+++ b/config.tests/win/directwrite2/directwrite2.pro
@@ -1,4 +1,3 @@
SOURCES = directwrite2.cpp
-LIBS += -ldwrite
CONFIG -= qt
CONFIG += console
diff --git a/config.tests/x11/glxfbconfig/glxfbconfig.cpp b/config.tests/x11/glxfbconfig/glxfbconfig.cpp
deleted file mode 100644
index 9a2a0f166c..0000000000
--- a/config.tests/x11/glxfbconfig/glxfbconfig.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests 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 <GL/gl.h>
-#include <GL/glx.h>
-
-int main(int, char **)
-{
- GLXFBConfig config;
- config = 0;
-
- return 0;
-}
diff --git a/config.tests/x11/glxfbconfig/glxfbconfig.pro b/config.tests/x11/glxfbconfig/glxfbconfig.pro
deleted file mode 100644
index 65f855a5f2..0000000000
--- a/config.tests/x11/glxfbconfig/glxfbconfig.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-SOURCES = glxfbconfig.cpp
-CONFIG += x11
-INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
-
-for(p, QMAKE_LIBDIR_OPENGL) {
- exists($$p):LIBS += -L$$p
-}
-
-CONFIG -= qt
-LIBS += -lGL
diff --git a/config.tests/x11/mitshm/mitshm.pro b/config.tests/x11/mitshm/mitshm.pro
deleted file mode 100644
index 8a40317d97..0000000000
--- a/config.tests/x11/mitshm/mitshm.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCES = mitshm.cpp
-CONFIG += x11
-CONFIG -= qt
-LIBS += -lXext
-hpux*:DEFINES+=Q_OS_HPUX
diff --git a/config.tests/x11/notype.test b/config.tests/x11/notype.test
deleted file mode 100755
index 3a01d8f1d7..0000000000
--- a/config.tests/x11/notype.test
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-QMKSPEC=$1
-XPLATFORM=`basename $1`
-VERBOSE=$2
-SRCDIR=$3
-OUTDIR=$4
-
-# debuggery
-[ "$VERBOSE" = "yes" ] && echo "Detecting broken X11 headers... ($*)"
-
-# Detect broken X11 headers when using GCC 2.95 or later
-# Xsun on Solaris 2.5.1:
-# Patches are available for Solaris 2.6, 7, and 8 but
-# not for Solaris 2.5.1.
-# HP-UX:
-# Patches are available for HP-UX 10.20, 11.00, and 11.11.
-# AIX 4.3.3 and AIX 5.1:
-# Headers are clearly broken on all AIX versions, and we
-# don't know of any patches. The strange thing is that we
-# did not get any reports about this issue until very
-# recently, long after gcc 3.0.x was released. It seems to
-# work for us with gcc 2.95.2.
-NOTYPE=no
-
-if [ $XPLATFORM = "solaris-g++" -o $XPLATFORM = "hpux-g++" -o $XPLATFORM = "aix-g++" -o $XPLATFORM = "aix-g++-64" ]; then
- NOTYPE=yes
-
- test -d "$OUTDIR/config.tests/x11/notype" || mkdir -p "$OUTDIR/config.tests/x11/notype"
- "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1
- cd "$OUTDIR/config.tests/x11/notype"
-
- if [ "$VERBOSE" = "yes" ]; then
- $MAKE
- else
- $MAKE >/dev/null 2>&1
- fi
-
- [ -x notypetest ] && NOTYPE=no
-fi
-
-# done
-if [ "$NOTYPE" = "yes" ]; then
- [ "$VERBOSE" = "yes" ] && echo "Broken X11 headers detected."
- exit 0
-else
- [ "$VERBOSE" = "yes" ] && echo "X11 headers look good."
- exit 1
-fi
diff --git a/config.tests/x11/notype/notypetest.pro b/config.tests/x11/notype/notypetest.pro
deleted file mode 100644
index 6ce2c62619..0000000000
--- a/config.tests/x11/notype/notypetest.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE=app
-TARGET=notypetest
-CONFIG-=qt
-CONFIG+=x11
-SOURCES=notypetest.cpp
diff --git a/config.tests/x11/opengl/opengl.cpp b/config.tests/x11/opengl/opengl.cpp
deleted file mode 100644
index e73c46b9e6..0000000000
--- a/config.tests/x11/opengl/opengl.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests 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 <GL/gl.h>
-
-int main(int, char **)
-{
- GLuint x;
- x = 0;
- return 0;
-}
diff --git a/config.tests/x11/opengl/opengl.pro b/config.tests/x11/opengl/opengl.pro
deleted file mode 100644
index d6814f1bd5..0000000000
--- a/config.tests/x11/opengl/opengl.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-SOURCES = opengl.cpp
-CONFIG += x11
-INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
-
-for(p, QMAKE_LIBDIR_OPENGL) {
- exists($$p):LIBS += -L$$p
-}
-
-CONFIG -= qt
-mingw:LIBS += -lopengl32
-else:LIBS += -lGL
diff --git a/config.tests/x11/xcursor/xcursor.cpp b/config.tests/x11/xcursor/xcursor.cpp
deleted file mode 100644
index 990534efea..0000000000
--- a/config.tests/x11/xcursor/xcursor.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests 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 <X11/Xlib.h>
-#include <X11/Xcursor/Xcursor.h>
-
-#if !defined(XCURSOR_LIB_MAJOR)
-# define XCURSOR_LIB_MAJOR XCURSOR_MAJOR
-#endif
-#if !defined(XCURSOR_LIB_MINOR)
-# define XCURSOR_LIB_MINOR XCURSOR_MINOR
-#endif
-
-#if XCURSOR_LIB_MAJOR == 1 && XCURSOR_LIB_MINOR >= 0
-# define XCURSOR_FOUND
-#else
-# define
-# error "Required Xcursor version 1.0 not found."
-#endif
-
-int main(int, char **)
-{
- XcursorImage *image;
- image = 0;
- XcursorCursors *cursors;
- cursors = 0;
- return 0;
-}
diff --git a/config.tests/x11/xcursor/xcursor.pro b/config.tests/x11/xcursor/xcursor.pro
deleted file mode 100644
index b1e69be29a..0000000000
--- a/config.tests/x11/xcursor/xcursor.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-SOURCES = xcursor.cpp
-CONFIG += x11
-CONFIG -= qt
-LIBS += -lXcursor
diff --git a/config.tests/x11/xfixes/xfixes.pro b/config.tests/x11/xfixes/xfixes.pro
deleted file mode 100644
index cc94a11bc2..0000000000
--- a/config.tests/x11/xfixes/xfixes.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG += x11
-CONFIG -= qt
-SOURCES = xfixes.cpp
diff --git a/config.tests/x11/xinput2/xinput2.pro b/config.tests/x11/xinput2/xinput2.pro
index ae8819b3d1..4788f0e14b 100644
--- a/config.tests/x11/xinput2/xinput2.pro
+++ b/config.tests/x11/xinput2/xinput2.pro
@@ -1,4 +1,3 @@
CONFIG += x11
CONFIG -= qt
-LIBS += -lXi
SOURCES = xinput2.cpp
diff --git a/config.tests/x11/xkb/xkb.cpp b/config.tests/x11/xkb/xkb.cpp
deleted file mode 100644
index 9876f67a71..0000000000
--- a/config.tests/x11/xkb/xkb.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests 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 <X11/Xlib.h>
-#include <X11/XKBlib.h>
-
-int main(int, char **)
-{
- Display *display = 0;
-
- int opcode = -1;
- int xkbEventBase = -1;
- int xkbErrorBase = -1;
- int xkblibMajor = XkbMajorVersion;
- int xkblibMinor = XkbMinorVersion;
- XkbQueryExtension(display, &opcode, &xkbEventBase, &xkbErrorBase, &xkblibMajor, &xkblibMinor);
-
- int keycode = 0;
- unsigned int state = 0;
- KeySym keySym;
- unsigned int consumedModifiers;
- XkbLookupKeySym(display, keycode, state, &consumedModifiers, &keySym);
-
- XkbDescPtr xkbDesc = XkbGetMap(display, XkbAllClientInfoMask, XkbUseCoreKbd);
- int w = XkbKeyGroupsWidth(xkbDesc, keycode);
- keySym = XkbKeySym(xkbDesc, keycode, w-1);
- XkbFreeClientMap(xkbDesc, XkbAllClientInfoMask, true);
-
- state = XkbPCF_GrabsUseXKBStateMask;
- (void) XkbSetPerClientControls(display, state, &state);
-
- return 0;
-}
diff --git a/config.tests/x11/xkb/xkb.pro b/config.tests/x11/xkb/xkb.pro
deleted file mode 100644
index d4ec2223df..0000000000
--- a/config.tests/x11/xkb/xkb.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = xkb.cpp
-CONFIG += x11
-CONFIG -= qt
diff --git a/config.tests/x11/xrandr/xrandr.pro b/config.tests/x11/xrandr/xrandr.pro
deleted file mode 100644
index 3fb2910b5e..0000000000
--- a/config.tests/x11/xrandr/xrandr.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-SOURCES = xrandr.cpp
-CONFIG += x11
-CONFIG -= qt
-LIBS += -lXrender -lXrandr
diff --git a/config.tests/x11/xrender/xrender.pro b/config.tests/x11/xrender/xrender.pro
index e7786420fa..ab5c5efa77 100644
--- a/config.tests/x11/xrender/xrender.pro
+++ b/config.tests/x11/xrender/xrender.pro
@@ -1,4 +1,3 @@
SOURCES = xrender.cpp
CONFIG += x11
CONFIG -= qt
-LIBS += -lXrender
diff --git a/config.tests/x11/xshape/xshape.cpp b/config.tests/x11/xshape/xshape.cpp
deleted file mode 100644
index 804a9d044e..0000000000
--- a/config.tests/x11/xshape/xshape.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests 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 <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/shape.h>
-
-int main(int, char **)
-{
- XShapeEvent shapeevent;
- shapeevent.type = 0;
- return 0;
-}
diff --git a/config.tests/x11/xshape/xshape.pro b/config.tests/x11/xshape/xshape.pro
deleted file mode 100644
index 611c048e39..0000000000
--- a/config.tests/x11/xshape/xshape.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG += x11
-CONFIG -= qt
-SOURCES = xshape.cpp
diff --git a/config.tests/x11/xsync/xsync.pro b/config.tests/x11/xsync/xsync.pro
deleted file mode 100644
index 58b82383ea..0000000000
--- a/config.tests/x11/xsync/xsync.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG += x11
-CONFIG -= qt
-SOURCES = xsync.cpp
diff --git a/config_help.txt b/config_help.txt
new file mode 100644
index 0000000000..76c0c60348
--- /dev/null
+++ b/config_help.txt
@@ -0,0 +1,299 @@
+Usage: configure [options] [assignments]
+
+Configure understands variable assignments like VAR=value on the command line.
+These override any values possibly obtained from pkg-config. The variables
+are mentioned in the descriptions of the options they relate to.
+
+It is also possible to manipulate any QMAKE_* variable, to amend the values
+from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3.
+
+Top-level installation directories:
+ -prefix <dir> ...... The deployment directory, as seen on the target device.
+ [/usr/local/Qt-$QT_VERSION, $PWD if -developer-build]
+ -extprefix <dir> ... The installation directory, as seen on the host machine.
+ [SYSROOT/PREFIX]
+ -hostprefix [dir] .. The installation directory for build tools running on
+ the host machine. If [dir] is not given, the current
+ build directory will be used. [EXTPREFIX]
+ -external-hostbindir <path> ... Path to Qt tools built for this machine.
+ Use this when -platform does not match the current
+ system, i.e., to make a Canadian Cross Build.
+
+Fine tuning of installation directory layout. Note that all directories
+except -sysconfdir should be located under -prefix/-hostprefix:
+
+ -bindir <dir> ......... Executables [PREFIX/bin]
+ -headerdir <dir> ...... Header files [PREFIX/include]
+ -libdir <dir> ......... Libraries [PREFIX/lib]
+ -archdatadir <dir> .... Arch-dependent data [PREFIX]
+ -plugindir <dir> ...... Plugins [ARCHDATADIR/plugins]
+ -libexecdir <dir> ..... Helper programs [ARCHDATADIR/bin on Windows,
+ ARCHDATADIR/libexec otherwise]
+ -importdir <dir> ...... QML1 imports [ARCHDATADIR/imports]
+ -qmldir <dir> ......... QML2 imports [ARCHDATADIR/qml]
+ -datadir <dir> ........ Arch-independent data [PREFIX]
+ -docdir <dir> ......... Documentation [DATADIR/doc]
+ -translationdir <dir> . Translations [DATADIR/translations]
+ -sysconfdir <dir> ..... Settings used by Qt programs [PREFIX/etc/xdg]
+ -examplesdir <dir> .... Examples [PREFIX/examples]
+ -testsdir <dir> ....... Tests [PREFIX/tests]
+
+ -hostbindir <dir> ..... Host executables [HOSTPREFIX/bin]
+ -hostlibdir <dir> ..... Host libraries [HOSTPREFIX/lib]
+ -hostdatadir <dir> .... Data used by qmake [HOSTPREFIX]
+
+Conventions for the remaining options: When an option's description is
+followed by a list of values in brackets, the interpretation is as follows:
+'yes' represents the bare option; all other values are possible prefixes to
+the option, e.g., -no-gui. Alternatively, the value can be assigned, e.g.,
+-gui=yes. Values are listed in the order they are tried if not specified;
+'auto' is a shorthand for 'yes/no'. Solitary 'yes' and 'no' represent binary
+options without auto-detection.
+
+Configure meta:
+
+ -help, -h ............ Display this help screen
+ -verbose, -v ......... Print verbose messages during configuration
+ -continue ............ Continue configure despite errors
+ -redo ................ Re-configure with previously used options.
+ Additional options may be passed, but will not be
+ saved for later use by -redo.
+ -recheck ............. Discard cached negative configure test results.
+ Use this after installing missing dependencies.
+ -recheck-all ......... Discard all cached configure test results.
+
+Build options:
+
+ -opensource .......... Build the Open-Source Edition of Qt
+ -commercial .......... Build the Commercial Edition of Qt
+ -confirm-license ..... Automatically acknowledge the license
+
+ -release ............. Build Qt with debugging turned off [yes]
+ -debug ............... Build Qt with debugging turned on [no]
+ -debug-and-release ... Build two versions of Qt, with and without
+ debugging turned on [yes] (Apple and Windows only)
+ -optimized-tools ..... Build optimized host tools even in debug build [no]
+ -force-debug-info .... Create symbol files for release builds [no]
+ -separate-debug-info . Split off debug information to separate files [no]
+ -strip ............... Strip release binaries of unneeded symbols [yes]
+ -force-asserts ....... Enable Q_ASSERT even in release builds [no]
+ -developer-build ..... Compile and link Qt for developing Qt itself
+ (exports for auto-tests, extra checks, etc.) [no]
+
+ -shared .............. Build shared Qt libraries [yes] (no for UIKit)
+ -static .............. Build static Qt libraries [no] (yes for UIKit)
+ -framework ........... Build Qt framework bundles [yes] (Apple only)
+
+ -platform <target> ... Select host mkspec [detected]
+ -host-option <key=value> ..... Add option for the host mkspec
+ -xplatform <target> .. Select target mkspec when cross-compiling [PLATFORM]
+ -device <name> ....... Cross-compile for device <name>
+ -device-option <key=value> ... Add option for the device mkspec
+
+ -qtnamespace <name> .. Wrap all Qt library code in 'namespace <name> {...}'.
+ -qtlibinfix <infix> .. Rename all libQt5*.so to libQt5*<infix>.so.
+
+ -testcocoon .......... Instrument with the TestCocoon code coverage tool [no]
+ -gcov ................ Instrument with the GCov code coverage tool [no]
+ -sanitize {address|thread|memory|undefined}
+ Instrument with the specified compiler sanitizer.
+
+ -c++std <edition> .... Select C++ standard <edition> [c++1z/c++14/c++11]
+ (Not supported with MSVC)
+ -rtti ................ Build with Runtime Type Information [yes] (MSVC only)
+
+ -sse2 ................ Use SSE2 instructions [auto]
+ -sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512
+ Enable use of particular x86 instructions [auto]
+ Enabled ones are still subject to runtime detection.
+ -mips_dsp/-mips_dspr2 Use MIPS DSP/rev2 instructions [auto]
+
+ -qreal <type> ........ typedef qreal to the specified type. [double]
+ Note: this affects binary compatibility.
+
+ -R <string> .......... Add an explicit runtime library path to the Qt
+ libraries. Supports paths relative to LIBDIR.
+ -rpath ............... Link Qt libraries and executables using the library
+ install path as a runtime library path. Similar to
+ -R LIBDIR. On Apple platforms, disabling this implies
+ using absolute install names (based in LIBDIR) for
+ dynamic libraries and frameworks. [auto]
+
+ -reduce-exports ...... Reduce amount of exported symbols [auto]
+ -reduce-relocations .. Reduce amount of relocations [auto] (Unix only)
+
+ -plugin-manifests .... Embed manifests into plugins [no] (Windows only)
+ -static-runtime ...... With -static, use static runtime [no] (Windows only)
+
+ -pch ................. Use precompiled headers [auto]
+ -ltcg ................ Use Link Time Code Generation [no]
+ -use-gold-linker ..... Use the GNU gold linker [auto]
+ -incredibuild-xge .... Use the IncrediBuild XGE [no] (Windows only)
+ -make-tool <tool> .... Use <tool> to build qmake [nmake] (Windows only)
+ -mp .................. Use multiple processors for compilation (MSVC only)
+
+ -warnings-are-errors . Treat warnings as errors [no; yes if -developer-build]
+ -silent .............. Reduce the build output so that warnings and errors
+ can be seen more easily
+
+Build environment:
+
+ -sysroot <dir> ....... Set <dir> as the target sysroot
+ -gcc-sysroot ......... With -sysroot, pass --sysroot to the compiler [yes]
+
+ -pkg-config .......... Use pkg-config [auto] (Unix only)
+
+ -D <string> .......... Pass additional preprocessor define
+ -I <string> .......... Pass additional include path
+ -L <string> .......... Pass additional library path
+ -F <string> .......... Pass additional framework path (Apple only)
+
+ -sdk <sdk> ........... Build Qt using Apple provided SDK <sdk>. The argument
+ should be one of the available SDKs as listed by
+ 'xcodebuild -showsdks'.
+ Note that the argument applies only to Qt libraries
+ and applications built using the target mkspec - not
+ host tools such as qmake, moc, rcc, etc.
+
+ -android-sdk path .... Set Android SDK root path [$ANDROID_SDK_ROOT]
+ -android-ndk path .... Set Android NDK root path [$ANDROID_NDK_ROOT]
+ -android-ndk-platform Set Android platform
+ -android-ndk-host .... Set Android NDK host (linux-x86, linux-x86_64, etc.)
+ [$ANDROID_NDK_HOST]
+ -android-arch ........ Set Android architecture (armeabi, armeabi-v7a,
+ arm64-v8a, x86, x86_64, mips, mips64)
+ -android-toolchain-version ... Set Android toolchain version
+ -android-style-assets Automatically extract style assets from the device at
+ run time. This option makes the Android style behave
+ correctly, but also makes the Android platform plugin
+ incompatible with the LGPL2.1. [yes]
+
+Component selection:
+
+ -skip <repo> ......... Exclude an entire repository from the build.
+ -make <part> ......... Add <part> to the list of parts to be built.
+ Specifying this option clears the default list first.
+ [libs and examples, also tools if not cross-building,
+ also tests if -developer-build]
+ -nomake <part> ....... Exclude <part> from the list of parts to be built.
+ -compile-examples .... When unset, install only the sources of examples [yes]
+ -gui ................. Build the Qt GUI module and dependencies [yes]
+ -widgets ............. Build the Qt Widgets module and dependencies [yes]
+ -no-dbus ............. Do not build the Qt D-Bus module
+ [default on Android and Windows]
+ -dbus-linked ......... Build Qt D-Bus and link to libdbus-1 [auto]
+ -dbus-runtime ........ Build Qt D-Bus and dynamically load libdbus-1 [no]
+ DBUS_PATH= DBUS_HOST_PATH=
+ -feature-<feature> ... Enable <feature>. The available features are described
+ in src/corelib/global/qfeatures.txt. [all enabled]
+ -accessibility ....... Enable accessibility support [yes]
+ Note: Disabling accessibility is not recommended.
+ -qml-debug ........... Enable QML debugging support [yes]
+
+Qt comes with bundled copies of some 3rd party libraries. These are used
+by default if auto-detection of the respective system library fails.
+
+Core options:
+
+ -doubleconversion .... Select used double conversion library [system/qt/no]
+ No implies use of sscanf_l and snprintf_l (imprecise).
+ -glib ................ Enable Glib support [no; auto on Unix]
+ -eventfd ............. Enable eventfd support
+ -inotify ............. Enable inotify support
+ -iconv ............... Enable iconv(3) support [posix/sun/gnu/no] (Unix only)
+ -icu ................. Enable ICU support [auto]
+ -pps ................. Enable PPS support [auto] (QNX only)
+ -pcre ................ Select used libpcre3 [system/qt]
+ -zlib ................ Select used zlib [system/qt]
+ ZLIB_LIBS=
+
+ Logging backends:
+ -journald .......... Enable journald support [no] (Unix only)
+ -syslog ............ Enable syslog support [no] (Unix only)
+ -slog2 ............. Enable slog2 support [auto] (QNX only)
+
+Network options:
+
+ -ssl ................. Enable either SSL support method [auto]
+ -no-openssl .......... Do not use OpenSSL [default on Apple and WinRT]
+ -openssl-linked ...... Use OpenSSL and link to libssl [no]
+ -openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto]
+ OPENSSL_PATH= OPENSSL_LIBS=, and on Windows also
+ OPENSSL_LIBS_DEBUG= OPENSSL_LIBS_RELEASE=
+ -securetransport ..... Use SecureTransport [auto] (Apple only)
+
+ -sctp ................ Enable SCTP support [no]
+
+ -libproxy ............ Enable use of libproxy [no]
+ -system-proxies ...... Use system network proxies by default [yes]
+
+Gui, printing, widget options:
+
+ -cups ................ Enable CUPS support [auto] (Unix only)
+
+ -fontconfig .......... Enable Fontconfig support [auto] (Unix only)
+ -freetype ............ Select used FreeType [system/qt/no]
+ -harfbuzz ............ Select used HarfBuzz-NG [system/qt/no]
+ (Not auto-detected on Apple and Windows)
+
+ -gtk ................. Enable GTK platform theme support [auto]
+
+ -lgmon ............... Enable lgmon support [auto] (QNX only)
+
+ -no-opengl ........... Disable OpenGL support
+ -opengl <api> ........ Enable OpenGL support. Supported APIs:
+ es2 (default on Windows), desktop (default on Unix),
+ dynamic (Windows only)
+ -opengles3 ........... Enable OpenGL ES 3.x support instead of ES 2.x [auto]
+ -angle ............... Use bundled ANGLE to support OpenGL ES 2.0 [auto]
+ (Windows only)
+
+ -qpa <name> .......... Select default QPA backend (e.g., xcb, cocoa, windows)
+ -xcb-xlib............. Enable Xcb-Xlib support [auto]
+
+ Platform backends:
+ -directfb .......... Enable DirectFB support [no] (Unix only)
+ -eglfs ............. Enable EGLFS support [auto; no on Android and Windows]
+ -gbm ............... Enable backends for GBM [auto] (Linux only)
+ -kms ............... Enable backends for KMS [auto] (Linux only)
+ -linuxfb ........... Enable Linux Framebuffer support [auto] (Linux only)
+ -mirclient ......... Enable Mir client support [no] (Linux only)
+ -xcb ............... Select used xcb-* libraries [system/qt/no]
+ (-qt-xcb still uses system version of libxcb itself)
+
+ Input backends:
+ -evdev ............. Enable evdev support [auto]
+ -imf ............... Enable IMF support [auto] (QNX only)
+ -libinput .......... Enable libinput support [auto]
+ -mtdev ............. Enable mtdev support [auto]
+ -tslib ............. Enable tslib support [auto]
+ -xinput2 ........... Enable XInput2 support [auto]
+ -xkbcommon-x11 ..... Select xkbcommon used in combination with xcb
+ [system/qt/no]
+ -xkb-config-root <dir> ... With -qt-xkbcommon-x11, set default XKB config
+ root <dir> [detect]
+ -xkbcommon-evdev ... Enable X-less xkbcommon in combination with libinput
+ [auto]
+
+ Image formats:
+ -gif ............... Enable reading support for GIF [auto]
+ -ico ............... Enable support for ICO [yes]
+ -libpng ............ Select used libpng [system/qt/no]
+ -libjpeg ........... Select used libjpeg [system/qt/no]
+
+Database options:
+
+ -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
+ db2 ibase mysql oci odbc psql sqlite2 sqlite tds
+ [all auto]
+ MYSQL_PATH= PSQL_LIBS= SYBASE= SYBASE_LIBS=
+ -sqlite .............. Select used sqlite3 [system/qt]
+
+Multimedia options:
+
+ -pulseaudio .......... Enable PulseAudio support [auto]
+ -alsa ................ Enable ALSA support [auto]
+ -no-gstreamer ........ Disable support for GStreamer
+ -gstreamer [version] . Enable GStreamer support [auto]
+ With no parameter, 1.0 is tried first, then 0.10.
+ -wmf-backend ......... Enable WMF support [no] (Windows only)
diff --git a/configure b/configure
index ba94d08714..789ba4cc74 100755
--- a/configure
+++ b/configure
@@ -42,7 +42,6 @@ outpath=`/bin/pwd`
# where to find which..
unixtests="$relpath/config.tests/unix"
-mactests="$relpath/config.tests/mac"
WHICH="$unixtests/which.test"
PERL=`$WHICH perl 2>/dev/null`
@@ -76,33 +75,63 @@ fi
# do this early so we don't store it in config.status
CFG_TOPLEVEL=
+relpathMangled=$relpath
+outpathPrefix=
if [ x"$1" = x"-top-level" ]; then
CFG_TOPLEVEL=yes
+ relpathMangled=`dirname "$relpath"`
+ outpathPrefix=../
shift
fi
-# later cache the command line in config.status
-OPT_CMDLINE=
+CFG_REDO=no
+OPT_CMDLINE= # excluding -verbose (for config.opt)
+QMAKE_CMDLINE= # including -verbose (for actual parsing)
+set -f # suppress globbing in for loop
+SAVED_IFS=$IFS
+IFS='
+'
for i in "$@"; do
- if [ "x$i" != "x-v" ]; then
- [ -z "${i##* *}" ] && i="'$i'"
- OPT_CMDLINE="$OPT_CMDLINE $i"
- fi
+ case $i in
+ -redo|--redo)
+ optfile=${outpathPrefix}config.opt
+ if test -n "$CFG_TOPLEVEL" && ! test -f $optfile; then
+ optfile=config.opt
+ fi
+ if ! test -f $optfile; then
+ echo >&2 "No config.opt present - cannot redo configuration."
+ exit 1
+ fi
+ for a in `cat $optfile`; do
+ OPT_CMDLINE="$OPT_CMDLINE
+$a"
+ QMAKE_CMDLINE="$QMAKE_CMDLINE
+$a"
+ done
+ CFG_REDO=yes # suppress repeated config.opt writeout
+ continue
+ ;;
+ -v|-verbose|--verbose|-no-v|-no-verbose|--no-verbose)
+ ;;
+ *)
+ OPT_CMDLINE="$OPT_CMDLINE
+$i"
+ ;;
+ esac
+ QMAKE_CMDLINE="$QMAKE_CMDLINE
+$i"
+done
+set --
+for i in $QMAKE_CMDLINE; do
+ set -- "$@" "$i"
done
+set +f
+IFS=$SAVED_IFS
# initialize global variables
-CONFIG_SEPARATORS=`printf ' \t'`
-QMAKE_SWITCHES=
-QMAKE_VARS=
-QMAKE_CONFIG=
-QTCONFIG_CONFIG=
-QT_CONFIG=
-SUPPORTED=
-QMAKE_VARS_FILE=.qmake.vars
DEVICE_VARS_FILE=.device.vars
HOST_VARS_FILE=.host.vars
-:> "$QMAKE_VARS_FILE"
:> "$DEVICE_VARS_FILE"
:> "$HOST_VARS_FILE"
@@ -110,11 +139,6 @@ HOST_VARS_FILE=.host.vars
# utility functions
#-------------------------------------------------------------------------------
-shellEscape()
-{
- echo "$@" | sed 's/ /\ /g'
-}
-
makeabs()
{
local FILE="$1"
@@ -135,44 +159,6 @@ makeabs()
echo "$RES" | sed 's,//,/,g; s,/$,,'
}
-# Adds a new qmake variable to the cache
-# Usage: QMakeVar mode varname contents
-# where mode is one of: set, add, del
-QMakeVar()
-{
- case "$1" in
- set)
- eq="="
- ;;
- add)
- eq="+="
- ;;
- del)
- eq="-="
- ;;
- *)
- echo >&2 "BUG: wrong command to QMakeVar: $1"
- ;;
- esac
-
- echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
-}
-
-shellArgumentListToQMakeListHelper()
-{
- local retval
- for arg in "$@"; do retval="$retval \"$arg\""; done
- echo "$retval"
-}
-
-# Convert a string usable on a shell command line into word-by-word quoted
-# qmake list.
-shellArgumentListToQMakeList()
-{
- # eval is needed for the shell to interpret the backslash escape sequences
- eval shellArgumentListToQMakeListHelper "$@"
-}
-
# Helper function for getQMakeConf. It parses include statements in
# qmake.conf and prints out the expanded file
expandQMakeConf()
@@ -295,6 +281,18 @@ macSDKify()
iphonesimulator*)
version_min_flag="-mios-simulator-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
;;
+ appletvos*)
+ version_min_flag="-mappletvos-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")"
+ ;;
+ appletvsimulator*)
+ version_min_flag="-mtvos-simulator-version-min=$(getSingleQMakeVariable QMAKE_TVOS_DEPLOYMENT_TARGET "$1")"
+ ;;
+ watchos*)
+ version_min_flag="-mwatchos-version-min=$(getSingleQMakeVariable QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
+ ;;
+ watchsimulator*)
+ version_min_flag="-mwatchos-simulator-version-min=$(getSingleQMakeVariable QMAKE_WATCHOS_DEPLOYMENT_TARGET "$1")"
+ ;;
*)
;;
esac
@@ -342,113 +340,6 @@ getXQMakeConf()
getSingleQMakeVariable "$1" "$xspecvals"
}
-testXConfig()
-{
- # Put a space on each end of the CONFIG value so that searching for the
- # target with whitespace on either side will work even when it's the
- # first/last/only item in the CONFIG value.
- case \ `getXQMakeConf CONFIG`\ in
- *[${CONFIG_SEPARATORS}]$1[${CONFIG_SEPARATORS}]*)
- return 0
- ;;
- *)
- return 1
- ;;
- esac
-}
-
-compilerSupportsFlag()
-{
- cat >conftest.cpp <<EOF
-int main() { return 0; }
-EOF
- if [ "$OPT_VERBOSE" = "yes" ]; then
- "$@" -o conftest-out conftest.cpp
- else
- "$@" -o conftest-out conftest.cpp >/dev/null 2>&1
- fi
- ret=$?
- rm -f conftest.cpp conftest-out
- return $ret
-}
-
-linkerSupportsFlag()
-{
- compiler=$1
- shift
- lflags=-Wl
- for flag
- do
- safe_flag=`shellEscape "$flag"`
- lflags=$lflags,$safe_flag
- done
- if [ $CFG_USE_GOLD_LINKER = yes ]; then
- lflags="-fuse-ld=gold $lflags"
- fi
- compilerSupportsFlag $compiler $lflags
-}
-
-# $1: newline-separated list of default paths
-# stdin: input path
-# stdout: input path or nothing
-filterDefaultPaths()
-{
- local path
- path=`cat`
- path=`makeabs "$path"`
- echo "$1" | grep "^$path\$" > /dev/null || echo "$path"
-}
-
-filterIncludePath()
-{
- filterDefaultPaths "$DEFAULT_INCDIRS"
-}
-
-filterLibraryPath()
-{
- filterDefaultPaths "$DEFAULT_LIBDIRS"
-}
-
-filterPathOptionsHelper()
-{
- local flag defpaths sep p path
- flag=$1; shift
- defpaths=$1; shift
- sep=
- for p in "$@"; do
- path=${p#$flag}
- if [ "x$path" != "x$p" ]; then
- path=`echo "$path" | filterDefaultPaths "$defpaths"`
- test -z "$path" && continue
- fi
- # Re-quote for shell & qmake
- p=`echo "$p" | sed 's,[^ ]* .*,"&",g'`
- printf "%s%s" "$sep" "$p"
- sep=" "
- done
- echo
-}
-
-# $1: flag
-# $2: newline-separated list of default paths
-# stdin: list of command line options
-# sdout: stdin without the options naming default paths
-filterPathOptions()
-{
- # The eval does escape interpretation for us
- eval filterPathOptionsHelper $1 "\"$2\"" "`cat`"
-}
-
-filterIncludeOptions()
-{
- filterPathOptions -I "$DEFAULT_INCDIRS"
-}
-
-filterLibraryOptions()
-{
- filterPathOptions -L "$DEFAULT_LIBDIRS"
-}
-
#-------------------------------------------------------------------------------
# device options
#-------------------------------------------------------------------------------
@@ -517,20 +408,11 @@ else
ECHO_C='\c'
fi
-#-------------------------------------------------------------------------------
-# window system detection
-#-------------------------------------------------------------------------------
-
BUILD_ON_MAC=no
if [ -d /System/Library/Frameworks/Carbon.framework ]; then
BUILD_ON_MAC=yes
fi
-HOST_DIRLIST_SEP=":"
-DEV_NULL=/dev/null
if [ "$OSTYPE" = "msys" ]; then
- HOST_DIRLIST_SEP=";"
- DEV_NULL=/tmp/empty-file
- echo "" > $DEV_NULL
relpath=`(cd "$relpath"; pwd -W)`
outpath=`pwd -W`
fi
@@ -578,227 +460,33 @@ fi
# initalize variables
#-------------------------------------------------------------------------------
-SYSTEM_VARIABLES="AR RANLIB STRIP OBJDUMP LD CC CXX CFLAGS CXXFLAGS LDFLAGS"
-for varname in $SYSTEM_VARIABLES; do
- qmakevarname="${varname}"
- qmakecmdargs=""
- # use LDFLAGS for autoconf compat, but qmake uses QMAKE_LFLAGS
- if [ "${varname}" = "LDFLAGS" ]; then
- qmakevarname="LFLAGS"
- elif [ "${varname}" = "LD" ]; then
- qmakevarname="LINK"
- elif [ "${varname}" = "AR" ]; then
- # QMAKE_AR needs to be set to "/path/to/ar cqs" but the
- # environment variable will be set to the command only so we
- # need to append " cqs" for autoconf compatibility
- qmakecmdargs=" cqs"
- fi
- cmd=`echo \
-'if [ -n "\$'${varname}'" ]; then
- QMakeVar set QMAKE_'${qmakevarname}' "\$'${varname}${qmakecmdargs}'"
-fi'`
- eval "$cmd"
-done
-
# Use CC/CXX to run config.tests
mkdir -p "$outpath/config.tests"
rm -f "$outpath/config.tests/.qmake.cache"
-cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
-
-QMakeVar add styles "mac fusion windows"
+: > "$outpath/config.tests/.qmake.cache"
# QTDIR may be set and point to an old or system-wide Qt installation
unset QTDIR
-# the minimum version of libdbus-1 that we require:
-MIN_DBUS_1_VERSION=1.2
-
# initalize internal variables
-CFG_CONFIGURE_EXIT_ON_ERROR=yes
-CFG_PROFILE=no
-CFG_STRIP=yes
-CFG_GUI=auto # (yes|no|auto)
-CFG_WIDGETS=yes
-CFG_QCONFIG=full
-CFG_DEBUG=auto
-CFG_MYSQL_CONFIG=
-CFG_PSQL_CONFIG=
-CFG_DEBUG_RELEASE=no
-CFG_FORCEDEBUGINFO=no
CFG_RELEASE_TOOLS=no
-CFG_SHARED=yes
-CFG_SM=auto
-CFG_XSHAPE=auto
-CFG_XSYNC=auto
-CFG_XFIXES=runtime
-CFG_ZLIB=auto
-CFG_MTDEV=auto
-CFG_JOURNALD=no
-CFG_SYSLOG=no
-CFG_SQLITE=qt
-CFG_GIF=auto
-CFG_PNG=yes
-CFG_LIBPNG=auto
-CFG_JPEG=auto
-CFG_LIBJPEG=auto
-CFG_XCURSOR=runtime
-CFG_XRANDR=runtime
-CFG_XRENDER=auto
-CFG_MITSHM=auto
-CFG_OPENGL=auto
-CFG_OPENGLES3=yes # still depends on CFG_OPENGL, so auto in practice
-CFG_OPENVG=auto
-CFG_OPENVG_LC_INCLUDES=no
-CFG_OPENVG_SHIVA=auto
-CFG_OPENVG_ON_OPENGL=auto
-CFG_EGL=auto
-CFG_EGL_X=auto
-CFG_DOUBLECONVERSION=auto
-CFG_FONTCONFIG=auto
-CFG_FREETYPE=auto
-CFG_HARFBUZZ=auto
-CFG_SQL_AVAILABLE=
-QT_ALL_BUILD_PARTS=" libs tools examples tests "
-QT_DEFAULT_BUILD_PARTS="libs tools examples"
-CFG_BUILD_PARTS=""
-CFG_NOBUILD_PARTS=""
-CFG_SKIP_MODULES=""
-CFG_COMPILE_EXAMPLES=yes
-CFG_AUDIO_BACKEND=auto
-CFG_QML_DEBUG=yes
-CFG_PKGCONFIG=auto
-CFG_STACK_PROTECTOR_STRONG=auto
-CFG_SLOG2=auto
-CFG_PPS=auto
-CFG_QNX_IMF=auto
-CFG_LGMON=auto
-CFG_SYSTEM_PROXIES=no
CFG_ANDROID_STYLE_ASSETS=yes
-CFG_GSTREAMER=auto
-CFG_GSTREAMER_VERSION=""
-CFG_ATOMIC64=auto
-
-# Target architecture
-CFG_ARCH=
-CFG_CPUFEATURES=
-# Host architecture, same as CFG_ARCH when not cross-compiling
-CFG_HOST_ARCH=
-CFG_HOST_CPUFEATURES=
-# Set when the -arch or -host-arch arguments are used
-OPT_OBSOLETE_HOST_ARG=no
-
-CFG_USE_GNUMAKE=no
-CFG_XINPUT2=auto
-CFG_XKB=auto
-CFG_XKBCOMMON=yes
-CFG_XKBCOMMON_EVDEV=auto
-CFG_XKB_CONFIG_ROOT=auto
-CFG_XCB=auto
-CFG_XCB_XLIB=auto
-CFG_XCB_GLX=no
-CFG_EGLFS=auto
-CFG_EGLFS_BRCM=no
-CFG_EGLFS_EGLDEVICE=no
-CFG_EGLFS_MALI=no
-CFG_EGLFS_VIV=no
-CFG_EGLFS_VIV_WL=no
-CFG_DIRECTFB=no
-CFG_GBM=auto
-CFG_LINUXFB=auto
-CFG_INTEGRITYFB=no
-CFG_KMS=auto
-CFG_MIRCLIENT=auto
-CFG_LIBUDEV=auto
-CFG_LIBINPUT=auto
-CFG_OBSOLETE_WAYLAND=no
-CFG_EVDEV=auto
-CFG_TSLIB=auto
-CFG_CUPS=auto
-CFG_ICONV=auto
-CFG_DBUS=auto
-CFG_GLIB=auto
-CFG_GTK=auto
-CFG_LARGEFILE=auto
-CFG_OPENSSL=auto
-CFG_LIBPROXY=auto
-CFG_SECURETRANSPORT=auto
-CFG_PRECOMPILE=auto
-CFG_LTCG=no
-CFG_SEPARATE_DEBUG_INFO=no
-CFG_REDUCE_EXPORTS=auto
-CFG_SSE2=auto
-CFG_SSE3=auto
-CFG_SSSE3=auto
-CFG_SSE4_1=auto
-CFG_SSE4_2=auto
-CFG_AVX=auto
-CFG_AVX2=auto
-CFG_AVX512=auto
-CFG_REDUCE_RELOCATIONS=auto
-CFG_ACCESSIBILITY=auto
-CFG_ACCESSIBILITY_ATSPI_BRIDGE=no # will be enabled depending on dbus and accessibility being enabled
-CFG_NEON=auto
-CFG_MIPS_DSP=auto
-CFG_MIPS_DSPR2=auto
-CFG_CLOCK_GETTIME=auto
-CFG_CLOCK_MONOTONIC=auto
-CFG_POSIX_FALLOCATE=auto
-CFG_MREMAP=auto
-CFG_GETADDRINFO=auto
-CFG_IPV6IFNAME=auto
-CFG_GETIFADDRS=auto
-CFG_INOTIFY=auto
-CFG_EVENTFD=auto
-CFG_CLOEXEC=no
-CFG_POLL=auto
-CFG_RPATH=yes
-CFG_FRAMEWORK=auto
-CFG_USE_GOLD_LINKER=auto
-CFG_ENABLE_NEW_DTAGS=auto
-DEFINES=
-INCLUDES=
-D_FLAGS=
-I_FLAGS=
-L_FLAGS=
-RPATH_FLAGS=
-W_FLAGS=
-QCONFIG_FLAGS=
+
XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
-XPLATFORM_MAC=no # Whether target platform is OS X or iOS
+XPLATFORM_MAC=no # Whether target platform is macOS, iOS, tvOS, or watchOS
XPLATFORM_IOS=no # Whether target platform is iOS
+XPLATFORM_TVOS=no # Whether target platform is tvOS
+XPLATFORM_WATCHOS=no # Whether target platform is watchOS
XPLATFORM_ANDROID=no
XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
-XPLATFORM_QNX=no
-XPLATFORM_HAIKU=no
-XPLATFORM_INTEGRITY=no
PLATFORM=$QMAKESPEC
-QT_CROSS_COMPILE=no
OPT_CONFIRM_LICENSE=no
OPT_SHADOW=maybe
OPT_VERBOSE=no
OPT_HELP=
CFG_SILENT=no
-CFG_ALSA=auto
-CFG_PULSEAUDIO=auto
-CFG_COREWLAN=auto
-CFG_ICU=auto
-CFG_FORCE_ASSERTS=no
-CFG_SANITIZERS=none
-CFG_SANITIZE_ADDRESS=no
-CFG_SANITIZE_THREAD=no
-CFG_SANITIZE_MEMORY=no
-CFG_SANITIZE_UNDEFINED=no
-CFG_PCRE=auto
-QPA_PLATFORM_GUARD=yes
-CFG_STDCXX=auto
-CFG_DIRECTWRITE=no
-CFG_DIRECTWRITE2=auto
-CFG_WERROR=auto
-CFG_HEADERSCLEAN=auto
-CFG_QREAL=double
OPT_MAC_SDK=
COMMERCIAL_USER=ask
-LICENSE_FILE=
CFG_DEV=no
# initalize variables used for installation
@@ -818,34 +506,13 @@ QT_INSTALL_SETTINGS=
QT_INSTALL_EXAMPLES=
QT_INSTALL_TESTS=
CFG_SYSROOT=
-CFG_GCC_SYSROOT="yes"
QT_HOST_PREFIX=
QT_HOST_BINS=
QT_HOST_LIBS=
QT_HOST_DATA=
QT_EXT_PREFIX=
-#flags for SQL drivers
-QT_CFLAGS_PSQL=
-QT_LFLAGS_PSQL=
-QT_CFLAGS_MYSQL=
-QT_LFLAGS_MYSQL=
-QT_LFLAGS_MYSQL_R=
-QT_CFLAGS_SQLITE=
-QT_LFLAGS_SQLITE=
-QT_LFLAGS_ODBC="-lodbc"
-QT_LFLAGS_TDS=
-
-# flags for libdbus-1
-QT_CFLAGS_DBUS=
-QT_LIBS_DBUS=
-
-# flags for Glib (X11 only)
-QT_CFLAGS_GLIB=
-QT_LIBS_GLIB=
-
# default qpa platform
-QT_QPA_DEFAULT_PLATFORM=
# Android vars
CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
@@ -856,36 +523,6 @@ CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.9
CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST
#-------------------------------------------------------------------------------
-# check SQL drivers available in this package
-#-------------------------------------------------------------------------------
-
-# opensource version removes some drivers, so force them to be off
-CFG_SQL_tds=no
-CFG_SQL_oci=no
-CFG_SQL_db2=no
-
-CFG_SQL_AVAILABLE=
-if [ -d "$relpath/src/plugins/sqldrivers" ]; then
- for a in "$relpath/src/plugins/sqldrivers/"*; do
- if [ -d "$a" ]; then
- base_a=`basename "$a"`
- CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
- eval "CFG_SQL_${base_a}=auto"
- fi
- done
-fi
-
-CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
-if [ -d "$relpath/src/plugins/imageformats" ]; then
- for a in "$relpath/src/plugins/imageformats/"*; do
- if [ -d "$a" ]; then
- base_a=`basename "$a"`
- CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}"
- fi
- done
-fi
-
-#-------------------------------------------------------------------------------
# parse command line arguments
#-------------------------------------------------------------------------------
@@ -947,7 +584,6 @@ while [ "$#" -gt 0 ]; do
-extprefix| \
-sysroot| \
-external-hostbindir| \
- -depths| \
-make| \
-nomake| \
-skip| \
@@ -957,16 +593,6 @@ while [ "$#" -gt 0 ]; do
-device-option| \
-host-option| \
-sdk| \
- -arch| \
- -host-arch| \
- -c++std | \
- -mysql_config| \
- -psql_config| \
- -qpa| \
- -qconfig| \
- -qreal| \
- -sanitize| \
- -xkb-config-root| \
-android-sdk| \
-android-ndk| \
-android-ndk-platform| \
@@ -982,54 +608,12 @@ while [ "$#" -gt 0 ]; do
VAR=`echo $1 | sed 's,^-\([^-]*\)-.*,\1,'`
VAL=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
;;
- -system-proxies)
- VAR=system-proxies
- VAL=yes
- ;;
- -no-system-proxies)
- VAR=system-proxies
- VAL=no
- ;;
#Qt Builtin/System style options
-no-*|-system-*|-qt-*)
VAR=`echo $1 | sed 's,^-[^-]*-\(.*\),\1,'`
VAL=`echo $1 | sed 's,^-\([^-]*\)-.*,\1,'`
;;
#Options that cannot be generalized
- -k|-continue)
- VAR=fatal_error
- VAL=no
- ;;
- -opengl)
- VAR=opengl
- # this option may or may not be followed by an argument
- if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
- VAL=yes
- else
- shift;
- VAL=$1
- fi
- ;;
- -openvg)
- VAR=openvg
- # this option may or may not be followed by an argument
- if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
- VAL=yes
- else
- shift;
- VAL=$1
- fi
- ;;
- -gstreamer)
- VAR=gstreamer
- # this option may or may not be followed by an argument
- if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
- VAL=yes
- else
- shift;
- VAL=$1
- fi
- ;;
-hostprefix)
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
# this option may or may not be followed by an argument
@@ -1039,124 +623,23 @@ while [ "$#" -gt 0 ]; do
shift;
VAL=$1
fi
- ;;
- -qtnamespace)
- VAR="qtnamespace"
- shift
- VAL="$1"
- ;;
- -qtlibinfix)
- VAR="qtlibinfix"
- shift
- VAL="$1"
- ;;
- -D?*|-D)
- VAR="add_define"
- if [ "$1" = "-D" ]; then
- shift
- VAL="$1"
- else
- VAL=`echo $1 | sed 's,-D,,'`
- fi
- ;;
- -fpu)
- VAR="fpu"
- # this option may or may not be followed by an argument
- if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
- VAL=no
- else
- shift
- VAL=$1
- fi
- ;;
- -I?*|-I)
- VAR="add_ipath"
- if [ "$1" = "-I" ]; then
- shift
- VAL="$1"
- else
- VAL=`echo $1 | sed 's,-I,,'`
- fi
- ;;
- -L?*|-L)
- VAR="add_lpath"
- if [ "$1" = "-L" ]; then
- shift
- VAL="$1"
- else
- VAL=`echo $1 | sed 's,-L,,'`
- fi
- ;;
- -R?*|-R)
- VAR="add_rpath"
- if [ "$1" = "-R" ]; then
- shift
- VAL="$1"
- else
- VAL=`echo $1 | sed 's,-R,,'`
- fi
- ;;
- -l) # -lfoo is handled differently
- VAR="add_link"
- shift
- VAL="$1"
- ;;
- -F?*|-F)
- VAR="add_fpath"
- if [ "$1" = "-F" ]; then
- shift
- VAL="$1"
- else
- VAL=`echo $1 | sed 's,-F,,'`
- fi
- ;;
- -fw) # -fwfoo is handled differently
- VAR="add_framework"
- shift
- VAL="$1"
- ;;
- -W*)
- VAR="add_warn"
- VAL="$1"
- ;;
+ ;;
#General options, including Qt style yes options
-*)
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
VAL="yes"
;;
+ # most options don't need processing in the configure script, skip them. qmake will do the real validation
*)
- UNKNOWN_ARG=yes
- ;;
- esac
- if [ "$UNKNOWN_ARG" = "yes" ]; then
- echo "$1: unknown argument"
- ERROR=yes
shift
continue
- fi
+ ;;
+ esac
+
shift
UNKNOWN_OPT=no
case "$VAR" in
- accessibility)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_ACCESSIBILITY="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- license)
- LICENSE_FILE="$VAL"
- ;;
- gnumake)
- CFG_USE_GNUMAKE="$VAL"
- ;;
- mysql_config)
- CFG_MYSQL_CONFIG="$VAL"
- ;;
- psql_config)
- CFG_PSQL_CONFIG="$VAL"
- ;;
prefix)
QT_INSTALL_PREFIX="$VAL"
;;
@@ -1176,14 +659,8 @@ while [ "$#" -gt 0 ]; do
QT_EXT_PREFIX="$VAL"
;;
pkg-config)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_PKGCONFIG="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
;;
force-pkg-config)
- CFG_PKGCONFIG="yes"
;;
docdir)
QT_INSTALL_DOCS="$VAL"
@@ -1209,12 +686,6 @@ while [ "$#" -gt 0 ]; do
libdir)
QT_INSTALL_LIBS="$VAL"
;;
- qtnamespace)
- QT_NAMESPACE="$VAL"
- ;;
- qtlibinfix)
- QT_LIBINFIX="$VAL"
- ;;
translationdir)
QT_INSTALL_TRANSLATIONS="$VAL"
;;
@@ -1227,54 +698,9 @@ while [ "$#" -gt 0 ]; do
testsdir)
QT_INSTALL_TESTS="$VAL"
;;
- qconfig)
- CFG_QCONFIG="$VAL"
- ;;
- qreal)
- CFG_QREAL="$VAL"
- if [ "$CFG_QREAL" = "float" ]; then
- CFG_QREAL_STRING="\"float\""
- elif [ "$CFG_QREAL" != "double" ]; then
- if [ -z "$PERL" ]; then
- echo "configure needs perl in \$PATH if the -qreal option is used with" >&2
- echo "a value different from \"float\"" >&2
- exit 1
- fi
- CFG_QREAL_STRING=`perl -e '$_ = $ARGV[0];
- s/ +/ /g; s/^ +//; s/ +$//;
- while (/(.)/g) {
- $c = $1;
- if ($c =~ /[a-zA-Z0-9]/) { $result .= $c; }
- else { $result .= "_" . unpack("H*", $c); }
- }
- print "\"$result\"";' "$CFG_QREAL"`
- fi
- ;;
- sanitize)
- if [ "$VAL" = "address" ]; then
- CFG_SANITIZE_ADDRESS=yes
- elif [ "$VAL" = "thread" ]; then
- CFG_SANITIZE_THREAD=yes
- elif [ "$VAL" = "memory" ]; then
- CFG_SANITIZE_MEMORY=yes
- elif [ "$VAL" = "undefined" ]; then
- CFG_SANITIZE_UNDEFINED=yes
- else
- echo "Unknown sanitizer: '$VAL'"
- ERROR=true
- fi
- if [ "$CFG_SANITIZERS" = "none" ]; then
- CFG_SANITIZERS=$VAL
- else
- CFG_SANITIZERS="$CFG_SANITIZERS $VAL"
- fi
- ;;
sysroot)
CFG_SYSROOT="$VAL"
;;
- gcc-sysroot)
- CFG_GCC_SYSROOT="$VAL"
- ;;
external-hostbindir)
CFG_HOST_QT_TOOLS_PATH="$VAL"
HostVar set HOST_QT_TOOLS "$VAL"
@@ -1285,62 +711,6 @@ while [ "$#" -gt 0 ]; do
libexecdir)
QT_INSTALL_LIBEXECS="$VAL"
;;
- opengl)
- if [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
- [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
- [ "$VAL" = "es2" ]; then
- CFG_OPENGL="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- opengles3)
- if [ "$VAL" = "no" ]; then
- CFG_OPENGLES3="no"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- openvg)
- if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_OPENVG="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- nomake)
- if [ -n "${QT_ALL_BUILD_PARTS%%* $VAL *}" ]; then
- echo "Unknown part $VAL passed to -nomake." >&2
- exit 1
- fi
- CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
- ;;
- make)
- if [ "$VAL" = "no" ]; then
- UNKNOWN_OPT=yes
- else
- if [ -n "${QT_ALL_BUILD_PARTS%%* $VAL *}" ]; then
- echo "Unknown part $VAL passed to -make." >&2
- exit 1
- fi
- CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
- fi
- ;;
- skip)
- VAL=qt${VAL#qt}
- if ! [ -d $relpath/../$VAL ]; then
- echo "Attempting to skip non-existent module $VAL." >&2
- exit 1
- fi
- CFG_SKIP_MODULES="$CFG_SKIP_MODULES $VAL"
- ;;
- compile-examples)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_COMPILE_EXAMPLES="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
sdk)
if [ "$BUILD_ON_MAC" = "yes" ]; then
DeviceVar set !host_build:QMAKE_MAC_SDK "$VAL"
@@ -1349,107 +719,11 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
- arch|host-arch)
- OPT_OBSOLETE_HOST_ARG=yes
- ;;
- harfbuzz)
- [ "$VAL" = "yes" ] && VAL=qt
- if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
- CFG_HARFBUZZ="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
-
- framework)
- if [ "$BUILD_ON_MAC" = "yes" ]; then
- CFG_FRAMEWORK="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- profile)
- if [ "$VAL" = "yes" ]; then
- CFG_PROFILE=yes
- QMakeVar add QMAKE_CFLAGS -pg
- QMakeVar add QMAKE_CXXFLAGS -pg
- QMakeVar add QMAKE_LFLAGS -pg
- QMAKE_VARS="$QMAKE_VARS CONFIG+=nostrip"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- strip)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_STRIP=$VAL
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- testcocoon)
- if [ "$VAL" = "yes" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG testcocoon"
- fi
- ;;
- gcov)
- if [ "$VAL" = "yes" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG gcov"
- fi
- ;;
platform)
PLATFORM="$VAL"
- # keep compatibility with old platform names
- case $PLATFORM in
- aix-64)
- PLATFORM=aix-xlc-64
- ;;
- hpux-o64)
- PLATFORM=hpux-acc-o64
- ;;
- hpux-n64)
- PLATFORM=hpux-acc-64
- ;;
- hpux-acc-n64)
- PLATFORM=hpux-acc-64
- ;;
- irix-n32)
- PLATFORM=irix-cc
- ;;
- irix-64)
- PLATFORM=irix-cc-64
- ;;
- irix-cc-n64)
- PLATFORM=irix-cc-64
- ;;
- reliant-64)
- PLATFORM=reliant-cds-64
- ;;
- solaris-64)
- PLATFORM=solaris-cc-64
- ;;
- openunix-cc)
- PLATFORM=unixware-cc
- ;;
- openunix-g++)
- PLATFORM=unixware-g++
- ;;
- unixware7-cc)
- PLATFORM=unixware-cc
- ;;
- unixware7-g++)
- PLATFORM=unixware-g++
- ;;
- esac
;;
xplatform)
XPLATFORM="$VAL"
- case `basename "$XPLATFORM"` in win32-g++*)
- XPLATFORM_MINGW=yes
- CFG_RPATH=no
- CFG_REDUCE_EXPORTS=no
- CFG_ICU=no
- ;;
- esac
;;
device)
XPLATFORM=`resolveDeviceMkspec $VAL`
@@ -1465,36 +739,9 @@ while [ "$#" -gt 0 ]; do
HOST_VAL=`echo $VAL | cut -d '=' -f 2-`
HostVar set $HOST_VAR "$HOST_VAL"
;;
- qpa)
- QT_QPA_DEFAULT_PLATFORM="$VAL"
- ;;
- debug-and-release)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_DEBUG_RELEASE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- release)
- if [ "$VAL" = "yes" ]; then
- CFG_DEBUG=no
- elif [ "$VAL" = "no" ]; then
- CFG_DEBUG=yes
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- debug)
- CFG_DEBUG="$VAL"
- ;;
- force-debug-info)
- CFG_FORCEDEBUGINFO="$VAL"
- ;;
optimized-qmake|optimized-tools)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_RELEASE_TOOLS="$VAL"
- else
- UNKNOWN_OPT=yes
fi
;;
developer-build)
@@ -1506,598 +753,6 @@ while [ "$#" -gt 0 ]; do
opensource)
COMMERCIAL_USER="no"
;;
- static)
- if [ "$VAL" = "yes" ]; then
- CFG_SHARED=no
- elif [ "$VAL" = "no" ]; then
- CFG_SHARED=yes
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- fatal_error)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- feature-*)
- FEATURE=`echo $VAR | sed 's,^[^-]*-\([^-]*\),\1,' | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
- if grep "^Feature: *${FEATURE} *\$" "$relpath"/src/corelib/global/qfeatures.txt >/dev/null 2>&1; then
- if [ "$VAL" = "no" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE"
- elif [ "$VAL" = "yes" ] || [ "$VAL" = "unknown" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_$FEATURE"
- else
- UNKNOWN_OPT=yes
- fi
- else
- echo "ERROR: Unknown feature $FEATURE"
- UNKNOWN_OPT=yes
- fi
- ;;
- shared)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_SHARED="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- gif)
- if [ "$VAL" = "no" ]; then
- CFG_GIF="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- sm)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_SM="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
-
- ;;
- xshape)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_XSHAPE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xsync)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_XSYNC="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xinput2)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_XINPUT2="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- egl)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_EGL="$VAL"
- CFG_EGL_X="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- pch)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_PRECOMPILE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- ltcg)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_LTCG="$VAL"
- else
- UNKNOWN_OPT=no
- fi
- ;;
- separate-debug-info)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_SEPARATE_DEBUG_INFO="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- reduce-exports)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_REDUCE_EXPORTS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- sse2)
- if [ "$VAL" = "no" ]; then
- CFG_SSE2="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- sse3)
- if [ "$VAL" = "no" ]; then
- CFG_SSE3="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- ssse3)
- if [ "$VAL" = "no" ]; then
- CFG_SSSE3="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- sse4.1)
- if [ "$VAL" = "no" ]; then
- CFG_SSE4_1="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- sse4.2)
- if [ "$VAL" = "no" ]; then
- CFG_SSE4_2="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- avx)
- if [ "$VAL" = "no" ]; then
- CFG_AVX="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- avx2)
- if [ "$VAL" = "no" ]; then
- CFG_AVX2="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- avx512)
- if [ "$VAL" = "no" ]; then
- CFG_AVX512=""
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- mips_dsp)
- if [ "$VAL" = "no" ]; then
- CFG_MIPS_DSP="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- mips_dspr2)
- if [ "$VAL" = "no" ]; then
- CFG_MIPS_DSPR2="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- reduce-relocations)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_REDUCE_RELOCATIONS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- use-gold-linker)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_USE_GOLD_LINKER="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- zlib)
- [ "$VAL" = "qt" ] && VAL=yes
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
- CFG_ZLIB="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- # No longer supported:
- #[ "$VAL" = "no" ] && CFG_LIBPNG=no
- ;;
- mtdev)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_MTDEV="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- journald)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_JOURNALD="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- syslog)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_SYSLOG="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- sqlite)
- if [ "$VAL" = "system" ]; then
- CFG_SQLITE=system
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- libpng)
- [ "$VAL" = "yes" ] && VAL=qt
- if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
- CFG_LIBPNG="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- libjpeg)
- [ "$VAL" = "yes" ] && VAL=qt
- if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
- CFG_LIBJPEG="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xcursor)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
- CFG_XCURSOR="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xfixes)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
- CFG_XFIXES="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xrandr)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
- CFG_XRANDR="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xrender)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_XRENDER="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- mitshm)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_MITSHM="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- doubleconversion)
- if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
- CFG_DOUBLECONVERSION="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- fontconfig)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_FONTCONFIG="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- freetype)
- [ "$VAL" = "yes" ] && VAL=qt
- if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
- CFG_FREETYPE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xkb)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_XKB="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xkbcommon-evdev)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_XKBCOMMON_EVDEV="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xkbcommon|xkbcommon-x11)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "qt" ] || [ "$VAL" = "system" ]; then
- CFG_XKBCOMMON="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xcb)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ] || [ "$VAL" = "qt" ]; then
- CFG_XCB="$VAL"
- if [ "$VAL" = "yes" ]; then
- CFG_XCB="system"
- fi
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xcb-xlib)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_XCB_XLIB="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- wayland)
- CFG_OBSOLETE_WAYLAND=yes
- ;;
- eglfs)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_EGLFS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- directfb)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_DIRECTFB="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- gbm)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_GBM="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- linuxfb)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_LINUXFB="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- kms)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_KMS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- mirclient)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_MIRCLIENT="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- libudev)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_LIBUDEV="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- libinput)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_LIBINPUT="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- evdev)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_EVDEV="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- tslib)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_TSLIB="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- cups)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_CUPS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- iconv)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_ICONV="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- glib)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_GLIB="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- slog2)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_SLOG2="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- imf)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_QNX_IMF="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- pps)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_PPS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- lgmon)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_LGMON="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- pulseaudio)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_PULSEAUDIO="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- alsa)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_ALSA="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- gstreamer)
- if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] ||
- [ "$VAL" = "0.10" ] || [ "$VAL" = "1.0" ] ||
- [ "$VAL" = "no" ]; then
- CFG_GSTREAMER="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- gtk)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_GTK="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- gui)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
- CFG_GUI="yes"
- else
- if [ "$VAL" = "no" ]; then
- CFG_GUI="no"
- else
- UNKNOWN_OPT=yes
- fi
- fi
- ;;
- widgets)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
- CFG_WIDGETS="yes"
- elif [ "$VAL" = "no" ]; then
- CFG_WIDGETS="no"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- qpa-platform-guard)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- QPA_PLATFORM_GUARD="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- dbus)
- if [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then
- CFG_DBUS="$VAL"
- elif [ "$VAL" = "yes" ]; then
- # keep as auto, we'll auto-detect whether to go linked or runtime later
- CFG_DBUS=auto
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- dbus-linked)
- if [ "$VAL" = "yes" ]; then
- CFG_DBUS="linked"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- dbus-runtime)
- if [ "$VAL" = "yes" ]; then
- CFG_DBUS="runtime"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- largefile)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_LARGEFILE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- openssl)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_OPENSSL="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- openssl-linked)
- if [ "$VAL" = "yes" ]; then
- CFG_OPENSSL="linked"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- securetransport)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_SECURETRANSPORT="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- libproxy)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_LIBPROXY="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- qml-debug)
- if [ "$VAL" = "yes" ]; then
- CFG_QML_DEBUG="yes"
- else
- if [ "$VAL" = "no" ]; then
- CFG_QML_DEBUG="no"
- else
- UNKNOWN_OPT=yes
- fi
- fi
- ;;
confirm-license)
if [ "$VAL" = "yes" ]; then
OPT_CONFIRM_LICENSE="$VAL"
@@ -2112,216 +767,19 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
- sql-*|imageformat-*)
- # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
- # if autoconf style options were used, $VAL can be "yes" or "no"
- [ "$VAL" = "yes" ] && VAL=qt
- # now $VAL should be "no", "qt", or "plugin"... double-check
- if [ "$VAL" != "no" ] && [ "$VAL" != "qt" ] && [ "$VAL" != "plugin" ]; then
- UNKNOWN_OPT=yes
- fi
- # now $VAL is "no", "qt", or "plugin"
- OPT="$VAL"
- VAL=`echo $VAR | sed 's,^[^-]*-\([^-]*\).*,\1,'`
- VAR=`echo $VAR | sed 's,^\([^-]*\).*,\1,'`
-
- # Grab the available values
- case "$VAR" in
- sql)
- avail="$CFG_SQL_AVAILABLE"
- ;;
- imageformat)
- avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE"
- if [ "$OPT" != "plugin" ]; then
- # png is always built in
- avail="$avail png"
- fi
- ;;
- *)
- avail=""
- echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
- ;;
- esac
-
- # Check that that user's value is available.
- found=no
- for d in $avail; do
- if [ "$VAL" = "$d" ]; then
- found=yes
- break
- fi
- done
- if [ "$found" != "yes" ]; then
- echo "$CURRENT_OPT: unknown argument"
- ERROR=yes
- continue
- fi
-
- if [ "$VAR" = "sql" ]; then
- # set the CFG_SQL_driver
- eval "CFG_SQL_$VAL=\$OPT"
- continue
- elif [ "$VAR" = "imageformat" ]; then
- [ "$OPT" = "qt" ] && OPT=yes
- VAL="`echo $VAL |tr a-z A-Z`"
- eval "CFG_$VAL=$OPT"
- continue
- fi
-
- if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
- if [ "$OPT" = "plugin" ]; then
- VAR="${VAR}-${OPT}"
- fi
- QMakeVar add "${VAR}s" "${VAL}"
- elif [ "$OPT" = "no" ]; then
- PLUG_VAR="${VAR}-plugin"
- IN_VAR="${VAR}"
- QMakeVar del "${IN_VAR}s" "$VAL"
- QMakeVar del "${PLUG_VAR}s" "$VAL"
- fi
- ;;
v|verbose)
if [ "$VAL" = "yes" ]; then
- if [ "$OPT_VERBOSE" = "$VAL" ]; then # takes two verboses to turn on qmake debugs
- QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
- else
- OPT_VERBOSE=yes
- fi
+ OPT_VERBOSE=yes
elif [ "$VAL" = "no" ]; then
- if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
- QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed 's, -d,,'`
- else
- OPT_VERBOSE=no
- fi
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- rpath)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_RPATH="$VAL"
+ OPT_VERBOSE=no
else
UNKNOWN_OPT=yes
fi
;;
- add_define)
- DEFINES="$DEFINES \"$VAL\""
- D_FLAGS="$D_FLAGS -D\"$VAL\""
- ;;
- add_ipath)
- INCLUDES="$INCLUDES \"$VAL\""
- I_FLAGS="$I_FLAGS -I\"${VAL}\""
- ;;
- add_lpath)
- L_FLAGS="$L_FLAGS -L\"${VAL}\""
- ;;
- add_rpath)
- RPATH_FLAGS="$RPATH_FLAGS \"${VAL}\""
- ;;
- add_link)
- L_FLAGS="$L_FLAGS -l\"${VAL}\""
- ;;
- add_fpath)
- if [ "$BUILD_ON_MAC" = "yes" ]; then
- L_FLAGS="$L_FLAGS -F\"${VAL}\""
- I_FLAGS="$I_FLAGS -F\"${VAL}\""
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- add_framework)
- if [ "$BUILD_ON_MAC" = "yes" ]; then
- L_FLAGS="$L_FLAGS -framework \"${VAL}\""
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- add_warn)
- W_FLAGS="$W_FLAGS \"${VAL}\""
- ;;
silent)
+ # need to keep this here, to ensure qmake is built silently
CFG_SILENT="$VAL"
;;
- audio-backend)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_AUDIO_BACKEND="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- icu)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_ICU="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- force-asserts)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_FORCE_ASSERTS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- pcre)
- if [ "$VAL" = "qt" ] || [ "$VAL" = "system" ]; then
- CFG_PCRE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- c++std)
- case "$VAL" in
- c++11|c++14|c++1z|auto)
- CFG_STDCXX="$VAL"
- ;;
- 11|14|1z)
- CFG_STDCXX="c++$VAL"
- ;;
- 1y|c++1y)
- CFG_STDCXX="c++14"
- ;;
- *)
- echo >&2 "Invalid C++ edition: $VAL; valid options are: c++11 c++14 c++1z auto"
- ERROR=yes
- ;;
- esac
- ;;
- system-proxies)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_SYSTEM_PROXIES="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- directwrite)
- if [ "$XPLATFORM_MINGW" = "yes" ] ; then
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_DIRECTWRITE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- warnings-are-errors|Werror)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_WERROR="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- headersclean)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_HEADERSCLEAN="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- xkb-config-root)
- CFG_XKB_CONFIG_ROOT="$VAL"
- ;;
android-sdk)
CFG_DEFAULT_ANDROID_SDK_ROOT="$VAL"
;;
@@ -2341,32 +799,12 @@ while [ "$#" -gt 0 ]; do
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL"
;;
android-style-assets)
+ # Required to be able to show the correct license text
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_ANDROID_STYLE_ASSETS="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- l*) # -lfoo
- if [ "$VAL" = "yes" ]; then
- L_FLAGS="$L_FLAGS -l\"${VAR#l}\""
- else
- UNKNOWN_OPT=yes
- fi
- ;;
- fw*) # -fwfoo
- if [ "$VAL" = "yes" ]; then
- if [ "$BUILD_ON_MAC" = "yes" ]; then
- L_FLAGS="$L_FLAGS -framework \"${VAR#fw}\""
- else
- UNKNOWN_OPT=yes
- fi
- else
- UNKNOWN_OPT=yes
fi
;;
*)
- UNKNOWN_OPT=yes
;;
esac
if [ "$UNKNOWN_OPT" = "yes" ]; then
@@ -2381,453 +819,9 @@ done
#-------------------------------------------------------------------------------
if [ "$OPT_HELP" = "yes" ]; then
- cat <<EOF
-Usage: $relconf [options]
-
-Installation options:
-
- These are optional, but you may specify install directories.
-
- -prefix <dir> ...... The deployment directory, as seen on the target device.
- (default /usr/local/Qt-${QT_VERSION}, \$PWD if -developer-build is active)
-
- -extprefix <dir> ... The installation directory, as seen on the host machine.
- (default SYSROOT/PREFIX)
-
- -hostprefix [dir] .. The installation directory for build tools running on the
- host machine. If [dir] is not given, the current build
- directory will be used. (default EXTPREFIX)
-
- You may use these to change the layout of the install. Note that all directories
- except -sysconfdir should be located under -prefix/-hostprefix:
-
- -bindir <dir> ......... User executables will be installed to <dir>
- (default PREFIX/bin)
- -headerdir <dir> ...... Headers will be installed to <dir>
- (default PREFIX/include)
- -libdir <dir> ......... Libraries will be installed to <dir>
- (default PREFIX/lib)
- -archdatadir <dir> .... Arch-dependent data used by Qt will be installed to <dir>
- (default PREFIX)
- -plugindir <dir> ...... Plugins will be installed to <dir>
- (default ARCHDATADIR/plugins)
- -libexecdir <dir> ..... Program executables will be installed to <dir>
- (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW)
- -importdir <dir> ...... Imports for QML1 will be installed to <dir>
- (default ARCHDATADIR/imports)
- -qmldir <dir> ......... Imports for QML2 will be installed to <dir>
- (default ARCHDATADIR/qml)
- -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir>
- (default PREFIX)
- -docdir <dir> ......... Documentation will be installed to <dir>
- (default DATADIR/doc)
- -translationdir <dir> . Translations of Qt programs will be installed to <dir>
- (default DATADIR/translations)
- -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
- (default PREFIX/etc/xdg)
- -examplesdir <dir> .... Examples will be installed to <dir>
- (default PREFIX/examples)
- -testsdir <dir> ....... Tests will be installed to <dir>
- (default PREFIX/tests)
-
- -hostbindir <dir> .. Host executables will be installed to <dir>
- (default HOSTPREFIX/bin)
- -hostlibdir <dir> .. Host libraries will be installed to <dir>
- (default HOSTPREFIX/lib)
- -hostdatadir <dir> . Data used by qmake will be installed to <dir>
- (default HOSTPREFIX)
-
-Configure options:
-
- The defaults (*) are usually acceptable. A plus (+) denotes a default value
- that needs to be evaluated. If the evaluation succeeds, the feature is
- included. Here is a short explanation of each option:
-
- * -release ........... Compile and link Qt with debugging turned off.
- -debug ............. Compile and link Qt with debugging turned on.
- -debug-and-release . Compile and link two versions of Qt, with and without
- debugging turned on (Mac only).
-
- -force-debug-info .. Create symbol files for release builds.
-
- -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
-
- * -no-optimized-tools ... Do not build optimized host tools even in debug build.
- -optimized-tools ...... Build optimized host tools even in debug build.
-
- -opensource ........ Compile and link the Open-Source Edition of Qt.
- -commercial ........ Compile and link the Commercial Edition of Qt.
-
- -confirm-license ... Automatically acknowledge the license (use with
- either -opensource or -commercial)
-
- -c++std <edition> .. Compile Qt with C++ standard edition (c++11, c++14, c++1z)
- Default: highest supported
-
- * -shared ............ Create and use shared Qt libraries.
- -static ............ Create and use static Qt libraries.
-
- -no-largefile ...... Disables large file support.
- + -largefile ......... Enables Qt to access files larger than 4 GB.
-
- -no-accessibility .. Do not compile Accessibility support.
- Disabling accessibility is not recommended, as it will break QStyle
- and may break other internal parts of Qt.
- With this switch you create a source incompatible version of Qt,
- which is unsupported.
- + -accessibility ..... Compile Accessibility support.
-
- -no-sql-<driver> ... Disable SQL <driver> entirely.
- -qt-sql-<driver> ... Enable a SQL <driver> in the Qt SQL module, by default
- none are turned on.
- -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
- at run time.
-
- Possible values for <driver>:
- [$CFG_SQL_AVAILABLE ]
-
- -system-sqlite ..... Use sqlite from the operating system.
-
- -no-qml-debug ...... Do not build the in-process QML debugging support.
- + -qml-debug ......... Build the QML debugging support.
-
- -platform target ... The operating system and compiler you are building
- on (default detected from host system).
-
- See the README file for a list of supported
- operating systems and compilers.
-
- -no-sse2 ........... Do not compile with use of SSE2 instructions.
- -no-sse3 ........... Do not compile with use of SSE3 instructions.
- -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
- -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions.
- -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions.
- -no-avx ............ Do not compile with use of AVX instructions.
- -no-avx2 ........... Do not compile with use of AVX2 instructions.
- -no-avx512 ......... Do not compile with use of AVX512 instructions.
- -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions.
- -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions.
-
- -qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'.
- -qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so.
-
- -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool.
- -gcov .............. Instrument Qt with the GCov code coverage tool.
-
- -D <string> ........ Add an explicit define to the preprocessor.
- -I <string> ........ Add an explicit include path.
- -L <string> ........ Add an explicit library path.
-
- + -pkg-config ........ Use pkg-config to detect include and library paths. By default,
- configure determines whether to use pkg-config or not with
- some heuristics such as checking the environment variables.
- -no-pkg-config ..... Disable use of pkg-config.
- -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability
- detection heuristic).
-
- -help, -h .......... Display this information.
-
-Third Party Libraries:
-
- -qt-zlib ............ Use the zlib bundled with Qt.
- + -system-zlib ........ Use zlib from the operating system.
- See http://www.gzip.org/zlib
-
- -no-mtdev ........... Do not compile mtdev support.
- + -mtdev .............. Enable mtdev support.
-
- + -no-journald ........ Do not send logging output to journald.
- -journald ........... Send logging output to journald.
-
- + -no-syslog .......... Do not send logging output to syslog.
- -syslog ............. Send logging output to syslog.
-
- -no-gif ............. Do not compile GIF reading support.
-
- -no-libpng .......... Do not compile PNG support.
- -qt-libpng .......... Use the libpng bundled with Qt.
- + -system-libpng ...... Use libpng from the operating system.
- See http://www.libpng.org/pub/png
-
- -no-libjpeg ......... Do not compile JPEG support.
- -qt-libjpeg ......... Use the libjpeg bundled with Qt.
- + -system-libjpeg ..... Use libjpeg from the operating system.
- See http://www.ijg.org
-
- -no-doubleconversion ..... Use sscanf_l and snprintf_l for (imprecise) double conversion.
- -qt-doubleconversion ..... Use the libdouble-conversion bundled with Qt.
- + -system-doubleconversion . Use the libdouble-conversion provided by the system.
- See https://github.com/google/double-conversion
-
- -no-freetype ........ Do not compile in Freetype2 support.
- -qt-freetype ........ Use the libfreetype bundled with Qt.
- + -system-freetype..... Use the libfreetype provided by the system (enabled if -fontconfig is active).
- See http://www.freetype.org
-
- -no-harfbuzz ........ Do not compile HarfBuzz-NG support.
- -qt-harfbuzz ........ Use HarfBuzz-NG bundled with Qt to do text shaping.
- It can still be disabled by setting
- the QT_HARFBUZZ environment variable to "old".
- + -system-harfbuzz .... Use HarfBuzz-NG from the operating system
- to do text shaping. It can still be disabled
- by setting the QT_HARFBUZZ environment variable to "old".
- See http://www.harfbuzz.org
-
- -no-openssl ......... Do not compile support for OpenSSL.
- + -openssl ............ Enable run-time OpenSSL support.
- -openssl-linked ..... Enabled linked OpenSSL support.
-
- -no-libproxy ....... Do not compile support for libproxy
- + -libproxy .......... Use libproxy from the operating system.
-
- -qt-pcre ............ Use the PCRE library bundled with Qt.
- + -system-pcre ........ Use the PCRE library from the operating system.
-
- -qt-xcb ............. Use xcb- libraries bundled with Qt.
- (libxcb.so will still be used from operating system).
- + -system-xcb ......... Use xcb- libraries from the operating system.
-
- -xkb-config-root .... Set default XKB config root. This option is used only together with -qt-xkbcommon-x11.
- -qt-xkbcommon-x11 ... Use the xkbcommon library bundled with Qt in combination with xcb.
- + -system-xkbcommon-x11 Use the xkbcommon library from the operating system in combination with xcb.
-
- -no-xkbcommon-evdev . Do not use X-less xkbcommon when compiling libinput support.
- * -xkbcommon-evdev .... Use X-less xkbcommon when compiling libinput support.
-
- -no-xinput2 ......... Do not compile XInput2 support.
- * -xinput2 ............ Compile XInput2 support.
-
- -no-xcb-xlib......... Do not compile Xcb-Xlib support.
- * -xcb-xlib............ Compile Xcb-Xlib support.
-
- -no-glib ............ Do not compile Glib support.
- + -glib ............... Compile Glib support.
-
- -no-pulseaudio ...... Do not compile PulseAudio support.
- + -pulseaudio ......... Compile PulseAudio support.
-
- -no-alsa ............ Do not compile ALSA support.
- + -alsa ............... Compile ALSA support.
-
- -no-gtk ............. Do not compile GTK platform theme support.
- + -gtk ................ Compile GTK platform theme support.
-
-Additional options:
-
- -make <part> ....... Add part to the list of parts to be built at make time.
- (defaults to: $QT_DEFAULT_BUILD_PARTS)
- -nomake <part> ..... Exclude part from the list of parts to be built.
-
- -skip <module> ..... Exclude an entire module from the build.
-
- -no-compile-examples ... Install only the sources of examples.
-
- -no-gui ............ Don't build the Qt GUI module and dependencies.
- + -gui ............... Build the Qt GUI module and dependencies.
-
- -no-widgets ........ Don't build the Qt Widgets module and dependencies.
- + -widgets ........... Build the Qt Widgets module and dependencies.
-
- -R <string> ........ Add an explicit runtime library path to the Qt
- libraries.
- -l <string> ........ Add an explicit library.
-
- -no-rpath .......... Do not use the library install path as a runtime
- library path. On Apple platforms, this implies using
- absolute install names (based in -libdir) for dynamic
- libraries and frameworks.
- + -rpath ............. Link Qt libraries and executables using the library
- install path as a runtime library path. Equivalent
- to -R install_libpath
-
- -continue .......... Continue as far as possible if an error occurs.
-
- -verbose, -v ....... Print verbose information about each step of the
- configure process.
-
- -silent ............ Reduce the build output so that warnings and errors
- can be seen more easily.
-
- -no-cups ........... Do not compile CUPS support.
- * -cups .............. Compile CUPS support.
- Requires cups/cups.h and libcups.so.2.
-
- -no-iconv .......... Do not compile support for iconv(3).
- * -iconv ............. Compile support for iconv(3).
-
- -no-evdev .......... Do not compile support for evdev.
- * -evdev ............. Compile support for evdev.
-
- -no-tslib .......... Do not compile support for tslib.
- * -tslib ............. Compile support for tslib.
-
- -no-icu ............ Do not compile support for ICU libraries.
- + -icu ............... Compile support for ICU libraries.
-
- -no-fontconfig ..... Do not compile FontConfig support.
- + -fontconfig ........ Compile FontConfig support.
-
- -no-strip .......... Do not strip binaries and libraries of unneeded symbols.
- * -strip ............. Strip binaries and libraries of unneeded symbols when installing.
-
- * -no-pch ............ Do not use precompiled header support.
- -pch ............... Use precompiled header support.
-
- * -no-ltcg Do not use Link Time Code Generation
- -ltcg Use Link Time Code Generation.
-
- -no-dbus ........... Do not compile the Qt D-Bus module.
- + -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1.
- -dbus-runtime ...... Compile the Qt D-Bus module and dynamically load libdbus-1.
-
- -reduce-relocations ..... Reduce relocations in the libraries through extra
- linker optimizations (Qt/X11 and Qt for Embedded Linux only;
- experimental; needs GNU ld >= 2.18).
-
- -no-use-gold-linker ..... Do not link using the GNU gold linker.
- + -use-gold-linker ........ Link using the GNU gold linker if available.
-
- -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
-
- -sanitize [address|thread|memory|undefined] Enables the specified compiler sanitizer.
-
- -device <name> ............... Cross-compile for device <name> (experimental)
- -device-option <key=value> ... Add device specific options for the device mkspec
- (experimental)
-
- -host-option <key=value> ..... Add host specific options for the host mkspec
-
- * -no-separate-debug-info . Do not store debug information in a separate file.
- -separate-debug-info .... Strip debug information into a separate file.
-
- -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
- * -xcb ............... Compile Xcb support.
-
- -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
- * -eglfs ............. Compile EGLFS support.
-
- -no-kms ............ Do not compile backends for KMS.
- * -kms ............... Compile backends for KMS.
-
- -no-gbm ............ Do not compile backends for GBM.
- * -gbm ............... Compile backends for GBM.
-
- * -no-directfb ....... Do not compile DirectFB support.
- -directfb .......... Compile DirectFB support.
-
- -no-linuxfb ........ Do not compile Linux Framebuffer support.
- * -linuxfb ........... Compile Linux Framebuffer support.
-
- * -no-mirclient....... Do not compile Mir client support.
- -mirclient.......... Compile Mir client support.
-
- -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows).
-
- -xplatform target ... The target platform when cross-compiling.
-
- -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.
- -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler
-
- -external-hostbindir <path> .. Path to Qt tools built for this machine. Use this when -platform
- does not match the current system, i.e., to make a Canadian Cross Build.
-
- -no-feature-<feature> Do not compile in <feature>.
- -feature-<feature> .. Compile in <feature>. The available features
- are described in src/corelib/global/qfeatures.txt
-
- -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
- default ($CFG_QCONFIG).
-
- -qreal [double|float] typedef qreal to the specified type. The default is double.
- Note that changing this flag affects binary compatibility.
-
- -no-opengl .......... Do not support OpenGL.
- -opengl <api> ....... Enable OpenGL support
- With no parameter, this will attempt to auto-detect
- OpenGL ES 2.0 and higher, or regular desktop OpenGL.
- Use es2 for <api> to override auto-detection.
-
- -no-libinput ........ Do not support libinput.
- * -libinput ........... Enable libinput support.
-
- -no-gstreamer ....... Do not support GStreamer.
- + -gstreamer <version> Enable GStreamer support
- With no parameter, this will attempt to auto-detect GStreamer 0.10 and
- 1.0. GStreamer 1.0 is used by default when available.
- Use 0.10 or 1.0 for <version> to override auto-detection.
-
- * -no-system-proxies .. Do not use system network proxies by default.
- -system-proxies ..... Use system network proxies by default.
-
- -no-warnings-are-errors Make warnings be treated normally
- -warnings-are-errors Make warnings be treated as errors
- (enabled if -developer-build is active)
-
-QNX options:
-
- -no-slog2 .......... Do not compile with slog2 support.
- -slog2 ............. Compile with slog2 support.
-
- -no-pps ............ Do not compile with pps support.
- -pps ............... Compile with pps support.
-
- -no-imf ............ Do not compile with imf support.
- -imf ............... Compile with imf support.
-
- -no-lgmon .......... Do not compile with lgmon support.
- -lgmon ............. Compile with lgmon support.
-
-MacOS/iOS options:
-
- -Fstring ........... Add an explicit framework path.
- -fw string ......... Add an explicit framework.
-
- * -framework ......... Build Qt as a series of frameworks and
- link tools against those frameworks.
- -no-framework ...... Do not build Qt as a series of frameworks.
-
- * -securetransport ... Use SecureTransport instead of OpenSSL
-
- -no-securetransport Do not use SecureTransport, either use OpenSSL or do not use any SSL backend
- at all (if combined with -no-openssl).
-
- -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be
- one of the available SDKs as listed by 'xcodebuild -showsdks'.
- Note that the argument applies only to Qt libraries and applications built
- using the target mkspec - not host tools such as qmake, moc, rcc, etc.
-
-Android options:
-
- -android-sdk path .............. The Android SDK root path.
- (default \$ANDROID_SDK_ROOT)
-
- -android-ndk path .............. The Android NDK root path.
- (default \$ANDROID_NDK_ROOT)
-
- -android-ndk-platform .......... Sets the android platform
- (default $CFG_DEFAULT_ANDROID_PLATFORM)
-
- -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.)
- (default \$ANDROID_NDK_HOST)
-
- -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips,
- arm64-v8a, x86_64, mips64)
- (default $CFG_DEFAULT_ANDROID_TARGET_ARCH)
-
- -android-toolchain-version ..... Sets the android toolchain version
- (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION)
-
- -no-android-style-assets ....... Do not compile in the code which automatically extracts
- style assets from the run-time device. Setting this will
- make the Android style behave incorrectly, but will enable
- compatibility with the LGPL2.1 license.
- * -android-style-assets .......... Compile the code which automatically extracts style assets
- from the run-time device. This option will make the
- Android platform plugin incompatible with the LGPL2.1.
-EOF
-
- exit 0
-fi # Help
+ cat $relpath/config_help.txt
+ exit 0
+fi
#-------------------------------------------------------------------------------
# platform detection
@@ -2837,27 +831,7 @@ if [ -z "$PLATFORM" ]; then
PLATFORM_NOTES=
case "$UNAME_SYSTEM:$UNAME_RELEASE" in
Darwin:*)
- # Select compiler. Use g++ unless we find a usable Clang version. Note that
- # we are checking the "Apple" clang/LLVM version number, not the actual
- # clang/LLVM version number that the Apple version was based on. We look
- # for Apple clang version 3.0 or higher, which was branched off LLVM 3.0
- # from SVN, and first included in Xcode 4.2. Also note that we do not care
- # about the OS version, since we're not using the clang version that comes
- # with the system. We use 'xcrun' to check the clang version that's part of
- # the Xcode installation.
- XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1`
- CLANGVERSION=`echo "$XCRUN" | sed -n 's/.*version \([0-9]\).*/\1/p'`
- expr "$CLANGVERSION" : '[0-9]' > /dev/null || { echo "Unable to determine CLANG version from output of xcrun: $XCRUN" ; exit 2 ; }
- if [ "$CLANGVERSION" -ge 3 ]; then
- PLATFORM=macx-clang
-
- # Advertise g++ as an alternative on Lion and below
- if [ "$(uname -r | cut -d. -f1)" -le 11 ]; then
- PLATFORM_NOTES="\n - Also available for Mac OS X: macx-g++\n"
- fi
- else
- PLATFORM=macx-g++
- fi
+ PLATFORM=macx-clang
;;
AIX:*)
#PLATFORM=aix-g++
@@ -2945,13 +919,9 @@ if [ -z "$PLATFORM" ]; then
"
;;
SunOS:5*)
- if [ "$XPLATFORM_MINGW" = "yes" ]; then
- PLATFORM="solaris-g++"
- else
- #PLATFORM=solaris-g++
- PLATFORM=solaris-cc
- #PLATFORM=solaris-cc64
- fi
+ #PLATFORM=solaris-g++
+ PLATFORM=solaris-cc
+ #PLATFORM=solaris-cc64
PLATFORM_NOTES="
- Also available for Solaris: solaris-g++ solaris-cc-64
"
@@ -3014,20 +984,25 @@ case "$XPLATFORM" in
XPLATFORM_MINGW=yes
;;
*qnx-*)
- XPLATFORM_QNX=yes
;;
*haiku-*)
- XPLATFORM_HAIKU=yes
;;
*ios*)
XPLATFORM_MAC=yes
XPLATFORM_IOS=yes
;;
+ *tvos*)
+ XPLATFORM_MAC=yes
+ XPLATFORM_TVOS=yes
+ ;;
+ *watchos*)
+ XPLATFORM_MAC=yes
+ XPLATFORM_WATCHOS=yes
+ ;;
*macx*)
XPLATFORM_MAC=yes
;;
*integrity*)
- XPLATFORM_INTEGRITY=yes
;;
# XPLATFORM_ANDROID should not be set for unsupported/android-g++
*unsupported*)
@@ -3055,9 +1030,13 @@ if [ "$COMMERCIAL_USER" = "ask" ]; then
echo
if [ "$commercial" = "c" ]; then
COMMERCIAL_USER="yes"
+ OPT_CMDLINE="$OPT_CMDLINE
+-commercial"
break
elif [ "$commercial" = "o" ]; then
COMMERCIAL_USER="no"
+ OPT_CMDLINE="$OPT_CMDLINE
+-opensource"
break
fi
done
@@ -3202,51 +1181,7 @@ fi
# command line and environment validation
#-------------------------------------------------------------------------------
-# update QT_CONFIG to show our current predefined configuration
-CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h
-case "$CFG_QCONFIG" in
-minimal|small|medium|large|full)
- # these are a sequence of increasing functionality
- for c in minimal small medium large full; do
- QT_CONFIG="$QT_CONFIG $c-config"
- [ "$CFG_QCONFIG" = $c ] && break
- done
- [ "$CFG_QCONFIG" = full ] && CFG_QCONFIG_PATH=
- ;;
-*)
- # not known to be sufficient for anything
- if [ ! -f "$CFG_QCONFIG_PATH" ]; then
- CFG_QCONFIG_PATH=`makeabs "${CFG_QCONFIG}"`
- if [ ! -f "$CFG_QCONFIG_PATH" ]; then
- echo >&2 "Error: configuration file not found:"
- echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
- echo >&2 " or"
- echo >&2 " $CFG_QCONFIG_PATH"
- exit 1
- fi
- fi
-esac
-
-if [ "$XPLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then
- echo
- echo "WARNING: -debug-and-release is not supported outside of Mac OS X."
- echo "Qt can be built in release mode with separate debug information, so"
- echo "-debug-and-release is not necessary anymore"
- echo
-fi
-
-if ( [ "$CFG_XCB" = "system" ] || [ "$CFG_XCB" = "qt" ] ) && [ "$CFG_XKBCOMMON" = "no" ]; then
- echo "Error: -no-xkbcommon-x11 is not supported on XCB platform plugin."
- exit 101
-fi
-
if [ "$XPLATFORM_ANDROID" != "no" ]; then
- if [ "$CFG_DBUS" = "auto" ]; then
- CFG_DBUS="no"
- fi
- if [ "$CFG_EGLFS" = "auto" ]; then
- CFG_EGLFS="no"
- fi
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
case $PLATFORM in
linux-*)
@@ -3292,9 +1227,6 @@ if [ "$XPLATFORM_ANDROID" != "no" ]; then
exit 1
fi
- QT_QPA_DEFAULT_PLATFORM="android"
- CFG_LARGEFILE="no"
-
DeviceVar set DEFAULT_ANDROID_SDK_ROOT "$CFG_DEFAULT_ANDROID_SDK_ROOT"
DeviceVar set DEFAULT_ANDROID_NDK_ROOT "$CFG_DEFAULT_ANDROID_NDK_ROOT"
DeviceVar set DEFAULT_ANDROID_PLATFORM "$CFG_DEFAULT_ANDROID_PLATFORM"
@@ -3313,11 +1245,6 @@ if [ -d "$XPLATFORM" ]; then
else
XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
fi
-if [ "$PLATFORM" != "$XPLATFORM" ]; then
- QT_CROSS_COMPILE=yes
- QMAKE_CONFIG="$QMAKE_CONFIG cross_compile"
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG cross_compile"
-fi
if [ "$BUILD_ON_MAC" = "yes" ]; then
if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
@@ -3397,203 +1324,15 @@ if [ "$OPT_SHADOW" = "yes" ]; then
mkdir -p "$outpath/mkspecs"
fi
-# detect build style
-if [ "$CFG_DEBUG" = "auto" ]; then
- if [ "$XPLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
- CFG_DEBUG_RELEASE=yes
- CFG_DEBUG=yes
- elif [ "$CFG_DEV" = "yes" ]; then
- CFG_DEBUG_RELEASE=no
- CFG_DEBUG=yes
- else
- CFG_DEBUG_RELEASE=no
- CFG_DEBUG=no
- fi
-fi
-if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG build_all debug_and_release"
-fi
-
-if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info"
-fi
-
-if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG release_tools"
-fi
-
-if [ "$XPLATFORM_MAC" = "yes" ]; then
- [ "$CFG_PKGCONFIG" = "auto" ] && CFG_PKGCONFIG="no"
-fi
-
-if [ "$XPLATFORM_IOS" = "yes" ]; then
- CFG_RPATH="no"
- CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples"
- CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store
- CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtdoc qtmacextras qtserialport qtwebkit qtwebkit-examples"
- CFG_PRECOMPILE="no" # Precompiled headers not supported with multiple -arch arguments
-
- # If the user passes -sdk on the command line we build a SDK-specific Qt build.
- # Otherwise we build a joined simulator and device build, which is the default.
- if [ -z "$OPT_MAC_SDK" ]; then
- QT_CONFIG="$QT_CONFIG build_all simulator_and_device"
- fi
-fi
-
-# disable XCB and GTK support auto-detection on Mac
-if [ "$XPLATFORM_MAC" = "yes" ]; then
- [ "$CFG_XCB" = "auto" ] && CFG_XCB=no
- [ "$CFG_GTK" = "auto" ] && CFG_GTK=no
-fi
-
-QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`
-
-TEST_COMPILER=$QMAKE_CONF_COMPILER
-
-if [ "$XPLATFORM_ANDROID" != "no" ] ; then
- ANDROID_NDK_TOOLCHAIN_PREFIX=
- ANDROID_NDK_TOOLS_PREFIX=
- ANDROID_PLATFORM_ARCH=
- case $CFG_DEFAULT_ANDROID_TARGET_ARCH in
- armeabi*)
- ANDROID_NDK_TOOLS_PREFIX=arm-linux-androideabi
- ANDROID_NDK_TOOLCHAIN_PREFIX=arm-linux-androideabi
- ANDROID_PLATFORM_ARCH=arch-arm
- ;;
- x86)
- ANDROID_NDK_TOOLS_PREFIX=i686-linux-android
- ANDROID_NDK_TOOLCHAIN_PREFIX=x86
- ANDROID_PLATFORM_ARCH=arch-x86
- ;;
- mips)
- ANDROID_NDK_TOOLS_PREFIX=mipsel-linux-android
- ANDROID_NDK_TOOLCHAIN_PREFIX=mipsel-linux-android
- ANDROID_PLATFORM_ARCH=arch-mips
- ;;
- arm64-v8a)
- ANDROID_NDK_TOOLS_PREFIX=aarch64-linux-android
- ANDROID_NDK_TOOLCHAIN_PREFIX=aarch64-linux-android
- ANDROID_PLATFORM_ARCH=arch-arm64
- ;;
- mips64)
- ANDROID_NDK_TOOLS_PREFIX=mips64el-linux-android
- ANDROID_NDK_TOOLCHAIN_PREFIX=mips64el-linux-android
- ANDROID_PLATFORM_ARCH=arch-mips64
- ;;
- x86_64)
- ANDROID_NDK_TOOLS_PREFIX=x86_64-linux-android
- ANDROID_NDK_TOOLCHAIN_PREFIX=x86_64
- ANDROID_PLATFORM_ARCH=arch-x86_64
- ;;
- *)
- echo "ERROR: Unknown android arch $CFG_DEFAULT_ANDROID_TARGET_ARCH"
- exit 1
- ;;
- esac
- if [ "$XPLATFORM_ANDROID" = "g++" ] ; then
- QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/$ANDROID_NDK_TOOLCHAIN_PREFIX-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/$ANDROID_NDK_TOOLS_PREFIX-g++
- else
- QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/clang++
- fi
- TEST_COMPILER="$QMAKE_CONF_COMPILER --sysroot=$CFG_DEFAULT_ANDROID_NDK_ROOT/platforms/$CFG_DEFAULT_ANDROID_PLATFORM/$ANDROID_PLATFORM_ARCH/"
- if [ "$CFG_ANDROID_STYLE_ASSETS" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG android-style-assets"
+if [ "$XPLATFORM_ANDROID" = "no" ]; then
+ TEST_COMPILER=`getXQMakeConf QMAKE_CXX`
+ GCC_MACHINE_DUMP=
+ case "$TEST_COMPILER" in *g++) GCC_MACHINE_DUMP=$($TEST_COMPILER -dumpmachine);; esac
+ if [ -n "$GCC_MACHINE_DUMP" ]; then
+ DeviceVar set GCC_MACHINE_DUMP $($TEST_COMPILER -dumpmachine)
fi
fi
-TEST_COMPILER_CXXFLAGS=`getXQMakeConf QMAKE_CXXFLAGS`
-
-GCC_MACHINE_DUMP=
-case "$TEST_COMPILER" in *g++) GCC_MACHINE_DUMP=$($TEST_COMPILER -dumpmachine);; esac
-if [ -n "$GCC_MACHINE_DUMP" ]; then
- DeviceVar set GCC_MACHINE_DUMP $($TEST_COMPILER -dumpmachine)
-fi
-
-if [ -n "$CFG_SYSROOT" ] && [ "$CFG_GCC_SYSROOT" = "yes" ]; then
- SYSROOT_FLAG="--sysroot=$CFG_SYSROOT"
-else
- SYSROOT_FLAG=
-fi
-export SYSROOT_FLAG # used by config.tests/unix/{compile.test,arch.test}
-
-# Auto-detect default include and library search paths.
-
-# Use intermediate variable to get around backtick/quote nesting problems.
-awkprog='
-BEGIN { ORS = ""; FS = "="; incs = 0; libs = 0; }
-
-function normalize(dir)
-{
- do {
- odir = dir
- sub(/\/[^\/]+\/\.\./, "", dir)
- } while (dir != odir);
- do {
- odir = dir
- gsub(/\/\./, "", dir)
- } while (dir != odir);
- sub("/$", "", dir);
- return dir;
-}
-
-# extract include paths from indented lines between
-# #include <...> search starts here:
-# and
-# End of search list.
-/^\#include </ { yup=1; print "DEFAULT_INCDIRS=\""; next }
-/^End of search/ { yup=0; print "\"\n" }
-/ \(framework directory\)$/ { next }
-yup { print normalize(substr($0, 2)) "\n"; ++incs }
-
-# extract from one line like LIBRARY_PATH=/one/path:/another/path:...
-$1 == "LIBRARY_PATH" {
- libs = split($2, library_paths, ":");
- print "DEFAULT_LIBDIRS=\"";
- for (lib in library_paths) {
- dir = normalize(library_paths[lib]);
- if (!(dir in dirs)) {
- print dir "\n";
- dirs[dir] = 1;
- }
- }
- print "\"\n"
-}
-
-END {
- if (incs == 0)
- print "DEFAULT_INCDIRS=\"/usr/include\n/usr/local/include\"\n";
- if (libs == 0)
- print "DEFAULT_LIBDIRS=\"/lib\n/usr/lib\"\n";
-}'
-
-awkprog_result=`LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK "$awkprog"`
-eval "$awkprog_result"
-[ "$OPT_VERBOSE" = "yes" ] && echo "$awkprog_result"
-
-#setup the build parts
-if [ -z "$CFG_BUILD_PARTS" ]; then
- CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
-
- # build tests by default, if a developer build
- if [ "$CFG_DEV" = "yes" ]; then
- CFG_BUILD_PARTS="$CFG_BUILD_PARTS tests"
- fi
-
- # don't build tools by default when cross-compiling
- if [ "$PLATFORM" != "$XPLATFORM" ]; then
- CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed 's, tools,,g'`
- fi
-fi
-for nobuild in $CFG_NOBUILD_PARTS; do
- CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
-done
-if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
-# echo
-# echo "WARNING: libs is a required part of the build."
-# echo
- CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
-fi
-
#-------------------------------------------------------------------------------
# postprocess installation and deployment paths
#-------------------------------------------------------------------------------
@@ -3771,10 +1510,6 @@ if [ -z "$QT_REL_HOST_DATA" ]; then
fi
fi
-if [ "$CFG_COMPILE_EXAMPLES" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG compile_examples"
-fi
-
shortxspec=`echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
shortspec=`echo $QMAKESPEC | sed "s,^${relpath}/mkspecs/,,"`
@@ -3822,10 +1557,6 @@ addConfStr "$shortspec"
[ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
-/* License Info */
-static const char qt_configure_licensee_str [256 + 12] = "qt_lcnsuser=$Licensee";
-static const char qt_configure_licensed_products_str [256 + 12] = "qt_lcnsprod=$Edition";
-
/* Installation date */
static const char qt_configure_installation [12+11] = "qt_instdate=2012-12-20";
@@ -3853,10 +1584,6 @@ $QT_CONFIGURE_STRS#endif
# define QT_CONFIGURE_SYSROOTIFY_PREFIX $QMAKE_SYSROOTIFY
#endif
-/* strlen( "qt_lcnsxxxx" ) == 12 */
-#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12
-#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12
-
#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12
#ifdef QT_BUILD_QMAKE
# define QT_CONFIGURE_EXT_PREFIX_PATH qt_configure_ext_prefix_path_str + 12
@@ -4004,11 +1731,13 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
EXTRA_OBJS="$EXTRA_OBJS \
qsettings_mac.o \
qcore_mac.o \
- qcore_mac_objc.o"
+ qcore_mac_objc.o \
+ qcore_foundation.o"
EXTRA_SRCS="$EXTRA_SRCS \
\"\$(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp\" \
\"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp\" \
- \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm\""
+ \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm\" \
+ \"\$(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm\""
fi
echo >>"$mkfile"
@@ -4141,3589 +1870,71 @@ else
HOST_VARS_FILE="$HOST_VARS_OUTFILE"
fi
-
-echo "Running configuration tests..."
-
-#-------------------------------------------------------------------------------
-# Verify makespec
-#-------------------------------------------------------------------------------
-QMAKE_OUTPUT=`"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" -E -nocache -spec "$XQMAKESPEC" "QT=" $DEV_NULL 2>&1`
-if [ $? != "0" ]; then
- echo "Failed to process makespec for platform '$XPLATFORM'"
- if [ "$OPT_VERBOSE" = "yes" ]; then
- echo "$QMAKE_OUTPUT"
- else
- echo "Turn on verbose messaging (-v) to see the final report."
- fi
- exit 101
-fi
-
-#-------------------------------------------------------------------------------
-# Detect pkg-config
-#-------------------------------------------------------------------------------
-if [ -z "$PKG_CONFIG" ]; then
- # See if PKG_CONFIG is set in the mkspec:
- PKG_CONFIG="`"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" $DEV_NULL 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`"
- [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from mkspec: $PKG_CONFIG"
-fi
-if [ -z "$PKG_CONFIG" ]; then
- PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
- [ -n "$PKG_CONFIG" ] && [ "$OPT_VERBOSE" = "yes" ] && echo "Found pkg-config from \$PATH: $PKG_CONFIG"
-fi
-
-if [ "$CFG_PKGCONFIG" = "no" ]; then
- PKG_CONFIG=
- [ "$OPT_VERBOSE" = "yes" ] && echo "pkg-config support disabled."
-elif [ -n "$PKG_CONFIG" ]; then
- # found a pkg-config
- if [ "$QT_CROSS_COMPILE" = "yes" ]; then
- # when xcompiling, check environment to see if it's actually usable
- if [ -z "$PKG_CONFIG_LIBDIR" ]; then
- if [ -n "$CFG_SYSROOT" ] && [ -d "$CFG_SYSROOT/usr/lib/pkgconfig" ]; then
- PKG_CONFIG_LIBDIR=$CFG_SYSROOT/usr/lib/pkgconfig:$CFG_SYSROOT/usr/share/pkgconfig
- if [ -n "$GCC_MACHINE_DUMP" ]; then
- PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR:$CFG_SYSROOT/usr/lib/$GCC_MACHINE_DUMP/pkgconfig
- fi
- export PKG_CONFIG_LIBDIR
- echo >&2 "Note: PKG_CONFIG_LIBDIR automatically set to $PKG_CONFIG_LIBDIR"
- elif [ "$CFG_PKGCONFIG" = "auto" ]; then
- PKG_CONFIG=
- echo >&2 "Warning: Disabling pkg-config since PKG_CONFIG_LIBDIR is not set and"
- echo >&2 "the host's .pc files would be used (even if you set PKG_CONFIG_PATH)."
- echo >&2 "Set this variable to the directory that contains target .pc files"
- echo >&2 "for pkg-config to function correctly when cross-compiling or"
- echo >&2 "use -pkg-config to override this test."
- fi
- fi
- if [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
- if [ -n "$CFG_SYSROOT" ]; then
- PKG_CONFIG_SYSROOT_DIR=$CFG_SYSROOT
- export PKG_CONFIG_SYSROOT_DIR
- echo >&2 "Note: PKG_CONFIG_SYSROOT_DIR automatically set to $PKG_CONFIG_SYSROOT_DIR"
- elif [ "$CFG_PKGCONFIG" = "auto" ]; then
- PKG_CONFIG=
- echo >&2 "Warning: Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set."
- echo >&2 "Set this variable to your sysroot for pkg-config to function correctly when"
- echo >&2 "cross-compiling or use -pkg-config to override this test."
- fi
- fi
- fi
- if [ -n "$PKG_CONFIG" ]; then
- CFG_PKGCONFIG=yes
- else
- CFG_PKGCONFIG=no
- fi
-elif [ "$CFG_PKGCONFIG" = "yes" ]; then
- echo >&2 "Could not detect pkg-config from mkspec or PATH."
- exit 101
-fi
-
-if [ -z "$PKG_CONFIG" ]; then
- QT_CONFIG="$QT_CONFIG no-pkg-config"
-fi
-
#-------------------------------------------------------------------------------
# run configure tests
#-------------------------------------------------------------------------------
-# parameters: path, name, extra args
-compileTest()
-{
- path=config.tests/$1
- name=$2
- shift 2
- # allow config tests which behave differently depending on the type of
- # library being built (shared/static) e.g. see config.tests/unix/icu
- test_config="$QMAKE_CONFIG shared"
- if [ "$CFG_SHARED" = "no" ]; then
- test_config="$QMAKE_CONFIG static"
- fi
- TEST_CONFIG_FLAGS=
- if [ -z "$PKG_CONFIG" ]; then
- TEST_CONFIG_FLAGS="QT_CONFIG+=no-pkg-config"
- fi
- echo $ECHO_N "checking for $name... $ECHO_C"
- "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" "$CFG_QMAKE_PATH" "$QTCONFFILE" $I_FLAGS $D_FLAGS $L_FLAGS $TEST_CONFIG_FLAGS "$@"
-}
-
-compileTestWithPkgConfig()
-{
- if [ $# -lt 4 ]; then
- echo "CompileTestWithPkgConfig requires at least 4 arguments."
- echo "compileTestWithPkgConfig pkg_name configtest configtest_name qmake_postfix + additional arguments to compileTest"
- exit 1
- fi
-
- local pkg_name=$1
- local configtest=$2
- local configtest_name="$3"
- local qmake_postfix=$4
- shift 4
-
- local has_used_pkg_config="no"
-
- local incdir_raw incdir_mod cflags
- local libdir_raw libdir_mod libs
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists $pkg_name 2>/dev/null; then
- incdir_raw=`$PKG_CONFIG --cflags-only-I $pkg_name 2>/dev/null`
- cflags=`$PKG_CONFIG --cflags-only-other $pkg_name 2>/dev/null`
- libdir_raw=`$PKG_CONFIG --libs-only-L $pkg_name 2>/dev/null`
- libs=`$PKG_CONFIG --libs-only-l --libs-only-other $pkg_name 2>/dev/null`
- incdir_mod=`echo $incdir_raw | sed -e 's,^-I,,g' -e 's, -I, ,g'`
- libdir_mod=`echo $libdir_raw | sed -e 's,^-L,,g' -e 's, -L, ,g'`
- has_used_pkg_config="yes"
- fi
- if compileTest $configtest "$configtest_name" $libdir_raw $incdir_raw $libs $cflags "$@"; then
- if [ "$has_used_pkg_config" = "yes" ] && [ -n "$qmake_postfix" ]; then
- QMakeVar set QMAKE_INCDIR_$qmake_postfix "`shellArgumentListToQMakeList $incdir_mod`"
- QMakeVar set QMAKE_LIBDIR_$qmake_postfix "`shellArgumentListToQMakeList $libdir_mod`"
- QMakeVar set QMAKE_LIBS_$qmake_postfix "`shellArgumentListToQMakeList $libs`"
- QMakeVar set QMAKE_CFLAGS_$qmake_postfix "`shellArgumentListToQMakeList $cflags`"
- fi
- return 0
- else
- return 1
- fi
-}
-
-#-------------------------------------------------------------------------------
-# determine the target and host architectures
-#-------------------------------------------------------------------------------
-
-# Use config.tests/arch/arch.pro to have the compiler tell us what the target architecture is
-OUTFILE=$outpath/arch.result
-"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "target" $CFG_QMAKE_PATH $QTCONFFILE $I_FLAGS $D_FLAGS $L_FLAGS
-if [ $? -eq 0 ]; then
- eval `cat "$OUTFILE"`
-else
- echo
- echo "Could not determine the target architecture!"
- echo "Turn on verbose messaging (-v) to see the final report."
-fi
-rm -f "$OUTFILE" 2>/dev/null
-[ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
-
-if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
- # Do the same test again, using the host compiler
- SYSROOT_FLAG= "$unixtests/arch.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "host" $CFG_QMAKE_PATH $QTCONFFILE $I_FLAGS $D_FLAGS $L_FLAGS
- if [ $? -eq 0 ]; then
- eval `cat "$OUTFILE"`
- else
- echo
- echo "Could not determine the host architecture!"
- echo "Turn on verbose messaging (-v) to see the final report."
- fi
- rm -f "$OUTFILE" 2>/dev/null
- [ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
-else
- # not cross compiling, host == target
- CFG_HOST_ARCH="$CFG_ARCH"
- CFG_HOST_CPUFEATURES="$CFG_CPUFEATURES"
-fi
-unset OUTFILE
-
-if [ "$OPT_VERBOSE" = "yes" ]; then
- echo "System architecture: '$CFG_ARCH'"
- echo "Host architecture: '$CFG_HOST_ARCH'"
-fi
-
-#-------------------------------------------------------------------------------
-# functionality tests
-#-------------------------------------------------------------------------------
-
-# auto-detect precompiled header support
-if [ "$CFG_PRECOMPILE" = "auto" ]; then
- if "$unixtests/precomp.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
- CFG_PRECOMPILE=no
- else
- CFG_PRECOMPILE=yes
- fi
-fi
-
-# auto-detect -fvisibility support
-if [ "$CFG_REDUCE_EXPORTS" != "no" ]; then
- if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
- if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
- echo "-reduce-exports was requested but this compiler does not support it"
- echo "Re-run configure with -v for more information"
- exit 1
- fi
- CFG_REDUCE_EXPORTS=no
- else
- CFG_REDUCE_EXPORTS=yes
- fi
-fi
-
-# auto-detect -fuse-ld=gold support
-if [ "$CFG_USE_GOLD_LINKER" != "no" ]; then
- if compilerSupportsFlag $TEST_COMPILER -fuse-ld=gold; then
- CFG_USE_GOLD_LINKER=yes
- else
- if [ "$CFG_USE_GOLD_LINKER" = "yes" ]; then
- echo "-use-gold-linker was requested but this compiler does not support it"
- exit 1
- fi
- CFG_USE_GOLD_LINKER=no
- fi
-fi
-
-# auto-detect --enable-new-dtags support
-if linkerSupportsFlag $TEST_COMPILER --enable-new-dtags; then
- CFG_ENABLE_NEW_DTAGS=yes
-else
- CFG_ENABLE_NEW_DTAGS=no
-fi
-
-# auto-detect -fstack-protector-strong support (for QNX only currently)
-if [ "$XPLATFORM_QNX" = "yes" ]; then
- if compilerSupportsFlag $TEST_COMPILER -fstack-protector-strong; then
- CFG_STACK_PROTECTOR_STRONG=yes
- else
- CFG_STACK_PROTECTOR_STRONG=no
- fi
-else
- CFG_STACK_PROTECTOR_STRONG=no
-fi
-
-# detect the availability of the -Bsymbolic-functions linker optimization
-if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
- if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
- if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
- echo "-reduce-relocations was requested but this compiler does not support it"
- echo "Re-run configure with -v for more information"
- exit 1
- fi
- CFG_REDUCE_RELOCATIONS=no
- else
- CFG_REDUCE_RELOCATIONS=yes
- fi
-fi
-
-# auto-detect GNU make support
-if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>&1; then
- CFG_USE_GNUMAKE=yes
-fi
-
-# find the default framework value
-if [ "$XPLATFORM_MAC" = "yes" ]; then
- if [ "$CFG_FRAMEWORK" = "auto" ]; then
- CFG_FRAMEWORK="$CFG_SHARED"
- elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
- echo
- echo "WARNING: Using static linking will disable the use of Mac frameworks."
- echo
- CFG_FRAMEWORK="no"
- fi
-else
- CFG_FRAMEWORK=no
-fi
-
-if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
- # sanity-check for separate debug info
- if [ "$CFG_SHARED" = "no" ]; then
- echo "ERROR: -separate-debug-info is incompatible with -static"
- exit 1
- fi
- if [ "$CFG_DEBUG" = "no" -a "$CFG_DEBUG_RELEASE" = "no" -a "$CFG_FORCEDEBUGINFO" = "no" ]; then
- echo "ERROR: -separate-debug-info needs -debug, -debug-and-release, or -force-debug-info"
- exit 1
- fi
-
- # Detect objcopy support
- if [ "$XPLATFORM_MAC" = "no" ]; then
- if ! compileTest unix/objcopy "objcopy"; then
- echo "ERROR: -separate-debug-info was requested but this binutils does not support it."
- echo "Re-run configure with -v for more information"
- exit 1
- fi
- fi
-fi
-
-# Detect C++11 & up support
-stdcxx_error=false
-if [ "$CFG_STDCXX" = "c++11" ]; then
- : # CFG_STDCXX is correct
-elif ! compileTest common/c++14 "C++14"; then
- if [ "$CFG_STDCXX" != "auto" ]; then
- stdcxx_error=true
- else
- CFG_STDCXX="c++11"
- fi
-elif [ "$CFG_STDCXX" = "c++14" ]; then
- : # CFG_STDCXX is correct
-elif ! compileTest common/c++1z "C++1z"; then
- if [ "$CFG_STDCXX" != "auto" ]; then
- stdcxx_error=true
- else
- CFG_STDCXX="c++14"
- fi
-else
- CFG_STDCXX="c++1z"
-fi
-
-if $stdcxx_error && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "$CFG_STDCXX support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
-fi
-
-# Detect which edition of the C++ standard the compiler defaults to
-CFG_STDCXX_DEFAULT=199711
-if compileTest common/c++default "default C++ standard edition"; then
- if [ -e "$outpath/config.tests/common/c++default/c++default.ii" ]; then
- CFG_STDCXX_DEFAULT=`sed -n '/^[0-9]/s/L//p' "$outpath/config.tests/common/c++default/c++default.ii"`
- else
- if [ "$OPT_VERBOSE" = "yes" ]; then
- echo "Failed to run the preprocessor, something is wrong with your compiler"
- fi
- if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- exit 101
- fi
- fi
-fi
-
-# Detect whether 64-bit std::atomic works -- some 32-bit platforms require extra library support
-if compileTest common/atomic64 "64-bit std::atomic"; then
- CFG_ATOMIC64=yes
-elif compileTest common/atomic64 "64-bit std::atomic in -latomic" -latomic; then
- CFG_ATOMIC64=libatomic
-else
- CFG_ATOMIC64=no
-fi
-
-# Detect whether std::atomic works for function pointers -- some implementations are buggy
-if ! compileTest common/atomicfptr "std::atomic for function pointers"; then
- echo "ERROR: detected a std::atomic implementation that fails for function pointers."
- echo "Please apply the patch corresponding to your Standard Library vendor, found in"
- echo " $relpath/config.tests/common/atomicfptr"
- exit 101
-fi
-
-# detect sse2 support
-CFG_SSE_LIST=
-if [ "${CFG_SSE2}" = "auto" ]; then
- if compileTest common/sse2 "sse2"; then
- CFG_SSE2=yes
- CFG_SSE_LIST=SSE2
- else
- CFG_SSE2=no
- fi
-fi
-
-# detect sse3 support
-if [ "${CFG_SSE2}" = "no" ]; then
- CFG_SSE3=no
-fi
-if [ "${CFG_SSE3}" = "auto" ]; then
- if compileTest common/sse3 "sse3"; then
- CFG_SSE3=yes
- CFG_SSE_LIST="$CFG_SSE_LIST SSE3"
- else
- CFG_SSE3=no
- fi
-fi
-
-# detect ssse3 support
-if [ "${CFG_SSE3}" = "no" ]; then
- CFG_SSSE3=no
-fi
-if [ "${CFG_SSSE3}" = "auto" ]; then
- if compileTest common/ssse3 "ssse3"; then
- CFG_SSSE3=yes
- CFG_SSE_LIST="$CFG_SSE_LIST SSSE3"
- else
- CFG_SSSE3=no
- fi
-fi
-
-# detect sse4.1 support
-if [ "${CFG_SSSE3}" = "no" ]; then
- CFG_SSE4_1=no
-fi
-if [ "${CFG_SSE4_1}" = "auto" ]; then
- if compileTest common/sse4_1 "sse4_1"; then
- CFG_SSE4_1=yes
- CFG_SSE_LIST="$CFG_SSE_LIST SSE4.1"
- else
- CFG_SSE4_1=no
- fi
-fi
-
-# detect sse4.2 support
-if [ "${CFG_SSE4_1}" = "no" ]; then
- CFG_SSE4_2=no
-fi
-if [ "${CFG_SSE4_2}" = "auto" ]; then
- if compileTest common/sse4_2 "sse4_2"; then
- CFG_SSE4_2=yes
- CFG_SSE_LIST="$CFG_SSE_LIST SSE4.2"
- else
- CFG_SSE4_2=no
- fi
-fi
-
-# detect avx support
-CFG_AVX_LIST=
-if [ "${CFG_SSE4_2}" = "no" ]; then
- CFG_AVX=no
-fi
-if [ "${CFG_AVX}" = "auto" ]; then
- if compileTest common/avx "avx"; then
- case "$XQMAKESPEC" in
- *g++*|*-clang*)
- # Some clang versions produce internal compiler errors compiling Qt AVX code
- case `$TEST_COMPILER --version` in
- Apple\ clang\ version\ [23]*)
- CFG_AVX=no
- if [ "$OPT_VERBOSE" = "yes" ]; then
- echo 'AVX support disabled for blacklisted clang compiler'
- fi
- ;;
- *)
- CFG_AVX=yes
- CFG_AVX_LIST=AVX
- ;;
- esac
- ;;
- *)
- CFG_AVX=yes
- CFG_AVX_LIST=AVX
- ;;
- esac
- else
- CFG_AVX=no
- fi
-fi
-
-# detect avx2 support
-if [ "${CFG_AVX}" = "no" ]; then
- CFG_AVX2=no
-fi
-if [ "${CFG_AVX2}" = "auto" ]; then
- if compileTest common/avx2 "avx2"; then
- CFG_AVX2=yes
- CFG_AVX_LIST="$CFG_AVX_LIST AVX2"
- else
- CFG_AVX2=no
- fi
-fi
-
-# detect avx512 support
-if [ "${CFG_AVX2}" = "no" ]; then
- CFG_AVX512=
-fi
-if [ "${CFG_AVX512}" = "auto" ]; then
- # First, test for AVX-512 Foundation
- if compileTest common/avx512 "avx512f" AVX512=F; then
- # Test for the sub-features
- CFG_AVX512=f
- CFG_AVX512_UPPER=AVX512F
- for feature in er cd pf dq bw vl ifma vbmi; do
- if [ -n "$BASH_VERSION" ] && [ "${BASH_VERSION%%.*}" -gt 3 ]; then
- upper=${feature^^*}
- elif [ -n "$ZSH_VERSION" ]; then
- upper=${(U)feature}
- else
- upper=`echo $feature | tr a-z A-Z`
- fi
- if compileTest common/avx512 "avx512$feature" AVX512=$upper; then
- CFG_AVX512="$CFG_AVX512 $feature"
- CFG_AVX512_UPPER="$CFG_AVX512_UPPER AVX512$upper"
- fi
- done
- else
- CFG_AVX512=
- fi
-fi
-
-# check Neon support
-if [ "$CFG_NEON" = "auto" ]; then
- # no compile test, just check what the compiler has
- case "$CFG_CPUFEATURES" in
- *neon*)
- CFG_NEON=yes
- ;;
- *)
- CFG_NEON=no
- ;;
- esac
-fi
-
-# detect mips_dsp support
-if [ "$CFG_ARCH" = "mips" ] && [ "${CFG_MIPS_DSP}" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mips_dsp "mips_dsp" "$CFG_QMAKE_PATH" "$QTCONFFILE" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
- CFG_MIPS_DSP=yes
- else
- CFG_MIPS_DSP=no
- fi
-elif [ "$CFG_ARCH" != "mips" ]; then
- CFG_MIPS_DSP=no
-fi
-
-# detect mips_dspr2 support
-if [ "$CFG_ARCH" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "auto" ]; then
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mips_dspr2 "mips_dspr2" "$CFG_QMAKE_PATH" "$QTCONFFILE" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
- CFG_MIPS_DSPR2=yes
- else
- CFG_MIPS_DSPR2=no
- fi
-elif [ "$CFG_ARCH" != "mips" ]; then
- CFG_MIPS_DSPR2=no
-fi
-
-[ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
-[ "$XPLATFORM_ANDROID" != "no" ] && QMakeVar add styles "android"
-
-# check IPC support
-if ! compileTest unix/ipc_sysv "ipc_sysv" ; then
- # SYSV IPC is not supported - check POSIX IPC
- if compileTest unix/ipc_posix "ipc_posix" ; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_POSIX_IPC"
- else
- if [ "$XPLATFORM_ANDROID" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] ; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SYSTEMSEMAPHORE QT_NO_SHAREDMEMORY"
- fi
- fi
-fi
-
-# detect zlib
-if [ "$CFG_ZLIB" = "no" ]; then
- # Note: Qt no longer support builds without zlib
- # So we force a "no" to be "auto" here.
- # If you REALLY really need no zlib support, you can still disable
- # it by doing the following:
- # add "no-zlib" to mkspecs/qconfig.pri
- # #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
- #
- # There's no guarantee that Qt will build under those conditions
-
- CFG_ZLIB=auto
- ZLIB_FORCED=yes
-fi
-
-if [ "$XPLATFORM_QNX" = "yes" ]; then
- if [ "$CFG_SLOG2" != "no" ]; then
- if compileTest unix/slog2 "slog2"; then
- CFG_SLOG2=yes
- QMAKE_CONFIG="$QMAKE_CONFIG slog2"
- else
- CFG_SLOG2=no
- fi
- fi
- if [ "$CFG_QNX_IMF" != "no" ]; then
- if compileTest unix/qqnx_imf "qqnx_imf"; then
- CFG_QNX_IMF=yes
- QMAKE_CONFIG="$QMAKE_CONFIG qqnx_imf"
- else
- CFG_QNX_IMF=no
- fi
- fi
- if [ "$CFG_PPS" != "no" ]; then
- if compileTest unix/pps "pps"; then
- CFG_PPS=yes
- QMAKE_CONFIG="$QMAKE_CONFIG qqnx_pps"
- else
- CFG_PPS=no
- fi
- fi
-
- if [ "$CFG_LGMON" != "no" ]; then
- if compileTest unix/lgmon "lgmon"; then
- CFG_LGMON=yes
- QMAKE_CONFIG="$QMAKE_CONFIG lgmon"
- else
- CFG_LGMON=no
- fi
- fi
-fi
-
-if [ "$XPLATFORM_INTEGRITY" = "yes" ]; then
- CFG_INTEGRITYFB=yes
- CFG_SHARED=no
- CFG_LARGEFILE=no
-fi
-
-if [ "$CFG_ZLIB" = "auto" ]; then
- if compileTest unix/zlib "zlib"; then
- CFG_ZLIB=system
- else
- CFG_ZLIB=yes
- fi
-fi
-
-if [ "$CFG_MTDEV" != "no" ]; then
- if compileTest unix/mtdev "mtdev"; then
- CFG_MTDEV=yes
- else
- CFG_MTDEV=no
- fi
-fi
-if [ "$CFG_MTDEV" = "no" ]; then
- QMakeVar add DEFINES QT_NO_MTDEV
-fi
-
-if [ "$CFG_JOURNALD" != "no" ]; then
- if compileTest unix/journald "journald"; then
- CFG_JOURNALD=yes
- QMAKE_CONFIG="$QMAKE_CONFIG journald"
- else
- if [ "$CFG_JOURNALD" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "journald support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_JOURNALD=no
- fi
- fi
-fi
-
-if [ "$CFG_SYSLOG" != "no" ]; then
- if compileTest unix/syslog "syslog"; then
- CFG_SYSLOG=yes
- QMAKE_CONFIG="$QMAKE_CONFIG syslog"
- else
- if [ "$CFG_SYSLOG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "syslog support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SYSLOG=no
- fi
- fi
-fi
-
-if [ "$CFG_LARGEFILE" = "auto" ]; then
- #Large files should be enabled for all Linux systems
- CFG_LARGEFILE=yes
-fi
-
-if [ "$CFG_GUI" = "no" ]; then
- QPA_PLATFORM_GUARD=no
-fi
-
-# detect how jpeg should be built
-if [ "$CFG_JPEG" = "auto" ]; then
- if [ "$CFG_SHARED" = "yes" ]; then
- CFG_JPEG=plugin
- else
- CFG_JPEG=yes
- fi
-fi
-# detect jpeg
-if [ "$CFG_LIBJPEG" = "auto" ]; then
- if compileTest unix/libjpeg "libjpeg"; then
- CFG_LIBJPEG=system
- else
- CFG_LIBJPEG=qt
- fi
-fi
-
-# detect how gif should be built
-if [ "$CFG_GIF" = "auto" ]; then
- if [ "$CFG_SHARED" = "yes" ]; then
- CFG_GIF=plugin
- else
- CFG_GIF=yes
- fi
-fi
-
-# detect png
-if [ "$CFG_LIBPNG" = "auto" ]; then
- if compileTest unix/libpng "libpng"; then
- CFG_LIBPNG=system
- else
- CFG_LIBPNG=qt
- fi
-fi
-
-# detect dl
-if compileTest unix/dlopen "dlopen"; then
- QMAKE_CONFIG="$QMAKE_CONFIG no-libdl"
-else
- if ! compileTest unix/libdl "libdl"; then
- QMAKE_CONFIG="$QMAKE_CONFIG no-libdl"
- QMakeVar add DEFINES QT_NO_DYNAMIC_LIBRARY
- fi
-fi
-
-if [ "$CFG_EGLFS" = "yes" ]; then
- if [ "$CFG_EGL" = "no" ]; then
- echo "The EGLFS plugin requires EGL support and cannot be built"
- exit 101
- fi
- CFG_EGL=yes
-fi
-
-# auto-detect SQL-modules support
-for _SQLDR in $CFG_SQL_AVAILABLE; do
- case $_SQLDR in
- mysql)
- if [ "$CFG_SQL_mysql" != "no" ]; then
- [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
- if [ -x "$CFG_MYSQL_CONFIG" ]; then
- QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null | filterIncludeOptions`
- # -rdynamic should not be returned by mysql_config, but is on RHEL 6.6
- QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"`
- QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"`
- QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
- QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
- fi
- if [ -n "$QT_MYSQL_VERSION" ] && [ "$QT_MYSQL_VERSION_MAJOR" -lt 4 ]; then
- if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "This version of MySql is not supported ($QT_MYSQL_VERSION)."
- echo " You need MySql 4 or higher."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_mysql="no"
- QT_LFLAGS_MYSQL=""
- QT_LFLAGS_MYSQL_R=""
- QT_CFLAGS_MYSQL=""
- fi
- else
- if compileTest unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $QT_CFLAGS_MYSQL; then
- QMakeVar add CONFIG use_libmysqlclient_r
- if [ "$CFG_SQL_mysql" = "auto" ]; then
- CFG_SQL_mysql=plugin
- fi
- QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
- elif compileTest unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $QT_CFLAGS_MYSQL; then
- if [ "$CFG_SQL_mysql" = "auto" ]; then
- CFG_SQL_mysql=plugin
- fi
- else
- if [ "$CFG_SQL_mysql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "MySQL support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_mysql=no
- QT_LFLAGS_MYSQL=""
- QT_LFLAGS_MYSQL_R=""
- QT_CFLAGS_MYSQL=""
- fi
- fi
- fi
- fi
- ;;
- psql)
- if [ "$CFG_SQL_psql" != "no" ]; then
- [ -z "$CFG_PSQL_CONFIG" ] && CFG_PSQL_CONFIG=`"$WHICH" pg_config`
- # Be careful not to use native pg_config when cross building.
- if [ "$XPLATFORM_MINGW" != "yes" ] && [ -x "$CFG_PSQL_CONFIG" ]; then
- QT_CFLAGS_PSQL=`$CFG_PSQL_CONFIG --includedir 2>/dev/null | filterIncludePath`
- QT_LFLAGS_PSQL=`$CFG_PSQL_CONFIG --libdir 2>/dev/null | filterLibraryPath`
- fi
- [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
- [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
- # But, respect PSQL_LIBS if set
- [ -z "$PSQL_LIBS" ] || QT_LFLAGS_PSQL="$PSQL_LIBS"
- if compileTest unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $QT_CFLAGS_PSQL; then
- if [ "$CFG_SQL_psql" = "auto" ]; then
- CFG_SQL_psql=plugin
- fi
- else
- if [ "$CFG_SQL_psql" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "PostgreSQL support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_psql=no
- QT_CFLAGS_PSQL=""
- QT_LFLAGS_PSQL=""
- fi
- fi
- fi
- ;;
- odbc)
- if [ "$CFG_SQL_odbc" != "no" ]; then
- if [ "$XPLATFORM_MAC" != "yes" ] && compileTest unix/odbc "ODBC"; then
- if [ "$CFG_SQL_odbc" = "auto" ]; then
- CFG_SQL_odbc=plugin
- fi
- else
- if compileTest unix/iodbc "iODBC"; then
- QT_LFLAGS_ODBC="-liodbc"
- if [ "$CFG_SQL_odbc" = "auto" ]; then
- CFG_SQL_odbc=plugin
- fi
- else
- if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "ODBC support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_odbc=no
- fi
- fi
- fi
- fi
- ;;
- oci)
- if [ "$CFG_SQL_oci" != "no" ]; then
- if compileTest unix/oci "OCI"; then
- if [ "$CFG_SQL_oci" = "auto" ]; then
- CFG_SQL_oci=plugin
- fi
- else
- if [ "$CFG_SQL_oci" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "Oracle (OCI) support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_oci=no
- fi
- fi
- fi
- ;;
- tds)
- if [ "$CFG_SQL_tds" != "no" ]; then
- [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib"
- [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS"
- if compileTest unix/tds "TDS" $QT_LFLAGS_TDS; then
- if [ "$CFG_SQL_tds" = "auto" ]; then
- CFG_SQL_tds=plugin
- fi
- else
- if [ "$CFG_SQL_tds" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "TDS support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_tds=no
- fi
- fi
- fi
- ;;
- db2)
- if [ "$CFG_SQL_db2" != "no" ]; then
- if compileTest unix/db2 "DB2"; then
- if [ "$CFG_SQL_db2" = "auto" ]; then
- CFG_SQL_db2=plugin
- fi
- else
- if [ "$CFG_SQL_db2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "ODBC support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_db2=no
- fi
- fi
- fi
- ;;
- ibase)
- if [ "$CFG_SQL_ibase" != "no" ]; then
- if compileTest unix/ibase "InterBase"; then
- if [ "$CFG_SQL_ibase" = "auto" ]; then
- CFG_SQL_ibase=plugin
- fi
- else
- if [ "$CFG_SQL_ibase" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "InterBase support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_ibase=no
- fi
- fi
- fi
- ;;
- sqlite2)
- if [ "$CFG_SQL_sqlite2" != "no" ]; then
- if compileTest unix/sqlite2 "SQLite2"; then
- if [ "$CFG_SQL_sqlite2" = "auto" ]; then
- CFG_SQL_sqlite2=plugin
- fi
- else
- if [ "$CFG_SQL_sqlite2" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "SQLite2 support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_SQL_sqlite2=no
- fi
- fi
- fi
- ;;
- sqlite)
- if [ "$CFG_SQL_sqlite" != "no" ]; then
- SQLITE_AUTODETECT_FAILED="no"
- if [ "$CFG_SQLITE" = "system" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists sqlite3 2>/dev/null; then
- QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
- QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
- else
- QT_CFLAGS_SQLITE=
- QT_LFLAGS_SQLITE="-lsqlite3 -lz"
- fi
- if compileTest unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $QT_CFLAGS_SQLITE; then
- if [ "$CFG_SQL_sqlite" = "auto" ]; then
- CFG_SQL_sqlite=plugin
- fi
- QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
- else
- SQLITE_AUTODETECT_FAILED="yes"
- CFG_SQL_sqlite=no
- fi
- elif [ -f "$relpath/src/3rdparty/sqlite/sqlite3.h" ]; then
- if [ "$CFG_SQL_sqlite" = "auto" ]; then
- CFG_SQL_sqlite=plugin
- fi
- else
- SQLITE_AUTODETECT_FAILED="yes"
- CFG_SQL_sqlite=no
- fi
-
- if [ "$SQLITE_AUTODETECT_FAILED" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "SQLite support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- fi
- fi
- ;;
- *)
- if [ "$OPT_VERBOSE" = "yes" ]; then
- echo "unknown SQL driver: $_SQLDR"
- fi
- ;;
- esac
-done
-
-# auto-detect CUPS support
-if [ "$CFG_CUPS" != "no" ]; then
- if compileTest unix/cups "Cups"; then
- CFG_CUPS=yes
- else
- if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "Cups support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_CUPS=no
- fi
- fi
-fi
-
-# auto-detect iconv(3) support
-if [ "$CFG_ICONV" != "no" ]; then
- if [ "$XPLATFORM_MINGW" = "yes" ]; then
- CFG_ICONV=no
- elif compileTest unix/iconv "POSIX iconv"; then
- CFG_ICONV=yes
- elif compileTest unix/sun-libiconv "SUN libiconv"; then
- CFG_ICONV=sun
- elif compileTest unix/gnu-libiconv "GNU libiconv"; then
- CFG_ICONV=gnu
- else
- if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "Iconv support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_ICONV=no
- fi
- fi
-fi
-
-# auto-detect libdbus-1 support
-# auto: detect if libdbus-1 is present; if so, link to it
-# linked: fail if libdbus-1 is not present; otherwise link to it
-# runtime: no detection (cannot fail), load libdbus-1 at runtime
-if [ "$CFG_DBUS" = "auto" ] || [ "$CFG_DBUS" = "linked" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
- QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
- QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
- else
- QT_LIBS_DBUS="-ldbus-1"
- fi
- if compileTest unix/dbus "D-Bus" $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then
- QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS"
- QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
- # Try find correct host configuration for dbus tools when cross-compiling
- if [ "$QT_CROSS_COMPILE" = "yes" ] && env -i PATH="$PATH" \
- pkg-config --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
- QT_CFLAGS_DBUS=`env -i PATH="$PATH" pkg-config --cflags dbus-1 2>/dev/null`
- fi
- QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
- CFG_DBUS=linked
- else
- # Failed to compile the test, so it's an error if CFG_DBUS is "linked"
- if [ "$CFG_DBUS" = "linked" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- # CFG_DBUS is "auto" here
- CFG_DBUS=runtime
- fi
- fi
-fi
-
-# auto-detect libproxy support
-if [ "$CFG_LIBPROXY" != "no" ]; then
- if compileTest common/libproxy "libproxy"; then
- CFG_LIBPROXY=yes
- else
- if [ "$CFG_LIBPROXY" = "auto" ]; then
- CFG_LIBPROXY=no
- elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- # CFG_LIBPROXY is "yes" here
- echo "The libproxy support cannot be enabled because libproxy was not found."
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- fi
- fi
-fi
-
-# auto-detect Glib support
-if [ "$CFG_GLIB" != "no" ]; then
- if [ -n "$PKG_CONFIG" ]; then
- QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
- QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
- fi
- if compileTest unix/glib "Glib" $QT_CFLAGS_GLIB $QT_LIBS_GLIB; then
- CFG_GLIB=yes
- QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
- QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
- else
- if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "Glib support cannot be enabled due to functionality tests!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_GLIB=no
- fi
- fi
-fi
-
-# auto-detect GTK style support
-if [ "$CFG_GLIB" = "yes" -a "$CFG_GTK" != "no" ]; then
- if [ -n "$PKG_CONFIG" ]; then
- QT_CFLAGS_QGTK3=`$PKG_CONFIG --cflags gtk+-3.0 2>/dev/null`
- QT_LIBS_QGTK3=`$PKG_CONFIG --libs gtk+-3.0 2>/dev/null`
- QT_LIBS_QGOBJECT=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
- fi
- if [ -n "$QT_CFLAGS_QGTK3" ] ; then
- CFG_GTK=yes
- QT_CONFIG="$QT_CONFIG gtk3"
- QMakeVar set QT_CFLAGS_QGTK3 "$QT_CFLAGS_QGTK3"
- QMakeVar set QT_LIBS_QGTK3 "$QT_LIBS_QGTK3"
- else
- if [ "$CFG_GTK" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "GTK theme support cannot be enabled due to functionality tests!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_GTK=no
- fi
- fi
-elif [ "$CFG_GLIB" = "no" ]; then
- CFG_GTK=no
-fi
-
-# auto-detect libicu support
-if [ "$CFG_ICU" != "no" ]; then
- if compileTest unix/icu "ICU"; then
- [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
- else
- if [ "$CFG_ICU" = "auto" ]; then
- CFG_ICU=no
- elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- # CFG_ICU is "yes"
-
- echo "The ICU library support cannot be enabled."
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- fi
- fi
-fi
-
-# Auto-detect PulseAudio support
-if [ "$CFG_PULSEAUDIO" != "no" ]; then
- if [ -n "$PKG_CONFIG" ]; then
- QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
- QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
- fi
- if compileTest unix/pulseaudio "PulseAudio" $QT_CFLAGS_PULSEAUDIO $QT_LIBS_PULSEAUDIO; then
- CFG_PULSEAUDIO=yes
- QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
- QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
- else
- if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "PulseAudio support cannot be enabled due to functionality tests!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_PULSEAUDIO=no
- fi
- fi
-fi
-
-# X11/MINGW OpenGL
-if [ "$XPLATFORM_MINGW" = "yes" ]; then
- # auto-detect OpenGL support (es2 = OpenGL ES 2.0 or higher)
- if [ "$CFG_GUI" = "no" ]; then
- if [ "$CFG_OPENGL" = "auto" ]; then
- CFG_OPENGL=no
- fi
- if [ "$CFG_OPENGL" != "no" ]; then
- echo "OpenGL enabled, but GUI disabled."
- echo " You might need to either enable the GUI or disable OpenGL"
- exit 1
- fi
- fi
- if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
- if compileTest x11/opengl "OpenGL"; then
- CFG_OPENGL=desktop
- elif compileTest unix/opengles2 "OpenGL ES 2.0"; then
- CFG_OPENGL=es2
- else
- if [ "$CFG_OPENGL" = "yes" ]; then
- echo "All the OpenGL functionality tests failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- CFG_OPENGL=no
- fi
- case "$PLATFORM" in
- hpux*)
- # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
- if [ "$CFG_OPENGL" = "desktop" ]; then
- compileTest x11/glxfbconfig "OpenGL"
- if [ $? != "0" ]; then
- QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
- fi
- fi
- ;;
- *)
- ;;
- esac
- elif [ "$CFG_OPENGL" = "es2" ]; then
- #OpenGL ES 2.0
- compileTest unix/opengles2 "OpenGL ES 2.0"
- if [ $? != "0" ]; then
- echo "The OpenGL ES 2.0 functionality test failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- elif [ "$CFG_OPENGL" = "desktop" ]; then
- # Desktop OpenGL support
- compileTest x11/opengl "OpenGL"
- if [ $? != "0" ]; then
- echo "The OpenGL functionality test failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- case "$PLATFORM" in
- hpux*)
- # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
- compileTest x11/glxfbconfig "OpenGL"
- if [ $? != "0" ]; then
- QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
- fi
- ;;
- *)
- ;;
- esac
- fi
-fi # X11/MINGW OpenGL
-
-if [ "$XPLATFORM_MAC" = "yes" ]; then
- if [ "$CFG_COREWLAN" = "auto" ]; then
- if compileTest mac/corewlan "CoreWlan"; then
- CFG_COREWLAN=yes
- else
- CFG_COREWLAN=no
- fi
- fi
-fi
-
-# auto-detect OpenGL support (es2 = OpenGL ES 2.0 or higher)
-if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
- if compileTestWithPkgConfig gl unix/opengldesktop "OpenGL" OPENGL; then
- CFG_OPENGL=desktop
- elif compileTestWithPkgConfig glesv2 unix/opengles2 "OpenGL ES 2.0" OPENGL_ES2; then
- CFG_OPENGL=es2
- else
- if [ "$CFG_OPENGL" = "yes" ]; then
- echo "All the OpenGL functionality tests failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- CFG_OPENGL=no
- fi
-elif [ "$CFG_OPENGL" = "es2" ]; then
- #OpenGL ES 2.0
-
- compileTestWithPkgConfig glesv2 unix/opengles2 "OpenGL ES 2.0" OPENGL_ES2
- if [ $? != "0" ]; then
- echo "The OpenGL ES 2.0 functionality test failed!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
-elif [ "$CFG_OPENGL" = "desktop" ]; then
- # Desktop OpenGL support
- compileTestWithPkgConfig gl unix/opengldesktop "OpenGL" OPENGL
- if [ $? != "0" ]; then
- echo "The OpenGL functionality test failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
-fi
-
-# If OpenGL ES 2.0 is enabled, check for 3.0 and higher. This is used to allow
-# compile-time differentiation and including the version specific (but backwards
-# compatible) ES headers (for example, GLES3/gl31.h). Other than that, there is
-# no difference in the configuration, even the library is the same.
-if [ "$CFG_OPENGL" = "es2" ] && [ "$CFG_OPENGLES3" = "yes" ]; then
- if compileTestWithPkgConfig glesv2 unix/opengles3 "OpenGL ES 3.0" ""; then
- # Add a define for ES3, in addition to ES and ES2.
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_3"
- fi
- if compileTestWithPkgConfig glesv2 unix/opengles31 "OpenGL ES 3.1" ""; then
- # Add a define for ES31.
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_3_1"
- fi
-fi
-
-# auto-detect FontConfig support
-ORIG_CFG_FREETYPE="$CFG_FREETYPE"
-if [ "$CFG_FONTCONFIG" != "no" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
- QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
- QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
- else
- QT_CFLAGS_FONTCONFIG=
- QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
- fi
- if compileTest unix/fontconfig "FontConfig" $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then
- QT_CONFIG="$QT_CONFIG fontconfig"
- QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
- QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
- CFG_FONTCONFIG=yes
- CFG_FREETYPE=system
- else
- CFG_FONTCONFIG=no
- fi
-
-fi
-
-# Save these for a check later
-ORIG_CFG_XCB="$CFG_XCB"
-ORIG_CFG_EGLFS="$CFG_EGLFS"
-ORIG_CFG_DIRECTFB="$CFG_DIRECTFB"
-ORIG_CFG_LINUXFB="$CFG_LINUXFB"
-ORIG_CFG_MIRCLIENT="$CFG_MIRCLIENT"
-
-if [ "$CFG_LIBUDEV" != "no" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
- QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
- QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
- QMAKE_CFLAGS_LIBUDEV=`$PKG_CONFIG --cflags libudev 2>/dev/null`
- QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
- QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
- fi
- if compileTest unix/libudev "libudev" $QMAKE_CFLAGS_LIBUDEV $QMAKE_LIBS_LIBUDEV; then
- CFG_LIBUDEV=yes
- QT_CONFIG="$QT_CONFIG libudev"
- elif [ "$CFG_LIBUDEV" = "yes" ]; then
- echo "The libudev functionality test failed!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- exit 1
- else
- CFG_LIBUDEV=no
- fi
-fi
-if [ "$CFG_LIBUDEV" = "no" ]; then
- QMakeVar add DEFINES QT_NO_LIBUDEV
-fi
-
-if [ "$CFG_EVDEV" != "no" ]; then
- if compileTest unix/evdev "evdev"; then
- CFG_EVDEV=yes
- QT_CONFIG="$QT_CONFIG evdev"
- elif [ "$CFG_EVDEV" = "yes" ]; then
- echo "The evdev functionality test failed!"
- exit 1
- else
- CFG_EVDEV=no
- fi
-fi
-if [ "$CFG_EVDEV" = "no" ]; then
- QMakeVar add DEFINES QT_NO_EVDEV
-fi
-
-if [ "$CFG_TSLIB" != "no" ]; then
- if compileTest unix/tslib "tslib"; then
- CFG_TSLIB=yes
- QT_CONFIG="$QT_CONFIG tslib"
- elif [ "$CFG_TSLIB" = "yes" ]; then
- echo "The tslib functionality test failed!"
- exit 1
- else
- CFG_TSLIB=no
- fi
-fi
-if [ "$CFG_TSLIB" = "no" ]; then
- QMakeVar add DEFINES QT_NO_TSLIB
-fi
-
-if [ "$CFG_XKBCOMMON_EVDEV" != "no" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
- QMAKE_INCDIR_XKBCOMMON_EVDEV=`$PKG_CONFIG --cflags-only-I xkbcommon 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
- QMAKE_LIBS_XKBCOMMON_EVDEV=`$PKG_CONFIG --libs xkbcommon 2>/dev/null`
- QMAKE_CFLAGS_XKBCOMMON_EVDEV=`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`
- QMakeVar set QMAKE_INCDIR_XKBCOMMON_EVDEV "$QMAKE_INCDIR_XKBCOMMON_EVDEV"
- QMakeVar set QMAKE_LIBS_XKBCOMMON_EVDEV "$QMAKE_LIBS_XKBCOMMON_EVDEV"
- fi
- if compileTest unix/xkbcommon "xkbcommon" $QMAKE_CFLAGS_XKBCOMMON_EVDEV $QMAKE_LIBS_XKBCOMMON_EVDEV; then
- CFG_XKBCOMMON_EVDEV=yes
- QT_CONFIG="$QT_CONFIG xkbcommon-evdev"
- elif [ "$CFG_XKBCOMMON_EVDEV" = "yes" ]; then
- echo "The xkbcommon-evdev functionality test failed!"
- exit 1
- else
- CFG_XKBCOMMON_EVDEV=no
- fi
-fi
-
-if [ "$CFG_LIBINPUT" != "no" ] && [ "$CFG_LIBUDEV" != "no" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libinput 2>/dev/null; then
- QMAKE_INCDIR_LIBINPUT=`$PKG_CONFIG --cflags-only-I libinput 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
- QMAKE_LIBS_LIBINPUT=`$PKG_CONFIG --libs libinput 2>/dev/null`
- QMAKE_CFLAGS_LIBINPUT=`$PKG_CONFIG --cflags libinput 2>/dev/null`
- QMAKE_LIBINPUT_VERSION_MAJOR=`$PKG_CONFIG --modversion libinput 2>/dev/null | cut -d . -f 1`
- QMAKE_LIBINPUT_VERSION_MINOR=`$PKG_CONFIG --modversion libinput 2>/dev/null | cut -d . -f 2`
- QMakeVar set QMAKE_LIBINPUT_VERSION_MAJOR "$QMAKE_LIBINPUT_VERSION_MAJOR"
- QMakeVar set QMAKE_LIBINPUT_VERSION_MINOR "$QMAKE_LIBINPUT_VERSION_MINOR"
- QMakeVar set QMAKE_INCDIR_LIBINPUT "$QMAKE_INCDIR_LIBINPUT"
- QMakeVar set QMAKE_LIBS_LIBINPUT "$QMAKE_LIBS_LIBINPUT"
- fi
- if compileTest unix/libinput "libinput" $QMAKE_CFLAGS_LIBINPUT $QMAKE_LIBS_LIBINPUT; then
- CFG_LIBINPUT=yes
- QT_CONFIG="$QT_CONFIG libinput"
- elif [ "$CFG_LIBINPUT" = "yes" ]; then
- echo "The libinput functionality test failed!"
- exit 1
- else
- CFG_LIBINPUT=no
- fi
-else
- CFG_LIBINPUT=no
-fi
-if [ "$CFG_LIBINPUT" = "no" ]; then
- QMakeVar add DEFINES QT_NO_LIBINPUT
-fi
-
-# Check we actually have X11 :-)
-if compileTest x11/xlib "XLib"; then
- QT_CONFIG="$QT_CONFIG xlib"
-fi
-
-# auto-detect Xrender support
-if [ "$CFG_XRENDER" != "no" ]; then
- if compileTest x11/xrender "Xrender"; then
- CFG_XRENDER=yes
- QT_CONFIG="$QT_CONFIG xrender"
- else
- if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "Xrender support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_XRENDER=no
- fi
- fi
-fi
-
-# auto-detect XInput2 support
-if [ "$CFG_XINPUT2" != "no" ]; then
- if compileTest x11/xinput2 "XInput2"; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xi 2>/dev/null; then
- QMAKE_LIBXI_VERSION_MAJOR=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 1`
- QMAKE_LIBXI_VERSION_MINOR=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 2`
- QMAKE_LIBXI_VERSION_PATCH=`$PKG_CONFIG --modversion xi 2>/dev/null | cut -d . -f 3`
- QMakeVar set QMAKE_LIBXI_VERSION_MAJOR "$QMAKE_LIBXI_VERSION_MAJOR"
- QMakeVar set QMAKE_LIBXI_VERSION_MINOR "$QMAKE_LIBXI_VERSION_MINOR"
- QMakeVar set QMAKE_LIBXI_VERSION_PATCH "$QMAKE_LIBXI_VERSION_PATCH"
- fi
- CFG_XINPUT2=yes
- else
- if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "XInput2 support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_XINPUT2=no
- fi
- fi
-fi
-
-if [ "$CFG_XCB" != "no" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
- QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
- QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb 2>/dev/null`"
- fi
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "x11" 2> /dev/null; then
- QMAKE_X11_PREFIX="`$PKG_CONFIG --variable=prefix x11`"
- else
- # default to LSB prefix
- QMAKE_X11_PREFIX="/usr"
- fi
- QMakeVar set QMAKE_X11_PREFIX "$QMAKE_X11_PREFIX"
-
- if [ "$CFG_XKBCOMMON" != no ] && compileTest qpa/xcb "xcb" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
- QT_CONFIG="$QT_CONFIG xcb-plugin"
-
- if [ "$CFG_XCB" = "qt" ]; then
- QT_CONFIG="$QT_CONFIG xcb-qt"
-
- if compileTest qpa/xcb-glx "xcb-glx" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
- CFG_XCB_GLX=yes
- QT_CONFIG="$QT_CONFIG xcb-glx"
- fi
- else
- CFG_XCB="system"
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
- XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape"
- QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags $XCB_PACKAGES 2>/dev/null`"
- QMAKE_LIBS_XCB="`$PKG_CONFIG --libs $XCB_PACKAGES 2>/dev/null`"
- fi
-
- # libxcb version 1.10 was the first version that enables xcb-xkb by default,
- # therefore the minimal xcb-xkb version we support is 1.10
- CFG_XKB=no
- if $PKG_CONFIG --exists "xcb-xkb >= 1.10" 2>/dev/null; then
- QMAKE_CFLAGS_XKB="`$PKG_CONFIG --cflags xcb xcb-xkb 2>/dev/null`"
- QMAKE_LIBS_XKB="`$PKG_CONFIG --libs xcb xcb-xkb 2>/dev/null`"
- if compileTest qpa/xcb-xkb "xcb-xkb" $QMAKE_CFLAGS_XKB $QMAKE_LIBS_XKB; then
- CFG_XKB=yes
- fi
- fi
- if [ "$CFG_XKB" = "no" ]; then
- QMakeVar add DEFINES QT_NO_XKB
- fi
-
- if compileTest qpa/xcb-syslibs "xcb-syslibs" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
- if compileTest qpa/xcb-render "xcb-render" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
- QT_CONFIG="$QT_CONFIG xcb-render"
- fi
-
- if compileTest qpa/xcb-glx "xcb-glx" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
- CFG_XCB_GLX=yes
- QT_CONFIG="$QT_CONFIG xcb-glx"
- fi
- else
- echo "The test for linking against libxcb and support libraries failed!"
- echo " You might need to install dependency packages, or pass -qt-xcb."
- echo " See src/plugins/platforms/xcb/README."
- exit 1
- fi
- fi
-
- if [ "$CFG_XCB_XLIB" != "no" ]; then
- if compileTest qpa/xcb-xlib "xcb-xlib" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
- QT_CONFIG="$QT_CONFIG xcb-xlib"
- CFG_XCB_XLIB=yes
- else
- CFG_XCB_XLIB=no
- fi
- fi
-
- if [ "$CFG_SM" != "no" ] && [ -n "$PKG_CONFIG" ]; then
- if $PKG_CONFIG --exists "sm" 2>/dev/null && $PKG_CONFIG --exists "ice" 2>/dev/null; then
- QT_CONFIG="$QT_CONFIG xcb-sm"
- fi
- fi
- else
- if [ "$CFG_XCB" != "auto" ]; then
- echo "The test for linking against libxcb failed!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " You might need to install dependency packages for libxcb."
- echo " See src/plugins/platforms/xcb/README."
- exit 1
- fi
- CFG_XCB=no
- fi
-fi
-
-if [ "$CFG_DIRECTFB" != "no" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists directfb 2>/dev/null; then
- QMAKE_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
- QMAKE_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
- if compileTest qpa/directfb "DirectFB" $QMAKE_CFLAGS_DIRECTFB $QMAKE_LIBS_DIRECTFB; then
- CFG_DIRECTFB=yes
- elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo " DirectFB support cannot be enabled due to functionality tests!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_DIRECTFB=no
- fi
- else
- CFG_DIRECTFB=no
- fi
-fi
-
-if [ "$CFG_GBM" != "no" ]; then
- if compileTest qpa/gbm "GBM"; then
- CFG_GBM=yes
- elif [ "$CFG_GBM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo " GBM support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_GBM=no
- fi
-fi
-
-if [ "$CFG_LINUXFB" != "no" ]; then
- if compileTest qpa/linuxfb "LinuxFB"; then
- CFG_LINUXFB=yes
- elif [ "$CFG_LINUXFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo " Linux Framebuffer support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_LINUXFB=no
- fi
-fi
-
-if [ "$CFG_KMS" != "no" ]; then
- if compileTest qpa/kms "KMS"; then
- CFG_KMS=yes
- elif [ "$CFG_KMS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo " KMS support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_KMS=no
- fi
-fi
-
-if [ "$CFG_MIRCLIENT" != "no" ]; then
- if compileTest qpa/mirclient "Mir client"; then
- CFG_MIRCLIENT=yes
- elif [ "$CFG_MIRCLIENT" = "yes" ]; then
- echo " Mir client support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_MIRCLIENT=no
- fi
-fi
-
-# Detect libxkbcommon
-MIN_REQ_XKBCOMMON="0.4.1"
-# currently only xcb platform plugin supports building xkbcommon
-if [ "$CFG_XCB" != "no" ]; then
- if [ "$CFG_XKBCOMMON" != "no" ] && [ "$CFG_XKBCOMMON" != "qt" ]; then
- # Check if there is a suitable system-wide xkbcommon
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkbcommon xkbcommon-x11 >= $MIN_REQ_XKBCOMMON" 2>/dev/null; then
- QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon xkbcommon-x11 2>/dev/null`"
- QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon xkbcommon-x11 2>/dev/null`"
-
- QMakeVar set QMAKE_CFLAGS_XKBCOMMON "$QMAKE_CFLAGS_XKBCOMMON"
- QMakeVar set QMAKE_LIBS_XKBCOMMON "$QMAKE_LIBS_XKBCOMMON"
- CFG_XKBCOMMON=system
- elif [ "$CFG_XKBCOMMON" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo " xkbcommon support cannot be enabled because either xkbcommon or "
- echo " xkbcommon-x11 >= $MIN_REQ_XKBCOMMON was not found via pkg-config!"
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- # use the bundled version instead
- CFG_XKBCOMMON=qt
- fi
- fi
- if [ "$CFG_XKBCOMMON" = "qt" ]; then
- QT_CONFIG="$QT_CONFIG xkbcommon-qt"
- # detect XKB config root
- if [ "$CFG_XKB_CONFIG_ROOT" = "auto" ]; then
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkeyboard-config" 2> /dev/null; then
- CFG_XKB_CONFIG_ROOT="`$PKG_CONFIG --variable=xkb_base xkeyboard-config`"
- else
- # search for xkb configs in most probable locations
- if [ -d "/usr/share/X11/xkb" ]; then
- # Linux
- CFG_XKB_CONFIG_ROOT="/usr/share/X11/xkb"
- elif [ -d "/usr/local/share/X11/xkb" ]; then
- # BSD UNIX
- CFG_XKB_CONFIG_ROOT="/usr/local/share/X11/xkb"
- fi
- fi
- fi
- QMakeVar set QMAKE_XKB_CONFIG_ROOT "$CFG_XKB_CONFIG_ROOT"
- if [ "$CFG_XKB_CONFIG_ROOT" = "auto" ]; then
- CFG_XKB_CONFIG_ROOT="not found"
- fi
- fi
-else
- CFG_XKBCOMMON=no
-fi
-
-# EGL Support
-if [ "$CFG_EGL" != "no" ]; then
- if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then
- echo "EGL support was requested but OpenGL support is disabled."
- echo "Either disable EGL support or enable OpenGL support."
- exit 101
- fi
-
- if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
- QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
- QMAKE_LIBS_EGL=`$PKG_CONFIG --libs egl 2>/dev/null`
- QMAKE_CFLAGS_EGL=`$PKG_CONFIG --cflags egl 2>/dev/null`
- QMakeVar set QMAKE_INCDIR_EGL "$QMAKE_INCDIR_EGL"
- QMakeVar set QMAKE_LIBS_EGL "$QMAKE_LIBS_EGL"
- QMakeVar set QMAKE_CFLAGS_EGL "`echo " $QMAKE_CFLAGS_EGL " | sed -e 's, -I[^ ]* , ,g;s,^ ,,;s, $,,'`"
- fi # detect EGL support
- if compileTest qpa/egl "EGL" $QMAKE_CFLAGS_EGL $QMAKE_LIBS_EGL; then
- CFG_EGL=yes
- if compileTest qpa/egl-x11 "EGL-X11" $QMAKE_CFLAGS_EGL $QMAKE_LIBS_EGL; then
- CFG_EGL_X=yes
- else
- CFG_EGL_X=no
- fi
- elif [ "$CFG_EGL" = "yes" ]; then
- echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
- [ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
- exit 1
- else
- CFG_EGL=no
- CFG_EGL_X=no
- fi
-fi
-
-if [ "$CFG_EGLFS" != "no" ]; then
- if [ "$XPLATFORM_QNX" = "no" ] && [ "$CFG_OPENGL" != "no" ]; then
- CFG_EGLFS="$CFG_EGL"
- # Detect eglfs backends.
- if compileTest qpa/eglfs-brcm "eglfs-brcm"; then
- CFG_EGLFS_BRCM=yes
- else
- CFG_EGLFS_BRCM=no
- fi
- if compileTest qpa/eglfs-egldevice "eglfs-egldevice"; then
- CFG_EGLFS_EGLDEVICE=yes
- else
- CFG_EGLFS_EGLDEVICE=no
- fi
- if compileTest qpa/eglfs-mali "eglfs-mali" \
- || compileTest qpa/eglfs-mali-2 "eglfs-mali-2"; then
- CFG_EGLFS_MALI=yes
- else
- CFG_EGLFS_MALI=no
- fi
- if compileTest qpa/eglfs-viv "eglfs-viv"; then
- CFG_EGLFS_VIV=yes
- else
- CFG_EGLFS_VIV=no
- fi
- if [ "$CFG_EGLFS_VIV" = "yes" ] && compileTest qpa/wayland-server "wayland-server"; then
- CFG_EGLFS_VIV_WL=yes
- else
- CFG_EGLFS_VIV_WL=no
- fi
- else
- CFG_EGLFS="no"
- fi
-fi
-
-# Detect accessibility support
-if [ "$CFG_ACCESSIBILITY" = "no" ]; then
- echo >&2 "Warning: Disabling Accessibility. This version of Qt is unsupported."
-else
- CFG_ACCESSIBILITY=yes
-
- # linux/xcb accessibility bridge needs dbus
- if [ "$CFG_XCB" != "no" ]; then
- if [ "$CFG_DBUS" != "no" ]; then
- CFG_ACCESSIBILITY_ATSPI_BRIDGE=yes
- QT_CONFIG="$QT_CONFIG accessibility-atspi-bridge"
- else
- echo >&2 "Warning: Disabling Linux Accessibility Bridge: DBus is missing."
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY_ATSPI_BRIDGE"
- fi
- fi
-fi
-
-# Determine the default QPA platform
-if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
- # check the mkspec
- QT_QPA_DEFAULT_PLATFORM=`getXQMakeConf QT_QPA_DEFAULT_PLATFORM`
- if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
- if [ "$XPLATFORM_MINGW" = "yes" ]; then
- QT_QPA_DEFAULT_PLATFORM="windows"
- elif [ "$XPLATFORM_MAC" = "yes" ]; then
- QT_QPA_DEFAULT_PLATFORM="cocoa"
- elif [ "$UNAME_SYSTEM" = "QNX" ]; then
- QT_QPA_DEFAULT_PLATFORM="qnx"
- elif [ "$XPLATFORM_INTEGRITY" = "yes" ]; then
- QT_QPA_DEFAULT_PLATFORM="integrityfb"
- else
- QT_QPA_DEFAULT_PLATFORM="xcb"
- fi
- fi
-fi
-
-if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
- QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
- QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
-fi
-
-if [ "$CFG_DIRECTFB" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG directfb"
- QMakeVar set QMAKE_CFLAGS_DIRECTFB "$QMAKE_CFLAGS_DIRECTFB"
- QMakeVar set QMAKE_LIBS_DIRECTFB "$QMAKE_LIBS_DIRECTFB"
-fi
-if [ "$CFG_GBM" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG gbm"
-fi
-if [ "$CFG_LINUXFB" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG linuxfb"
-fi
-if [ "$CFG_INTEGRITYFB" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG integrityfb"
-fi
-if [ "$CFG_KMS" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG kms"
-fi
-if [ "$CFG_MIRCLIENT" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG mirclient"
-fi
-
-if [ "$XPLATFORM_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ] && [ "$XPLATFORM_HAIKU" = "no" ] && [ "$XPLATFORM_INTEGRITY" = "no" ]; then
- if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_MIRCLIENT" = "no" ]; then
- if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
- ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_MIRCLIENT" = "auto" ] ); then
- echo "No QPA platform plugin enabled!"
- echo " If you really want to build without a QPA platform plugin you must pass"
- echo " -no-qpa-platform-guard to configure. Doing this will"
- echo " produce a Qt that can not run GUI applications."
- echo " The dependencies needed for xcb to build are listed in"
- echo " src/plugins/platforms/xcb/README"
- exit 1
- fi
-fi
- fi
-
-# double-conversion support
-if [ "$CFG_DOUBLECONVERSION" = "no" ]; then
- if ! compileTest common/xlocalescanprint "XLocaleScanPrint"; then
- echo "Your C library does not provide sscanf_l or snprintf_l."
- echo "You need to use libdouble-conversion for double/string conversion."
- exit 1
- fi
-elif [ "$CFG_DOUBLECONVERSION" != "qt" ]; then
- if compileTest unix/doubleconversion "DoubleConversion"; then
- CFG_DOUBLECONVERSION=system
- elif [ "$CFG_DOUBLECONVERSION" = "system" ]; then
- echo "No system libdouble-conversion found."
- exit 1
- else
- CFG_DOUBLECONVERSION=qt
- fi
-fi
-
-# freetype support
-[ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_FREETYPE" = "auto" ] && CFG_FREETYPE=no
-if [ "$CFG_FREETYPE" = "auto" ]; then
- if compileTest unix/freetype "FreeType"; then
- CFG_FREETYPE=system
- else
- CFG_FREETYPE=yes
- fi
-fi
-
-# harfbuzz support
-[ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_HARFBUZZ" = "auto" ] && CFG_HARFBUZZ=qt
-if [ "$CFG_HARFBUZZ" = "auto" ] || [ "$CFG_HARFBUZZ" = "system" ]; then
- if compileTest unix/harfbuzz "HarfBuzz"; then
- CFG_HARFBUZZ=system
- else
- if [ "$CFG_HARFBUZZ" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo " HarfBuzz system library support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_HARFBUZZ=qt
- fi
- fi
-fi
-if [ "$XPLATFORM_MAC" = "yes" -a "$CFG_HARFBUZZ" != "qt" ]; then
- echo
- echo "WARNING: On OS X, AAT is supported only with -qt-harfbuzz."
- echo
-fi
-
-if ! compileTest unix/stl "STL" &&
- [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "STL functionality check failed! Cannot build Qt with this STL library."
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- exit 101
-fi
-
-
-# detect POSIX clock_gettime()
-if [ "$CFG_CLOCK_GETTIME" = "auto" ]; then
- if compileTest unix/clock-gettime "POSIX clock_gettime()"; then
- CFG_CLOCK_GETTIME=yes
- else
- CFG_CLOCK_GETTIME=no
- fi
-fi
-
-# detect POSIX monotonic clocks
-if [ "$CFG_CLOCK_GETTIME" = "yes" ] && [ "$CFG_CLOCK_MONOTONIC" = "auto" ]; then
- if compileTest unix/clock-monotonic "POSIX Monotonic Clock"; then
- CFG_CLOCK_MONOTONIC=yes
- else
- CFG_CLOCK_MONOTONIC=no
- fi
-elif [ "$CFG_CLOCK_GETTIME" = "no" ]; then
- CFG_CLOCK_MONOTONIC=no
-fi
-
-# detect posix_fallocate
-if [ "$CFG_POSIX_FALLOCATE" = "auto" ]; then
- if compileTest unix/posix_fallocate "posix_fallocate"; then
- CFG_POSIX_FALLOCATE=yes
- else
- CFG_POSIX_FALLOCATE=no
- fi
-fi
-
-# detect mremap
-if [ "$CFG_MREMAP" = "auto" ]; then
- if compileTest unix/mremap "mremap"; then
- CFG_MREMAP=yes
- else
- CFG_MREMAP=no
- fi
-fi
-
-# find if the platform provides getaddrinfo (ipv6 dns lookups)
-if [ "$CFG_GETADDRINFO" != "no" ]; then
- if compileTest unix/getaddrinfo "getaddrinfo"; then
- CFG_GETADDRINFO=yes
- else
- if [ "$CFG_GETADDRINFO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "getaddrinfo support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_GETADDRINFO=no
- fi
- fi
-fi
-
-# find if the platform provides inotify
-if [ "$CFG_INOTIFY" != "no" ]; then
- if compileTest unix/inotify "inotify"; then
- CFG_INOTIFY=yes
- else
- if [ "$CFG_INOTIFY" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "inotify support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_INOTIFY=no
- fi
- fi
-fi
-
-# find if the platform provides eventfd
-if [ "$CFG_EVENTFD" != "no" ]; then
- if compileTest unix/eventfd "eventfd"; then
- CFG_EVENTFD=yes
- else
- if [ "$CFG_EVENTFD" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "eventfd support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_EVENTFD=no
- fi
- fi
-fi
-
-# find if the platform provides if_nametoindex (ipv6 interface name support)
-if [ "$CFG_IPV6IFNAME" != "no" ]; then
- if compileTest unix/ipv6ifname "IPv6 interface name"; then
- CFG_IPV6IFNAME=yes
- else
- if [ "$CFG_IPV6IFNAME" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "IPv6 interface name support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_IPV6IFNAME=no
- fi
- fi
-fi
-
-# find if the platform provides getifaddrs (network interface enumeration)
-if [ "$CFG_GETIFADDRS" != "no" ]; then
- if compileTest unix/getifaddrs "getifaddrs"; then
- CFG_GETIFADDRS=yes
- else
- if [ "$CFG_GETIFADDRS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "getifaddrs support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_GETIFADDRS=no
- fi
- fi
-fi
-
-# find if the platform provides thread-safe CLOEXEC support
-if compileTest unix/cloexec "cloexec"; then
- CFG_CLOEXEC=yes
-fi
-
-if compileTest unix/ppoll "ppoll"; then
- CFG_POLL="ppoll"
-elif compileTest unix/pollts "pollts"; then
- CFG_POLL="pollts"
-elif compileTest unix/poll "poll"; then
- CFG_POLL="poll"
-else
- CFG_POLL="select"
-fi
-
-if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_SECURETRANSPORT" != "no" ] && ([ "$CFG_OPENSSL" = "no" ] || [ "$CFG_OPENSSL" = "auto" ]); then
- CFG_SECURETRANSPORT=yes
- CFG_OPENSSL=no
-else
- CFG_SECURETRANSPORT=no
-fi
-
-# detect OpenSSL
-if [ "$CFG_OPENSSL" != "no" ]; then
- if compileTest unix/openssl "OpenSSL"; then
- if [ "$CFG_OPENSSL" = "auto" ]; then
- CFG_OPENSSL=yes
- fi
- else
- if ( [ "$CFG_OPENSSL" = "yes" ] || [ "$CFG_OPENSSL" = "linked" ] ) && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "OpenSSL support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_OPENSSL=no
- fi
- fi
-fi
-
-
-# detect PCRE
-if [ "$CFG_PCRE" != "qt" ]; then
- if compileTest unix/pcre "PCRE"; then
- CFG_PCRE=system
- else
- if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "PCRE support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_PCRE=qt
- fi
- fi
-fi
-
-# detect OpenVG support
-if [ "$CFG_OPENVG" != "no" ]; then
- if compileTest unix/openvg "OpenVG"; then
- if [ "$CFG_OPENVG" = "auto" ]; then
- CFG_OPENVG=yes
- fi
- elif compileTest unix/openvg "OpenVG" -config openvg_on_opengl; then
- if [ "$CFG_OPENVG" = "auto" ]; then
- CFG_OPENVG=yes
- fi
- CFG_OPENVG_ON_OPENGL=yes
- elif compileTest unix/openvg "OpenVG (lc includes)" -config lower_case_includes; then
- if [ "$CFG_OPENVG" = "auto" ]; then
- CFG_OPENVG=yes
- fi
- CFG_OPENVG_LC_INCLUDES=yes
- elif compileTest unix/openvg "OpenVG (lc includes)" -config "openvg_on_opengl lower_case_includes"; then
- if [ "$CFG_OPENVG" = "auto" ]; then
- CFG_OPENVG=yes
- fi
- CFG_OPENVG_LC_INCLUDES=yes
- CFG_OPENVG_ON_OPENGL=yes
- else
- if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "$CFG_OPENVG was specified for OpenVG but cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_OPENVG=no
- fi
- fi
- if [ "$CFG_OPENVG" = "yes" ] && compileTest unix/shivavg "ShivaVG"; then
- CFG_OPENVG_SHIVA=yes
- fi
-fi
-
-if [ "$CFG_ALSA" = "auto" ]; then
- if compileTest unix/alsa "alsa"; then
- CFG_ALSA=yes
- else
- CFG_ALSA=no
- fi
-fi
-
-if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
- CFG_AUDIO_BACKEND=yes
-fi
-
-# detect GStreamer support
-if [ "$CFG_GSTREAMER" = "auto" ] || [ "$CFG_GSTREAMER" = "yes" ]; then
- if compileTest unix/gstreamer "GStreamer 1.0" -config gst-1.0; then
- CFG_GSTREAMER=yes
- CFG_GSTREAMER_VERSION=1.0
- elif compileTest unix/gstreamer "GStreamer 0.10" -config gst-0.10; then
- CFG_GSTREAMER=yes
- CFG_GSTREAMER_VERSION=0.10
- else
- if [ "$CFG_GSTREAMER" = "yes" ]; then
- echo "GStreamer support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- exit 1
- fi
- CFG_GSTREAMER=no
- fi
-elif [ "$CFG_GSTREAMER" = "0.10" ]; then
- if compileTest unix/gstreamer "GStreamer 0.10" -config gst-0.10; then
- CFG_GSTREAMER=yes
- CFG_GSTREAMER_VERSION=0.10
- else
- echo "The GStreamer 0.10 functionality test failed!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- exit 1
- fi
-elif [ "$CFG_GSTREAMER" = "1.0" ]; then
- if compileTest unix/gstreamer "GStreamer 1.0" -config gst-1.0; then
- CFG_GSTREAMER=yes
- CFG_GSTREAMER_VERSION=1.0
- else
- echo "The GStreamer 1.0 functionality test failed!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- exit 1
- fi
-fi
-
-if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
- echo "Warning: largefile support cannot be disabled for win32."
- CFG_LARGEFILE="yes"
-fi
-
-# Detect DirectWrite 2 support on Windows
-if [ "$CFG_DIRECTWRITE" = "no" ]; then
- CFG_DIRECTWRITE2=no
-fi
-if [ "$CFG_DIRECTWRITE2" = "auto" ]; then
- if compileTest win/directwrite2 "directwrite2"; then
- CFG_DIRECTWRITE2=yes
- else
- CFG_DIRECTWRITE2=no
- fi
-fi
-
-#-------------------------------------------------------------------------------
-# ask for all that hasn't been auto-detected or specified in the arguments
-#-------------------------------------------------------------------------------
-
-# Set "c++11" unconditionally, as lots of code does contains(QT_CONFIG, c++11)
-QT_CONFIG="$QT_CONFIG c++11"
-if [ "$CFG_STDCXX" != "c++11" ]; then
- QT_CONFIG="$QT_CONFIG c++14"
- if [ "$CFG_STDCXX" != "c++14" ]; then
- QT_CONFIG="$QT_CONFIG c++1z"
- fi
-fi
-
-if [ "$CFG_ATOMIC64" = "libatomic" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG atomic64-libatomic"
-fi
-
-if [ "$CFG_SILENT" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG silent"
-fi
-
-# disable accessibility
-if [ "$CFG_ACCESSIBILITY" = "no" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
-else
- QT_CONFIG="$QT_CONFIG accessibility"
-fi
-
-# enable egl
-if [ "$CFG_EGL" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG egl"
-else
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
-fi
-
-# enable egl on X
-if [ "$CFG_EGL_X" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG egl_x11"
-else
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL_X11"
-fi
-
-# enable eglfs
-if [ "$CFG_EGLFS" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eglfs"
-else
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGLFS"
-fi
-# eglfs backends
-if [ "$CFG_EGLFS_BRCM" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eglfs_brcm"
-fi
-if [ "$CFG_EGLFS_EGLDEVICE" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eglfs_egldevice"
-fi
-if [ "$CFG_EGLFS" = "yes" ] && [ "$CFG_KMS" = "yes" ] && [ "$CFG_GBM" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eglfs_gbm"
- CFG_EGLFS_GBM="yes"
-else
- CFG_EGLFS_GBM="no"
-fi
-if [ "$CFG_EGLFS_MALI" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eglfs_mali"
-fi
-if [ "$CFG_EGLFS_VIV" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eglfs_viv"
- if [ "$CFG_EGLFS_VIV_WL" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eglfs_viv_wl"
- fi
-fi
+# copy some variables that are still being computed in the shell script into an input file for configure
+# This should go away in the future
-# enable openvg
-if [ "$CFG_OPENVG" = "no" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
-else
- QT_CONFIG="$QT_CONFIG openvg"
- if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
- fi
- if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG openvg_on_opengl"
- fi
- if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG shivavg"
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
- fi
-fi
-
-# enable opengl
-if [ "$CFG_OPENGL" = "no" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENGL"
-else
- QT_CONFIG="$QT_CONFIG opengl"
-fi
-
-if [ "$CFG_OPENGL" = "es2" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES QT_OPENGL_ES_2"
- QT_CONFIG="$QT_CONFIG opengles2"
-fi
-
-if [ "$CFG_SHARED" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG shared"
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG shared"
-elif [ "$CFG_SHARED" = "no" ]; then
- QT_CONFIG="$QT_CONFIG static"
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG static"
-fi
-
-#FIXME: qpa is implicit this should all be removed
-QMAKE_CONFIG="$QMAKE_CONFIG qpa"
-QT_CONFIG="$QT_CONFIG qpa"
-QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
-
-if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG largefile"
-fi
-if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG GNUmake"
-fi
-[ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
-[ "$CFG_STACK_PROTECTOR_STRONG" = "yes" ] && QT_CONFIG="$QT_CONFIG stack-protector-strong"
-[ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
-[ "$CFG_STRIP" = "no" ] && QMAKE_CONFIG="$QMAKE_CONFIG nostrip"
-if testXConfig precompile_header; then
- [ "$CFG_PRECOMPILE" = "no" ] && QMakeVar del CONFIG precompile_header
-else
- [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
-fi
-[ "$CFG_USE_GOLD_LINKER" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG use_gold_linker"
-[ "$CFG_ENABLE_NEW_DTAGS" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG enable_new_dtags"
-if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG separate_debug_info"
-fi
-[ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
-[ "$CFG_SSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse3"
-[ "$CFG_SSSE3" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG ssse3"
-[ "$CFG_SSE4_1" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_1"
-[ "$CFG_SSE4_2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse4_2"
-[ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
-[ "$CFG_AVX2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx2"
-for feature in $CFG_AVX512; do
- QMAKE_CONFIG="$QMAKE_CONFIG avx512$feature"
-done
-[ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
-if [ "$CFG_ARCH" = "mips" ]; then
- [ "$CFG_MIPS_DSP" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dsp"
- [ "$CFG_MIPS_DSPR2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dspr2"
-fi
-if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG clock-gettime"
-fi
-if [ "$CFG_CLOCK_MONOTONIC" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG clock-monotonic"
-fi
-if [ "$CFG_POSIX_FALLOCATE" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG posix_fallocate"
-fi
-if [ "$CFG_MREMAP" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG mremap"
-fi
-if [ "$CFG_GETADDRINFO" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG getaddrinfo"
-fi
-if [ "$CFG_IPV6IFNAME" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG ipv6ifname"
-fi
-if [ "$CFG_GETIFADDRS" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG getifaddrs"
-fi
-if [ "$CFG_INOTIFY" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG inotify"
-fi
-if [ "$CFG_EVENTFD" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG eventfd"
-fi
-if [ "$CFG_CLOEXEC" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG threadsafe-cloexec"
-fi
-if [ "$CFG_POLL" = "select" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NATIVE_POLL"
-fi
-QT_CONFIG="$QT_CONFIG poll_$CFG_POLL"
-if [ "$CFG_LIBJPEG" = "no" ]; then
- CFG_JPEG="no"
-elif [ "$CFG_LIBJPEG" = "system" ]; then
- QT_CONFIG="$QT_CONFIG system-jpeg"
-fi
-if [ "$CFG_JPEG" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-jpeg"
-elif [ "$CFG_JPEG" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG jpeg"
-fi
-if [ "$CFG_LIBPNG" = "no" ]; then
- CFG_PNG="no"
-fi
-if [ "$CFG_LIBPNG" = "system" ]; then
- QT_CONFIG="$QT_CONFIG system-png"
-fi
-if [ "$CFG_PNG" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-png"
-elif [ "$CFG_PNG" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG png"
-fi
-if [ "$CFG_GIF" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-gif"
-elif [ "$CFG_GIF" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG gif"
-fi
-if [ "$CFG_DOUBLECONVERSION" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-doubleconversion"
-elif [ "$CFG_DOUBLECONVERSION" = "system" ]; then
- QT_CONFIG="$QT_CONFIG system-doubleconversion"
-else
- QT_CONFIG="$QT_CONFIG doubleconversion"
-fi
-if [ "$CFG_FREETYPE" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-freetype"
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FREETYPE"
-elif [ "$CFG_FREETYPE" = "system" ]; then
- QT_CONFIG="$QT_CONFIG system-freetype"
-else
- QT_CONFIG="$QT_CONFIG freetype"
-fi
-if [ "$CFG_HARFBUZZ" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-harfbuzz"
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_HARFBUZZ"
-elif [ "$CFG_HARFBUZZ" = "system" ]; then
- QT_CONFIG="$QT_CONFIG system-harfbuzz"
-else
- QT_CONFIG="$QT_CONFIG harfbuzz"
-fi
-if [ "$CFG_GUI" = "auto" ]; then
- CFG_GUI="yes"
-fi
-if [ "$CFG_GUI" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-gui"
- CFG_WIDGETS="no"
-fi
-if [ "$CFG_WIDGETS" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-widgets"
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS"
-fi
-
-if [ "$XPLATFORM_MAC" = "yes" ]; then
- #On Mac we implicitly link against libz, so we
- #never use the 3rdparty stuff.
- [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
-fi
-if [ "$CFG_ZLIB" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG zlib"
-elif [ "$CFG_ZLIB" = "system" ]; then
- QT_CONFIG="$QT_CONFIG system-zlib"
-fi
-
-[ "$CFG_MTDEV" = "yes" ] && QT_CONFIG="$QT_CONFIG mtdev"
-[ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
-[ "$CFG_ICONV" = "yes" ] && QT_CONFIG="$QT_CONFIG iconv"
-[ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
-[ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
-[ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
-[ "$CFG_DBUS" != "no" ] && QT_CONFIG="$QT_CONFIG dbus"
-[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus-linked"
-[ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
-[ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
-[ "$CFG_SECURETRANSPORT" = "yes" ] && QT_CONFIG="$QT_CONFIG ssl securetransport"
-[ "$CFG_LIBPROXY" = "yes" ] && QT_CONFIG="$QT_CONFIG libproxy"
-[ "$CFG_XCB" != "no" ] && QT_CONFIG="$QT_CONFIG xcb"
-[ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
-[ "$CFG_SYSTEM_PROXIES" = "yes" ] && QT_CONFIG="$QT_CONFIG system-proxies"
-[ "$CFG_DIRECTWRITE" = "yes" ] && QT_CONFIG="$QT_CONFIG directwrite"
-[ "$CFG_DIRECTWRITE2" = "yes" ] && QT_CONFIG="$QT_CONFIG directwrite2"
-
-[ '!' -z "$DEFINES" ] && QMakeVar add EXTRA_DEFINES "$DEFINES"
-[ '!' -z "$INCLUDES" ] && QMakeVar add EXTRA_INCLUDEPATH "$INCLUDES"
-[ '!' -z "$L_FLAGS" ] && QMakeVar add EXTRA_LIBS "$L_FLAGS"
-
-if [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
- if [ -n "$RPATH_FLAGS" ]; then
- echo
- echo "ERROR: -R cannot be used on this platform as \$QMAKE_LFLAGS_RPATH is"
- echo " undefined."
- echo
- exit 1
- elif [ "$CFG_RPATH" = "yes" ]; then
- RPATH_MESSAGE=" NOTE: This platform does not support runtime library paths, using -no-rpath."
- CFG_RPATH=no
- fi
-else
- if [ -n "$RPATH_FLAGS" ]; then
- # add the user defined rpaths
- QMakeVar add EXTRA_RPATHS "$RPATH_FLAGS"
- fi
-fi
-if [ "$CFG_RPATH" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG rpath"
-fi
-
-if [ '!' -z "$W_FLAGS" ]; then
- # add the user defined warning flags
- QMakeVar add QMAKE_CFLAGS_WARN_ON "$W_FLAGS"
- QMakeVar add QMAKE_CXXFLAGS_WARN_ON "$W_FLAGS"
-fi
-
-if [ "$XPLATFORM_MINGW" = "yes" ]; then
- # mkspecs/features/win32/default_pre.prf sets "no-rtti".
- # Follow default behavior of configure.exe by overriding with "rtti".
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
-fi
-
-if [ "$CFG_ALSA" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG alsa"
-fi
-
-if [ "$CFG_PULSEAUDIO" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG pulseaudio"
-fi
-
-[ "$CFG_GSTREAMER_VERSION" = "0.10" ] && QT_CONFIG="$QT_CONFIG gstreamer-0.10"
-[ "$CFG_GSTREAMER_VERSION" = "1.0" ] && QT_CONFIG="$QT_CONFIG gstreamer-1.0"
-
-if [ "$CFG_COREWLAN" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG corewlan"
-fi
-
-if [ "$CFG_ICU" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG icu"
-fi
-
-if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG force_asserts"
-fi
-
-if [ "$CFG_LTCG" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG ltcg"
-fi
-
-if [ "$CFG_SANITIZERS" != "none" ]; then
-
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitizer"
-
- if [ "$CFG_SANITIZE_ADDRESS" = "yes" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_address"
- fi
-
- if [ "$CFG_SANITIZE_THREAD" = "yes" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_thread"
- fi
-
- if [ "$CFG_SANITIZE_MEMORY" = "yes" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_memory"
- fi
-
- if [ "$CFG_SANITIZE_UNDEFINED" = "yes" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG sanitize_undefined"
- fi
-fi
-
-if [ "$CFG_PCRE" = "qt" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG pcre"
-fi
-
-#
-# Some Qt modules are too advanced in C++ for some old compilers
-# Detect here the platforms where they are known to work.
-#
-# See Qt documentation for more information on which features are
-# supported and on which compilers.
-#
-canBuildQtConcurrent="yes"
-
-case "$XPLATFORM" in
- hpux-g++*)
- # PA-RISC's assembly is too limited
- # gcc 3.4 on that platform can't build QtXmlPatterns
- # the assembly it generates cannot be compiled
-
- # Check gcc's version
- case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
- 4*)
- ;;
- 3.4*)
- canBuildQtXmlPatterns="no"
- ;;
- *)
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- ;;
- esac
- ;;
- unsupported/vxworks-*-g++*)
- canBuildWebKit="no"
- ;;
- unsupported/vxworks-*-dcc*)
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- ;;
- *-g++*)
- # Check gcc's version
- case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
- 4*|3.4*)
- ;;
- 3.3*)
- canBuildWebKit="no"
- ;;
- *)
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- ;;
- esac
- ;;
- solaris-cc*)
- # Check the compiler version
- case `${QMAKE_CONF_COMPILER} -V 2>&1 | $AWK '{print $4}'` in
- 5.[012345678])
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- canBuildQtConcurrent="no"
- ;;
- 5.*)
- canBuildWebKit="no"
- canBuildQtConcurrent="no"
- ;;
- esac
- ;;
- hpux-acc*)
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- canBuildQtConcurrent="no"
- ;;
- hpuxi-acc*)
- canBuildWebKit="no"
- ;;
- aix-xlc*)
- # Get the xlC version
- cat > xlcver.c <<EOF
-#include <stdio.h>
-int main()
-{
- printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
- return 0;
-}
+cat > "$outpath/config.tests/configure.cfg" <<EOF
+# Feature defaults set by configure command line
+config.input.qt_edition = $Edition
+config.input.qt_licheck = $Licheck
+config.input.qt_release_date = $ReleaseDate
EOF
- xlcver=
- if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
- xlcver=`./xlcver 2>/dev/null`
- rm -f ./xlcver
- fi
- if [ "$OPT_VERBOSE" = "yes" ]; then
- if [ -n "$xlcver" ]; then
- echo Found IBM xlC version: $xlcver.
- else
- echo Could not determine IBM xlC version, assuming oldest supported.
- fi
- fi
-
- case "$xlcver" in
- [123456].*)
- canBuildWebKit="no"
- canBuildQtXmlPatterns="no"
- canBuildQtConcurrent="no"
- ;;
- *)
- canBuildWebKit="no"
- canBuildQtConcurrent="no"
- ;;
- esac
- ;;
- irix-cc*)
- canBuildWebKit="no"
- canBuildQtConcurrent="no"
- ;;
-esac
-
-if [ "$CFG_GUI" = "no" ]; then
- # WebKit requires Qt GUI
- canBuildWebKit="no"
-fi
-
-if [ "$CFG_SHARED" = "no" ]; then
- echo
- echo "WARNING: Using static linking will disable the WebKit module."
- echo
- canBuildWebKit="no"
-fi
-
-CFG_CONCURRENT="yes"
-if [ "$canBuildQtConcurrent" = "no" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
- CFG_CONCURRENT="no"
-else
- QT_CONFIG="$QT_CONFIG concurrent"
-fi
-
-# ### Vestige
-if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG audio-backend"
-fi
-
-# ### Vestige
-if [ "$CFG_WEBKIT" = "debug" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
-fi
-# ### Vestige
-if [ "$CFG_QML_DEBUG" = "no" ]; then
- QT_CONFIG="$QT_CONFIG no-qml-debug"
-fi
-
-case "$QMAKE_CONF_COMPILER" in
-*clang*)
- # Clang
- COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -v 2>&1 | sed -n -E '
-/^Apple (clang|LLVM) version /{s///; s/^([0-9]*)\.([0-9]*).*$/QT_APPLE_CLANG_MAJOR_VERSION=\1; QT_APPLE_CLANG_MINOR_VERSION=\2/;p;q;}
-/^(FreeBSD )?clang version /{s///; s/^([0-9]*)\.([0-9]*).*$/QT_CLANG_MAJOR_VERSION=\1; QT_CLANG_MINOR_VERSION=\2/;p;q;}'`
- eval "$COMPILER_VERSION"
- ;;
-*icpc)
- # Intel CC
- COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -v 2>&1 | sed -n '
-s/icpc version \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\) .*$/QT_ICC_MAJOR_VERSION=\1; QT_ICC_MINOR_VERSION=\2; QT_ICC_PATCH_VERSION=\3/p'`
- eval "$COMPILER_VERSION"
- ;;
-*g++*)
- # GNU C++
- COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
-
- case "$COMPILER_VERSION" in
- *.*.*)
- QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\1,'`
- QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\2,'`
- QT_GCC_PATCH_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*,\3,'`
- ;;
- *.*)
- QT_GCC_MAJOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\1,'`
- QT_GCC_MINOR_VERSION=`echo $COMPILER_VERSION | sed 's,^\([0-9]*\)\.\([0-9]*\).*,\2,'`
- QT_GCC_PATCH_VERSION=0
- ;;
- *)
- QT_GCC_MAJOR_VERSION=$COMPILER_VERSION
- QT_GCC_MINOR_VERSION=0
- QT_GCC_PATCH_VERSION=0
- esac
-
- ;;
-*)
- #
- ;;
-esac
-
-echo "Done running configuration tests."
-
-# Save stdout in fd 3
-exec 3>&1
-
-#-------------------------------------------------------------------------------
-# part of configuration information goes into qconfig.h
-#-------------------------------------------------------------------------------
-
-# Open qconfig.h.new
-exec > "$outpath/src/corelib/global/qconfig.h.new"
-
-# start with Qt's version number
-cat <<EOF
-#define QT_VERSION_MAJOR $QT_MAJOR_VERSION
-#define QT_VERSION_MINOR $QT_MINOR_VERSION
-#define QT_VERSION_PATCH $QT_PATCH_VERSION
-#define QT_VERSION_STR "$QT_VERSION"
-
-EOF
-
-case "$CFG_QCONFIG" in
-full)
- echo "/* Everything */"
- ;;
-*)
- echo "#ifndef QT_BOOTSTRAPPED"
- cat "$CFG_QCONFIG_PATH"
- echo "#endif"
- ;;
-esac
-
-echo '/* Compile time features */'
-[ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\""
-
-if [ "$CFG_SHARED" = "no" ]; then
- cat <<EOF
-/* Qt was configured for a static build */
-#if !defined(QT_SHARED) && !defined(QT_STATIC)
-# define QT_STATIC
-#endif
-
-EOF
-fi
-
-if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
- echo "#define QT_LARGEFILE_SUPPORT 64"
-fi
-
-if [ "$CFG_QREAL" != double ]; then
- echo "#define QT_COORD_TYPE $CFG_QREAL"
- echo "#define QT_COORD_TYPE_STRING $CFG_QREAL_STRING"
-fi
-
-if [ "$CFG_FRAMEWORK" = "yes" ]; then
- echo "#define QT_MAC_FRAMEWORK_BUILD"
-fi
-
-if [ "$CFG_ATOMIC64" = "no" ]; then
- echo "#define QT_NO_STD_ATOMIC64"
-fi
-
-#REDUCE_RELOCATIONS is a elf/unix only thing, so not in windows configure.exe
-if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
- echo "#define QT_REDUCE_RELOCATIONS"
-fi
-
-# Add compiler sub-architecture support
-echo ""
-echo "// Compiler sub-arch support"
-for SUBARCH in SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2 \
- MIPS_DSP MIPS_DSPR2; do
- eval "VAL=\$CFG_$SUBARCH"
- case "$VAL" in
- yes)
- echo "#define QT_COMPILER_SUPPORTS_$SUBARCH 1" \
-
- ;;
- esac
-done
-for feature in $CFG_AVX512_UPPER; do
- echo "#define QT_COMPILER_SUPPORTS_$feature 1"
-done
-
-echo ""
-
-if [ "$CFG_DEV" = "yes" ]; then
- echo "#define QT_BUILD_INTERNAL"
-fi
-
-# Add QPA to config.h
-QCONFIG_FLAGS="$QCONFIG_FLAGS"
-
-# Add turned on SQL drivers
-for DRIVER in $CFG_SQL_AVAILABLE; do
- eval "VAL=\$CFG_SQL_$DRIVER"
- case "$VAL" in
- qt)
- ONDRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SQL_$ONDRIVER"
- SQL_DRIVERS="$SQL_DRIVERS $DRIVER"
- ;;
- plugin)
- SQL_PLUGINS="$SQL_PLUGINS $DRIVER"
- ;;
- esac
+# recreate command line for qmake
+set -f
+SAVED_IFS=$IFS
+IFS='
+'
+for i in $QMAKE_CMDLINE; do
+ set -- "$@" "$i"
done
-
-QMakeVar set sql-drivers "$SQL_DRIVERS"
-QMakeVar set sql-plugins "$SQL_PLUGINS"
-
-# Add other configuration options to the qconfig.h file
-[ "$CFG_GIF" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_BUILTIN_GIF_READER=1"
-[ "$CFG_PNG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
-[ "$CFG_JPEG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
-[ "$CFG_ZLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
-[ "$CFG_DBUS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
-[ "$CFG_LIBPROXY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_LIBPROXY"
-
-# X11/Unix/Mac only configs
-[ "$CFG_CUPS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
-[ "$CFG_ICONV" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
-[ "$CFG_EVDEV" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EVDEV"
-[ "$CFG_GLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
-[ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
-[ "$CFG_POSIX_FALLOCATE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_POSIX_FALLOCATE"
-[ "$CFG_MREMAP" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
-[ "$CFG_GETADDRINFO" = "no" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETADDRINFO"
-[ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
-[ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
-[ "$CFG_INOTIFY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
-[ "$CFG_EVENTFD" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EVENTFD"
-[ "$CFG_CLOEXEC" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_THREADSAFE_CLOEXEC=1"
-[ "$CFG_OPENSSL" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL"
-[ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
-[ "$CFG_OPENSSL" = "no" ] && [ "$CFG_SECURETRANSPORT" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SSL"
-[ "$CFG_SECURETRANSPORT" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SECURETRANSPORT"
-
-[ "$CFG_SM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SESSIONMANAGER"
-[ "$CFG_TSLIB" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_TSLIB"
-[ "$CFG_XCURSOR" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XCURSOR"
-[ "$CFG_XFIXES" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XFIXES"
-[ "$CFG_FONTCONFIG" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_FONTCONFIG"
-[ "$CFG_XKB" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XKB"
-[ "$CFG_XRANDR" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRANDR"
-[ "$CFG_XRENDER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER"
-[ "$CFG_MITSHM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
-[ "$CFG_XSHAPE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
-[ "$CFG_XSYNC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
-
-[ "$CFG_XCURSOR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XCURSOR"
-[ "$CFG_XFIXES" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XFIXES"
-[ "$CFG_XRANDR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
-[ "$CFG_ALSA" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
-[ "$CFG_PULSEAUDIO" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_PULSEAUDIO"
-[ "$CFG_COREWLAN" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN"
-
-# sort QCONFIG_FLAGS for neatness if we can
-[ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq`
-QCONFIG_FLAGS=`echo $QCONFIG_FLAGS`
-
-if [ -n "$QCONFIG_FLAGS" ]; then
-cat << EOF
-#ifndef QT_BOOTSTRAPPED
-
-EOF
- for cfg in $QCONFIG_FLAGS; do
- cfgd=`echo $cfg | sed 's/=.*$//'` # trim pushed 'Foo=Bar' defines
- cfg=`echo $cfg | sed 's/=/ /'` # turn first '=' into a space
- # figure out define logic, so we can output the correct
- # ifdefs to override the global defines in a project
- cfgdNeg=
- if [ true ] && echo "$cfgd" | grep 'QT_NO_' >/dev/null 2>&1; then
- # QT_NO_option can be forcefully turned on by QT_option
- cfgdNeg=`echo $cfgd | sed 's,QT_NO_,QT_,'`
- elif [ true ] && echo "$cfgd" | grep 'QT_' >/dev/null 2>&1; then
- # QT_option can be forcefully turned off by QT_NO_option
- cfgdNeg=`echo $cfgd | sed 's,QT_,QT_NO_,'`
- fi
-
- if [ -z $cfgdNeg ]; then
-cat << EOF
-#ifndef $cfgd
-# define $cfg
-#endif
-
-EOF
- else
-cat << EOF
-#if defined($cfgd) && defined($cfgdNeg)
-# undef $cfgd
-#elif !defined($cfgd) && !defined($cfgdNeg)
-# define $cfg
-#endif
-
-EOF
- fi
- done
-cat << EOF
-#endif // QT_BOOTSTRAPPED
-
-EOF
-fi
-
-if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
-cat << EOF
-#define QT_VISIBILITY_AVAILABLE
-
-EOF
-fi
-
-if [ -n "$QT_LIBINFIX" ]; then
-cat << EOF
-#define QT_LIBINFIX "$QT_LIBINFIX"
-
-EOF
-fi
-
-echo "#define QT_QPA_DEFAULT_PLATFORM_NAME \"$QT_QPA_DEFAULT_PLATFORM\""
-
-# Close qconfig.h.new (by restoring the original stdout)
-exec >&3
-
-# avoid unecessary rebuilds by copying only if qconfig.h has changed
-if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
- rm -f "$outpath/src/corelib/global/qconfig.h.new"
-else
- mv -f "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
-fi
+set +f
+IFS=$SAVED_IFS
#-------------------------------------------------------------------------------
-# save configuration into qconfig.pri
+# configure and build top-level makefile
#-------------------------------------------------------------------------------
-# open qconfig.pri
-QTCONFIG="$outpath/mkspecs/qconfig.pri"
-exec > "$QTCONFIG.tmp"
-
-if [ "$CFG_DEBUG" = "yes" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG debug"
- if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG release"
- fi
- QT_CONFIG="$QT_CONFIG debug"
-elif [ "$CFG_DEBUG" = "no" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG release"
- if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG debug"
- fi
- QT_CONFIG="$QT_CONFIG release"
-fi
-if [ "$CFG_FRAMEWORK" = "no" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_no_framework"
-else
- QT_CONFIG="$QT_CONFIG qt_framework"
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG qt_framework"
-fi
-if [ "$CFG_DEV" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG private_tests"
- if [ "$CFG_WERROR" != "no" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG warnings_are_errors"
- fi
- if [ "$CFG_HEADERSCLEAN" != "no" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG headersclean"
- fi
-else
- if [ "$CFG_WERROR" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG warnings_are_errors"
- fi
- if [ "$CFG_HEADERSCLEAN" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG headersclean"
- fi
-fi
-
-cat <<EOF
-#configuration
-CONFIG += $QTCONFIG_CONFIG
-host_build {
- QT_ARCH = $CFG_HOST_ARCH
- QT_TARGET_ARCH = $CFG_ARCH
-} else {
- QT_ARCH = $CFG_ARCH
-}
-QT_CONFIG += $QT_CONFIG
-
-#versioning
-QT_VERSION = $QT_VERSION
-QT_MAJOR_VERSION = $QT_MAJOR_VERSION
-QT_MINOR_VERSION = $QT_MINOR_VERSION
-QT_PATCH_VERSION = $QT_PATCH_VERSION
-
-#namespaces
-QT_LIBINFIX = $QT_LIBINFIX
-QT_NAMESPACE = $QT_NAMESPACE
-
-QT_EDITION = $Edition
-EOF
-
-if [ "$Edition" != "OpenSource" ] && [ "$Edition" != "Preview" ]; then
- echo "QT_LICHECK = $Licheck"
- echo "QT_RELEASE_DATE = $ReleaseDate"
-fi
-echo
-
-if [ "$CFG_SHARED" = "no" ]; then
- echo "QT_DEFAULT_QPA_PLUGIN = q$QT_QPA_DEFAULT_PLATFORM"
- echo
-fi
-
-if [ -n "$PKG_CONFIG_SYSROOT_DIR" ] || [ -n "$PKG_CONFIG_LIBDIR" ]; then
- echo "# pkgconfig"
- echo "PKG_CONFIG_SYSROOT_DIR = $PKG_CONFIG_SYSROOT_DIR"
- echo "PKG_CONFIG_LIBDIR = $PKG_CONFIG_LIBDIR"
- echo
+if [ -n "$CFG_TOPLEVEL" ]; then
+ cd ..
fi
-if [ -n "$CFG_SYSROOT" ] && [ "$CFG_GCC_SYSROOT" = "yes" ]; then
- echo "# sysroot"
- echo "!host_build {"
- echo " QMAKE_CFLAGS += --sysroot=\$\$[QT_SYSROOT]"
- echo " QMAKE_CXXFLAGS += --sysroot=\$\$[QT_SYSROOT]"
- echo " QMAKE_LFLAGS += --sysroot=\$\$[QT_SYSROOT]"
- echo "}"
- echo
-fi
-echo "QT_COMPILER_STDCXX = $CFG_STDCXX_DEFAULT"
-if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
- echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION"
- echo "QT_GCC_MINOR_VERSION = $QT_GCC_MINOR_VERSION"
- echo "QT_GCC_PATCH_VERSION = $QT_GCC_PATCH_VERSION"
-fi
-if [ -n "$QT_ICC_MAJOR_VERSION" ]; then
- echo "QT_ICC_MAJOR_VERSION = $QT_ICC_MAJOR_VERSION"
- echo "QT_ICC_MINOR_VERSION = $QT_ICC_MINOR_VERSION"
- echo "QT_ICC_PATCH_VERSION = $QT_ICC_PATCH_VERSION"
-fi
-if [ -n "$QT_CLANG_MAJOR_VERSION" ]; then
- echo "QT_CLANG_MAJOR_VERSION = $QT_CLANG_MAJOR_VERSION"
- echo "QT_CLANG_MINOR_VERSION = $QT_CLANG_MINOR_VERSION"
-fi
-if [ -n "$QT_APPLE_CLANG_MAJOR_VERSION" ]; then
- echo "QT_APPLE_CLANG_MAJOR_VERSION = $QT_APPLE_CLANG_MAJOR_VERSION"
- echo "QT_APPLE_CLANG_MINOR_VERSION = $QT_APPLE_CLANG_MINOR_VERSION"
-fi
-
-if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
- echo "#Qt opengl include path"
- echo "QMAKE_INCDIR_OPENGL_ES2 = `shellArgumentListToQMakeList "$QMAKE_INCDIR_OPENGL_ES2"`"
-fi
-
-# Close qconfig.pri.tmp (by restoring the original stdout)
-exec >&3
-
-# replace qconfig.pri if it differs from the newly created temp file
-if cmp -s "$QTCONFIG.tmp" "$QTCONFIG"; then
- rm -f "$QTCONFIG.tmp"
-else
- mv -f "$QTCONFIG.tmp" "$QTCONFIG"
-fi
+"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled" -- "$@" || exit
#-------------------------------------------------------------------------------
-# save configuration into qmodule.pri
+# finally save the executed command to another script
#-------------------------------------------------------------------------------
-
-# open qmodule.pri
-QTMODULE="$outpath/mkspecs/qmodule.pri"
-exec > "$QTMODULE.tmp"
-
-echo "CONFIG += $QMAKE_CONFIG"
-echo "QT_BUILD_PARTS += $CFG_BUILD_PARTS"
-if [ -n "$CFG_SKIP_MODULES" ]; then
- echo "QT_SKIP_MODULES += $CFG_SKIP_MODULES"
-fi
-DISABLED_FEATURES=
-for cfg in $QCONFIG_FLAGS; do
- ncfg=${cfg#QT_NO_}
- if [ x$ncfg != x$cfg ]; then
- DISABLED_FEATURES="$DISABLED_FEATURES $ncfg"
+if [ $CFG_REDO = no ]; then
+ if [ "$OPT_CONFIRM_LICENSE" = "no" ]; then
+ OPT_CMDLINE="$OPT_CMDLINE
+-confirm-license"
fi
-done
-if [ -n "$DISABLED_FEATURES" ]; then
- echo "QT_NO_DEFINES = $DISABLED_FEATURES"
-fi
-echo "QT_QCONFIG_PATH = ${CFG_QCONFIG_PATH#$relpath/src/corelib/global/}"
-
-cat <<EOF
-host_build {
- QT_CPU_FEATURES.$CFG_HOST_ARCH = $CFG_HOST_CPUFEATURES
-} else {
- QT_CPU_FEATURES.$CFG_ARCH = $CFG_CPUFEATURES
-}
-EOF
-echo "QT_COORD_TYPE = $CFG_QREAL"
-
-if [ -n "$QT_CFLAGS_PSQL" ]; then
- echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL"
-fi
-if [ -n "$QT_LFLAGS_PSQL" ]; then
- echo "QT_LFLAGS_PSQL = $QT_LFLAGS_PSQL"
-fi
-if [ -n "$QT_CFLAGS_MYSQL" ]; then
- echo "QT_CFLAGS_MYSQL = $QT_CFLAGS_MYSQL"
-fi
-if [ -n "$QT_LFLAGS_MYSQL" ]; then
- echo "QT_LFLAGS_MYSQL = $QT_LFLAGS_MYSQL"
-fi
-if [ -n "$QT_CFLAGS_SQLITE" ]; then
- echo "QT_CFLAGS_SQLITE = $QT_CFLAGS_SQLITE"
-fi
-if [ -n "$QT_LFLAGS_SQLITE" ]; then
- echo "QT_LFLAGS_SQLITE = $QT_LFLAGS_SQLITE"
-fi
-if [ -n "$QT_LFLAGS_ODBC" ]; then
- echo "QT_LFLAGS_ODBC = $QT_LFLAGS_ODBC"
-fi
-if [ -n "$QT_LFLAGS_TDS" ]; then
- echo "QT_LFLAGS_TDS = $QT_LFLAGS_TDS"
-fi
-#dump in the OPENSSL_LIBS info
-if [ '!' -z "$OPENSSL_LIBS" ]; then
- echo "OPENSSL_LIBS = $OPENSSL_LIBS"
-elif [ "$CFG_OPENSSL" = "linked" ]; then
- echo "OPENSSL_LIBS = -lssl -lcrypto"
-fi
-
-# cmdline args
-cat "$QMAKE_VARS_FILE"
-# QMAKE_VARS_FILE will be still needed for a status message.
+ # skip first line, as it's always empty due to unconditional field separation
+ echo "$OPT_CMDLINE" | tail -n +2 > config.opt
-# Close qmodule.pri.tmp (by restoring the original stdout)
-exec >&3
-
-# replace qmodule.pri if it differs from the newly created temp file
-if cmp -s "$QTMODULE.tmp" "$QTMODULE"; then
- rm -f "$QTMODULE.tmp"
-else
- mv -f "$QTMODULE.tmp" "$QTMODULE"
+ [ -f "config.status" ] && rm -f config.status
+ echo "#!/bin/sh" > config.status
+ echo "$relpathMangled/$relconf -redo \"\$@\"" >> config.status
+ chmod +x config.status
fi
#-------------------------------------------------------------------------------
-# give feedback on configuration
+# final notes for the user
#-------------------------------------------------------------------------------
-exec 1>$outpath/config.summary # redirect output temporarily to config.summary
-
-report_support()
-{
- case "$#,$2" in
- 2,auto)
- # 2 arguments and the result is "auto", so just say "yes"
- # this is usually an error in the configure script, but oh well..
- echo "$1 yes"
- return
- ;;
- [012],* | *,no*)
- # 0, 1 or 2 arguments, or anything starting with "no"
- # print just the first part of the argument (before the dash)
- echo "$1 ${2%%-*}"
- return
- :;
- esac
- heading=$1
- shift
-
- value=$1
- shift
-
- while [ $# -gt 0 ]; do
- if [ "$value" = "$1" ]; then
- echo "$heading yes ($2)"
- return
- fi
- shift
- shift
- done
- echo "$heading $value"
-}
-
-report_support_plugin()
-{
- report_support "$1" "$2-$3" \
- yes-qt "in $4, using bundled copy" \
- yes-system "in $4, using system library" \
- plugin-qt "plugin, using bundled copy" \
- plugin-system "plugin, using system library"
-}
-
-echo
-echo " Configure summary"
-echo
-if [ "$XPLATFORM" = "$PLATFORM" ]; then
- # the missing space before $CFG_FEATURES is intentional
- echo "Build type: $PLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES:- none detected})"
-else
- echo "Building on: $PLATFORM ($CFG_HOST_ARCH, CPU features:${CFG_HOST_CPUFEATURES:- none detected})"
- echo "Building for: $XPLATFORM ($CFG_ARCH, CPU features:${CFG_CPUFEATURES:- none detected})"
-fi
-
if [ -n "$PLATFORM_NOTES" ]; then
+ echo
echo "Platform notes:"
echo "$PLATFORM_NOTES"
else
echo
fi
-if [ "$OPT_VERBOSE" = "yes" ]; then
- echo $ECHO_N "qmake vars .......... $ECHO_C"
- cat "$QMAKE_VARS_FILE" | tr '\n' ' '
- echo "qmake switches ......... $QMAKE_SWITCHES"
- echo
-fi
-
-# Build configuration
-echo "Build options:"
-echo $ECHO_N " Configuration .......... $ECHO_C"
-echo $QMAKE_CONFIG $QT_CONFIG | tr ' ' '\n' | sort | tr '\n' ' '
-echo
-echo " Build parts ............ $CFG_BUILD_PARTS"
-release="release"
-[ "$CFG_FORCEDEBUGINFO" = "yes" ] && release="release (with debug info)"
-[ "$CFG_DEBUG" = "yes" ] && build_mode="debug" || build_mode=$release
-if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
- build_mode="debug and $release; default link: $build_mode"
-fi
-if [ "$CFG_RELEASE_TOOLS" = "yes" ]; then
- build_mode="$build_mode; optimized tools"
-fi
-echo " Mode ................... $build_mode"
-unset build_mode release
-echo " Using sanitizer(s)...... $CFG_SANITIZERS"
-echo " Using C++ standard ..... $CFG_STDCXX"
-echo " Using gold linker....... $CFG_USE_GOLD_LINKER"
-echo " Using new DTAGS ........ $CFG_ENABLE_NEW_DTAGS"
-echo " Using PCH .............. $CFG_PRECOMPILE"
-echo " Using LTCG ............. $CFG_LTCG"
-echo " Target compiler supports:"
-if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then
- echo " SSE .................. ${CFG_SSE_LIST:-<none>}"
- echo " AVX .................. ${CFG_AVX_LIST:-<none>}"
- echo " AVX512 ............... ${CFG_AVX512_UPPER:-<none>}"
-elif [ "$CFG_ARCH" = "arm" ]; then
- echo " Neon ................. ${CFG_NEON}"
-elif [ "$CFG_ARCH" = "mips" ]; then
- echo " DSP/DSPr2 ............ ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}"
-fi
-
-# Qt modules
-echo
-echo "Qt modules and options:"
-report_support " Qt D-Bus ..............." "$CFG_DBUS" runtime "loading dbus-1 at runtime" linked "linked to dbus-1"
-report_support " Qt Concurrent .........." "$CFG_CONCURRENT"
-report_support " Qt GUI ................." "$CFG_GUI"
-report_support " Qt Widgets ............." "$CFG_WIDGETS"
-report_support " Large File ............." "$CFG_LARGEFILE"
-report_support " QML debugging .........." "$CFG_QML_DEBUG"
-report_support " Use system proxies ....." "$CFG_SYSTEM_PROXIES"
-
-# Other things
-# Please keep sorted and properly grouped! The output is quite long, so it's
-# hard to find something you're searching for if it's not sorted.
-echo
-echo "Support enabled for:"
-report_support " Accessibility .........." "$CFG_ACCESSIBILITY"
-report_support " ALSA ..................." "$CFG_ALSA"
-report_support " CUPS ..................." "$CFG_CUPS"
-[ "$XPLATFORM_MINGW" = "yes" ] && \
- report_support " DirectWrite ............" "$CFG_DIRECTWRITE"
-report_support " DoubleConversion........" "$CFG_DOUBLECONVERSION" no "libc" system "system library" qt "bundled copy"
-report_support " Evdev .................." "$CFG_EVDEV"
-report_support " FontConfig ............." "$CFG_FONTCONFIG"
-report_support " FreeType ..............." "$CFG_FREETYPE" system "system library" yes "bundled copy"
-report_support " Glib ..................." "$CFG_GLIB"
-report_support " GStreamer .............." "$CFG_GSTREAMER" yes "$CFG_GSTREAMER_VERSION"
-report_support " GTK platformtheme ......" "$CFG_GTK"
-report_support " HarfBuzz ..............." "$CFG_HARFBUZZ" system "system library" qt "bundled copy"
-report_support " Iconv .................." "$CFG_ICONV"
-report_support " ICU ...................." "$CFG_ICU"
-report_support " Image formats:"
-report_support_plugin " GIF .................." "$CFG_GIF" qt QtGui
-report_support_plugin " JPEG ................." "$CFG_JPEG" "$CFG_LIBJPEG" QtGui
-report_support_plugin " PNG .................." "$CFG_PNG" "$CFG_LIBPNG" QtGui
-report_support " libinput................" "$CFG_LIBINPUT"
-report_support " Logging backends:"
-report_support " journald ..............." "$CFG_JOURNALD"
-report_support " syslog ..............." "$CFG_SYSLOG"
-report_support " mtdev .................." "$CFG_MTDEV" yes "system library"
-report_support " Networking:"
-[ "$XPLATFORM_MAC" = "yes" ] && \
- report_support " CoreWlan ............." "$CFG_COREWLAN"
-report_support " getaddrinfo .........." "$CFG_GETADDRINFO"
-report_support " getifaddrs ..........." "$CFG_GETIFADDRS"
-report_support " IPv6 ifname .........." "$CFG_IPV6IFNAME"
-report_support " libproxy.............." "$CFG_LIBPROXY"
-report_support " OpenSSL .............." "$CFG_OPENSSL" yes "loading libraries at run-time" linked "linked to the libraries"
-[ "$XPLATFORM_MAC" = "yes" ] && \
- report_support " SecureTransport ......" "$CFG_SECURETRANSPORT"
-report_support " OpenGL / OpenVG:"
-report_support " EGL .................." "$CFG_EGL"
-report_support " OpenGL ..............." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.0+"
-report_support " OpenVG ..............." "$CFG_OPENVG-$CFG_OPENVG_SHIVA" yes-yes "ShivaVG" yes-no "native"
-report_support " PCRE ..................." "$CFG_PCRE" yes "system library" qt "bundled copy"
-if [ -n "$PKG_CONFIG" ]; then
- report_support " pkg-config ............. yes"
-else
- report_support " pkg-config ............. no"
-fi
-report_support " PulseAudio ............." "$CFG_PULSEAUDIO"
-report_support " QPA backends:"
-report_support " DirectFB ............." "$CFG_DIRECTFB"
-report_support " EGLFS ................" "$CFG_EGLFS"
-report_support " EGLFS i.MX6 ........" "$CFG_EGLFS_VIV"
-report_support " EGLFS i.MX6 Wayland." "$CFG_EGLFS_VIV_WL"
-report_support " EGLFS EGLDevice ...." "$CFG_EGLFS_EGLDEVICE"
-report_support " EGLFS GBM .........." "$CFG_EGLFS_GBM"
-report_support " EGLFS Mali ........." "$CFG_EGLFS_MALI"
-report_support " EGLFS Raspberry Pi ." "$CFG_EGLFS_BRCM"
-report_support " EGLFS X11 .........." "$CFG_EGL_X"
-if [ "$XPLATFORM_INTEGRITY" = "yes" ]; then
- report_support " INTEGRITY Framebuffer " "$CFG_INTEGRITYFB"
-fi
-report_support " LinuxFB .............." "$CFG_LINUXFB"
-report_support " Mir client............" "$CFG_MIRCLIENT"
-report_support " XCB .................." "$CFG_XCB" system "system library" qt "bundled copy"
-if [ "$CFG_XCB" != "no" ]; then
- report_support " EGL on X ..........." "$CFG_EGL_X"
- report_support " GLX ................" "$CFG_XCB_GLX"
- report_support " MIT-SHM ............" "$CFG_MITSHM"
- report_support " Xcb-Xlib ..........." "$CFG_XCB_XLIB"
- report_support " Xcursor ............" "$CFG_XCURSOR" runtime "loaded at runtime"
- report_support " Xfixes ............." "$CFG_XFIXES" runtime "loaded at runtime"
- report_support " Xi2 ................" "$CFG_XINPUT2" runtime "loaded at runtime"
- report_support " Xrandr ............." "$CFG_XRANDR" runtime "loaded at runtime"
- report_support " Xrender ............" "$CFG_XRENDER"
- report_support " XKB ................" "$CFG_XKB"
- report_support " XShape ............." "$CFG_XSHAPE"
- report_support " XSync .............." "$CFG_XSYNC"
-fi
-report_support " Session management ....." "$CFG_SM"
-if [ "$XPLATFORM_QNX" = "yes" ]; then
- report_support " SLOG2 .................." "$CFG_SLOG2"
- report_support " IMF ...................." "$CFG_QNX_IMF"
- report_support " PPS ...................." "$CFG_PPS"
- report_support " LGMON .................." "$CFG_LGMON"
-fi
-report_support " SQL drivers:"
-report_support " DB2 .................." "$CFG_SQL_db2" plugin "plugin" yes "built into QtSql"
-report_support " InterBase ............" "$CFG_SQL_ibase" plugin "plugin" yes "built into QtSql"
-report_support " MySQL ................" "$CFG_SQL_mysql" plugin "plugin" yes "built into QtSql"
-report_support " OCI .................." "$CFG_SQL_oci" plugin "plugin" yes "built into QtSql"
-report_support " ODBC ................." "$CFG_SQL_odbc" plugin "plugin" yes "built into QtSql"
-report_support " PostgreSQL ..........." "$CFG_SQL_psql" plugin "plugin" yes "built into QtSql"
-report_support " SQLite 2 ............." "$CFG_SQL_sqlite2" plugin "plugin" yes "built into QtSql"
-report_support_plugin " SQLite ..............." "$CFG_SQL_sqlite" "$CFG_SQLITE" QtSql
-report_support " TDS .................." "$CFG_SQL_tds" plugin "plugin" yes "built into QtSql"
-report_support " tslib .................." "$CFG_TSLIB"
-report_support " udev ..................." "$CFG_LIBUDEV"
-report_support " xkbcommon-x11..........." "$CFG_XKBCOMMON" system "system library" qt "bundled copy, XKB config root: $CFG_XKB_CONFIG_ROOT"
-report_support " xkbcommon-evdev........." "$CFG_XKBCOMMON_EVDEV"
-report_support " zlib ..................." "$CFG_ZLIB" system "system library" yes "bundled copy"
-
-echo
-
-# complain about not being able to use dynamic plugins if we are using a static build
-if [ "$CFG_SHARED" = "no" ]; then
- echo
- echo "WARNING: Using static linking will disable the use of dynamically"
- echo "loaded plugins. Make sure to import all needed static plugins,"
- echo "or compile needed modules into the library."
-fi
-if [ "$CFG_FREETYPE" = "system" ]; then
- if [ "$ORIG_CFG_FREETYPE" = "qt" ]; then
- echo
- echo "WARNING: Bundled FreeType can't be used. FontConfig use requires system FreeType."
- elif [ "$ORIG_CFG_FREETYPE" = "no" ]; then
- echo
- echo "WARNING: FreeType can't be disabled. FontConfig use requires system FreeType."
- fi
-fi
-if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
- echo
- echo "NOTE: When linking against OpenSSL, you can override the default"
- echo "library names through OPENSSL_LIBS."
- echo "For example:"
- echo " OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
-fi
-if [ "$CFG_JOURNALD" = "yes" ] || [ "$CFG_SYSLOG" = "yes" ] || [ "$CFG_SLOG2" = "yes" ]; then
- echo
- echo "NOTE: journald, syslog or slog2 integration is enabled."
- echo "If your users intend on developing applications against this build,"
- echo "ensure that the IDEs they use either set QT_LOGGING_TO_CONSOLE to 1"
- echo "or the IDE is able to read the logged output from journald, syslog or slog2."
-fi
-if [ "$CFG_XKBCOMMON" = "qt" ] && [ "$CFG_XKB_CONFIG_ROOT" = "not found" ]; then
- echo
- echo "WARNING: Could not find XKB config root, use -xkb-config-root to set a path to "
- echo "XKB configuration data. This is required for keyboard input support."
-fi
-if [ "$CFG_QREAL" = double ] && [ "$CFG_ARCH" = arm ]; then
- echo
- echo "NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1."
- echo "Configure with '-qreal float' to create a build that is binary compatible with 5.1."
-fi
-if [ "$CFG_RELEASE_TOOLS" = "yes" -a \( "$CFG_DEBUG" = "no" -o "$CFG_DEBUG_RELEASE" = "yes" \) ]; then
- echo
- echo "NOTE: -optimized-tools is not useful in -release mode."
- echo
-fi
-
-exec 1>&3 3>&- # restore stdout
-cat $outpath/config.summary # display config feedback to user
-
-if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
- echo
- echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
- echo "if you want a pure debug build."
- echo
- exit 1
-fi
-
-sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'`
-PROCS=1
-EXEC=""
-
-rm -f "$QMAKE_VARS_FILE" 2>/dev/null
-
-#-------------------------------------------------------------------------------
-# build makefiles based on the configuration
-#-------------------------------------------------------------------------------
-
-( # fork to make the cd stay local
-
- relpathMangled=$relpath
- if [ -n "$CFG_TOPLEVEL" ]; then
- relpathMangled=`dirname "$relpath"`
- cd ..
- fi
-
- "$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled"
-
-) || exit
-
-#-------------------------------------------------------------------------------
-# check for platforms that we don't yet know about
-#-------------------------------------------------------------------------------
-if [ "$CFG_ARCH" = "unknown" ]; then
-cat <<EOF
-
- NOTICE: configure was unable to determine the architecture
- for the $XQMAKESPEC target.
-
- Qt will not use a specialized implementation for any atomic
- operations. Instead a generic implemention based on either GCC
- intrinsics or C++11 std::atomic<T> will be used (when
- available). The generic implementations are generally as fast
- as and always as safe as a specialized implementation.
-
- If no generic implementation is available, Qt will use a
- fallback UNIX implementation which uses a single
- pthread_mutex_t to protect all atomic operations. This
- implementation is the slow (but safe) fallback implementation
- for architectures Qt does not yet support.
-EOF
-fi
-
-#-------------------------------------------------------------------------------
-# check if the user passed the -no-zlib option, which is no longer supported
-#-------------------------------------------------------------------------------
-if [ -n "$ZLIB_FORCED" ]; then
- which_zlib="supplied"
- if [ "$CFG_ZLIB" = "system" ]; then
- which_zlib="system"
- fi
-
-cat <<EOF
-
- NOTICE: The -no-zlib option was supplied but is no longer
- supported.
-
- Qt now requires zlib support in all builds, so the -no-zlib
- option was ignored. Qt will be built using the $which_zlib
- zlib.
-EOF
-fi
-
-#-------------------------------------------------------------------------------
-# check if the user passed the obsoleted -wayland or -no-wayland flag
-#-------------------------------------------------------------------------------
-if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then
-cat <<EOF
-
- NOTICE: The -wayland and -no-wayland flags are now obsolete
-
- All configuring of QtWayland plugin and QtCompositor happens in the module
-EOF
-fi
-
-#-------------------------------------------------------------------------------
-# check if the user passed the obsoleted -arch or -host-arch options
-#-------------------------------------------------------------------------------
-if [ "$OPT_OBSOLETE_HOST_ARG" = "yes" ]; then
-cat <<EOF
-
- NOTICE: The -arch and -host-arch options are obsolete.
-
- Qt now detects the target and host architectures based on compiler
- output. Qt will be built using $CFG_ARCH for the target architecture
- and $CFG_HOST_ARCH for the host architecture (note that these two
- will be the same unless you are cross-compiling).
-EOF
-fi
-
-#-------------------------------------------------------------------------------
-# finally save the executed command to another script
-#-------------------------------------------------------------------------------
-if [ `basename $0` != "config.status" ]; then
- CONFIG_STATUS="$relpath/$relconf$OPT_CMDLINE"
-
- # add the system variables
- for varname in $SYSTEM_VARIABLES; do
- cmd=`echo \
-'if [ -n "\$'${varname}'" ]; then
- CONFIG_STATUS="'${varname}'='"'\\\$${varname}'"' \$CONFIG_STATUS"
-fi'`
- eval "$cmd"
- done
-
- echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license"
-
- [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
- echo "#!/bin/sh" > "$outpath/config.status"
- [ -n "$PKG_CONFIG_SYSROOT_DIR" ] && \
- echo "export PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR" >> "$outpath/config.status"
- [ -n "$PKG_CONFIG_LIBDIR" ] && \
- echo "export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR" >> "$outpath/config.status"
- echo "$CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
- chmod +x "$outpath/config.status"
-fi
-
-if [ -n "$RPATH_MESSAGE" ]; then
- echo
- echo "$RPATH_MESSAGE"
-fi
-
if [ -n "$PREFIX_COMPLAINTS" ]; then
echo
echo "$PREFIX_COMPLAINTS"
diff --git a/configure.bat b/configure.bat
index 5c01890116..769cddbd1b 100644
--- a/configure.bat
+++ b/configure.bat
@@ -28,10 +28,26 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
+setlocal ENABLEEXTENSIONS
+set ARGS=%*
set QTSRC=%~dp0
set QTDIR=%CD%
-if not exist %QTSRC%.gitignore goto sconf
+:doargs
+ if "%~1" == "" goto doneargs
+
+ if "%~1" == "/?" goto help
+ if "%~1" == "-?" goto help
+ if /i "%~1" == "/h" goto help
+ if /i "%~1" == "-h" goto help
+ if /i "%~1" == "/help" goto help
+ if /i "%~1" == "-help" goto help
+ if /i "%~1" == "--help" goto help
+
+ shift
+ goto doargs
+:doneargs
+
echo Please wait while bootstrapping configure ...
for %%C in (clang-cl.exe cl.exe icl.exe g++.exe perl.exe jom.exe) do set %%C=%%~$PATH:C
@@ -114,9 +130,10 @@ if errorlevel 1 (cd ..\.. & exit /b 1)
cd ..\..
:conf
-configure.exe -srcdir %QTSRC% %*
+configure.exe -srcdir %QTSRC% %ARGS%
goto exit
-:sconf
-%QTSRC%configure.exe %*
+:help
+type %QTSRC%config_help.txt
+
:exit
diff --git a/configure.json b/configure.json
new file mode 100644
index 0000000000..85ef23a186
--- /dev/null
+++ b/configure.json
@@ -0,0 +1,1195 @@
+{
+ "files": {
+ "publicHeader": "src/corelib/global/qconfig.h",
+ "privateHeader": "src/corelib/global/qconfig_p.h",
+ "publicPro": "mkspecs/qconfig.pri",
+ "privatePro": "mkspecs/qmodule.pri"
+ },
+
+ "subconfigs": [
+ "src/corelib",
+ "src/network",
+ "src/sql",
+ "src/gui",
+ "src/xml",
+ "src/widgets",
+ "src/printsupport"
+ ],
+
+ "commandline": {
+ "assignments": {
+ "DBUS_HOST_PATH": "host_dbus.prefix",
+ "DBUS_PATH": "dbus.prefix",
+ "ZLIB_LIBS": "zlib.libs"
+ },
+ "custom": "qmakeArgs",
+ "options": {
+ "prefix": "string",
+ "hostprefix": "string",
+ "extprefix": "string",
+
+ "archdatadir": "string",
+ "bindir": "string",
+ "datadir": "string",
+ "docdir": "string",
+ "examplesdir": "string",
+ "external-hostbindir": "string",
+ "headerdir": "string",
+ "hostbindir": "string",
+ "hostdatadir": "string",
+ "hostlibdir": "string",
+ "importdir": "string",
+ "libdir": "string",
+ "libexecdir": "string",
+ "plugindir": "string",
+ "qmldir": "string",
+ "settingsdir": "string",
+ "sysconfdir": "string",
+ "testsdir": "string",
+ "translationdir": "string",
+
+ "android-arch": "string",
+ "android-ndk": "string",
+ "android-ndk-host": "string",
+ "android-ndk-platform": "string",
+ "android-sdk": "string",
+ "android-toolchain-version": "string",
+
+ "accessibility": "boolean",
+ "alsa": "boolean",
+ "audio-backend": "boolean",
+ "avx": "boolean",
+ "avx2": "boolean",
+ "avx512": { "type": "boolean", "name": "avx512f" },
+ "c++std": "cxxstd",
+ "commercial": "void",
+ "compile-examples": { "type": "boolean", "name": "compile_examples" },
+ "confirm-license": "void",
+ "continue": "void",
+ "dbus": { "type": "optionalString", "values": [ "no", "yes", "linked", "runtime" ] },
+ "dbus-linked": { "type": "void", "name": "dbus", "value": "linked" },
+ "dbus-runtime": { "type": "void", "name": "dbus", "value": "runtime" },
+ "debug": "void",
+ "debug-and-release": { "type": "boolean", "name": "debug_and_release" },
+ "developer-build": "void",
+ "device": "string",
+ "device-option": "string",
+ "force-asserts": { "type": "boolean", "name": "force_asserts" },
+ "force-debug-info": { "type": "boolean", "name": "force_debug_info" },
+ "force-pkg-config": { "type": "void", "name": "pkg-config" },
+ "framework": "boolean",
+ "gcc-sysroot": "boolean",
+ "gcov": "boolean",
+ "gnumake": { "type": "boolean", "name": "GNUmake" },
+ "gstreamer": { "type": "optionalString", "values": [ "no", "yes", "0.10", "1.0" ] },
+ "gui": "boolean",
+ "headersclean": "boolean",
+ "host-option": "string",
+ "incredibuild-xge": { "type": "boolean", "name": "incredibuild_xge" },
+ "libudev": "boolean",
+ "ltcg": "boolean",
+ "make": { "type": "addString", "values": [ "examples", "libs", "tests", "tools" ] },
+ "make-tool": "string",
+ "mips_dsp": "boolean",
+ "mips_dspr2": "boolean",
+ "mp": { "type": "boolean", "name": "msvc_mp" },
+ "nomake": { "type": "addString", "values": [ "examples", "tests", "tools" ] },
+ "opensource": { "type": "void", "name": "commercial", "value": "no" },
+ "optimized-qmake": { "type": "boolean", "name": "release_tools" },
+ "optimized-tools": { "type": "boolean", "name": "release_tools" },
+ "pch": { "type": "boolean", "name": "precompile_header" },
+ "pkg-config": "boolean",
+ "platform": "string",
+ "plugin-manifests": "boolean",
+ "profile": "boolean",
+ "pulseaudio": "boolean",
+ "qml-debug": "boolean",
+ "qreal": "string",
+ "qtlibinfix": { "type": "string", "name": "qt_libinfix" },
+ "qtnamespace": { "type": "string", "name": "qt_namespace" },
+ "reduce-exports": { "type": "boolean", "name": "reduce_exports" },
+ "reduce-relocations": { "type": "boolean", "name": "reduce_relocations" },
+ "release": { "type": "enum", "name": "debug", "values": { "yes": "no", "no": "yes" } },
+ "rpath": "boolean",
+ "rtti": "boolean",
+ "sanitize": "sanitize",
+ "sdk": "string",
+ "separate-debug-info": { "type": "boolean", "name": "separate_debug_info" },
+ "shared": "boolean",
+ "silent": "void",
+ "qdbus": { "type": "boolean", "name": "dbus" },
+ "sse2": "boolean",
+ "sse3": "boolean",
+ "sse4.1": { "type": "boolean", "name": "sse4_1" },
+ "sse4.2": { "type": "boolean", "name": "sse4_2" },
+ "ssse3": "boolean",
+ "static": { "type": "enum", "name": "shared", "values": { "yes": "no", "no": "yes" } },
+ "static-runtime": { "type": "boolean", "name": "static_runtime" },
+ "strip": "boolean",
+ "syncqt": "boolean",
+ "sysroot": "string",
+ "testcocoon": "boolean",
+ "use-gold-linker": { "type": "boolean", "name": "use_gold_linker" },
+ "warnings-are-errors": { "type": "boolean", "name": "warnings_are_errors" },
+ "Werror": { "type": "boolean", "name": "warnings_are_errors" },
+ "widgets": "boolean",
+ "wmf-backend": "boolean",
+ "xplatform": "string",
+ "zlib": { "type": "enum", "name": "system-zlib", "values": { "system": "yes", "qt": "no" } }
+ },
+ "prefix": {
+ "D": "defines",
+ "F": "fpaths",
+ "I": "includes",
+ "L": "lpaths",
+ "R": "rpaths",
+ "W": "wflags"
+ }
+
+ },
+
+ "libraries": {
+ "zlib": {
+ "label": "zlib",
+ "test": "unix/zlib",
+ "sources": [
+ { "libs": "-lzdll", "condition": "config.msvc" },
+ { "libs": "-lz", "condition": "!config.msvc" }
+ ]
+ },
+ "alsa": {
+ "label": "ALSA",
+ "export": "",
+ "test": "unix/alsa",
+ "sources": [
+ "-lasound"
+ ]
+ },
+ "pulseaudio": {
+ "label": "PulseAudio >= 0.9.10",
+ "test": "unix/pulseaudio",
+ "sources": [
+ { "type": "pkgConfig", "args": "libpulse >= 0.9.10 libpulse-mainloop-glib" }
+ ]
+ },
+ "gstreamer_1_0": {
+ "label": "GStreamer 1.0",
+ "export": "",
+ "test": "unix/gstreamer",
+ "sources": [
+ { "type": "pkgConfig",
+ "args": "gstreamer-1.0 gstreamer-base-1.0 gstreamer-audio-1.0 gstreamer-video-1.0 gstreamer-pbutils-1.0" }
+ ]
+ },
+ "gstreamer_0_10": {
+ "label": "GStreamer 0.10",
+ "export": "",
+ "test": "unix/gstreamer",
+ "sources": [
+ { "type": "pkgConfig",
+ "args": "gstreamer-0.10 gstreamer-base-0.10 gstreamer-audio-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10" }
+ ]
+ },
+ "dbus": {
+ "label": "D-Bus >= 1.2",
+ "test": "unix/dbus",
+ "sources": [
+ { "type": "pkgConfig", "args": "dbus-1 >= 1.2" },
+ {
+ "libs": "",
+ "builds": {
+ "debug": "-ldbus-1d",
+ "release": "-ldbus-1"
+ },
+ "condition": "config.win32"
+ },
+ { "libs": "-ldbus-1", "condition": "!config.win32" }
+ ]
+ },
+ "host_dbus": {
+ "label": "D-Bus >= 1.2 (host)",
+ "export": "",
+ "sources": [
+ { "type": "pkgConfig", "host": true, "args": "dbus-1 >= 1.2" },
+ { "libs": "", "comment": "placeholder for DBUS_HOST_PATH" }
+ ]
+ },
+ "libudev": {
+ "label": "udev",
+ "test": "unix/libudev",
+ "sources": [
+ { "type": "pkgConfig", "args": "libudev" },
+ "-ludev"
+ ]
+ }
+ },
+
+ "testTypeDependencies": {
+ "linkerSupportsFlag": [ "use_gold_linker" ],
+ "verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs" ],
+ "compile": [ "verifyspec" ],
+ "detectPkgConfig": [ "cross_compile" ],
+ "library": [ "pkg-config" ],
+ "getPkgConfigVariable": [ "pkg-config" ],
+ "neon": [ "architecture" ]
+ },
+
+ "testTypeAliases": {
+ "compile": [ "library", "architecture" ]
+ },
+
+ "tests": {
+ "verifyspec": {
+ "label": "valid makespec",
+ "type": "verifySpec",
+ "test": "common/verifyspec"
+ },
+ "architecture": {
+ "label": "target architecture",
+ "type": "architecture",
+ "test": "arch",
+ "log": "arch"
+ },
+ "host_architecture": {
+ "label": "host architecture",
+ "type": "architecture",
+ "test": "arch",
+ "host": true,
+ "pro": "arch_host.pro",
+ "log": "arch"
+ },
+ "GNUmake": {
+ "label": "GNU make",
+ "type": "gnumake"
+ },
+ "pkg-config": {
+ "label": "pkg-config",
+ "type": "detectPkgConfig"
+ },
+ "stl": {
+ "label": "STL compatibility",
+ "type": "compile",
+ "test": "unix/stl"
+ },
+ "c++14": {
+ "label": "C++14 support",
+ "type": "compile",
+ "test": "common/c++14"
+ },
+ "c++1z": {
+ "label": "C++1z support",
+ "type": "compile",
+ "test": "common/c++1z"
+ },
+ "cxx98default": {
+ "label": "compiler defaulting to C++98",
+ "type": "compile",
+ "test": "common/c++98default"
+ },
+ "compiler": {
+ "label": "Compiler",
+ "type": "checkCompiler",
+ "log": "compilerDescription"
+ },
+ "precompile_header": {
+ "label": "precompiled header support",
+ "type": "compile",
+ "test": "common/pch"
+ },
+ "use_gold_linker": {
+ "label": "gold linker",
+ "type": "compilerSupportsFlag",
+ "flag": "-fuse-ld=gold"
+ },
+ "enable_new_dtags": {
+ "label": "new dtags support",
+ "type": "linkerSupportsFlag",
+ "flag": "--enable-new-dtags"
+ },
+ "reduce_exports": {
+ "label": "symbol visibility support",
+ "type": "compile",
+ "test": "unix/reduce_exports"
+ },
+ "reduce_relocations": {
+ "label": "-Bsymbolic-functions support",
+ "type": "compile",
+ "test": "unix/reduce_relocs"
+ },
+ "build_parts": {
+ "type": "buildParts"
+ },
+ "separate_debug_info": {
+ "label": "separate debug information support",
+ "type": "compile",
+ "test": "unix/objcopy"
+ },
+ "sse2": {
+ "label": "SSE2 instructions",
+ "type": "compile",
+ "test": "common/sse2"
+ },
+ "sse3": {
+ "label": "SSE3 instructions",
+ "type": "compile",
+ "test": "common/sse3"
+ },
+ "ssse3": {
+ "label": "SSSE3 instructions",
+ "type": "compile",
+ "test": "common/ssse3"
+ },
+ "sse4_1": {
+ "label": "SSE4.1 instructions",
+ "type": "compile",
+ "test": "common/sse4_1"
+ },
+ "sse4_2": {
+ "label": "SSE4.2 instructions",
+ "type": "compile",
+ "test": "common/sse4_2"
+ },
+ "avx": {
+ "label": "AVX instructions",
+ "type": "compile",
+ "test": "common/avx"
+ },
+ "avx_apple_clang": {
+ "label": "bugfree AVX support in compiler",
+ "type": "avx_test_apple_clang"
+ },
+ "avx2": {
+ "label": "AVX2 instructions",
+ "type": "compile",
+ "test": "common/avx2"
+ },
+ "avx512f": {
+ "label": "AVX512 F instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=F"
+ },
+ "avx512er": {
+ "label": "AVX512 ER instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=ER"
+ },
+ "avx512cd": {
+ "label": "AVX512 CD instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=CD"
+ },
+ "avx512pf": {
+ "label": "AVX512 PF instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=PF"
+ },
+ "avx512dq": {
+ "label": "AVX512 DQ instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=DQ"
+ },
+ "avx512bw": {
+ "label": "AVX512 BW instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=BW"
+ },
+ "avx512vl": {
+ "label": "AVX512 VL instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=VL"
+ },
+ "avx512ifma": {
+ "label": "AVX512 IFMA instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=IFMA"
+ },
+ "avx512vbmi": {
+ "label": "AVX512 VBMI instructions",
+ "type": "compile",
+ "test": "common/avx512",
+ "args": "AVX512=VBMI"
+ },
+ "mips_dsp": {
+ "label": "MIPS DSP instructions",
+ "type": "compile",
+ "test": "unix/mips_dsp"
+ },
+ "mips_dspr2": {
+ "label": "MIPS DSPr2 instructions",
+ "type": "compile",
+ "test": "common/mips_dspr2"
+ },
+ "neon": {
+ "label": "NEON instructions",
+ "type": "neon"
+ },
+
+ "mremap": {
+ "label": "mremap()",
+ "type": "compile",
+ "test": "unix/mremap"
+ },
+ "posix_fallocate": {
+ "label": "POSIX fallocate()",
+ "type": "compile",
+ "test": "unix/posix_fallocate"
+ },
+ "stack_protector": {
+ "label": "stack protection",
+ "type": "compilerSupportsFlag",
+ "test": "-fstack-protector-strong"
+ },
+ "incredibuild_xge": {
+ "label": "IncrediBuild",
+ "type": "files",
+ "files": [ "BuildConsole.exe", "xgConsole.exe" ]
+ },
+ "wmf": {
+ "label": "WMF",
+ "type": "files",
+ "files": [ "mfapi.h", "mf.lib" ]
+ }
+ },
+
+ "features": {
+ "shared": {
+ "label": "Building shared libraries",
+ "condition": "!config.uikit && !config.integrity",
+ "output": [
+ "shared",
+ "publicFeature",
+ "publicQtConfig",
+ "publicConfig"
+ ]
+ },
+ "static": {
+ "condition": "!features.shared",
+ "output": [
+ "publicFeature",
+ "publicQtConfig",
+ "publicConfig"
+ ]
+ },
+ "cross_compile": {
+ "label": "Cross compiling",
+ "condition": "call.crossCompile",
+ "output": [ "publicConfig", "privateConfig" ]
+ },
+ "cxx98default": {
+ "label": "Compiler defaults to C++98",
+ "condition": "tests.cxx98default",
+ "output": [ { "type": "publicConfig", "name": "c++11" } ]
+ },
+ "compiler-flags": {
+ "output": [ "compilerFlags" ]
+ },
+ "gcc-sysroot": {
+ "output": [ "gccSysroot" ],
+ "condition": "input.sysroot != ''"
+ },
+ "qmakeargs": {
+ "output": [ "qmakeArgs" ],
+ "condition": "input.qmakeArgs != ''"
+ },
+ "use_gold_linker": {
+ "label": "Using gold linker",
+ "condition": "!config.msvc && tests.use_gold_linker",
+ "output": [ "privateConfig", "useGoldLinker" ]
+ },
+ "architecture": {
+ "label": "Architecture",
+ "output": [ "architecture" ]
+ },
+ "pkg-config": {
+ "label": "Using pkg-config",
+ "autoDetect": "!config.darwin && !config.win32",
+ "condition": "tests.pkg-config",
+ "output": [
+ "publicFeature",
+ { "type": "publicQtConfig", "negative": true },
+ "pkgConfig"
+ ]
+ },
+ "verifyspec": {
+ "label": "Have valid makespec",
+ "condition": "tests.verifyspec"
+ },
+ "developer-build": {
+ "label": "Developer build",
+ "autoDetect": false,
+ "output": [
+ { "type": "define", "name": "QT_BUILD_INTERNAL" },
+ { "type": "privateFeature", "name": "private_tests" },
+ { "type": "publicQtConfig", "name": "private_tests" }
+ ]
+ },
+ "debug": {
+ "label": "Build for debugging",
+ "autoDetect": "features.developer-build || config.win32 || config.darwin"
+ },
+ "debug_and_release": {
+ "label": "Compile libs in debug and release mode",
+ "autoDetect": "input.debug == ''",
+ "condition": "config.darwin || config.win32",
+ "output": [ "publicFeature", "publicQtConfig", "debugAndRelease" ]
+ },
+ "force_debug_info": {
+ "label": "Add debug info in release mode",
+ "autoDetect": false,
+ "output": [ "privateConfig" ]
+ },
+ "separate_debug_info": {
+ "label": "Split off debug information",
+ "autoDetect": false,
+ "condition": [
+ "features.shared",
+ "features.debug || features.debug_and_release || features.force_debug_info",
+ "config.darwin || tests.separate_debug_info"
+ ],
+ "output": [ "publicFeature", "publicQtConfig" ]
+ },
+ "release_tools": {
+ "label": "Compile tools in release mode",
+ "output": [ "privateFeature", "publicQtConfig" ]
+ },
+ "simulator_and_device": {
+ "label": "Build for both simulator and device",
+ "condition": "config.uikit && input.sdk == ''",
+ "output": [ "publicFeature", "publicQtConfig" ]
+ },
+ "build_all": {
+ "condition": "features.debug_and_release || features.simulator_and_device",
+ "output": [ "publicFeature", "publicQtConfig" ]
+ },
+ "rpath": {
+ "label": "Build with RPATH",
+ "autoDetect": "var.QMAKE_LFLAGS_RPATH != '' && features.shared",
+ "output": [ "publicFeature", "publicQtConfig" ]
+ },
+ "rpath_dir": {
+ "label": "RPATH directory",
+ "enable": "input.rpaths != ''",
+ "autoDetect": false,
+ "output": [ { "type": "varAppend", "name": "EXTRA_RPATHS", "value": "input.rpaths" } ]
+ },
+ "rtti": {
+ "label": "Build with RTTI",
+ "comment": "mkspecs/features/win32/default_pre.prf sets no-rtti. Follow default behavior of configure.exe by overriding with rtti.",
+ "condition": "config.win32",
+ "output": [ "publicConfig" ]
+ },
+ "force_asserts": {
+ "label": "Force assertions",
+ "autoDetect": false,
+ "output": [ "publicFeature" ]
+ },
+ "warnings_are_errors": {
+ "label": "WError",
+ "autoDetect": "features.developer-build",
+ "output": [ "privateConfig" ]
+ },
+ "headersclean": {
+ "label": "Check for clean headers",
+ "autoDetect": "features.developer-build",
+ "output": [ "privateConfig" ]
+ },
+ "framework": {
+ "label": "Build Apple Frameworks",
+ "condition": "config.darwin && features.shared",
+ "output": [
+ { "type": "define", "name": "QT_MAC_FRAMEWORK_BUILD" },
+ "publicFeature",
+ { "type": "publicQtConfig", "name": "qt_framework"},
+ { "type": "publicConfig", "name": "qt_framework"}
+ ]
+ },
+ "largefile": {
+ "label": "Large file support",
+ "condition": "!config.android && !config.integrity && !config.winrt",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_LARGEFILE_SUPPORT", "value": 64 }
+ ]
+ },
+ "testcocoon": {
+ "label": "Testcocoon support",
+ "autoDetect": false,
+ "output": [ "publicConfig" ]
+ },
+ "gcov": {
+ "label": "gcov support",
+ "autoDetect": false,
+ "output": [ "publicConfig" ]
+ },
+ "silent": {
+ "label": "Silent build",
+ "autoDetect": false,
+ "output": [ "privateConfig" ]
+ },
+ "sanitize_address": {
+ "label": "Addresses",
+ "autoDetect": false,
+ "output": [ "publicConfig" ]
+ },
+ "sanitize_thread": {
+ "label": "Threads",
+ "autoDetect": false,
+ "output": [ "publicConfig" ]
+ },
+ "sanitize_memory": {
+ "label": "Memory",
+ "autoDetect": false,
+ "output": [ "publicConfig" ]
+ },
+ "sanitize_undefined": {
+ "label": "Undefined",
+ "autoDetect": false,
+ "output": [ "publicConfig" ]
+ },
+ "sanitizer": {
+ "label": "Sanitizers",
+ "condition": "features.sanitize_address || features.sanitize_thread || features.sanitize_memory || features.sanitize_undefined",
+ "output": [ "publicConfig" ]
+ },
+ "GNUmake": {
+ "label": "GNU make",
+ "autoDetect": false,
+ "condition": "tests.GNUmake",
+ "output": [ "privateConfig" ]
+ },
+ "plugin-manifests": {
+ "label": "Embed manifests in plugins",
+ "emitIf": "config.win32",
+ "autoDetect": false,
+ "output": [ { "type": "publicConfig", "negative": true, "name": "no_plugin_manifest" } ]
+ },
+ "profile": {
+ "label": "GNU profiling support",
+ "autoDetect": false,
+ "output": [
+ { "type": "varAppend", "name": "QMAKE_CFLAGS", "value": "'-pg'" },
+ { "type": "varAppend", "name": "QMAKE_CXXFLAGS", "value": "'-pg'" },
+ { "type": "varAppend", "name": "QMAKE_LFLAGS", "value": "'-pg'" }
+ ]
+ },
+ "strip": {
+ "label": "Strip binaries",
+ "condition": "!features.profile",
+ "output": [ { "type": "privateConfig", "negative": true, "name": "nostrip" } ]
+ },
+ "stl": {
+ "label": "STL compatibility",
+ "condition": "tests.stl",
+ "output": [ "publicQtConfig" ]
+ },
+ "c++11": {
+ "label": "C++11",
+ "output": [ "publicFeature", "publicQtConfig" ]
+ },
+ "c++14": {
+ "label": "C++14",
+ "condition": "features.c++11 && tests.c++14",
+ "output": [ "publicFeature", "publicQtConfig" ]
+ },
+ "c++1z": {
+ "label": "C++1z",
+ "condition": "features.c++14 && tests.c++1z",
+ "output": [ "publicFeature", "publicQtConfig" ]
+ },
+ "compiler": {
+ "label": "Compiler version",
+ "condition": "tests.compiler",
+ "output": [ "compilerVersion" ]
+ },
+ "precompile_header": {
+ "label": "Using precompiled headers",
+ "condition": "config.msvc || tests.precompile_header",
+ "output": [
+ "privateConfig",
+ { "type": "varRemove", "negative": true, "name": "CONFIG", "value": "'precompile_header'" }
+ ]
+ },
+ "ltcg": {
+ "label": "Using LTCG",
+ "autoDetect": false,
+ "output": [ "privateConfig" ]
+ },
+ "enable_new_dtags": {
+ "label": "Using new DTAGS",
+ "condition": "config.linux && tests.enable_new_dtags",
+ "output": [ "privateConfig" ]
+ },
+ "reduce_exports": {
+ "label": "Reduce amount of exported symbols",
+ "condition": "!config.win32 && tests.reduce_exports",
+ "output": [
+ "privateFeature",
+ "publicQtConfig",
+ { "type": "define", "name": "QT_VISIBILITY_AVAILABLE" }
+ ]
+ },
+ "reduce_relocations": {
+ "label": "Reduce amount of relocations",
+ "condition": "!config.win32 && tests.reduce_relocations",
+ "output": [
+ "privateFeature",
+ "publicQtConfig",
+ { "type": "define", "name": "QT_REDUCE_RELOCATIONS" }
+ ]
+ },
+ "sse2": {
+ "label": "SSE2",
+ "condition": "(arch.i386 || arch.x86_64) && tests.sse2",
+ "output": [
+ "privateConfig",
+ "privateFeature",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_SSE2", "value": 1 }
+ ]
+ },
+ "sse3": {
+ "label": "SSE3",
+ "condition": "features.sse2 && tests.sse3",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_SSE3", "value": 1 }
+ ]
+ },
+ "ssse3": {
+ "label": "SSSE3",
+ "condition": "features.sse3 && tests.ssse3",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_SSSE3", "value": 1 }
+ ]
+ },
+ "sse4_1": {
+ "label": "SSE4.1",
+ "condition": "features.ssse3 && tests.sse4_1",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_SSE4_1", "value": 1 }
+ ]
+ },
+ "sse4_2": {
+ "label": "SSE4.2",
+ "condition": "features.sse4_1 && tests.sse4_2",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_SSE4_2", "value": 1 }
+ ]
+ },
+ "avx": {
+ "label": "AVX",
+ "condition": "features.sse4_2 && tests.avx && tests.avx_apple_clang",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX", "value": 1 }
+ ]
+ },
+ "avx2": {
+ "label": "AVX2",
+ "condition": "features.avx && tests.avx2",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX2", "value": 1 }
+ ]
+ },
+ "avx512f": {
+ "label": "F",
+ "condition": "features.avx2 && tests.avx512f",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512F", "value": 1 }
+ ]
+ },
+ "avx512er": {
+ "label": "ER",
+ "condition": "features.avx512f && tests.avx512er",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512ER", "value": 1 }
+ ]
+ },
+ "avx512cd": {
+ "label": "CD",
+ "condition": "features.avx512f && tests.avx512cd",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512CD", "value": 1 }
+ ]
+ },
+ "avx512pf": {
+ "label": "PF",
+ "condition": "features.avx512f && tests.avx512pf",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512PF", "value": 1 }
+ ]
+ },
+ "avx512dq": {
+ "label": "DQ",
+ "condition": "features.avx512f && tests.avx512dq",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512DQ", "value": 1 }
+ ]
+ },
+ "avx512bw": {
+ "label": "BW",
+ "condition": "features.avx512f && tests.avx512bw",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512BW", "value": 1 }
+ ]
+ },
+ "avx512vl": {
+ "label": "VL",
+ "condition": "features.avx512f && tests.avx512vl",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512VL", "value": 1 }
+ ]
+ },
+ "avx512ifma": {
+ "label": "IFMA",
+ "condition": "features.avx512f && tests.avx512ifma",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512IFMA", "value": 1 }
+ ]
+ },
+ "avx512vbmi": {
+ "label": "VBMI",
+ "condition": "features.avx512f && tests.avx512vbmi",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX512VBMI", "value": 1 }
+ ]
+ },
+ "mips_dsp": {
+ "label": "DSP",
+ "condition": "arch.mips && tests.mips_dsp",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_MIPS_DSP", "value": 1 }
+ ]
+ },
+ "mips_dspr2": {
+ "label": "DSPr2",
+ "condition": "arch.mips && tests.mips_dspr2",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_MIPS_DSPR2", "value": 1 }
+ ]
+ },
+ "neon": {
+ "label": "NEON",
+ "condition": "(arch.arm || arch.arm64) && tests.neon",
+ "output": [
+ "privateConfig",
+ { "type": "define", "name": "QT_COMPILER_SUPPORTS_NEON", "value": 1 }
+ ]
+ },
+ "alsa": {
+ "label": "ALSA",
+ "condition": "libs.alsa",
+ "output": [ "feature" ]
+ },
+ "mremap": {
+ "label": "mremap()",
+ "condition": "tests.mremap",
+ "output": [ "feature" ]
+ },
+ "posix_fallocate": {
+ "label": "POSIX fallocate()",
+ "condition": "tests.posix_fallocate",
+ "output": [ "privateFeature" ]
+ },
+ "stack-protector-strong": {
+ "label": "stack protection",
+ "condition": "config.qnx && tests.stack_protector",
+ "output": [ "publicQtConfig" ]
+ },
+ "accessibility": {
+ "label": "Accessibility",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "pulseaudio": {
+ "label": "PulseAudio",
+ "condition": "libs.pulseaudio",
+ "output": [ "feature" ]
+ },
+ "system-zlib": {
+ "label": "Using system zlib",
+ "condition": "libs.zlib",
+ "output": [ "privateFeature" ]
+ },
+ "concurrent": {
+ "label": "Qt Concurrent",
+ "purpose": "Provides a high-level multi-threading API.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "dbus": {
+ "label": "Qt D-Bus",
+ "autoDetect": "!config.uikit && !config.android && !config.winrt",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "dbus-linked": {
+ "label": "Qt D-Bus directly linked to libdbus",
+ "enable": "input.dbus == 'linked'",
+ "disable": "input.dbus == 'runtime'",
+ "condition": "features.dbus && libs.dbus",
+ "output": [ "privateFeature" ]
+ },
+ "host-dbus": {
+ "label": "Qt D-Bus (Host)",
+ "autoDetect": "!config.android",
+ "condition": "libs.host_dbus",
+ "output": [ { "type": "varAppend", "name": "QT_HOST_CFLAGS_DBUS", "value": "libs.host_dbus.cflags", "eval": "true" } ]
+ },
+ "build_parts": {
+ "output": [ { "type": "varAppend", "name": "QT_BUILD_PARTS", "value": "tests.build_parts.value" } ]
+ },
+ "qreal": {
+ "label": "Type for qreal",
+ "output": [ "qreal" ]
+ },
+ "gui": {
+ "label": "Qt Gui",
+ "output": [
+ "privateFeature",
+ { "type": "publicQtConfig", "negative": true }
+ ]
+ },
+ "widgets": {
+ "label": "Qt Widgets",
+ "condition": "features.gui",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_WIDGETS" },
+ { "type": "publicQtConfig", "negative": true }
+ ]
+ },
+ "libudev": {
+ "label": "udev",
+ "condition": "libs.libudev",
+ "output": [ "privateFeature" ]
+ },
+ "gstreamer-1_0": {
+ "label": "GStreamer 1.0",
+ "disable": "input.gstreamer == '0.10' || input.gstreamer == 'no'",
+ "enable": "input.gstreamer == '1.0'",
+ "condition": "libs.gstreamer_1_0",
+ "output": [ { "type": "publicQtConfig", "name": "gstreamer-1.0" } ]
+ },
+ "gstreamer-0_10": {
+ "label": "GStreamer 0.10",
+ "disable": "input.gstreamer == 'no'",
+ "enable": "input.gstreamer == '0.10'",
+ "condition": "!features.gstreamer-1_0 && libs.gstreamer_0_10",
+ "output": [ { "type": "publicQtConfig", "name": "gstreamer-0.10" } ]
+ },
+ "audio-backend": {
+ "label": "Audio backend",
+ "output": [ "publicQtConfig" ]
+ },
+ "qml-debug": {
+ "label": "QML debugging",
+ "output": [ { "type": "publicQtConfig", "negative": true } ]
+ },
+ "compile_examples": {
+ "label": "Compile examples",
+ "output": [ "privateConfig" ]
+ },
+ "incredibuild_xge": {
+ "label": "IncrediBuild",
+ "emitIf": "var.QMAKE_HOST.os == 'Windows'",
+ "condition": "tests.incredibuild_xge",
+ "output": [ "publicConfig" ]
+ },
+ "msvc_mp": {
+ "label": "Use multiple processors when compiling with MSVC",
+ "emitIf": "config.msvc",
+ "autoDetect": "false",
+ "output": [ "privateConfig" ]
+ },
+ "static_runtime": {
+ "label": "Statically link the C/C++ runtime library",
+ "emitIf": "config.win32",
+ "autoDetect": false,
+ "condition": "!features.shared",
+ "output": [ "publicConfig", "publicQtConfig" ]
+ },
+ "wmf-backend": {
+ "label": "Windows Media Foundation backend for Qt Multimedia",
+ "emitIf": "config.win32",
+ "autoDetect": false,
+ "condition": "tests.wmf",
+ "output": [ "publicQtConfig" ]
+ }
+ },
+
+ "earlyReport": [
+ {
+ "type": "warning",
+ "condition": "input.debug_and_release == 'yes' && !config.darwin && !config.win32",
+ "message": "-debug-and-release is only supported on Darwin and Windows platforms.
+Qt can be built in release mode with separate debug information, so
+-debug-and-release is no longer necessary."
+ },
+ {
+ "type": "error",
+ "condition": "features.framework && features.debug && !features.debug_and_release",
+ "message": "debug-only framework builds are not supported. Configure with -no-framework if you want a pure debug build."
+ },
+ {
+ "type": "error",
+ "condition": "(features.rpath || features.rpath_dir) && !features.shared",
+ "message": "Static builds don't support RPATH"
+ },
+ {
+ "type": "error",
+ "condition": "(features.rpath || features.rpath_dir) && var.QMAKE_LFLAGS_RPATH == ''",
+ "message": "This platform does not support RPATH"
+ }
+ ],
+
+ "report": [
+ {
+ "type": "note",
+ "condition": "!features.shared",
+ "message": "Using static linking will disable the use of dynamically
+loaded plugins. Make sure to import all needed static plugins,
+or compile needed modules into the library."
+ },
+ {
+ "type": "note",
+ "condition": "features.release_tools && (!features.debug || features.debug_and_release)",
+ "message": "-optimized-tools is not useful in -release mode."
+ },
+ {
+ "type": "note",
+ "condition": "input.qreal == 'double' && arch.arm",
+ "message": "Qt is using double for qreal on this system. This is binary-incompatible against Qt 5.1.
+Configure with '-qreal float' to create a build that is binary-compatible with 5.1."
+ },
+ {
+ "type": "warning",
+ "condition": "!features.accessibility",
+ "message": "Accessibility disabled. This configuration of Qt is unsupported."
+ },
+ {
+ "type": "error",
+ "condition": "!features.stl",
+ "message": "Qt requires a compliant STL library."
+ }
+ ],
+
+ "summary": [
+ {
+ "type": "buildTypeAndConfig"
+ },
+ {
+ "section": "Build options",
+ "entries": [
+ {
+ "message": "Mode",
+ "type": "buildMode"
+ },
+ "shared",
+ {
+ "message": "Using C++ standard",
+ "type": "firstAvailableFeature",
+ "args": "c++1z c++14 c++11"
+ },
+ "use_gold_linker",
+ {
+ "type": "feature",
+ "args": "enable_new_dtags",
+ "condition": "config.linux"
+ },
+ "precompile_header",
+ "ltcg",
+ {
+ "section": "Target compiler supports",
+ "entries": [
+ {
+ "message": "SSE",
+ "type": "featureList",
+ "args": "sse2 sse3 ssse3 sse4_1 sse4_2",
+ "condition": "(arch.i386 || arch.x86_64)"
+ },
+ {
+ "message": "AVX",
+ "type": "featureList",
+ "args": "avx avx2",
+ "condition": "(arch.i386 || arch.x86_64)"
+ },
+ {
+ "message": "AVX512",
+ "type": "featureList",
+ "args": "avx512f avx512er avx512cd avx512pf avx512dq avx512bw avx512vl avx512ifma avx512vbmi",
+ "condition": "(arch.i386 || arch.x86_64)"
+ },
+ {
+ "type": "feature",
+ "args": "neon",
+ "condition": "arch.arm || arch.arm64"
+ },
+ {
+ "type": "feature",
+ "args": "mips_dsp",
+ "condition": "arch.mips"
+ },
+ {
+ "type": "feature",
+ "args": "mips_dspr2",
+ "condition": "arch.mips"
+ }
+ ]
+ },
+ {
+ "section": "Sanitizers",
+ "condition": "features.sanitizer",
+ "entries": [ "sanitize_address", "sanitize_thread", "sanitize_memory", "sanitize_undefined" ]
+ },
+ {
+ "message": "Build parts",
+ "type": "buildParts"
+ }
+ ]
+ }, {
+ "section": "Qt modules and options",
+ "entries": [
+ "concurrent",
+ "dbus",
+ "dbus-linked",
+ "gui",
+ "widgets"
+ ]
+ }, {
+ "section": "Support enabled for",
+ "entries": [
+ "accessibility",
+ "alsa",
+ "gstreamer-0_10",
+ "gstreamer-1_0",
+ "pkg-config",
+ "pulseaudio",
+ "qml-debug",
+ "libudev",
+ "system-zlib"
+ ]
+ }
+ ]
+
+}
diff --git a/configure.pri b/configure.pri
new file mode 100644
index 0000000000..7ec845375e
--- /dev/null
+++ b/configure.pri
@@ -0,0 +1,550 @@
+# custom command line handling
+
+defineTest(qtConfCommandline_qmakeArgs) {
+ contains(1, QMAKE_[A-Z_]+ *[-+]?=.*) {
+ config.input.qmakeArgs += $$1
+ export(config.input.qmakeArgs)
+ return(true)
+ }
+ return(false)
+}
+
+defineTest(qtConfCommandline_cxxstd) {
+ msvc: \
+ qtConfAddError("Command line option -c++std is not supported with MSVC compilers.")
+
+ arg = $${1}
+ val = $${2}
+ isEmpty(val): val = $$qtConfGetNextCommandlineArg()
+ !contains(val, "^-.*"):!isEmpty(val) {
+ contains(val, "(c\+\+)?11") {
+ qtConfCommandlineSetInput("c++14", "no")
+ } else: contains(val, "(c\+\+)?(14|1y)") {
+ qtConfCommandlineSetInput("c++14", "yes")
+ qtConfCommandlineSetInput("c++1z", "no")
+ } else: contains(val, "(c\+\+)?(1z)") {
+ qtConfCommandlineSetInput("c++14", "yes")
+ qtConfCommandlineSetInput("c++1z", "yes")
+ } else {
+ qtConfAddError("Invalid argument $$val to command line parameter $$arg")
+ }
+ } else {
+ qtConfAddError("Missing argument to command line parameter $$arg")
+ }
+}
+
+defineTest(qtConfCommandline_sanitize) {
+ arg = $${1}
+ val = $${2}
+ isEmpty(val): val = $$qtConfGetNextCommandlineArg()
+ !contains(val, "^-.*"):!isEmpty(val) {
+ equals(val, "address") {
+ qtConfCommandlineSetInput("sanitize_address", "yes")
+ } else: equals(val, "thread") {
+ qtConfCommandlineSetInput("sanitize_thread", "yes")
+ } else: equals(val, "memory") {
+ qtConfCommandlineSetInput("sanitize_memory", "yes")
+ } else: equals(val, "undefined") {
+ qtConfCommandlineSetInput("sanitize_undefined", "yes")
+ } else {
+ qtConfAddError("Invalid argument $$val to command line parameter $$arg")
+ }
+ } else {
+ qtConfAddError("Missing argument to command line parameter $$arg")
+ }
+}
+
+# callbacks
+
+defineReplace(qtConfFunc_crossCompile) {
+ spec = $$[QMAKE_SPEC]
+ !equals(spec, $$[QMAKE_XSPEC]): return(true)
+ return(false)
+}
+
+# custom tests
+
+defineTest(qtConfTest_architecture) {
+ !qtConfTest_compile($${1}): \
+ error("Could not determine $$eval($${1}.label). See config.log for details.")
+
+ test = $$eval($${1}.test)
+ test_out_dir = $$shadowed($$QMAKE_CONFIG_TESTS_DIR/$$test)
+ unix:exists($$test_out_dir/arch): \
+ content = $$cat($$test_out_dir/arch, blob)
+ else: win32:exists($$test_out_dir/arch.exe): \
+ content = $$cat($$test_out_dir/arch.exe, blob)
+ else: android:exists($$test_out_dir/libarch.so): \
+ content = $$cat($$test_out_dir/libarch.so, blob)
+ else: \
+ error("$$eval($${1}.label) detection binary not found.")
+
+ arch_magic = ".*==Qt=magic=Qt== Architecture:([^\\0]*).*"
+ subarch_magic = ".*==Qt=magic=Qt== Sub-architecture:([^\\0]*).*"
+
+ !contains(content, $$arch_magic)|!contains(content, $$subarch_magic): \
+ error("$$eval($${1}.label) detection binary does not contain expected data.")
+
+ $${1}.arch = $$replace(content, $$arch_magic, "\\1")
+ $${1}.subarch = $$replace(content, $$subarch_magic, "\\1")
+ $${1}.subarch = $$split($${1}.subarch, " ")
+ export($${1}.arch)
+ export($${1}.subarch)
+ qtLog("Detected architecture: $$eval($${1}.arch) ($$eval($${1}.subarch))")
+
+ $${1}.cache += arch subarch
+ export($${1}.cache)
+ return(true)
+}
+
+defineTest(qtConfTest_avx_test_apple_clang) {
+ !*g++*:!*-clang*: return(true)
+
+ qtRunLoggedCommand("$$QMAKE_CXX --version", compiler)|return(false)
+ contains(compiler, "Apple clang version [23]") {
+ # Some clang versions produce internal compiler errors compiling Qt AVX code
+ return(false)
+ } else {
+ return(true)
+ }
+}
+
+defineTest(qtConfTest_gnumake) {
+ make = $$qtConfFindInPath("gmake")
+ isEmpty(make): make = $$qtConfFindInPath("make")
+ !isEmpty(make) {
+ qtRunLoggedCommand("$$make -v", version)|return(false)
+ contains(version, "^GNU Make.*"): return(true)
+ }
+ return(false)
+}
+
+defineTest(qtConfTest_detectPkgConfig) {
+ pkgConfig = $$getenv("PKG_CONFIG")
+ !isEmpty(pkgConfig): {
+ qtLog("Found pkg-config from environment variable: $$pkgConfig")
+ } else {
+ pkgConfig = $$PKG_CONFIG
+
+ !isEmpty(pkgConfig) {
+ qtLog("Found pkg-config from mkspec: $$pkgConfig")
+ } else {
+ pkgConfig = $$qtConfFindInPath("pkg-config")
+
+ isEmpty(pkgConfig): \
+ return(false)
+
+ qtLog("Found pkg-config from path: $$pkgConfig")
+ }
+ }
+
+ $$qtConfEvaluate("features.cross_compile") {
+ # cross compiling, check that pkg-config is set up sanely
+ sysroot = $$config.input.sysroot
+
+ pkgConfigLibdir = $$getenv("PKG_CONFIG_LIBDIR")
+ isEmpty(pkgConfigLibdir) {
+ isEmpty(sysroot) {
+ qtConfAddWarning("Cross compiling without sysroot. Disabling pkg-config")
+ return(false)
+ }
+ !exists("$$sysroot/usr/lib/pkgconfig") {
+ qtConfAddWarning( \
+ "Disabling pkg-config since PKG_CONFIG_LIBDIR is not set and" \
+ "the host's .pc files would be used (even if you set PKG_CONFIG_PATH)." \
+ "Set this variable to the directory that contains target .pc files" \
+ "for pkg-config to function correctly when cross-compiling or" \
+ "use -pkg-config to override this test.")
+ return(false)
+ }
+
+ pkgConfigLibdir = $$sysroot/usr/lib/pkgconfig:$$sysroot/usr/share/pkgconfig
+ gcc {
+ qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine", gccMachineDump): \
+ !isEmpty(gccMachineDump): \
+ pkgConfigLibdir = "$$pkgConfigLibdir:$$sysroot/usr/lib/$$gccMachineDump/pkgconfig"
+ }
+
+ qtConfAddNote("PKG_CONFIG_LIBDIR automatically set to $$pkgConfigLibdir")
+ }
+ pkgConfigSysrootDir = $$getenv("PKG_CONFIG_SYSROOT_DIR")
+ isEmpty(pkgConfigSysrootDir) {
+ isEmpty(sysroot) {
+ qtConfAddWarning( \
+ "Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set." \
+ "Set this variable to your sysroot for pkg-config to function correctly when" \
+ "cross-compiling or use -pkg-config to override this test.")
+ return(false)
+ }
+
+ pkgConfigSysrootDir = $$sysroot
+ qtConfAddNote("PKG_CONFIG_SYSROOT_DIR automatically set to $$pkgConfigSysrootDir")
+ }
+ $${1}.pkgConfigLibdir = $$pkgConfigLibdir
+ export($${1}.pkgConfigLibdir)
+ $${1}.pkgConfigSysrootDir = $$pkgConfigSysrootDir
+ export($${1}.pkgConfigSysrootDir)
+ $${1}.cache += pkgConfigLibdir pkgConfigSysrootDir
+ }
+ $${1}.pkgConfig = $$pkgConfig
+ export($${1}.pkgConfig)
+ $${1}.cache += pkgConfig
+ export($${1}.cache)
+
+ return(true)
+}
+
+defineTest(qtConfTest_neon) {
+ contains($${currentConfig}.tests.architecture.subarch, "neon"): return(true)
+ return(false)
+}
+
+defineTest(qtConfTest_buildParts) {
+ parts = $$config.input.make
+ isEmpty(parts) {
+ parts = libs examples
+
+ $$qtConfEvaluate("features.developer-build"): \
+ parts += tests
+ !$$qtConfEvaluate("features.cross_compile"): \
+ parts += tools
+ }
+
+ parts -= $$config.input.nomake
+
+ # always add libs, as it's required to build Qt
+ parts *= libs
+
+ $${1}.value = $$parts
+ export($${1}.value)
+ $${1}.cache = -
+ export($${1}.cache)
+ return(true)
+}
+
+defineTest(qtConfTest_checkCompiler) {
+ contains(QMAKE_CXX, ".*clang.*") {
+ qtRunLoggedCommand("$$QMAKE_CXX -v 2>&1", versionstr)|return(false)
+ contains(versionstr, "^Apple (clang|LLVM) version .*") {
+ $${1}.compilerDescription = "Apple Clang"
+ $${1}.compilerId = "apple_clang"
+ $${1}.compilerVersion = $$replace(versionstr, "^Apple (clang|LLVM) version ([0-9.]+).*$", "\\2")
+ } else: contains(versionstr, ".*clang version.*") {
+ $${1}.compilerDescription = "Clang"
+ $${1}.compilerId = "clang"
+ $${1}.compilerVersion = $$replace(versionstr, "^.*clang version ([0-9.]+).*", "\\1")
+ } else {
+ return(false)
+ }
+ } else: contains(QMAKE_CXX, ".*g\\+\\+.*") {
+ qtRunLoggedCommand("$$QMAKE_CXX -dumpversion", version)|return(false)
+ $${1}.compilerDescription = "GCC"
+ $${1}.compilerId = "gcc"
+ $${1}.compilerVersion = $$version
+ } else: contains(QMAKE_CXX, ".*icpc" ) {
+ qtRunLoggedCommand("$$QMAKE_CXX -v", version)|return(false)
+ $${1}.compilerDescription = "ICC"
+ $${1}.compilerId = "icc"
+ $${1}.compilerVersion = $$replace(version, "icpc version ([0-9.]+).*", "\\1")
+ } else: msvc {
+ qtRunLoggedCommand("$$QMAKE_CXX /? 2>&1", version)|return(false)
+ version = "$$version"
+ $${1}.compilerDescription = "MSVC"
+ $${1}.compilerId = "cl"
+ $${1}.compilerVersion = $$replace(version, "^.*Compiler Version ([0-9.]+) for.*$", "\\1")
+ } else {
+ return(false)
+ }
+ $${1}.compilerDescription += $$eval($${1}.compilerVersion)
+ export($${1}.compilerDescription)
+ export($${1}.compilerId)
+ export($${1}.compilerVersion)
+ $${1}.cache += compilerDescription compilerId compilerVersion
+ export($${1}.cache)
+ return(true)
+}
+
+# custom outputs
+
+defineTest(qtConfOutput_shared) {
+ !$${2}: return()
+
+ # export this here, so later tests can use it
+ CONFIG += shared
+ export(CONFIG)
+}
+
+defineTest(qtConfOutput_architecture) {
+ arch = $$qtConfEvaluate("tests.architecture.arch")
+
+ $$qtConfEvaluate("features.cross_compile") {
+ host_arch = $$qtConfEvaluate("tests.host_architecture.arch")
+
+ privatePro = \
+ "host_build {" \
+ " QT_CPU_FEATURES.$$host_arch = $$qtConfEvaluate('tests.host_architecture.subarch')" \
+ "} else {" \
+ " QT_CPU_FEATURES.$$arch = $$qtConfEvaluate('tests.architecture.subarch')" \
+ "}"
+ publicPro = \
+ "host_build {" \
+ " QT_ARCH = $$host_arch" \
+ " QT_TARGET_ARCH = $$arch" \
+ "} else {" \
+ " QT_ARCH = $$arch" \
+ "}"
+
+ } else {
+ privatePro = \
+ "QT_CPU_FEATURES.$$arch = $$qtConfEvaluate('tests.architecture.subarch')"
+ publicPro = \
+ "QT_ARCH = $$arch"
+ }
+
+ $${currentConfig}.output.publicPro += $$publicPro
+ export($${currentConfig}.output.publicPro)
+ $${currentConfig}.output.privatePro += $$privatePro
+ export($${currentConfig}.output.privatePro)
+
+ # setup QT_ARCH variable used by qtConfEvaluate
+ QT_ARCH = $$arch
+ export(QT_ARCH)
+}
+
+defineTest(qtConfOutput_qreal) {
+ qreal = $$config.input.qreal
+ isEmpty(qreal): qreal = "double"
+ qreal_string = $$replace(qreal, [^a-zA-Z0-9], "_")
+ qtConfOutputVar(assign, "privatePro", "QT_COORD_TYPE", $$qreal)
+ !equals(qreal, "double") {
+ qtConfOutputSetDefine("publicHeader", "QT_COORD_TYPE", $$qreal)
+ qtConfOutputSetDefine("publicHeader", "QT_COORD_TYPE_STRING", "\"$$qreal_string\"")
+ }
+}
+
+defineTest(qtConfOutput_pkgConfig) {
+ !$${2}: return()
+
+ PKG_CONFIG = $$eval($${currentConfig}.tests.pkg-config.pkgConfig)
+ export(PKG_CONFIG)
+ # this method also exports PKG_CONFIG_(LIB|SYSROOT)DIR, so that tests using pkgConfig will work correctly
+ PKG_CONFIG_SYSROOT_DIR = $$eval($${currentConfig}.tests.pkg-config.pkgConfigSysrootDir)
+ !isEmpty(PKG_CONFIG_SYSROOT_DIR) {
+ qtConfOutputVar(assign, "publicPro", "PKG_CONFIG_SYSROOT_DIR", $$PKG_CONFIG_SYSROOT_DIR)
+ export(PKG_CONFIG_SYSROOT_DIR)
+ }
+ PKG_CONFIG_LIBDIR = $$eval($${currentConfig}.tests.pkg-config.pkgConfigLibdir)
+ !isEmpty(PKG_CONFIG_LIBDIR) {
+ qtConfOutputVar(assign, "publicPro", "PKG_CONFIG_LIBDIR", $$PKG_CONFIG_LIBDIR)
+ export(PKG_CONFIG_LIBDIR)
+ }
+}
+
+defineTest(qtConfOutput_useGoldLinker) {
+ !$${2}: return()
+
+ # We need to preempt the output here, so that qtConfTest_linkerSupportsFlag can work properly in qtbase
+ CONFIG += use_gold_linker
+ export(CONFIG)
+}
+
+defineTest(qtConfOutput_debugAndRelease) {
+ $$qtConfEvaluate("features.debug") {
+ qtConfOutputVar(append, "publicPro", "CONFIG", "debug")
+ $${2}: qtConfOutputVar(append, "publicPro", "QT_CONFIG", "release")
+ qtConfOutputVar(append, "publicPro", "QT_CONFIG", "debug")
+ } else {
+ qtConfOutputVar(append, "publicPro", "CONFIG", "release")
+ $${2}: qtConfOutputVar(append, "publicPro", "QT_CONFIG", "debug")
+ qtConfOutputVar(append, "publicPro", "QT_CONFIG", "release")
+ }
+}
+
+defineTest(qtConfOutput_compilerVersion) {
+ !$${2}: return()
+
+ name = $$upper($$eval($${currentConfig}.tests.compiler.compilerId))
+ version = $$eval($${currentConfig}.tests.compiler.compilerVersion)
+ major = $$section(version, '.', 0, 0)
+ minor = $$section(version, '.', 1, 1)
+ patch = $$section(version, '.', 2, 2)
+ isEmpty(minor): minor = 0
+ isEmpty(patch): patch = 0
+
+ $${currentConfig}.output.publicPro += \
+ "QT_$${name}_MAJOR_VERSION = $$major" \
+ "QT_$${name}_MINOR_VERSION = $$minor" \
+ "QT_$${name}_PATCH_VERSION = $$patch"
+
+ export($${currentConfig}.output.publicPro)
+}
+
+defineTest(qtConfOutput_compilerFlags) {
+ # this output also exports the variables locally, so that subsequent compiler tests can use them
+
+ output =
+ !isEmpty(config.input.wflags) {
+ wflags = $$join(config.input.wflags, " -W", "-W")
+ QMAKE_CFLAGS_WARN_ON += $$wflags
+ QMAKE_CXXFLAGS_WARN_ON += $$wflags
+ export(QMAKE_CFLAGS_WARN_ON)
+ export(QMAKE_CXXFLAGS_WARN_ON)
+ output += \
+ "QMAKE_CFLAGS_WARN_ON += $$wflags" \
+ "QMAKE_CXXFLAGS_WARN_ON += $$wflags"
+ }
+ !isEmpty(config.input.defines) {
+ EXTRA_DEFINES += $$config.input.defines
+ export(EXTRA_DEFINES)
+ output += "EXTRA_DEFINES += $$val_escape(config.input.defines)"
+ }
+ !isEmpty(config.input.includes) {
+ EXTRA_INCLUDEPATH += $$config.input.includes
+ export(EXTRA_INCLUDEPATH)
+ output += "EXTRA_INCLUDEPATH += $$val_escape(config.input.includes)"
+ }
+
+ !isEmpty(config.input.lpaths) {
+ EXTRA_LIBDIR += $$config.input.lpaths
+ export(EXTRA_LIBDIR)
+ output += "EXTRA_LIBDIR += $$val_escape(config.input.lpaths)"
+ }
+ darwin:!isEmpty(config.input.fpaths) {
+ EXTRA_FRAMEWORKPATH += $$config.input.fpaths
+ export(EXTRA_FRAMEWORKPATH)
+ output += "EXTRA_FRAMEWORKPATH += $$val_escape(config.input.fpaths)"
+ }
+
+ $${currentConfig}.output.privatePro += $$output
+ export($${currentConfig}.output.privatePro)
+}
+
+defineTest(qtConfOutput_gccSysroot) {
+ !$${2}: return()
+
+ # This variable also needs to be exported immediately, so the compilation tests
+ # can pick it up.
+ EXTRA_QMAKE_ARGS += \
+ "\"QMAKE_CFLAGS += --sysroot=$$config.input.sysroot\"" \
+ "\"QMAKE_CXXFLAGS += --sysroot=$$config.input.sysroot\"" \
+ "\"QMAKE_LFLAGS += --sysroot=$$config.input.sysroot\""
+ export(EXTRA_QMAKE_ARGS)
+
+ output = \
+ "!host_build {" \
+ " QMAKE_CFLAGS += --sysroot=\$\$[QT_SYSROOT]" \
+ " QMAKE_CXXFLAGS += --sysroot=\$\$[QT_SYSROOT]" \
+ " QMAKE_LFLAGS += --sysroot=\$\$[QT_SYSROOT]" \
+ "}"
+ $${currentConfig}.output.publicPro += $$output
+ export($${currentConfig}.output.publicPro)
+}
+
+defineTest(qtConfOutput_qmakeArgs) {
+ !$${2}: return()
+
+ $${currentConfig}.output.privatePro = "!host_build {"
+ for (a, config.input.qmakeArgs) {
+ $${currentConfig}.output.privatePro += " $$a"
+ EXTRA_QMAKE_ARGS += $$system_quote($$a)
+ }
+ $${currentConfig}.output.privatePro += "}"
+ export(EXTRA_QMAKE_ARGS)
+ export($${currentConfig}.output.privatePro)
+}
+
+defineTest(qtConfOutputPostProcess_publicPro) {
+ qt_version = $$[QT_VERSION]
+ output = \
+ "QT_VERSION = $$qt_version" \
+ "QT_MAJOR_VERSION = $$section(qt_version, '.', 0, 0)" \
+ "QT_MINOR_VERSION = $$section(qt_version, '.', 1, 1)" \
+ "QT_PATCH_VERSION = $$section(qt_version, '.', 2, 2)"
+
+ #libinfix and namespace
+ !isEmpty(config.input.qt_libinfix): output += "QT_LIBINFIX = $$config.input.qt_libinfix"
+ !isEmpty(config.input.qt_namespace): output += "QT_NAMESPACE = $$config.input.qt_namespace"
+
+ output += "QT_EDITION = $$config.input.qt_edition"
+ !contains(config.input.qt_edition, "(OpenSource|Preview)") {
+ output += \
+ "QT_LICHECK = $$config.input.qt_licheck" \
+ "QT_RELEASE_DATE = $$config.input.qt_release_date"
+ }
+
+ $${currentConfig}.output.publicPro += $$output
+ export($${currentConfig}.output.publicPro)
+}
+
+defineTest(qtConfOutputPostProcess_publicHeader) {
+ qt_version = $$[QT_VERSION]
+ output = \
+ "$${LITERAL_HASH}define QT_VERSION_STR \"$$qt_version\"" \
+ "$${LITERAL_HASH}define QT_VERSION_MAJOR $$section(qt_version, '.', 0, 0)" \
+ "$${LITERAL_HASH}define QT_VERSION_MINOR $$section(qt_version, '.', 1, 1)" \
+ "$${LITERAL_HASH}define QT_VERSION_PATCH $$section(qt_version, '.', 2, 2)"
+
+ !$$qtConfEvaluate("features.shared") {
+ output += \
+ "/* Qt was configured for a static build */" \
+ "$${LITERAL_HASH}if !defined(QT_SHARED) && !defined(QT_STATIC)" \
+ "$${LITERAL_HASH} define QT_STATIC" \
+ "$${LITERAL_HASH}endif"
+ }
+
+ !isEmpty(config.input.qt_libinfix): \
+ output += "$${LITERAL_HASH}define QT_LIBINFIX \"$$eval(config.input.qt_libinfix)\""
+
+ $${currentConfig}.output.publicHeader += $$output
+ export($${currentConfig}.output.publicHeader)
+}
+
+
+# custom reporting
+
+defineTest(qtConfReport_buildParts) {
+ qtConfReportPadded($${1}, $$qtConfEvaluate("tests.build_parts.value"))
+}
+
+defineTest(qtConfReport_buildTypeAndConfig) {
+ !$$qtConfEvaluate("features.cross_compile") {
+ qtConfAddReport("Build type: $$qtConfEvaluate('tests.architecture.arch')")
+ } else {
+ qtConfAddReport("Building on: $$qtConfEvaluate('tests.host_architecture.arch')")
+ qtConfAddReport("Building for: $$qtConfEvaluate('tests.architecture.arch')")
+ }
+ qtConfAddReport()
+ qtConfAddReport("Configuration: $$eval($${currentConfig}.output.privatePro.append.CONFIG) $$eval($${currentConfig}.output.publicPro.append.QT_CONFIG)")
+ qtConfAddReport()
+}
+
+defineTest(qtConfReport_buildMode) {
+ $$qtConfEvaluate("features.force_debug_info"): \
+ release = "release (with debug info)"
+ else: \
+ release = "release"
+
+ $$qtConfEvaluate("features.debug"): \
+ build_mode = "debug"
+ else: \
+ build_mode = $$release
+
+ $$qtConfEvaluate("features.debug_and_release"): \
+ build_mode = "debug and $$release; default link: $$build_mode"
+
+ $$qtConfEvaluate("features.release_tools"): \
+ build_mode = "$$build_mode; optimized tools"
+
+ qtConfReportPadded($$1, $$build_mode)
+}
+
+# ensure pristine environment for configuration
+discard_from($$[QT_HOST_DATA/get]/mkspecs/qconfig.pri)
+discard_from($$[QT_HOST_DATA/get]/mkspecs/qmodule.pri)
+# ... and cause them to be reloaded afterwards
+QMAKE_POST_CONFIGURE += \
+ "include(\$\$[QT_HOST_DATA/get]/mkspecs/qconfig.pri)" \
+ "include(\$\$[QT_HOST_DATA/get]/mkspecs/qmodule.pri)"
+
+# load and process input from configure.sh/.exe
+include($$shadowed($$PWD)/config.tests/configure.cfg)
diff --git a/doc/global/config.qdocconf b/doc/global/config.qdocconf
index 97357345c9..ac9e7ac274 100644
--- a/doc/global/config.qdocconf
+++ b/doc/global/config.qdocconf
@@ -10,6 +10,6 @@ dita.metadata.default.audience = programmer
#Set the main Qt index.html
navigation.homepage = "Qt $QT_VER"
-sourcedirs += includes
+sourcedirs += includes $$BUILDDIR
url = http://doc.qt.io/qt-5
diff --git a/doc/global/externalsites/qt-webpages.qdoc b/doc/global/externalsites/qt-webpages.qdoc
index 5eea92c601..f17f85da9f 100644
--- a/doc/global/externalsites/qt-webpages.qdoc
+++ b/doc/global/externalsites/qt-webpages.qdoc
@@ -37,6 +37,10 @@
\title Downloads
*/
/*!
+ \externalpage http://www.qt.io/about-us/
+ \title The Qt Company
+*/
+/*!
\externalpage http://qt.io/licensing/
\title Qt Licensing Overview
*/
diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf
index 54d2cbbe4e..13e523411a 100644
--- a/doc/global/qt-cpp-defines.qdocconf
+++ b/doc/global/qt-cpp-defines.qdocconf
@@ -68,6 +68,7 @@ Cpp.ignoretokens += \
Q_LOCATION_EXPORT \
Q_POSITIONING_EXPORT \
Q_MULTIMEDIA_EXPORT \
+ Q_NAMESPACE \
Q_NETWORK_EXPORT \
Q_NEVER_INLINE \
Q_NORETURN \
diff --git a/examples/corelib/ipc/ipc.pro b/examples/corelib/ipc/ipc.pro
index 65ee98a2cf..4cc5f3be56 100644
--- a/examples/corelib/ipc/ipc.pro
+++ b/examples/corelib/ipc/ipc.pro
@@ -3,4 +3,4 @@ requires(qtHaveModule(widgets))
TEMPLATE = subdirs
# no QSharedMemory
!vxworks:!integrity: SUBDIRS = sharedmemory
-!wince:qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient
+qtHaveModule(network): SUBDIRS += localfortuneserver localfortuneclient
diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h
index 14946b44fb..cbacc2cdd0 100644
--- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h
+++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h
@@ -65,15 +65,15 @@ public:
MandelbrotWidget(QWidget *parent = 0);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *event) override;
#endif
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
private slots:
void updatePixmap(const QImage &image, double scaleFactor);
diff --git a/examples/corelib/threads/mandelbrot/renderthread.h b/examples/corelib/threads/mandelbrot/renderthread.h
index b9b59ba4cf..b5e9226fb8 100644
--- a/examples/corelib/threads/mandelbrot/renderthread.h
+++ b/examples/corelib/threads/mandelbrot/renderthread.h
@@ -75,7 +75,7 @@ signals:
void renderedImage(const QImage &image, double scaleFactor);
protected:
- void run() Q_DECL_OVERRIDE;
+ void run() override;
private:
uint rgbFromWaveLength(double wave);
diff --git a/examples/corelib/threads/semaphores/semaphores.cpp b/examples/corelib/threads/semaphores/semaphores.cpp
index f44f709d72..37dd4cda20 100644
--- a/examples/corelib/threads/semaphores/semaphores.cpp
+++ b/examples/corelib/threads/semaphores/semaphores.cpp
@@ -68,7 +68,7 @@ class Producer : public QThread
//! [1] //! [2]
{
public:
- void run() Q_DECL_OVERRIDE
+ void run() override
{
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
for (int i = 0; i < DataSize; ++i) {
@@ -86,7 +86,7 @@ class Consumer : public QThread
{
Q_OBJECT
public:
- void run() Q_DECL_OVERRIDE
+ void run() override
{
for (int i = 0; i < DataSize; ++i) {
usedBytes.acquire();
diff --git a/examples/corelib/threads/waitconditions/waitconditions.cpp b/examples/corelib/threads/waitconditions/waitconditions.cpp
index 7040246937..9eab28f94c 100644
--- a/examples/corelib/threads/waitconditions/waitconditions.cpp
+++ b/examples/corelib/threads/waitconditions/waitconditions.cpp
@@ -74,7 +74,7 @@ public:
{
}
- void run() Q_DECL_OVERRIDE
+ void run() override
{
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
@@ -105,7 +105,7 @@ public:
{
}
- void run() Q_DECL_OVERRIDE
+ void run() override
{
for (int i = 0; i < DataSize; ++i) {
mutex.lock();
diff --git a/examples/corelib/tools/contiguouscache/randomlistmodel.h b/examples/corelib/tools/contiguouscache/randomlistmodel.h
index f1f9bd247e..e6192b434f 100644
--- a/examples/corelib/tools/contiguouscache/randomlistmodel.h
+++ b/examples/corelib/tools/contiguouscache/randomlistmodel.h
@@ -62,8 +62,8 @@ public:
RandomListModel(QObject *parent = 0);
~RandomListModel();
- int rowCount(const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &, int) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex & = QModelIndex()) const override;
+ QVariant data(const QModelIndex &, int) const override;
private:
void cacheRows(int, int) const;
diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro
index 083e442dfb..afeb1de0d5 100644
--- a/examples/dbus/dbus.pro
+++ b/examples/dbus/dbus.pro
@@ -2,8 +2,9 @@ requires(qtHaveModule(dbus))
TEMPLATE = subdirs
SUBDIRS = listnames \
- pingpong \
- complexpingpong
+ pingpong
+
+!uikit: SUBDIRS += complexpingpong
qtHaveModule(widgets) {
SUBDIRS += chat \
diff --git a/examples/examples.pro b/examples/examples.pro
index bcc13704dc..b57d281384 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -15,7 +15,7 @@ SUBDIRS = \
widgets \
xml
-contains(QT_CONFIG, opengl): SUBDIRS += opengl
+qtConfig(opengl): SUBDIRS += opengl
aggregate.files = aggregate/examples.pro
aggregate.path = $$[QT_INSTALL_EXAMPLES]
diff --git a/examples/gui/analogclock/main.cpp b/examples/gui/analogclock/main.cpp
index 29b21410e3..053ccb54b5 100644
--- a/examples/gui/analogclock/main.cpp
+++ b/examples/gui/analogclock/main.cpp
@@ -59,8 +59,8 @@ public:
AnalogClockWindow();
protected:
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
- void render(QPainter *p) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
+ void render(QPainter *p) override;
private:
int m_timerId;
diff --git a/examples/gui/doc/src/openglwindow.qdoc b/examples/gui/doc/src/openglwindow.qdoc
index e93451c9a5..f283c7cfc0 100644
--- a/examples/gui/doc/src/openglwindow.qdoc
+++ b/examples/gui/doc/src/openglwindow.qdoc
@@ -34,6 +34,9 @@
\image openglwindow-example.png Screenshot of the OpenGLWindow example
+ \note This is a low level example of how to use QWindow with OpenGL.
+ In practice you should consider using the higher level QOpenGLWindow class.
+
\section1 OpenGLWindow Super Class
Our OpenGLWindow class acts as an API which is then subclassed to do the
@@ -70,9 +73,8 @@
\snippet openglwindow/openglwindow.cpp 2
- The renderLater() function simply puts an update request event on
- the event loop, which leads to renderNow() being called once the event
- gets processed.
+ The renderLater() function simply calls QWindow::requestUpdate() to schedule
+ an update for when the system is ready to repaint.
We also call renderNow() when we get an expose event. The exposeEvent() is
the notification to the window that its exposure, meaning visibility, on
@@ -109,11 +111,11 @@
\l {http://www.khronos.org/registry/gles/}{Khronos OpenGL ES API Registry}.
If animation has been enabled with OpenGLWindow::setAnimating(true), we
- call renderLater() to put another update request on the event loop.
+ call renderLater() to schedule another update request.
\snippet openglwindow/openglwindow.cpp 4
- Enabling animation also triggers an update request as shown in the
+ Enabling animation also schedules an update request as shown in the
following code snippet.
\snippet openglwindow/openglwindow.cpp 5
diff --git a/examples/gui/doc/src/rasterwindow.qdoc b/examples/gui/doc/src/rasterwindow.qdoc
index 963d09971d..d276925059 100644
--- a/examples/gui/doc/src/rasterwindow.qdoc
+++ b/examples/gui/doc/src/rasterwindow.qdoc
@@ -143,19 +143,16 @@
\snippet rasterwindow/rasterwindow.cpp 6
We went through a few places where the window needed to repainted
- immediately. There are some cases where this is not desierable,
+ immediately. There are some cases where this is not desirable,
but rather let the application return to the event loop and
- later. We acheive this by posting an even to ourself which will
- then be delivered when the application returns to the \l
- QGuiApplication event loop. To avoid posting new requests when one
- is already pending, we store this state in the \c m_update_pending
- variable.
+ schedule the repaint for later. We achieve this by requesting
+ an update, using QWindow::requestUpdate(), which will then be
+ delivered when the system is ready to repaint.
\snippet rasterwindow/rasterwindow.cpp 7
We reimplement the virtual \l QObject::event() function to handle
- the update event we posted to ourselves. When the event comes in
- we reset the pending update flag and call renderNow() to render
- the window right away.
+ the update event. When the event comes in we call renderNow() to
+ render the window right away.
*/
diff --git a/examples/gui/gui.pro b/examples/gui/gui.pro
index 3a63ffb5eb..a4d960d3f5 100644
--- a/examples/gui/gui.pro
+++ b/examples/gui/gui.pro
@@ -1,10 +1,10 @@
requires(qtHaveModule(gui))
TEMPLATE = subdirs
+QT_FOR_CONFIG += gui
CONFIG += no_docs_target
SUBDIRS += analogclock
SUBDIRS += rasterwindow
-contains(QT_CONFIG, opengl(es2)?) {
+qtConfig(opengl): \
SUBDIRS += openglwindow
-}
diff --git a/examples/gui/openglwindow/main.cpp b/examples/gui/openglwindow/main.cpp
index ba56ba39f5..90c93f0d37 100644
--- a/examples/gui/openglwindow/main.cpp
+++ b/examples/gui/openglwindow/main.cpp
@@ -63,8 +63,8 @@ class TriangleWindow : public OpenGLWindow
public:
TriangleWindow();
- void initialize() Q_DECL_OVERRIDE;
- void render() Q_DECL_OVERRIDE;
+ void initialize() override;
+ void render() override;
private:
GLuint m_posAttr;
diff --git a/examples/gui/openglwindow/openglwindow.cpp b/examples/gui/openglwindow/openglwindow.cpp
index d36614f6a0..57a996a876 100644
--- a/examples/gui/openglwindow/openglwindow.cpp
+++ b/examples/gui/openglwindow/openglwindow.cpp
@@ -59,7 +59,6 @@
//! [1]
OpenGLWindow::OpenGLWindow(QWindow *parent)
: QWindow(parent)
- , m_update_pending(false)
, m_animating(false)
, m_context(0)
, m_device(0)
@@ -99,17 +98,13 @@ void OpenGLWindow::render()
//! [3]
void OpenGLWindow::renderLater()
{
- if (!m_update_pending) {
- m_update_pending = true;
- QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
- }
+ requestUpdate();
}
bool OpenGLWindow::event(QEvent *event)
{
switch (event->type()) {
case QEvent::UpdateRequest:
- m_update_pending = false;
renderNow();
return true;
default:
diff --git a/examples/gui/openglwindow/openglwindow.h b/examples/gui/openglwindow/openglwindow.h
index 820eaf1b8f..6e6c1d7449 100644
--- a/examples/gui/openglwindow/openglwindow.h
+++ b/examples/gui/openglwindow/openglwindow.h
@@ -77,12 +77,11 @@ public slots:
void renderNow();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
- void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
+ void exposeEvent(QExposeEvent *event) override;
private:
- bool m_update_pending;
bool m_animating;
QOpenGLContext *m_context;
diff --git a/examples/gui/rasterwindow/rasterwindow.cpp b/examples/gui/rasterwindow/rasterwindow.cpp
index eb34bec252..fb717a4c8a 100644
--- a/examples/gui/rasterwindow/rasterwindow.cpp
+++ b/examples/gui/rasterwindow/rasterwindow.cpp
@@ -53,7 +53,6 @@
//! [1]
RasterWindow::RasterWindow(QWindow *parent)
: QWindow(parent)
- , m_update_pending(false)
{
create();
m_backingStore = new QBackingStore(this);
@@ -68,7 +67,6 @@ RasterWindow::RasterWindow(QWindow *parent)
bool RasterWindow::event(QEvent *event)
{
if (event->type() == QEvent::UpdateRequest) {
- m_update_pending = false;
renderNow();
return true;
}
@@ -79,10 +77,7 @@ bool RasterWindow::event(QEvent *event)
//! [6]
void RasterWindow::renderLater()
{
- if (!m_update_pending) {
- m_update_pending = true;
- QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
- }
+ requestUpdate();
}
//! [6]
@@ -99,9 +94,8 @@ void RasterWindow::resizeEvent(QResizeEvent *resizeEvent)
//! [2]
void RasterWindow::exposeEvent(QExposeEvent *)
{
- if (isExposed()) {
+ if (isExposed())
renderNow();
- }
}
//! [2]
diff --git a/examples/gui/rasterwindow/rasterwindow.h b/examples/gui/rasterwindow/rasterwindow.h
index f03975a808..2ccecbf704 100644
--- a/examples/gui/rasterwindow/rasterwindow.h
+++ b/examples/gui/rasterwindow/rasterwindow.h
@@ -67,14 +67,13 @@ public slots:
void renderNow();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) override;
+ void exposeEvent(QExposeEvent *event) override;
private:
QBackingStore *m_backingStore;
- bool m_update_pending;
};
//! [1]
#endif // RASTERWINDOW_H
diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro
index f364fabf2d..d75e021834 100644
--- a/examples/network/bearermonitor/bearermonitor.pro
+++ b/examples/network/bearermonitor/bearermonitor.pro
@@ -12,8 +12,7 @@ FORMS = bearermonitor_240_320.ui \
bearermonitor_640_480.ui \
sessionwidget.ui
-win32:!wince: LIBS += -lws2_32
-wince: LIBS += -lws2
+win32:LIBS += -lws2_32
CONFIG += console
diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h
index 6bc0aef7c1..ba352eefee 100644
--- a/examples/network/bearermonitor/sessionwidget.h
+++ b/examples/network/bearermonitor/sessionwidget.h
@@ -65,7 +65,7 @@ public:
explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
~SessionWidget();
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
private:
void updateSessionState(QNetworkSession::State state);
diff --git a/examples/network/blockingfortuneclient/fortunethread.h b/examples/network/blockingfortuneclient/fortunethread.h
index 2ab1adb921..0cbc3961fc 100644
--- a/examples/network/blockingfortuneclient/fortunethread.h
+++ b/examples/network/blockingfortuneclient/fortunethread.h
@@ -65,7 +65,7 @@ public:
~FortuneThread();
void requestNewFortune(const QString &hostName, quint16 port);
- void run() Q_DECL_OVERRIDE;
+ void run() override;
signals:
void newFortune(const QString &fortune);
diff --git a/examples/network/googlesuggest/googlesuggest.h b/examples/network/googlesuggest/googlesuggest.h
index 561d94efde..1d42f31571 100644
--- a/examples/network/googlesuggest/googlesuggest.h
+++ b/examples/network/googlesuggest/googlesuggest.h
@@ -70,7 +70,7 @@ class GSuggestCompletion : public QObject
public:
GSuggestCompletion(QLineEdit *parent = 0);
~GSuggestCompletion();
- bool eventFilter(QObject *obj, QEvent *ev) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *obj, QEvent *ev) override;
void showCompletion(const QStringList &choices);
public slots:
diff --git a/examples/network/multistreamclient/chatconsumer.cpp b/examples/network/multistreamclient/chatconsumer.cpp
new file mode 100644
index 0000000000..723ecfaa23
--- /dev/null
+++ b/examples/network/multistreamclient/chatconsumer.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chatconsumer.h"
+#include <QWidget>
+#include <QTextEdit>
+#include <QLineEdit>
+#include <QVBoxLayout>
+#include <QString>
+
+ChatConsumer::ChatConsumer(QObject *parent)
+ : Consumer(parent)
+{
+ frameWidget = new QWidget;
+ frameWidget->setFocusPolicy(Qt::TabFocus);
+
+ textEdit = new QTextEdit;
+ textEdit->setFocusPolicy(Qt::NoFocus);
+ textEdit->setReadOnly(true);
+
+ lineEdit = new QLineEdit;
+ frameWidget->setFocusProxy(lineEdit);
+
+ connect(lineEdit, &QLineEdit::returnPressed, this, &ChatConsumer::returnPressed);
+
+ QVBoxLayout *layout = new QVBoxLayout(frameWidget);
+ layout->setContentsMargins( 0, 0, 0, 0);
+ layout->addWidget(textEdit);
+ layout->addWidget(lineEdit);
+}
+
+QWidget *ChatConsumer::widget()
+{
+ return frameWidget;
+}
+
+void ChatConsumer::readDatagram(const QByteArray &ba)
+{
+ textEdit->append(QString::fromUtf8(ba));
+}
+
+void ChatConsumer::returnPressed()
+{
+ emit writeDatagram(lineEdit->text().toUtf8());
+ lineEdit->clear();
+}
diff --git a/examples/network/multistreamclient/chatconsumer.h b/examples/network/multistreamclient/chatconsumer.h
new file mode 100644
index 0000000000..9e12f99359
--- /dev/null
+++ b/examples/network/multistreamclient/chatconsumer.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHATCONSUMER_H
+#define CHATCONSUMER_H
+
+#include "consumer.h"
+
+QT_BEGIN_NAMESPACE
+class QTextEdit;
+class QLineEdit;
+QT_END_NAMESPACE
+
+class ChatConsumer : public Consumer
+{
+ Q_OBJECT
+public:
+ explicit ChatConsumer(QObject *parent = nullptr);
+
+ QWidget *widget() Q_DECL_OVERRIDE;
+ void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE;
+
+private slots:
+ void returnPressed();
+
+private:
+ QWidget *frameWidget;
+ QTextEdit *textEdit;
+ QLineEdit *lineEdit;
+};
+
+#endif
diff --git a/examples/network/multistreamclient/client.cpp b/examples/network/multistreamclient/client.cpp
new file mode 100644
index 0000000000..112fb2e1a0
--- /dev/null
+++ b/examples/network/multistreamclient/client.cpp
@@ -0,0 +1,219 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets>
+#include <QtNetwork>
+
+#include "client.h"
+#include "movieconsumer.h"
+#include "timeconsumer.h"
+#include "chatconsumer.h"
+
+#include "../shared/sctpchannels.h"
+
+Client::Client(QWidget *parent)
+ : QDialog(parent)
+ , consumers(SctpChannels::NumberOfChannels)
+{
+ setWindowTitle(tr("Multi-stream Client"));
+
+ sctpSocket = new QSctpSocket(this);
+
+ QLabel *hostLabel = new QLabel(tr("&Server name:"));
+ QLabel *portLabel = new QLabel(tr("S&erver port:"));
+
+ hostCombo = new QComboBox;
+ hostCombo->setEditable(true);
+ // find out name of this machine
+ QString name = QHostInfo::localHostName();
+ if (!name.isEmpty()) {
+ hostCombo->addItem(name);
+ QString domain = QHostInfo::localDomainName();
+ if (!domain.isEmpty())
+ hostCombo->addItem(name + QChar('.') + domain);
+ }
+ if (name != QString("localhost"))
+ hostCombo->addItem(QString("localhost"));
+ // find out IP addresses of this machine
+ QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
+ // add non-localhost addresses
+ for (int i = 0; i < ipAddressesList.size(); ++i) {
+ if (!ipAddressesList.at(i).isLoopback())
+ hostCombo->addItem(ipAddressesList.at(i).toString());
+ }
+ // add localhost addresses
+ for (int i = 0; i < ipAddressesList.size(); ++i) {
+ if (ipAddressesList.at(i).isLoopback())
+ hostCombo->addItem(ipAddressesList.at(i).toString());
+ }
+
+ portLineEdit = new QLineEdit;
+ portLineEdit->setValidator(new QIntValidator(1, 65535, this));
+
+ hostLabel->setBuddy(hostCombo);
+ portLabel->setBuddy(portLineEdit);
+
+ connectButton = new QPushButton(tr("Connect"));
+ connectButton->setDefault(true);
+ connectButton->setEnabled(false);
+
+ QPushButton *quitButton = new QPushButton(tr("Quit"));
+ quitButton->setAutoDefault(false);
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox;
+ buttonBox->addButton(connectButton, QDialogButtonBox::ActionRole);
+ buttonBox->addButton(quitButton, QDialogButtonBox::AcceptRole);
+
+ QLabel *movieLabel = new QLabel(tr("Movie stream:"));
+ consumers[SctpChannels::Movie] = new MovieConsumer(this);
+ QLabel *timeLabel = new QLabel(tr("Time stream:"));
+ consumers[SctpChannels::Time] = new TimeConsumer(this);
+ QLabel *chatLabel = new QLabel(tr("&Chat:"));
+ consumers[SctpChannels::Chat] = new ChatConsumer(this);
+ chatLabel->setBuddy(consumers[SctpChannels::Chat]->widget());
+
+ connect(hostCombo, &QComboBox::editTextChanged, this, &Client::enableConnectButton);
+ connect(portLineEdit, &QLineEdit::textChanged, this, &Client::enableConnectButton);
+ connect(connectButton, &QPushButton::clicked, this, &Client::requestConnect);
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &Client::accept);
+ connect(sctpSocket, &QSctpSocket::connected, this, &Client::connected);
+ connect(sctpSocket, &QSctpSocket::disconnected, this, &Client::disconnected);
+ connect(sctpSocket, &QSctpSocket::channelReadyRead, this, &Client::readDatagram);
+ connect(sctpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
+ this, SLOT(displayError(QAbstractSocket::SocketError)));
+ connect(consumers[SctpChannels::Time], &Consumer::writeDatagram, this, &Client::writeDatagram);
+ connect(consumers[SctpChannels::Chat], &Consumer::writeDatagram, this, &Client::writeDatagram);
+
+ QGridLayout *mainLayout = new QGridLayout;
+ mainLayout->addWidget(hostLabel, 0, 0);
+ mainLayout->addWidget(hostCombo, 0, 1);
+ mainLayout->addWidget(portLabel, 1, 0);
+ mainLayout->addWidget(portLineEdit, 1, 1);
+ mainLayout->addWidget(buttonBox, 2, 0, 1, 2);
+ mainLayout->addWidget(movieLabel, 3, 0);
+ mainLayout->addWidget(timeLabel, 3, 1);
+ mainLayout->addWidget(consumers[SctpChannels::Movie]->widget(), 4, 0);
+ mainLayout->addWidget(consumers[SctpChannels::Time]->widget(), 4, 1);
+ mainLayout->addWidget(chatLabel, 5, 0);
+ mainLayout->addWidget(consumers[SctpChannels::Chat]->widget(), 6, 0, 1, 2);
+ setLayout(mainLayout);
+
+ portLineEdit->setFocus();
+}
+
+Client::~Client()
+{
+ delete sctpSocket;
+}
+
+void Client::connected()
+{
+ consumers[SctpChannels::Chat]->widget()->setFocus();
+}
+
+void Client::disconnected()
+{
+ for (Consumer *consumer : consumers)
+ consumer->serverDisconnected();
+
+ sctpSocket->close();
+}
+
+void Client::requestConnect()
+{
+ connectButton->setEnabled(false);
+ sctpSocket->abort();
+ sctpSocket->connectToHost(hostCombo->currentText(),
+ portLineEdit->text().toInt());
+}
+
+void Client::readDatagram(int channel)
+{
+ sctpSocket->setCurrentReadChannel(channel);
+ consumers[channel]->readDatagram(sctpSocket->readDatagram().data());
+}
+
+void Client::displayError(QAbstractSocket::SocketError socketError)
+{
+ switch (socketError) {
+ case QAbstractSocket::HostNotFoundError:
+ QMessageBox::information(this, tr("Multi-stream Client"),
+ tr("The host was not found. Please check the "
+ "host name and port settings."));
+ break;
+ case QAbstractSocket::ConnectionRefusedError:
+ QMessageBox::information(this, tr("Multi-stream Client"),
+ tr("The connection was refused by the peer. "
+ "Make sure the multi-stream server is running, "
+ "and check that the host name and port "
+ "settings are correct."));
+ break;
+ default:
+ QMessageBox::information(this, tr("Multi-stream Client"),
+ tr("The following error occurred: %1.")
+ .arg(sctpSocket->errorString()));
+ }
+
+ enableConnectButton();
+}
+
+void Client::enableConnectButton()
+{
+ connectButton->setEnabled(!hostCombo->currentText().isEmpty() &&
+ !portLineEdit->text().isEmpty());
+}
+
+void Client::writeDatagram(const QByteArray &ba)
+{
+ if (sctpSocket->isValid() && sctpSocket->state() == QAbstractSocket::ConnectedState) {
+ sctpSocket->setCurrentWriteChannel(consumers.indexOf(static_cast<Consumer *>(sender())));
+ sctpSocket->writeDatagram(ba);
+ }
+}
diff --git a/examples/network/multistreamclient/client.h b/examples/network/multistreamclient/client.h
new file mode 100644
index 0000000000..c22a245eba
--- /dev/null
+++ b/examples/network/multistreamclient/client.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CLIENT_H
+#define CLIENT_H
+
+#include <QDialog>
+#include <QVector>
+#include <QSctpSocket>
+
+QT_BEGIN_NAMESPACE
+class QComboBox;
+class QLineEdit;
+class QPushButton;
+class QByteArray;
+QT_END_NAMESPACE
+
+class Consumer;
+
+class Client : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit Client(QWidget *parent = nullptr);
+ virtual ~Client();
+
+private slots:
+ void connected();
+ void disconnected();
+ void requestConnect();
+ void readDatagram(int channel);
+ void displayError(QAbstractSocket::SocketError socketError);
+ void enableConnectButton();
+ void writeDatagram(const QByteArray &ba);
+
+private:
+ QVector<Consumer *> consumers;
+ QSctpSocket *sctpSocket;
+
+ QComboBox *hostCombo;
+ QLineEdit *portLineEdit;
+ QPushButton *connectButton;
+};
+
+#endif
diff --git a/examples/network/multistreamclient/consumer.h b/examples/network/multistreamclient/consumer.h
new file mode 100644
index 0000000000..d70f8d67bf
--- /dev/null
+++ b/examples/network/multistreamclient/consumer.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CONSUMER_H
+#define CONSUMER_H
+
+#include <QObject>
+#include <QByteArray>
+
+QT_BEGIN_NAMESPACE
+class QWidget;
+QT_END_NAMESPACE
+
+class Consumer : public QObject
+{
+ Q_OBJECT
+public:
+ explicit inline Consumer(QObject *parent = nullptr) : QObject(parent) { }
+
+ virtual QWidget *widget() = 0;
+ virtual void readDatagram(const QByteArray &ba) = 0;
+ virtual void serverDisconnected() { }
+
+signals:
+ void writeDatagram(const QByteArray &ba);
+};
+
+#endif
diff --git a/examples/network/multistreamclient/main.cpp b/examples/network/multistreamclient/main.cpp
new file mode 100644
index 0000000000..b903214710
--- /dev/null
+++ b/examples/network/multistreamclient/main.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "client.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Client client;
+
+ return (client.exec() == QDialog::Accepted) ? 0 : -1;
+}
diff --git a/examples/network/multistreamclient/movieconsumer.cpp b/examples/network/multistreamclient/movieconsumer.cpp
new file mode 100644
index 0000000000..ff5610a0b9
--- /dev/null
+++ b/examples/network/multistreamclient/movieconsumer.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "movieconsumer.h"
+#include <QLabel>
+#include <QDataStream>
+#include <QImage>
+#include <QPixmap>
+
+MovieConsumer::MovieConsumer(QObject *parent)
+ : Consumer(parent)
+{
+ label = new QLabel;
+ label->setFrameStyle(QFrame::Box | QFrame::Raised);
+ label->setFixedSize(128 + label->frameWidth() * 2,
+ 64 + label->frameWidth() * 2);
+}
+
+QWidget *MovieConsumer::widget()
+{
+ return label;
+}
+
+void MovieConsumer::readDatagram(const QByteArray &ba)
+{
+ QDataStream ds(ba);
+ QImage image;
+
+ ds >> image;
+ label->setPixmap(QPixmap::fromImage(image));
+}
+
+void MovieConsumer::serverDisconnected()
+{
+ label->setPixmap(QPixmap());
+}
diff --git a/examples/network/multistreamclient/movieconsumer.h b/examples/network/multistreamclient/movieconsumer.h
new file mode 100644
index 0000000000..74321a8505
--- /dev/null
+++ b/examples/network/multistreamclient/movieconsumer.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MOVIECONSUMER_H
+#define MOVIECONSUMER_H
+
+#include "consumer.h"
+
+QT_BEGIN_NAMESPACE
+class QLabel;
+QT_END_NAMESPACE
+
+class MovieConsumer : public Consumer
+{
+ Q_OBJECT
+public:
+ explicit MovieConsumer(QObject *parent = nullptr);
+
+ QWidget *widget() Q_DECL_OVERRIDE;
+ void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE;
+ void serverDisconnected() Q_DECL_OVERRIDE;
+
+private:
+ QLabel *label;
+};
+
+#endif
diff --git a/examples/network/multistreamclient/multistreamclient.pro b/examples/network/multistreamclient/multistreamclient.pro
new file mode 100644
index 0000000000..ed887ab53e
--- /dev/null
+++ b/examples/network/multistreamclient/multistreamclient.pro
@@ -0,0 +1,16 @@
+QT += network widgets
+
+HEADERS = client.h \
+ consumer.h \
+ movieconsumer.h \
+ timeconsumer.h \
+ chatconsumer.h
+SOURCES = client.cpp \
+ movieconsumer.cpp \
+ timeconsumer.cpp \
+ chatconsumer.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/network/multistreamclient
+INSTALLS += target
diff --git a/examples/network/multistreamclient/timeconsumer.cpp b/examples/network/multistreamclient/timeconsumer.cpp
new file mode 100644
index 0000000000..6543e53cfc
--- /dev/null
+++ b/examples/network/multistreamclient/timeconsumer.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "timeconsumer.h"
+#include <QLCDNumber>
+#include <QString>
+#include <QDataStream>
+#include <QTimer>
+
+TimeConsumer::TimeConsumer(QObject *parent)
+ : Consumer(parent)
+{
+ lcdNumber = new QLCDNumber(8);
+
+ QTimer *timer = new QTimer(this);
+ connect(timer, &QTimer::timeout, this, &TimeConsumer::timerTick);
+ timer->start(100);
+
+ serverDisconnected();
+}
+
+QWidget *TimeConsumer::widget()
+{
+ return lcdNumber;
+}
+
+void TimeConsumer::readDatagram(const QByteArray &ba)
+{
+ QDataStream ds(ba);
+
+ ds >> lastTime;
+ lcdNumber->display(lastTime.toString("hh:mm:ss"));
+}
+
+void TimeConsumer::timerTick()
+{
+ QByteArray buf;
+ QDataStream ds(&buf, QIODevice::WriteOnly);
+
+ ds << lastTime;
+ emit writeDatagram(buf);
+}
+
+void TimeConsumer::serverDisconnected()
+{
+ lcdNumber->display(QLatin1String("--:--:--"));
+}
diff --git a/examples/network/multistreamclient/timeconsumer.h b/examples/network/multistreamclient/timeconsumer.h
new file mode 100644
index 0000000000..3faa4a6b1a
--- /dev/null
+++ b/examples/network/multistreamclient/timeconsumer.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TIMECONSUMER_H
+#define TIMECONSUMER_H
+
+#include "consumer.h"
+#include <QTime>
+
+QT_BEGIN_NAMESPACE
+class QLCDNumber;
+QT_END_NAMESPACE
+
+class TimeConsumer : public Consumer
+{
+ Q_OBJECT
+public:
+ explicit TimeConsumer(QObject *parent = nullptr);
+
+ QWidget *widget() Q_DECL_OVERRIDE;
+ void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE;
+ void serverDisconnected() Q_DECL_OVERRIDE;
+
+private slots:
+ void timerTick();
+
+private:
+ QTime lastTime;
+ QLCDNumber *lcdNumber;
+};
+
+#endif
diff --git a/examples/network/multistreamserver/animation.gif b/examples/network/multistreamserver/animation.gif
new file mode 100644
index 0000000000..f674369efc
--- /dev/null
+++ b/examples/network/multistreamserver/animation.gif
Binary files differ
diff --git a/examples/network/multistreamserver/chatprovider.cpp b/examples/network/multistreamserver/chatprovider.cpp
new file mode 100644
index 0000000000..a6ba9c6a27
--- /dev/null
+++ b/examples/network/multistreamserver/chatprovider.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chatprovider.h"
+#include <QString>
+#include <QSctpSocket>
+#include <QHostAddress>
+
+ChatProvider::ChatProvider(QObject *parent)
+ : Provider(parent)
+{
+}
+
+void ChatProvider::readDatagram(QSctpSocket &from, const QByteArray &ba)
+{
+ emit writeDatagram(0, QString(QLatin1String("<%1:%2> %3"))
+ .arg(from.peerAddress().toString())
+ .arg(QString::number(from.peerPort()))
+ .arg(QString::fromUtf8(ba)).toUtf8());
+}
+
+void ChatProvider::newConnection(QSctpSocket &client)
+{
+ readDatagram(client, QString(tr("has joined")).toUtf8());
+}
+
+void ChatProvider::clientDisconnected(QSctpSocket &client)
+{
+ readDatagram(client, QString(tr("has left")).toUtf8());
+}
diff --git a/examples/network/multistreamserver/chatprovider.h b/examples/network/multistreamserver/chatprovider.h
new file mode 100644
index 0000000000..b6ff61a917
--- /dev/null
+++ b/examples/network/multistreamserver/chatprovider.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHATPROVIDER_H
+#define CHATPROVIDER_H
+
+#include "provider.h"
+
+class ChatProvider : public Provider
+{
+ Q_OBJECT
+public:
+ explicit ChatProvider(QObject *parent = nullptr);
+
+ void readDatagram(QSctpSocket &from, const QByteArray &ba) Q_DECL_OVERRIDE;
+ void newConnection(QSctpSocket &client) Q_DECL_OVERRIDE;
+ void clientDisconnected(QSctpSocket &client) Q_DECL_OVERRIDE;
+};
+
+#endif
diff --git a/examples/network/multistreamserver/main.cpp b/examples/network/multistreamserver/main.cpp
new file mode 100644
index 0000000000..ae201f6b82
--- /dev/null
+++ b/examples/network/multistreamserver/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "server.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Server server;
+
+ return (server.exec() == QDialog::Accepted) ? 0 : -1;
+}
diff --git a/examples/network/multistreamserver/movieprovider.cpp b/examples/network/multistreamserver/movieprovider.cpp
new file mode 100644
index 0000000000..335038a515
--- /dev/null
+++ b/examples/network/multistreamserver/movieprovider.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "movieprovider.h"
+#include <QMovie>
+#include <QString>
+#include <QDataStream>
+
+MovieProvider::MovieProvider(QObject *parent)
+ : Provider(parent)
+{
+ movie = new QMovie(this);
+ movie->setCacheMode(QMovie::CacheAll);
+ movie->setFileName(QLatin1String("animation.gif"));
+ connect(movie, &QMovie::frameChanged, this, &MovieProvider::frameChanged);
+ movie->start();
+}
+
+void MovieProvider::frameChanged()
+{
+ QByteArray buf;
+ QDataStream ds(&buf, QIODevice::WriteOnly);
+
+ ds << movie->currentImage();
+ emit writeDatagram(0, buf);
+}
diff --git a/examples/network/multistreamserver/movieprovider.h b/examples/network/multistreamserver/movieprovider.h
new file mode 100644
index 0000000000..46de20a648
--- /dev/null
+++ b/examples/network/multistreamserver/movieprovider.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MOVIEPROVIDER_H
+#define MOVIEPROVIDER_H
+
+#include "provider.h"
+
+QT_BEGIN_NAMESPACE
+class QMovie;
+QT_END_NAMESPACE
+
+class MovieProvider : public Provider
+{
+ Q_OBJECT
+public:
+ explicit MovieProvider(QObject *parent = nullptr);
+
+private slots:
+ void frameChanged();
+
+private:
+ QMovie *movie;
+};
+
+#endif
diff --git a/examples/network/multistreamserver/multistreamserver.pro b/examples/network/multistreamserver/multistreamserver.pro
new file mode 100644
index 0000000000..75a7e6bbec
--- /dev/null
+++ b/examples/network/multistreamserver/multistreamserver.pro
@@ -0,0 +1,24 @@
+QT += network widgets
+
+HEADERS = server.h \
+ provider.h \
+ movieprovider.h \
+ timeprovider.h \
+ chatprovider.h
+SOURCES = server.cpp \
+ movieprovider.cpp \
+ timeprovider.cpp \
+ chatprovider.cpp \
+ main.cpp
+
+EXAMPLE_FILES = animation.gif
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/network/multistreamserver
+INSTALLS += target
+
+wince*: {
+ addFiles.files += *.gif
+ addFiles.path = .
+ DEPLOYMENT += addFiles
+}
diff --git a/examples/network/multistreamserver/provider.h b/examples/network/multistreamserver/provider.h
new file mode 100644
index 0000000000..5be14d5ed8
--- /dev/null
+++ b/examples/network/multistreamserver/provider.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PROVIDER_H
+#define PROVIDER_H
+
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+class QSctpSocket;
+class QByteArray;
+QT_END_NAMESPACE
+
+class Provider : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit inline Provider(QObject *parent = nullptr) : QObject(parent) { }
+
+ virtual void readDatagram(QSctpSocket &, const QByteArray &) { }
+ virtual void newConnection(QSctpSocket &) { }
+ virtual void clientDisconnected(QSctpSocket &) { }
+
+signals:
+ void writeDatagram(QSctpSocket *to, const QByteArray &ba);
+};
+
+#endif
diff --git a/examples/network/multistreamserver/server.cpp b/examples/network/multistreamserver/server.cpp
new file mode 100644
index 0000000000..3b06c0fd37
--- /dev/null
+++ b/examples/network/multistreamserver/server.cpp
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets>
+#include <QtNetwork>
+#include <QtAlgorithms>
+
+#include "server.h"
+#include "movieprovider.h"
+#include "timeprovider.h"
+#include "chatprovider.h"
+
+#include "../shared/sctpchannels.h"
+
+Server::Server(QWidget *parent)
+ : QDialog(parent)
+ , providers(SctpChannels::NumberOfChannels)
+{
+ setWindowTitle(tr("Multi-stream Server"));
+
+ sctpServer = new QSctpServer(this);
+ sctpServer->setMaxChannelCount(NumberOfChannels);
+
+ statusLabel = new QLabel;
+ QPushButton *quitButton = new QPushButton(tr("Quit"));
+
+ providers[SctpChannels::Movie] = new MovieProvider(this);
+ providers[SctpChannels::Time] = new TimeProvider(this);
+ providers[SctpChannels::Chat] = new ChatProvider(this);
+
+ connect(sctpServer, &QSctpServer::newConnection, this, &Server::newConnection);
+ connect(quitButton, &QPushButton::clicked, this, &Server::accept);
+ connect(providers[SctpChannels::Movie], &Provider::writeDatagram, this, &Server::writeDatagram);
+ connect(providers[SctpChannels::Time], &Provider::writeDatagram, this, &Server::writeDatagram);
+ connect(providers[SctpChannels::Chat], &Provider::writeDatagram, this, &Server::writeDatagram);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(statusLabel);
+ mainLayout->addWidget(quitButton);
+ setLayout(mainLayout);
+}
+
+Server::~Server()
+{
+ qDeleteAll(connections.begin(), connections.end());
+}
+
+int Server::exec()
+{
+ if (!sctpServer->listen()) {
+ QMessageBox::critical(this, windowTitle(),
+ tr("Unable to start the server: %1.")
+ .arg(sctpServer->errorString()));
+ return QDialog::Rejected;
+ }
+
+ QString ipAddress;
+ QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
+ // use the first non-localhost IPv4 address
+ for (int i = 0; i < ipAddressesList.size(); ++i) {
+ if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
+ ipAddressesList.at(i).toIPv4Address()) {
+ ipAddress = ipAddressesList.at(i).toString();
+ break;
+ }
+ }
+ // if we did not find one, use IPv4 localhost
+ if (ipAddress.isEmpty())
+ ipAddress = QHostAddress(QHostAddress::LocalHost).toString();
+ statusLabel->setText(tr("The server is running on\n\nIP: %1\nport: %2\n\n"
+ "Run the Multi-stream Client example now.")
+ .arg(ipAddress).arg(sctpServer->serverPort()));
+
+ return QDialog::exec();
+}
+
+void Server::newConnection()
+{
+ QSctpSocket *connection = sctpServer->nextPendingDatagramConnection();
+
+ connections.append(connection);
+ connect(connection, &QSctpSocket::channelReadyRead, this, &Server::readDatagram);
+ connect(connection, &QSctpSocket::disconnected, this, &Server::clientDisconnected);
+
+ for (Provider *provider : providers)
+ provider->newConnection(*connection);
+}
+
+void Server::clientDisconnected()
+{
+ QSctpSocket *connection = static_cast<QSctpSocket *>(sender());
+
+ connections.removeOne(connection);
+ connection->disconnect();
+
+ for (Provider *provider : providers)
+ provider->clientDisconnected(*connection);
+
+ connection->deleteLater();
+}
+
+void Server::readDatagram(int channel)
+{
+ QSctpSocket *connection = static_cast<QSctpSocket *>(sender());
+
+ connection->setCurrentReadChannel(channel);
+ providers[channel]->readDatagram(*connection, connection->readDatagram().data());
+}
+
+void Server::writeDatagram(QSctpSocket *to, const QByteArray &ba)
+{
+ int channel = providers.indexOf(static_cast<Provider *>(sender()));
+
+ if (to) {
+ to->setCurrentWriteChannel(channel);
+ to->writeDatagram(ba);
+ return;
+ }
+
+ for (QSctpSocket *connection : connections) {
+ connection->setCurrentWriteChannel(channel);
+ connection->writeDatagram(ba);
+ }
+}
diff --git a/examples/network/multistreamserver/server.h b/examples/network/multistreamserver/server.h
new file mode 100644
index 0000000000..d9a38e61a4
--- /dev/null
+++ b/examples/network/multistreamserver/server.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SERVER_H
+#define SERVER_H
+
+#include <QDialog>
+#include <QVector>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+class QSctpServer;
+class QSctpSocket;
+class QLabel;
+class QByteArray;
+QT_END_NAMESPACE
+
+class Provider;
+
+class Server : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit Server(QWidget *parent = nullptr);
+ virtual ~Server();
+
+public slots:
+ int exec() Q_DECL_OVERRIDE;
+
+private slots:
+ void newConnection();
+ void clientDisconnected();
+ void readDatagram(int channel);
+ void writeDatagram(QSctpSocket *to, const QByteArray &ba);
+
+private:
+ QVector<Provider *> providers;
+ QSctpServer *sctpServer;
+ QList<QSctpSocket *> connections;
+
+ QLabel *statusLabel;
+};
+
+#endif
diff --git a/examples/network/multistreamserver/timeprovider.cpp b/examples/network/multistreamserver/timeprovider.cpp
new file mode 100644
index 0000000000..fb50baac26
--- /dev/null
+++ b/examples/network/multistreamserver/timeprovider.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "timeprovider.h"
+#include <QDataStream>
+#include <QTime>
+#include <QByteArray>
+
+TimeProvider::TimeProvider(QObject *parent)
+ : Provider(parent)
+{
+}
+
+void TimeProvider::readDatagram(QSctpSocket &from, const QByteArray &ba)
+{
+ QDataStream in_ds(ba);
+ QTime curTime = QTime::currentTime();
+ QTime clientTime;
+
+ in_ds >> clientTime;
+ // Send response only if a displayed part of the time is changed.
+ // So, sub-second differences are ignored.
+ if (!clientTime.isValid() || curTime.second() != clientTime.second()
+ || curTime.minute() != clientTime.minute()
+ || curTime.hour() != clientTime.hour()) {
+ QByteArray buf;
+ QDataStream out_ds(&buf, QIODevice::WriteOnly);
+
+ out_ds << curTime;
+ emit writeDatagram(&from, buf);
+ }
+}
diff --git a/examples/network/multistreamserver/timeprovider.h b/examples/network/multistreamserver/timeprovider.h
new file mode 100644
index 0000000000..f99cdbc717
--- /dev/null
+++ b/examples/network/multistreamserver/timeprovider.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TIMEPROVIDER_H
+#define TIMEPROVIDER_H
+
+#include "provider.h"
+
+class TimeProvider : public Provider
+{
+ Q_OBJECT
+public:
+ explicit TimeProvider(QObject *parent = nullptr);
+
+ void readDatagram(QSctpSocket &from, const QByteArray &ba) Q_DECL_OVERRIDE;
+};
+
+#endif
diff --git a/examples/network/network-chat/connection.h b/examples/network/network-chat/connection.h
index bcd9e889f7..67d25d4d1e 100644
--- a/examples/network/network-chat/connection.h
+++ b/examples/network/network-chat/connection.h
@@ -88,7 +88,7 @@ signals:
void newMessage(const QString &from, const QString &message);
protected:
- void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *timerEvent) override;
private slots:
void processReadyRead();
diff --git a/examples/network/network-chat/server.h b/examples/network/network-chat/server.h
index 47adfc63c7..d86ed36bce 100644
--- a/examples/network/network-chat/server.h
+++ b/examples/network/network-chat/server.h
@@ -66,7 +66,7 @@ signals:
void newConnection(Connection *connection);
protected:
- void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
+ void incomingConnection(qintptr socketDescriptor) override;
};
#endif
diff --git a/examples/network/network.pro b/examples/network/network.pro
index 86bb08d22a..5ad5f1939f 100644
--- a/examples/network/network.pro
+++ b/examples/network/network.pro
@@ -1,6 +1,7 @@
requires(qtHaveModule(network))
TEMPLATE = subdirs
+QT_FOR_CONFIG += network-private
SUBDIRS = \
download \
downloadmanager
@@ -18,10 +19,9 @@ qtHaveModule(widgets) {
multicastreceiver \
multicastsender
- load(qfeatures)
- !contains(QT_DISABLED_FEATURES, bearermanagement) {
+ qtConfig(bearermanagement) {
# no QProcess
- !vxworks:!qnx:!winrt:!integrity: SUBDIRS += network-chat
+ !vxworks:!qnx:!winrt:!integrity:!uikit: SUBDIRS += network-chat
SUBDIRS += \
bearermonitor \
@@ -30,6 +30,9 @@ qtHaveModule(widgets) {
}
- contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient
- contains(QT_CONFIG, openssl-linked):SUBDIRS += securesocketclient
+ qtConfig(openssl): SUBDIRS += securesocketclient
+ qtConfig(openssl-linked): SUBDIRS += securesocketclient
+ qtConfig(sctp): SUBDIRS += multistreamserver multistreamclient
}
+
+EXAMPLE_FILES = shared
diff --git a/examples/network/shared/sctpchannels.h b/examples/network/shared/sctpchannels.h
new file mode 100644
index 0000000000..f8d78ee33b
--- /dev/null
+++ b/examples/network/shared/sctpchannels.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SCTPCHANNELS_H
+#define SCTPCHANNELS_H
+
+enum SctpChannels {
+ Movie = 0,
+ Time = 1,
+ Chat = 2,
+
+ NumberOfChannels = 3
+};
+
+#endif
diff --git a/examples/network/threadedfortuneserver/fortuneserver.h b/examples/network/threadedfortuneserver/fortuneserver.h
index 3922add519..dc0949bcb2 100644
--- a/examples/network/threadedfortuneserver/fortuneserver.h
+++ b/examples/network/threadedfortuneserver/fortuneserver.h
@@ -63,7 +63,7 @@ public:
FortuneServer(QObject *parent = 0);
protected:
- void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
+ void incomingConnection(qintptr socketDescriptor) override;
private:
QStringList fortunes;
diff --git a/examples/network/threadedfortuneserver/fortunethread.h b/examples/network/threadedfortuneserver/fortunethread.h
index 038998d9ab..0a4948e1de 100644
--- a/examples/network/threadedfortuneserver/fortunethread.h
+++ b/examples/network/threadedfortuneserver/fortunethread.h
@@ -62,7 +62,7 @@ class FortuneThread : public QThread
public:
FortuneThread(int socketDescriptor, const QString &fortune, QObject *parent);
- void run() Q_DECL_OVERRIDE;
+ void run() override;
signals:
void error(QTcpSocket::SocketError socketError);
diff --git a/examples/network/torrent/connectionmanager.cpp b/examples/network/torrent/connectionmanager.cpp
index d7b0418619..87b7a16e28 100644
--- a/examples/network/torrent/connectionmanager.cpp
+++ b/examples/network/torrent/connectionmanager.cpp
@@ -86,7 +86,7 @@ QByteArray ConnectionManager::clientId() const
{
if (id.isEmpty()) {
// Generate peer id
- int startupTime = int(QDateTime::currentDateTime().toTime_t());
+ qint64 startupTime = QDateTime::currentSecsSinceEpoch();
id += QString::asprintf("-QT%04x-", QT_VERSION >> 8).toLatin1();
id += QByteArray::number(startupTime, 10);
diff --git a/examples/network/torrent/filemanager.h b/examples/network/torrent/filemanager.h
index 73061ad059..82f9983ea6 100644
--- a/examples/network/torrent/filemanager.h
+++ b/examples/network/torrent/filemanager.h
@@ -100,7 +100,7 @@ signals:
void pieceVerified(int pieceIndex, bool verified);
protected:
- void run() Q_DECL_OVERRIDE;
+ void run() override;
private slots:
bool verifySinglePiece(int pieceIndex);
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp
index 2b3d3e8b3a..efdf187174 100644
--- a/examples/network/torrent/mainwindow.cpp
+++ b/examples/network/torrent/mainwindow.cpp
@@ -67,8 +67,8 @@ signals:
void fileDropped(const QString &fileName);
protected:
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
#endif
};
@@ -80,7 +80,7 @@ public:
inline TorrentViewDelegate(MainWindow *mainWindow) : QItemDelegate(mainWindow) {}
void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index ) const Q_DECL_OVERRIDE
+ const QModelIndex &index ) const override
{
if (index.column() != 2) {
QItemDelegate::paint(painter, option, index);
diff --git a/examples/network/torrent/mainwindow.h b/examples/network/torrent/mainwindow.h
index 7c18f770f8..9c55b72256 100644
--- a/examples/network/torrent/mainwindow.h
+++ b/examples/network/torrent/mainwindow.h
@@ -73,11 +73,11 @@ class MainWindow : public QMainWindow
public:
MainWindow(QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
const TorrentClient *clientForRow(int row) const;
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void loadSettings();
diff --git a/examples/network/torrent/metainfo.cpp b/examples/network/torrent/metainfo.cpp
index e3718999b8..565533e2f9 100644
--- a/examples/network/torrent/metainfo.cpp
+++ b/examples/network/torrent/metainfo.cpp
@@ -141,7 +141,7 @@ bool MetaInfo::parse(const QByteArray &data)
}
if (dict.contains("creation date"))
- metaInfoCreationDate.setTime_t(dict.value("creation date").toInt());
+ metaInfoCreationDate.setSecsSinceEpoch(dict.value("creation date").toInt());
if (dict.contains("comment"))
metaInfoComment = QString::fromUtf8(dict.value("comment").toByteArray());
if (dict.contains("created by"))
diff --git a/examples/network/torrent/peerwireclient.h b/examples/network/torrent/peerwireclient.h
index 6fee52bee0..e03b538f63 100644
--- a/examples/network/torrent/peerwireclient.h
+++ b/examples/network/torrent/peerwireclient.h
@@ -122,14 +122,14 @@ public:
qint64 uploadSpeed() const;
bool canTransferMore() const;
- qint64 bytesAvailable() const Q_DECL_OVERRIDE { return incomingBuffer.size() + QTcpSocket::bytesAvailable(); }
+ qint64 bytesAvailable() const override { return incomingBuffer.size() + QTcpSocket::bytesAvailable(); }
qint64 socketBytesAvailable() const { return socket.bytesAvailable(); }
qint64 socketBytesToWrite() const { return socket.bytesToWrite(); }
- void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE;
+ void setReadBufferSize(qint64 size) override;
void connectToHost(const QHostAddress &address,
- quint16 port, OpenMode openMode = ReadWrite) Q_DECL_OVERRIDE;
+ quint16 port, OpenMode openMode = ReadWrite) override;
void diconnectFromHost();
signals:
@@ -148,11 +148,11 @@ signals:
void bytesReceived(qint64 size);
protected:
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 readLineData(char *data, qint64 maxlen) override;
+ qint64 writeData(const char *data, qint64 len) override;
private slots:
void sendHandShake();
diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp
index 6b184be39c..ba87924ff9 100644
--- a/examples/network/torrent/torrentclient.cpp
+++ b/examples/network/torrent/torrentclient.cpp
@@ -703,7 +703,7 @@ void TorrentClient::connectToPeers()
// Pick a random peer from the list of weighed peers.
TorrentPeer *peer = weighedPeers.takeAt(qrand() % weighedPeers.size());
weighedPeers.removeAll(peer);
- peer->connectStart = QDateTime::currentDateTime().toTime_t();
+ peer->connectStart = QDateTime::currentSecsSinceEpoch();
peer->lastVisited = peer->connectStart;
// Connect to the peer.
@@ -717,7 +717,7 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
QList<TorrentPeer *> weighedPeers;
// Generate a list of peers that we want to connect to.
- uint now = QDateTime::currentDateTime().toTime_t();
+ qint64 now = QDateTime::currentSecsSinceEpoch();
QList<TorrentPeer *> freePeers;
QMap<QString, int> connectionsPerPeer;
foreach (TorrentPeer *peer, d->peers) {
diff --git a/examples/network/torrent/torrentclient.h b/examples/network/torrent/torrentclient.h
index 4db60b9a8c..b9b88b3a07 100644
--- a/examples/network/torrent/torrentclient.h
+++ b/examples/network/torrent/torrentclient.h
@@ -168,7 +168,7 @@ public slots:
void setupIncomingConnection(PeerWireClient *client);
protected slots:
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
private slots:
// File management
diff --git a/examples/network/torrent/torrentserver.h b/examples/network/torrent/torrentserver.h
index 884cce1db8..b0d2b3c012 100644
--- a/examples/network/torrent/torrentserver.h
+++ b/examples/network/torrent/torrentserver.h
@@ -68,7 +68,7 @@ public:
void removeClient(TorrentClient *client);
protected:
- void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
+ void incomingConnection(qintptr socketDescriptor) override;
private slots:
void removeClient();
diff --git a/examples/network/torrent/trackerclient.h b/examples/network/torrent/trackerclient.h
index 787e7b2c84..323fc67eba 100644
--- a/examples/network/torrent/trackerclient.h
+++ b/examples/network/torrent/trackerclient.h
@@ -88,7 +88,7 @@ signals:
void stopped();
protected:
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
private slots:
void fetchPeerList();
diff --git a/examples/opengl/2dpainting/glwidget.h b/examples/opengl/2dpainting/glwidget.h
index 6f0a20022b..16ad1a95f3 100644
--- a/examples/opengl/2dpainting/glwidget.h
+++ b/examples/opengl/2dpainting/glwidget.h
@@ -67,7 +67,7 @@ public slots:
void animate();
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
private:
Helper *helper;
diff --git a/examples/opengl/2dpainting/widget.h b/examples/opengl/2dpainting/widget.h
index a1f36be183..40d20bc0a1 100644
--- a/examples/opengl/2dpainting/widget.h
+++ b/examples/opengl/2dpainting/widget.h
@@ -67,7 +67,7 @@ public slots:
void animate();
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
private:
Helper *helper;
diff --git a/examples/opengl/contextinfo/renderwindow.h b/examples/opengl/contextinfo/renderwindow.h
index 5e9212e04c..c148b71c3c 100644
--- a/examples/opengl/contextinfo/renderwindow.h
+++ b/examples/opengl/contextinfo/renderwindow.h
@@ -65,7 +65,7 @@ class RenderWindow : public QWindow
public:
RenderWindow(const QSurfaceFormat &format);
QOpenGLContext *context() { return m_context; }
- void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
+ void exposeEvent(QExposeEvent *) override;
void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; }
signals:
diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h
index 92182e82c2..cd2f8098ad 100644
--- a/examples/opengl/cube/mainwidget.h
+++ b/examples/opengl/cube/mainwidget.h
@@ -73,13 +73,13 @@ public:
~MainWidget();
protected:
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
- void initializeGL() Q_DECL_OVERRIDE;
- void resizeGL(int w, int h) Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
+ void initializeGL() override;
+ void resizeGL(int w, int h) override;
+ void paintGL() override;
void initShaders();
void initTextures();
diff --git a/examples/opengl/hellogl2/glwidget.h b/examples/opengl/hellogl2/glwidget.h
index 9b4a087fd8..cff5633893 100644
--- a/examples/opengl/hellogl2/glwidget.h
+++ b/examples/opengl/hellogl2/glwidget.h
@@ -68,8 +68,8 @@ public:
GLWidget(QWidget *parent = 0);
~GLWidget();
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
public slots:
void setXRotation(int angle);
@@ -83,11 +83,11 @@ signals:
void zRotationChanged(int angle);
protected:
- void initializeGL() Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void resizeGL(int width, int height) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void initializeGL() override;
+ void paintGL() override;
+ void resizeGL(int width, int height) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
private:
void setupVertexAttribs();
diff --git a/examples/opengl/hellogl2/window.h b/examples/opengl/hellogl2/window.h
index 68ee754d8e..5cec60ff06 100644
--- a/examples/opengl/hellogl2/window.h
+++ b/examples/opengl/hellogl2/window.h
@@ -69,7 +69,7 @@ public:
Window(MainWindow *mw);
protected:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
private slots:
void dockUndock();
diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h
index 0229c393f9..1372152e93 100644
--- a/examples/opengl/hellowindow/hellowindow.h
+++ b/examples/opengl/hellowindow/hellowindow.h
@@ -112,10 +112,10 @@ public:
QColor color() const;
void updateColor();
- void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
+ void exposeEvent(QExposeEvent *event) override;
private:
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) override;
int m_colorIndex;
QColor m_color;
diff --git a/examples/opengl/legacy/framebufferobject2/framebufferobject2.pro b/examples/opengl/legacy/framebufferobject2/framebufferobject2.pro
index 78fc6b1a63..3f2578bc1f 100644
--- a/examples/opengl/legacy/framebufferobject2/framebufferobject2.pro
+++ b/examples/opengl/legacy/framebufferobject2/framebufferobject2.pro
@@ -8,4 +8,4 @@ QT += opengl widgets
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/legacy/framebufferobject2
INSTALLS += target
-contains(QT_CONFIG, opengles.|angle|dynamicgl):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle|dynamicgl): error("This example requires Qt to be configured with -opengl desktop")
diff --git a/examples/opengl/legacy/framebufferobject2/glwidget.h b/examples/opengl/legacy/framebufferobject2/glwidget.h
index 8f46f65b29..d3e4aa5af5 100644
--- a/examples/opengl/legacy/framebufferobject2/glwidget.h
+++ b/examples/opengl/legacy/framebufferobject2/glwidget.h
@@ -55,12 +55,12 @@ class GLWidget : public QGLWidget
public:
GLWidget(QWidget *parent);
~GLWidget();
- void initializeGL() Q_DECL_OVERRIDE;
- void resizeGL(int w, int h) Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE { update(); }
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { killTimer(timerId); }
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { timerId = startTimer(20); }
+ void initializeGL() override;
+ void resizeGL(int w, int h) override;
+ void paintGL() override;
+ void timerEvent(QTimerEvent *) override { update(); }
+ void mousePressEvent(QMouseEvent *) override { killTimer(timerId); }
+ void mouseReleaseEvent(QMouseEvent *) override { timerId = startTimer(20); }
void drawCube(int i, GLfloat z, GLfloat ri, GLfloat jmp, GLfloat amp);
diff --git a/examples/opengl/legacy/grabber/glwidget.h b/examples/opengl/legacy/grabber/glwidget.h
index 3a6e2fb3bb..67020b0ada 100644
--- a/examples/opengl/legacy/grabber/glwidget.h
+++ b/examples/opengl/legacy/grabber/glwidget.h
@@ -76,11 +76,11 @@ signals:
void zRotationChanged(int angle);
protected:
- void initializeGL() Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void resizeGL(int width, int height) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void initializeGL() override;
+ void paintGL() override;
+ void resizeGL(int width, int height) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
private slots:
void advanceGears();
diff --git a/examples/opengl/legacy/grabber/grabber.pro b/examples/opengl/legacy/grabber/grabber.pro
index 1db0e23156..88c03f1c5e 100644
--- a/examples/opengl/legacy/grabber/grabber.pro
+++ b/examples/opengl/legacy/grabber/grabber.pro
@@ -9,4 +9,4 @@ QT += opengl widgets
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/legacy/grabber
INSTALLS += target
-contains(QT_CONFIG, opengles.|angle|dynamicgl):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle|dynamicgl): error("This example requires Qt to be configured with -opengl desktop")
diff --git a/examples/opengl/legacy/hellogl/glwidget.h b/examples/opengl/legacy/hellogl/glwidget.h
index 89446d5937..8154d7405c 100644
--- a/examples/opengl/legacy/hellogl/glwidget.h
+++ b/examples/opengl/legacy/hellogl/glwidget.h
@@ -65,8 +65,8 @@ public:
GLWidget(QWidget *parent = 0);
~GLWidget();
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
//! [0]
//! [1]
@@ -83,11 +83,11 @@ signals:
//! [2]
protected:
- void initializeGL() Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void resizeGL(int width, int height) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void initializeGL() override;
+ void paintGL() override;
+ void resizeGL(int width, int height) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
//! [2]
//! [3]
diff --git a/examples/opengl/legacy/hellogl/hellogl.pro b/examples/opengl/legacy/hellogl/hellogl.pro
index c211242fd2..c6e926c245 100644
--- a/examples/opengl/legacy/hellogl/hellogl.pro
+++ b/examples/opengl/legacy/hellogl/hellogl.pro
@@ -14,4 +14,4 @@ QT += opengl widgets
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/legacy/hellogl
INSTALLS += target
-contains(QT_CONFIG, opengles.|angle):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle): error("This example requires Qt to be configured with -opengl desktop")
diff --git a/examples/opengl/legacy/hellogl/window.h b/examples/opengl/legacy/hellogl/window.h
index 8d684a155b..04e83694a4 100644
--- a/examples/opengl/legacy/hellogl/window.h
+++ b/examples/opengl/legacy/hellogl/window.h
@@ -67,7 +67,7 @@ public:
Window();
protected:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
private:
QSlider *createSlider();
diff --git a/examples/opengl/legacy/legacy.pro b/examples/opengl/legacy/legacy.pro
index 0a74d50f7f..1398332c11 100644
--- a/examples/opengl/legacy/legacy.pro
+++ b/examples/opengl/legacy/legacy.pro
@@ -2,7 +2,7 @@ requires(qtHaveModule(opengl))
TEMPLATE = subdirs
-!contains(QT_CONFIG, dynamicgl): !contains(QT_CONFIG, opengles2) {
+!qtConfig(dynamicgl):!qtConfig(opengles2) {
# legacy desktop-only examples, no dynamic GL support
SUBDIRS = \
grabber \
diff --git a/examples/opengl/legacy/overpainting/glwidget.h b/examples/opengl/legacy/overpainting/glwidget.h
index ffa7922061..e5ea539f6d 100644
--- a/examples/opengl/legacy/overpainting/glwidget.h
+++ b/examples/opengl/legacy/overpainting/glwidget.h
@@ -68,7 +68,7 @@ public:
~GLWidget();
//! [0]
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
int xRotation() const { return xRot; }
int yRotation() const { return yRot; }
int zRotation() const { return zRot; }
@@ -80,12 +80,12 @@ public slots:
//! [1]
protected:
- void initializeGL() Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeGL(int width, int height) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
+ void initializeGL() override;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeGL(int width, int height) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void showEvent(QShowEvent *event) override;
private slots:
void animate();
diff --git a/examples/opengl/legacy/overpainting/overpainting.pro b/examples/opengl/legacy/overpainting/overpainting.pro
index cc46f18889..17213a6079 100644
--- a/examples/opengl/legacy/overpainting/overpainting.pro
+++ b/examples/opengl/legacy/overpainting/overpainting.pro
@@ -16,4 +16,4 @@ SOURCES = bubble.cpp \
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/legacy/overpainting
INSTALLS += target
-contains(QT_CONFIG, opengles.|angle):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle): error("This example requires Qt to be configured with -opengl desktop")
diff --git a/examples/opengl/legacy/pbuffers/glwidget.h b/examples/opengl/legacy/pbuffers/glwidget.h
index d447abb638..397329c428 100644
--- a/examples/opengl/legacy/pbuffers/glwidget.h
+++ b/examples/opengl/legacy/pbuffers/glwidget.h
@@ -67,11 +67,11 @@ public:
~GLWidget();
protected:
- void initializeGL() Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void resizeGL(int width, int height) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(true); }
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE { setAnimationPaused(false); }
+ void initializeGL() override;
+ void paintGL() override;
+ void resizeGL(int width, int height) override;
+ void mousePressEvent(QMouseEvent *) override { setAnimationPaused(true); }
+ void mouseReleaseEvent(QMouseEvent *) override { setAnimationPaused(false); }
private:
void initializeGeometry();
diff --git a/examples/opengl/legacy/pbuffers/pbuffers.pro b/examples/opengl/legacy/pbuffers/pbuffers.pro
index d779a2a2dc..7572ba3583 100644
--- a/examples/opengl/legacy/pbuffers/pbuffers.pro
+++ b/examples/opengl/legacy/pbuffers/pbuffers.pro
@@ -10,4 +10,4 @@ QT += opengl widgets
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/legacy/pbuffers
INSTALLS += target
-contains(QT_CONFIG, opengles.|angle|dynamicgl):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle|dynamicgl): error("This example requires Qt to be configured with -opengl desktop")
diff --git a/examples/opengl/legacy/pbuffers2/pbuffers2.pro b/examples/opengl/legacy/pbuffers2/pbuffers2.pro
index 2ba40a6f74..f1baae3931 100644
--- a/examples/opengl/legacy/pbuffers2/pbuffers2.pro
+++ b/examples/opengl/legacy/pbuffers2/pbuffers2.pro
@@ -8,4 +8,4 @@ RESOURCES += pbuffers2.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/legacy/pbuffers2
INSTALLS += target
-contains(QT_CONFIG, opengles.|angle|dynamicgl):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle|dynamicgl): error("This example requires Qt to be configured with -opengl desktop")
diff --git a/examples/opengl/legacy/samplebuffers/glwidget.h b/examples/opengl/legacy/samplebuffers/glwidget.h
index f46f8e19ac..f02f0835ef 100644
--- a/examples/opengl/legacy/samplebuffers/glwidget.h
+++ b/examples/opengl/legacy/samplebuffers/glwidget.h
@@ -56,10 +56,10 @@ public:
GLWidget(QWidget *parent);
protected:
- void initializeGL() Q_DECL_OVERRIDE;
- void resizeGL(int w, int h) Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void initializeGL() override;
+ void resizeGL(int w, int h) override;
+ void paintGL() override;
+ void timerEvent(QTimerEvent *) override;
void makeObject();
void quad(GLenum primitive, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
diff --git a/examples/opengl/legacy/samplebuffers/samplebuffers.pro b/examples/opengl/legacy/samplebuffers/samplebuffers.pro
index 3719f5039d..aca56f8df8 100644
--- a/examples/opengl/legacy/samplebuffers/samplebuffers.pro
+++ b/examples/opengl/legacy/samplebuffers/samplebuffers.pro
@@ -7,4 +7,4 @@ QT += opengl widgets
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/legacy/samplebuffers
INSTALLS += target
-contains(QT_CONFIG, opengles.|angle|dynamicgl):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle|dynamicgl): error("This example requires Qt to be configured with -opengl desktop")
diff --git a/examples/opengl/paintedwindow/paintedwindow.h b/examples/opengl/paintedwindow/paintedwindow.h
index 73a4b2e63d..7281451924 100644
--- a/examples/opengl/paintedwindow/paintedwindow.h
+++ b/examples/opengl/paintedwindow/paintedwindow.h
@@ -84,8 +84,8 @@ private slots:
void rotationDone();
private:
- void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void exposeEvent(QExposeEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
void paint(QPainter *painter, const QRect &rect);
diff --git a/examples/opengl/qopenglwidget/glwidget.h b/examples/opengl/qopenglwidget/glwidget.h
index d677e414f7..de7805a907 100644
--- a/examples/opengl/qopenglwidget/glwidget.h
+++ b/examples/opengl/qopenglwidget/glwidget.h
@@ -85,9 +85,9 @@ private slots:
void handleButtonPress();
protected:
- void resizeGL(int w, int h) Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void initializeGL() Q_DECL_OVERRIDE;
+ void resizeGL(int w, int h) override;
+ void paintGL() override;
+ void initializeGL() override;
private:
void paintTexturedCube();
diff --git a/examples/opengl/qopenglwindow/main.cpp b/examples/opengl/qopenglwindow/main.cpp
index 5640acccc7..4287d42d24 100644
--- a/examples/opengl/qopenglwindow/main.cpp
+++ b/examples/opengl/qopenglwindow/main.cpp
@@ -79,9 +79,9 @@ public:
OpenGLWindow();
protected:
- void paintGL() Q_DECL_OVERRIDE;
- void resizeGL(int w, int h) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void paintGL() override;
+ void resizeGL(int w, int h) override;
+ void keyPressEvent(QKeyEvent *e) override;
private:
void setAnimating(bool enabled);
diff --git a/examples/opengl/textures/glwidget.h b/examples/opengl/textures/glwidget.h
index c4c06f3864..0db2695c6a 100644
--- a/examples/opengl/textures/glwidget.h
+++ b/examples/opengl/textures/glwidget.h
@@ -66,8 +66,8 @@ public:
explicit GLWidget(QWidget *parent = 0);
~GLWidget();
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
void rotateBy(int xAngle, int yAngle, int zAngle);
void setClearColor(const QColor &color);
@@ -75,12 +75,12 @@ signals:
void clicked();
protected:
- void initializeGL() Q_DECL_OVERRIDE;
- void paintGL() Q_DECL_OVERRIDE;
- void resizeGL(int width, int height) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void initializeGL() override;
+ void paintGL() override;
+ void resizeGL(int width, int height) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
private:
void makeObject();
diff --git a/examples/opengl/threadedqopenglwidget/glwidget.h b/examples/opengl/threadedqopenglwidget/glwidget.h
index 8d2d8bbc70..c33f7e51a7 100644
--- a/examples/opengl/threadedqopenglwidget/glwidget.h
+++ b/examples/opengl/threadedqopenglwidget/glwidget.h
@@ -114,7 +114,7 @@ public:
~GLWidget();
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE { }
+ void paintEvent(QPaintEvent *) override { }
signals:
void renderRequested();
diff --git a/examples/qpa/windows/window.h b/examples/qpa/windows/window.h
index f64bea1676..5647688fbc 100644
--- a/examples/qpa/windows/window.h
+++ b/examples/qpa/windows/window.h
@@ -58,16 +58,16 @@ public:
Window(QScreen *screen);
protected:
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) override;
- void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void exposeEvent(QExposeEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
private:
void render();
diff --git a/examples/sql/books/bookdelegate.h b/examples/sql/books/bookdelegate.h
index ba46f7d60a..d07f2b9534 100644
--- a/examples/sql/books/bookdelegate.h
+++ b/examples/sql/books/bookdelegate.h
@@ -64,16 +64,16 @@ public:
BookDelegate(QObject *parent);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
bool editorEvent(QEvent *event, QAbstractItemModel *model,
const QStyleOptionViewItem &option,
- const QModelIndex &index) Q_DECL_OVERRIDE;
+ const QModelIndex &index) override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
private:
QPixmap star;
diff --git a/examples/sql/drilldown/imageitem.h b/examples/sql/drilldown/imageitem.h
index 7b1c869066..4f773a6dfc 100644
--- a/examples/sql/drilldown/imageitem.h
+++ b/examples/sql/drilldown/imageitem.h
@@ -66,8 +66,8 @@ public:
int id();
protected:
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
private slots:
void setFrame(int frame);
diff --git a/examples/sql/drilldown/view.h b/examples/sql/drilldown/view.h
index 3aecf5ab58..9d6ef0e853 100644
--- a/examples/sql/drilldown/view.h
+++ b/examples/sql/drilldown/view.h
@@ -66,7 +66,7 @@ public:
View(const QString &items, const QString &images, QWidget *parent = 0);
protected:
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) override;
//! [0]
//! [1]
diff --git a/examples/sql/querymodel/customsqlmodel.h b/examples/sql/querymodel/customsqlmodel.h
index b9b4dd4f95..5d2f625665 100644
--- a/examples/sql/querymodel/customsqlmodel.h
+++ b/examples/sql/querymodel/customsqlmodel.h
@@ -61,7 +61,7 @@ class CustomSqlModel : public QSqlQueryModel
public:
CustomSqlModel(QObject *parent = 0);
- QVariant data(const QModelIndex &item, int role) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &item, int role) const override;
};
//! [0]
diff --git a/examples/sql/querymodel/editablesqlmodel.h b/examples/sql/querymodel/editablesqlmodel.h
index b88c9a3fb1..1341dd372a 100644
--- a/examples/sql/querymodel/editablesqlmodel.h
+++ b/examples/sql/querymodel/editablesqlmodel.h
@@ -60,8 +60,8 @@ class EditableSqlModel : public QSqlQueryModel
public:
EditableSqlModel(QObject *parent = 0);
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
private:
bool setFirstName(int personId, const QString &firstName);
diff --git a/examples/sql/sqlbrowser/browser.h b/examples/sql/sqlbrowser/browser.h
index 8b36952ce4..fef410778b 100644
--- a/examples/sql/sqlbrowser/browser.h
+++ b/examples/sql/sqlbrowser/browser.h
@@ -117,7 +117,7 @@ class CustomModel: public QSqlTableModel
Q_OBJECT
public:
explicit CustomModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()):QSqlTableModel(parent, db) {}
- QVariant data(const QModelIndex &idx, int role) const Q_DECL_OVERRIDE
+ QVariant data(const QModelIndex &idx, int role) const override
{
if (role == Qt::BackgroundRole && isDirty(idx))
return QBrush(QColor(Qt::yellow));
diff --git a/examples/touch/fingerpaint/mainwindow.h b/examples/touch/fingerpaint/mainwindow.h
index 3686947065..47c339050e 100644
--- a/examples/touch/fingerpaint/mainwindow.h
+++ b/examples/touch/fingerpaint/mainwindow.h
@@ -65,7 +65,7 @@ public:
MainWindow();
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void open();
diff --git a/examples/touch/fingerpaint/scribblearea.h b/examples/touch/fingerpaint/scribblearea.h
index d81414e8b9..5138e3a1ab 100644
--- a/examples/touch/fingerpaint/scribblearea.h
+++ b/examples/touch/fingerpaint/scribblearea.h
@@ -74,9 +74,9 @@ public slots:
void print();
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ bool event(QEvent *event) override;
private:
void resizeImage(QImage *image, const QSize &newSize);
diff --git a/examples/touch/knobs/knob.h b/examples/touch/knobs/knob.h
index b35b16aabe..c16b61d6f1 100644
--- a/examples/touch/knobs/knob.h
+++ b/examples/touch/knobs/knob.h
@@ -58,7 +58,7 @@ class Knob : public QGraphicsEllipseItem
public:
Knob();
- bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
+ bool sceneEvent(QEvent *event) override;
};
#endif // KNOB_H
diff --git a/examples/touch/pinchzoom/graphicsview.h b/examples/touch/pinchzoom/graphicsview.h
index f9dbc43980..d4e2e32d36 100644
--- a/examples/touch/pinchzoom/graphicsview.h
+++ b/examples/touch/pinchzoom/graphicsview.h
@@ -58,7 +58,7 @@ class GraphicsView : public QGraphicsView
public:
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
- bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
+ bool viewportEvent(QEvent *event) override;
private:
qreal totalScaleFactor;
diff --git a/examples/touch/pinchzoom/mouse.h b/examples/touch/pinchzoom/mouse.h
index a01c4d629c..870bfcd6c0 100644
--- a/examples/touch/pinchzoom/mouse.h
+++ b/examples/touch/pinchzoom/mouse.h
@@ -61,13 +61,13 @@ class Mouse : public QGraphicsObject
public:
Mouse();
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget) Q_DECL_OVERRIDE;
+ QWidget *widget) override;
protected:
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
private:
qreal angle;
diff --git a/examples/widgets/animation/animatedtiles/main.cpp b/examples/widgets/animation/animatedtiles/main.cpp
index 2202f6194b..0511fe8162 100644
--- a/examples/widgets/animation/animatedtiles/main.cpp
+++ b/examples/widgets/animation/animatedtiles/main.cpp
@@ -75,19 +75,19 @@ public:
setCacheMode(DeviceCoordinateCache);
}
- QRectF boundingRect() const Q_DECL_OVERRIDE
+ QRectF boundingRect() const override
{
return QRectF(-65, -65, 130, 130);
}
- QPainterPath shape() const Q_DECL_OVERRIDE
+ QPainterPath shape() const override
{
QPainterPath path;
path.addEllipse(boundingRect());
return path;
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) override
{
bool down = option->state & QStyle::State_Sunken;
QRectF r = boundingRect();
@@ -112,13 +112,13 @@ signals:
void pressed();
protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
+ void mousePressEvent(QGraphicsSceneMouseEvent *) override
{
emit pressed();
update();
}
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override
{
update();
}
@@ -133,7 +133,7 @@ public:
View(QGraphicsScene *scene) : QGraphicsView(scene) { }
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
+ void resizeEvent(QResizeEvent *event) override
{
QGraphicsView::resizeEvent(event);
fitInView(sceneRect(), Qt::KeepAspectRatio);
diff --git a/examples/widgets/animation/appchooser/main.cpp b/examples/widgets/animation/appchooser/main.cpp
index 59611274ef..c9821450c9 100644
--- a/examples/widgets/animation/appchooser/main.cpp
+++ b/examples/widgets/animation/appchooser/main.cpp
@@ -62,17 +62,17 @@ public:
{
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
{
painter->drawPixmap(QPointF(), p);
}
- virtual void mousePressEvent(QGraphicsSceneMouseEvent * ) Q_DECL_OVERRIDE
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *) override
{
emit clicked();
}
- virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE
+ virtual void setGeometry(const QRectF &rect) override
{
QGraphicsWidget::setGeometry(rect);
@@ -98,7 +98,7 @@ public:
{
}
- virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
+ virtual void resizeEvent(QResizeEvent *) override
{
fitInView(sceneRect(), Qt::KeepAspectRatio);
}
diff --git a/examples/widgets/animation/easing/animation.h b/examples/widgets/animation/easing/animation.h
index f8373ef686..696257bb4a 100644
--- a/examples/widgets/animation/easing/animation.h
+++ b/examples/widgets/animation/easing/animation.h
@@ -77,7 +77,7 @@ public:
m_path = QPainterPath();
}
- void updateCurrentTime(int currentTime) Q_DECL_OVERRIDE
+ void updateCurrentTime(int currentTime) override
{
if (m_pathType == CirclePath) {
if (m_path.isEmpty()) {
diff --git a/examples/widgets/animation/moveblocks/main.cpp b/examples/widgets/animation/moveblocks/main.cpp
index 3b271339e4..f85211ef88 100644
--- a/examples/widgets/animation/moveblocks/main.cpp
+++ b/examples/widgets/animation/moveblocks/main.cpp
@@ -80,7 +80,7 @@ class QGraphicsRectWidget : public QGraphicsWidget
{
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
- QWidget *) Q_DECL_OVERRIDE
+ QWidget *) override
{
painter->fillRect(rect(), Qt::blue);
}
@@ -98,14 +98,14 @@ public:
protected:
//![14]
- virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *event) override
{
return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
}
//![14]
- virtual void onTransition(QEvent *) Q_DECL_OVERRIDE {}
+ virtual void onTransition(QEvent *) override {}
private:
int m_rand;
@@ -122,7 +122,7 @@ public:
//![10]
//![11]
- virtual void onEntry(QEvent *) Q_DECL_OVERRIDE
+ virtual void onEntry(QEvent *) override
{
int n;
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
@@ -130,7 +130,7 @@ public:
m_lastIndex = n;
machine()->postEvent(new StateSwitchEvent(n));
}
- virtual void onExit(QEvent *) Q_DECL_OVERRIDE {}
+ virtual void onExit(QEvent *) override {}
//![11]
//![12]
@@ -174,7 +174,7 @@ public:
}
protected:
- virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
+ virtual void resizeEvent(QResizeEvent *event) override
{
fitInView(scene()->sceneRect());
QGraphicsView::resizeEvent(event);
diff --git a/examples/widgets/animation/states/main.cpp b/examples/widgets/animation/states/main.cpp
index 1c5cb2d12d..a3c7256933 100644
--- a/examples/widgets/animation/states/main.cpp
+++ b/examples/widgets/animation/states/main.cpp
@@ -58,12 +58,12 @@ public:
{
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
{
painter->drawPixmap(QPointF(), p);
}
- QRectF boundingRect() const Q_DECL_OVERRIDE
+ QRectF boundingRect() const override
{
return QRectF( QPointF(0, 0), p.size());
}
@@ -79,7 +79,7 @@ public:
{
}
- virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
+ virtual void resizeEvent(QResizeEvent *) override
{
fitInView(sceneRect(), Qt::KeepAspectRatio);
}
diff --git a/examples/widgets/animation/stickman/graphicsview.h b/examples/widgets/animation/stickman/graphicsview.h
index 64201f4e3d..4b9b8fc028 100644
--- a/examples/widgets/animation/stickman/graphicsview.h
+++ b/examples/widgets/animation/stickman/graphicsview.h
@@ -61,8 +61,8 @@ public:
GraphicsView(QWidget *parent = 0);
protected:
- virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QResizeEvent *event) override;
+ void keyPressEvent(QKeyEvent *) override;
signals:
void keyPressed(int key);
diff --git a/examples/widgets/animation/stickman/lifecycle.cpp b/examples/widgets/animation/stickman/lifecycle.cpp
index c0623d02fe..0ece4f3932 100644
--- a/examples/widgets/animation/stickman/lifecycle.cpp
+++ b/examples/widgets/animation/stickman/lifecycle.cpp
@@ -70,7 +70,7 @@ public:
setTargetState(target);
}
- virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *e) override
{
if (QSignalTransition::eventTest(e)) {
QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0);
@@ -91,11 +91,11 @@ public:
: QEventTransition(this, QEvent::Timer)
{
setTargetState(target);
- qsrand((uint)QDateTime::currentDateTime().toTime_t());
+ qsrand((uint)QDateTime::currentSecsSinceEpoch());
startTimer(1000);
}
- virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *e) override
{
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
}
diff --git a/examples/widgets/animation/stickman/node.h b/examples/widgets/animation/stickman/node.h
index cdf2df46cb..679999b7e8 100644
--- a/examples/widgets/animation/stickman/node.h
+++ b/examples/widgets/animation/stickman/node.h
@@ -60,18 +60,18 @@ public:
explicit Node(const QPointF &pos, QGraphicsItem *parent = 0);
~Node();
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
signals:
void positionChanged();
protected:
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
- void mousePressEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *) override;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override;
private:
bool m_dragging;
diff --git a/examples/widgets/animation/stickman/rectbutton.h b/examples/widgets/animation/stickman/rectbutton.h
index 79902c9d38..864a2c179e 100644
--- a/examples/widgets/animation/stickman/rectbutton.h
+++ b/examples/widgets/animation/stickman/rectbutton.h
@@ -60,13 +60,13 @@ public:
RectButton(QString buttonText);
~RectButton();
- virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ virtual QRectF boundingRect() const override;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
QString m_ButtonText;
- virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
signals:
void clicked();
diff --git a/examples/widgets/animation/stickman/stickman.h b/examples/widgets/animation/stickman/stickman.h
index 302de06704..b5fbd14872 100644
--- a/examples/widgets/animation/stickman/stickman.h
+++ b/examples/widgets/animation/stickman/stickman.h
@@ -69,8 +69,8 @@ public:
StickMan();
~StickMan();
- virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ virtual QRectF boundingRect() const override;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
int nodeCount() const;
Node *node(int idx) const;
@@ -92,7 +92,7 @@ public slots:
void childPositionChanged();
protected:
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
private:
diff --git a/examples/widgets/animation/sub-attaq/boat.h b/examples/widgets/animation/sub-attaq/boat.h
index 4b7b20c390..24b004a108 100644
--- a/examples/widgets/animation/sub-attaq/boat.h
+++ b/examples/widgets/animation/sub-attaq/boat.h
@@ -86,7 +86,7 @@ public:
void updateBoatMovement();
- virtual int type() const Q_DECL_OVERRIDE;
+ virtual int type() const override;
signals:
void boatDestroyed();
diff --git a/examples/widgets/animation/sub-attaq/boat_p.h b/examples/widgets/animation/sub-attaq/boat_p.h
index 6d3c3f69f8..5cad6bde96 100644
--- a/examples/widgets/animation/sub-attaq/boat_p.h
+++ b/examples/widgets/animation/sub-attaq/boat_p.h
@@ -81,7 +81,7 @@ public:
{
}
protected:
- virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *event) override
{
if (!QKeyEventTransition::eventTest(event))
return false;
@@ -100,13 +100,13 @@ public:
{
}
protected:
- virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *event) override
{
if (!QKeyEventTransition::eventTest(event))
return false;
return (boat->currentSpeed() >= 0);
}
- void onTransition(QEvent *) Q_DECL_OVERRIDE
+ void onTransition(QEvent *) override
{
//We decrease the speed if needed
if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right)
@@ -131,7 +131,7 @@ public:
{
}
protected:
- virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *event) override
{
if (!QKeyEventTransition::eventTest(event))
return false;
@@ -150,7 +150,7 @@ public:
{
}
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE
+ void onEntry(QEvent *) override
{
boat->setCurrentDirection(Boat::Right);
boat->updateBoatMovement();
@@ -167,7 +167,7 @@ public:
{
}
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE
+ void onEntry(QEvent *) override
{
boat->setCurrentDirection(Boat::Left);
boat->updateBoatMovement();
@@ -184,7 +184,7 @@ public:
{
}
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE
+ void onEntry(QEvent *) override
{
boat->setCurrentSpeed(0);
boat->setCurrentDirection(Boat::None);
@@ -202,7 +202,7 @@ public:
{
}
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE
+ void onEntry(QEvent *) override
{
Bomb *b = new Bomb();
b->setPos(boat->x()+boat->size().width(),boat->y());
@@ -223,7 +223,7 @@ public:
{
}
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE
+ void onEntry(QEvent *) override
{
Bomb *b = new Bomb();
b->setPos(boat->x() - b->size().width(), boat->y());
diff --git a/examples/widgets/animation/sub-attaq/pixmapitem.h b/examples/widgets/animation/sub-attaq/pixmapitem.h
index 139537bcc9..de8ed67a38 100644
--- a/examples/widgets/animation/sub-attaq/pixmapitem.h
+++ b/examples/widgets/animation/sub-attaq/pixmapitem.h
@@ -63,8 +63,8 @@ public:
PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem * parent = 0);
PixmapItem(const QString &fileName, QGraphicsScene *scene);
QSizeF size() const;
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
private:
QPixmap pix;
};
diff --git a/examples/widgets/animation/sub-attaq/qanimationstate.h b/examples/widgets/animation/sub-attaq/qanimationstate.h
index b4afdd699d..06ab4dfbcf 100644
--- a/examples/widgets/animation/sub-attaq/qanimationstate.h
+++ b/examples/widgets/animation/sub-attaq/qanimationstate.h
@@ -80,9 +80,9 @@ signals:
void animationFinished();
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE;
- void onExit(QEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *) override;
+ void onExit(QEvent *) override;
+ bool event(QEvent *e) override;
private:
Q_DISABLE_COPY(QAnimationState)
diff --git a/examples/widgets/animation/sub-attaq/states.h b/examples/widgets/animation/sub-attaq/states.h
index 5b6b38bee7..1d50abbf02 100644
--- a/examples/widgets/animation/sub-attaq/states.h
+++ b/examples/widgets/animation/sub-attaq/states.h
@@ -72,7 +72,7 @@ public:
~PlayState();
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *) override;
private :
GraphicsScene *scene;
@@ -94,7 +94,7 @@ class LevelState : public QState
public:
LevelState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *) override;
private :
void initializeLevel();
GraphicsScene *scene;
@@ -107,8 +107,8 @@ public:
explicit PauseState(GraphicsScene *scene, QState *parent = 0);
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE;
- void onExit(QEvent *) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *) override;
+ void onExit(QEvent *) override;
private :
GraphicsScene *scene;
};
@@ -119,8 +119,8 @@ public:
LostState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE;
- void onExit(QEvent *) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *) override;
+ void onExit(QEvent *) override;
private :
GraphicsScene *scene;
PlayState *game;
@@ -132,8 +132,8 @@ public:
WinState(GraphicsScene *scene, PlayState *game, QState *parent = 0);
protected:
- void onEntry(QEvent *) Q_DECL_OVERRIDE;
- void onExit(QEvent *) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *) override;
+ void onExit(QEvent *) override;
private :
GraphicsScene *scene;
PlayState *game;
@@ -152,7 +152,7 @@ class UpdateScoreTransition : public QSignalTransition
public:
UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
- virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ virtual bool eventTest(QEvent *event) override;
private:
PlayState * game;
GraphicsScene *scene;
@@ -164,7 +164,7 @@ class WinTransition : public QSignalTransition
public:
WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
protected:
- virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ virtual bool eventTest(QEvent *event) override;
private:
PlayState * game;
GraphicsScene *scene;
@@ -176,7 +176,7 @@ private:
public:
CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
protected:
- virtual bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ virtual bool eventTest(QEvent *event) override;
private:
PlayState *game;
};
diff --git a/examples/widgets/animation/sub-attaq/submarine.h b/examples/widgets/animation/sub-attaq/submarine.h
index 179fe62ed0..abfdca6195 100644
--- a/examples/widgets/animation/sub-attaq/submarine.h
+++ b/examples/widgets/animation/sub-attaq/submarine.h
@@ -81,7 +81,7 @@ public:
void launchTorpedo(int speed);
void destroy();
- virtual int type() const Q_DECL_OVERRIDE;
+ virtual int type() const override;
QGraphicsRotation *rotation() const { return graphicsRotation; }
diff --git a/examples/widgets/animation/sub-attaq/submarine_p.h b/examples/widgets/animation/sub-attaq/submarine_p.h
index 72aa761ed4..b8d5532962 100644
--- a/examples/widgets/animation/sub-attaq/submarine_p.h
+++ b/examples/widgets/animation/sub-attaq/submarine_p.h
@@ -93,7 +93,7 @@ protected slots:
}
protected:
- void onEntry(QEvent *e) Q_DECL_OVERRIDE
+ void onEntry(QEvent *e) override
{
if (submarine->currentDirection() == SubMarine::Left) {
movementAnimation->setEndValue(QPointF(0,submarine->y()));
@@ -125,14 +125,14 @@ public:
}
protected:
- void onEntry(QEvent *e) Q_DECL_OVERRIDE
+ void onEntry(QEvent *e) override
{
returnAnimation->stop();
returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.);
QAnimationState::onEntry(e);
}
- void onExit(QEvent *e) Q_DECL_OVERRIDE
+ void onExit(QEvent *e) override
{
submarine->currentDirection() == SubMarine::Right ? submarine->setCurrentDirection(SubMarine::Left) : submarine->setCurrentDirection(SubMarine::Right);
QAnimationState::onExit(e);
diff --git a/examples/widgets/desktop/screenshot/screenshot.h b/examples/widgets/desktop/screenshot/screenshot.h
index 6db722fa76..240952120d 100644
--- a/examples/widgets/desktop/screenshot/screenshot.h
+++ b/examples/widgets/desktop/screenshot/screenshot.h
@@ -74,7 +74,7 @@ public:
Screenshot();
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) override;
private slots:
void newScreenshot();
diff --git a/examples/widgets/desktop/systray/window.h b/examples/widgets/desktop/systray/window.h
index b9ebe2c57f..001338df0c 100644
--- a/examples/widgets/desktop/systray/window.h
+++ b/examples/widgets/desktop/systray/window.h
@@ -78,10 +78,10 @@ class Window : public QDialog
public:
Window();
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void setIcon(int index);
diff --git a/examples/widgets/dialogs/classwizard/classwizard.h b/examples/widgets/dialogs/classwizard/classwizard.h
index 8be08f180c..fee0f6df66 100644
--- a/examples/widgets/dialogs/classwizard/classwizard.h
+++ b/examples/widgets/dialogs/classwizard/classwizard.h
@@ -69,7 +69,7 @@ class ClassWizard : public QWizard
public:
ClassWizard(QWidget *parent = 0);
- void accept() Q_DECL_OVERRIDE;
+ void accept() override;
};
//! [0]
@@ -117,7 +117,7 @@ public:
CodeStylePage(QWidget *parent = 0);
protected:
- void initializePage() Q_DECL_OVERRIDE;
+ void initializePage() override;
private:
QCheckBox *commentCheckBox;
@@ -138,7 +138,7 @@ public:
OutputFilesPage(QWidget *parent = 0);
protected:
- void initializePage() Q_DECL_OVERRIDE;
+ void initializePage() override;
private:
QLabel *outputDirLabel;
@@ -157,7 +157,7 @@ public:
ConclusionPage(QWidget *parent = 0);
protected:
- void initializePage() Q_DECL_OVERRIDE;
+ void initializePage() override;
private:
QLabel *label;
diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.h b/examples/widgets/dialogs/licensewizard/licensewizard.h
index 4e7e6feb09..c7709d88b3 100644
--- a/examples/widgets/dialogs/licensewizard/licensewizard.h
+++ b/examples/widgets/dialogs/licensewizard/licensewizard.h
@@ -88,7 +88,7 @@ class IntroPage : public QWizardPage
public:
IntroPage(QWidget *parent = 0);
- int nextId() const Q_DECL_OVERRIDE;
+ int nextId() const override;
private:
QLabel *topLabel;
@@ -105,7 +105,7 @@ class EvaluatePage : public QWizardPage
public:
EvaluatePage(QWidget *parent = 0);
- int nextId() const Q_DECL_OVERRIDE;
+ int nextId() const override;
private:
QLabel *nameLabel;
@@ -122,7 +122,7 @@ class RegisterPage : public QWizardPage
public:
RegisterPage(QWidget *parent = 0);
- int nextId() const Q_DECL_OVERRIDE;
+ int nextId() const override;
private:
QLabel *nameLabel;
@@ -138,7 +138,7 @@ class DetailsPage : public QWizardPage
public:
DetailsPage(QWidget *parent = 0);
- int nextId() const Q_DECL_OVERRIDE;
+ int nextId() const override;
private:
QLabel *companyLabel;
@@ -157,9 +157,9 @@ class ConclusionPage : public QWizardPage
public:
ConclusionPage(QWidget *parent = 0);
- void initializePage() Q_DECL_OVERRIDE;
- int nextId() const Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void initializePage() override;
+ int nextId() const override;
+ void setVisible(bool visible) override;
private slots:
void printButtonClicked();
diff --git a/examples/widgets/draganddrop/draganddrop.pro b/examples/widgets/draganddrop/draganddrop.pro
index eb678eecd8..1ecafd33a1 100644
--- a/examples/widgets/draganddrop/draganddrop.pro
+++ b/examples/widgets/draganddrop/draganddrop.pro
@@ -4,5 +4,3 @@ SUBDIRS = draggableicons \
dropsite \
fridgemagnets \
puzzle
-
-wince: SUBDIRS -= dropsite
diff --git a/examples/widgets/draganddrop/draggableicons/dragwidget.h b/examples/widgets/draganddrop/draggableicons/dragwidget.h
index 3d02742530..18be074b61 100644
--- a/examples/widgets/draganddrop/draggableicons/dragwidget.h
+++ b/examples/widgets/draganddrop/draggableicons/dragwidget.h
@@ -65,10 +65,10 @@ public:
DragWidget(QWidget *parent = 0);
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
};
//! [0]
diff --git a/examples/widgets/draganddrop/draggabletext/dragwidget.h b/examples/widgets/draganddrop/draggabletext/dragwidget.h
index aa686fd4a4..24d1f6f5c7 100644
--- a/examples/widgets/draganddrop/draggabletext/dragwidget.h
+++ b/examples/widgets/draganddrop/draggabletext/dragwidget.h
@@ -64,9 +64,9 @@ public:
DragWidget(QWidget *parent = 0);
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
};
#endif // DRAGWIDGET_H
diff --git a/examples/widgets/draganddrop/dropsite/droparea.h b/examples/widgets/draganddrop/dropsite/droparea.h
index 71084318c1..5b6e209dfa 100644
--- a/examples/widgets/draganddrop/dropsite/droparea.h
+++ b/examples/widgets/draganddrop/dropsite/droparea.h
@@ -74,10 +74,10 @@ signals:
//! [DropArea header part2]
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
private:
QLabel *label;
diff --git a/examples/widgets/draganddrop/fridgemagnets/dragwidget.h b/examples/widgets/draganddrop/fridgemagnets/dragwidget.h
index 1117822fe2..104e500134 100644
--- a/examples/widgets/draganddrop/fridgemagnets/dragwidget.h
+++ b/examples/widgets/draganddrop/fridgemagnets/dragwidget.h
@@ -65,10 +65,10 @@ public:
DragWidget(QWidget *parent = 0);
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
};
//! [0]
diff --git a/examples/widgets/draganddrop/puzzle/pieceslist.h b/examples/widgets/draganddrop/puzzle/pieceslist.h
index 2cd6c83373..b67d2bdaf7 100644
--- a/examples/widgets/draganddrop/puzzle/pieceslist.h
+++ b/examples/widgets/draganddrop/puzzle/pieceslist.h
@@ -64,10 +64,10 @@ public:
static QString puzzleMimeType() { return QStringLiteral("image/x-puzzle-piece"); }
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
- void startDrag(Qt::DropActions supportedActions) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void startDrag(Qt::DropActions supportedActions) override;
int m_PieceSize;
};
diff --git a/examples/widgets/draganddrop/puzzle/puzzle.pro b/examples/widgets/draganddrop/puzzle/puzzle.pro
index 404b75187d..97e7206682 100644
--- a/examples/widgets/draganddrop/puzzle/puzzle.pro
+++ b/examples/widgets/draganddrop/puzzle/puzzle.pro
@@ -14,9 +14,3 @@ QMAKE_PROJECT_NAME = dndpuzzle
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/draganddrop/puzzle
INSTALLS += target
-
-wince {
- addFile.files = example.jpg
- addFile.path = .
- INSTALLS += addFile
-}
diff --git a/examples/widgets/draganddrop/puzzle/puzzlewidget.h b/examples/widgets/draganddrop/puzzle/puzzlewidget.h
index 48c66b7b58..7dcb7dd497 100644
--- a/examples/widgets/draganddrop/puzzle/puzzlewidget.h
+++ b/examples/widgets/draganddrop/puzzle/puzzlewidget.h
@@ -77,12 +77,12 @@ signals:
void puzzleCompleted();
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
const QRect targetSquare(const QPoint &position) const;
diff --git a/examples/widgets/effects/blurpicker/blureffect.h b/examples/widgets/effects/blurpicker/blureffect.h
index 2ae2519bd7..241a0ea535 100644
--- a/examples/widgets/effects/blurpicker/blureffect.h
+++ b/examples/widgets/effects/blurpicker/blureffect.h
@@ -63,7 +63,7 @@ public:
QRectF boundingRect() const;
- void draw(QPainter *painter) Q_DECL_OVERRIDE;
+ void draw(QPainter *painter) override;
private:
void adjustForItem();
diff --git a/examples/widgets/effects/blurpicker/blurpicker.h b/examples/widgets/effects/blurpicker/blurpicker.h
index ba004a0a2b..3f444419a8 100644
--- a/examples/widgets/effects/blurpicker/blurpicker.h
+++ b/examples/widgets/effects/blurpicker/blurpicker.h
@@ -69,9 +69,9 @@ public:
void setIndex(qreal);
protected:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
private:
void setupScene();
diff --git a/examples/widgets/effects/lighting/lighting.h b/examples/widgets/effects/lighting/lighting.h
index e77024b1c6..615824d46f 100644
--- a/examples/widgets/effects/lighting/lighting.h
+++ b/examples/widgets/effects/lighting/lighting.h
@@ -68,7 +68,7 @@ private:
void setupScene();
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) override;
private:
qreal angle;
diff --git a/examples/widgets/gestures/imagegestures/imagewidget.h b/examples/widgets/gestures/imagegestures/imagewidget.h
index 9ffc7491de..5e92541067 100644
--- a/examples/widgets/gestures/imagegestures/imagewidget.h
+++ b/examples/widgets/gestures/imagegestures/imagewidget.h
@@ -75,10 +75,10 @@ public:
void grabGestures(const QList<Qt::GestureType> &gestures);
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
private:
bool gestureEvent(QGestureEvent *event);
diff --git a/examples/widgets/graphicsview/basicgraphicslayouts/layoutitem.h b/examples/widgets/graphicsview/basicgraphicslayouts/layoutitem.h
index 8a940738a6..3535a26670 100644
--- a/examples/widgets/graphicsview/basicgraphicslayouts/layoutitem.h
+++ b/examples/widgets/graphicsview/basicgraphicslayouts/layoutitem.h
@@ -61,12 +61,12 @@ public:
LayoutItem(QGraphicsItem *parent = 0);
~LayoutItem();
// Inherited from QGraphicsLayoutItem
- void setGeometry(const QRectF &geom) Q_DECL_OVERRIDE;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
+ void setGeometry(const QRectF &geom) override;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
// Inherited from QGraphicsItem
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
private:
QPixmap *m_pix;
diff --git a/examples/widgets/graphicsview/boxes/boxes.pro b/examples/widgets/graphicsview/boxes/boxes.pro
index 38aae1c2c4..afdca816b1 100644
--- a/examples/widgets/graphicsview/boxes/boxes.pro
+++ b/examples/widgets/graphicsview/boxes/boxes.pro
@@ -1,6 +1,6 @@
QT += opengl widgets
-contains(QT_CONFIG, opengles.|angle|dynamicgl):error("This example requires Qt to be configured with -opengl desktop")
+qtConfig(opengles.|angle|dynamicgl): error("This example requires Qt to be configured with -opengl desktop")
HEADERS += 3rdparty/fbm.h \
glbuffers.h \
@@ -24,7 +24,3 @@ RESOURCES += boxes.qrc
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/boxes
INSTALLS += target
-
-wince {
- DEPLOYMENT_PLUGIN += qjpeg
-}
diff --git a/examples/widgets/graphicsview/boxes/glbuffers.h b/examples/widgets/graphicsview/boxes/glbuffers.h
index 25ab66fca6..0c2ff43c7e 100644
--- a/examples/widgets/graphicsview/boxes/glbuffers.h
+++ b/examples/widgets/graphicsview/boxes/glbuffers.h
@@ -110,8 +110,8 @@ public:
GLTexture2D(int width, int height);
explicit GLTexture2D(const QString& fileName, int width = 0, int height = 0);
void load(int width, int height, QRgb *data);
- virtual void bind() Q_DECL_OVERRIDE;
- virtual void unbind() Q_DECL_OVERRIDE;
+ virtual void bind() override;
+ virtual void unbind() override;
};
class GLTexture3D : public GLTexture
@@ -121,8 +121,8 @@ public:
// TODO: Implement function below
//GLTexture3D(const QString& fileName, int width = 0, int height = 0);
void load(int width, int height, int depth, QRgb *data);
- virtual void bind() Q_DECL_OVERRIDE;
- virtual void unbind() Q_DECL_OVERRIDE;
+ virtual void bind() override;
+ virtual void unbind() override;
};
class GLTextureCube : public GLTexture
@@ -131,8 +131,8 @@ public:
GLTextureCube(int size);
explicit GLTextureCube(const QStringList& fileNames, int size = 0);
void load(int size, int face, QRgb *data);
- virtual void bind() Q_DECL_OVERRIDE;
- virtual void unbind() Q_DECL_OVERRIDE;
+ virtual void bind() override;
+ virtual void unbind() override;
};
// TODO: Define and implement class below
@@ -146,7 +146,7 @@ public:
void begin(int face);
// end rendering
void end();
- virtual bool failed() const Q_DECL_OVERRIDE {return m_failed || m_fbo.failed();}
+ virtual bool failed() const override {return m_failed || m_fbo.failed();}
static void getViewMatrix(QMatrix4x4& mat, int face);
static void getProjectionMatrix(QMatrix4x4& mat, float nearZ, float farZ);
diff --git a/examples/widgets/graphicsview/boxes/main.cpp b/examples/widgets/graphicsview/boxes/main.cpp
index cc708e9433..b7242d529b 100644
--- a/examples/widgets/graphicsview/boxes/main.cpp
+++ b/examples/widgets/graphicsview/boxes/main.cpp
@@ -67,7 +67,7 @@ public:
}
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE {
+ void resizeEvent(QResizeEvent *event) override {
if (scene())
scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
QGraphicsView::resizeEvent(event);
diff --git a/examples/widgets/graphicsview/boxes/qtbox.h b/examples/widgets/graphicsview/boxes/qtbox.h
index 6eb3a39224..e283dccfb4 100644
--- a/examples/widgets/graphicsview/boxes/qtbox.h
+++ b/examples/widgets/graphicsview/boxes/qtbox.h
@@ -63,18 +63,18 @@ public:
ItemBase(int size, int x, int y);
virtual ~ItemBase();
- virtual QRectF boundingRect() const Q_DECL_OVERRIDE;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ virtual QRectF boundingRect() const override;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
virtual ItemBase *createNew(int size, int x, int y) = 0;
- virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE;
- virtual int type() const Q_DECL_OVERRIDE;
+ virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
+ virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
+ virtual void keyPressEvent(QKeyEvent *event) override;
+ virtual void wheelEvent(QGraphicsSceneWheelEvent *event) override;
+ virtual int type() const override;
bool isInResizeArea(const QPointF &pos);
static void duplicateSelectedItems(QGraphicsScene *scene);
@@ -92,9 +92,9 @@ class QtBox : public ItemBase
public:
QtBox(int size, int x, int y);
virtual ~QtBox();
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
- virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
+ virtual ItemBase *createNew(int size, int x, int y) override;
private:
QVector3D m_vertices[8];
QVector3D m_texCoords[4];
@@ -106,9 +106,9 @@ class CircleItem : public ItemBase
{
public:
CircleItem(int size, int x, int y);
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
- virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
+ virtual ItemBase *createNew(int size, int x, int y) override;
QColor m_color;
};
@@ -117,9 +117,9 @@ class SquareItem : public ItemBase
{
public:
SquareItem(int size, int x, int y);
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
- virtual ItemBase *createNew(int size, int x, int y) Q_DECL_OVERRIDE;
+ virtual ItemBase *createNew(int size, int x, int y) override;
QPixmap m_image;
};
diff --git a/examples/widgets/graphicsview/boxes/scene.h b/examples/widgets/graphicsview/boxes/scene.h
index 843b48a656..b76fb1057c 100644
--- a/examples/widgets/graphicsview/boxes/scene.h
+++ b/examples/widgets/graphicsview/boxes/scene.h
@@ -81,13 +81,13 @@ class ColorEdit : public ParameterEdit
public:
ColorEdit(QRgb initialColor, int id);
QRgb color() const {return m_color;}
- virtual void emitChange() Q_DECL_OVERRIDE {emit colorChanged(m_color, m_id);}
+ virtual void emitChange() override { emit colorChanged(m_color, m_id); }
public slots:
void editDone();
signals:
void colorChanged(QRgb color, int id);
protected:
- virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QMouseEvent *event) override;
void setColor(QRgb color); // also emits colorChanged()
private:
QGraphicsScene *m_dialogParentScene;
@@ -103,7 +103,7 @@ class FloatEdit : public ParameterEdit
public:
FloatEdit(float initialValue, int id);
float value() const {return m_value;}
- virtual void emitChange() Q_DECL_OVERRIDE {emit valueChanged(m_value, m_id);}
+ virtual void emitChange() override { emit valueChanged(m_value, m_id); }
public slots:
void editDone();
signals:
@@ -120,9 +120,9 @@ class GraphicsWidget : public QGraphicsProxyWidget
public:
GraphicsWidget() : QGraphicsProxyWidget(0, Qt::Window) {}
protected:
- virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
- virtual void resizeEvent(QGraphicsSceneResizeEvent *event) Q_DECL_OVERRIDE;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
+ virtual void resizeEvent(QGraphicsSceneResizeEvent *event) override;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
};
class TwoSidedGraphicsWidget : public QObject
@@ -162,7 +162,7 @@ signals:
void shaderChanged(int);
void doubleClicked();
protected:
- virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
QVector<QByteArray> m_parameterNames;
QComboBox *m_textureCombo;
@@ -189,7 +189,7 @@ signals:
void doubleClicked();
void newItemTriggered(ItemDialog::ItemType type);
protected:
- virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
};
class Scene : public QGraphicsScene
@@ -198,7 +198,7 @@ class Scene : public QGraphicsScene
public:
Scene(int width, int height, int maxTextureSize);
~Scene();
- virtual void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
+ virtual void drawBackground(QPainter *painter, const QRectF &rect) override;
public slots:
void setShader(int index);
@@ -214,10 +214,10 @@ protected:
void defaultStates();
void renderCubemaps();
- virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void wheelEvent(QGraphicsSceneWheelEvent * event) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
+ virtual void wheelEvent(QGraphicsSceneWheelEvent * event) override;
private:
void initGL();
QPointF pixelPosToViewPos(const QPointF& p);
diff --git a/examples/widgets/graphicsview/chip/chip.h b/examples/widgets/graphicsview/chip/chip.h
index c1d6523122..f3d54e6295 100644
--- a/examples/widgets/graphicsview/chip/chip.h
+++ b/examples/widgets/graphicsview/chip/chip.h
@@ -59,14 +59,14 @@ class Chip : public QGraphicsItem
public:
Chip(const QColor &color, int x, int y);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) override;
protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
int x;
diff --git a/examples/widgets/graphicsview/chip/view.h b/examples/widgets/graphicsview/chip/view.h
index 8f0049c628..2d174250c2 100644
--- a/examples/widgets/graphicsview/chip/view.h
+++ b/examples/widgets/graphicsview/chip/view.h
@@ -70,7 +70,7 @@ public:
protected:
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *) override;
#endif
private:
diff --git a/examples/widgets/graphicsview/collidingmice/mouse.h b/examples/widgets/graphicsview/collidingmice/mouse.h
index 1cc0d52c62..bd9e592242 100644
--- a/examples/widgets/graphicsview/collidingmice/mouse.h
+++ b/examples/widgets/graphicsview/collidingmice/mouse.h
@@ -59,13 +59,13 @@ class Mouse : public QGraphicsItem
public:
Mouse();
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget) Q_DECL_OVERRIDE;
+ QWidget *widget) override;
protected:
- void advance(int step) Q_DECL_OVERRIDE;
+ void advance(int step) override;
private:
qreal angle;
diff --git a/examples/widgets/graphicsview/diagramscene/arrow.h b/examples/widgets/graphicsview/diagramscene/arrow.h
index 2252091d4b..e0fa389d53 100644
--- a/examples/widgets/graphicsview/diagramscene/arrow.h
+++ b/examples/widgets/graphicsview/diagramscene/arrow.h
@@ -73,9 +73,9 @@ public:
Arrow(DiagramItem *startItem, DiagramItem *endItem,
QGraphicsItem *parent = 0);
- int type() const Q_DECL_OVERRIDE { return Type; }
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
+ int type() const override { return Type; }
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
void setColor(const QColor &color) { myColor = color; }
DiagramItem *startItem() const { return myStartItem; }
DiagramItem *endItem() const { return myEndItem; }
@@ -83,7 +83,7 @@ public:
void updatePosition();
protected:
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
private:
DiagramItem *myStartItem;
diff --git a/examples/widgets/graphicsview/diagramscene/diagramitem.h b/examples/widgets/graphicsview/diagramscene/diagramitem.h
index f1c4222aed..3a43ec57fc 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramitem.h
+++ b/examples/widgets/graphicsview/diagramscene/diagramitem.h
@@ -85,11 +85,11 @@ public:
QPolygonF polygon() const { return myPolygon; }
void addArrow(Arrow *arrow);
QPixmap image() const;
- int type() const Q_DECL_OVERRIDE { return Type;}
+ int type() const override { return Type;}
protected:
- void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
private:
DiagramType myDiagramType;
diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.h b/examples/widgets/graphicsview/diagramscene/diagramscene.h
index 6f38201f00..95f7f3c621 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramscene.h
+++ b/examples/widgets/graphicsview/diagramscene/diagramscene.h
@@ -95,9 +95,9 @@ signals:
void itemSelected(QGraphicsItem *item);
protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
private:
bool isItemChange(int type);
diff --git a/examples/widgets/graphicsview/diagramscene/diagramtextitem.h b/examples/widgets/graphicsview/diagramscene/diagramtextitem.h
index 9db03141b1..f5d3d3b95e 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramtextitem.h
+++ b/examples/widgets/graphicsview/diagramscene/diagramtextitem.h
@@ -71,16 +71,16 @@ public:
DiagramTextItem(QGraphicsItem *parent = 0);
- int type() const Q_DECL_OVERRIDE { return Type; }
+ int type() const override { return Type; }
signals:
void lostFocus(DiagramTextItem *item);
void selectedChange(QGraphicsItem *item);
protected:
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
};
//! [0]
diff --git a/examples/widgets/graphicsview/dragdroprobot/coloritem.h b/examples/widgets/graphicsview/dragdroprobot/coloritem.h
index 9c7471ffbd..7701928c27 100644
--- a/examples/widgets/graphicsview/dragdroprobot/coloritem.h
+++ b/examples/widgets/graphicsview/dragdroprobot/coloritem.h
@@ -59,13 +59,13 @@ class ColorItem : public QGraphicsItem
public:
ColorItem();
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
QColor color;
diff --git a/examples/widgets/graphicsview/dragdroprobot/main.cpp b/examples/widgets/graphicsview/dragdroprobot/main.cpp
index 6906976cb6..ff3758ac60 100644
--- a/examples/widgets/graphicsview/dragdroprobot/main.cpp
+++ b/examples/widgets/graphicsview/dragdroprobot/main.cpp
@@ -63,7 +63,7 @@ public:
}
protected:
- virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
+ virtual void resizeEvent(QResizeEvent *) override
{
}
};
diff --git a/examples/widgets/graphicsview/dragdroprobot/robot.h b/examples/widgets/graphicsview/dragdroprobot/robot.h
index 8e20bf2cbf..e25966c7c4 100644
--- a/examples/widgets/graphicsview/dragdroprobot/robot.h
+++ b/examples/widgets/graphicsview/dragdroprobot/robot.h
@@ -65,9 +65,9 @@ public:
RobotPart(QGraphicsItem *parent = 0);
protected:
- void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dropEvent(QGraphicsSceneDragDropEvent *event) override;
QColor color;
bool dragOver;
@@ -80,12 +80,12 @@ class RobotHead : public RobotPart
public:
RobotHead(QGraphicsItem *parent = 0);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
protected:
- void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dropEvent(QGraphicsSceneDragDropEvent *event) override;
private:
QPixmap pixmap;
@@ -98,8 +98,8 @@ class RobotTorso : public RobotPart
public:
RobotTorso(QGraphicsItem *parent = 0);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
};
//! [2]
@@ -109,8 +109,8 @@ class RobotLimb : public RobotPart
public:
RobotLimb(QGraphicsItem *parent = 0);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
};
//! [3]
@@ -120,8 +120,8 @@ class Robot : public RobotPart
public:
Robot(QGraphicsItem *parent = 0);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
};
//! [4]
diff --git a/examples/widgets/graphicsview/elasticnodes/edge.h b/examples/widgets/graphicsview/elasticnodes/edge.h
index 6409af3a89..19072b8b33 100644
--- a/examples/widgets/graphicsview/elasticnodes/edge.h
+++ b/examples/widgets/graphicsview/elasticnodes/edge.h
@@ -67,11 +67,11 @@ public:
void adjust();
enum { Type = UserType + 2 };
- int type() const Q_DECL_OVERRIDE { return Type; }
+ int type() const override { return Type; }
protected:
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
private:
Node *source, *dest;
diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.h b/examples/widgets/graphicsview/elasticnodes/graphwidget.h
index 2b26cb6d67..79acb89985 100644
--- a/examples/widgets/graphicsview/elasticnodes/graphwidget.h
+++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.h
@@ -71,12 +71,12 @@ public slots:
void zoomOut();
protected:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *event) override;
#endif
- void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
+ void drawBackground(QPainter *painter, const QRectF &rect) override;
void scaleView(qreal scaleFactor);
diff --git a/examples/widgets/graphicsview/elasticnodes/node.h b/examples/widgets/graphicsview/elasticnodes/node.h
index 6c8a49ca4f..487ae0d68e 100644
--- a/examples/widgets/graphicsview/elasticnodes/node.h
+++ b/examples/widgets/graphicsview/elasticnodes/node.h
@@ -70,20 +70,20 @@ public:
QList<Edge *> edges() const;
enum { Type = UserType + 1 };
- int type() const Q_DECL_OVERRIDE { return Type; }
+ int type() const override { return Type; }
void calculateForces();
bool advance();
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
- void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
QList<Edge *> edgeList;
diff --git a/examples/widgets/graphicsview/embeddeddialogs/customproxy.h b/examples/widgets/graphicsview/embeddeddialogs/customproxy.h
index 05ae087931..36209b7073 100644
--- a/examples/widgets/graphicsview/embeddeddialogs/customproxy.h
+++ b/examples/widgets/graphicsview/embeddeddialogs/customproxy.h
@@ -61,15 +61,15 @@ class CustomProxy : public QGraphicsProxyWidget
public:
explicit CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget) Q_DECL_OVERRIDE;
+ QWidget *widget) override;
protected:
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) Q_DECL_OVERRIDE;
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
+ bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override;
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
private slots:
void updateStep(qreal step);
diff --git a/examples/widgets/graphicsview/embeddeddialogs/main.cpp b/examples/widgets/graphicsview/embeddeddialogs/main.cpp
index dcab0ee3a8..cbd5dd5890 100644
--- a/examples/widgets/graphicsview/embeddeddialogs/main.cpp
+++ b/examples/widgets/graphicsview/embeddeddialogs/main.cpp
@@ -62,11 +62,7 @@ int main(int argc, char *argv[])
QGraphicsScene scene;
scene.setStickyFocus(true);
-#ifndef Q_OS_WINCE
const int gridSize = 10;
-#else
- const int gridSize = 5;
-#endif
for (int y = 0; y < gridSize; ++y) {
for (int x = 0; x < gridSize; ++x) {
diff --git a/examples/widgets/graphicsview/flowlayout/flowlayout.h b/examples/widgets/graphicsview/flowlayout/flowlayout.h
index cb3d2ad590..808f5d2c77 100644
--- a/examples/widgets/graphicsview/flowlayout/flowlayout.h
+++ b/examples/widgets/graphicsview/flowlayout/flowlayout.h
@@ -60,14 +60,14 @@ public:
qreal spacing(Qt::Orientation o) const;
// inherited functions
- void setGeometry(const QRectF &geom) Q_DECL_OVERRIDE;
+ void setGeometry(const QRectF &geom) override;
- int count() const Q_DECL_OVERRIDE;
- QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- void removeAt(int index) Q_DECL_OVERRIDE;
+ int count() const override;
+ QGraphicsLayoutItem *itemAt(int index) const override;
+ void removeAt(int index) override;
protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
private:
qreal doLayout(const QRectF &geom, bool applyNewGeometry) const;
diff --git a/examples/widgets/graphicsview/graphicsview.pro b/examples/widgets/graphicsview/graphicsview.pro
index 06a7ce8071..5a054fe6b2 100644
--- a/examples/widgets/graphicsview/graphicsview.pro
+++ b/examples/widgets/graphicsview/graphicsview.pro
@@ -15,6 +15,6 @@ SUBDIRS = \
contains(DEFINES, QT_NO_CURSOR)|contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= dragdroprobot
-qtHaveModule(opengl):!contains(QT_CONFIG, opengles.):!contains(QT_CONFIG,dynamicgl) {
+qtHaveModule(opengl):!qtConfig(opengles.):!qtConfig(dynamicgl) {
SUBDIRS += boxes
}
diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.h b/examples/widgets/graphicsview/padnavigator/padnavigator.h
index 1fcc9b0cf3..00cf2c0212 100644
--- a/examples/widgets/graphicsview/padnavigator/padnavigator.h
+++ b/examples/widgets/graphicsview/padnavigator/padnavigator.h
@@ -67,7 +67,7 @@ public:
explicit PadNavigator(const QSize &size, QWidget *parent = 0);
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) override;
private:
Ui::Form form;
diff --git a/examples/widgets/graphicsview/padnavigator/roundrectitem.h b/examples/widgets/graphicsview/padnavigator/roundrectitem.h
index 3fbf8d2c2f..e76862c08c 100644
--- a/examples/widgets/graphicsview/padnavigator/roundrectitem.h
+++ b/examples/widgets/graphicsview/padnavigator/roundrectitem.h
@@ -66,8 +66,8 @@ public:
QPixmap pixmap() const;
void setPixmap(const QPixmap &pixmap);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
bool fill() const;
void setFill(bool fill);
diff --git a/examples/widgets/graphicsview/padnavigator/splashitem.h b/examples/widgets/graphicsview/padnavigator/splashitem.h
index 6945e90a86..2ad54f82a1 100644
--- a/examples/widgets/graphicsview/padnavigator/splashitem.h
+++ b/examples/widgets/graphicsview/padnavigator/splashitem.h
@@ -60,8 +60,8 @@ class SplashItem : public QGraphicsObject
public:
explicit SplashItem(QGraphicsItem *parent = 0);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
private:
QString text;
diff --git a/examples/widgets/graphicsview/simpleanchorlayout/main.cpp b/examples/widgets/graphicsview/simpleanchorlayout/main.cpp
index 99cb2d01fa..299a5ad7bd 100644
--- a/examples/widgets/graphicsview/simpleanchorlayout/main.cpp
+++ b/examples/widgets/graphicsview/simpleanchorlayout/main.cpp
@@ -62,7 +62,7 @@ public:
{
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget * = 0) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget * = 0) override
{
QFont font;
font.setPixelSize(0.75 * qMin(boundingRect().width(), boundingRect().height()));
diff --git a/examples/widgets/graphicsview/weatheranchorlayout/main.cpp b/examples/widgets/graphicsview/weatheranchorlayout/main.cpp
index 01ce1ce0f0..ec1f73bf9c 100644
--- a/examples/widgets/graphicsview/weatheranchorlayout/main.cpp
+++ b/examples/widgets/graphicsview/weatheranchorlayout/main.cpp
@@ -69,7 +69,7 @@ public:
{
}
- virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE
+ virtual void resizeEvent(QResizeEvent *event) override
{
w->setGeometry(0, 0, event->size().width(), event->size().height());
}
@@ -101,7 +101,7 @@ public:
original->setZValue(z);
}
- void setGeometry (const QRectF &rect) Q_DECL_OVERRIDE
+ void setGeometry (const QRectF &rect) override
{
original->setTransform(QTransform::fromScale(rect.width() / r.width(),
rect.height() / r.height()), true);
@@ -110,7 +110,7 @@ public:
}
protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override
{
Q_UNUSED(constraint);
QSizeF sh;
@@ -148,7 +148,7 @@ public:
{
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
{
QPointF reflection = QPointF();
reflection.setY(scaled.height() + 2);
@@ -180,14 +180,14 @@ public:
painter->drawPixmap(reflection, tmp);
}
- void resizeEvent(QGraphicsSceneResizeEvent *event) Q_DECL_OVERRIDE
+ void resizeEvent(QGraphicsSceneResizeEvent *event) override
{
QSize newSize = event->newSize().toSize();
newSize.setHeight(newSize.height() / 2);
scaled = original.scaled(newSize);
}
- QRectF boundingRect() const Q_DECL_OVERRIDE
+ QRectF boundingRect() const override
{
QSize size(scaled.width(), scaled.height() * 2 + 2);
return QRectF(QPointF(0, 0), size);
diff --git a/examples/widgets/itemviews/addressbook/tablemodel.h b/examples/widgets/itemviews/addressbook/tablemodel.h
index de81df1430..9a669c508d 100644
--- a/examples/widgets/itemviews/addressbook/tablemodel.h
+++ b/examples/widgets/itemviews/addressbook/tablemodel.h
@@ -64,14 +64,14 @@ public:
TableModel(QObject *parent = 0);
TableModel(QList<QPair<QString, QString> > listofPairs, QObject *parent = 0);
- int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
- bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent) const override;
+ int columnCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
+ bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
QList<QPair<QString, QString> > getList();
private:
diff --git a/examples/widgets/itemviews/chart/pieview.h b/examples/widgets/itemviews/chart/pieview.h
index 9e2011499e..aa397e6d55 100644
--- a/examples/widgets/itemviews/chart/pieview.h
+++ b/examples/widgets/itemviews/chart/pieview.h
@@ -61,44 +61,44 @@ class PieView : public QAbstractItemView
public:
PieView(QWidget *parent = 0);
- QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
- QModelIndex indexAt(const QPoint &point) const Q_DECL_OVERRIDE;
+ QRect visualRect(const QModelIndex &index) const override;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
+ QModelIndex indexAt(const QPoint &point) const override;
protected slots:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
- const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE;
- void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
- void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ const QVector<int> &roles = QVector<int>()) override;
+ void rowsInserted(const QModelIndex &parent, int start, int end) override;
+ void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
protected:
- bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) Q_DECL_OVERRIDE;
+ bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) override;
QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction,
- Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
+ Qt::KeyboardModifiers modifiers) override;
- int horizontalOffset() const Q_DECL_OVERRIDE;
- int verticalOffset() const Q_DECL_OVERRIDE;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
- bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ bool isIndexHidden(const QModelIndex &index) const override;
- void setSelection(const QRect&, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
+ void setSelection(const QRect&, QItemSelectionModel::SelectionFlags command) override;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void scrollContentsBy(int dx, int dy) override;
- QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const override;
private:
QRect itemRect(const QModelIndex &item) const;
QRegion itemRegion(const QModelIndex &index) const;
int rows(const QModelIndex &index = QModelIndex()) const;
- void updateGeometries() Q_DECL_OVERRIDE;
+ void updateGeometries() override;
int margin;
int totalSize;
diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
index 00db49220a..e2aff3c829 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
+++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
@@ -69,8 +69,8 @@ public:
void setFilterMaximumDate(const QDate &date);
protected:
- bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const Q_DECL_OVERRIDE;
- bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
private:
bool dateInRange(const QDate &date) const;
diff --git a/examples/widgets/itemviews/editabletreemodel/treemodel.h b/examples/widgets/itemviews/editabletreemodel/treemodel.h
index e9dfbf63d2..d76d138831 100644
--- a/examples/widgets/itemviews/editabletreemodel/treemodel.h
+++ b/examples/widgets/itemviews/editabletreemodel/treemodel.h
@@ -68,33 +68,33 @@ public:
~TreeModel();
//! [0] //! [1]
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &index) const override;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
//! [1]
//! [2]
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
bool setData(const QModelIndex &index, const QVariant &value,
- int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ int role = Qt::EditRole) override;
bool setHeaderData(int section, Qt::Orientation orientation,
- const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ const QVariant &value, int role = Qt::EditRole) override;
bool insertColumns(int position, int columns,
- const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) override;
bool removeColumns(int position, int columns,
- const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) override;
bool insertRows(int position, int rows,
- const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) override;
bool removeRows(int position, int rows,
- const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) override;
private:
void setupModelData(const QStringList &lines, TreeItem *parent);
diff --git a/examples/widgets/itemviews/fetchmore/filelistmodel.h b/examples/widgets/itemviews/fetchmore/filelistmodel.h
index 79646799b2..9251eaf959 100644
--- a/examples/widgets/itemviews/fetchmore/filelistmodel.h
+++ b/examples/widgets/itemviews/fetchmore/filelistmodel.h
@@ -63,8 +63,8 @@ class FileListModel : public QAbstractListModel
public:
FileListModel(QObject *parent = 0);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
signals:
void numberPopulated(int number);
@@ -73,8 +73,8 @@ public slots:
void setDirPath(const QString &path);
protected:
- bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE;
+ bool canFetchMore(const QModelIndex &parent) const override;
+ void fetchMore(const QModelIndex &parent) override;
private:
QStringList fileList;
diff --git a/examples/widgets/itemviews/frozencolumn/freezetablewidget.h b/examples/widgets/itemviews/frozencolumn/freezetablewidget.h
index 137ee83d5d..51c46fb7e7 100644
--- a/examples/widgets/itemviews/frozencolumn/freezetablewidget.h
+++ b/examples/widgets/itemviews/frozencolumn/freezetablewidget.h
@@ -63,9 +63,9 @@ public:
protected:
- virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
- void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
+ virtual void resizeEvent(QResizeEvent *event) override;
+ virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
+ void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible) override;
private:
QTableView *frozenTableView;
diff --git a/examples/widgets/itemviews/interview/model.h b/examples/widgets/itemviews/interview/model.h
index cd69cb6986..969cf693b2 100644
--- a/examples/widgets/itemviews/interview/model.h
+++ b/examples/widgets/itemviews/interview/model.h
@@ -64,17 +64,17 @@ public:
Model(int rows, int columns, QObject *parent = 0);
~Model();
- QModelIndex index(int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
- int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent) const override;
+ int columnCount(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
- bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ bool hasChildren(const QModelIndex &parent) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
private:
diff --git a/examples/widgets/itemviews/pixelator/imagemodel.h b/examples/widgets/itemviews/pixelator/imagemodel.h
index 8b476a3d04..c6c510dcac 100644
--- a/examples/widgets/itemviews/pixelator/imagemodel.h
+++ b/examples/widgets/itemviews/pixelator/imagemodel.h
@@ -64,11 +64,11 @@ public:
void setImage(const QImage &image);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
private:
QImage modelImage;
diff --git a/examples/widgets/itemviews/pixelator/pixeldelegate.h b/examples/widgets/itemviews/pixelator/pixeldelegate.h
index 85ef0e0b1c..d968d9e8d2 100644
--- a/examples/widgets/itemviews/pixelator/pixeldelegate.h
+++ b/examples/widgets/itemviews/pixelator/pixeldelegate.h
@@ -72,10 +72,10 @@ public:
PixelDelegate(QObject *parent = 0);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index ) const Q_DECL_OVERRIDE;
+ const QModelIndex &index ) const override;
public slots:
void setPixelSize(int size);
diff --git a/examples/widgets/itemviews/puzzle/piecesmodel.h b/examples/widgets/itemviews/puzzle/piecesmodel.h
index d7293ffa6c..bd979f4c7e 100644
--- a/examples/widgets/itemviews/puzzle/piecesmodel.h
+++ b/examples/widgets/itemviews/puzzle/piecesmodel.h
@@ -68,16 +68,16 @@ class PiecesModel : public QAbstractListModel
public:
explicit PiecesModel(int pieceSize, QObject *parent = 0);
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool removeRows(int row, int count, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ bool removeRows(int row, int count, const QModelIndex &parent) override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
- QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
+ QStringList mimeTypes() const override;
+ int rowCount(const QModelIndex &parent) const override;
+ Qt::DropActions supportedDropActions() const override;
void addPiece(const QPixmap &pixmap, const QPoint &location);
void addPieces(const QPixmap& pixmap);
diff --git a/examples/widgets/itemviews/puzzle/puzzle.pro b/examples/widgets/itemviews/puzzle/puzzle.pro
index a5379293ff..55f1d7e709 100644
--- a/examples/widgets/itemviews/puzzle/puzzle.pro
+++ b/examples/widgets/itemviews/puzzle/puzzle.pro
@@ -12,8 +12,3 @@ SOURCES = main.cpp \
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/puzzle
INSTALLS += target
-
-
-wince* {
- DEPLOYMENT_PLUGIN += qjpeg qgif
-}
diff --git a/examples/widgets/itemviews/puzzle/puzzlewidget.h b/examples/widgets/itemviews/puzzle/puzzlewidget.h
index 2b6bd061ba..137e0b7162 100644
--- a/examples/widgets/itemviews/puzzle/puzzlewidget.h
+++ b/examples/widgets/itemviews/puzzle/puzzlewidget.h
@@ -77,12 +77,12 @@ signals:
void puzzleCompleted();
protected:
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
int findPiece(const QRect &pieceRect) const;
diff --git a/examples/widgets/itemviews/simpledommodel/dommodel.h b/examples/widgets/itemviews/simpledommodel/dommodel.h
index 7028aa89b2..411f58295c 100644
--- a/examples/widgets/itemviews/simpledommodel/dommodel.h
+++ b/examples/widgets/itemviews/simpledommodel/dommodel.h
@@ -66,15 +66,15 @@ public:
explicit DomModel(QDomDocument document, QObject *parent = 0);
~DomModel();
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
private:
QDomDocument domDocument;
diff --git a/examples/widgets/itemviews/simpletreemodel/treemodel.h b/examples/widgets/itemviews/simpletreemodel/treemodel.h
index 8c67477d4b..800728fb82 100644
--- a/examples/widgets/itemviews/simpletreemodel/treemodel.h
+++ b/examples/widgets/itemviews/simpletreemodel/treemodel.h
@@ -66,15 +66,15 @@ public:
explicit TreeModel(const QString &data, QObject *parent = 0);
~TreeModel();
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &index) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
private:
void setupModelData(const QStringList &lines, TreeItem *parent);
diff --git a/examples/widgets/itemviews/spinboxdelegate/delegate.h b/examples/widgets/itemviews/spinboxdelegate/delegate.h
index 7c9c50706e..47ef1555f7 100644
--- a/examples/widgets/itemviews/spinboxdelegate/delegate.h
+++ b/examples/widgets/itemviews/spinboxdelegate/delegate.h
@@ -62,14 +62,14 @@ public:
SpinBoxDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QStyleOptionViewItem &option, const QModelIndex &index) const override;
};
//! [0]
diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h b/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h
index 5fbd4894d5..333467720f 100644
--- a/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h
+++ b/examples/widgets/itemviews/spreadsheet/spreadsheetdelegate.h
@@ -62,10 +62,10 @@ class SpreadSheetDelegate : public QItemDelegate
public:
SpreadSheetDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
private slots:
void commitAndCloseEditor();
diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h
index e43d222f48..46460df527 100644
--- a/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h
+++ b/examples/widgets/itemviews/spreadsheet/spreadsheetitem.h
@@ -61,10 +61,10 @@ public:
SpreadSheetItem();
SpreadSheetItem(const QString &text);
- QTableWidgetItem *clone() const Q_DECL_OVERRIDE;
+ QTableWidgetItem *clone() const override;
- QVariant data(int role) const Q_DECL_OVERRIDE;
- void setData(int role, const QVariant &value) Q_DECL_OVERRIDE;
+ QVariant data(int role) const override;
+ void setData(int role, const QVariant &value) override;
QVariant display() const;
inline QString formula() const
diff --git a/examples/widgets/itemviews/stardelegate/stardelegate.h b/examples/widgets/itemviews/stardelegate/stardelegate.h
index f8e49e5bd1..ffc65fbedd 100644
--- a/examples/widgets/itemviews/stardelegate/stardelegate.h
+++ b/examples/widgets/itemviews/stardelegate/stardelegate.h
@@ -62,14 +62,14 @@ public:
StarDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {}
void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
private slots:
void commitAndCloseEditor();
diff --git a/examples/widgets/itemviews/stardelegate/stareditor.h b/examples/widgets/itemviews/stardelegate/stareditor.h
index 6bd5008d50..4a4c3a4954 100644
--- a/examples/widgets/itemviews/stardelegate/stareditor.h
+++ b/examples/widgets/itemviews/stardelegate/stareditor.h
@@ -63,7 +63,7 @@ class StarEditor : public QWidget
public:
StarEditor(QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
void setStarRating(const StarRating &starRating) {
myStarRating = starRating;
}
@@ -73,9 +73,9 @@ signals:
void editingFinished();
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
private:
int starAtPosition(int x);
diff --git a/examples/widgets/layouts/borderlayout/borderlayout.h b/examples/widgets/layouts/borderlayout/borderlayout.h
index 0ccdb1be60..4c0c01f90b 100644
--- a/examples/widgets/layouts/borderlayout/borderlayout.h
+++ b/examples/widgets/layouts/borderlayout/borderlayout.h
@@ -63,16 +63,16 @@ public:
BorderLayout(int spacing = -1);
~BorderLayout();
- void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *item) override;
void addWidget(QWidget *widget, Position position);
- Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
- bool hasHeightForWidth() const Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
+ Qt::Orientations expandingDirections() const override;
+ bool hasHeightForWidth() const override;
+ int count() const override;
+ QLayoutItem *itemAt(int index) const override;
+ QSize minimumSize() const override;
+ void setGeometry(const QRect &rect) override;
+ QSize sizeHint() const override;
+ QLayoutItem *takeAt(int index) override;
void add(QLayoutItem *item, Position position);
diff --git a/examples/widgets/layouts/flowlayout/flowlayout.h b/examples/widgets/layouts/flowlayout/flowlayout.h
index 90cc59dcfd..3155d5d347 100644
--- a/examples/widgets/layouts/flowlayout/flowlayout.h
+++ b/examples/widgets/layouts/flowlayout/flowlayout.h
@@ -62,18 +62,18 @@ public:
explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
~FlowLayout();
- void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *item) override;
int horizontalSpacing() const;
int verticalSpacing() const;
- Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
- bool hasHeightForWidth() const Q_DECL_OVERRIDE;
- int heightForWidth(int) const Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
+ Qt::Orientations expandingDirections() const override;
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int) const override;
+ int count() const override;
+ QLayoutItem *itemAt(int index) const override;
+ QSize minimumSize() const override;
+ void setGeometry(const QRect &rect) override;
+ QSize sizeHint() const override;
+ QLayoutItem *takeAt(int index) override;
private:
int doLayout(const QRect &rect, bool testOnly) const;
diff --git a/examples/widgets/mainwindows/application/mainwindow.h b/examples/widgets/mainwindows/application/mainwindow.h
index 9e3e1e907a..1300247ce7 100644
--- a/examples/widgets/mainwindows/application/mainwindow.h
+++ b/examples/widgets/mainwindows/application/mainwindow.h
@@ -71,7 +71,7 @@ public:
void loadFile(const QString &fileName);
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void newFile();
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
index 73076c20b0..c47b80275f 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
@@ -112,8 +112,8 @@ class ColorDock : public QFrame
public:
explicit ColorDock(const QString &c, QWidget *parent);
- QSize sizeHint() const Q_DECL_OVERRIDE { return szHint; }
- QSize minimumSizeHint() const Q_DECL_OVERRIDE { return minSzHint; }
+ QSize sizeHint() const override { return szHint; }
+ QSize minimumSizeHint() const override { return minSzHint; }
void setCustomSizeHint(const QSize &size);
@@ -121,7 +121,7 @@ public slots:
void changeSizeHints();
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
private:
const QString color;
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.h b/examples/widgets/mainwindows/mainwindow/colorswatch.h
index c2f6ef19b9..ec9d9e7372 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.h
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.h
@@ -69,9 +69,9 @@ public:
protected:
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *event) override;
#endif // QT_NO_CONTEXTMENU
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *e) override;
private slots:
void changeClosable(bool on);
@@ -130,12 +130,12 @@ class BlueTitleBar : public QWidget
public:
explicit BlueTitleBar(QWidget *parent = Q_NULLPTR);
- QSize sizeHint() const Q_DECL_OVERRIDE { return minimumSizeHint(); }
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override { return minimumSizeHint(); }
+ QSize minimumSizeHint() const override;
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
public slots:
void updateMask();
diff --git a/examples/widgets/mainwindows/mdi/mainwindow.h b/examples/widgets/mainwindows/mdi/mainwindow.h
index 4525b52697..f163145c2c 100644
--- a/examples/widgets/mainwindows/mdi/mainwindow.h
+++ b/examples/widgets/mainwindows/mdi/mainwindow.h
@@ -71,7 +71,7 @@ public:
bool openFile(const QString &fileName);
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void newFile();
diff --git a/examples/widgets/mainwindows/mdi/mdichild.h b/examples/widgets/mainwindows/mdi/mdichild.h
index 22fbb28212..2ac8194f73 100644
--- a/examples/widgets/mainwindows/mdi/mdichild.h
+++ b/examples/widgets/mainwindows/mdi/mdichild.h
@@ -69,7 +69,7 @@ public:
QString currentFile() { return curFile; }
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void documentWasModified();
diff --git a/examples/widgets/mainwindows/menus/mainwindow.h b/examples/widgets/mainwindows/menus/mainwindow.h
index 590d7c7550..1f1a065aaf 100644
--- a/examples/widgets/mainwindows/menus/mainwindow.h
+++ b/examples/widgets/mainwindows/menus/mainwindow.h
@@ -70,7 +70,7 @@ public:
protected:
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *event) override;
#endif // QT_NO_CONTEXTMENU
//! [0]
diff --git a/examples/widgets/mainwindows/sdi/mainwindow.h b/examples/widgets/mainwindows/sdi/mainwindow.h
index 4b4beaeaae..059710eacb 100644
--- a/examples/widgets/mainwindows/sdi/mainwindow.h
+++ b/examples/widgets/mainwindows/sdi/mainwindow.h
@@ -73,7 +73,7 @@ public:
void tile(const QMainWindow *previous);
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void newFile();
diff --git a/examples/widgets/painting/affine/affine.pro b/examples/widgets/painting/affine/affine.pro
index be6a83960d..0ad869183c 100644
--- a/examples/widgets/painting/affine/affine.pro
+++ b/examples/widgets/painting/affine/affine.pro
@@ -16,7 +16,3 @@ RESOURCES += affine.qrc
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/affine
INSTALLS += target
-
-wince {
- DEPLOYMENT_PLUGIN += qjpeg
-}
diff --git a/examples/widgets/painting/affine/xform.h b/examples/widgets/painting/affine/xform.h
index 11c8fbde90..f2eed99b4f 100644
--- a/examples/widgets/painting/affine/xform.h
+++ b/examples/widgets/painting/affine/xform.h
@@ -80,14 +80,14 @@ public:
enum XFormType { VectorType, PixmapType, TextType };
XFormView(QWidget *parent);
- void paint(QPainter *) Q_DECL_OVERRIDE;
+ void paint(QPainter *) override;
void drawVectorType(QPainter *painter);
void drawPixmapType(QPainter *painter);
void drawTextType(QPainter *painter);
- QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(500, 500); }
+ QSize sizeHint() const override { return QSize(500, 500); }
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
HoverPoints *hoverPoints() { return pts; }
bool animation() const { return timer.isActive(); }
@@ -124,9 +124,9 @@ signals:
void shearChanged(int shear);
protected:
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *) override;
#endif
private:
diff --git a/examples/widgets/painting/basicdrawing/renderarea.h b/examples/widgets/painting/basicdrawing/renderarea.h
index db44d8aa14..fb4aab470b 100644
--- a/examples/widgets/painting/basicdrawing/renderarea.h
+++ b/examples/widgets/painting/basicdrawing/renderarea.h
@@ -67,8 +67,8 @@ public:
RenderArea(QWidget *parent = 0);
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
public slots:
void setShape(Shape shape);
@@ -78,7 +78,7 @@ public slots:
void setTransformed(bool transformed);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
private:
Shape shape;
diff --git a/examples/widgets/painting/composition/composition.cpp b/examples/widgets/painting/composition/composition.cpp
index 1c2802f860..d5d674fd83 100644
--- a/examples/widgets/painting/composition/composition.cpp
+++ b/examples/widgets/painting/composition/composition.cpp
@@ -290,7 +290,7 @@ void CompositionRenderer::updateCirclePos()
if (m_current_object != NoObject)
return;
QDateTime dt = QDateTime::currentDateTime();
- qreal t = (dt.toTime_t() * 1000 + dt.time().msec()) / 1000.0;
+ qreal t = dt.toMSecsSinceEpoch() / 1000.0;
qreal x = width() / qreal(2) + (qCos(t*8/11) + qSin(-t)) * width() / qreal(4);
qreal y = height() / qreal(2) + (qSin(t*6/7) + qCos(t * qreal(1.5))) * height() / qreal(4);
diff --git a/examples/widgets/painting/composition/composition.h b/examples/widgets/painting/composition/composition.h
index 015dd13098..49853f503b 100644
--- a/examples/widgets/painting/composition/composition.h
+++ b/examples/widgets/painting/composition/composition.h
@@ -118,21 +118,21 @@ class CompositionRenderer : public ArthurFrame
public:
CompositionRenderer(QWidget *parent);
- void paint(QPainter *) Q_DECL_OVERRIDE;
+ void paint(QPainter *) override;
void setCirclePos(const QPointF &pos);
- QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(500, 400); }
+ QSize sizeHint() const override { return QSize(500, 400); }
bool animationEnabled() const { return m_animation_enabled; }
int circleColor() const { return m_circle_hue; }
int circleAlpha() const { return m_circle_alpha; }
protected:
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void timerEvent(QTimerEvent *) override;
public slots:
void setClearMode() { m_composition_mode = QPainter::CompositionMode_Clear; update(); }
diff --git a/examples/widgets/painting/composition/composition.pro b/examples/widgets/painting/composition/composition.pro
index 3b64714ba2..5fdbe4a5a2 100644
--- a/examples/widgets/painting/composition/composition.pro
+++ b/examples/widgets/painting/composition/composition.pro
@@ -6,7 +6,7 @@ SHARED_FOLDER = ../shared
include($$SHARED_FOLDER/shared.pri)
RESOURCES += composition.qrc
-qtHaveModule(opengl): !contains(QT_CONFIG,dynamicgl) {
+qtHaveModule(opengl):!qtConfig(dynamicgl) {
DEFINES += USE_OPENGL
QT += opengl
}
@@ -15,7 +15,3 @@ QT += widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/composition
INSTALLS += target
-
-wince* {
- DEPLOYMENT_PLUGIN += qjpeg
-}
diff --git a/examples/widgets/painting/concentriccircles/circlewidget.h b/examples/widgets/painting/concentriccircles/circlewidget.h
index 99e39ca2bb..79fd5c71da 100644
--- a/examples/widgets/painting/concentriccircles/circlewidget.h
+++ b/examples/widgets/painting/concentriccircles/circlewidget.h
@@ -64,14 +64,14 @@ public:
void setFloatBased(bool floatBased);
void setAntialiased(bool antialiased);
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
public slots:
void nextAnimationFrame();
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
private:
bool floatBased;
diff --git a/examples/widgets/painting/deform/pathdeform.h b/examples/widgets/painting/deform/pathdeform.h
index 46c1d2c5ac..68908045b9 100644
--- a/examples/widgets/painting/deform/pathdeform.h
+++ b/examples/widgets/painting/deform/pathdeform.h
@@ -69,14 +69,14 @@ class PathDeformRenderer : public ArthurFrame
public:
explicit PathDeformRenderer(QWidget *widget, bool smallScreen = false);
- void paint(QPainter *painter) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter) override;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
- QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(600, 500); }
+ QSize sizeHint() const override { return QSize(600, 500); }
bool animated() const { return m_animated; }
int radius() const { return int(m_radius); }
diff --git a/examples/widgets/painting/gradients/gradients.h b/examples/widgets/painting/gradients/gradients.h
index b15a586d72..b4db298bb4 100644
--- a/examples/widgets/painting/gradients/gradients.h
+++ b/examples/widgets/painting/gradients/gradients.h
@@ -76,9 +76,9 @@ public:
void setGradientStops(const QGradientStops &stops);
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) override;
- QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(150, 40); }
+ QSize sizeHint() const override { return QSize(150, 40); }
QPolygonF points() const;
HoverPoints *hoverPoints() const { return m_hoverPoints; }
@@ -125,12 +125,12 @@ class GradientRenderer : public ArthurFrame
public:
GradientRenderer(QWidget *parent);
- void paint(QPainter *p) Q_DECL_OVERRIDE;
+ void paint(QPainter *p) override;
- QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(400, 400); }
+ QSize sizeHint() const override { return QSize(400, 400); }
HoverPoints *hoverPoints() const { return m_hoverPoints; }
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *e) override;
public slots:
void setGradientStops(const QGradientStops &stops);
diff --git a/examples/widgets/painting/painterpaths/renderarea.h b/examples/widgets/painting/painterpaths/renderarea.h
index 0c07108589..5f0874b772 100644
--- a/examples/widgets/painting/painterpaths/renderarea.h
+++ b/examples/widgets/painting/painterpaths/renderarea.h
@@ -62,8 +62,8 @@ class RenderArea : public QWidget
public:
explicit RenderArea(const QPainterPath &path, QWidget *parent = 0);
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
public slots:
void setFillRule(Qt::FillRule rule);
@@ -73,7 +73,7 @@ public slots:
void setRotationAngle(int degrees);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
//! [0]
//! [1]
diff --git a/examples/widgets/painting/pathstroke/pathstroke.h b/examples/widgets/painting/pathstroke/pathstroke.h
index f5f2a9ae00..71352c8cc2 100644
--- a/examples/widgets/painting/pathstroke/pathstroke.h
+++ b/examples/widgets/painting/pathstroke/pathstroke.h
@@ -65,14 +65,14 @@ public:
explicit PathStrokeRenderer(QWidget *parent, bool smallScreen = false);
- void paint(QPainter *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
-
- QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(500, 500); }
+ void paint(QPainter *) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
+ bool event(QEvent *e) override;
+
+ QSize sizeHint() const override { return QSize(500, 500); }
bool animation() const { return m_timer.isActive(); }
diff --git a/examples/widgets/painting/shared/arthurstyle.h b/examples/widgets/painting/shared/arthurstyle.h
index ca5993b5a2..8ea8354bab 100644
--- a/examples/widgets/painting/shared/arthurstyle.h
+++ b/examples/widgets/painting/shared/arthurstyle.h
@@ -63,23 +63,23 @@ public:
void drawHoverRect(QPainter *painter, const QRect &rect) const;
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget = 0) const override;
void drawControl(ControlElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget) const override;
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget) const override;
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const Q_DECL_OVERRIDE;
+ const QSize &size, const QWidget *widget) const override;
- QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
- SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE;
+ SubControl sc, const QWidget *widget) const override;
- int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override;
- void polish(QPalette &palette) Q_DECL_OVERRIDE;
- void polish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void polish(QPalette &palette) override;
+ void polish(QWidget *widget) override;
+ void unpolish(QWidget *widget) override;
};
#endif
diff --git a/examples/widgets/painting/shared/arthurwidgets.h b/examples/widgets/painting/shared/arthurwidgets.h
index 0133073c04..d6e1e44b3a 100644
--- a/examples/widgets/painting/shared/arthurwidgets.h
+++ b/examples/widgets/painting/shared/arthurwidgets.h
@@ -68,9 +68,9 @@ public:
setAttribute(Qt::WA_AcceptTouchEvents);
}
void disableAutoBufferSwap() { setAutoBufferSwap(false); }
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE { parentWidget()->update(); }
+ void paintEvent(QPaintEvent *) override { parentWidget()->update(); }
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE
+ bool event(QEvent *event) override
{
switch (event->type()) {
case QEvent::TouchBegin:
@@ -126,8 +126,8 @@ signals:
void descriptionEnabledChanged(bool);
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
#if defined(QT_OPENGL_SUPPORT)
GLWidget *glw;
diff --git a/examples/widgets/painting/shared/hoverpoints.h b/examples/widgets/painting/shared/hoverpoints.h
index 6f8c122042..6bf1cafe4e 100644
--- a/examples/widgets/painting/shared/hoverpoints.h
+++ b/examples/widgets/painting/shared/hoverpoints.h
@@ -85,7 +85,7 @@ public:
HoverPoints(QWidget *widget, PointShape shape);
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
void paintPoints();
diff --git a/examples/widgets/painting/shared/shared.pri b/examples/widgets/painting/shared/shared.pri
index c8d119f4e5..362cc6819c 100644
--- a/examples/widgets/painting/shared/shared.pri
+++ b/examples/widgets/painting/shared/shared.pri
@@ -1,6 +1,6 @@
INCLUDEPATH += $$PWD
-qtHaveModule(opengl)|contains(QT_CONFIG, opengles2) {
+qtHaveModule(opengl)|qtConfig(opengles2) {
DEFINES += QT_OPENGL_SUPPORT
QT += opengl widgets
}
diff --git a/examples/widgets/painting/transformations/renderarea.h b/examples/widgets/painting/transformations/renderarea.h
index 2cc9ac274a..140be27b2b 100644
--- a/examples/widgets/painting/transformations/renderarea.h
+++ b/examples/widgets/painting/transformations/renderarea.h
@@ -75,11 +75,11 @@ public:
void setOperations(const QList<Operation> &operations);
void setShape(const QPainterPath &shape);
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
//! [1]
//! [2]
diff --git a/examples/widgets/richtext/syntaxhighlighter/highlighter.h b/examples/widgets/richtext/syntaxhighlighter/highlighter.h
index 56274778ce..39141615fc 100644
--- a/examples/widgets/richtext/syntaxhighlighter/highlighter.h
+++ b/examples/widgets/richtext/syntaxhighlighter/highlighter.h
@@ -67,7 +67,7 @@ public:
Highlighter(QTextDocument *parent = 0);
protected:
- void highlightBlock(const QString &text) Q_DECL_OVERRIDE;
+ void highlightBlock(const QString &text) override;
private:
struct HighlightingRule
diff --git a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro
index 93cd950b0b..ae51662341 100644
--- a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro
+++ b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro
@@ -9,10 +9,3 @@ SOURCES = highlighter.cpp \
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/richtext/syntaxhighlighter
INSTALLS += target
-
-
-wince {
- addFiles.files = main.cpp mainwindow.cpp
- addFiles.path = .
- INSTALLS += addFiles
-}
diff --git a/examples/widgets/richtext/textedit/textedit.h b/examples/widgets/richtext/textedit/textedit.h
index d130b9cca7..e5f04e706c 100644
--- a/examples/widgets/richtext/textedit/textedit.h
+++ b/examples/widgets/richtext/textedit/textedit.h
@@ -78,7 +78,7 @@ public slots:
void fileNew();
protected:
- virtual void closeEvent(QCloseEvent *e) Q_DECL_OVERRIDE;
+ virtual void closeEvent(QCloseEvent *e) override;
private slots:
void fileOpen();
diff --git a/examples/widgets/scroller/graphicsview/main.cpp b/examples/widgets/scroller/graphicsview/main.cpp
index 4009041cd8..c33a3091ed 100644
--- a/examples/widgets/scroller/graphicsview/main.cpp
+++ b/examples/widgets/scroller/graphicsview/main.cpp
@@ -74,7 +74,7 @@ public:
setFlag(QGraphicsItem::ItemClipsToShape, true);
}
- QRectF boundingRect() const Q_DECL_OVERRIDE
+ QRectF boundingRect() const override
{
// here we only want the size of the children and not the size of the children of the children...
qreal halfpw = m_pen.widthF() / 2;
@@ -85,7 +85,7 @@ public:
return rect;
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
{
Q_UNUSED(option);
Q_UNUSED(widget);
@@ -114,7 +114,7 @@ public:
: QGraphicsObject(parent)
{ }
- QRectF boundingRect() const Q_DECL_OVERRIDE
+ QRectF boundingRect() const override
{
QRectF rect;
foreach (QGraphicsItem *item, childItems())
@@ -122,7 +122,7 @@ public:
return rect;
}
- void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) Q_DECL_OVERRIDE
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
{ }
};
@@ -150,7 +150,7 @@ public:
return m_viewport;
}
- bool event(QEvent *e) Q_DECL_OVERRIDE
+ bool event(QEvent *e) override
{
switch (e->type()) {
// ![2]
@@ -179,7 +179,7 @@ public:
return QGraphicsObject::event(e);
}
- bool sceneEvent(QEvent *e) Q_DECL_OVERRIDE
+ bool sceneEvent(QEvent *e) override
{
switch (e->type()) {
case QEvent::TouchBegin: {
@@ -204,12 +204,12 @@ public:
return QGraphicsObject::sceneEvent(e);
}
- QRectF boundingRect() const Q_DECL_OVERRIDE
+ QRectF boundingRect() const override
{
return QRectF(0, 0, m_size.width() + 3, m_size.height());
}
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
{
Q_UNUSED(option);
Q_UNUSED(widget);
@@ -275,7 +275,7 @@ public:
protected:
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE
+ void resizeEvent(QResizeEvent *e) override
{
// resize the scene according to our own size to prevent scrolling
m_scene->setSceneRect(0, 0, m_view->viewport()->width(), m_view->viewport()->height());
diff --git a/examples/widgets/statemachine/factorial/main.cpp b/examples/widgets/statemachine/factorial/main.cpp
index 995ae4d246..d0d61cb7df 100644
--- a/examples/widgets/statemachine/factorial/main.cpp
+++ b/examples/widgets/statemachine/factorial/main.cpp
@@ -103,7 +103,7 @@ public:
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
{}
- virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *e) override
{
if (!QSignalTransition::eventTest(e))
return false;
@@ -111,7 +111,7 @@ public:
return se->arguments().at(0).toInt() > 1;
}
- virtual void onTransition(QEvent *e) Q_DECL_OVERRIDE
+ virtual void onTransition(QEvent *e) override
{
QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
int x = se->arguments().at(0).toInt();
@@ -133,7 +133,7 @@ public:
: QSignalTransition(fact, SIGNAL(xChanged(int))), m_fact(fact)
{}
- virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE
+ virtual bool eventTest(QEvent *e) override
{
if (!QSignalTransition::eventTest(e))
return false;
@@ -141,7 +141,7 @@ public:
return se->arguments().at(0).toInt() <= 1;
}
- virtual void onTransition(QEvent *) Q_DECL_OVERRIDE
+ virtual void onTransition(QEvent *) override
{
fprintf(stdout, "%d\n", m_fact->property("fac").toInt());
}
diff --git a/examples/widgets/statemachine/pingpong/main.cpp b/examples/widgets/statemachine/pingpong/main.cpp
index ef799ec998..8c3b9f674b 100644
--- a/examples/widgets/statemachine/pingpong/main.cpp
+++ b/examples/widgets/statemachine/pingpong/main.cpp
@@ -75,7 +75,7 @@ public:
: QState(parent) {}
protected:
- virtual void onEntry(QEvent *) Q_DECL_OVERRIDE
+ virtual void onEntry(QEvent *) override
{
machine()->postEvent(new PingEvent());
fprintf(stdout, "ping?\n");
@@ -90,10 +90,10 @@ public:
PongTransition() {}
protected:
- virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE {
+ virtual bool eventTest(QEvent *e) override {
return (e->type() == QEvent::User+3);
}
- virtual void onTransition(QEvent *) Q_DECL_OVERRIDE
+ virtual void onTransition(QEvent *) override
{
machine()->postDelayedEvent(new PingEvent(), 500);
fprintf(stdout, "ping?\n");
@@ -108,10 +108,10 @@ public:
PingTransition() {}
protected:
- virtual bool eventTest(QEvent *e) Q_DECL_OVERRIDE {
+ virtual bool eventTest(QEvent *e) override {
return (e->type() == QEvent::User+2);
}
- virtual void onTransition(QEvent *) Q_DECL_OVERRIDE
+ virtual void onTransition(QEvent *) override
{
machine()->postDelayedEvent(new PongEvent(), 500);
fprintf(stdout, "pong!\n");
diff --git a/examples/widgets/statemachine/rogue/movementtransition.h b/examples/widgets/statemachine/rogue/movementtransition.h
index 05fc7edf61..74ffed6608 100644
--- a/examples/widgets/statemachine/rogue/movementtransition.h
+++ b/examples/widgets/statemachine/rogue/movementtransition.h
@@ -69,7 +69,7 @@ public:
//![1]
protected:
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE {
+ bool eventTest(QEvent *event) override {
if (event->type() == QEvent::StateMachineWrapped &&
static_cast<QStateMachine::WrappedEvent *>(event)->event()->type() == QEvent::KeyPress) {
QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event();
@@ -86,7 +86,7 @@ protected:
//![1]
//![2]
- void onTransition(QEvent *event) Q_DECL_OVERRIDE {
+ void onTransition(QEvent *event) override {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(
static_cast<QStateMachine::WrappedEvent *>(event)->event());
diff --git a/examples/widgets/statemachine/rogue/window.h b/examples/widgets/statemachine/rogue/window.h
index 2ac9650201..af34815ffd 100644
--- a/examples/widgets/statemachine/rogue/window.h
+++ b/examples/widgets/statemachine/rogue/window.h
@@ -77,10 +77,10 @@ public:
void setStatus(const QString &status);
QString status() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
//![0]
//![1]
diff --git a/examples/widgets/statemachine/trafficlight/main.cpp b/examples/widgets/statemachine/trafficlight/main.cpp
index ebfb3bface..143f2a9324 100644
--- a/examples/widgets/statemachine/trafficlight/main.cpp
+++ b/examples/widgets/statemachine/trafficlight/main.cpp
@@ -74,7 +74,7 @@ public slots:
void turnOn() { setOn(true); }
protected:
- virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE
+ virtual void paintEvent(QPaintEvent *) override
{
if (!m_on)
return;
diff --git a/examples/widgets/tools/completer/fsmodel.h b/examples/widgets/tools/completer/fsmodel.h
index a9b7db3849..a243c48b43 100644
--- a/examples/widgets/tools/completer/fsmodel.h
+++ b/examples/widgets/tools/completer/fsmodel.h
@@ -63,7 +63,7 @@ class FileSystemModel : public QFileSystemModel
{
public:
FileSystemModel(QObject *parent = 0);
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
};
//! [0]
diff --git a/examples/widgets/tools/customcompleter/textedit.h b/examples/widgets/tools/customcompleter/textedit.h
index ce407cbf53..d0636ab670 100644
--- a/examples/widgets/tools/customcompleter/textedit.h
+++ b/examples/widgets/tools/customcompleter/textedit.h
@@ -70,8 +70,8 @@ public:
QCompleter *completer() const;
protected:
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) override;
+ void focusInEvent(QFocusEvent *e) override;
private slots:
void insertCompletion(const QString &completion);
diff --git a/examples/widgets/tools/echoplugin/plugin/echoplugin.h b/examples/widgets/tools/echoplugin/plugin/echoplugin.h
index 94feb1a2ea..f0f237099c 100644
--- a/examples/widgets/tools/echoplugin/plugin/echoplugin.h
+++ b/examples/widgets/tools/echoplugin/plugin/echoplugin.h
@@ -63,7 +63,7 @@ class EchoPlugin : public QObject, EchoInterface
Q_INTERFACES(EchoInterface)
public:
- QString echo(const QString &message) Q_DECL_OVERRIDE;
+ QString echo(const QString &message) override;
};
//! [0]
diff --git a/examples/widgets/tools/i18n/languagechooser.h b/examples/widgets/tools/i18n/languagechooser.h
index 8af7be6d71..13363c7111 100644
--- a/examples/widgets/tools/i18n/languagechooser.h
+++ b/examples/widgets/tools/i18n/languagechooser.h
@@ -71,8 +71,8 @@ public:
explicit LanguageChooser(const QString& defaultLang = QString(), QWidget *parent = 0);
protected:
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void checkBoxToggled();
diff --git a/examples/widgets/tools/plugandpaint/app/app.pro b/examples/widgets/tools/plugandpaint/app/app.pro
index 8139cd53ad..e35203edf2 100644
--- a/examples/widgets/tools/plugandpaint/app/app.pro
+++ b/examples/widgets/tools/plugandpaint/app/app.pro
@@ -13,11 +13,16 @@ SOURCES = main.cpp \
paintarea.cpp \
plugindialog.cpp
-LIBS = -L../plugins -lpnp_basictools
+LIBS = -L../plugins
-if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
- mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
- win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
+macx-xcode:qtConfig(simulator_and_device) {
+ LIBS += -lpnp_basictools$($${QMAKE_XCODE_LIBRARY_PLATFORM_SUFFIX_SETTING})$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})
+} else {
+ LIBS += -lpnp_basictools
+ if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
+ mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
+ win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
+ }
}
#! [0]
diff --git a/examples/widgets/tools/plugandpaint/app/paintarea.h b/examples/widgets/tools/plugandpaint/app/paintarea.h
index 415e4c0be4..1c8ee1ee1b 100644
--- a/examples/widgets/tools/plugandpaint/app/paintarea.h
+++ b/examples/widgets/tools/plugandpaint/app/paintarea.h
@@ -76,13 +76,13 @@ public:
QImage image() const { return theImage; }
QColor brushColor() const { return color; }
int brushWidth() const { return thickness; }
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
private:
void setupPainter(QPainter &painter);
diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro b/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro
index f28be96b03..8317019c10 100644
--- a/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro
+++ b/examples/widgets/tools/plugandpaint/plugins/basictools/basictools.pro
@@ -14,3 +14,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins
INSTALLS += target
CONFIG += install_ok # Do not cargo-cult this!
+uikit: CONFIG += debug_and_release simulator_and_device
diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h b/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h
index 6e6d639d12..fd9bb9e5f3 100644
--- a/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h
+++ b/examples/widgets/tools/plugandpaint/plugins/basictools/basictoolsplugin.h
@@ -78,22 +78,22 @@ class BasicToolsPlugin : public QObject,
public:
//! [1]
// BrushInterface
- QStringList brushes() const Q_DECL_OVERRIDE;
+ QStringList brushes() const override;
QRect mousePress(const QString &brush, QPainter &painter,
- const QPoint &pos) Q_DECL_OVERRIDE;
+ const QPoint &pos) override;
QRect mouseMove(const QString &brush, QPainter &painter,
- const QPoint &oldPos, const QPoint &newPos) Q_DECL_OVERRIDE;
+ const QPoint &oldPos, const QPoint &newPos) override;
QRect mouseRelease(const QString &brush, QPainter &painter,
- const QPoint &pos) Q_DECL_OVERRIDE;
+ const QPoint &pos) override;
// ShapeInterface
- QStringList shapes() const Q_DECL_OVERRIDE;
- QPainterPath generateShape(const QString &shape, QWidget *parent) Q_DECL_OVERRIDE;
+ QStringList shapes() const override;
+ QPainterPath generateShape(const QString &shape, QWidget *parent) override;
// FilterInterface
- QStringList filters() const Q_DECL_OVERRIDE;
+ QStringList filters() const override;
QImage filterImage(const QString &filter, const QImage &image,
- QWidget *parent) Q_DECL_OVERRIDE;
+ QWidget *parent) override;
//! [3]
};
//! [2] //! [3]
diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro
index deb3c5e70e..4716665d34 100644
--- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro
+++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafilters.pro
@@ -14,3 +14,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins
INSTALLS += target
CONFIG += install_ok # Do not cargo-cult this!
+uikit: CONFIG += debug_and_release simulator_and_device
diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h
index 4beac9a7fb..dddde78caa 100644
--- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h
+++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/extrafiltersplugin.h
@@ -66,9 +66,9 @@ class ExtraFiltersPlugin : public QObject, public FilterInterface
Q_INTERFACES(FilterInterface)
public:
- QStringList filters() const Q_DECL_OVERRIDE;
+ QStringList filters() const override;
QImage filterImage(const QString &filter, const QImage &image,
- QWidget *parent) Q_DECL_OVERRIDE;
+ QWidget *parent) override;
};
//! [0]
diff --git a/examples/widgets/tools/settingseditor/settingstree.h b/examples/widgets/tools/settingseditor/settingstree.h
index b46a3d38da..15efa0e6aa 100644
--- a/examples/widgets/tools/settingseditor/settingstree.h
+++ b/examples/widgets/tools/settingseditor/settingstree.h
@@ -71,7 +71,7 @@ public:
~SettingsTree();
void setSettingsObject(const SettingsPtr &settings);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
public slots:
void setAutoRefresh(bool autoRefresh);
@@ -80,7 +80,7 @@ public slots:
void refresh();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
private slots:
void updateSetting(QTreeWidgetItem *item);
diff --git a/examples/widgets/tools/settingseditor/variantdelegate.h b/examples/widgets/tools/settingseditor/variantdelegate.h
index 3860ecb2f4..a15228fdf9 100644
--- a/examples/widgets/tools/settingseditor/variantdelegate.h
+++ b/examples/widgets/tools/settingseditor/variantdelegate.h
@@ -62,12 +62,12 @@ public:
VariantDelegate(QObject *parent = 0);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
static bool isSupportedType(QVariant::Type type);
static QString displayText(const QVariant &value);
diff --git a/examples/widgets/tools/styleplugin/plugin/simplestyle.h b/examples/widgets/tools/styleplugin/plugin/simplestyle.h
index 05905cd87b..51d6d5b77e 100644
--- a/examples/widgets/tools/styleplugin/plugin/simplestyle.h
+++ b/examples/widgets/tools/styleplugin/plugin/simplestyle.h
@@ -64,7 +64,7 @@ class SimpleStyle : public QProxyStyle
public:
SimpleStyle() {};
- void polish(QPalette &palette) Q_DECL_OVERRIDE;
+ void polish(QPalette &palette) override;
};
#endif
diff --git a/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h b/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h
index 980de4c1df..88805d4887 100644
--- a/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h
+++ b/examples/widgets/tools/styleplugin/plugin/simplestyleplugin.h
@@ -68,7 +68,7 @@ public:
SimpleStylePlugin() {}
QStringList keys() const;
- QStyle *create(const QString &key) Q_DECL_OVERRIDE;
+ QStyle *create(const QString &key) override;
};
//! [0]
diff --git a/examples/widgets/tools/tools.pro b/examples/widgets/tools/tools.pro
index f3cbd73d98..dd8401567b 100644
--- a/examples/widgets/tools/tools.pro
+++ b/examples/widgets/tools/tools.pro
@@ -16,8 +16,7 @@ SUBDIRS = \
contains(DEFINES, QT_NO_TRANSLATION): SUBDIRS -= i18n
-load(qfeatures)
-contains(QT_DISABLED_FEATURES, library) {
+!qtConfig(library) {
SUBDIRS -= \
echoplugin \
plugandpaint
diff --git a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h
index 7e10f87f5b..1d28fddee0 100644
--- a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h
+++ b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.h
@@ -68,8 +68,8 @@ public slots:
void setSeparator(const QString &separator);
protected:
- QStringList splitPath(const QString &path) const Q_DECL_OVERRIDE;
- QString pathFromIndex(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QStringList splitPath(const QString &path) const override;
+ QString pathFromIndex(const QModelIndex &index) const override;
private:
QString sep;
diff --git a/examples/widgets/tools/undo/commands.h b/examples/widgets/tools/undo/commands.h
index 1a14b3fa56..de3bebd740 100644
--- a/examples/widgets/tools/undo/commands.h
+++ b/examples/widgets/tools/undo/commands.h
@@ -58,8 +58,8 @@ class AddShapeCommand : public QUndoCommand
{
public:
AddShapeCommand(Document *doc, const Shape &shape, QUndoCommand *parent = 0);
- void undo() Q_DECL_OVERRIDE;
- void redo() Q_DECL_OVERRIDE;
+ void undo() override;
+ void redo() override;
private:
Document *m_doc;
@@ -71,8 +71,8 @@ class RemoveShapeCommand : public QUndoCommand
{
public:
RemoveShapeCommand(Document *doc, const QString &shapeName, QUndoCommand *parent = 0);
- void undo() Q_DECL_OVERRIDE;
- void redo() Q_DECL_OVERRIDE;
+ void undo() override;
+ void redo() override;
private:
Document *m_doc;
@@ -86,11 +86,11 @@ public:
SetShapeColorCommand(Document *doc, const QString &shapeName, const QColor &color,
QUndoCommand *parent = 0);
- void undo() Q_DECL_OVERRIDE;
- void redo() Q_DECL_OVERRIDE;
+ void undo() override;
+ void redo() override;
- bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
- int id() const Q_DECL_OVERRIDE;
+ bool mergeWith(const QUndoCommand *command) override;
+ int id() const override;
private:
Document *m_doc;
@@ -105,11 +105,11 @@ public:
SetShapeRectCommand(Document *doc, const QString &shapeName, const QRect &rect,
QUndoCommand *parent = 0);
- void undo() Q_DECL_OVERRIDE;
- void redo() Q_DECL_OVERRIDE;
+ void undo() override;
+ void redo() override;
- bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
- int id() const Q_DECL_OVERRIDE;
+ bool mergeWith(const QUndoCommand *command) override;
+ int id() const override;
private:
Document *m_doc;
diff --git a/examples/widgets/tools/undo/document.h b/examples/widgets/tools/undo/document.h
index 41e53a9a04..8076d7185c 100644
--- a/examples/widgets/tools/undo/document.h
+++ b/examples/widgets/tools/undo/document.h
@@ -110,10 +110,10 @@ signals:
void currentShapeChanged(const QString &shapeName);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
private:
void setCurrentShape(int index);
diff --git a/examples/widgets/tools/undoframework/commands.h b/examples/widgets/tools/undoframework/commands.h
index 22c62fe9fd..dc53c14557 100644
--- a/examples/widgets/tools/undoframework/commands.h
+++ b/examples/widgets/tools/undoframework/commands.h
@@ -64,10 +64,10 @@ public:
MoveCommand(DiagramItem *diagramItem, const QPointF &oldPos,
QUndoCommand *parent = 0);
- void undo() Q_DECL_OVERRIDE;
- void redo() Q_DECL_OVERRIDE;
- bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
- int id() const Q_DECL_OVERRIDE { return Id; }
+ void undo() override;
+ void redo() override;
+ bool mergeWith(const QUndoCommand *command) override;
+ int id() const override { return Id; }
private:
DiagramItem *myDiagramItem;
@@ -82,8 +82,8 @@ class DeleteCommand : public QUndoCommand
public:
explicit DeleteCommand(QGraphicsScene *graphicsScene, QUndoCommand *parent = 0);
- void undo() Q_DECL_OVERRIDE;
- void redo() Q_DECL_OVERRIDE;
+ void undo() override;
+ void redo() override;
private:
DiagramItem *myDiagramItem;
@@ -99,8 +99,8 @@ public:
QUndoCommand *parent = 0);
~AddCommand();
- void undo() Q_DECL_OVERRIDE;
- void redo() Q_DECL_OVERRIDE;
+ void undo() override;
+ void redo() override;
private:
DiagramItem *myDiagramItem;
diff --git a/examples/widgets/tools/undoframework/diagramitem.h b/examples/widgets/tools/undoframework/diagramitem.h
index 246443b64d..1638dcbea8 100644
--- a/examples/widgets/tools/undoframework/diagramitem.h
+++ b/examples/widgets/tools/undoframework/diagramitem.h
@@ -71,7 +71,7 @@ public:
DiagramType diagramType() const {
return polygon() == boxPolygon ? Box : Triangle;
}
- int type() const Q_DECL_OVERRIDE { return Type; }
+ int type() const override { return Type; }
private:
QPolygonF boxPolygon;
diff --git a/examples/widgets/tools/undoframework/diagramscene.h b/examples/widgets/tools/undoframework/diagramscene.h
index 6b275ce5d3..b1e2804ba6 100644
--- a/examples/widgets/tools/undoframework/diagramscene.h
+++ b/examples/widgets/tools/undoframework/diagramscene.h
@@ -72,8 +72,8 @@ signals:
void itemMoved(DiagramItem *movedItem, const QPointF &movedFromPosition);
protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
QGraphicsItem *movingItem;
diff --git a/examples/widgets/tutorials/modelview/1_readonly/mymodel.h b/examples/widgets/tutorials/modelview/1_readonly/mymodel.h
index 68480c9f5e..e675cc6bc2 100644
--- a/examples/widgets/tutorials/modelview/1_readonly/mymodel.h
+++ b/examples/widgets/tutorials/modelview/1_readonly/mymodel.h
@@ -60,9 +60,9 @@ class MyModel : public QAbstractTableModel
Q_OBJECT
public:
MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE ;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
};
//! [Quoting ModelView Tutorial]
diff --git a/examples/widgets/tutorials/modelview/2_formatting/mymodel.h b/examples/widgets/tutorials/modelview/2_formatting/mymodel.h
index 1d94c9fbeb..9c12f98ba9 100644
--- a/examples/widgets/tutorials/modelview/2_formatting/mymodel.h
+++ b/examples/widgets/tutorials/modelview/2_formatting/mymodel.h
@@ -58,9 +58,9 @@ class MyModel : public QAbstractTableModel
Q_OBJECT
public:
MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE ;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
};
#endif // MYMODEL_H
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
index 5d67d88e45..dfcf0f6239 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
@@ -59,9 +59,9 @@ class MyModel : public QAbstractTableModel
Q_OBJECT
public:
MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE ;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QTimer *timer;
private:
int selectedCell;
diff --git a/examples/widgets/tutorials/modelview/4_headers/mymodel.h b/examples/widgets/tutorials/modelview/4_headers/mymodel.h
index 74e2a93626..fb2d7aa940 100644
--- a/examples/widgets/tutorials/modelview/4_headers/mymodel.h
+++ b/examples/widgets/tutorials/modelview/4_headers/mymodel.h
@@ -58,10 +58,10 @@ class MyModel : public QAbstractTableModel
Q_OBJECT
public:
MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE ;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
};
#endif // MYMODEL_H
diff --git a/examples/widgets/tutorials/modelview/5_edit/mymodel.h b/examples/widgets/tutorials/modelview/5_edit/mymodel.h
index a95e120de3..dd0d4f5066 100644
--- a/examples/widgets/tutorials/modelview/5_edit/mymodel.h
+++ b/examples/widgets/tutorials/modelview/5_edit/mymodel.h
@@ -65,11 +65,11 @@ class MyModel : public QAbstractTableModel
Q_OBJECT
public:
MyModel(QObject *parent);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE ;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex & index) const Q_DECL_OVERRIDE ;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) override;
+ Qt::ItemFlags flags(const QModelIndex & index) const override ;
private:
QString m_gridData[ROWS][COLS]; //holds text entered into QTableView
signals:
diff --git a/examples/widgets/widgets.pro b/examples/widgets/widgets.pro
index cc489b5c16..65a96dd718 100644
--- a/examples/widgets/widgets.pro
+++ b/examples/widgets/widgets.pro
@@ -22,11 +22,11 @@ SUBDIRS = \
tutorials \
widgets
-contains(QT_CONFIG, opengl(es2)?) {
+qtConfig(opengl(es2)?) {
SUBDIRS += windowcontainer
}
-!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= windowcontainer
+!qtConfig(opengl(es2)?): SUBDIRS -= windowcontainer
contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows
contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= draganddrop
mac:SUBDIRS += mac
diff --git a/examples/widgets/widgets/analogclock/analogclock.h b/examples/widgets/widgets/analogclock/analogclock.h
index 2098b83ec4..19e580d1ac 100644
--- a/examples/widgets/widgets/analogclock/analogclock.h
+++ b/examples/widgets/widgets/analogclock/analogclock.h
@@ -62,7 +62,7 @@ public:
AnalogClock(QWidget *parent = 0);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
};
//! [0]
diff --git a/examples/widgets/widgets/calculator/button.h b/examples/widgets/widgets/calculator/button.h
index b06edc1405..057640700f 100644
--- a/examples/widgets/widgets/calculator/button.h
+++ b/examples/widgets/widgets/calculator/button.h
@@ -61,7 +61,7 @@ class Button : public QToolButton
public:
explicit Button(const QString &text, QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
};
//! [0]
diff --git a/examples/widgets/widgets/charactermap/characterwidget.h b/examples/widgets/widgets/charactermap/characterwidget.h
index 8f8406f244..53add51e6f 100644
--- a/examples/widgets/widgets/charactermap/characterwidget.h
+++ b/examples/widgets/widgets/charactermap/characterwidget.h
@@ -69,7 +69,7 @@ class CharacterWidget : public QWidget
public:
CharacterWidget(QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
public slots:
void updateFont(const QFont &font);
@@ -81,9 +81,9 @@ signals:
void characterSelected(const QString &character);
protected:
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
void calculateSquareSize();
diff --git a/examples/widgets/widgets/codeeditor/codeeditor.h b/examples/widgets/widgets/codeeditor/codeeditor.h
index ba6a28c27c..65be76d81d 100644
--- a/examples/widgets/widgets/codeeditor/codeeditor.h
+++ b/examples/widgets/widgets/codeeditor/codeeditor.h
@@ -76,7 +76,7 @@ public:
int lineNumberAreaWidth();
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) override;
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
@@ -97,12 +97,12 @@ public:
codeEditor = editor;
}
- QSize sizeHint() const Q_DECL_OVERRIDE {
+ QSize sizeHint() const override {
return QSize(codeEditor->lineNumberAreaWidth(), 0);
}
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE {
+ void paintEvent(QPaintEvent *event) override {
codeEditor->lineNumberAreaPaintEvent(event);
}
diff --git a/examples/widgets/widgets/elidedlabel/elidedlabel.h b/examples/widgets/widgets/elidedlabel/elidedlabel.h
index 98ce1fed33..8a2a40f49a 100644
--- a/examples/widgets/widgets/elidedlabel/elidedlabel.h
+++ b/examples/widgets/widgets/elidedlabel/elidedlabel.h
@@ -72,7 +72,7 @@ public:
bool isElided() const { return elided; }
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
signals:
void elisionChanged(bool elided);
diff --git a/examples/widgets/widgets/elidedlabel/testwidget.h b/examples/widgets/widgets/elidedlabel/testwidget.h
index 1871a7af6a..840bc98b40 100644
--- a/examples/widgets/widgets/elidedlabel/testwidget.h
+++ b/examples/widgets/widgets/elidedlabel/testwidget.h
@@ -67,7 +67,7 @@ public:
TestWidget(QWidget *parent = 0);
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) override;
private slots:
void switchText();
diff --git a/examples/widgets/widgets/icons/icons.pro b/examples/widgets/widgets/icons/icons.pro
index 4ee95592c8..450bdf9f8a 100644
--- a/examples/widgets/widgets/icons/icons.pro
+++ b/examples/widgets/widgets/icons/icons.pro
@@ -17,14 +17,3 @@ EXAMPLE_FILES = images/*
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/icons
INSTALLS += target
-
-
-wince {
- imageFiles.files = images/*
- wincewm*: {
- imageFiles.path = "/My Documents/My Pictures"
- } else {
- imageFiles.path = images
- }
- INSTALLS += imageFiles
-}
diff --git a/examples/widgets/widgets/icons/iconsizespinbox.h b/examples/widgets/widgets/icons/iconsizespinbox.h
index 1bbd2f793f..96a56e75c9 100644
--- a/examples/widgets/widgets/icons/iconsizespinbox.h
+++ b/examples/widgets/widgets/icons/iconsizespinbox.h
@@ -61,8 +61,8 @@ class IconSizeSpinBox : public QSpinBox
public:
explicit IconSizeSpinBox(QWidget *parent = Q_NULLPTR);
- int valueFromText(const QString &text) const Q_DECL_OVERRIDE;
- QString textFromValue(int value) const Q_DECL_OVERRIDE;
+ int valueFromText(const QString &text) const override;
+ QString textFromValue(int value) const override;
};
//! [0]
diff --git a/examples/widgets/widgets/icons/imagedelegate.h b/examples/widgets/widgets/icons/imagedelegate.h
index 28822d01fb..928085d85b 100644
--- a/examples/widgets/widgets/icons/imagedelegate.h
+++ b/examples/widgets/widgets/icons/imagedelegate.h
@@ -64,10 +64,10 @@ public:
//! [1]
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
//! [1] //! [2]
private slots:
diff --git a/examples/widgets/widgets/imageviewer/imageviewer.pro b/examples/widgets/widgets/imageviewer/imageviewer.pro
index 2853f1699f..4903a68537 100644
--- a/examples/widgets/widgets/imageviewer/imageviewer.pro
+++ b/examples/widgets/widgets/imageviewer/imageviewer.pro
@@ -8,8 +8,3 @@ SOURCES = imageviewer.cpp \
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/imageviewer
INSTALLS += target
-
-
-wince {
- DEPLOYMENT_PLUGIN += qjpeg qgif
-}
diff --git a/examples/widgets/widgets/mousebuttons/buttontester.h b/examples/widgets/widgets/mousebuttons/buttontester.h
index 24976052d7..cd05171d86 100644
--- a/examples/widgets/widgets/mousebuttons/buttontester.h
+++ b/examples/widgets/widgets/mousebuttons/buttontester.h
@@ -61,11 +61,11 @@ class ButtonTester : public QTextEdit
Q_OBJECT
protected:
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent * event) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent * event) override;
#endif
int buttonByNumber(const Qt::MouseButton button);
QString enumNameFromValue(const Qt::MouseButton button);
diff --git a/examples/widgets/widgets/movie/movie.pro b/examples/widgets/widgets/movie/movie.pro
index 94d86454d8..e3b9b5129c 100644
--- a/examples/widgets/widgets/movie/movie.pro
+++ b/examples/widgets/widgets/movie/movie.pro
@@ -9,10 +9,3 @@ EXAMPLE_FILES = animation.gif
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/movie
INSTALLS += target
-
-
-wince {
- addFiles.files += *.gif
- addFiles.path = .
- INSTALLS += addFiles
-}
diff --git a/examples/widgets/widgets/scribble/mainwindow.h b/examples/widgets/widgets/scribble/mainwindow.h
index 3cd4b395d9..9e0ddaff71 100644
--- a/examples/widgets/widgets/scribble/mainwindow.h
+++ b/examples/widgets/widgets/scribble/mainwindow.h
@@ -65,7 +65,7 @@ public:
MainWindow();
protected:
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
+ void closeEvent(QCloseEvent *event) override;
private slots:
void open();
diff --git a/examples/widgets/widgets/scribble/scribblearea.h b/examples/widgets/widgets/scribble/scribblearea.h
index 4c1df541af..7729fb5b89 100644
--- a/examples/widgets/widgets/scribble/scribblearea.h
+++ b/examples/widgets/widgets/scribble/scribblearea.h
@@ -78,11 +78,11 @@ public slots:
void print();
protected:
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
private:
void drawLineTo(const QPoint &endPoint);
diff --git a/examples/widgets/widgets/shapedclock/shapedclock.h b/examples/widgets/widgets/shapedclock/shapedclock.h
index f2e58951fa..6468d21618 100644
--- a/examples/widgets/widgets/shapedclock/shapedclock.h
+++ b/examples/widgets/widgets/shapedclock/shapedclock.h
@@ -60,13 +60,13 @@ class ShapedClock : public QWidget
public:
ShapedClock(QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
protected:
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
private:
QPoint dragPosition;
diff --git a/examples/widgets/widgets/styles/norwegianwoodstyle.h b/examples/widgets/widgets/styles/norwegianwoodstyle.h
index 06c433630a..c41d81d23a 100644
--- a/examples/widgets/widgets/styles/norwegianwoodstyle.h
+++ b/examples/widgets/widgets/styles/norwegianwoodstyle.h
@@ -66,17 +66,17 @@ class NorwegianWoodStyle : public QProxyStyle
public:
NorwegianWoodStyle();
- void polish(QPalette &palette) Q_DECL_OVERRIDE;
- void polish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void polish(QPalette &palette) override;
+ void polish(QWidget *widget) override;
+ void unpolish(QWidget *widget) override;
int pixelMetric(PixelMetric metric, const QStyleOption *option,
- const QWidget *widget) const Q_DECL_OVERRIDE;
+ const QWidget *widget) const override;
int styleHint(StyleHint hint, const QStyleOption *option,
- const QWidget *widget, QStyleHintReturn *returnData) const Q_DECL_OVERRIDE;
+ const QWidget *widget, QStyleHintReturn *returnData) const override;
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget) const override;
void drawControl(ControlElement control, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget) const override;
private:
static void setTexture(QPalette &palette, QPalette::ColorRole role,
diff --git a/examples/widgets/widgets/tablet/tabletapplication.h b/examples/widgets/widgets/tablet/tabletapplication.h
index 6b24992c5a..6b3b2a1730 100644
--- a/examples/widgets/widgets/tablet/tabletapplication.h
+++ b/examples/widgets/widgets/tablet/tabletapplication.h
@@ -64,7 +64,7 @@ public:
TabletApplication(int &argv, char **args)
: QApplication(argv, args) {}
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
void setCanvas(TabletCanvas *canvas)
{ m_canvas = canvas; }
diff --git a/examples/widgets/widgets/tablet/tabletcanvas.h b/examples/widgets/widgets/tablet/tabletcanvas.h
index baf042cb64..1784e05916 100644
--- a/examples/widgets/widgets/tablet/tabletcanvas.h
+++ b/examples/widgets/widgets/tablet/tabletcanvas.h
@@ -95,9 +95,9 @@ public:
{ return a > b ? a : b; }
protected:
- void tabletEvent(QTabletEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void tabletEvent(QTabletEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
private:
void initPixmap();
diff --git a/examples/widgets/widgets/tetrix/tetrixboard.h b/examples/widgets/widgets/tetrix/tetrixboard.h
index d777a76a20..7c6871dfbd 100644
--- a/examples/widgets/widgets/tetrix/tetrixboard.h
+++ b/examples/widgets/widgets/tetrix/tetrixboard.h
@@ -70,8 +70,8 @@ public:
TetrixBoard(QWidget *parent = 0);
void setNextPieceLabel(QLabel *label);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
public slots:
void start();
@@ -83,9 +83,9 @@ signals:
void linesRemovedChanged(int numLines);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
//! [0]
//! [1]
diff --git a/examples/widgets/widgets/tooltips/sortingbox.h b/examples/widgets/widgets/tooltips/sortingbox.h
index 326eeee5a7..2ac27614a5 100644
--- a/examples/widgets/widgets/tooltips/sortingbox.h
+++ b/examples/widgets/widgets/tooltips/sortingbox.h
@@ -70,12 +70,12 @@ public:
SortingBox();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
private slots:
void createNewCircle();
diff --git a/examples/widgets/widgets/wiggly/wigglywidget.h b/examples/widgets/widgets/wiggly/wigglywidget.h
index 1967b809f5..58a7d045e1 100644
--- a/examples/widgets/widgets/wiggly/wigglywidget.h
+++ b/examples/widgets/widgets/wiggly/wigglywidget.h
@@ -66,8 +66,8 @@ public slots:
void setText(const QString &newText) { text = newText; }
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
private:
QBasicTimer timer;
diff --git a/examples/widgets/windowcontainer/windowcontainer.cpp b/examples/widgets/windowcontainer/windowcontainer.cpp
index 39b45a80ce..9f2124c4e1 100644
--- a/examples/widgets/windowcontainer/windowcontainer.cpp
+++ b/examples/widgets/windowcontainer/windowcontainer.cpp
@@ -73,7 +73,7 @@ public:
{
}
- void render(QPainter *p) Q_DECL_OVERRIDE {
+ void render(QPainter *p) override {
QLinearGradient g(0, 0, 0, height());
g.setColorAt(0, QColor("lightsteelblue"));
g.setColorAt(1, Qt::black);
@@ -101,7 +101,7 @@ public:
p->drawPolyline(m_polygon);
}
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
+ void mousePressEvent(QMouseEvent *e) override {
if (!m_mouseDown) {
m_mouseDown = true;
m_polygon.clear();
@@ -110,14 +110,14 @@ public:
}
}
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
+ void mouseMoveEvent(QMouseEvent *e) override {
if (m_mouseDown) {
m_polygon.append(e->pos());
renderLater();
}
}
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
+ void mouseReleaseEvent(QMouseEvent *e) override {
if (m_mouseDown) {
m_mouseDown = false;
m_polygon.append(e->pos());
@@ -125,23 +125,23 @@ public:
}
}
- void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE {
+ void focusInEvent(QFocusEvent *) override {
m_focus = true;
renderLater();
}
- void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE {
+ void focusOutEvent(QFocusEvent *) override {
m_focus = false;
m_polygon.clear();
renderLater();
}
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE {
+ void keyPressEvent(QKeyEvent *e) override {
m_key = e->text();
renderLater();
}
- void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE {
+ void keyReleaseEvent(QKeyEvent *) override {
m_key = QString();
renderLater();
}
diff --git a/examples/xml/saxbookmarks/xbelhandler.h b/examples/xml/saxbookmarks/xbelhandler.h
index e1fd06dd3f..3f4cb109e9 100644
--- a/examples/xml/saxbookmarks/xbelhandler.h
+++ b/examples/xml/saxbookmarks/xbelhandler.h
@@ -65,12 +65,12 @@ public:
XbelHandler(QTreeWidget *treeWidget);
bool startElement(const QString &namespaceURI, const QString &localName,
- const QString &qName, const QXmlAttributes &attributes) Q_DECL_OVERRIDE;
+ const QString &qName, const QXmlAttributes &attributes) override;
bool endElement(const QString &namespaceURI, const QString &localName,
- const QString &qName) Q_DECL_OVERRIDE;
- bool characters(const QString &str) Q_DECL_OVERRIDE;
- bool fatalError(const QXmlParseException &exception) Q_DECL_OVERRIDE;
- QString errorString() const Q_DECL_OVERRIDE;
+ const QString &qName) override;
+ bool characters(const QString &str) override;
+ bool fatalError(const QXmlParseException &exception) override;
+ QString errorString() const override;
private:
QTreeWidgetItem *createChildItem(const QString &tagName);
diff --git a/mkspecs/common/clang-mac.conf b/mkspecs/common/clang-mac.conf
index c616e20b6e..274fd73d00 100644
--- a/mkspecs/common/clang-mac.conf
+++ b/mkspecs/common/clang-mac.conf
@@ -8,3 +8,4 @@ QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0
QMAKE_CXXFLAGS += -stdlib=libc++
QMAKE_LFLAGS += -stdlib=libc++
+QMAKE_AR_LTCG = libtool -static -o
diff --git a/mkspecs/common/ios.conf b/mkspecs/common/ios.conf
index f8f810d4f0..dd9b29f9e2 100644
--- a/mkspecs/common/ios.conf
+++ b/mkspecs/common/ios.conf
@@ -6,15 +6,15 @@ QMAKE_PLATFORM += ios
QMAKE_MAC_SDK = iphoneos
simulator.sdk = iphonesimulator
-simulator.target = $${simulator.sdk}
+simulator.target = simulator
simulator.dir_affix = $${simulator.sdk}
simulator.CONFIG = $${simulator.sdk}
simulator.deployment_identifier = ios-simulator
device.sdk = iphoneos
-device.target = $${device.sdk}
+device.target = device
device.dir_affix = $${device.sdk}
device.CONFIG = $${device.sdk}
device.deployment_identifier = $${device.sdk}
-include(mac.conf)
+include(uikit.conf)
diff --git a/mkspecs/common/linux-android.conf b/mkspecs/common/linux-android.conf
index fec008cb45..b8e052d1ec 100644
--- a/mkspecs/common/linux-android.conf
+++ b/mkspecs/common/linux-android.conf
@@ -6,7 +6,6 @@ QMAKE_PLATFORM += android
include(linux.conf)
include(gcc-base-unix.conf)
-DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG
QT_QPA_DEFAULT_PLATFORM = minimal
NDK_ROOT = $$(ANDROID_NDK_ROOT)
diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf
index 143df704b1..1a39c88425 100644
--- a/mkspecs/common/linux.conf
+++ b/mkspecs/common/linux.conf
@@ -35,7 +35,6 @@ QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
QMAKE_LIBS_OPENVG = -lOpenVG
QMAKE_LIBS_THREAD = -lpthread
-QMAKE_LIBS_LIBUDEV = -ludev
QMAKE_CFLAGS_WAYLAND =
QMAKE_INCDIR_WAYLAND =
@@ -45,10 +44,6 @@ QMAKE_LIBDIR_WAYLAND =
QMAKE_DEFINES_WAYLAND =
QMAKE_WAYLAND_SCANNER = wayland-scanner
-QMAKE_CFLAGS_XCB =
-QMAKE_LIBS_XCB =
-QMAKE_DEFINES_XCB =
-
QMAKE_AR = ar cqs
QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
index b19b0853cb..56b9574e19 100644
--- a/mkspecs/common/mac.conf
+++ b/mkspecs/common/mac.conf
@@ -6,9 +6,11 @@
QMAKE_PLATFORM += mac darwin
-include(unix.conf)
+MAKEFILE_GENERATOR = UNIX
+CONFIG += app_bundle incremental global_init_link_order lib_version_first sdk
+QMAKE_INCREMENTAL_STYLE = sublib
-CONFIG += sdk
+include(unix.conf)
QMAKE_RESOURCE = /Developer/Tools/Rez
QMAKE_EXTENSION_SHLIB = dylib
diff --git a/mkspecs/common/msvc-base.conf b/mkspecs/common/msvc-base.conf
index 37f38560e8..d54b11507e 100644
--- a/mkspecs/common/msvc-base.conf
+++ b/mkspecs/common/msvc-base.conf
@@ -27,8 +27,6 @@ greaterThan(MSC_VER, 1599) {
greaterThan(MSC_VER, 1699) {
# Visual Studio 2012 (11.0) / Visual C++ 17.0 and up
QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0
- QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@
- QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@
QT_CONFIG += c++11
CONFIG += c++11
}
diff --git a/mkspecs/common/tvos.conf b/mkspecs/common/tvos.conf
new file mode 100644
index 0000000000..45e8c82c7b
--- /dev/null
+++ b/mkspecs/common/tvos.conf
@@ -0,0 +1,20 @@
+#
+# qmake common configuration for tvOS
+#
+
+QMAKE_PLATFORM += tvos
+QMAKE_MAC_SDK = appletvos
+
+simulator.sdk = appletvsimulator
+simulator.target = simulator
+simulator.dir_affix = $${simulator.sdk}
+simulator.CONFIG = $${simulator.sdk}
+simulator.deployment_identifier = tvos-simulator
+
+device.sdk = appletvos
+device.target = device
+device.dir_affix = $${device.sdk}
+device.CONFIG = $${device.sdk}
+device.deployment_identifier = $${device.sdk}
+
+include(uikit.conf)
diff --git a/mkspecs/common/uikit.conf b/mkspecs/common/uikit.conf
new file mode 100644
index 0000000000..bfbab36db6
--- /dev/null
+++ b/mkspecs/common/uikit.conf
@@ -0,0 +1,11 @@
+#
+# qmake configuration for shared by UIKIT platforms
+#
+
+QMAKE_PLATFORM += uikit
+CONFIG += bitcode reduce_exports
+
+INCLUDEPATH += $$PWD/uikit
+DEFINES += DARWIN_NO_CARBON
+
+include(mac.conf)
diff --git a/mkspecs/common/ios/GLES2/gl2.h b/mkspecs/common/uikit/GLES2/gl2.h
index 0974509a35..0974509a35 100644
--- a/mkspecs/common/ios/GLES2/gl2.h
+++ b/mkspecs/common/uikit/GLES2/gl2.h
diff --git a/mkspecs/common/watchos.conf b/mkspecs/common/watchos.conf
new file mode 100644
index 0000000000..a9352aa9c5
--- /dev/null
+++ b/mkspecs/common/watchos.conf
@@ -0,0 +1,20 @@
+#
+# qmake common configuration for watchOS
+#
+
+QMAKE_PLATFORM += watchos
+QMAKE_MAC_SDK = watchos
+
+simulator.sdk = watchsimulator
+simulator.target = simulator
+simulator.dir_affix = $${simulator.sdk}
+simulator.CONFIG = apple$${simulator.sdk}
+simulator.deployment_identifier = watchos-simulator
+
+device.sdk = watchos
+device.target = device
+device.dir_affix = $${device.sdk}
+device.CONFIG = apple$${device.sdk}
+device.deployment_identifier = $${device.sdk}
+
+include(uikit.conf)
diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf
deleted file mode 100644
index fa1a72a1b9..0000000000
--- a/mkspecs/common/wince/qmake.conf
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# qmake configuration for common Windows CE
-#
-
-include(../angle.conf)
-
-MAKEFILE_GENERATOR = MSVC.NET
-QMAKE_PLATFORM += wince win32
-CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target
-
-DEFINES += UNDER_CE WINCE _WINDOWS _UNICODE UNICODE _WIN32 QT_NO_PRINTER QT_NO_PRINTDIALOG
-
-QMAKE_COMPILER_DEFINES += _MSC_VER=1400
-
-QMAKE_COMPILER = msvc
-
-QMAKE_CC = cl
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = bison -y
-QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t-
-QMAKE_CFLAGS_WARN_ON = -W3
-QMAKE_CFLAGS_WARN_OFF = -W0
-QMAKE_CFLAGS_RELEASE = -O2 -MD
-QMAKE_CFLAGS_LTCG = -GL
-QMAKE_CFLAGS_DEBUG = -DDEBUG -D_DEBUG -Zi -MDd
-QMAKE_CFLAGS_YACC =
-
-# Uncomment the following lines to reduce library sizes
-# with potential cost of performance
-# QMAKE_CFLAGS += -Os
-# QMAKE_CFLAGS_RELEASE += -Os
-
-QMAKE_CXX = $$QMAKE_CC
-QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
-QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189
-QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_STL_ON = -EHsc
-QMAKE_CXXFLAGS_STL_OFF =
-QMAKE_CXXFLAGS_RTTI_ON = -GR
-QMAKE_CXXFLAGS_RTTI_OFF =
-QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
-QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -EHs-c-
-
-QMAKE_INCDIR =
-
-QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<<
-QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<<
-
-QMAKE_LINK = link
-QMAKE_LFLAGS = /NOLOGO /NODEFAULTLIB:OLDNAMES.LIB
-QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
-QMAKE_LFLAGS_DEBUG = /DEBUG
-QMAKE_LFLAGS_LTCG = /LTCG
-QMAKE_LIBS_NETWORK = ws2.lib
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_COMPAT =
-QMAKE_PREFIX_SHLIB =
-QMAKE_EXTENSION_SHLIB = dll
-QMAKE_PREFIX_STATICLIB =
-QMAKE_EXTENSION_STATICLIB = lib
-
-QMAKE_LIBS_EGL = $${LIBEGL_NAME}.lib
-QMAKE_LIBS_OPENGL_ES2 = $${LIBGLESV2_NAME}.lib
-
-QMAKE_LIBS_QT_ENTRY = -lqtmain
-
-QMAKE_IDL = midl
-QMAKE_LIB = lib
-QMAKE_RC = rc
-
-VCPROJ_EXTENSION = .vcproj
-VCSOLUTION_EXTENSION = .sln
-VCPROJ_KEYWORD = Qt4VSv1.0
-load(qt_config)
diff --git a/mkspecs/common/wince/qplatformdefs.h b/mkspecs/common/wince/qplatformdefs.h
deleted file mode 100644
index 92f5013231..0000000000
--- a/mkspecs/common/wince/qplatformdefs.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the qmake spec 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 QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-#ifdef UNICODE
-#ifndef _UNICODE
-#define _UNICODE
-#endif
-#endif
-
-// Get Qt defines/settings
-
-#include "qglobal.h"
-#include "qfunctions_wince.h"
-
-#define _POSIX_
-#include <limits.h>
-#undef _POSIX_
-
-#include <tchar.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_STATBUF struct _stati64 // non-ANSI defs
-#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs
-#define QT_STAT ::_stati64
-#define QT_FSTAT ::_fstati64
-#else
-#define QT_STATBUF struct stat // non-ANSI defs
-#define QT_STATBUF4TSTAT struct stat // non-ANSI defs
-#define QT_STAT ::qt_wince_stat
-#define QT_FSTAT ::qt_wince__fstat
-#endif
-#define QT_STAT_REG _S_IFREG
-#define QT_STAT_DIR _S_IFDIR
-#define QT_STAT_MASK _S_IFMT
-#if defined(_S_IFLNK)
-# define QT_STAT_LNK _S_IFLNK
-#endif
-#define QT_FILENO ::qt_wince___fileno
-#define QT_OPEN ::qt_wince_open
-#define QT_CLOSE ::qt_wince__close
-#ifdef QT_LARGEFILE_SUPPORT
-#define QT_LSEEK ::_lseeki64
-#define QT_TSTAT ::_tstati64
-#else
-#define QT_LSEEK ::qt_wince__lseek
-#define QT_TSTAT ::_tstat
-#endif
-#define QT_READ ::qt_wince__read
-#define QT_WRITE ::qt_wince__write
-#define QT_ACCESS ::qt_wince__access
-#define QT_GETCWD ::_getcwd
-#define QT_CHDIR ::_chdir
-#define QT_MKDIR ::qt_wince__mkdir
-#define QT_RMDIR ::qt_wince__rmdir
-#define QT_OPEN_LARGEFILE 0
-#define QT_OPEN_RDONLY _O_RDONLY
-#define QT_OPEN_WRONLY _O_WRONLY
-#define QT_OPEN_RDWR _O_RDWR
-#define QT_OPEN_CREAT _O_CREAT
-#define QT_OPEN_TRUNC _O_TRUNC
-#define QT_OPEN_APPEND _O_APPEND
-# define QT_OPEN_TEXT _O_TEXT
-# define QT_OPEN_BINARY _O_BINARY
-
-#define QT_FOPEN ::fopen
-#define QT_FSEEK ::fseek
-#define QT_FTELL ::ftell
-#define QT_FGETPOS ::fgetpos
-#define QT_FSETPOS ::fsetpos
-#define QT_MMAP ::mmap
-#define QT_FPOS_T fpos_t
-#define QT_OFF_T long
-
-#define QT_SIGNAL_ARGS int
-
-#define QT_VSNPRINTF(buffer, count, format, arg) \
- _vsnprintf(buffer, count, format, arg)
-
-#define QT_SNPRINTF ::_snprintf
-
-# define F_OK 0
-# define X_OK 1
-# define W_OK 2
-# define R_OK 4
-
-typedef int mode_t;
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf
index b5e0c7cc71..05c9bd39a5 100644
--- a/mkspecs/common/winrt_winphone/qmake.conf
+++ b/mkspecs/common/winrt_winphone/qmake.conf
@@ -10,8 +10,7 @@ MAKEFILE_GENERATOR = MSBUILD
QMAKE_COMPILER = msvc
QMAKE_PLATFORM = winrt win32
CONFIG = package_manifest $$CONFIG incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target rtti
-DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN \
- QT_NO_PRINTER QT_NO_PRINTDIALOG # TODO: Remove when printing is re-enabled
+DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN
DEPLOYMENT_PLUGIN += qwinrt
diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp
index 4dac018810..184a47b683 100644
--- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp
+++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qeglfshooks.h"
+#include "private/qeglfshooks_p.h"
#include <EGL/fbdev_window.h>
#include <stdio.h>
#include <sys/ioctl.h>
diff --git a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf
index 71ff90c9f8..99b8f22f97 100644
--- a/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf
+++ b/mkspecs/devices/linux-arm-hisilicon-hix5hd2-g++/qmake.conf
@@ -4,14 +4,14 @@
# A typical configure line looks like this:
# <path-to-qt-src>/configure -opensource -confirm-license -release -make libs -make examples -optimized-qmake
# -platform linux-g++-64 -device linux-arm-hisilicon-hix5hd2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf-
-# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -no-audio-backend -qt-zlib -qt-libjpeg -qt-libpng
+# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -qt-zlib -qt-libjpeg -qt-libpng
# -no-icu -no-nis -sysroot <path-to-rootfs> -extprefix <path-to-targetinstall> -hostprefix <path-to-hostinstall>
# -prefix <path-to-prefix>
#
# such as
# ./configure -opensource -confirm-license -release -make libs -make examples -optimized-qmake
# -platform linux-g++-64 -device linux-arm-hisilicon-hix5hd2-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf-
-# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -no-audio-backend -qt-zlib -qt-libjpeg -qt-libpng
+# -opengl es2 -no-qml-debug -no-directfb -no-kms -no-xcb -no-alsa -qt-zlib -qt-libjpeg -qt-libpng
# -no-icu -no-nis -sysroot /home/abc/project/sysbase
# -extprefix /home/abc/project/sysbase/qt_install
# -hostprefix /home/abc/project/qtdir/qtbase_hostinstall
diff --git a/mkspecs/devices/linux-colibri-vf-g++/qmake.conf b/mkspecs/devices/linux-colibri-vf-g++/qmake.conf
new file mode 100644
index 0000000000..bc42f67f8a
--- /dev/null
+++ b/mkspecs/devices/linux-colibri-vf-g++/qmake.conf
@@ -0,0 +1,17 @@
+#
+# qmake configuration for the NXP Colibri VFxx boards
+#
+
+include(../common/linux_device_pre.conf)
+
+VFXX_CFLAGS = -march=armv7-a -mtune=cortex-a5 -mfpu=neon
+QMAKE_CFLAGS += $$VFXX_CFLAGS
+QMAKE_CXXFLAGS += $$VFXX_CFLAGS
+
+QT_QPA_DEFAULT_PLATFORM = linuxfb
+
+DISTRO_OPTS += hard-float
+
+include(../common/linux_arm_device_post.conf)
+
+load(qt_config)
diff --git a/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h b/mkspecs/devices/linux-colibri-vf-g++/qplatformdefs.h
index 780b7ef124..6a35ed45d5 100644
--- a/mkspecs/wince60standard-x86-msvc2005/qplatformdefs.h
+++ b/mkspecs/devices/linux-colibri-vf-g++/qplatformdefs.h
@@ -37,5 +37,4 @@
**
****************************************************************************/
-#include "../common/wince/qplatformdefs.h"
-
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/mkspecs/devices/linux-rpi3-g++/qmake.conf b/mkspecs/devices/linux-rpi3-g++/qmake.conf
index a660577565..10862ccd70 100644
--- a/mkspecs/devices/linux-rpi3-g++/qmake.conf
+++ b/mkspecs/devices/linux-rpi3-g++/qmake.conf
@@ -1,7 +1,12 @@
-# qmake configuration for the Raspberry Pi 3 (32-bit) using the Broadcom graphics stack
+# qmake configuration for the Raspberry Pi 3 using the Broadcom graphics stack
include(../common/linux_device_pre.conf)
+# For modern Yocto-based sysroots that have the proper include and lib
+# setup in egl.pc we will pull the necessary arguments from
+# there. However, to support Raspbian and older stuff that has /opt/vc
+# and possibly no pkg-config, have some static values as well:
+
# I consider it a bug that this is required, but our EGL config.test _requires_ it
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib
diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf
index ce5696a33c..848de485f8 100644
--- a/mkspecs/features/android/android_deployment_settings.prf
+++ b/mkspecs/features/android/android_deployment_settings.prf
@@ -65,6 +65,6 @@ contains(TEMPLATE, ".*app"):!build_pass: {
isEmpty(ANDROID_DEPLOYMENT_SETTINGS_FILE): ANDROID_DEPLOYMENT_SETTINGS_FILE = $$OUT_PWD/android-$$TARGET-deployment-settings.json
- write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT) | error("Aborting.")
+ write_file($$ANDROID_DEPLOYMENT_SETTINGS_FILE, FILE_CONTENT)|error()
}
diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
index a890c7f6b9..f275e3ac06 100644
--- a/mkspecs/features/configure.prf
+++ b/mkspecs/features/configure.prf
@@ -1,40 +1,6 @@
-equals(QMAKE_HOST.os, Windows) {
- SETENV_PFX = "set "
- SETENV_SFX = "&"
-} else {
- SETENV_PFX =
- SETENV_SFX =
-}
-
-QMAKE_MAKE = $$(MAKE)
-!isEmpty(QMAKE_MAKE) {
- # We were called recursively. Use the same make.
-} else:if(equals(MAKEFILE_GENERATOR, UNIX)|equals(MAKEFILE_GENERATOR, MINGW)) {
- !equals(QMAKE_HOST.os, Windows): \
- QMAKE_MAKE = make
- else: \
- QMAKE_MAKE = mingw32-make
-} else:if(equals(MAKEFILE_GENERATOR, MSVC.NET)|equals(MAKEFILE_GENERATOR, MSBUILD)) {
- QMAKE_MAKE = nmake
-} else {
- error("Configure tests are not supported with the $$MAKEFILE_GENERATOR Makefile generator.")
-}
-# Make sure we don't inherit MAKEFLAGS - -i in particular is fatal.
-QMAKE_MAKE = "$${SETENV_PFX}MAKEFLAGS=$$SETENV_SFX $$QMAKE_MAKE"
-
-# Ensure that a cache is present. If none was found on startup, this will create
-# one in the build directory of the project which loads this feature.
-cache()
+load(configure_base)
-QMAKE_CONFIG_LOG = $$dirname(_QMAKE_CACHE_)/config.log
-QMAKE_CONFIG_TESTS_DIR = $$_PRO_FILE_PWD_/config.tests
-
-defineTest(qtRunLoggedCommand) {
- msg = "+ $$1"
- write_file($$QMAKE_CONFIG_LOG, msg, append)
- system("$$1 >> \"$$QMAKE_CONFIG_LOG\" 2>&1")|return(false)
- return(true)
-}
+isEmpty(QMAKE_CONFIG_TESTS_DIR): QMAKE_CONFIG_TESTS_DIR = $$_PRO_FILE_PWD_/config.tests
# Try to build the test project in $$QMAKE_CONFIG_TESTS_DIR/$$1
# ($$_PRO_FILE_PWD_/config.tests/$$1 by default).
@@ -73,7 +39,7 @@ defineTest(qtCompileTest) {
# Clean up after previous run
exists($$test_out_dir/Makefile):qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE distclean")
- mkpath($$test_out_dir)|error("Aborting.")
+ mkpath($$test_out_dir)|error()
!isEmpty (QMAKE_QTCONF): qtconfarg = -qtconf $$QMAKE_QTCONF
diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf
new file mode 100644
index 0000000000..dc630a3528
--- /dev/null
+++ b/mkspecs/features/configure_base.prf
@@ -0,0 +1,51 @@
+equals(QMAKE_HOST.os, Windows) {
+ SETENV_PFX = "set "
+ SETENV_SFX = "&"
+} else {
+ SETENV_PFX =
+ SETENV_SFX =
+}
+
+QMAKE_MAKE = $$(MAKE)
+!isEmpty(QMAKE_MAKE) {
+ # We were called recursively. Use the same make.
+} else: if(equals(MAKEFILE_GENERATOR, UNIX)|equals(MAKEFILE_GENERATOR, MINGW)) {
+ !equals(QMAKE_HOST.os, Windows): \
+ QMAKE_MAKE = make
+ else: \
+ QMAKE_MAKE = mingw32-make
+} else: if(equals(MAKEFILE_GENERATOR, MSVC.NET)|equals(MAKEFILE_GENERATOR, MSBUILD)) {
+ QMAKE_MAKE = nmake
+} else {
+ error("Configure tests are not supported with the $$MAKEFILE_GENERATOR Makefile generator.")
+}
+# Make sure we don't inherit MAKEFLAGS - -i in particular is fatal.
+QMAKE_MAKE = "$${SETENV_PFX}MAKEFLAGS=$$SETENV_SFX $$QMAKE_MAKE"
+
+isEmpty(QMAKE_CONFIG_VERBOSE): QMAKE_CONFIG_VERBOSE = false
+
+defineTest(qtLog) {
+ write_file($$QMAKE_CONFIG_LOG, 1, append)
+ $$QMAKE_CONFIG_VERBOSE: for (l, 1): log("$$l$$escape_expand(\\n)")
+}
+
+defineTest(qtRunLoggedCommand) {
+ qtLog("+ $$1")
+
+ output = $$system("( $$1 ) 2>&1", lines, result)
+ qtLog($$output)
+ !isEmpty(2) {
+ $$2 = $$output
+ export($$2)
+ }
+
+ !equals(result, 0): return(false)
+ return(true)
+}
+
+# Ensure that a cache is present. If none was found on startup, this will create
+# one in the build directory of the project which loads this feature.
+cache()
+
+QMAKE_CONFIG_LOG = $$dirname(_QMAKE_CACHE_)/config.log
+write_file($$QMAKE_CONFIG_LOG, "")
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 11fb52a0b1..1099e14b17 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -78,7 +78,7 @@ contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") {
CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
}
-win32:!wince:!static:!staticlib {
+win32:!static:!staticlib {
CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX])
contains(CMAKE_DLL_DIR, "^\\.\\./.*") {
CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
@@ -208,7 +208,7 @@ mac {
CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.prl
CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
} else {
- CONFIG(qt_framework, qt_framework|qt_no_framework) {
+ qt_framework {
CMAKE_LIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.framework/Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.framework/Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
CMAKE_BUILD_IS_FRAMEWORK = "true"
diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf
index 7183ade4df..af80fc00a1 100644
--- a/mkspecs/features/ctest_testcase_common.prf
+++ b/mkspecs/features/ctest_testcase_common.prf
@@ -69,8 +69,9 @@ for (dep, dependentmodules): \
mod_deps += $$cmakeModuleName($$dep)
dependentmodules = $$join(mod_deps, ";")
-contains(QT_CONFIG, angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
-!contains(QT_CONFIG, egl): CMAKE_GL_DEFINES += -DNO_EGL=True
+QT_FOR_CONFIG += gui-private
+qtConfig(angle): CMAKE_GL_DEFINES = -DQT_WITH_ANGLE=True
+!qtConfig(egl): CMAKE_GL_DEFINES += -DNO_EGL=True
CMAKE_MODULE_VERSIONS =
CMAKE_MODULES_UNDER_TEST =
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index e7e9a5bd87..edc3cac7ba 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -116,6 +116,29 @@ c++11|c++14|c++1z {
unset(cxxstd)
}
+suffix =
+for(ever) {
+ QMAKE_USE$${suffix} = $$unique(QMAKE_USE$${suffix})
+ for(name, QMAKE_USE$${suffix}) {
+ nu = $$upper($$name)
+ CONFIG(debug, debug|release): \
+ libs = $$eval(QMAKE_LIBS_$${nu}_DEBUG)
+ else: \
+ libs = $$eval(QMAKE_LIBS_$${nu}_RELEASE)
+ libs += $$eval(QMAKE_LIBS_$$nu)
+ cflags = $$eval(QMAKE_CFLAGS_$${nu})
+
+ isEmpty(libs):isEmpty(cflags): \
+ error("Library '$$name' is not defined.")
+
+ LIBS$${suffix} += $$libs
+ QMAKE_CFLAGS += $$cflags
+ QMAKE_CXXFLAGS += $$cflags
+ }
+ !isEmpty(suffix): break()
+ suffix = "_PRIVATE"
+}
+
!precompile_header: SOURCES += $$NO_PCH_SOURCES
QMAKE_INCDIR += $$QMAKE_INCDIR_POST
diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf
index cd4ea58d87..b655f2e0ca 100644
--- a/mkspecs/features/default_pre.prf
+++ b/mkspecs/features/default_pre.prf
@@ -8,8 +8,6 @@ CONFIG = \
testcase_targets import_plugins import_qpa_plugin \
$$CONFIG
-contains(QT_CONFIG, c++11):lessThan(QT_COMPILER_STDCXX, 201103): CONFIG += c++11
-
!build_pass:defined(QT_EDITION, var):!equals(QT_EDITION, "OpenSource"):!equals(QT_EDITION, "Preview") {
#
# call license checker (but cache result for one day)
@@ -25,4 +23,49 @@ contains(QT_CONFIG, c++11):lessThan(QT_COMPILER_STDCXX, 201103): CONFIG += c++11
unset(today)
}
-load(toolchain)
+isEmpty(QMAKE_DEFAULT_INCDIRS):!host_build {
+ #
+ # Get default include and library paths from compiler
+ #
+ gcc {
+ !equals(QMAKE_HOST.os, Windows) {
+ cmd_prefix = "LC_ALL=C"
+ cmd_suffix = "</dev/null >/dev/null"
+ } else {
+ cmd_prefix = "set LC_ALL=C&"
+ cmd_suffix = "<NUL >NUL"
+ }
+ output = $$system("$$cmd_prefix $$QMAKE_CXX $$QMAKE_CXXFLAGS -xc++ -E -v - 2>&1 $$cmd_suffix", lines)
+ add_includes = false
+ for (line, output) {
+ line ~= s/^ *// # remove leading spaces
+ contains(line, "LIBRARY_PATH=.*") {
+ line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH=
+ paths = $$split(line, $$QMAKE_DIRLIST_SEP)
+ for (path, paths): \
+ QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path)
+ } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here:
+ add_includes = true
+ } else: contains(line, "End of search.*") {
+ add_includes = false
+ } else: $$add_includes {
+ !contains(line, ".* \\(framework directory\\)"): \
+ QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)
+ }
+ }
+ QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS)
+ } else: msvc {
+ LIB = $$getenv("LIB")
+ QMAKE_DEFAULT_LIBDIRS = $$split(LIB, $$QMAKE_DIRLIST_SEP)
+ INCLUDE = $$getenv("INCLUDE")
+ QMAKE_DEFAULT_INCDIRS = $$split(INCLUDE, $$QMAKE_DIRLIST_SEP)
+ }
+
+ unix {
+ isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include
+ isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib
+ }
+
+ !isEmpty(QMAKE_DEFAULT_INCDIRS): cache(QMAKE_DEFAULT_INCDIRS, set stash)
+ !isEmpty(QMAKE_DEFAULT_LIBDIRS): cache(QMAKE_DEFAULT_LIBDIRS, set stash)
+}
diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf
index 0f0b991f0a..852954e5ca 100644
--- a/mkspecs/features/java.prf
+++ b/mkspecs/features/java.prf
@@ -28,7 +28,7 @@ javac.commands = javac -source 6 -target 6 -Xlint:unchecked -bootclasspath $$AND
javac.depends = FORCE
QMAKE_EXTRA_COMPILERS += javac
-mkpath($$absolute_path($$CLASS_DIR, $$OUT_PWD)) | error("Aborting.")
+mkpath($$absolute_path($$CLASS_DIR, $$OUT_PWD))|error()
# Disable all linker flags since we are overriding the regular linker
QMAKE_LFLAGS =
diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
index 6e920cd7d3..7bf6b4a716 100644
--- a/mkspecs/features/mac/default_post.prf
+++ b/mkspecs/features/mac/default_post.prf
@@ -2,11 +2,11 @@ load(default_post)
!no_objective_c:CONFIG += objective_c
qt {
- contains(QT_CONFIG, static) {
+ qtConfig(static) {
# C++11 support means using libc++ instead of libstd++. As the
# two libraries are incompatible we need to ensure the end user
# project is built using the same C++11 support/no support as Qt.
- contains(QT_CONFIG, c++11) {
+ qtConfig(c++11) {
CONFIG += c++11
} else: c++11 {
warning("Qt was not built with C++11 enabled, disabling feature")
@@ -35,3 +35,7 @@ cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
cache(QMAKE_XCODE_VERSION, stash)
QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+
+# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
+# and friends that other features/extra compilers may depend on.
+sdk: load(sdk)
diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
index 1190efed5d..4c8c80d101 100644
--- a/mkspecs/features/mac/default_pre.prf
+++ b/mkspecs/features/mac/default_pre.prf
@@ -1,4 +1,4 @@
-CONFIG = rez $$CONFIG
+CONFIG = sdk rez $$CONFIG
load(default_pre)
isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
@@ -40,7 +40,7 @@ isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
# and put it into a dSYM file. We don't need that dSYM file in
# the first place, since the information is available in the
# object files inside the archives (static libraries).
-contains(QT_CONFIG, static): \
+macx-xcode:qtConfig(static): \
QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
# This variable is used by the xcode_dynamic_library_suffix
diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
index ab37b1740f..0d43fbe5a1 100644
--- a/mkspecs/features/mac/sdk.prf
+++ b/mkspecs/features/mac/sdk.prf
@@ -24,12 +24,6 @@ QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
-!equals(MAKEFILE_GENERATOR, XCODE) {
- QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
- QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
- QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH
-}
-
sysrootified =
for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
QMAKE_INCDIR_OPENGL = $$sysrootified
@@ -55,19 +49,73 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
}
!equals(MAKEFILE_GENERATOR, XCODE) {
- ios:!host_build {
- simulator: \
- version_identifier = $$simulator.deployment_identifier
- else: \
- version_identifier = $$device.deployment_identifier
- deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
+ uikit:!host_build {
+ ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
+ tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
+ watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
+
+ !simulator|simulator_and_device: device_archs = $$QMAKE_APPLE_DEVICE_ARCHS
+ simulator: simulator_archs = $$QMAKE_APPLE_SIMULATOR_ARCHS
+ archs = $$device_archs $$simulator_archs
+
+ QMAKE_XARCH_CFLAGS =
+ QMAKE_XARCH_LFLAGS =
+ QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
+
+ single_arch {
+ device_archs = $$first(device_archs)
+ simulator_archs = $$first(simulator_archs)
+ archs = $$first(archs)
+ }
+
+ for(arch, archs) {
+ contains(simulator_archs, $$arch) {
+ sdk = $$simulator.sdk
+ version_identifier = $$simulator.deployment_identifier
+ } else {
+ sdk = $$device.sdk
+ version_identifier = $$device.deployment_identifier
+ }
+
+ version_min_flags = \
+ -Xarch_$${arch} \
+ -m$${version_identifier}-version-min=$$deployment_target
+ QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
+ -Xarch_$${arch} \
+ -isysroot$$xcodeSDKInfo(Path, $$sdk)
+ QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
+ -Xarch_$${arch} \
+ -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
+
+ QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
+ QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
+
+ QMAKE_EXTRA_VARIABLES += \
+ QMAKE_XARCH_CFLAGS_$${arch} \
+ QMAKE_XARCH_LFLAGS_$${arch}
+ }
+
+ QMAKE_CFLAGS_USE_PRECOMPILE =
+ for(arch, archs) {
+ QMAKE_CFLAGS_USE_PRECOMPILE += \
+ -Xarch_$${arch} \
+ -include${QMAKE_PCH_OUTPUT_$${arch}}
+ }
+ QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+ QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+ QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+
+ QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
} else: osx {
version_identifier = macosx
deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
+ version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
+ QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+ QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+ QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
}
- version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
- QMAKE_CFLAGS += $$version_min_flag
- QMAKE_CXXFLAGS += $$version_min_flag
- QMAKE_LFLAGS += $$version_min_flag
+ QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+ QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+ QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
}
diff --git a/mkspecs/features/mac/toolchain.prf b/mkspecs/features/mac/toolchain.prf
deleted file mode 100644
index df191eb13c..0000000000
--- a/mkspecs/features/mac/toolchain.prf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Ensure that we process sdk.prf first, as it will update QMAKE_CXX,
-# which the default path determination uses.
-sdk: load(sdk)
-
-load(toolchain)
diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf
index 8ddfc38c63..4c81ee5c74 100644
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -21,11 +21,27 @@ win32:count(MOC_INCLUDEPATH, 40, >) {
WIN_INCLUDETEMP_CONT =
for (inc, MOC_INCLUDEPATH): \
WIN_INCLUDETEMP_CONT += -I$$inc
- write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error("Aborting.")
+ write_file($$absolute_path($$WIN_INCLUDETEMP, $$OUT_PWD), WIN_INCLUDETEMP_CONT)|error()
+}
+
+# QNX's compiler sets "gcc" config, but does not support the -dM option;
+# UIKit builds are always multi-arch due to simulator_and_device (unless
+# -sdk is used) so this feature cannot possibly work.
+if(gcc|intel_icl|msvc):!rim_qcc:!uikit {
+ moc_predefs.CONFIG = no_link
+ gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+ else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+ else:msvc {
+ moc_predefs.commands += $$QMAKE_CXX -Bx$$shell_path($$[QT_INSTALL_BINS/get]/qmake) $$QMAKE_CXXFLAGS -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT}
+ } else: error("Oops, I messed up")
+ moc_predefs.output = $$MOC_DIR/moc_predefs.h
+ moc_predefs.input = MOC_PREDEF_FILE
+ silent: moc_predefs.commands = @echo generating $$moc_predefs.output$$escape_expand(\n\t)@$$moc_predefs.commands
+ QMAKE_EXTRA_COMPILERS += moc_predefs
+ MOC_PREDEF_FILE = $$[QT_HOST_DATA/src]/mkspecs/features/data/dummy.cpp
}
defineReplace(mocCmdBase) {
- RET =
!isEmpty(WIN_INCLUDETEMP) {
incvar = @$$WIN_INCLUDETEMP
} else {
@@ -34,7 +50,14 @@ defineReplace(mocCmdBase) {
incvar += -I$$shell_quote($$inc)
incvar += $$QMAKE_FRAMEWORKPATH_FLAGS
}
- RET += $$QMAKE_MOC $(DEFINES) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$incvar $$QMAKE_MOC_OPTIONS
+
+ RET = $$QMAKE_MOC $(DEFINES)
+ msvc: RET += --compiler-flavor=msvc
+
+ isEmpty(MOC_PREDEF_FILE): RET += $$join(QMAKE_COMPILER_DEFINES, " -D", -D)
+ else: RET += --include $$moc_predefs.output
+
+ RET += $$incvar $$QMAKE_MOC_OPTIONS
return($$RET)
}
@@ -46,7 +69,7 @@ moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAK
moc_header.input = HEADERS
moc_header.variable_out = SOURCES
moc_header.name = MOC ${QMAKE_FILE_IN}
-moc_header.depends += $$WIN_INCLUDETEMP
+moc_header.depends += $$WIN_INCLUDETEMP $$moc_predefs.output
silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands
QMAKE_EXTRA_COMPILERS += moc_header
INCREDIBUILD_XGE += moc_header
@@ -58,7 +81,7 @@ moc_source.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_
moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC}
moc_source.input = SOURCES OBJECTIVE_SOURCES
moc_source.name = MOC ${QMAKE_FILE_IN}
-moc_source.depends += $$WIN_INCLUDETEMP
+moc_source.depends += $$WIN_INCLUDETEMP $$moc_predefs.output
silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands
QMAKE_EXTRA_COMPILERS += moc_source
INCREDIBUILD_XGE += moc_source
diff --git a/mkspecs/features/no_debug_info.prf b/mkspecs/features/no_debug_info.prf
index 1307679a39..da14b7bb27 100644
--- a/mkspecs/features/no_debug_info.prf
+++ b/mkspecs/features/no_debug_info.prf
@@ -1,5 +1,4 @@
-
-win32-msvc2*|wince*msvc* {
+msvc {
QMAKE_CFLAGS -= -Zi
QMAKE_CFLAGS_DEBUG -= -Zi
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zi
diff --git a/mkspecs/features/qfeatures.prf b/mkspecs/features/qfeatures.prf
deleted file mode 100644
index 15ef5c5be0..0000000000
--- a/mkspecs/features/qfeatures.prf
+++ /dev/null
@@ -1,4 +0,0 @@
-# This file needs to be loaded explicitly, as the evaluation is relatively
-# expensive, and not many projects will actually need it.
-QMAKE_QT_FEATURES = $$[QT_HOST_DATA/get]/mkspecs/qfeatures.pri
-include($$QMAKE_QT_FEATURES) | error("Failed to load $$QMAKE_QT_FEATURES")
diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
index a367dc3337..149b3cff56 100644
--- a/mkspecs/features/qml_plugin.prf
+++ b/mkspecs/features/qml_plugin.prf
@@ -15,9 +15,9 @@ TEMPLATE = lib
CONFIG += plugin
if(win32|mac):!macx-xcode {
- contains(QT_CONFIG, simulator_and_device): CONFIG += simulator_and_device
- contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
- contains(QT_CONFIG, build_all): CONFIG += build_all
+ qtConfig(simulator_and_device): CONFIG += simulator_and_device
+ qtConfig(debug_and_release): CONFIG += debug_and_release
+ qtConfig(build_all): CONFIG += build_all
}
CONFIG += relative_qt_rpath # Qt's QML plugins should be relocatable
diff --git a/mkspecs/features/qpa/basicunixfontdatabase.prf b/mkspecs/features/qpa/basicunixfontdatabase.prf
index f2e4016c99..80382da214 100644
--- a/mkspecs/features/qpa/basicunixfontdatabase.prf
+++ b/mkspecs/features/qpa/basicunixfontdatabase.prf
@@ -1,3 +1,3 @@
-contains(QT_CONFIG, system-freetype) {
+qtConfig(system-freetype) {
LIBS_PRIVATE += -lfreetype
}
diff --git a/mkspecs/features/qpa/genericunixfontdatabase.prf b/mkspecs/features/qpa/genericunixfontdatabase.prf
index b0d81e5571..3680d5ad79 100644
--- a/mkspecs/features/qpa/genericunixfontdatabase.prf
+++ b/mkspecs/features/qpa/genericunixfontdatabase.prf
@@ -1,5 +1,5 @@
CONFIG += qpa/basicunixfontdatabase
-contains(QT_CONFIG, fontconfig) {
+qtConfig(fontconfig) {
DEFINES += Q_FONTCONFIGDATABASE
LIBS_PRIVATE += -lfontconfig
} else:!android {
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index bb52f23378..bd54565e01 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -2,14 +2,14 @@ CONFIG *= thread
#handle defines
win32 {
- contains(QT_CONFIG, shared) {
+ qtConfig(shared) {
# this variable is read by qmake in qmake/generators/win32/msvc_vcproj.cpp
# function VcprojGenerator::initDeploymentTool()
QMAKE_DLL_PATHS += $$[QT_INSTALL_BINS/get]
}
}
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG
-contains(QT_CONFIG, force_asserts):DEFINES += QT_FORCE_ASSERTS
+qtConfig(force_asserts): DEFINES += QT_FORCE_ASSERTS
no_keywords:DEFINES += QT_NO_KEYWORDS
plugin { #Qt plugins
static:DEFINES += QT_STATICPLUGIN
@@ -165,7 +165,7 @@ for(ever) {
qt_module_deps = $$CLEAN_QT $$CLEAN_QT_PRIVATE
qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
-!no_qt_rpath:!static:contains(QT_CONFIG, rpath):!contains(QT_CONFIG, static):\
+!no_qt_rpath:!static:qtConfig(rpath):!qtConfig(static):\
contains(qt_module_deps, core) {
relative_qt_rpath:!isEmpty(QMAKE_REL_RPATH_BASE):contains(INSTALLS, target):\
isEmpty(target.files):isEmpty(target.commands):isEmpty(target.extra) {
@@ -176,7 +176,7 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
}
}
-!isEmpty(QMAKE_LFLAGS_RPATHLINK):!contains(QT_CONFIG, static) {
+!isEmpty(QMAKE_LFLAGS_RPATHLINK):!qtConfig(static) {
# -rpath-link is used by the linker to find dependencies of dynamic
# libraries which were NOT specified on the command line.
# This means that paths of direct dependencies (QT & QT_PRIVATE)
@@ -191,7 +191,7 @@ qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
# static builds: link qml import plugins into the app.
contains(qt_module_deps, qml): \
- contains(QT_CONFIG, static):contains(TEMPLATE, .*app):!host_build:!no_import_scan {
+ qtConfig(static):contains(TEMPLATE, .*app):!host_build:!no_import_scan {
!isEmpty(QTREPOS) {
for (qrep, QTREPOS): \
exists($$qrep/qml): \
@@ -238,7 +238,7 @@ contains(qt_module_deps, qml): \
}
}
QML_IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_qml_plugin_import.cpp
- write_file($$QML_IMPORT_CPP, IMPORT_FILE_CONT)|error("Aborting.")
+ write_file($$QML_IMPORT_CPP, IMPORT_FILE_CONT)|error()
GENERATED_SOURCES += $$QML_IMPORT_CPP
QMAKE_DISTCLEAN += $$QML_IMPORT_CPP
@@ -261,7 +261,7 @@ contains(qt_module_deps, qml): \
"[Paths]" \
"Imports = $$QMAKE_QML_BUNDLE_PATH" \
"Qml2Imports = $$QMAKE_QML_BUNDLE_PATH"
- write_file("$$OUT_PWD/qt.conf", QT_CONF_CONTENTS)|error("Aborting.")
+ write_file("$$OUT_PWD/qt.conf", QT_CONF_CONTENTS)|error()
# write qt.conf and copy each qml import dir into the bundle.
# But strip away archives and other files that are not needed:
@@ -318,7 +318,7 @@ contains(TEMPLATE, .*app) {
}
QT_PLUGIN_VERIFY = DEPLOYMENT_PLUGIN
-contains(QT_CONFIG, static) {
+qtConfig(static) {
QT_PLUGIN_VERIFY += QTPLUGIN
force_import_plugins|contains(TEMPLATE, .*app) {
import_plugins:!isEmpty(QTPLUGIN) {
@@ -334,7 +334,7 @@ contains(QT_CONFIG, static) {
warning("Plugin class name could not be determined for $$IMPORT_PLUG plugin.")
}
IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_import.cpp
- write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error("Aborting.")
+ write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error()
GENERATED_SOURCES += $$IMPORT_CPP
QMAKE_DISTCLEAN += $$IMPORT_CPP
}
@@ -365,7 +365,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
# The following block is currently broken, because qt_plugin_XXX.prf files
# are not generated for dynamic builds.
- false:isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:if(wince*|winrt) {
+ false:isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:winrt {
QT_ITEM =
debug: QT_ITEM = $${QTPLUG}d4.dll
else: QT_ITEM = $${QTPLUG}4.dll
diff --git a/mkspecs/features/qt_android_deps.prf b/mkspecs/features/qt_android_deps.prf
index 7ec7bad047..c172ca8c4e 100644
--- a/mkspecs/features/qt_android_deps.prf
+++ b/mkspecs/features/qt_android_deps.prf
@@ -79,7 +79,7 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml
!isEmpty(FILE_CONTENT) {
FILE_CONTENT = "<rules><dependencies><lib name=\"$$TARGET\"><depends>" $$FILE_CONTENT "</depends></lib></dependencies></rules>"
- write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.")
+ write_file($$DEPENDENCY_FILE, FILE_CONTENT)|error()
}
}
diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
index 46aca50cc2..90135b00a3 100644
--- a/mkspecs/features/qt_app.prf
+++ b/mkspecs/features/qt_app.prf
@@ -21,14 +21,14 @@ QMAKE_LFLAGS += $$QMAKE_LFLAGS_GCSECTIONS
host_build: QT -= gui # no host tool will ever use gui
host_build:force_bootstrap {
- !build_pass:contains(QT_CONFIG, release_tools): CONFIG += release
+ !build_pass:qtConfig(release_tools): CONFIG += release
contains(QT, core(-private)?|xml) {
QT -= core core-private xml
QT += bootstrap-private
}
target.path = $$[QT_HOST_BINS]
} else {
- !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
+ !build_pass:qtConfig(debug_and_release): CONFIG += release
target.path = $$[QT_INSTALL_BINS]
CONFIG += relative_qt_rpath # Qt's tools and apps should be relocatable
}
diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf
index 1e2d5c2423..95e63ecae0 100644
--- a/mkspecs/features/qt_build_config.prf
+++ b/mkspecs/features/qt_build_config.prf
@@ -12,7 +12,7 @@
!contains(QMAKE_INTERNAL_INCLUDED_FILES, .*qmodule\\.pri) {
QMAKE_QT_MODULE = $$[QT_HOST_DATA/get]/mkspecs/qmodule.pri
!exists($$QMAKE_QT_MODULE)|!include($$QMAKE_QT_MODULE, "", true) {
- error("Cannot load qmodule.pri!")
+ debug(1, "Cannot load qmodule.pri!")
} else {
debug(1, "Loaded qmodule.pri from ($$QMAKE_QT_MODULE)")
}
@@ -64,7 +64,7 @@ CONFIG = qt_build_extra $$CONFIG
cross_compile: \
CONFIG += force_bootstrap
-android|ios|winrt: \
+android|uikit|winrt: \
CONFIG += builtin_testdata
CONFIG += \
@@ -95,3 +95,26 @@ defineTest(qtNomakeTools) {
export($${d}.CONFIG)
}
}
+
+# This overloads the same function from qt_functions.prf.
+# This is not in qt_module.prf, as that gets loaded too late.
+defineTest(qtConfig) {
+ modules = $$QT $$QT_PRIVATE $$QT_FOR_PRIVATE $$QT_FOR_CONFIG
+ modules ~= s,-private$,_private,g
+ modules = $$resolve_depends(modules, "QT.", ".depends")
+ isEmpty(MODULE): \
+ MODULE = $$section($$list($$basename(_PRO_FILE_)), ., 0, 0)
+ exists($$OUT_PWD/qt$${MODULE}-config.pri) {
+ include($$OUT_PWD/qt$${MODULE}-config.pri)
+ modules += $${MODULE} $${MODULE}_private
+ }
+ modules += global global_private
+ modules = $$reverse(modules)
+ for (module, modules) {
+ contains(QT.$${module}.enabled_features, $$1): \
+ return(true)
+ contains(QT.$${module}.disabled_features, $$1): \
+ return(false)
+ }
+ error("Could not find feature $${1}.")
+}
diff --git a/mkspecs/features/qt_build_extra.prf b/mkspecs/features/qt_build_extra.prf
index abdd7bc2b2..a1512c3a19 100644
--- a/mkspecs/features/qt_build_extra.prf
+++ b/mkspecs/features/qt_build_extra.prf
@@ -23,7 +23,8 @@ INCLUDEPATH += $$EXTRA_INCLUDEPATH
# The other flags are relevant only for actual libraries.
equals(TEMPLATE, aux): return()
-LIBS += $$EXTRA_LIBS
+QMAKE_LIBDIR += $$EXTRA_LIBDIR
+QMAKE_FRAMEWORKPATH += $$EXTRA_FRAMEWORKPATH
# Static libs need no rpaths
static: return()
diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
index 59e08fc124..d30983f62b 100644
--- a/mkspecs/features/qt_common.prf
+++ b/mkspecs/features/qt_common.prf
@@ -12,15 +12,14 @@
QMAKE_DIR_REPLACE_SANE += DESTDIR
CONFIG -= debug_and_release_target
-contains(QT_CONFIG, c++11): CONFIG += c++11 strict_c++
-contains(QT_CONFIG, c++14): CONFIG += c++14
-contains(QT_CONFIG, c++1z): CONFIG += c++1z
+qtConfig(c++11): CONFIG += c++11 strict_c++
+qtConfig(c++14): CONFIG += c++14
+qtConfig(c++1z): CONFIG += c++1z
contains(TEMPLATE, .*lib) {
# module and plugins
- !host_build:contains(QT_CONFIG, reduce_exports): CONFIG += hide_symbols
- unix:contains(QT_CONFIG, reduce_relocations): CONFIG += bsymbolic_functions
- contains(QT_CONFIG, largefile): CONFIG += largefile
- contains(QT_CONFIG, separate_debug_info): CONFIG += separate_debug_info
+ !host_build:qtConfig(reduce_exports): CONFIG += hide_symbols
+ unix:qtConfig(reduce_relocations): CONFIG += bsymbolic_functions
+ qtConfig(separate_debug_info): CONFIG += separate_debug_info
!isEmpty(_QMAKE_SUPER_CACHE_): \
rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
@@ -61,6 +60,8 @@ clang {
QMAKE_CXXFLAGS_WARN_ON += -Wvla
# GCC 5 introduced -Wdate-time
greaterThan(QT_GCC_MAJOR_VERSION, 4): QMAKE_CXXFLAGS_WARN_ON += -Wdate-time
+ # GCC 6 introduced these
+ greaterThan(QT_GCC_MAJOR_VERSION, 5): QMAKE_CXXFLAGS_WARN_ON += -Wshift-overflow=2 -Wduplicated-cond
}
warnings_are_errors:warning_clean {
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
new file mode 100644
index 0000000000..e34d7ad194
--- /dev/null
+++ b/mkspecs/features/qt_configure.prf
@@ -0,0 +1,1783 @@
+
+QT_CONFIGURE_REPORT =
+QT_CONFIGURE_NOTES =
+QT_CONFIGURE_WARNINGS =
+QT_CONFIGURE_ERRORS =
+
+defineTest(qtConfAddReport) {
+ QT_CONFIGURE_REPORT += "$$join(1, $$escape_expand(\\n))"
+ export(QT_CONFIGURE_REPORT)
+}
+
+defineTest(qtConfAddNote) {
+ QT_CONFIGURE_NOTES += "Note: $$join(1, $$escape_expand(\\n))"
+ export(QT_CONFIGURE_NOTES)
+}
+
+defineTest(qtConfAddWarning) {
+ QT_CONFIGURE_WARNINGS += "WARNING: $$join(1, $$escape_expand(\\n))"
+ export(QT_CONFIGURE_WARNINGS)
+}
+
+defineTest(qtConfAddError) {
+ QT_CONFIGURE_ERRORS += "ERROR: $$join(1, $$escape_expand(\\n))"
+ export(QT_CONFIGURE_ERRORS)
+ equals(2, log) {
+ CONFIG += mention_config_log
+ export(CONFIG)
+ }
+}
+
+defineTest(qtConfCommandlineSetInput) {
+ arg = $${1}
+ val = $${2}
+ !isEmpty($${currentConfig}.commandline.options.$${arg}.name): \
+ arg = $$eval($${currentConfig}.commandline.options.$${arg}.name)
+
+ config.input.$$arg = $$val
+ export(config.input.$$arg)
+}
+
+defineReplace(qtConfGetNextCommandlineArg) {
+ c = $$take_first(QMAKE_EXTRA_ARGS)
+ export(QMAKE_EXTRA_ARGS)
+ return($$c)
+}
+
+defineReplace(qtConfPeekNextCommandlineArg) {
+ return($$first(QMAKE_EXTRA_ARGS))
+}
+
+defineTest(qtConfCommandline_boolean) {
+ opt = $${1}
+ val = $${2}
+ isEmpty(val): val = yes
+
+ !equals(val, yes):!equals(val, no) {
+ qtConfAddError("Invalid value given for boolean command line option '$$opt'.")
+ return()
+ }
+
+ qtConfCommandlineSetInput($$opt, $$val)
+}
+
+defineTest(qtConfCommandline_void) {
+ opt = $${1}
+ val = $${2}
+ !isEmpty(val) {
+ qtConfAddError("Command line option '$$opt' expects no argument ('$$val' given).")
+ return()
+ }
+
+ val = $$eval($${currentConfig}.commandline.options.$${opt}.value)
+ isEmpty(val): val = yes
+
+ qtConfCommandlineSetInput($$opt, $$val)
+}
+
+defineTest(qtConfCommandline_enum) {
+ opt = $${1}
+ val = $${2}
+ isEmpty(val): val = yes
+
+ # validate and map value
+ mapped = $$eval($${currentConfig}.commandline.options.$${opt}.values.$${val})
+ isEmpty(mapped) {
+ # just a list of allowed values
+ for (i, $${currentConfig}.commandline.options.$${opt}.values._KEYS_) {
+ equals($${currentConfig}.commandline.options.$${opt}.values.$${i}, $$val) {
+ mapped = $$val
+ break()
+ }
+ }
+ }
+ isEmpty(mapped) {
+ qtConfAddError("Invalid value '$$val' supplied to command line option '$$opt'.")
+ return()
+ }
+
+ qtConfCommandlineSetInput($$opt, $$mapped)
+}
+
+defineTest(qtConfValidateValue) {
+ opt = $${1}
+ val = $${2}
+
+ validValues = $$eval($${currentConfig}.commandline.options.$${opt}.values._KEYS_)
+ isEmpty(validValues): \
+ return(true)
+
+ for (i, validValues) {
+ equals($${currentConfig}.commandline.options.$${opt}.values.$${i}, $$val): \
+ return(true)
+ }
+
+ qtConfAddError("Invalid value '$$val' supplied to command line option '$$opt'.")
+ return(false)
+}
+
+defineTest(qtConfCommandline_string) {
+ opt = $${1}
+ val = $${2}
+ isEmpty(val): val = $$qtConfGetNextCommandlineArg()
+
+ # Note: Arguments which are variable assignments are legit here.
+ contains(val, "^-.*")|isEmpty(val) {
+ qtConfAddError("No value supplied to command line option '$$opt'.")
+ return()
+ }
+
+ !qtConfValidateValue($$opt, $$val): \
+ return()
+
+ qtConfCommandlineSetInput($$opt, $$val)
+}
+
+defineTest(qtConfCommandline_optionalString) {
+ opt = $${1}
+ val = $${2}
+ isEmpty(val) {
+ v = $$qtConfPeekNextCommandlineArg()
+ contains(v, "^-.*|[A-Z_]+=.*")|isEmpty(v): \
+ val = "yes"
+ else: \
+ val = $$qtConfGetNextCommandlineArg()
+ }
+
+ !qtConfValidateValue($$opt, $$val): \
+ return()
+
+ qtConfCommandlineSetInput($$opt, $$val)
+}
+
+
+defineTest(qtConfCommandline_addString) {
+ opt = $${1}
+ val = $${2}
+ isEmpty(val): val = $$qtConfGetNextCommandlineArg()
+
+ contains(val, "^-.*|[A-Z_]+=.*")|isEmpty(val) {
+ qtConfAddError("No value supplied to command line option '$$opt'.")
+ return()
+ }
+
+ !qtConfValidateValue($$opt, $$val): \
+ return()
+
+ !isEmpty($${currentConfig}.commandline.options.$${opt}.name): \
+ opt = $$eval($${currentConfig}.commandline.options.$${opt}.name)
+
+ config.input.$$opt += $$val
+ export(config.input.$$opt)
+}
+
+defineTest(qtConfParseCommandLine) {
+ customCalls =
+ for (cc, allConfigs) {
+ custom = $$eval($${cc}.commandline.custom)
+
+ !isEmpty(custom) {
+ customCall = qtConfCommandline_$$custom
+ !defined($$customCall, test): \
+ error("Custom command line callback '$$custom' is undefined.")
+ customCalls += $$customCall
+ }
+ }
+
+ for (ever) {
+ c = $$qtConfGetNextCommandlineArg()
+ isEmpty(c): break()
+
+ # handle options to turn on verbose logging
+ contains(c, "^-v")|contains(c, "^--?verbose") {
+ QMAKE_CONFIG_VERBOSE = true
+ export(QMAKE_CONFIG_VERBOSE)
+ next()
+ }
+ contains(c, "^-no-v")|contains(c, "^--?no-verbose") {
+ QMAKE_CONFIG_VERBOSE = false
+ export(QMAKE_CONFIG_VERBOSE)
+ next()
+ }
+
+ contains(c, "^--?recheck") {
+ QMAKE_CONFIG_CACHE_USE = positive
+ export(QMAKE_CONFIG_CACHE_USE)
+ next()
+ }
+ contains(c, "^--?recheck-all") {
+ QMAKE_CONFIG_CACHE_USE = none
+ export(QMAKE_CONFIG_CACHE_USE)
+ next()
+ }
+
+ didCustomCall = false
+ for (customCall, customCalls) {
+ $${customCall}($$c) {
+ didCustomCall = true
+ break()
+ }
+ }
+ $$didCustomCall: \
+ next()
+
+ contains(c, "([A-Z_]+)=(.*)") {
+ opt = $$replace(c, "^([A-Z_]+)=(.*)", "\\1")
+ val = $$replace(c, "^([A-Z_]+)=(.*)", "\\2")
+ for (cc, allConfigs) {
+ var = $$eval($${cc}.commandline.assignments.$${opt})
+ !isEmpty(var): \
+ break()
+ }
+ isEmpty(var) {
+ qtConfAddError("Assigning unknown variable '$$opt' on command line.")
+ return()
+ }
+ config.input.$$var = $$val
+ export(config.input.$$var)
+ next()
+ }
+
+ # parse out opt and val
+ contains(c, "^--?enable-(.*)") {
+ opt = $$replace(c, "^--?enable-(.*)", "\\1")
+ val = yes
+ } else: contains(c, "^--?(disable|no)-(.*)") {
+ opt = $$replace(c, "^--?(disable|no)-(.*)", "\\2")
+ val = no
+ } else: contains(c, "^--?qt-(.*)") {
+ opt = $$replace(c, "^--?qt-(.*)", "\\1")
+ val = qt
+ } else: contains(c, "^--?system-(.*)") {
+ opt = $$replace(c, "^--?system-(.*)", "\\1")
+ val = system
+ } else: contains(c, "^--?([^-].*)=(.*)") {
+ opt = $$replace(c, "^--?([^-].*)=(.*)", "\\1")
+ val = $$replace(c, "^--?([^-].*)=(.*)", "\\2")
+ } else: contains(c, "^--?([^-].*)") {
+ opt = $$replace(c, "^--?([^-].*)", "\\1")
+ val =
+ } else {
+ qtConfAddError("Invalid command line parameter '$$c'.")
+ return()
+ }
+
+ for (cc, allConfigs) {
+ type = $$eval($${cc}.commandline.options.$${opt})
+ isEmpty(type): \
+ type = $$eval($${cc}.commandline.options.$${opt}.type)
+ isEmpty(type) {
+ # no match in the regular options, try matching the prefixes
+ for (p, $${cc}.commandline.prefix._KEYS_) {
+ e = "^-$${p}(.*)"
+ contains(c, $$e) {
+ opt = $$eval($${cc}.commandline.prefix.$${p})
+ val = $$replace(c, $$e, "\\1")
+ type = "addString"
+ break()
+ }
+ }
+ }
+ !isEmpty(type) {
+ currentConfig = $$cc
+ break()
+ }
+ }
+ # handle builtin [-no]-feature-xxx
+ isEmpty(type):contains(opt, "feature-(.*)") {
+ opt ~= s,^feature-,,
+ found = false
+ for (cc, allConfigs) {
+ contains($${cc}.features._KEYS_, $$opt) {
+ found = true
+ break()
+ }
+ }
+ !$$found {
+ qtConfAddError("Enabling/Disabling unknown feature '$$opt'.")
+ return()
+ }
+ # this is a boolean enabling/disabling the corresponding feature
+ type = boolean
+ }
+
+ isEmpty(type) {
+ qtConfAddError("Unknown command line option '$$c'.")
+ return()
+ }
+
+ call = "qtConfCommandline_$${type}"
+ !defined($$call, test): \
+ error("Command line option '$$c' has unknown type '$$type'.")
+
+ # now that we have opt and value, process it
+ $${call}($$opt, $$val)
+ }
+}
+
+defineReplace(qtConfToolchainSupportsFlag) {
+ test_out_dir = $$shadowed($$QMAKE_CONFIG_TESTS_DIR)
+ test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&"
+
+ conftest = "int main() { return 0; }"
+ write_file("$$test_out_dir/conftest.cpp", conftest)|error()
+
+ qtRunLoggedCommand("$$test_cmd_base $$QMAKE_CXX $${1} -o conftest-out conftest.cpp"): \
+ return(true)
+ return(false)
+}
+
+defineTest(qtConfTest_compilerSupportsFlag) {
+ flag = $$eval($${1}.flag)
+
+ return($$qtConfToolchainSupportsFlag($$flag))
+}
+
+defineTest(qtConfTest_linkerSupportsFlag) {
+ flag = $$eval($${1}.flag)
+
+ use_gold_linker: \
+ LFLAGS = -fuse-ld=gold
+
+ return($$qtConfToolchainSupportsFlag($$LFLAGS "-Wl,$$flag"))
+}
+
+defineReplace(qtConfFindInPathList) {
+ for (dir, 2) {
+ exists("$$dir/$${1}"): \
+ return("$$dir/$${1}")
+ }
+ return()
+}
+
+defineReplace(qtConfFindInPath) {
+ ensurePathEnv()
+ return($$qtConfFindInPathList($$1, $$2 $$QMAKE_PATH_ENV))
+}
+
+defineReplace(qtConfPkgConfigEnv) {
+ env =
+ !isEmpty(PKG_CONFIG_SYSROOT_DIR): env = "$${SETENV_PFX}PKG_CONFIG_SYSROOT_DIR=$${PKG_CONFIG_SYSROOT_DIR}$${SETENV_SFX} "
+ !isEmpty(PKG_CONFIG_LIBDIR): env = "$$env$${SETENV_PFX}PKG_CONFIG_LIBDIR=$${PKG_CONFIG_LIBDIR}$${SETENV_SFX} "
+ return($$env)
+}
+
+defineReplace(qtConfPkgConfig) {
+ host = $$1
+ isEmpty(host): host = false
+
+ $$host {
+ pkg_config = $$qtConfFindInPath("pkg-config")
+ } else {
+ pkg_config = "$$qtConfPkgConfigEnv()$$PKG_CONFIG"
+ }
+
+ return($$pkg_config)
+}
+
+defineTest(qtConfPkgConfigPackageExists) {
+ isEmpty(1)|isEmpty(2): \
+ return(false)
+
+ !qtRunLoggedCommand("$${1} --exists --silence-errors $${2}"): \
+ return(false)
+
+ return(true)
+}
+
+defineReplace(qtConfPrepareArgs) {
+ arglist = $$split(1)
+ args =
+ for (a, arglist): \
+ args += $$system_quote($$a)
+ return($$args)
+}
+
+defineTest(qtConfSetupLibraries) {
+ for (l, $${currentConfig}.libraries._KEYS_) {
+ lpfx = $${currentConfig}.libraries.$${l}
+ # 'export' may be omitted, in which case it falls back to the library's name
+ !defined($${lpfx}.export, var) {
+ $${lpfx}.export = $$l
+ export($${lpfx}.export)
+ }
+ isEmpty($${lpfx}.sources._KEYS_): \
+ error("Library $$l defines no sources")
+ for (s, $${lpfx}.sources._KEYS_) {
+ spfx = $${lpfx}.sources.$${s}
+ # link back to parent object
+ $${spfx}.library = $$l
+ export($${spfx}.library)
+ # a plain string is transformed into a structure
+ isEmpty($${spfx}._KEYS_) {
+ $${spfx}.libs = $$eval($${spfx})
+ export($${spfx}.libs)
+ }
+ # if the type is missing (implicitly in the case of plain strings), assume 'inline'
+ isEmpty($${spfx}.type) {
+ $${spfx}.type = inline
+ export($${spfx}.type)
+ }
+ }
+ }
+
+ # reverse mapping for assignments on command line.
+ for (a, $${currentConfig}.commandline.assignments._KEYS_) {
+ apfx = $${currentConfig}.commandline.assignments.$${a}
+ ra = config.commandline.rev_assignments.$$eval($$apfx)
+ $$ra = $$a
+ export($$ra)
+ }
+}
+
+# the library is specified inline in a 'libs' field.
+# overrides from the command line are accepted.
+defineTest(qtConfLibrary_inline) {
+ lib = $$eval($${1}.library)
+ !defined($${1}.libs, var): \
+ error("'inline' source in library '$$lib' does not specify 'libs'.")
+
+ # direct libs. overwrites inline libs.
+ defined(config.input.$${lib}.libs, var) {
+ $${1}.libs = $$eval(config.input.$${lib}.libs)
+ export($${1}.libs)
+ }
+
+ # build-specific direct libs. overwrites inline libs.
+ vars =
+ any = false
+ all = true
+ for (b, $${1}.builds._KEYS_) {
+ iv = $${lib}.libs.$${b}
+ vars += $$eval(config.commandline.rev_assignments.$${iv})
+ defined(config.input.$${iv}, var) {
+ $${1}.builds.$${b}.libs = $$eval(config.input.$${iv})
+ export($${1}.builds.$${b}.libs)
+ any = true
+ } else {
+ all = false
+ }
+ }
+ $$any:!$$all {
+ qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.")
+ return(false)
+ }
+
+ # prefix. prepends to (possibly overwritten) inline libs.
+ prefix = $$val_escape(config.input.$${lib}.prefix)
+ !isEmpty(prefix) {
+ $${1}.includedir = $$prefix/include
+ export($${1}.includedir)
+ $${1}.cflags = -I$$prefix/include
+ export($${1}.cflags)
+ $${1}.libs = "-L$$prefix/lib $$eval($${1}.libs)"
+ export($${1}.libs)
+ }
+
+ return(true)
+}
+
+# the library is provided by the qmake spec.
+# this source type cannot fail.
+defineTest(qtConfLibrary_makeSpec) {
+ spec = $$eval($${1}.spec)
+ isEmpty(spec): \
+ error("makeSpec source in library '$$eval($${1}.library)' does not specify 'spec'.")
+
+ $${1}.includedir = "$$val_escape(QMAKE_INCDIR_$$spec)"
+ export($${1}.includedir)
+ $${1}.cflags = "$$val_escape(QMAKE_CFLAGS_$$spec)"
+ export($${1}.cflags)
+ libs =
+ for (l, QMAKE_LIBDIR_$$spec): \
+ libs += -L$$l
+ libs += $$eval(QMAKE_LIBS_$$spec)
+ $${1}.libs = "$$val_escape(libs)"
+ export($${1}.libs)
+
+ # the library definition is always in scope, so no point in exporting it.
+ $${1}.export = false
+ export($${1}.export)
+
+ return(true)
+}
+
+# the library is found via pkg-config.
+defineTest(qtConfLibrary_pkgConfig) {
+ pkg_config = $$qtConfPkgConfig($$eval($${1}.host))
+ isEmpty(pkg_config): \
+ return(false)
+ args = $$qtConfPrepareArgs($$eval($${1}.args))
+
+ !qtConfPkgConfigPackageExists($$pkg_config, $$args): \
+ return(false)
+
+ qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false)
+ qtRunLoggedCommand("$$pkg_config --libs-only-L --libs-only-l $$args", $${1}.libs)|return(false)
+ qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false)
+ qtRunLoggedCommand("$$pkg_config --cflags-only-I $$args", includes)|return(false)
+ eval(includes = $$includes)
+ includes ~= s/^-I//g
+ $${1}.includedir = "$$val_escape(includes)"
+ version ~= s/[^0-9.].*$//
+ $${1}.version = $$first(version)
+ export($${1}.libs)
+ export($${1}.cflags)
+ export($${1}.includedir)
+ export($${1}.version)
+ return(true)
+}
+
+defineTest(qtConfTest_getPkgConfigVariable) {
+ pkg_config = $$qtConfPkgConfig($$eval($${1}.host))
+ isEmpty(pkg_config): \
+ return(false)
+ args = $$qtConfPrepareArgs($$eval($${1}.pkg-config-args))
+
+ !qtConfPkgConfigPackageExists($$pkg_config, $$args): \
+ return(false)
+
+ variable = $$eval($${1}.pkg-config-variable)
+ qtRunLoggedCommand("$$pkg_config --variable=$$variable $$args", $${1}.value)|return(false)
+ export($${1}.value)
+ $${1}.cache += value
+ export($${1}.cache)
+ return(true)
+}
+
+defineReplace(qtConfLibraryArgs) {
+ qmake_args =
+ libs = $$eval($${1}.libs)
+ !isEmpty(libs): \
+ qmake_args += $$system_quote(LIBS += $$libs)
+ for (b, $${1}.builds._KEYS_): \
+ qmake_args += $$system_quote(LIBS_$$upper($$b) += $$eval($${1}.builds.$${b}))
+ includedir = $$eval($${1}.includedir)
+ !isEmpty(includedir): \
+ qmake_args += $$system_quote(INCLUDEPATH *= $$includedir)
+ return($$qmake_args)
+}
+
+defineReplace(qtConfGetHexVersion) {
+ version = $$split(1, '.')
+ number =
+ for(i, 0..2) {
+ n = $$member(version, $$i)
+ isEmpty(n): n = 0
+ number += $$format_number($$n, obase=16 zeropad width=2)
+ }
+ number = "0x$$join(number)"
+ return($$number)
+}
+
+defineTest(qtConfExportLibrary) {
+ isEmpty(2): return()
+ !$$qtConfEvaluate($$eval($${1}.export)): return()
+
+ output = privatePro
+
+ eval(libs = $$eval($${1}.libs))
+ eval(cflags = $$eval($${1}.cflags))
+ eval(includes = $$eval($${1}.includedir))
+ version = $$eval($${1}.version)
+
+ NAME = $$upper($$2)
+ !isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
+ for (b, $${1}.builds._KEYS_): \
+ qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \
+ $$eval($${1}.builds.$${b}))
+ !isEmpty(cflags): qtConfOutputVar(assign, $$output, QMAKE_CFLAGS_$$NAME, $$cflags)
+ !isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
+ !isEmpty(version) {
+ qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION, $$version)
+ qtConfOutputSetDefine("privateHeader", "QT_LIBRARY_VERSION_$${2}", $$qtConfGetHexVersion($$version))
+ version = $$split(version, '.')
+ qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MAJOR, $$member(version, 0))
+ qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MINOR, $$member(version, 1))
+ qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_PATCH, $$member(version, 2))
+ }
+ !isEmpty($${currentConfig}.module): \
+ qtConfExtendVar($$output, "QT.$${currentModule}_private.libraries", $$2)
+}
+
+defineTest(qtConfHandleLibrary) {
+ lpfx = $${currentConfig}.libraries.$$1
+ defined($${lpfx}.result, var): return()
+
+ qtConfEnsureTestTypeDeps("library")
+
+ qtConfLoadResult($${lpfx}, $$1) {
+ $$eval($${lpfx}.result): \
+ qtConfExportLibrary($${lpfx}.sources.$$eval($${lpfx}.source), $$eval($${lpfx}.export))
+ return()
+ }
+
+ qtLogTestIntro($${lpfx})
+ msg = "looking for library $${1}"
+ write_file($$QMAKE_CONFIG_LOG, msg, append)
+
+ result = false
+ for (s, $${lpfx}.sources._KEYS_) {
+ qtLog("Trying source $$s of library $${1}.")
+ spfx = $${lpfx}.sources.$${s}
+
+ t = $$eval($${spfx}.type)
+ call = qtConfLibrary_$$t
+ !defined($$call, test): \
+ error("Library $${1} source $${s} has unknown type '$$t'")
+
+ !$$qtConfEvaluate($$eval($${spfx}.condition)) {
+ qtLog("Source $$s of library $$1 failed condition.")
+ next()
+ }
+
+ !$${call}($$spfx) {
+ qtLog("Source $$s of library $$1 produced no result.")
+ next()
+ }
+
+ # if the library defines a test, use it to verify the source.
+ !isEmpty($${lpfx}.test) {
+ $${lpfx}.literal_args = $$qtConfLibraryArgs($$spfx)
+ $${lpfx}.host = $$eval($${spfx}.host)
+ !qtConfTest_compile($$lpfx) {
+ qtLog("Source $$s of library $$1 failed verification.")
+ next()
+ }
+ }
+
+ $${lpfx}.cache += source
+ for (v, $$list(libs includes cflags version export)): \
+ $${lpfx}.cache += sources.$${s}.$${v}
+ for (b, $${spfx}.builds._KEYS_): \
+ $${lpfx}.cache += sources.$${s}.builds.$${b}
+
+ # immediately output the library as well.
+ qtConfExportLibrary($${spfx}, $$eval($${lpfx}.export))
+
+ $${lpfx}.source = $$s
+ export($${lpfx}.source)
+ result = true
+ break()
+ }
+
+ qtLogTestResult($${lpfx}, $$result)
+
+ $${lpfx}.result = $$result
+ export($${lpfx}.result)
+ qtConfSaveResult($${lpfx}, $$1)
+}
+
+# This is a fake test type for the test dependency system.
+defineTest(qtConfTest_library) {
+ error("The test type 'library' may not be instantiated.")
+}
+
+defineTest(qtConfTestPrepare_compile) {
+ for (u, $$list($$eval($${1}.use))) {
+ !contains($${currentConfig}.libraries._KEYS_, $$u): \
+ error("Test $$1 tries to use undeclared library '$$u'")
+ qtConfHandleLibrary($$u)
+ lpfx = $${currentConfig}.libraries.$${u}
+ isEmpty($${lpfx}.source): \
+ return(false)
+ $${1}.literal_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source))
+ }
+ export($${1}.literal_args)
+ return(true)
+}
+
+defineTest(qtConfTest_compile) {
+ test = $$eval($${1}.test)
+ host = $$eval($${1}.host)
+ isEmpty(host): host = false
+
+ test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test
+ test_out_dir = $$shadowed($$test_dir)
+ !isEmpty($${1}.pro): \
+ test_dir = $$test_dir/$$eval($${1}.pro)
+ test_cmd_base = "cd $$system_quote($$system_path($$test_out_dir)) &&"
+
+ qmake_args = $$qtConfPkgConfigEnv()$$system_quote($$system_path($$QMAKE_QMAKE))
+ !isEmpty(QMAKE_QTCONF): \
+ qmake_args += -qtconf $$system_quote($$QMAKE_QTCONF)
+
+ # Disable qmake features which are typically counterproductive for tests
+ qmake_args += "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\""
+
+ # allow tests to behave differently depending on the type of library
+ # being built (shared/static). e.g. see config.tests/unix/icu
+ shared: \
+ qmake_configs = "shared"
+ else: \
+ qmake_configs = "static"
+
+ use_gold_linker: \
+ qmake_configs += "use_gold_linker"
+
+ # add console to the CONFIG variable when running the tests, so that they
+ # can work with a regular main() entry point on Windows.
+ qmake_configs += "console"
+
+ qmake_args += "\"CONFIG += $$qmake_configs\""
+
+ !$$host {
+ # On WinRT we need to change the entry point as we cannot create windows
+ # applications
+ winrt: \
+ qmake_args += " \"QMAKE_LFLAGS += /ENTRY:main\""
+
+ # add compiler flags, these are set for the target and should not be applied to host tests
+ !isEmpty(EXTRA_DEFINES): \
+ qmake_args += $$system_quote(DEFINES += $$val_escape(EXTRA_DEFINES))
+ !isEmpty(EXTRA_LIBDIR) \
+ qmake_args += $$system_quote(QMAKE_LIBDIR += $$val_escape(EXTRA_LIBDIR))
+ !isEmpty(EXTRA_FRAMEWORKPATH) \
+ qmake_args += $$system_quote(QMAKE_FRAMEWORKPATH += $$val_escape(EXTRA_FRAMEWORKPATH))
+ !isEmpty(EXTRA_INCLUDEPATH): \
+ qmake_args += $$system_quote(INCLUDEPATH += $$val_escape(EXTRA_INCLUDEPATH))
+ qmake_args += $$EXTRA_QMAKE_ARGS
+ }
+
+ # Clean up after previous run
+ exists($$test_out_dir/Makefile): \
+ QMAKE_MAKE = "$$QMAKE_MAKE clean && $$QMAKE_MAKE"
+
+ mkpath($$test_out_dir)|error()
+
+ # add possible command line args
+ qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) $$eval($${1}.literal_args)
+
+ qtRunLoggedCommand("$$test_cmd_base $$qmake_args $$system_quote($$test_dir)") {
+ qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE"): \
+ return(true)
+ }
+
+ return(false)
+}
+
+defineTest(qtConfTest_verifySpec) {
+ qtConfTest_compile($$1): return(true)
+ qtConfAddError("Cannot compile a minimal program. The toolchain or QMakeSpec is broken.", log)
+ qtConfPrintReport()
+ error()
+}
+
+defineTest(qtConfTest_files) {
+ for(i, $${1}.files._KEYS_) {
+ f = $$eval($${1}.files.$${i})
+ qtLog("Searching for file $${f}.")
+ contains(f, ".*\.h") {
+ file = $$qtConfFindInPathList($$f, $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS)
+ } else: contains(f, ".*\.(lib|so|a)") {
+ file = $$qtConfFindInPathList($$f, $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS)
+ } else {
+ # assume we're looking for an executable
+ file = $$qtConfFindInPath($$f, $$EXTRA_PATH)
+ }
+ isEmpty(file) {
+ qtLog(" Not found.");
+ return(false)
+ }
+ qtLog(" Found at $${file}.")
+ }
+ return(true)
+}
+
+defineTest(logn) {
+ log("$${1}$$escape_expand(\\n)")
+}
+
+defineTest(qtLogTestIntro) {
+ label = $$eval($${1}.label)
+ isEmpty(label): return()
+
+ msg = "Checking for $${label}... "
+ log($$msg)
+ $$QMAKE_CONFIG_VERBOSE: log("$$escape_expand(\\n)")
+ write_file($$QMAKE_CONFIG_LOG, msg, append)
+}
+
+defineTest(qtLogTestResult) {
+ isEmpty($${1}.label): return()
+
+ !isEmpty($${1}.log) {
+ field = $$eval($${1}.log)
+ log_msg = $$eval($${1}.$$field)
+ msg = "test $$1 gave result $$log_msg"
+ } else: $${2} {
+ log_msg = yes
+ msg = "test $$1 succeeded"
+ } else {
+ log_msg = no
+ msg = "test $$1 FAILED"
+ }
+ $$QMAKE_CONFIG_VERBOSE: log_msg = $$msg
+ logn("$$log_msg")
+ write_file($$QMAKE_CONFIG_LOG, msg, append)
+}
+
+defineTest(qtConfSaveResult) {
+ equals($${1}.cache, -): \
+ return()
+ keys = result $$eval($${1}.cache)
+ cont = "cache.$${2}._KEYS_ = $$keys"
+ for (k, keys): \
+ cont += "cache.$${2}.$${k} = $$val_escape($${1}.$${k})"
+ write_file($$QMAKE_CONFIG_CACHE, cont, append)|error()
+}
+
+defineTest(qtConfLoadResult) {
+ equals(QMAKE_CONFIG_CACHE_USE, none): \
+ return(false)
+ isEmpty(cache.$${2}._KEYS_): \
+ return(false)
+ equals(QMAKE_CONFIG_CACHE_USE, positive):!$$eval(cache.$${2}.result): \
+ return(false)
+ for (k, cache.$${2}._KEYS_) {
+ $${1}.$${k} = $$eval(cache.$${2}.$${k})
+ export($${1}.$${k})
+ }
+ return(true)
+}
+
+defineTest(qtConfIsBoolean) {
+ equals(1, "true")|equals(1, "false"): \
+ return(true)
+ return(false)
+}
+
+defineTest(qtConfSetupTestTypeDeps) {
+ for (tt, $${currentConfig}.testTypeDependencies._KEYS_) {
+ !defined(qtConfTest_$${tt}, test): \
+ error("Declaring dependency for undefined test type '$$tt'.")
+ for (f, $${currentConfig}.testTypeDependencies.$${tt}._KEYS_) {
+ feature = $$eval($${currentConfig}.testTypeDependencies.$${tt}.$${f})
+ isEmpty($${currentConfig}.features.$${feature}._KEYS_): \
+ error("Test type '$$tt' depends on undefined feature '$$feature'.")
+ }
+ }
+ # Test type aliasing means that one test type's callback is called by
+ # another test type's callback. Put differently, one callback forwards
+ # the call to another one. The former representation is more natural
+ # (and concise) to write, while the latter is more efficient to process.
+ # Hence, this function inverts the mapping.
+ for (tt, $${currentConfig}.testTypeAliases._KEYS_) {
+ !defined(qtConfTest_$${tt}, test): \
+ error("Aliasing undefined test type '$$tt'.")
+ for (tta, $${currentConfig}.testTypeAliases.$${tt}._KEYS_) {
+ type = $$eval($${currentConfig}.testTypeAliases.$${tt}.$${tta})
+ !defined(qtConfTest_$${type}, test): \
+ error("Aliasing '$$tt' to undefined test type '$$type'.")
+ $${currentConfig}.testTypeForwards.$${type} += $$tt
+ export($${currentConfig}.testTypeForwards.$${type})
+ }
+ }
+}
+
+defineTest(qtConfEnsureTestTypeDeps) {
+ depsn = $${currentConfig}.testTypeDependencies.$${1}._KEYS_
+ !isEmpty($$depsn) {
+ for (dep, $$depsn) {
+ feature = $$eval($${currentConfig}.testTypeDependencies.$${1}.$${dep})
+ !qtConfCheckFeature($$feature): \
+ error("Test type '$$1' depends on non-emitted feature $${feature}.")
+ }
+ $$depsn =
+ export($$depsn)
+ }
+ fwdsn = $${currentConfig}.testTypeForwards.$${1}
+ !isEmpty($$fwdsn) {
+ for (fwd, $$fwdsn): \
+ qtConfEnsureTestTypeDeps($$fwd)
+ $$fwdsn =
+ export($$fwdsn)
+ }
+}
+
+defineTest(qtRunSingleTest) {
+ tpfx = $${currentConfig}.tests.$${1}
+ defined($${tpfx}.result, var): \
+ return()
+
+ type = $$eval($${tpfx}.type)
+ call = "qtConfTest_$$type"
+ !defined($$call, test): \
+ error("Configure test $${1} refers to nonexistent type $$type")
+
+ qtConfEnsureTestTypeDeps($$type)
+
+ preCall = "qtConfTestPrepare_$$type"
+ defined($$preCall, test):!$${preCall}($${tpfx}) {
+ $${tpfx}.result = false
+ export($${tpfx}.result)
+ # don't cache the result; the pre-deps have their own caches.
+ return()
+ }
+
+ # note: we do this only after resolving the dependencies and the
+ # preparation (which may resolve libraries), so that caching does
+ # not alter the execution order (and thus the output).
+ qtConfLoadResult($${tpfx}, $$1): \
+ return()
+
+ qtLogTestIntro($${tpfx})
+ msg = "executing config test $${1}"
+ write_file($$QMAKE_CONFIG_LOG, msg, append)
+
+ result = false
+ $${call}($${tpfx}): result = true
+
+ qtLogTestResult($${tpfx}, $$result)
+
+ $${tpfx}.result = $$result
+ export($${tpfx}.result)
+ qtConfSaveResult($${tpfx}, $$1)
+}
+
+defineReplace(qtConfEvaluate) {
+ isEmpty(1): return(true)
+
+ 1 ~= s/$$escape_expand(\\t)/ /g
+ 1 ~= s/$$escape_expand(\\r)//g
+ 1 ~= s/$$escape_expand(\\n) */ /g
+ expr = $${1}
+ expr ~= s/&&/ && /g
+ expr ~= s/\|\|/ || /g
+ expr ~= s/!/ ! /g
+ expr ~= s/\\(/ ( /g
+ expr ~= s/\\)/ ) /g
+ expr ~= s/ *== */==/g
+ expr ~= s/ *! = */!=/g
+ expr_list = $$eval($$list($$expr))
+ return($$qtConfEvaluateSubExpression($${1}, $$expr_list, 0))
+}
+
+defineReplace(qtConfEvaluateSingleExpression) {
+ e = $${2}
+
+ equals(e, true) {
+ result = true
+ } else: equals(e, false) {
+ result = false
+ } else: contains(e, "^[0-9]+$") {
+ # numbers
+ result = $$e
+ } else: contains(e, "^'.*'$") {
+ # quoted literals
+ result = $$replace(e, "^'(.*)'$", "\\1")
+ } else: contains(e, "^tests\..*") {
+ !qt_conf_tests_allowed: \
+ error("Expression '$${1}' refers to a test, which is not allowed at this stage of configuring.")
+ test = $$section(e, ".", 1, 1)
+ var = $$section(e, ".", 2, -1)
+ isEmpty(var): \
+ var = result
+ !contains($${currentConfig}.tests._KEYS_, $$test): \
+ error("Unknown test object $${test} in expression '$${1}'.")
+ qtRunSingleTest($$test)
+ result = $$eval($${currentConfig}.tests.$${test}.$${var})
+ } else: contains(e, "^libs\..*") {
+ !qt_conf_tests_allowed: \
+ error("Expression '$${1}' refers to a library, which is not allowed at this stage of configuring.")
+ lib = $$section(e, ".", 1, 1)
+ var = $$section(e, ".", 2, -1)
+ isEmpty(var): \
+ var = result
+ !contains($${currentConfig}.libraries._KEYS_, $$lib): \
+ error("Unknown library object $${lib} in expression '$${1}'.")
+ qtConfHandleLibrary($$lib)
+ !defined($${currentConfig}.libraries.$${lib}.$${var}, var): \
+ var = sources.$$eval($${currentConfig}.libraries.$${lib}.$${source}).$$var
+ result = $$eval($${currentConfig}.libraries.$${lib}.$${var})
+ } else: contains(e, "^features\..*") {
+ feature = $$section(e, ".", 1, 1)
+ var = $$section(e, ".", 2, -1)
+ isEmpty(var): \
+ var = available
+ !contains($${currentConfig}.features._KEYS_, $$feature) {
+ # this is basically a copy of what qtConfig() in qt_build_config.prf
+ # does, but we produce a nicer error message.
+ for (module, QMAKE_CONFIG_DEPS) {
+ contains(QT.$${module}.enabled_features, $$feature): \
+ result = true
+ else: contains(QT.$${module}.disabled_features, $$feature): \
+ result = false
+ else: \
+ next()
+ !equals(var, available): \
+ error("Expression '$$1' is accessing field '$$var' of non-local feature $${feature}.")
+ return($$result)
+ }
+ error("Unknown feature object $${feature} in expression '$${1}'.")
+ }
+ !qtConfCheckFeature($$feature): \
+ error("Expression '$$1' is accessing non-emitted feature $${feature}.")
+ result = $$eval($${currentConfig}.features.$${feature}.$${var})
+ } else: contains(e, "^config\..*") {
+ var = $$replace(e, "^config\.", "")
+ result = false
+ contains(CONFIG, $$var): result = true
+ } else: contains(e, "^arch\..*") {
+ var = $$replace(e, "^arch\.", "")
+ result = false
+ isEmpty(QT_ARCH): \
+ qtConfCheckFeature(architecture)
+ contains(QT_ARCH, $$var): result = true
+ } else: contains(e, "^input\..*") {
+ result = $$eval(config.$$e)
+ } else: contains(e, "^var\..*") {
+ var = $$replace(e, "^var\.", "")
+ result = $$eval($$var)
+ } else: contains(e, "^call\..*") {
+ call = $$replace(e, "^call\.", "qtConfFunc_")
+ !defined($$call, replace): \
+ error("Call $$call referenced in expression '$${1}' does not exist")
+ eval(result = \$\$"$$call"())
+ } else {
+ error("Unrecognized token $$e in expression '$${1}'")
+ }
+ return($$result)
+}
+
+defineReplace(qtConfEvaluateSubExpression) {
+ expr_list = $${2}
+ result = true
+ negate = false
+ runSubExpression = false
+ nesting_level = 0
+ for (n, $${3}..$$num_add($$size(expr_list), -1)) {
+ e = $$member(expr_list, $$n)
+ $$runSubExpression {
+ runSubExpression = false
+ result = $$qtConfEvaluateSubExpression($${1}, $$expr_list, $$n)
+ } else: isEqual(e, "(") {
+ isEqual(nesting_level, 0): runSubExpression = true
+ nesting_level = $$num_add($$nesting_level, 1)
+ next()
+ } else: isEqual(e, ")") {
+ nesting_level = $$num_add($$nesting_level, -1)
+ lessThan(nesting_level, 0): break()
+ next()
+ } else: greaterThan(nesting_level, 0) {
+ next()
+ } else: isEqual(e, "!") {
+ negate = true
+ next()
+ } else: isEqual(e, "&&") {
+ !qtConfIsBoolean($$result): \
+ error("Left hand side of && is non-boolean value '$$result' in expression '$${1}'")
+ !$$result: return(false)
+ } else: isEqual(e, "||") {
+ !qtConfIsBoolean($$result): \
+ error("Left hand side of || is non-boolean value '$$result' in expression '$${1}'")
+ $$result: return(true)
+ } else {
+ contains(e, ".*==.*") {
+ lhs = $$qtConfEvaluateSingleExpression($${1}, $$replace(e, "==.*", ""))
+ rhs = $$qtConfEvaluateSingleExpression($${1}, $$replace(e, ".*==", ""))
+ result = false
+ equals(lhs, $$rhs): result = true
+ } else: contains(e, ".*!=.*") {
+ lhs = $$qtConfEvaluateSingleExpression($${1}, $$replace(e, "!=.*", ""))
+ rhs = $$qtConfEvaluateSingleExpression($${1}, $$replace(e, ".*!=", ""))
+ result = false
+ !equals(lhs, $$rhs): result = true
+ } else {
+ result = $$qtConfEvaluateSingleExpression($${1}, $$e)
+ }
+ }
+ $$negate {
+ !qtConfIsBoolean($$result): \
+ error("Attempting to negate a non-boolean value '$$result' in expression '$${1}'")
+ $$result: \
+ result = false
+ else: \
+ result = true
+ negate = false
+ }
+ }
+ return($$result)
+}
+
+defineReplace(qtIsFeatureEnabled) {
+ enable = $$eval($${currentConfig}.features.$${1}.enable)
+ !isEmpty(enable) {
+ $$qtConfEvaluate($$enable): \
+ return(true)
+ } else {
+ equals(config.input.$${1}, "yes"): \
+ return(true)
+ }
+
+ return(false)
+}
+
+defineReplace(qtIsFeatureDisabled) {
+ disable = $$eval($${currentConfig}.features.$${1}.disable)
+ !isEmpty(disable) {
+ $$qtConfEvaluate($$disable): \
+ return(true)
+ } else {
+ equals(config.input.$${1}, "no"): \
+ return(true)
+ }
+
+ return(false)
+}
+
+defineReplace(qtConfCheckSingleCondition) {
+ result = $$qtConfEvaluate($$2)
+
+ !qtConfIsBoolean($$result): \
+ error("Evaluation of condition '$$2' yielded non-boolean value '$$result' in feature '$${1}'.")
+
+ !$$result {
+ $${3} {
+ qtConfAddError("Feature '$${1}' was enabled, but the pre-condition '$$2' failed.", log)
+ $$result = true
+ }
+ }
+ return($$result)
+}
+
+defineTest(qtConfCheckFeature) {
+ fpfx = $${currentConfig}.features.$${1}
+
+ available = $$eval($${fpfx}.available)
+ !isEmpty(available): return(true)
+
+ # skip features that will not get emitted anyway
+ emitIf = $$qtConfEvaluate($$eval($${fpfx}.emitIf))
+ enabled = $$qtIsFeatureEnabled($$1)
+ disabled = $$qtIsFeatureDisabled($$1)
+
+ !$$emitIf {
+ $$enabled|$$disabled: \
+ qtConfAddWarning("Feature $${1} is insignificant in this configuration, ignoring related command line option(s).")
+ return(false)
+ }
+
+ $$disabled {
+ result = false
+ } else: !$$enabled:!$$qtConfEvaluate($$eval($${fpfx}.autoDetect)) {
+ # feature not auto-detected and not explicitly enabled
+ result = false
+ } else {
+ condition = $$eval($${fpfx}.condition)
+ !isEmpty(condition) {
+ result = $$qtConfCheckSingleCondition($$1, $$condition, $$enabled)
+ } else {
+ result = true
+ # check whether we have an array of conditions
+ for (i, $${fpfx}.condition._KEYS_) {
+ condition = $$eval($${fpfx}.condition.$$i)
+ result = $$qtConfCheckSingleCondition($$1, $$condition, $$enabled)
+ !$$result: break()
+ }
+ }
+ }
+ $${fpfx}.available = $$result
+ export($${fpfx}.available)
+
+ for (i, $${currentConfig}.features.$${feature}.output._KEYS_): \
+ qtConfProcessOneOutput($$feature, $$i)
+
+ return(true)
+}
+
+
+defineTest(qtConfProcessFeatures) {
+ for (feature, $${currentConfig}.features._KEYS_): \
+ qtConfCheckFeature($$feature)
+}
+
+#
+# reporting
+#
+
+QT_CONF_REPORT_PADDING = "........................................"
+
+defineTest(qtConfReportPadded) {
+ pad = $$num_add($$str_size($$QT_CONF_REPORT_PADDING), -$$str_size($${1}))
+ lessThan(pad, 0): pad = 0
+ str = "$$1 $$str_member($$QT_CONF_REPORT_PADDING, 0, $$pad)"
+
+ qtConfAddReport("$$str $${2}")
+}
+
+defineReplace(qtConfCollectFeatures) {
+ l =
+ for (feature, $$list($${1})) {
+ $$eval($${currentConfig}.features.$${feature}.available): \
+ l += $$eval($${currentConfig}.features.$${feature}.label)
+ }
+
+ isEmpty(l): return("<none>")
+ return($$join(l, ' '))
+}
+
+defineTest(qtConfReport_featureList) {
+ qtConfReportPadded($${1}, $$qtConfCollectFeatures($${2}))
+}
+
+defineReplace(qtConfFindFirstAvailableFeature) {
+ for (feature, $$list($${1})) {
+ isEmpty($${currentConfig}.features.$${feature}._KEYS_): \
+ error("Asking for a report on undefined feature $${2}.")
+ $$eval($${currentConfig}.features.$${feature}.available): \
+ return($$eval($${currentConfig}.features.$${feature}.label))
+ }
+
+ return("<none>")
+}
+
+defineTest(qtConfReport_firstAvailableFeature) {
+ qtConfReportPadded($${1}, $$qtConfFindFirstAvailableFeature($${2}))
+}
+
+defineTest(qtConfReport_feature) {
+ !contains($${currentConfig}.features._KEYS_, $$2): \
+ error("Asking for a report on undefined feature $${2}.")
+
+ # hide report for not emitted features
+ isEmpty($${currentConfig}.features.$${2}.available): \
+ return()
+
+ $$eval($${currentConfig}.features.$${2}.available) {
+ result = "yes"
+ !isEmpty(3): result = "$${3}"
+ } else {
+ result = "no"
+ !isEmpty(4): result = "$${4}"
+ }
+
+ text = $$eval($${currentConfig}.features.$${2}.label)
+
+ qtConfReportPadded($${1}$$text, $$result)
+}
+
+defineTest(qtConfReport_note) {
+ qtConfAddNote($${1})
+}
+
+defineTest(qtConfReport_warning) {
+ qtConfAddWarning($${1})
+}
+
+defineTest(qtConfReport_error) {
+ qtConfAddError($${1}, log)
+}
+
+defineTest(qtConfCreateReportRecurse) {
+ equals(2, false) {
+ indent = ""
+ recurse = false
+ } else {
+ indent = $${2}
+ recurse = true
+ }
+
+ keys = $$eval($${1}._KEYS_)
+ for (n, keys) {
+ entry = $${1}.$$n
+ subKeys = $$eval($${entry}._KEYS_)
+ contains(subKeys, condition) {
+ condition = $$eval($${entry}.condition)
+ r = $$qtConfEvaluate($$condition)
+ !qtConfIsBoolean($$r): \
+ error("Evaluation of condition '$$condition' in report entry $${entry} yielded non-boolean value '$$r'.")
+ !$$r: next()
+ }
+ contains(subKeys, "section") {
+ !$$recurse: \
+ error("Report type 'section' is not allowed in '$$1'.")
+ section = $$eval($${entry}.section)
+ qtConfAddReport("$$indent$$section:")
+ qtConfCreateReportRecurse("$${entry}.entries", "$$indent ")
+ } else: !isEmpty($${entry}) {
+ feature = $$eval($${entry})
+ qtConfReport_feature($$indent, $$feature)
+ } else {
+ text = $$eval($${entry}.message)
+ isEmpty($${entry}.type): \
+ error("Report entry $${entry} doesn't define a type.")
+ r = "qtConfReport_$$eval($${entry}.type)"
+ !defined($$r, test): \
+ error("Undefined report type $$eval($${entry}.type) used in report entry $${entry}.")
+ args = $$eval($${entry}.args)
+ $${r}($$indent$${text}, $$args)
+ }
+ }
+}
+
+defineTest(qtConfProcessEarlyChecks) {
+ qtConfCreateReportRecurse($${currentConfig}.earlyReport, false)
+}
+
+defineTest(qtConfCreateReport) {
+ qtConfCreateReportRecurse($${currentConfig}.report, false)
+}
+
+defineTest(qtConfCreateSummary) {
+ qtConfCreateReportRecurse($${currentConfig}.summary, "")
+}
+
+defineTest(qtConfPrintReport) {
+ for (n, QT_CONFIGURE_REPORT): \
+ logn($$n)
+ logn()
+
+ for (n, QT_CONFIGURE_NOTES) {
+ logn($$n)
+ logn()
+ }
+
+ for (w, QT_CONFIGURE_WARNINGS) {
+ logn($$w)
+ logn()
+ }
+
+ !isEmpty(QT_CONFIGURE_ERRORS) {
+ for (e, QT_CONFIGURE_ERRORS) {
+ logn($$e)
+ logn()
+ }
+ mention_config_log:!$$QMAKE_CONFIG_VERBOSE {
+ logn("Check config.log for details.")
+ logn()
+ }
+
+ !equals(config.input.continue, yes): \
+ error()
+ }
+}
+
+defineTest(qtConfCheckErrors) {
+ !isEmpty(QT_CONFIGURE_ERRORS):!equals(config.input.continue, yes): \
+ qtConfPrintReport()
+}
+
+#
+# output generation
+#
+
+# qtConfOutputVar(modifier, output, name, value)
+defineTest(qtConfOutputVar) {
+ modifier = $$1
+ output = $$2
+ name = $$3
+ value = $$val_escape(4)
+
+ defined($${currentConfig}.output.$${output}.assign.$${name}, var): \
+ error("Trying to overwrite assigned variable '$$name' in '$$output' using modifier '$$modifier'.")
+
+ equals(modifier, assign) {
+ !isEmpty($${currentConfig}.output.$${output}.append.$${name})|!isEmpty($${currentConfig}.output.$${output}.remove.$${name}): \
+ error("Trying to assign variable '$$name' in '$$output', which has already appended or removed parts.")
+ $${currentConfig}.output.$${output}.assign.$${name} = $$value
+ } else: equals(modifier, append) {
+ contains($${currentConfig}.output.$${output}.remove.$${name}, $$value): \
+ error("Trying to append removed '$$value' to variable '$$name' in '$$output'.")
+ $${currentConfig}.output.$${output}.append.$${name} += $$value
+ } else: equals(modifier, remove) {
+ contains($${currentConfig}.output.$${output}.append.$${name}, $$value): \
+ error("Trying to remove appended '$$value' to variable '$$name' in '$$output'.")
+ $${currentConfig}.output.$${output}.remove.$${name} += $$value
+ } else {
+ error("Invalid modifier '$$modifier' passed to qtConfOutputVar.")
+ }
+ $${currentConfig}.output.$${output}.$${modifier}._KEYS_ *= $${name}
+ export($${currentConfig}.output.$${output}.$${modifier}.$${name})
+ export($${currentConfig}.output.$${output}.$${modifier}._KEYS_)
+}
+
+# qtConfExtendVar(output, name, value)
+defineTest(qtConfExtendVar) {
+ output = $$1
+ name = $$2
+ value = $$val_escape(3)
+
+ !defined($${currentConfig}.output.$${output}.assign.$${name}, var): \
+ error("Trying to extend undefined variable '$$name' in '$$output'.")
+
+ $${currentConfig}.output.$${output}.assign.$${name} += $$value
+ export($${currentConfig}.output.$${output}.assign.$${name})
+}
+
+defineTest(qtConfOutputVarHelper) {
+ !isEmpty($${2}.public):$$eval($${2}.public) {
+ output = "publicPro"
+ } else {
+ output = "privatePro"
+ }
+
+ negative = $$eval($${2}.negative)
+ isEmpty(negative): negative = false
+ equals(3, $$negative): return()
+
+ name = $$eval($${2}.name)
+ isEmpty(name): \
+ error("Output type 'var$$title($$1)' used in feature '$$eval($${2}.feature)' without a 'name' entry.")
+
+ value = $$qtConfEvaluate($$eval($${2}.value))
+ !isEmpty($${2}.eval):$$qtConfEvaluate($$eval($${2}.eval)): \
+ eval(value = $$value)
+ qtConfOutputVar($$1, $$output, $$name, $$value)
+ equals(output, "publicPro"):!isEmpty($${currentConfig}.module): \
+ qtConfExtendVar($$output, "QT.$${currentModule}.exports", $$name)
+}
+
+defineTest(qtConfOutput_varAssign) {
+ qtConfOutputVarHelper(assign, $$1, $$2)
+}
+
+defineTest(qtConfOutput_varAppend) {
+ qtConfOutputVarHelper(append, $$1, $$2)
+}
+
+defineTest(qtConfOutput_varRemove) {
+ qtConfOutputVarHelper(remove, $$1, $$2)
+}
+
+defineTest(qtConfOutputConfigVar) {
+ pro = $$3
+ var = $$4
+ modular = $$5
+
+ negative = $$eval($${1}.negative)
+ isEmpty(negative): negative = false
+ equals(2, $$negative): return()
+
+ val = $$eval($${1}.name)
+ isEmpty(val) {
+ val = $$eval($${1}.feature)
+ $$negative: val = no-$$val
+ }
+
+ isEmpty($${currentConfig}.module)|!$$modular: \
+ qtConfOutputVar(append, $$pro, $$var, $$val)
+ else: \
+ qtConfExtendVar($$pro, "QT.$${currentModule}.$$var", $$val)
+}
+
+defineTest(qtConfOutput_publicQtConfig) {
+ qtConfOutputConfigVar($$1, $$2, "publicPro", "QT_CONFIG", true)
+}
+
+defineTest(qtConfOutput_publicConfig) {
+ !isEmpty($${currentConfig}.module): \
+ error("Cannot use output type 'publicConfig' in module-local feature '$$eval($${1}.feature)'.")
+ qtConfOutputConfigVar($$1, $$2, "publicPro", "CONFIG", false)
+}
+
+defineTest(qtConfOutput_privateConfig) {
+ qtConfOutputConfigVar($$1, $$2, "privatePro", "CONFIG", false)
+}
+
+defineTest(qtConfOutputSetDefine) {
+ $${currentConfig}.output.$${1}.$${2} = $${3}
+ $${currentConfig}.output.$${1}._KEYS_ *= $${2}
+ export($${currentConfig}.output.$${1}.$${2})
+ export($${currentConfig}.output.$${1}._KEYS_)
+}
+
+defineTest(qtConfOutput_define) {
+ output = publicHeader
+ define = $$eval($${1}.name)
+ value = $$qtConfEvaluate($$eval($${1}.value))
+ isEmpty(define): \
+ error("Output type 'define' used in feature '$$eval($${1}.feature)' without a 'name' entry.")
+
+ negative = $$eval($${1}.negative)
+ isEmpty(negative): negative = false
+ equals(2, $$negative): return()
+
+ qtConfOutputSetDefine($$output, $$define, $$value)
+}
+
+defineTest(qtConfOutput_feature) {
+ name = "$$eval($${1}.name)"
+ isEmpty(name): \
+ name = $$eval($${1}.feature)
+
+ $${2} {
+ isEmpty($${currentConfig}.module): \
+ qtConfOutputVar(append, "publicPro", "QT_CONFIG", $$name)
+ else: \
+ qtConfExtendVar("publicPro", "QT.$${currentModule}.QT_CONFIG", $$name)
+ } else {
+ f = $$upper($$replace(name, -, _))
+ qtConfOutputSetDefine("publicHeader", "QT_NO_$$f")
+ }
+}
+
+defineTest(qtConfSetModuleName) {
+ currentModule = $$eval($${currentConfig}.module)
+ isEmpty(currentModule): \
+ currentModule = global
+ export(currentModule)
+}
+
+defineTest(qtConfSetupModuleOutputs) {
+ qtConfOutputVar(assign, "publicPro", "QT.$${currentModule}.enabled_features", )
+ qtConfOutputVar(assign, "publicPro", "QT.$${currentModule}.disabled_features", )
+ qtConfOutputVar(assign, "privatePro", "QT.$${currentModule}_private.enabled_features", )
+ qtConfOutputVar(assign, "privatePro", "QT.$${currentModule}_private.disabled_features", )
+ !isEmpty($${currentConfig}.module) {
+ qtConfOutputVar(assign, "publicPro", "QT.$${currentModule}.QT_CONFIG", )
+ qtConfOutputVar(assign, "publicPro", "QT.$${currentModule}.exports", )
+ qtConfOutputVar(assign, "privatePro", "QT.$${currentModule}_private.libraries", )
+ }
+}
+
+defineTest(qtConfOutput_publicFeature) {
+ name = "$$eval($${1}.name)"
+ isEmpty(name): \
+ name = $$eval($${1}.feature)
+ feature = $$replace(name, [-+.], _)
+
+ $${2} {
+ qtConfExtendVar("publicPro", "QT.$${currentModule}.enabled_features", $$name)
+ QT.$${currentModule}.enabled_features += $$name
+ export(QT.$${currentModule}.enabled_features)
+ qtConfOutputSetDefine("publicHeader", "QT_FEATURE_$$feature", 1)
+ } else {
+ qtConfExtendVar("publicPro", "QT.$${currentModule}.disabled_features", $$name)
+ QT.$${currentModule}.disabled_features += $$name
+ export(QT.$${currentModule}.disabled_features)
+ qtConfOutputSetDefine("publicHeader", "QT_FEATURE_$$feature", -1)
+ }
+}
+
+# currently this is somewhat inconsistent, as the feature is output to the public pro file,
+# whereas the define is being added to the private pro file.
+# This should get cleaned up to add to the private pro and header instead.
+defineTest(qtConfOutput_privateFeature) {
+ name = "$$eval($${1}.name)"
+ isEmpty(name): \
+ name = $$eval($${1}.feature)
+ feature = $$replace(name, [-+.], _)
+
+ $${2} {
+ qtConfExtendVar("privatePro", "QT.$${currentModule}_private.enabled_features", $$name)
+ QT.$${currentModule}_private.enabled_features += $$name
+ export(QT.$${currentModule}_private.enabled_features)
+ qtConfOutputSetDefine("privateHeader", "QT_FEATURE_$$feature", 1)
+ } else {
+ qtConfExtendVar("privatePro", "QT.$${currentModule}_private.disabled_features", $$name)
+ QT.$${currentModule}_private.disabled_features += $$name
+ export(QT.$${currentModule}_private.disabled_features)
+ qtConfOutputSetDefine("privateHeader", "QT_FEATURE_$$feature", -1)
+ }
+}
+
+defineTest(qtConfProcessOneOutput) {
+ feature = $${1}
+ fpfx = $${currentConfig}.features.$${feature}
+ opfx = $${fpfx}.output.$${2}
+
+ condition = $$eval($${opfx}.condition)
+ !isEmpty(condition):!$$qtConfEvaluate($$condition): \
+ return()
+
+ call = $$eval($${opfx}.type)
+ isEmpty(call) {
+ # output is just a string, not an object
+ call = $$eval($$opfx)
+ }
+ !defined("qtConfOutput_$$call", test): \
+ error("Undefined type '$$call' in output '$$2' of feature '$$feature'.")
+
+ condition = $$eval($${opfx}.condition)
+ !isEmpty(condition) {
+ !$$qtConfEvaluate($$condition): \
+ return(false)
+ }
+
+ $${opfx}.feature = $$feature
+ qtConfOutput_$${call}($$opfx, $$eval($${fpfx}.available))
+}
+
+defineTest(qtConfProcessOutput) {
+ !contains($${currentConfig}._KEYS_, "features"): \
+ return()
+
+ basedir = $$shadowed($$eval($${currentConfig}.dir))
+ module = $$eval($${currentConfig}.module)
+
+ # write it to the output files
+ isEmpty($${currentConfig}.files._KEYS_) {
+ # set defaults that should work for most Qt modules
+ isEmpty(module): \
+ error("Neither module nor files section specified in configuration file.")
+
+ $${currentConfig}.files._KEYS_ = publicPro privatePro publicHeader privateHeader
+ $${currentConfig}.files.publicPro = qt$${module}-config.pri
+ $${currentConfig}.files.privatePro = qt$${module}-config.pri # sic!
+ $${currentConfig}.files.publicHeader = qt$${module}-config.h
+ $${currentConfig}.files.privateHeader = qt$${module}-config_p.h
+ }
+
+ for (type, $${currentConfig}.files._KEYS_) {
+ contains(type, ".*Pro") {
+ for (k, $${currentConfig}.output.$${type}.assign._KEYS_): \
+ $${currentConfig}.output.$$type += "$$k = $$eval($${currentConfig}.output.$${type}.assign.$$k)"
+ for (k, $${currentConfig}.output.$${type}.remove._KEYS_): \
+ $${currentConfig}.output.$$type += "$$k -= $$eval($${currentConfig}.output.$${type}.remove.$$k)"
+ for (k, $${currentConfig}.output.$${type}.append._KEYS_): \
+ $${currentConfig}.output.$$type += "$$k += $$eval($${currentConfig}.output.$${type}.append.$$k)"
+ } else {
+ for (define, $${currentConfig}.output.$${type}._KEYS_) {
+ value = $$eval($${currentConfig}.output.$${type}.$${define})
+ $${currentConfig}.output.$$type += "$${LITERAL_HASH}define $$define $$value"
+ }
+ }
+
+ ppScope =
+ !isEmpty(module): ppScope = $${module}_
+ defined(qtConfOutputPostProcess_$${ppScope}$${type}, test): \
+ qtConfOutputPostProcess_$${ppScope}$${type}()
+
+ file = $$eval($${currentConfig}.files.$${type})
+ fileCont.$$file += $$eval($${currentConfig}.output.$${type})
+ fileCont._KEYS_ *= $$file
+ }
+
+ for (file, fileCont._KEYS_): \
+ write_file($$basedir/$$file, fileCont.$$file)|error()
+}
+
+#
+# tie it all together
+#
+
+cfgs =
+isEmpty(_QMAKE_SUPER_CACHE_)|equals(OUT_PWD, $$dirname(_QMAKE_SUPER_CACHE_)) {
+ c = $$basename(_PRO_FILE_PWD_)
+ config.$${c}.dir = $$_PRO_FILE_PWD_
+ cfgs += $$c
+ !isEmpty(_QMAKE_SUPER_CACHE_) {
+ for (s, SUBDIRS) {
+ config.$${s}.dir = $$_PRO_FILE_PWD_/$${s}
+ cfgs += $$s
+ }
+ }
+}
+configsToProcess =
+for (c, cfgs) {
+ s = $$eval(config.$${c}.dir)
+ exists($$s/configure.json): \
+ configsToProcess += $$c
+}
+isEmpty(configsToProcess): \
+ return()
+
+load(configure_base)
+
+QMAKE_POST_CONFIGURE =
+allConfigs =
+for(ever) {
+ isEmpty(configsToProcess): \
+ break()
+
+ currentConfig = config.$$take_first(configsToProcess)
+ thisDir = $$eval($${currentConfig}.dir)
+ jsonFile = $$thisDir/configure.json
+ priFile = $$thisDir/configure.pri
+
+ allConfigs += $$currentConfig
+
+ # load configuration data
+ configure_data = $$cat($$jsonFile, blob)
+ !parseJson(configure_data, $$currentConfig): \
+ error("Invalid or non-existent file $${jsonFile}.")
+ exists($$priFile): \
+ !include($$priFile): error()
+
+ # prepend all subconfigs to files to keep a depth first search order
+ subconfigs =
+ for(n, $${currentConfig}.subconfigs._KEYS_) {
+ subconfig = $$eval($${currentConfig}.subconfigs.$${n})
+ name = $$basename(subconfig)
+ config.$${name}.dir = $$thisDir/$$subconfig
+ subconfigs += $$name
+ }
+ configsToProcess = $$subconfigs $$configsToProcess
+}
+
+for (currentConfig, allConfigs): \
+ qtConfSetupLibraries()
+
+!isEmpty(_QMAKE_SUPER_CACHE_): \
+ QMAKE_CONFIG_CACHE = $$dirname(_QMAKE_SUPER_CACHE_)/config.cache
+else: \
+ QMAKE_CONFIG_CACHE = $$dirname(_QMAKE_CACHE_)/config.cache
+QMAKE_CONFIG_CACHE_USE = all
+
+qtConfParseCommandLine()
+
+!equals(QMAKE_CONFIG_CACHE_USE, none) {
+ include($$QMAKE_CONFIG_CACHE, , true)
+ # this crudely determines when to discard the cache. this also catches the case
+ # of no cache being there in the first place.
+ !equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]): \
+ QMAKE_CONFIG_CACHE_USE = none
+}
+equals(QMAKE_CONFIG_CACHE_USE, none) {
+ cont = \
+ "cache.platform = $$[QMAKE_SPEC]" \
+ "cache.xplatform = $$[QMAKE_XSPEC]"
+ write_file($$QMAKE_CONFIG_CACHE, cont)
+}
+
+for (currentConfig, allConfigs) {
+ qtConfSetModuleName()
+ qtConfSetupModuleOutputs()
+ # do early checks, mainly to validate the command line
+ qtConfProcessEarlyChecks()
+}
+qtConfCheckErrors()
+
+CONFIG += qt_conf_tests_allowed
+logn()
+logn("Running configuration tests...")
+
+for (currentConfig, allConfigs) {
+ tdir = $$eval($${currentConfig}.testDir)
+ isEmpty(tdir): tdir = config.tests
+ QMAKE_CONFIG_TESTS_DIR = $$absolute_path($$tdir, $$eval($${currentConfig}.dir))
+
+ qtConfSetModuleName()
+
+ qtConfSetupTestTypeDeps()
+
+ # correctly setup dependencies
+ QMAKE_CONFIG_DEPS = global global_private
+ !isEmpty($${currentConfig}.module) {
+ for (d, $${currentConfig}.depends._KEYS_) {
+ dep = $$replace($${currentConfig}.depends.$$d, -private$, _private)
+ dep *= $$replace(dep, _private$, )
+ QMAKE_CONFIG_DEPS += $$dep
+ }
+ }
+
+ # process all features
+ qtConfProcessFeatures()
+
+ # generate files and reports
+ qtConfProcessOutput()
+ qtConfCreateReport()
+ qtConfCreateSummary()
+}
+
+# these come from the pri files loaded above.
+for (p, QMAKE_POST_CONFIGURE): \
+ eval($$p)
+
+logn("Done running configuration tests.")
+logn()
+
+logn("Configure summary:")
+logn()
+qtConfPrintReport()
diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf
index 183d0c9502..72dde61a40 100644
--- a/mkspecs/features/qt_docs.prf
+++ b/mkspecs/features/qt_docs.prf
@@ -21,12 +21,16 @@ qtvertag.name = QT_VERSION_TAG
qtvertag.value = $$replace(qtver.value, \.,)
qtdocs.name = QT_INSTALL_DOCS
qtdocs.value = $$[QT_INSTALL_DOCS/src]
-QT_TOOL_ENV = qtver qtmver qtvertag qtdocs
+builddir.name = BUILDDIR
+builddir.value = $$OUT_PWD
+QT_TOOL_ENV = qtver qtmver qtvertag qtdocs builddir
qtPrepareTool(QDOC, qdoc)
QT_TOOL_ENV =
!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
+qtPrepareTool(QTATTRIBUTIONSSCANNER, qtattributionsscanner)
+
# qtPrepareTool() must be called outside a build pass, as it protects
# against concurrent wrapper creation by omitting it during build passes.
# However, creating the actual targets is reserved to the build passes.
@@ -63,12 +67,21 @@ DOC_INDEXES =
PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
}
+
+qtattributionsscanner.target = qtattributionsscanner
+qtattributionsscanner.commands = $$QTATTRIBUTIONSSCANNER $$shell_quote($$MODULE_BASE_INDIR) \
+ --filter "QDocModule=$$QMAKE_DOCS_TARGET" -o $$shell_quote($$OUT_PWD/codeattributions.qdoc)
+qtattributionsscanner.CONFIG += phony
+QMAKE_EXTRA_TARGETS += qtattributionsscanner
+
doc_command = $$QDOC $$QMAKE_DOCS
prepare_docs {
prepare_docs.commands += $$doc_command -prepare $$PREP_DOC_INDEXES -no-link-errors
generate_docs.commands += $$doc_command -generate $$DOC_INDEXES
+ prepare_docs.depends += qtattributionsscanner
} else {
html_docs.commands += $$doc_command $$DOC_INDEXES
+ html_docs.depends += qtattributionsscanner
}
!build_online_docs {
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index 54641ce5a1..708815d9f9 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -1,10 +1,6 @@
defineReplace(qtPlatformTargetSuffix) {
- ios:CONFIG(simulator, simulator|device): \
- suffix = _$${simulator.sdk}
- else: \
- suffix =
-
+ suffix =
CONFIG(debug, debug|release) {
!debug_and_release|build_pass {
mac: return($${suffix}_debug)
@@ -16,7 +12,7 @@ defineReplace(qtPlatformTargetSuffix) {
defineReplace(qtLibraryTarget) {
LIBRARY_NAME = $$1
- CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
+ CONFIG(shared, static|shared):qtConfig(framework) {
QMAKE_FRAMEWORK_BUNDLE_NAME = $$LIBRARY_NAME
export(QMAKE_FRAMEWORK_BUNDLE_NAME)
}
@@ -171,7 +167,7 @@ defineTest(qtAddToolEnv) {
"EndLocal"
$$1 = call
}
- !build_pass:!write_file($$OUT_PWD/$$batch_name, batch_cont, exe): error("Aborting.")
+ !build_pass:!write_file($$OUT_PWD/$$batch_name, batch_cont, exe): error()
isEmpty(3): \
$$1 += $$shell_quote($$shell_path($$OUT_PWD/$$batch_name))
else: \
@@ -187,8 +183,10 @@ defineTest(qtAddTargetEnv) {
deps = $$replace($$2, -private$, _private)
deps = $$resolve_depends(deps, "QT.", ".depends" ".run_depends")
!isEmpty(deps) {
+ libs = libs
deppath.CONFIG = prepend
equals(QMAKE_HOST.os, Windows) {
+ libs = bins
deppath.CONFIG = always_prepend
deppath.name = PATH
} else:contains(QMAKE_HOST.os, Linux|FreeBSD|OpenBSD|NetBSD|DragonFly|SunOS|HP-UX|QNX|GNU) {
@@ -196,7 +194,7 @@ defineTest(qtAddTargetEnv) {
} else:contains(QMAKE_HOST.os, Haiku) {
deppath.name = LIBRARY_PATH
} else:equals(QMAKE_HOST.os, Darwin) {
- contains(QT_CONFIG, qt_framework): \
+ qtConfig(framework): \
deppath.name = DYLD_FRAMEWORK_PATH
else: \
deppath.name = DYLD_LIBRARY_PATH
@@ -208,9 +206,9 @@ defineTest(qtAddTargetEnv) {
ptypes =
for(dep, deps) {
isEmpty(3): \
- deppath += $$shell_path($$eval(QT.$${dep}.libs))
+ deppath += $$shell_path($$eval(QT.$${dep}.$$libs))
else: \
- deppath += $$system_path($$eval(QT.$${dep}.libs))
+ deppath += $$system_path($$eval(QT.$${dep}.$$libs))
ptypes += $$eval(QT.$${dep}.plugin_types)
}
deppath.value = $$unique(deppath)
@@ -259,7 +257,7 @@ defineReplace(pkgConfigExecutable) {
}
defineTest(packagesExist) {
- contains(QT_CONFIG, no-pkg-config) {
+ !qtConfig(pkg-config) {
warning("pkg-config disabled, can't check package existence")
return(false)
}
@@ -302,3 +300,18 @@ defineTest(prepareRecursiveTarget) {
export($${target}.CONFIG)
export($${target}.recurse_target)
}
+
+defineTest(qtConfig) {
+ modules = $$QT $$QT_PRIVATE $$QT_FOR_CONFIG
+ modules ~= s,-private$,_private,g
+ modules = $$resolve_depends(modules, "QT.", ".depends")
+ modules += global global_private
+ modules = $$reverse(modules)
+ for (module, modules) {
+ contains(QT.$${module}.enabled_features, $$1): \
+ return(true)
+ contains(QT.$${module}.disabled_features, $$1): \
+ return(false)
+ }
+ error("Could not find feature $${1}.")
+}
diff --git a/mkspecs/features/qt_helper_lib.prf b/mkspecs/features/qt_helper_lib.prf
index dc7a5da30e..8890866c64 100644
--- a/mkspecs/features/qt_helper_lib.prf
+++ b/mkspecs/features/qt_helper_lib.prf
@@ -18,15 +18,15 @@ QT = # In case qt is re-added.
CONFIG -= warning_clean # Don't presume 3rd party code to be clean
load(qt_common)
-contains(QT_CONFIG, simulator_and_device): CONFIG += simulator_and_device
-contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
-contains(QT_CONFIG, build_all): CONFIG += build_all
+qtConfig(simulator_and_device): CONFIG += simulator_and_device
+qtConfig(debug_and_release): CONFIG += debug_and_release
+qtConfig(build_all): CONFIG += build_all
DESTDIR = $$MODULE_BASE_OUTDIR/lib
DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
# In static builds of Qt, convenience libraries must be installed,
# as in this case they are not linked to the final library/plugin.
-installed|if(!not_installed:contains(QT_CONFIG, static)): load(qt_installs)
+installed|if(!not_installed:qtConfig(static)): load(qt_installs)
TARGET = $$qt5LibraryTarget($$TARGET)
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index d9011f5482..168cc47f93 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -32,17 +32,17 @@ host_build {
QMAKE_CFLAGS += $$QMAKE_CFLAGS_SPLIT_SECTIONS
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_SPLIT_SECTIONS
force_bootstrap {
- !build_pass:contains(QT_CONFIG, release_tools): CONFIG += release
+ !build_pass:qtConfig(release_tools): CONFIG += release
contains(QT, core(-private)?|xml) {
QT -= core core-private xml
QT += bootstrap-private
}
} else {
- !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
+ !build_pass:qtConfig(debug_and_release): CONFIG += release
}
}
-CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework): \
+CONFIG(shared, static|shared):qtConfig(framework): \
CONFIG += lib_bundle
CONFIG += relative_qt_rpath # Qt libraries should be relocatable
@@ -74,7 +74,7 @@ header_module {
TEMPLATE = lib
}
DESTDIR = $$MODULE_BASE_OUTDIR/lib
-win32:!wince:!prefix_build: DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
+DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
CONFIG += qmake_cache target_qt
@@ -89,9 +89,9 @@ INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.inclu
# If Qt was configured with -debug-and-release then build the module the same way
# - unless this is a host library
!host_build:if(win32|mac):!macx-xcode {
- contains(QT_CONFIG, simulator_and_device): CONFIG += simulator_and_device
- contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
- contains(QT_CONFIG, build_all): CONFIG += build_all
+ qtConfig(simulator_and_device): CONFIG += simulator_and_device
+ qtConfig(debug_and_release): CONFIG += debug_and_release
+ qtConfig(build_all): CONFIG += build_all
}
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
@@ -114,10 +114,12 @@ lib_bundle {
CONFIG += sliced_bundle
header_module {
CONFIG += bundle
+ QMAKE_BUNDLE_NAME = $$TARGET
QMAKE_BUNDLE_EXTENSION = .framework
QMAKE_INFO_PLIST = $$QMAKESPEC/Info.plist.lib
}
- !debug_and_release|!build_all|CONFIG(release, debug|release) {
+ !build_all| \
+ if(if(!debug_and_release|CONFIG(release, debug|release))) {
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
FRAMEWORK_HEADERS.path = Headers
@@ -137,7 +139,7 @@ mac {
QMAKE_CXXFLAGS += -fconstant-cfstrings
}
- contains(QT_CONFIG, rpath): \
+ qtConfig(rpath): \
QMAKE_SONAME_PREFIX = @rpath
else: \
CONFIG += absolute_library_soname
@@ -164,7 +166,7 @@ aix-g++* {
QMAKE_CXXFLAGS += -mminimal-toc
}
-sse2:!contains(QT_CPU_FEATURES.$$QT_ARCH, sse2):!host_build:!if(static:contains(QT_CONFIG, shared)) {
+sse2:!contains(QT_CPU_FEATURES.$$QT_ARCH, sse2):!host_build:!if(static:qtConfig(shared)) {
# If the compiler supports SSE2, enable it unconditionally in all of Qt shared libraries
# (and only the libraries). This is not expected to be a problem because:
# - on Windows, sharing of libraries is uncommon
@@ -232,7 +234,7 @@ android: CONFIG += qt_android_deps no_linker_version_script
verscript = $$verscript_in
}
- write_file($$OUT_PWD/$$verscript, verscript_content)|error("Aborting.")
+ write_file($$OUT_PWD/$$verscript, verscript_content)|error()
unset(current)
unset(previous)
unset(verscript)
diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf
index 05d0706a33..5a45007820 100644
--- a/mkspecs/features/qt_module_headers.prf
+++ b/mkspecs/features/qt_module_headers.prf
@@ -16,7 +16,7 @@ load(qt_build_paths)
minimal_syncqt {
QMAKE_SYNCQT += -minimal $$QMAKE_SYNCQT_OPTIONS
} else {
- contains(QT_CONFIG, private_tests): \ # -developer-build
+ qtConfig(private_tests): \ # -developer-build
QMAKE_SYNCQT += -check-includes
}
for(mod, MODULE_INCNAME): \
@@ -104,18 +104,33 @@ include($$INC_PATH/include/$$MODULE_INCNAME/headers.pri, "", true)
alien_syncqt: return()
+MODULE_INC_OUTDIR = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME
+
+exists($$OUT_PWD/qt$${MODULE}-config.h) {
+ fwd_rel = $$relative_path($$OUT_PWD, $$MODULE_INC_OUTDIR)
+ SYNCQT.INJECTIONS += \
+ $$fwd_rel/qt$${MODULE}-config.h:qt$${MODULE}-config.h \
+ $$fwd_rel/qt$${MODULE}-config_p.h:$$MODULE_VERSION/$$MODULE_INCNAME/private/qt$${MODULE}-config_p.h
+ inst_rel = $$relative_path($$OUT_PWD, $$_PRO_FILE_PWD_)
+ SYNCQT.HEADER_FILES += $$inst_rel/qt$${MODULE}-config.h
+ SYNCQT.PRIVATE_HEADER_FILES += $$inst_rel/qt$${MODULE}-config_p.h
+}
+
for (injection, SYNCQT.INJECTIONS) {
injects = $$split(injection, :)
+ dst_hdr = $$absolute_path($$member(injects, 0), $$MODULE_INC_OUTDIR)
fwd_hdr = $$member(injects, 1)
- MAIN_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$fwd_hdr
- MAIN_FWD_CONT = '$${LITERAL_HASH}include "$$member(injects, 0)"'
- write_file($$MAIN_FWD, MAIN_FWD_CONT)|error("Aborting.")
+ MAIN_FWD = $$MODULE_INC_OUTDIR/$$fwd_hdr
+ MAIN_FWD_CONT = '$${LITERAL_HASH}include "$$relative_path($$dst_hdr, $$dirname(MAIN_FWD))"'
+ write_file($$MAIN_FWD, MAIN_FWD_CONT)|error()
+ touch($$MAIN_FWD, $$dst_hdr)
!git_build: QMAKE_DISTCLEAN += $$MAIN_FWD
injects = $$member(injects, 2, -1)
for (inject, injects) {
- CLASS_FWD = $$INC_PATH/include/$$MODULE_INCNAME/$$inject
+ CLASS_FWD = $$MODULE_INC_OUTDIR/$$inject
CLASS_FWD_CONT = '$${LITERAL_HASH}include "$$fwd_hdr"'
- write_file($$CLASS_FWD, CLASS_FWD_CONT)|error("Aborting.")
+ write_file($$CLASS_FWD, CLASS_FWD_CONT)|error()
+ touch($$CLASS_FWD, $$dst_hdr)
!git_build: QMAKE_DISTCLEAN += $$CLASS_FWD
}
}
@@ -135,7 +150,7 @@ MODULE_MASTER_DEPS_HEADER = $$MODULE_BASE_OUTDIR/include/$$MODULE_INCNAME/$${MOD
MODULE_MASTER_DEPS_HEADER_CONT += "$${LITERAL_HASH}include <$$depname/$$depname>"
}
MODULE_MASTER_DEPS_HEADER_CONT += "$${LITERAL_HASH}endif"
- write_file($$MODULE_MASTER_DEPS_HEADER, MODULE_MASTER_DEPS_HEADER_CONT)|error("Aborting.")
+ write_file($$MODULE_MASTER_DEPS_HEADER, MODULE_MASTER_DEPS_HEADER_CONT)|error()
!git_build: QMAKE_DISTCLEAN += $$MODULE_MASTER_DEPS_HEADER
}
SYNCQT.HEADER_FILES += $$MODULE_MASTER_DEPS_HEADER
@@ -227,17 +242,24 @@ headersclean:!internal_module {
$$[QT_INSTALL_DATA/src]/mkspecs/features/data/dummy.cpp
}
- !isEmpty(hcleanCOMMAND):if(!contains(QT_CONFIG, debug_and_release)|CONFIG(release, debug|release)) {
+ !isEmpty(hcleanCOMMAND):if(!qtConfig(debug_and_release)|CONFIG(release, debug|release)) {
+ CLEAN_HEADERS =
+ for (h, SYNCQT.CLEAN_HEADER_FILES) {
+ hh = $$split(h, :)
+ hr = $$member(hh, 1)
+ isEmpty(hr)|qtConfig($$hr): \
+ CLEAN_HEADERS += $$member(hh, 0)
+ }
+ CLEAN_HEADERS -= $$HEADERSCLEAN_EXCLUDE
header_check.dependency_type = TYPE_C
header_check.CONFIG += no_link
header_check.output = ${QMAKE_VAR_OBJECTS_DIR}header_${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
- header_check.input = SYNCQT.CLEAN_HEADER_FILES
+ header_check.input = CLEAN_HEADERS
header_check.variable_out = PRE_TARGETDEPS
header_check.name = headercheck ${QMAKE_FILE_IN}
header_check.commands = $$hcleanCOMMAND
silent:header_check.commands = @echo compiling[header] ${QMAKE_FILE_IN} && $$hcleanCOMMAND
QMAKE_EXTRA_COMPILERS += header_check
- SYNCQT.CLEAN_HEADER_FILES -= $$HEADERSCLEAN_EXCLUDE
}
unset(hcleanCOMMAND)
unset(hcleanFLAGS)
diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf
index 4dd9e25f9f..9542a362d0 100644
--- a/mkspecs/features/qt_module_pris.prf
+++ b/mkspecs/features/qt_module_pris.prf
@@ -35,6 +35,41 @@ else: \
MODULE_PRI = $$mod_inst_pfx/qt_lib_$${MODULE_ID}.pri
MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
+exists($$OUT_PWD/qt$${MODULE}-config.pri): \
+ include($$OUT_PWD/qt$${MODULE}-config.pri)
+
+defineReplace(qtGetFeaturesForModule) {
+ enabled = $$unique(QT.$${1}.enabled_features)
+ disabled = $$unique(QT.$${1}.disabled_features)
+ result = \
+ "QT.$${1}.enabled_features =$$join(enabled, " ", " ")" \
+ "QT.$${1}.disabled_features =$$join(disabled, " ", " ")"
+ return($$result)
+}
+
+defineReplace(qtGetExportsForModule) {
+ result =
+ for (var, QT.$${1}.exports): \
+ result += "$$var = $$val_escape($$var)"
+ return($$result)
+}
+
+defineReplace(qtExportLibsForModule) {
+ result =
+ for (lib, QT.$${1}.libraries) {
+ NAME = $$upper($$lib)
+ vars = \
+ QMAKE_LIBS_$$NAME QMAKE_LIBS_$${NAME}_DEBUG QMAKE_LIBS_$${NAME}_RELEASE \
+ QMAKE_CFLAGS_$$NAME QMAKE_INCDIR_$$NAME QMAKE_$${NAME}_VERSION \
+ QMAKE_$${NAME}_VERSION_MAJOR QMAKE_$${NAME}_VERSION_MINOR QMAKE_$${NAME}_VERSION_PATCH
+ for (var, vars) {
+ !isEmpty($$var): \
+ result += "$$var = $$val_escape($$var)"
+ }
+ }
+ return($$result)
+}
+
!build_pass {
# Create a module .pri file
@@ -102,12 +137,15 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
"QT.$${MODULE_ID}.module_config =$$join(module_build_type, " ", " ")" \
$$module_config \
"QT.$${MODULE_ID}.DEFINES = $$val_escape(MODULE_DEFINES)" \
+ $$qtGetFeaturesForModule($$MODULE_ID) \
+ $$qtGetExportsForModule($$MODULE_ID) \
+ "QT_CONFIG +=$$join(QT.$${MODULE_ID}.QT_CONFIG, " ", " ")" \
"" \
"QT_MODULES += $$MODULE"
winrt: MODULE_PRI_CONT += \
"QT.$${MODULE_ID}.winrt_capabilities =$$join(MODULE_WINRT_CAPABILITIES, " ", " ")" \
"QT.$${MODULE_ID}.winrt_capabilities_device =$$join(MODULE_WINRT_CAPABILITIES_DEVICE, " ", " ")"
- write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
+ write_file($$MODULE_PRI, MODULE_PRI_CONT)|error()
!internal_module:!no_private_module {
module_build_type += internal_module
private_deps = $$QT
@@ -126,8 +164,11 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
"QT.$${MODULE}_private.includes = $$MODULE_PRIVATE_INCLUDES" \
"QT.$${MODULE}_private.frameworks =" \
"QT.$${MODULE}_private.depends = $$private_deps" \
- "QT.$${MODULE}_private.module_config =$$join(module_build_type, " ", " ")"
- write_file($$MODULE_PRIVATE_PRI, MODULE_PRIVATE_PRI_CONT)|error("Aborting.")
+ "QT.$${MODULE}_private.module_config =$$join(module_build_type, " ", " ")" \
+ $$qtGetFeaturesForModule($${MODULE}_private) \
+ "" \
+ $$qtExportLibsForModule($${MODULE}_private)
+ write_file($$MODULE_PRIVATE_PRI, MODULE_PRIVATE_PRI_CONT)|error()
}
MODULE_PRI_FILES = $$MODULE_PRI $$MODULE_PRIVATE_PRI
@@ -162,7 +203,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
MODULE_FWD_PRI_CONT += \
"QT.$${MODULE}_private.includes $$pls= $$MODULE_FWD_PRIVATE_INCLUDES"
}
- write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
+ write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error()
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
MODULE_PRI_FILES += $$MODULE_FWD_PRI
diff --git a/mkspecs/features/qt_parts.prf b/mkspecs/features/qt_parts.prf
index 877bd60321..0accef6665 100644
--- a/mkspecs/features/qt_parts.prf
+++ b/mkspecs/features/qt_parts.prf
@@ -12,6 +12,8 @@
# Ensure that each module has a .qmake.cache when properly qmake'd.
cache()
+load(qt_configure)
+
load(qt_build_config)
TEMPLATE = subdirs
@@ -60,7 +62,7 @@ exists($$_PRO_FILE_PWD_/tests/tests.pro) {
sub_tests.CONFIG = no_default_install
!contains(QT_BUILD_PARTS, tests) {
sub_tests.CONFIG += no_default_target
- } else: !ios {
+ } else: !uikit {
# Make sure these are there in case we need them
sub_tools.CONFIG -= no_default_target
sub_examples.CONFIG -= no_default_target
@@ -74,6 +76,7 @@ QT_BUILD_PARTS -= libs tools examples tests
QMAKE_DISTCLEAN += \
.qmake.cache \
+ config.cache \
config.log \
mkspecs/modules/*.pri \
mkspecs/modules-inst/*.pri
diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
index 8e47d91133..2179c7ca22 100644
--- a/mkspecs/features/qt_plugin.prf
+++ b/mkspecs/features/qt_plugin.prf
@@ -24,11 +24,11 @@ win32:CONFIG(shared, static|shared) {
}
tool_plugin {
- !build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
+ !build_pass:qtConfig(debug_and_release): CONFIG += release
} else:if(win32|mac):!macx-xcode {
- contains(QT_CONFIG, simulator_and_device): CONFIG += simulator_and_device
- contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
- contains(QT_CONFIG, build_all): CONFIG += build_all
+ qtConfig(simulator_and_device): CONFIG += simulator_and_device
+ qtConfig(debug_and_release): CONFIG += debug_and_release
+ qtConfig(build_all): CONFIG += build_all
}
CONFIG += relative_qt_rpath # Qt's plugins should be relocatable
@@ -50,7 +50,7 @@ CONFIG(static, static|shared)|prefix_build {
"QT_PLUGIN.$${MODULE}.EXTENDS =$$join(PLUGIN_EXTENDS, " ", " ")" \
"QT_PLUGIN.$${MODULE}.CLASS_NAME = $$PLUGIN_CLASS_NAME" \
"QT_PLUGINS += $$MODULE"
- write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
+ write_file($$MODULE_PRI, MODULE_PRI_CONT)|error()
MODULE_PRI_FILES = $$MODULE_PRI
force_independent {
@@ -59,7 +59,7 @@ CONFIG(static, static|shared)|prefix_build {
MODULE_FWD_PRI_CONT = \
"QT_PLUGIN.$${MODULE}.PATH = $$MODULE_BASE_OUTDIR/plugins" \
"include($$MODULE_PRI)"
- write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
+ write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error()
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
MODULE_PRI_FILES += $$MODULE_FWD_PRI
@@ -92,5 +92,4 @@ CONFIG += create_cmake
load(qt_targets)
load(qt_common)
-wince: LIBS += $$QMAKE_LIBS_GUI
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf
index bdeb59c83d..93c952617d 100644
--- a/mkspecs/features/qt_tool.prf
+++ b/mkspecs/features/qt_tool.prf
@@ -60,7 +60,7 @@ DEFINES *= QT_USE_QSTRINGBUILDER
"QT_TOOL.$${MODULE}.binary = $$val_escape(bin)" \
"QT_TOOL.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
$$module_envvars
- write_file($$TOOL_PRI, TOOL_PRI_CONT)|error("Aborting.")
+ write_file($$TOOL_PRI, TOOL_PRI_CONT)|error()
# Then, inject the new tool into the current cache state
!contains(QMAKE_INTERNAL_INCLUDED_FILES, $$TOOL_PRI) { # before the actual include()!
diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf
index b712a2b58e..816c3b680d 100644
--- a/mkspecs/features/resolve_config.prf
+++ b/mkspecs/features/resolve_config.prf
@@ -41,7 +41,7 @@ CONFIG(debug, debug|release) {
# or not debug_and_release is active.
for(build, $$list(debug release)) {
suffix =
- contains(QT_CONFIG, debug_and_release) {
+ qtConfig(debug_and_release) {
equals(build, debug): \
suffix = _debug
} else {
diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf
index 21147e4a42..adc8e9a8ac 100644
--- a/mkspecs/features/resources.prf
+++ b/mkspecs/features/resources.prf
@@ -65,7 +65,7 @@ for(resource, RESOURCES) {
"</RCC>"
!write_file($$OUT_PWD/$$resource_file, resource_file_content): \
- error("Aborting.")
+ error()
}
RESOURCES -= $$resource
diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf
index 08ed00715d..64a6a9266b 100644
--- a/mkspecs/features/testcase.prf
+++ b/mkspecs/features/testcase.prf
@@ -181,6 +181,11 @@ isEmpty(BUILDS)|build_pass {
builtin_testdata {
ALL_TESTDATA = $$TESTDATA $$GENERATED_TESTDATA
+
+ # BLACKLIST needs to be added to the testdata
+ BLACKLISTPATH = $$_PRO_FILE_PWD_/BLACKLIST
+ exists($$BLACKLISTPATH): ALL_TESTDATA *= $$BLACKLISTPATH
+
# RESOURCES does not support wildcards (for good reasons)
for(td, ALL_TESTDATA): \
testdata.files += $$files($$absolute_path($$td, $$_PRO_FILE_PWD_))
diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf
deleted file mode 100644
index 7691b7db34..0000000000
--- a/mkspecs/features/toolchain.prf
+++ /dev/null
@@ -1,42 +0,0 @@
-
-isEmpty(QMAKE_DEFAULT_INCDIRS):!host_build {
- #
- # Get default include and library paths from compiler
- #
- gcc {
- !equals(QMAKE_HOST.os, Windows) {
- cmd_prefix = "LC_ALL=C"
- cmd_suffix = "</dev/null >/dev/null"
- } else {
- cmd_prefix = "set LC_ALL=C&"
- cmd_suffix = "<NUL >NUL"
- }
- output = $$system("$$cmd_prefix $$QMAKE_CXX $$QMAKE_CXXFLAGS -xc++ -E -v - 2>&1 $$cmd_suffix", lines)
- add_includes = false
- for (line, output) {
- line ~= s/^ *// # remove leading spaces
- contains(line, "LIBRARY_PATH=.*") {
- line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH=
- paths = $$split(line, $$QMAKE_DIRLIST_SEP)
- for (path, paths): \
- QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path)
- } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here:
- add_includes = true
- } else: contains(line, "End of search.*") {
- add_includes = false
- } else: $$add_includes {
- !contains(line, ".* \\(framework directory\\)"): \
- QMAKE_DEFAULT_INCDIRS += $$clean_path($$line)
- }
- }
- QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS)
- }
-
- unix {
- isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include
- isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib
- }
-
- !isEmpty(QMAKE_DEFAULT_INCDIRS): cache(QMAKE_DEFAULT_INCDIRS, set stash)
- !isEmpty(QMAKE_DEFAULT_LIBDIRS): cache(QMAKE_DEFAULT_LIBDIRS, set stash)
-}
diff --git a/mkspecs/features/uikit/bitcode.prf b/mkspecs/features/uikit/bitcode.prf
new file mode 100644
index 0000000000..a1dff19eb3
--- /dev/null
+++ b/mkspecs/features/uikit/bitcode.prf
@@ -0,0 +1,15 @@
+lessThan(QMAKE_XCODE_VERSION, "7.0") {
+ warning("You need to update Xcode to version 7 or newer to support bitcode")
+} else {
+ release:device {
+ QMAKE_CFLAGS += -fembed-bitcode
+ QMAKE_CXXFLAGS += -fembed-bitcode
+ QMAKE_OBJECTIVE_CFLAGS += -fembed-bitcode
+ QMAKE_LFLAGS += -fembed-bitcode
+ } else {
+ QMAKE_CFLAGS += -fembed-bitcode-marker
+ QMAKE_CXXFLAGS += -fembed-bitcode-marker
+ QMAKE_OBJECTIVE_CFLAGS += -fembed-bitcode-marker
+ QMAKE_LFLAGS += -fembed-bitcode-marker
+ }
+}
diff --git a/mkspecs/features/uikit/default_post.prf b/mkspecs/features/uikit/default_post.prf
new file mode 100644
index 0000000000..9a231ffc84
--- /dev/null
+++ b/mkspecs/features/uikit/default_post.prf
@@ -0,0 +1,104 @@
+equals(TEMPLATE, app):qt {
+ # If the application uses Qt, it needs to be an application bundle
+ # to be able to deploy and run on iOS. The only exception to this
+ # is if you're working with a jailbroken device and can run the
+ # resulting binary from the console/over SSH, but that's not a
+ # use-case we care about, so no need to complicate the logic.
+ CONFIG *= app_bundle
+
+ # For Qt applications we want Xcode project files as the generated output,
+ # but since qmake doesn't handle the transition between makefiles and Xcode
+ # project files (which happens when using subdirs), we can't just override
+ # MAKEFILE_GENERATOR. Instead, we generate the Xcode project by spawning a
+ # child qmake process with -spec macx-xcode and let the top level qmake
+ # process generate a wrapper makefile that forwards everything to xcodebuild.
+ equals(MAKEFILE_GENERATOR, UNIX): \
+ CONFIG = xcodebuild $$CONFIG
+}
+
+load(default_post)
+
+macx-xcode {
+ ios:isEmpty(QMAKE_APPLE_TARGETED_DEVICE_FAMILY):!isEmpty(QMAKE_IOS_TARGETED_DEVICE_FAMILY) {
+ warning("QMAKE_IOS_TARGETED_DEVICE_FAMILY is deprecated; use QMAKE_APPLE_TARGETED_DEVICE_FAMILY")
+ QMAKE_APPLE_TARGETED_DEVICE_FAMILY = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY
+ }
+
+ device_family.name = TARGETED_DEVICE_FAMILY
+ device_family.value = $$QMAKE_APPLE_TARGETED_DEVICE_FAMILY
+ QMAKE_MAC_XCODE_SETTINGS += device_family
+
+ ios {
+ # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an
+ # AppIcon.appiconset, we configure Xcode to use it for app icons.
+ for(bundle_data, QMAKE_BUNDLE_DATA) {
+ for(bundle_file, $${bundle_data}.files) {
+ !contains(bundle_file, .*\.xcassets$): next()
+ !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()
+
+ asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
+ asset_catalog_appicon.value = "AppIcon"
+ QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
+ break()
+ }
+ !isEmpty(asset_catalog_appicon.name): break()
+ }
+
+ # Set up default 4-inch iPhone/iPod launch image so that our apps
+ # support the full screen resolution of those devices.
+ qmake_launch_image = Default-568h@2x.png
+ qmake_copy_image.input = $$QMAKESPEC/$$qmake_launch_image
+ qmake_copy_image.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_image
+ qmake_copy_image.CONFIG = verbatim
+ QMAKE_SUBSTITUTES += qmake_copy_image
+ qmake_launch_images.files = $$qmake_copy_image.output
+ QMAKE_BUNDLE_DATA += qmake_launch_images
+
+ lessThan(QMAKE_XCODE_VERSION, "6.0") {
+ warning("You need to update Xcode to version 6 or newer to fully support iPhone6/6+")
+ } else {
+ # Set up default LaunchScreen to support iPhone6/6+
+ qmake_launch_screen = LaunchScreen.xib
+ qmake_copy_launch_screen.input = $$QMAKESPEC/$$qmake_launch_screen
+ qmake_copy_launch_screen.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_screen
+ QMAKE_SUBSTITUTES += qmake_copy_launch_screen
+ qmake_launch_screens.files = $$qmake_copy_launch_screen.output
+ QMAKE_BUNDLE_DATA += qmake_launch_screens
+ }
+ }
+}
+
+macx-xcode {
+ arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
+ arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
+
+ arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
+ arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
+ QMAKE_XCODE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS $$QMAKE_APPLE_SIMULATOR_ARCHS
+
+ QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator
+
+ only_active_arch.name = ONLY_ACTIVE_ARCH
+ only_active_arch.value = YES
+ only_active_arch.build = debug
+ QMAKE_MAC_XCODE_SETTINGS += only_active_arch
+} else {
+ VALID_ARCHS =
+ !simulator|simulator_and_device: VALID_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
+ simulator: VALID_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
+
+ single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
+
+ ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
+ ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
+
+ QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
+
+ arch_flags = $(EXPORT_ARCH_ARGS)
+
+ QMAKE_CFLAGS += $$arch_flags
+ QMAKE_CXXFLAGS += $$arch_flags
+ QMAKE_LFLAGS += $$arch_flags
+
+ QMAKE_PCH_ARCHS = $$VALID_ARCHS
+}
diff --git a/mkspecs/features/uikit/default_pre.prf b/mkspecs/features/uikit/default_pre.prf
new file mode 100644
index 0000000000..8b5b3ccfe9
--- /dev/null
+++ b/mkspecs/features/uikit/default_pre.prf
@@ -0,0 +1,22 @@
+
+load(default_pre)
+
+!isEmpty(QT_VERSION) {
+ qtConfig(simulator_and_device)|contains(QMAKE_MAC_SDK, ^$${device.sdk}.*): \
+ CONFIG += device $${device.sdk}
+ qtConfig(simulator_and_device)|contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
+ CONFIG += simulator $${simulator.sdk}
+
+ qtConfig(simulator_and_device) {
+ # For a simulator_and_device build all the config tests
+ # are based on the device's ARM SDK, but we know that the simulator
+ # is Intel and that we support SSE/SSE2.
+ QT_CPU_FEATURES.$$QT_ARCH += sse sse2
+ CONFIG += sse sse2
+ DEFINES += QT_COMPILER_SUPPORTS_SSE2
+ }
+}
+
+# Check for supported Xcode versions
+lessThan(QMAKE_XCODE_VERSION, "4.3"): \
+ error("This mkspec requires Xcode 4.3 or later")
diff --git a/mkspecs/macx-ios-clang/ios_destinations.sh b/mkspecs/features/uikit/device_destinations.sh
index d80a5cecf4..162ad01aaf 100755
--- a/mkspecs/macx-ios-clang/ios_destinations.sh
+++ b/mkspecs/features/uikit/device_destinations.sh
@@ -40,10 +40,10 @@
#############################################################################
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-booted_simulator=$($DIR/ios_devices.pl "iPhone|iPad" "Booted" "NOT unavailable" | tail -n 1)
-echo "IPHONESIMULATOR_DEVICES = $booted_simulator"
+booted_simulator=$($DIR/devices.pl "$1" "Booted" "NOT unavailable" | tail -n 1)
+echo "SIMULATOR_DEVICES = $booted_simulator"
-xcodebuild test -scheme $1 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
+xcodebuild test -scheme $2 -destination 'id=0' -destination-timeout 1 2>&1| sed -n 's/{ \(platform:.*\) }/\1/p' | while read destination; do
id=$(echo $destination | sed -n -E 's/.*id:([^ ,]+).*/\1/p')
[[ $id == *"placeholder"* ]] && continue
@@ -54,9 +54,17 @@ xcodebuild test -scheme $1 -destination 'id=0' -destination-timeout 1 2>&1| sed
if [ $key = 'PLATFORM' ]; then
if [ "$val" = "iOS" ]; then
- echo "IPHONEOS_DEVICES += $id"
+ echo "HARDWARE_DEVICES += $id"
elif [ "$val" = "iOS Simulator" -a "$id" != "$booted_simulator" ]; then
- echo "IPHONESIMULATOR_DEVICES += $id"
+ echo "SIMULATOR_DEVICES += $id"
+ elif [ "$val" = "tvOS" ]; then
+ echo "HARDWARE_DEVICES += $id"
+ elif [ "$val" = "tvOS Simulator" -a "$id" != "$booted_simulator" ]; then
+ echo "SIMULATOR_DEVICES += $id"
+ elif [ "$val" = "watchOS" ]; then
+ echo "HARDWARE_DEVICES += $id"
+ elif [ "$val" = "watchOS Simulator" -a "$id" != "$booted_simulator" ]; then
+ echo "SIMULATOR_DEVICES += $id"
fi
fi
done
diff --git a/mkspecs/macx-ios-clang/ios_devices.pl b/mkspecs/features/uikit/devices.pl
index eb45d1dab9..eb45d1dab9 100755
--- a/mkspecs/macx-ios-clang/ios_devices.pl
+++ b/mkspecs/features/uikit/devices.pl
diff --git a/mkspecs/macx-ios-clang/features/exclusive_builds_post.prf b/mkspecs/features/uikit/exclusive_builds_post.prf
index 1fb0a55846..1fb0a55846 100644
--- a/mkspecs/macx-ios-clang/features/exclusive_builds_post.prf
+++ b/mkspecs/features/uikit/exclusive_builds_post.prf
diff --git a/mkspecs/macx-ios-clang/features/qt.prf b/mkspecs/features/uikit/qt.prf
index 474a195e4b..4475c137dc 100644
--- a/mkspecs/macx-ios-clang/features/qt.prf
+++ b/mkspecs/features/uikit/qt.prf
@@ -1,22 +1,24 @@
qt_depends = $$resolve_depends(QT, "QT.")
-equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) {
+!watchos:equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) {
LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/platforms
lib_name = qios
lib_path_and_base = $$[QT_INSTALL_PLUGINS/get]/platforms/lib$${lib_name}$$qtPlatformTargetSuffix()
LIBS += -l$${lib_name}$$qtPlatformTargetSuffix() $$fromfile($${lib_path_and_base}.prl, QMAKE_PRL_LIBS)
- # By marking qt_registerPlatformPlugin as undefined, we ensure that
- # the plugin.o translation unit is considered for inclusion in
- # the final binary, which in turn ensures that the plugin's
- # static initializer is included and run.
- QMAKE_LFLAGS += -u _qt_registerPlatformPlugin
+ !bitcode {
+ # By marking qt_registerPlatformPlugin as undefined, we ensure that
+ # the plugin.o translation unit is considered for inclusion in
+ # the final binary, which in turn ensures that the plugin's
+ # static initializer is included and run.
+ QMAKE_LFLAGS += -u _qt_registerPlatformPlugin
- # We do link and dependency resolution for the platform plugin
- # manually, since we know we always need the plugin, so we don't
- # need to generate an import for it.
- QTPLUGIN.platforms = -
+ # We do link and dependency resolution for the platform plugin
+ # manually, since we know we always need the plugin, so we don't
+ # need to generate an import for it.
+ QTPLUGIN.platforms = -
+ }
!no_main_wrapper {
# The LC_MAIN load command available in iOS 6.0 and above allows dyld to
diff --git a/mkspecs/macx-ios-clang/features/qt_config.prf b/mkspecs/features/uikit/qt_config.prf
index d746cba9d9..5fa5a536f8 100644
--- a/mkspecs/macx-ios-clang/features/qt_config.prf
+++ b/mkspecs/features/uikit/qt_config.prf
@@ -5,10 +5,13 @@ isEmpty(QT_ARCH) {
# means we fail to pass -arch to the compiler, resulting in broke tests.
# As the Xcode toolchain doesn't seem to have a way to auto-detect the
# arch based on the SDK, we have to hard-code the arch for configure.
- contains(QMAKE_MAC_SDK, $${device.sdk}.*): \
+ contains(QMAKE_MAC_SDK, $${device.sdk}.*) {
QT_ARCH = arm
- else: \ # Simulator
- QT_ARCH = i386
+ } else { # Simulator
+ ios: QT_ARCH = i386
+ tvos: QT_ARCH = x64
+ watchos: QT_ARCH = i386
+ }
# Prevent the arch/config tests from building as multi-arch binaries,
# as we only want the lowest common denominator features.
diff --git a/mkspecs/macx-ios-clang/features/qt_parts.prf b/mkspecs/features/uikit/qt_parts.prf
index 81814a62b0..81814a62b0 100644
--- a/mkspecs/macx-ios-clang/features/qt_parts.prf
+++ b/mkspecs/features/uikit/qt_parts.prf
diff --git a/mkspecs/features/uikit/resolve_config.prf b/mkspecs/features/uikit/resolve_config.prf
new file mode 100644
index 0000000000..70ddd8be52
--- /dev/null
+++ b/mkspecs/features/uikit/resolve_config.prf
@@ -0,0 +1,11 @@
+
+xcodebuild {
+ # Xcode project files always support both Debug and Release configurations
+ # and device and simulator targets, so we make sure the wrapper-makefile
+ # also does.
+ CONFIG += debug_and_release simulator_and_device
+}
+
+load(resolve_config)
+
+!macx-xcode:xcodebuild: addExclusiveBuilds(simulator, device)
diff --git a/mkspecs/macx-ios-clang/features/sdk.prf b/mkspecs/features/uikit/sdk.prf
index f091723774..54674eb396 100644
--- a/mkspecs/macx-ios-clang/features/sdk.prf
+++ b/mkspecs/features/uikit/sdk.prf
@@ -1,8 +1,8 @@
# In case the user sets the SDK manually
contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*) {
- contains(QT_CONFIG, simulator_and_device): \
- error("iOS simulator is handled automatically for simulator_and_device")
+ !isEmpty(QT_VERSION):qtConfig(simulator_and_device): \
+ error("Simulator is handled automatically for simulator_and_device")
CONFIG += simulator $${simulator.sdk}
}
diff --git a/mkspecs/macx-ios-clang/features/testcase.prf b/mkspecs/features/uikit/testcase.prf
index e16c163ffa..e16c163ffa 100644
--- a/mkspecs/macx-ios-clang/features/testcase.prf
+++ b/mkspecs/features/uikit/testcase.prf
diff --git a/mkspecs/macx-ios-clang/features/testcase_targets.prf b/mkspecs/features/uikit/testcase_targets.prf
index e0a2922c3f..e0a2922c3f 100644
--- a/mkspecs/macx-ios-clang/features/testcase_targets.prf
+++ b/mkspecs/features/uikit/testcase_targets.prf
diff --git a/mkspecs/macx-ios-clang/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk
index 0036799b33..0b3ad632b6 100644
--- a/mkspecs/macx-ios-clang/xcodebuild.mk
+++ b/mkspecs/features/uikit/xcodebuild.mk
@@ -40,41 +40,42 @@ $(EXPORT_SUBTARGETS): % : %-build
%-install: ACTION = install
%-install: xcodebuild-% ;
-# iOS Simulator doesn't support archiving
-%-iphonesimulator-install: ACTION = build
-iphonesimulator-install: ACTION = build
+# Simulator doesn't support archiving
+%-simulator-install: ACTION = build
+simulator-install: ACTION = build
# Limit check to a single configuration
-%-iphoneos-check: check-iphoneos ;
-%-iphonesimulator-check: check-iphonesimulator ;
+%-device-check: check-device ;
+%-simulator-check: check-simulator ;
# SDK
-%-iphoneos: SDK = iphoneos
-%-iphonesimulator: SDK = iphonesimulator
+%-device: SDK = $(DEVICE_SDK)
+%-simulator: SDK = $(SIMULATOR_SDK)
# Configuration
release-%: CONFIGURATION = Release
debug-%: CONFIGURATION = Debug
-SPECDIR := $(dir $(lastword $(MAKEFILE_LIST)))
+MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
# Test and build (device) destinations
ifneq ($(filter check%,$(MAKECMDGOALS)),)
ifeq ($(DEVICES),)
$(info Enumerating test destinations (you may override this by setting DEVICES explicitly), please wait...)
- DESTINATIONS_INCLUDE = /tmp/ios_destinations.mk
- $(shell $(SPECDIR)/ios_destinations.sh $(TARGET) > $(DESTINATIONS_INCLUDE))
+ DESTINATIONS_INCLUDE = /tmp/device_destinations.mk
+ $(shell $(MAKEFILE_DIR)device_destinations.sh '$(EXPORT_DEVICE_FILTER)' $(TARGET) > $(DESTINATIONS_INCLUDE))
include $(DESTINATIONS_INCLUDE)
endif
endif
-%-iphonesimulator: DEVICES = $(firstword $(IPHONESIMULATOR_DEVICES))
-%-iphoneos: DEVICES = $(IPHONEOS_DEVICES)
+%-simulator: DEVICES = $(firstword $(SIMULATOR_DEVICES))
+%-device: DEVICES = $(HARDWARE_DEVICES)
-IPHONEOS_GENERIC_DESTINATION := "generic/platform=iOS"
-IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell $(SPECDIR)/ios_devices.pl "iPhone|iPad" "NOT unavailable" | tail -n 1)"
+GENERIC_DEVICE_DESTINATION := $(EXPORT_GENERIC_DEVICE_DESTINATION)
+GENERIC_SIMULATOR_DESTINATION := "id=$(shell $(MAKEFILE_DIR)devices.pl '$(EXPORT_DEVICE_FILTER)' "NOT unavailable" | tail -n 1)"
-DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(value $(call toupper,$(call basesdk,$(SDK)))_GENERIC_DESTINATION))
+%-simulator: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_SIMULATOR_DESTINATION))
+%-device: DESTINATION = $(if $(DESTINATION_ID),"id=$(DESTINATION_ID)",$(GENERIC_DEVICE_DESTINATION))
XCODE_VERSION_MAJOR := $(shell xcodebuild -version | grep Xcode | sed -e 's/Xcode //' | sed -e 's/\..*//')
@@ -89,7 +90,7 @@ DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \
xcodebuild-%:
@$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),)
- xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,)
+ xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@))
diff --git a/mkspecs/macx-ios-clang/features/xcodebuild.prf b/mkspecs/features/uikit/xcodebuild.prf
index b897432a43..82bcd9a315 100644
--- a/mkspecs/macx-ios-clang/features/xcodebuild.prf
+++ b/mkspecs/features/uikit/xcodebuild.prf
@@ -33,7 +33,23 @@ QMAKE_EXTRA_VARIABLES += SUBTARGETS
CONFIG += no_default_goal_deps
-QMAKE_EXTRA_INCLUDES += $$shell_quote($$QMAKESPEC/xcodebuild.mk)
+DEVICE_SDK = $${device.sdk}
+SIMULATOR_SDK = $${simulator.sdk}
+ios {
+ DEVICE_FILTER = "iPhone|iPad"
+ GENERIC_DEVICE_DESTINATION = "generic/platform=iOS"
+}
+tvos {
+ DEVICE_FILTER = "Apple TV"
+ GENERIC_DEVICE_DESTINATION = "generic/platform=tvOS"
+}
+watchos {
+ DEVICE_FILTER = "Apple Watch"
+ GENERIC_DEVICE_DESTINATION = "generic/platform=watchOS"
+}
+QMAKE_EXTRA_VARIABLES += DEVICE_SDK SIMULATOR_SDK DEVICE_FILTER GENERIC_DEVICE_DESTINATION
+
+QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/xcodebuild.mk)
# Distclean
diff --git a/mkspecs/features/unix/opengl.prf b/mkspecs/features/unix/opengl.prf
index 123c647be2..72b5ac453d 100644
--- a/mkspecs/features/unix/opengl.prf
+++ b/mkspecs/features/unix/opengl.prf
@@ -1,4 +1,4 @@
-contains(QT_CONFIG, opengles2) {
+qtConfig(opengles2) {
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
!isEmpty(QMAKE_LIBDIR_OPENGL_ES2):QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2
target_qt:LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2
diff --git a/mkspecs/features/unix/openvg.prf b/mkspecs/features/unix/openvg.prf
index 29acec18ff..500dfc50c6 100644
--- a/mkspecs/features/unix/openvg.prf
+++ b/mkspecs/features/unix/openvg.prf
@@ -2,13 +2,13 @@
!isEmpty(QMAKE_LIBDIR_OPENVG): QMAKE_LIBDIR += -L$$QMAKE_LIBDIR_OPENVG
!isEmpty(QMAKE_LIBS_OPENVG): LIBS += $$QMAKE_LIBS_OPENVG
-contains(QT_CONFIG, egl) {
+qtConfig(egl) {
!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
!isEmpty(QMAKE_LIBDIR_EGL): LIBS += -L$$QMAKE_LIBDIR_EGL
!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
}
-contains(QT_CONFIG, openvg_on_opengl) {
+qtConfig(openvg_on_opengl) {
!isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
!isEmpty(QMAKE_LIBDIR_OPENGL): QMAKE_LIBDIR += -L$$QMAKE_LIBDIR_OPENGL
!isEmpty(QMAKE_LIBS_OPENGL): LIBS += $$QMAKE_LIBS_OPENGL
diff --git a/mkspecs/features/win32/console.prf b/mkspecs/features/win32/console.prf
index 629f3af59b..739bb0e01b 100644
--- a/mkspecs/features/win32/console.prf
+++ b/mkspecs/features/win32/console.prf
@@ -1,6 +1,5 @@
CONFIG -= windows
-QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX)
+QMAKE_LFLAGS += $$QMAKE_LFLAGS_CONSOLE
contains(TEMPLATE, ".*app") {
- wince: QMAKE_LFLAGS += /ENTRY:mainACRTStartup
QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE
}
diff --git a/mkspecs/features/win32/opengl.prf b/mkspecs/features/win32/opengl.prf
index 8173348bc4..ebc29d0923 100644
--- a/mkspecs/features/win32/opengl.prf
+++ b/mkspecs/features/win32/opengl.prf
@@ -1,32 +1,21 @@
-# WinCE does not have a platform directory for .prf files, and the
-# win32 directory is searched for .prfs by qmake on WinCE. Ideally
-# there should be a features/wince/opengl.prf which contains the wince
-# block below.
-
-wince* {
- include(../unix/opengl.prf)
-} else {
- contains(QT_CONFIG, opengles2) {
-# For Desktop, use the ANGLE library location passed on from configure.
- INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
- CONFIG(debug, debug|release) {
- QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_DEBUG
- contains(QT_CONFIG, angle) {
- LIBS += $$QMAKE_LIBS_OPENGL_ES2_DEBUG
- } else {
- LIBS += $$QMAKE_LIBS_OPENGL_ES2
- }
+qtConfig(opengles2) {
+# For Desktop, use the ANGLE library location passed on from configure.
+ INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
+ CONFIG(debug, debug|release) {
+ QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_DEBUG
+ qtConfig(angle) {
+ LIBS += $$QMAKE_LIBS_OPENGL_ES2_DEBUG
} else {
LIBS += $$QMAKE_LIBS_OPENGL_ES2
- QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_RELEASE
}
- DEFINES += QT_OPENGL_ES_2 QT_OPENGL_ES_2_ANGLE
- contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC GL_APICALL= EGLAPI=
- QT_CONFIG -= opengl
} else {
- !contains(QT_CONFIG, dynamicgl) {
- QMAKE_LIBS += $$QMAKE_LIBS_OPENGL
- QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL
- }
+ LIBS += $$QMAKE_LIBS_OPENGL_ES2
+ QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2_RELEASE
+ }
+ qtConfig(static): DEFINES += GL_APICALL= EGLAPI=
+} else {
+ !qtConfig(dynamicgl) {
+ QMAKE_LIBS += $$QMAKE_LIBS_OPENGL
+ QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL
}
}
diff --git a/mkspecs/features/win32/openvg.prf b/mkspecs/features/win32/openvg.prf
index 0df5b6621a..9d9a49d856 100644
--- a/mkspecs/features/win32/openvg.prf
+++ b/mkspecs/features/win32/openvg.prf
@@ -1,7 +1,7 @@
QMAKE_LIBS += $$QMAKE_LIBS_OPENVG
QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENVG
-contains(QT_CONFIG, openvg_on_opengl) {
+qtConfig(openvg_on_opengl) {
QMAKE_LIBS += $$QMAKE_LIBS_OPENGL
QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL
}
diff --git a/mkspecs/features/win32/qt_config.prf b/mkspecs/features/win32/qt_config.prf
deleted file mode 100644
index 49b4c79431..0000000000
--- a/mkspecs/features/win32/qt_config.prf
+++ /dev/null
@@ -1,10 +0,0 @@
-load(qt_config)
-
-equals(QMAKE_TARGET_OS, xp) {
- # http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx?PageIndex=3
- equals(QT_ARCH, x86_64) {
- QMAKE_SUBSYSTEM_SUFFIX = ,5.02
- } else {
- QMAKE_SUBSYSTEM_SUFFIX = ,5.01
- }
-}
diff --git a/mkspecs/features/win32/windows.prf b/mkspecs/features/win32/windows.prf
index 986067fc8c..ecb167bf18 100644
--- a/mkspecs/features/win32/windows.prf
+++ b/mkspecs/features/win32/windows.prf
@@ -1,5 +1,5 @@
CONFIG -= console
-QMAKE_LFLAGS += $$replace(QMAKE_LFLAGS_WINDOWS, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX)
+QMAKE_LFLAGS += $$QMAKE_LFLAGS_WINDOWS
contains(TEMPLATE, ".*app") {
QMAKE_LFLAGS += $$QMAKE_LFLAGS_EXE
mingw:DEFINES += QT_NEEDS_QMAIN
diff --git a/mkspecs/features/winrt/default_pre.prf b/mkspecs/features/winrt/default_pre.prf
index 8299950d8b..f397ef3d61 100644
--- a/mkspecs/features/winrt/default_pre.prf
+++ b/mkspecs/features/winrt/default_pre.prf
@@ -1,12 +1,14 @@
*msvc2015 {
- # Note that the order is important, ucrt(d) has to be first
- # Otherwise the linker might use malloc from a different library
- # but free_dbg() from the runtime, causing assert when deleting
- # items from different heaps
+ # Note that the order is important - ucrt(d) has to be first.
+ # Otherwise, the linker might use malloc from a different library,
+ # but free_dbg() from the runtime, causing an assertion failure
+ # due to deleting an item from a different heap.
+ # vcruntime(d) is necessary when we don't link to any libraries
+ # which would pull it in transitively.
CONFIG(debug, debug|release): \
- QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS
+ QMAKE_LIBS = ucrtd.lib vcruntimed.lib $$QMAKE_LIBS
else: \
- QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
+ QMAKE_LIBS = ucrt.lib vcruntime.lib $$QMAKE_LIBS
}
equals(TEMPLATE, "vcapp"): CONFIG += windeployqt
diff --git a/mkspecs/hurd-g++/qmake.conf b/mkspecs/hurd-g++/qmake.conf
index f2e3242627..fc6ef779fc 100644
--- a/mkspecs/hurd-g++/qmake.conf
+++ b/mkspecs/hurd-g++/qmake.conf
@@ -36,10 +36,6 @@ QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
QMAKE_LIBS_OPENVG = -lOpenVG
QMAKE_LIBS_THREAD = -lpthread
-QMAKE_CFLAGS_XCB =
-QMAKE_LIBS_XCB =
-QMAKE_DEFINES_XCB =
-
QMAKE_AR = ar cqs
QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
diff --git a/mkspecs/integrity-armv7-imx6/qmake.conf b/mkspecs/integrity-armv7-imx6/qmake.conf
index 7a1ee461f2..3bf2abd844 100644
--- a/mkspecs/integrity-armv7-imx6/qmake.conf
+++ b/mkspecs/integrity-armv7-imx6/qmake.conf
@@ -4,7 +4,6 @@
include(../common/ghs-integrity-armv7.conf)
-DEFINES += QT_NO_CLIPBOARD
DEFINES += QT_STATICPLUGIN
QTPLUGIN.platforms += qeglfs qeglfs-viv-integration
diff --git a/mkspecs/integrity-armv7/qmake.conf b/mkspecs/integrity-armv7/qmake.conf
index 0cac2ebdc0..7a2ffaba14 100644
--- a/mkspecs/integrity-armv7/qmake.conf
+++ b/mkspecs/integrity-armv7/qmake.conf
@@ -4,7 +4,6 @@
include(../common/ghs-integrity-armv7.conf)
-DEFINES += QT_NO_CLIPBOARD
DEFINES += QT_STATICPLUGIN
QTPLUGIN.platforms += integrityfb
diff --git a/mkspecs/integrity-x86/qmake.conf b/mkspecs/integrity-x86/qmake.conf
index 4a5cfcc49d..13d4a6c082 100644
--- a/mkspecs/integrity-x86/qmake.conf
+++ b/mkspecs/integrity-x86/qmake.conf
@@ -5,7 +5,6 @@
include(../common/ghs-integrity-x86.conf)
QMAKE_CFLAGS += -cpu=Corei
-DEFINES += QT_NO_CLIPBOARD
DEFINES += QT_STATICPLUGIN
QTPLUGIN.platforms += integrityfb
diff --git a/mkspecs/macx-clang-32/qmake.conf b/mkspecs/macx-clang-32/qmake.conf
index f962163c26..ba3c7cab6c 100644
--- a/mkspecs/macx-clang-32/qmake.conf
+++ b/mkspecs/macx-clang-32/qmake.conf
@@ -2,16 +2,12 @@
# qmake configuration for 32-bit Clang on OS X
#
-MAKEFILE_GENERATOR = UNIX
-CONFIG += app_bundle incremental global_init_link_order lib_version_first
-QMAKE_INCREMENTAL_STYLE = sublib
-
include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/clang.conf)
include(../common/clang-mac.conf)
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
QMAKE_CFLAGS += -arch i386
QMAKE_CXXFLAGS += -arch i386
diff --git a/mkspecs/macx-clang/qmake.conf b/mkspecs/macx-clang/qmake.conf
index 93a7c8b271..4d56d771a1 100644
--- a/mkspecs/macx-clang/qmake.conf
+++ b/mkspecs/macx-clang/qmake.conf
@@ -2,15 +2,11 @@
# qmake configuration for Clang on OS X
#
-MAKEFILE_GENERATOR = UNIX
-CONFIG += app_bundle incremental global_init_link_order lib_version_first
-QMAKE_INCREMENTAL_STYLE = sublib
-
include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/clang.conf)
include(../common/clang-mac.conf)
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
load(qt_config)
diff --git a/mkspecs/macx-g++-32/qmake.conf b/mkspecs/macx-g++-32/qmake.conf
index c0fc8e0007..3cd707d537 100644
--- a/mkspecs/macx-g++-32/qmake.conf
+++ b/mkspecs/macx-g++-32/qmake.conf
@@ -14,7 +14,7 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf)
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
QMAKE_CFLAGS += -arch i386
QMAKE_CXXFLAGS += -arch i386
diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf
index b0134f72e7..5b3105c668 100644
--- a/mkspecs/macx-g++/qmake.conf
+++ b/mkspecs/macx-g++/qmake.conf
@@ -14,6 +14,6 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf)
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
load(qt_config)
diff --git a/mkspecs/macx-g++40/qmake.conf b/mkspecs/macx-g++40/qmake.conf
index 400be1cd8f..308cc2007c 100644
--- a/mkspecs/macx-g++40/qmake.conf
+++ b/mkspecs/macx-g++40/qmake.conf
@@ -14,7 +14,7 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf)
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
QMAKE_CC = gcc-4.0
QMAKE_CXX = g++-4.0
diff --git a/mkspecs/macx-g++42/qmake.conf b/mkspecs/macx-g++42/qmake.conf
index 6485124ba6..b24cb7f3f3 100644
--- a/mkspecs/macx-g++42/qmake.conf
+++ b/mkspecs/macx-g++42/qmake.conf
@@ -14,7 +14,7 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/g++-macx.conf)
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
QMAKE_CC = gcc-4.2
QMAKE_CXX = g++-4.2
diff --git a/mkspecs/macx-ios-clang/Info.plist.lib b/mkspecs/macx-ios-clang/Info.plist.lib
index 2a44d1721e..7cbdb9af12 100644
--- a/mkspecs/macx-ios-clang/Info.plist.lib
+++ b/mkspecs/macx-ios-clang/Info.plist.lib
@@ -14,6 +14,8 @@
<string>@TYPEINFO@</string>
<key>CFBundleExecutable</key>
<string>@LIBRARY@</string>
+ <key>CFBundleIdentifier</key>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>Please, do NOT change this file -- It was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf
deleted file mode 100644
index e5c78a0ea4..0000000000
--- a/mkspecs/macx-ios-clang/features/default_post.prf
+++ /dev/null
@@ -1,97 +0,0 @@
-
-equals(TEMPLATE, app):contains(CONFIG, qt) {
- # If the application uses Qt, it needs to be an application bundle
- # to be able to deploy and run on iOS. The only exception to this
- # is if you're working with a jailbroken device and can run the
- # resulting binary from the console/over SSH, but that's not a
- # use-case we care about, so no need to complicate the logic.
- CONFIG *= app_bundle
-
- # For Qt applications we want Xcode project files as the generated output,
- # but since qmake doesn't handle the transition between makefiles and Xcode
- # project files (which happens when using subdirs), we can't just override
- # MAKEFILE_GENERATOR. Instead, we generate the Xcode project by spawning a
- # child qmake process with -spec macx-xcode and let the top level qmake
- # process generate a wrapper makefile that forwards everything to xcodebuild.
- equals(MAKEFILE_GENERATOR, UNIX): \
- CONFIG = xcodebuild $$CONFIG
-}
-
-load(default_post)
-
-macx-xcode {
- ios_device_family.name = TARGETED_DEVICE_FAMILY
- ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY
- QMAKE_MAC_XCODE_SETTINGS += ios_device_family
-
- # If QMAKE_BUNDLE_DATA contains an asset catalog that includes an
- # AppIcon.appiconset, we configure Xcode to use it for app icons.
- for(bundle_data, QMAKE_BUNDLE_DATA) {
- for(bundle_file, $${bundle_data}.files) {
- !contains(bundle_file, .*\.xcassets$): next()
- !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()
-
- asset_catalog_appicon.name = "ASSETCATALOG_COMPILER_APPICON_NAME"
- asset_catalog_appicon.value = "AppIcon"
- QMAKE_MAC_XCODE_SETTINGS += asset_catalog_appicon
- break()
- }
- !isEmpty(asset_catalog_appicon.name): break()
- }
-
- # Set up default 4-inch iPhone/iPod launch image so that our apps
- # support the full screen resolution of those devices.
- qmake_launch_image = Default-568h@2x.png
- qmake_copy_image.input = $$QMAKESPEC/$$qmake_launch_image
- qmake_copy_image.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_image
- qmake_copy_image.CONFIG = verbatim
- QMAKE_SUBSTITUTES += qmake_copy_image
- qmake_launch_images.files = $$qmake_copy_image.output
- QMAKE_BUNDLE_DATA += qmake_launch_images
-
- lessThan(QMAKE_XCODE_VERSION, "6.0") {
- warning("You need to update Xcode to version 6 or newer to fully support iPhone6/6+")
- } else {
- # Set up default LaunchScreen to support iPhone6/6+
- qmake_launch_screen = LaunchScreen.xib
- qmake_copy_launch_screen.input = $$QMAKESPEC/$$qmake_launch_screen
- qmake_copy_launch_screen.output = $$OUT_PWD/$${TARGET}.xcodeproj/$$qmake_launch_screen
- QMAKE_SUBSTITUTES += qmake_copy_launch_screen
- qmake_launch_screens.files = $$qmake_copy_launch_screen.output
- QMAKE_BUNDLE_DATA += qmake_launch_screens
- }
-}
-
-macx-xcode {
- arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
- arch_device.value = $$QMAKE_IOS_DEVICE_ARCHS
- arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
- arch_simulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS
-
- QMAKE_MAC_XCODE_SETTINGS += arch_device arch_simulator
- QMAKE_XCODE_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS
-
- only_active_arch.name = ONLY_ACTIVE_ARCH
- only_active_arch.value = YES
- only_active_arch.build = debug
- QMAKE_MAC_XCODE_SETTINGS += only_active_arch
-} else {
- # Be more specific about which architecture we're targeting
- contains(QT_ARCH, arm.*): \
- VALID_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS
- else: \
- VALID_ARCHS = $$QMAKE_IOS_SIMULATOR_ARCHS
-
- single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
-
- ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
- ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
-
- QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
-
- arch_flags = $(EXPORT_ARCH_ARGS)
-
- QMAKE_CFLAGS += $$arch_flags
- QMAKE_CXXFLAGS += $$arch_flags
- QMAKE_LFLAGS += $$arch_flags
-}
diff --git a/mkspecs/macx-ios-clang/features/default_pre.prf b/mkspecs/macx-ios-clang/features/default_pre.prf
deleted file mode 100644
index 977ac9acb2..0000000000
--- a/mkspecs/macx-ios-clang/features/default_pre.prf
+++ /dev/null
@@ -1,21 +0,0 @@
-
-load(default_pre)
-
-# In case Qt was built for a specific SDK
-!contains(QT_CONFIG, simulator_and_device):contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
- CONFIG += simulator $${simulator.sdk}
-
-# Check for supported Xcode versions
-lessThan(QMAKE_XCODE_VERSION, "4.3"): \
- error("This mkspec requires Xcode 4.3 or later")
-
-build_pass:simulator {
- # For a simulator_and_device build all the config tests
- # are based on the iPhoneOS ARM SDK, but we know that the simulator
- # is i386 and that we support SSE/SSE2.
- QT_ARCH = i386
- QT_CPU_FEATURES.i386 = sse sse2
- DEFINES += QT_COMPILER_SUPPORTS_SSE2
- CONFIG -= neon
- CONFIG += sse sse2
-}
diff --git a/mkspecs/macx-ios-clang/features/resolve_config.prf b/mkspecs/macx-ios-clang/features/resolve_config.prf
deleted file mode 100644
index c3ab90f45e..0000000000
--- a/mkspecs/macx-ios-clang/features/resolve_config.prf
+++ /dev/null
@@ -1,68 +0,0 @@
-
-xcodebuild {
- # Xcode project files always support both Debug and Release configurations
- # and iOS device and simulator targets, so we make sure the wrapper-makefile
- # also does.
- CONFIG += debug_and_release simulator_and_device
-}
-
-load(resolve_config)
-
-# Legacy exclusive build configurations for backwards compatibility
-CONFIG($${device.CONFIG}, $${device.CONFIG}|$${simulator.CONFIG}): \
- CONFIG += device
-else: CONFIG($${simulator.CONFIG}, $${device.CONFIG}|$${simulator.CONFIG}): \
- CONFIG += simulator
-
-CONFIG(simulator, simulator|device): \
- CONFIG -= device $${device.CONFIG}
-else: \
- CONFIG -= simulator $${simulator.CONFIG}
-
-macx-xcode {
- # There is no way to genereate Xcode projects that are limited to either
- # simulator or device builds, so simulator_and_device is always
- # effectivly active, even if the user disabled it explicitly.
- # The Xcode generator doesn't support multiple BUILDS though (exclusive
- # builds), so we have to manually set up the simulator suffix.
- library_suffix_simulator.name = "$${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING}[sdk=$${simulator.sdk}*]"
- library_suffix_simulator.value = "_$${simulator.sdk}$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})"
- QMAKE_MAC_XCODE_SETTINGS += library_suffix_simulator
- CONFIG *= xcode_dynamic_library_suffix
-} else {
- addExclusiveBuilds(simulator, device)
-}
-
-equals(TEMPLATE, subdirs) {
- # Prevent recursion into host_builds
- for(subdir, SUBDIRS) {
- contains($${subdir}.CONFIG, host_build) {
- $${subdir}.CONFIG += no_$${simulator.target}_target no_$${device.target}_target
-
- # Other targets which we do want to recurse into may depend on this target,
- # for example corelib depends on moc, rcc, bootstrap, etc, and other libs
- # may depend on host-tools that are needed to build the lib, so we resolve
- # the final target name and redirect it to the base target, so that the
- # dependency chain is not broken for the other targets.
-
- !isEmpty($${subdir}.target) {
- target = $$eval($${subdir}.target)
- } else {
- !isEmpty($${subdir}.file): \
- file = $$eval($${subdir}.file)
- else: !isEmpty($${subdir}.subdir): \
- file = $$eval($${subdir}.subdir)
- else: \
- file = $$subdir
-
- target = sub-$$file
- }
-
- target ~= s,[^a-zA-Z0-9_],-,
-
- $${target}-$${simulator.target}.depends = $$target
- $${target}-$${device.target}.depends = $$target
- QMAKE_EXTRA_TARGETS += $${target}-$${simulator.target} $${target}-$${device.target}
- }
- }
-}
diff --git a/mkspecs/macx-ios-clang/qmake.conf b/mkspecs/macx-ios-clang/qmake.conf
index 9b145c2b03..e21445deb7 100644
--- a/mkspecs/macx-ios-clang/qmake.conf
+++ b/mkspecs/macx-ios-clang/qmake.conf
@@ -2,21 +2,13 @@
# qmake configuration for macx-ios-clang
#
-MAKEFILE_GENERATOR = UNIX
-CONFIG += app_bundle reduce_exports incremental global_init_link_order lib_version_first sdk
-QMAKE_INCREMENTAL_STYLE = sublib
-
-QMAKE_MACOSX_DEPLOYMENT_TARGET =
-QMAKE_IOS_DEPLOYMENT_TARGET = 6.0
-
-INCLUDEPATH += $$PWD/ios
-DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG
+QMAKE_IOS_DEPLOYMENT_TARGET = 7.0
# Universal target (iPhone and iPad)
-QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2
+QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1,2
-QMAKE_IOS_DEVICE_ARCHS = armv7 arm64
-QMAKE_IOS_SIMULATOR_ARCHS = i386 x86_64
+QMAKE_APPLE_DEVICE_ARCHS = armv7 arm64
+QMAKE_APPLE_SIMULATOR_ARCHS = i386 x86_64
include(../common/ios.conf)
include(../common/gcc-base-mac.conf)
diff --git a/mkspecs/macx-llvm/qmake.conf b/mkspecs/macx-llvm/qmake.conf
index 1c90cdf273..0434d29b50 100644
--- a/mkspecs/macx-llvm/qmake.conf
+++ b/mkspecs/macx-llvm/qmake.conf
@@ -14,7 +14,7 @@ include(../common/macx.conf)
include(../common/gcc-base-mac.conf)
include(../common/llvm.conf)
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
+QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvmgcc42
diff --git a/mkspecs/macx-tvos-clang/Info.plist.app b/mkspecs/macx-tvos-clang/Info.plist.app
new file mode 100644
index 0000000000..618989d63d
--- /dev/null
+++ b/mkspecs/macx-tvos-clang/Info.plist.app
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Created by Qt/QMake</string>
+ <key>CFBundleSignature</key>
+ <string>@TYPEINFO@</string>
+ <key>CFBundleExecutable</key>
+ <string>@EXECUTABLE@</string>
+ <key>CFBundleIdentifier</key>
+ <string>@BUNDLEIDENTIFIER@</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>CFBundleIcons</key>
+ <dict>
+ <key>CFBundlePrimaryIcon</key>
+ <string>App Icon - Small</string>
+ </dict>
+ <key>CFBundleSupportedPlatforms</key>
+ <array>
+ <string>AppleTVOS</string>
+ </array>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>MinimumOSVersion</key>
+ <string>9.1</string>
+ <key>NOTE</key>
+ <string>This file was generated by Qt/QMake.</string>
+</dict>
+</plist>
diff --git a/mkspecs/macx-tvos-clang/Info.plist.lib b/mkspecs/macx-tvos-clang/Info.plist.lib
new file mode 100644
index 0000000000..7cbdb9af12
--- /dev/null
+++ b/mkspecs/macx-tvos-clang/Info.plist.lib
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Created by Qt/QMake</string>
+ <key>CFBundleSignature</key>
+ <string>@TYPEINFO@</string>
+ <key>CFBundleExecutable</key>
+ <string>@LIBRARY@</string>
+ <key>CFBundleIdentifier</key>
+ <string>@BUNDLEIDENTIFIER@</string>
+ <key>NOTE</key>
+ <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string>
+</dict>
+</plist>
diff --git a/mkspecs/macx-tvos-clang/qmake.conf b/mkspecs/macx-tvos-clang/qmake.conf
new file mode 100644
index 0000000000..e945cc9d28
--- /dev/null
+++ b/mkspecs/macx-tvos-clang/qmake.conf
@@ -0,0 +1,21 @@
+#
+# qmake configuration for macx-tvos-clang
+#
+
+QMAKE_TVOS_DEPLOYMENT_TARGET = 9.1
+
+INCLUDEPATH += $$PWD/tvos
+
+QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 3
+
+QMAKE_APPLE_DEVICE_ARCHS = arm64
+QMAKE_APPLE_SIMULATOR_ARCHS = x86_64
+
+include(../common/tvos.conf)
+include(../common/gcc-base-mac.conf)
+include(../common/clang.conf)
+include(../common/clang-mac.conf)
+include(../common/ios/clang.conf)
+include(../common/ios/qmake.conf)
+
+load(qt_config)
diff --git a/mkspecs/macx-tvos-clang/qplatformdefs.h b/mkspecs/macx-tvos-clang/qplatformdefs.h
new file mode 100644
index 0000000000..68020de6d5
--- /dev/null
+++ b/mkspecs/macx-tvos-clang/qplatformdefs.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qmake spec 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 "../common/mac/qplatformdefs.h"
diff --git a/mkspecs/macx-watchos-clang/Info.plist.app b/mkspecs/macx-watchos-clang/Info.plist.app
new file mode 100644
index 0000000000..cceb9c5b5a
--- /dev/null
+++ b/mkspecs/macx-watchos-clang/Info.plist.app
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Created by Qt/QMake</string>
+ <key>CFBundleSignature</key>
+ <string>@TYPEINFO@</string>
+ <key>CFBundleExecutable</key>
+ <string>@EXECUTABLE@</string>
+ <key>CFBundleIdentifier</key>
+ <string>@BUNDLEIDENTIFIER@</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ </array>
+ <key>WKWatchKitApp</key>
+ <true/>
+ <key>NOTE</key>
+ <string>This file was generated by Qt/QMake.</string>
+</dict>
+</plist>
diff --git a/mkspecs/macx-watchos-clang/Info.plist.lib b/mkspecs/macx-watchos-clang/Info.plist.lib
new file mode 100644
index 0000000000..7cbdb9af12
--- /dev/null
+++ b/mkspecs/macx-watchos-clang/Info.plist.lib
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@SHORT_VERSION@</string>
+ <key>CFBundleVersion</key>
+ <string>@FULL_VERSION@</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Created by Qt/QMake</string>
+ <key>CFBundleSignature</key>
+ <string>@TYPEINFO@</string>
+ <key>CFBundleExecutable</key>
+ <string>@LIBRARY@</string>
+ <key>CFBundleIdentifier</key>
+ <string>@BUNDLEIDENTIFIER@</string>
+ <key>NOTE</key>
+ <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string>
+</dict>
+</plist>
diff --git a/mkspecs/macx-watchos-clang/qmake.conf b/mkspecs/macx-watchos-clang/qmake.conf
new file mode 100644
index 0000000000..03c05ad717
--- /dev/null
+++ b/mkspecs/macx-watchos-clang/qmake.conf
@@ -0,0 +1,21 @@
+#
+# qmake configuration for macx-watchos-clang
+#
+
+QMAKE_WATCHOS_DEPLOYMENT_TARGET = 2.2
+
+INCLUDEPATH += $$PWD/watchos
+
+QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 4
+
+QMAKE_APPLE_DEVICE_ARCHS = armv7k
+QMAKE_APPLE_SIMULATOR_ARCHS = i386
+
+include(../common/watchos.conf)
+include(../common/gcc-base-mac.conf)
+include(../common/clang.conf)
+include(../common/clang-mac.conf)
+include(../common/ios/clang.conf)
+include(../common/ios/qmake.conf)
+
+load(qt_config)
diff --git a/mkspecs/macx-watchos-clang/qplatformdefs.h b/mkspecs/macx-watchos-clang/qplatformdefs.h
new file mode 100644
index 0000000000..965eb5e97b
--- /dev/null
+++ b/mkspecs/macx-watchos-clang/qplatformdefs.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qmake spec 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 "../common/mac/qplatformdefs.h"
diff --git a/mkspecs/qnx-aarch64le-qcc/qmake.conf b/mkspecs/qnx-aarch64le-qcc/qmake.conf
index 8e229d360b..5e3123bece 100644
--- a/mkspecs/qnx-aarch64le-qcc/qmake.conf
+++ b/mkspecs/qnx-aarch64le-qcc/qmake.conf
@@ -2,13 +2,13 @@
# qmake configuration for qnx aarch64le systems
#
-DEFINES += QT_NO_CLIPBOARD _FORTIFY_SOURCE=2
+DEFINES += _FORTIFY_SOURCE=2
QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now
include(../common/qcc-base-qnx-aarch64le.conf)
-contains(QT_CONFIG, stack-protector-strong) {
+qtConfig(stack-protector-strong) {
QMAKE_CFLAGS += -fstack-protector-strong
QMAKE_CXXFLAGS += -fstack-protector-strong
} else {
diff --git a/mkspecs/qnx-armle-v7-qcc/qmake.conf b/mkspecs/qnx-armle-v7-qcc/qmake.conf
index b77455044c..a21e5bcad3 100644
--- a/mkspecs/qnx-armle-v7-qcc/qmake.conf
+++ b/mkspecs/qnx-armle-v7-qcc/qmake.conf
@@ -3,5 +3,3 @@
#
include(../common/qcc-base-qnx-armle-v7.conf)
-
-DEFINES += QT_NO_CLIPBOARD
diff --git a/mkspecs/qnx-x86-64-qcc/qmake.conf b/mkspecs/qnx-x86-64-qcc/qmake.conf
index f1760e4072..2a01ed1405 100644
--- a/mkspecs/qnx-x86-64-qcc/qmake.conf
+++ b/mkspecs/qnx-x86-64-qcc/qmake.conf
@@ -2,13 +2,11 @@
# qmake configuration for qnx x86-64 systems
#
-DEFINES += QT_NO_CLIPBOARD
-
QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now
include(../common/qcc-base-qnx-x86-64.conf)
-contains(QT_CONFIG, stack-protector-strong) {
+qtConfig(stack-protector-strong) {
QMAKE_CFLAGS += -fstack-protector-strong
QMAKE_CXXFLAGS += -fstack-protector-strong
} else {
diff --git a/mkspecs/qnx-x86-qcc/qmake.conf b/mkspecs/qnx-x86-qcc/qmake.conf
index 36a3ba2ff3..3daadf4f02 100644
--- a/mkspecs/qnx-x86-qcc/qmake.conf
+++ b/mkspecs/qnx-x86-qcc/qmake.conf
@@ -3,5 +3,3 @@
#
include(../common/qcc-base-qnx-x86.conf)
-
-DEFINES += QT_NO_CLIPBOARD
diff --git a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf b/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf
deleted file mode 100644
index fb16348487..0000000000
--- a/mkspecs/wince60standard-armv4i-msvc2005/qmake.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# qmake configuration for wince-msvc2005
-#
-# Written for Microsoft VS 2005 for WindowsCE 6.0 (ARMV4I)
-# This is just a template for creating Windows CE 6 mkspecs.
-#
-
-include(../common/wince/qmake.conf)
-
-CE_SDK = STANDARDSDK_600 # replace with actual SDK name
-CE_ARCH = ARMV4I
-
-DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _ARMV4I_ armv4i _ARM_ ARM _M_ARM ARM _WIN32 __arm__
-
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB
-QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /DLL /SAFESEH:NO
-QMAKE_LIBFLAGS_RELEASE = /LTCG
-QMAKE_LIBS = corelibc.lib coredll.lib
-QMAKE_LIBS_CORE = libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib
-QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE
-QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_COMPAT =
-
-QMAKE_RC = rc /DUNDER_CE=600 /D_WIN32_WCE=0x600
-
diff --git a/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h b/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h
deleted file mode 100644
index 780b7ef124..0000000000
--- a/mkspecs/wince60standard-armv4i-msvc2005/qplatformdefs.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the qmake spec 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 "../common/wince/qplatformdefs.h"
-
diff --git a/mkspecs/wince60standard-x86-msvc2005/qmake.conf b/mkspecs/wince60standard-x86-msvc2005/qmake.conf
deleted file mode 100644
index 417de0d688..0000000000
--- a/mkspecs/wince60standard-x86-msvc2005/qmake.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# qmake configuration for wince-msvc2005
-#
-# Written for Microsoft VS 2005 for WindowsCE 6.0 (x86)
-# This is just a template for creating Windows CE 6 mkspecs.
-#
-
-include(../common/wince/qmake.conf)
-
-CE_SDK = STANDARDSDK_600 # replace with actual SDK name
-CE_ARCH = x86
-
-DEFINES += STANDARDSHELL_UI_MODEL _WIN32_WCE=0x600 $$CE_ARCH _X86_ _M_IX86
-
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86
-QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:X86 /DLL /SAFESEH:NO
-QMAKE_LIBFLAGS_RELEASE = /LTCG
-QMAKE_LIBS = corelibc.lib coredll.lib
-QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib
-QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE
-QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_COMPAT =
-
-QMAKE_RC = rc /DUNDER_CE=600 /D_WIN32_WCE=0x600
-
diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf b/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf
deleted file mode 100644
index 860fbc0e6a..0000000000
--- a/mkspecs/wince70embedded-armv4i-msvc2008/qmake.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-# qmake configuration for Windows Embedded Compact 7 with VS2008 on ARM targets
-#
-# This is just a template for creating WEC7 mkspecs for ARM targets
-# Replace the SDK name with actual SDK name.
-
-include(../common/wince/qmake.conf)
-
-CE_SDK = WEC7_SDK_NAME # replace with actual SDK name
-CE_ARCH = armv4i
-
-DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _AMRV7_ armv7 _ARM_
-
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB
-QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:THUMB /DLL /SAFESEH:NO
-QMAKE_LIBFLAGS_RELEASE = /LTCG
-QMAKE_LIBS = corelibc.lib coredll.lib
-QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib
-QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE
-QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_COMPAT =
-QMAKE_LIBS_OPENVG = libopenvg.lib
-QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib
-
-QMAKE_RC = rc
-
-QMAKE_COMPILER_DEFINES -= _MSC_VER=1400
-QMAKE_COMPILER_DEFINES += _MSC_VER=1500
diff --git a/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h b/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h
deleted file mode 100644
index 780b7ef124..0000000000
--- a/mkspecs/wince70embedded-armv4i-msvc2008/qplatformdefs.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the qmake spec 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 "../common/wince/qplatformdefs.h"
-
diff --git a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf b/mkspecs/wince70embedded-x86-msvc2008/qmake.conf
deleted file mode 100644
index 4d995db332..0000000000
--- a/mkspecs/wince70embedded-x86-msvc2008/qmake.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-# qmake configuration for Windows Embedded Compact 7 with VS2008 platform builder target
-#
-#
-
-include(../common/wince/qmake.conf)
-
-CE_SDK = Platform Builder
-CE_ARCH = _TGTCPU
-
-DEFINES += QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x700 $$CE_ARCH _X86_ _M_IX86
-
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86
-QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,7.00 /MACHINE:X86 /DLL /SAFESEH:NO
-QMAKE_LIBFLAGS_RELEASE = /LTCG
-QMAKE_LIBS = corelibc.lib coredll.lib
-QMAKE_LIBS_CORE = corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib
-QMAKE_LIBS_GUI = ceshell.lib ole32.lib $$QMAKE_LIBS_CORE
-QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI
-QMAKE_LIBS_OPENGL =
-QMAKE_LIBS_COMPAT =
-QMAKE_LIBS_OPENVG = libopenvg.lib
-
-QMAKE_RC = rc
-
-QMAKE_COMPILER_DEFINES -= _MSC_VER=1400
-QMAKE_COMPILER_DEFINES += _MSC_VER=1500
diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
deleted file mode 100644
index 7af1ca828e..0000000000
--- a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
+++ /dev/null
@@ -1,45 +0,0 @@
-# qmake configuration for Windows Embedded Compact 2013 with VS2012 on ARM targets
-#
-# This is just a template for creating WEC2013 mkspecs for ARM targets
-# Replace the SDK name with actual SDK name.
-
-include(../common/wince/qmake.conf)
-
-CE_SDK = Toradex_CE800 # replace with actual SDK name
-CE_ARCH = ARMV7
-CE_PLATFORMNAME = Toradex_CE800
-QT_CONFIG -= accessibility
-
-DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM QT_NO_WINCE_SHELLSDK QT_NO_WINCE_NUIOUSER
-
-#QMAKE_CXXFLAGS += /P
-QMAKE_CFLAGS_RELEASE += -O2 -MT
-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
-QMAKE_CFLAGS_DEBUG += -Zi -MTd
-QMAKE_CFLAGS_RELEASE -= -MD
-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -MD
-QMAKE_CFLAGS_DEBUG -= -MDd
-QMAKE_CXXFLAGS_RELEASE -= -MD
-QMAKE_CXXFLAGS_RELEASE += -MT
-QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -MT
-QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -MD
-QMAKE_CXXFLAGS_DEBUG -= -MDd
-QMAKE_CXXFLAGS_DEBUG += -MTd
-QMAKE_INCDIR_OPENGL_ES2 += $$(NV_WINCE_T2_PLAT)/include
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM
-QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM /DLL /SAFESEH:NO
-QMAKE_LIBFLAGS_RELEASE = /LTCG
-QMAKE_LIBS = coredll.lib
-QMAKE_LIBS_CORE = ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib
-QMAKE_LIBS_GUI = ole32.lib $$QMAKE_LIBS_CORE
-QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI
-QMAKE_LIBS_OPENGL_ES2 = $${LIBEGL_NAME}.lib $${LIBGLESV2_NAME}.lib
-
-MAKEFILE_GENERATOR = MSBUILD
-VCPROJ_EXTENSION = .vcxproj
-
-QMAKE_RC = rc
-
-QMAKE_COMPILER_DEFINES -= _MSC_VER=1400
-QMAKE_COMPILER_DEFINES += _MSC_VER=1700
diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h b/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h
deleted file mode 100644
index 780b7ef124..0000000000
--- a/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the qmake spec 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 "../common/wince/qplatformdefs.h"
-
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix
index 9d3ddab6f9..ffbd0d4545 100644
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -8,8 +8,7 @@ OBJS=project.o option.o property.o main.o ioutils.o proitems.o \
makefile.o unixmake2.o unixmake.o \
mingw_make.o winmakefile.o projectgenerator.o \
meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
- msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o \
- cesdkhandler.o
+ msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o
#qt code
QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o \
@@ -36,7 +35,7 @@ DEPEND_SRC = \
$(QMKGENSRC)/mac/pbuilder_pbx.cpp \
$(QMKGENSRC)/win32/winmakefile.cpp \
$(QMKGENSRC)/win32/mingw_make.cpp $(QMKGENSRC)/win32/msvc_nmake.cpp \
- $(QMKGENSRC)/win32/cesdkhandler.cpp $(QMKGENSRC)/mac/xmloutput.cpp \
+ $(QMKGENSRC)/mac/xmloutput.cpp \
$(QMKGENSRC)/win32/msvc_vcproj.cpp $(QMKGENSRC)/win32/msvc_vcxproj.cpp \
$(QMKGENSRC)/win32/msvc_objectmodel.cpp $(QMKGENSRC)/win32/msbuild_objectmodel.cpp \
$(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
@@ -76,6 +75,7 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qhash.cpp $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp \
$(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm \
+ $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm \
$(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp \
$(SOURCE_PATH)/src/corelib/io/qsettings.cpp $(SOURCE_PATH)/src/corelib/kernel/qvariant.cpp \
$(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \
@@ -208,9 +208,6 @@ msvc_vcxproj.o: $(QMKSRC)/generators/win32/msvc_vcxproj.cpp
msvc_nmake.o: $(QMKSRC)/generators/win32/msvc_nmake.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
-cesdkhandler.o: $(QMKSRC)/generators/win32/cesdkhandler.cpp
- $(CXX) -c -o $@ $(CXXFLAGS) $<
-
pbuilder_pbx.o: $(QMKSRC)/generators/mac/pbuilder_pbx.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
@@ -278,6 +275,9 @@ qcore_mac.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp
qcore_mac_objc.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qcore_mac_objc.mm
+qcore_foundation.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm
+
qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index 834065ee61..fc225ff098 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -21,9 +21,7 @@ CFLAGS_EXTRA = -fms-compatibility-version=19.00.23506 -Wno-microsoft-enum-v
!else
CXX = cl
LINKER = link
-! if "$(QMAKESPEC)" == "win32-msvc2005"
-CFLAGS_EXTRA = /Zc:wchar_t-
-! elseif "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2013"
+! if "$(QMAKESPEC)" == "win32-msvc2013"
CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS $(CFLAGS_CRT)
! elseif "$(QMAKESPEC)" == "win32-msvc2015" || "$(QMAKESPEC)" == "win32-clang-msvc2015"
CFLAGS_EXTRA = /MP /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /Zc:strictStrings /w44456 /w44457 /w44458 /wd4577 $(CFLAGS_CRT)
@@ -68,8 +66,7 @@ OBJS = project.obj main.obj ioutils.obj proitems.obj qmakevfs.obj \
option.obj winmakefile.obj projectgenerator.obj property.obj meta.obj \
makefiledeps.obj metamakefile.obj xmloutput.obj \
msvc_nmake.obj msvc_vcproj.obj msvc_vcxproj.obj \
- msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj \
- cesdkhandler.obj
+ msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj
#qt code
QTOBJS= \
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index 7135948832..c1979c4bec 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -657,7 +657,7 @@
qmake knows about many of these features, which can be accessed via specific
variables that only take effect on the platforms where they are relevant.
- \section1 \macos and iOS
+ \section1 \macos, iOS, tvOS, and watchOS
Features specific to these platforms include support for creating universal
binaries, frameworks and bundles.
@@ -1439,7 +1439,7 @@
\target QMAKE_BUNDLE_DATA
\section1 QMAKE_BUNDLE_DATA
- \note This variable is used on \macos and iOS only.
+ \note This variable is used on \macos, iOS, tvOS, and watchOS only.
Specifies the data that will be installed with a library
bundle, and is often used to specify a collection of header files.
@@ -1461,7 +1461,7 @@
\section1 QMAKE_BUNDLE_EXTENSION
- \note This variable is used on \macos and iOS only.
+ \note This variable is used on \macos, iOS, tvOS, and watchOS only.
Specifies the extension to be used for library bundles.
This allows frameworks to be created with custom extensions instead of the
@@ -1695,7 +1695,7 @@
\section1 QMAKE_FRAMEWORK_BUNDLE_NAME
- \note This variable is used on \macos and iOS only.
+ \note This variable is used on \macos, iOS, tvOS, and watchOS only.
In a framework project, this variable contains the name to be used for the
framework that is built.
@@ -1709,11 +1709,11 @@
\target QMAKE_FRAMEWORK_VERSION
\section1 QMAKE_FRAMEWORK_VERSION
- \note This variable is used on \macos and iOS only.
+ \note This variable is used on \macos, iOS, tvOS, and watchOS only.
- For projects where the build target is a \macos or an iOS framework, this variable
- is used to specify the version number that will be applied to the framework
- that is built.
+ For projects where the build target is an \macos, iOS, tvOS, or watchOS framework, this
+ variable is used to specify the version number that will be applied to the
+ framework that is built.
By default, this variable contains the same value as the \l{#VERSION}{VERSION}
variable.
@@ -1804,10 +1804,10 @@
\target QMAKE_INFO_PLIST
\section1 QMAKE_INFO_PLIST
- \note This variable is used on \macos and iOS platforms only.
+ \note This variable is used on \macos, iOS, tvOS, and watchOS platforms only.
Specifies the name of the property list file, \c{.plist}, you
- would like to include in your \macos and iOS application bundle.
+ would like to include in your \macos, iOS, tvOS, and watchOS application bundle.
In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@,
which qmake will replace with the actual executable name. Other variables
@@ -2164,8 +2164,8 @@
If defined, the value of this variable is used as a path to be prepended to
the built shared library's \c SONAME identifier. The \c SONAME is the
identifier that the dynamic linker will later use to reference the library.
- In general this reference may be a library name or full library path. On OS
- X and iOS, the path may be specified relatively using the following
+ In general this reference may be a library name or full library path. On \macos,
+ iOS, tvOS, and watchOS, the path may be specified relatively using the following
placeholders:
\table
@@ -2861,6 +2861,7 @@
MY_VAR2 will contain '-Lone -Ltwo -Lthree -Lfour -Lfive', and MY_VAR3 will
contain 'three two three'.
+ \target fn_first
\section2 first(variablename)
Returns the first value of \c variablename.
@@ -2869,8 +2870,9 @@
\snippet code/doc_src_qmake-manual.pro 161
- See also \l{last(variablename)}{last()}.
+ See also \l{take_first()}, \l{fn_last}{last()}.
+ \target format_number()
\section2 format_number(number[, options...])
Returns \c number in the format specified by \c options. You can specify the
@@ -2917,6 +2919,7 @@
to empty strings. If you need to encode spaces in \c glue, \c before, or \c
after, you must quote them.
+ \target fn_last
\section2 last(variablename)
Returns the last value of \c variablename.
@@ -2925,7 +2928,7 @@
\snippet code/doc_src_qmake-manual.pro 162
- See also \l{first(variablename)}{first()}.
+ See also \l{take_last()}, \l{fn_first}{first()}.
\section2 list(arg1 [, arg2 ..., argn])
@@ -2946,14 +2949,56 @@
See also \l{upper(arg1 [, arg2 ..., argn])}{upper()}.
- \section2 member(variablename, position)
+ \target member()
+ \section2 member(variablename [, start [, end]])
- Returns the value at the given \c position in the list of items in
- \c variablename.
- If an item cannot be found at the position specified, an empty string is
- returned. \c variablename is the only required field. If not specified,
- \c position defaults to 0, causing the first value in the list to be
- returned.
+ Returns the slice of the list value of \c variablename with the
+ zero-based element indices between \c start and \c end (inclusive).
+
+ If \c start is not given, it defaults to zero. This usage is
+ equivalent to \c $$first(variablename).
+
+ If \c end is not given, it defaults to \c start. This usage represents
+ simple array indexing, as exactly one element will be returned.
+
+ It is also possible to specify start and end in a single argument, with
+ the numbers separated by two periods.
+
+ Negative numbers represent indices starting from the end of the list,
+ with -1 being the last element.
+
+ If either index is out of range, an empty list is returned.
+
+ If \c end is smaller than \c start, the elements are returned
+ in reverse order.
+
+ \note The fact that the end index is inclusive and unordered implies
+ that an empty list will be returned only when an index is invalid
+ (which is implied by the input variable being empty).
+
+ See also \l{str_member()}.
+
+ \target num_add()
+ \section2 num_add(arg1 [, arg2 ..., argn])
+
+ Takes an arbitrary number of numeric arguments and adds them up,
+ returning the sum.
+
+ Subtraction is implicitly supported due to the possibility to simply
+ prepend a minus sign to a numeric value to negate it:
+
+ \code
+ sum = $$num_add($$first, -$$second)
+ \endcode
+
+ If the operand may be already negative, another step is necessary to
+ normalize the number:
+
+ \code
+ second_neg = -$$second
+ second_neg ~= s/^--//
+ sum = $$num_add($$first, $$second_neg)
+ \endcode
\section2 prompt(question)
@@ -3033,14 +3078,25 @@
See also \l{system_quote(arg)}{system_quote()}.
+ \target fn_size
\section2 size(variablename)
Returns the number of values of \c variablename.
+ See also \l{str_size()}.
+
\section2 sort_depends(variablename, prefix)
This is an internal function that you will typically not need.
+ \section2 sorted(variablename)
+
+ Returns the list of values in \c variablename with entries sorted
+ in ascending ASCII order.
+
+ Numerical sorting can be accomplished by zero-padding the values to
+ a fixed length with the help of the \l{format_number()} function.
+
\section2 split(variablename, separator)
Splits the value of \c variablename into separate values, and returns them
@@ -3050,7 +3106,46 @@
\snippet code/doc_src_qmake-manual.pro 168
- \section2 system(command[, mode])
+ \target str_member()
+ \section2 str_member(arg [, start [, end]])
+
+ This function is identical to \l{member()}, except that it operates
+ on a string value instead of a list variable, and consequently the
+ indices refer to character positions.
+
+ This function can be used to implement many common string slicing
+ operations:
+
+ \code
+ # $$left(VAR, len)
+ left = $$str_member(VAR, 0, $$num_add($$len, -1))
+
+ # $$right(VAR, len)
+ right = $$str_member(VAR, -$$num, -1)
+
+ # $$mid(VAR, off, len)
+ mid = $$str_member(VAR, $$off, $$num_add($$off, $$len, -1))
+
+ # $$mid(VAR, off)
+ mid = $$str_member(VAR, $$off, -1)
+
+ # $$reverse(VAR)
+ reverse = $$str_member(VAR, -1, 0)
+ \endcode
+
+ \note In these implementations, a zero \c len argument needs to be
+ handled separately.
+
+ See also \l{member()}, \l{num_add()}.
+
+ \target str_size()
+ \section2 str_size(arg)
+
+ Returns the number of characters in the argument.
+
+ See also \l{fn_size}{size()}.
+
+ \section2 system(command[, mode[, stsvar]])
You can use this variant of the \c system function to obtain stdout from the
command and assign it to a variable.
@@ -3059,6 +3154,11 @@
\snippet code/doc_src_qmake-manual.pro 72
+ If you pass \c stsvar, the command's exit status will be stored in that
+ variable. If the command crashes, the status will be -1, otherwise a
+ non-negative exit code of the command's choosing. Usually, comparing
+ the status with zero (success) is sufficient.
+
See also the test variant of \l{system(command)}{system()}.
\section2 system_path(path)
@@ -3077,6 +3177,26 @@
See also \l{shell_quote(arg)}{shell_quote()}.
+ \target take_first()
+ \section2 take_first(variablename)
+
+ Returns the first value of \c variablename and removes it from the
+ source variable.
+
+ This provides convenience for implementing queues, for example.
+
+ See also \l{take_last()}, \l{fn_first}{first()}.
+
+ \target take_last()
+ \section2 take_last(variablename)
+
+ Returns the last value of \c variablename and removes it from the
+ source variable.
+
+ This provides convenience for implementing stacks, for example.
+
+ See also \l{take_first()}, \l{fn_last}{last()}.
+
\target unique
\section2 unique(variablename)
@@ -4315,7 +4435,7 @@
\li nmake
\li Visual Studio projects (VS 2008 and later)
\endlist
- \li \macos and iOS
+ \li \macos, iOS, tvOS, and watchOS
\list
\li Makefile
\li Xcode
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index b80e4e3758..85a5ba56c3 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -1116,7 +1116,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
// Copy Bundle Data
if (!project->isEmpty("QMAKE_BUNDLE_DATA")) {
ProStringList bundle_file_refs;
- bool ios = project->isActiveConfig("ios");
+ bool osx = project->isActiveConfig("osx");
//all bundle data
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
@@ -1144,8 +1144,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t};\n";
}
- if (copyBundleResources && ((ios && path.isEmpty())
- || (!ios && path == QLatin1String("Contents/Resources")))) {
+ if (copyBundleResources && ((!osx && path.isEmpty())
+ || (osx && path == QLatin1String("Contents/Resources")))) {
for (const ProString &s : qAsConst(bundle_files))
bundle_resources_files << s;
} else {
@@ -1363,7 +1363,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
ProString targetName = project->first("QMAKE_ORIG_TARGET");
ProString testHost = "$(BUILT_PRODUCTS_DIR)/" + targetName + ".app/";
- if (!project->isActiveConfig("ios"))
+ if (project->isActiveConfig("osx"))
testHost.append("Contents/MacOS/");
testHost.append(targetName);
@@ -1439,10 +1439,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
}
}
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
- // Bitcode is only supported with a deployment target >= iOS 6.0.
- // Disable it for now, and consider switching it on when later
- // bumping the deployment target.
- settings.insert("ENABLE_BITCODE", "NO");
+ // required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
+ settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES");
if(!as_release)
settings.insert("GCC_OPTIMIZATION_LEVEL", "0");
@@ -1572,6 +1570,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t\t" << writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) << ";\n";
if (!project->isEmpty("QMAKE_IOS_DEPLOYMENT_TARGET"))
t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";\n";
+ if (!project->isEmpty("QMAKE_TVOS_DEPLOYMENT_TARGET"))
+ t << "\t\t\t\t" << writeSettings("APPLETVOS_DEPLOYMENT_TARGET", project->first("QMAKE_TVOS_DEPLOYMENT_TARGET")) << ";\n";
+ if (!project->isEmpty("QMAKE_WATCHOS_DEPLOYMENT_TARGET"))
+ t << "\t\t\t\t" << writeSettings("WATCHOS_DEPLOYMENT_TARGET", project->first("QMAKE_WATCHOS_DEPLOYMENT_TARGET")) << ";\n";
if (!project->isEmpty("QMAKE_XCODE_CODE_SIGN_IDENTITY"))
t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n";
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index d356adada5..5d7700ec82 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -318,8 +318,8 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
QDir::NoDotAndDotDot | QDir::AllEntries);
if(files.isEmpty()) {
debug_msg(1, "%s:%d Failure to find %s in vpath (%s)",
- __FILE__, __LINE__,
- val.toLatin1().constData(), vpath.join("::").toLatin1().constData());
+ __FILE__, __LINE__, val.toLatin1().constData(),
+ vpath.join(QString("::")).toLatin1().constData());
if(flags & VPATH_RemoveMissingFiles)
remove_file = true;
else if(flags & VPATH_WarnMissingFiles)
@@ -612,7 +612,7 @@ MakefileGenerator::init()
int x;
//build up a list of compilers
- QList<Compiler> compilers;
+ QVector<Compiler> compilers;
{
const char *builtins[] = { "OBJECTS", "SOURCES", "PRECOMPILED_HEADER", 0 };
for(x = 0; builtins[x]; ++x) {
@@ -780,7 +780,8 @@ MakefileGenerator::init()
for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it)
deplist.append(QMakeLocalFileName((*it).toQString()));
QMakeSourceFileInfo::setDependencyPaths(deplist);
- debug_msg(1, "Dependency Directories: %s", incDirs.join(" :: ").toLatin1().constData());
+ debug_msg(1, "Dependency Directories: %s",
+ incDirs.join(QString(" :: ")).toLatin1().constData());
//cache info
if(project->isActiveConfig("qmake_cache")) {
QString cache_file;
@@ -2183,7 +2184,7 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
}
if (!outlist.isEmpty()) {
t << "####### Custom Variables\n";
- t << outlist.join("\n") << endl << endl;
+ t << outlist.join('\n') << endl << endl;
}
}
@@ -2268,9 +2269,6 @@ QString MakefileGenerator::build_args()
{
QString ret = "$(QMAKE)";
- // general options and arguments
- ret += buildArgs();
-
//output
QString ofile = fileFixify(Option::output.fileName());
if(!ofile.isEmpty() && ofile != project->first("QMAKE_MAKEFILE"))
@@ -2279,6 +2277,9 @@ QString MakefileGenerator::build_args()
//inputs
ret += " " + escapeFilePath(fileFixify(project->projectFile()));
+ // general options and arguments
+ ret += buildArgs();
+
return ret;
}
@@ -2441,7 +2442,7 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t,
if (!in_directory.isEmpty())
t << "\n\t" << mkdir_p_asstring(out_directory);
pfx = "( " + chkexists.arg(out) +
- + " $(QMAKE) " + in + buildArgs() + " -o " + out
+ + " $(QMAKE) -o " + out + ' ' + in + buildArgs()
+ " ) && ";
}
writeSubMakeCall(t, out_directory_cdin + pfx, makefilein);
@@ -2512,7 +2513,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
t << mkdir_p_asstring(out_directory)
<< out_directory_cdin;
}
- t << "$(QMAKE) " << in << buildArgs() << " -o " << out;
+ t << "$(QMAKE) -o " << out << ' ' << in << buildArgs();
if (!dont_recurse)
writeSubMakeCall(t, out_directory_cdin, makefilein + " qmake_all");
else
@@ -2709,7 +2710,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
QStringList files = escapeFilePaths(fileFixify(Option::mkfile::project_files));
t << escapeDependencyPath(project->first("QMAKE_INTERNAL_PRL_FILE").toQString()) << ": \n\t"
- << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(' ') << endl;
+ << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs() << endl;
}
QString qmake = build_args();
@@ -2727,7 +2728,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " ";
}
const ProStringList &included = escapeDependencyPaths(project->values("QMAKE_INTERNAL_INCLUDED_FILES"));
- t << included.join(" \\\n\t\t") << "\n\t"
+ t << included.join(QString(" \\\n\t\t")) << "\n\t"
<< qmake << endl;
for(int include = 0; include < included.size(); ++include) {
const ProString &i = included.at(include);
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index a67a0ec0fc..86fec748eb 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -155,6 +155,8 @@ protected:
};
uint flags, type;
};
+ friend class QTypeInfo<Compiler>;
+
void initCompiler(const Compiler &comp);
enum VPATHFlag {
VPATH_NoFlag = 0x00,
@@ -264,6 +266,7 @@ public:
bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); }
QString shellQuote(const QString &str);
};
+Q_DECLARE_TYPEINFO(MakefileGenerator::Compiler, Q_MOVABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(MakefileGenerator::FileFixifyTypes)
inline void MakefileGenerator::setNoIO(bool o)
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index 57cb0ea854..67c8219d4b 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -911,9 +911,10 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
debug_msg(2, "findMocs: %s", file->file.local().toLatin1().constData());
int line_count = 1;
- bool ignore[2] = { false, false }; // [0] for Q_OBJECT, [1] for Q_GADGET
+ bool ignore[3] = { false, false, false }; // [0] for Q_OBJECT, [1] for Q_GADGET, [2] for Q_NAMESPACE
/* qmake ignore Q_GADGET */
/* qmake ignore Q_OBJECT */
+ /* qmake ignore Q_NAMESPACE */
for(int x = 0; x < buffer_len; x++) {
#define SKIP_BSNL(pos) skipEscapedLineEnds(buffer, buffer_len, (pos), &line_count)
x = SKIP_BSNL(x);
@@ -946,6 +947,12 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
file->file.real().toLatin1().constData(), line_count);
x += 20;
ignore[1] = true;
+ } else if (buffer_len >= (x + 23) &&
+ !strncmp(buffer + x + 1, "make ignore Q_NAMESPACE", 23)) {
+ debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_NAMESPACE\"",
+ file->file.real().toLatin1().constData(), line_count);
+ x += 23;
+ ignore[2] = true;
}
} else if (buffer[x] == '*') {
extralines = 0;
@@ -973,8 +980,8 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
int morelines = 0;
int y = skipEscapedLineEnds(buffer, buffer_len, x + 1, &morelines);
if (buffer[y] == 'Q') {
- static const char interesting[][9] = { "Q_OBJECT", "Q_GADGET" };
- for (int interest = 0; interest < 2; ++interest) {
+ static const char interesting[][12] = { "Q_OBJECT", "Q_GADGET", "Q_NAMESPACE"};
+ for (int interest = 0; interest < 3; ++interest) {
if (ignore[interest])
continue;
diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h
index 3b0c6ce803..034197fd31 100644
--- a/qmake/generators/makefiledeps.h
+++ b/qmake/generators/makefiledeps.h
@@ -41,10 +41,10 @@ struct SourceDependChildren;
class SourceFiles;
class QMakeLocalFileName {
- uint is_null : 1;
+ bool is_null;
mutable QString real_name, local_name;
public:
- QMakeLocalFileName() : is_null(1) { }
+ QMakeLocalFileName() : is_null(true) {}
QMakeLocalFileName(const QString &);
bool isNull() const { return is_null; }
inline const QString &real() const { return real_name; }
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index b0f7593fbe..349dcd2f40 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -194,6 +194,18 @@ UnixMakefileGenerator::init()
if (!language.isEmpty()) {
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT}"),
escapeFilePath(pchBaseName + language + headerSuffix));
+ const ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ for (const ProString &arch : pchArchs) {
+ QString suffix = headerSuffix;
+ suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
+ if (project->isActiveConfig("clang_pch_style")
+ && (suffix.endsWith(QLatin1String(".pch"))
+ || suffix.endsWith(QLatin1String(".gch")))) {
+ suffix.chop(4); // must omit header suffix for -include to recognize the PCH
+ }
+ pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_") + arch + QLatin1Char('}'),
+ escapeFilePath(pchBaseName + language + suffix));
+ }
}
}
@@ -351,9 +363,17 @@ QStringList
if (!file.endsWith(extension.toQString()))
continue;
- QString precompiledHeader = header_prefix + language + header_suffix;
- if (!ret.contains(precompiledHeader))
- ret += precompiledHeader;
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ if (pchArchs.isEmpty())
+ pchArchs << ProString(); // normal single-arch PCH
+ for (const ProString &arch : qAsConst(pchArchs)) {
+ QString suffix = header_suffix;
+ if (!arch.isEmpty())
+ suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
+ QString precompiledHeader = header_prefix + language + suffix;
+ if (!ret.contains(precompiledHeader))
+ ret += precompiledHeader;
+ }
goto foundPrecompiledDependency;
}
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 9312f19418..6fa355390f 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -241,13 +241,14 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\\\n\t\t" << (*objit);
}
if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
- t << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;
+ t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl;
} else if(!incrs_out.count()) {
t << endl;
} else {
src_incremental = true;
t << endl;
- t << "INCREMENTAL_OBJECTS = " << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;
+ t << "INCREMENTAL_OBJECTS = "
+ << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl;
}
} else {
// Used all over the place in both deps and commands.
@@ -730,7 +731,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
if(!meta_files.isEmpty())
t << escapeDependencyPaths(meta_files).join(" ") << ": \n\t"
- << "@$(QMAKE) -prl " << buildArgs() << ' ' << escapeFilePath(project->projectFile()) << endl;
+ << "@$(QMAKE) -prl " << escapeFilePath(project->projectFile()) << ' ' << buildArgs() << endl;
}
if (!project->isEmpty("QMAKE_BUNDLE")) {
@@ -995,7 +996,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (language.isEmpty())
continue;
- precomp_files += precomph_out_dir + header_prefix + language + header_suffix;
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ if (pchArchs.isEmpty())
+ pchArchs << ProString(); // normal single-arch PCH
+ for (const ProString &arch : qAsConst(pchArchs)) {
+ auto suffix = header_suffix.toQString();
+ if (!arch.isEmpty())
+ suffix.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
+ precomp_files += precomph_out_dir + header_prefix + language + suffix;
+ }
}
}
t << "-$(DEL_FILE) " << escapeFilePaths(precomp_files).join(' ') << "\n\t";
@@ -1051,6 +1060,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString pchInput = project->first("PRECOMPILED_HEADER").toQString();
t << "###### Precompiled headers\n";
for (const ProString &compiler : project->values("QMAKE_BUILTIN_COMPILERS")) {
+ QString pchOutputDir;
QString pchFlags = var(ProKey("QMAKE_" + compiler + "FLAGS_PRECOMPILE"));
if(pchFlags.isEmpty())
continue;
@@ -1061,6 +1071,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
else
cflags += " $(CXXFLAGS)";
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ if (pchArchs.isEmpty())
+ pchArchs << ProString(); // normal single-arch PCH
ProString pchBaseName = project->first("QMAKE_ORIG_TARGET");
ProString pchOutput;
if(!project->isEmpty("PRECOMPILED_DIR"))
@@ -1087,30 +1100,47 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ProString header_suffix = project->isActiveConfig("clang_pch_style")
? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
pchOutput += Option::dir_sep;
- QString pchOutputDir = pchOutput.toQString();
+ pchOutputDir = pchOutput.toQString();
QString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler)).toQString();
if (language.isEmpty())
continue;
pchOutput += header_prefix + language + header_suffix;
-
- t << escapeDependencyPath(pchOutput) << ": " << escapeDependencyPath(pchInput) << ' '
- << escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t")
- << "\n\t" << mkdir_p_asstring(pchOutputDir);
}
pchFlags.replace(QLatin1String("${QMAKE_PCH_INPUT}"), escapeFilePath(pchInput))
- .replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString()))
- .replace(QLatin1String("${QMAKE_PCH_OUTPUT}"), escapeFilePath(pchOutput.toQString()));
+ .replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString()));
+ for (const ProString &arch : qAsConst(pchArchs)) {
+ auto pchArchOutput = pchOutput.toQString();
+ if (!arch.isEmpty())
+ pchArchOutput.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
+
+ if (!project->isActiveConfig("icc_pch_style")) {
+ const auto pchFilePath_d = escapeDependencyPath(pchArchOutput);
+ if (!arch.isEmpty()) {
+ t << pchFilePath_d << ": " << "EXPORT_ARCH_ARGS = -arch " << arch << "\n\n";
+ t << pchFilePath_d << ": "
+ << "EXPORT_QMAKE_XARCH_CFLAGS = $(EXPORT_QMAKE_XARCH_CFLAGS_" << arch << ")" << "\n\n";
+ t << pchFilePath_d << ": "
+ << "EXPORT_QMAKE_XARCH_LFLAGS = $(EXPORT_QMAKE_XARCH_LFLAGS_" << arch << ")" << "\n\n";
+ }
+ t << pchFilePath_d << ": " << escapeDependencyPath(pchInput) << ' '
+ << escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t")
+ << "\n\t" << mkdir_p_asstring(pchOutputDir);
+ }
- QString compilerExecutable;
- if (compiler == "C" || compiler == "OBJC")
- compilerExecutable = "$(CC)";
- else
- compilerExecutable = "$(CXX)";
+ auto pchArchFlags = pchFlags;
+ pchArchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT}"), escapeFilePath(pchArchOutput));
- // compile command
- t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchFlags << endl << endl;
+ QString compilerExecutable;
+ if (compiler == "C" || compiler == "OBJC")
+ compilerExecutable = "$(CC)";
+ else
+ compilerExecutable = "$(CXX)";
+
+ // compile command
+ t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchArchFlags << endl << endl;
+ }
}
}
diff --git a/qmake/generators/win32/cesdkhandler.cpp b/qmake/generators/win32/cesdkhandler.cpp
deleted file mode 100644
index f45cbf74a9..0000000000
--- a/qmake/generators/win32/cesdkhandler.cpp
+++ /dev/null
@@ -1,368 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cesdkhandler.h"
-
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qdebug.h>
-#include <qxmlstream.h>
-#include <qsettings.h>
-#include <qtextstream.h>
-
-QT_BEGIN_NAMESPACE
-
-struct PropertyContainer
-{
- void clear() { name.clear(); value.clear(); properties.clear(); }
- QString name;
- QString value;
- QMap<QString, PropertyContainer> properties;
-};
-Q_DECLARE_TYPEINFO(PropertyContainer, Q_MOVABLE_TYPE);
-
-CeSdkInfo::CeSdkInfo() : m_major(0) , m_minor(0)
-{
-}
-
-CeSdkHandler::CeSdkHandler()
-{
-}
-
-struct ContainsPathKey
-{
- bool operator()(const QString &val) const
- {
- return !(val.endsWith(QLatin1String("MSBuildToolsPath"))
- || val.endsWith(QLatin1String("MSBuildToolsRoot")));
- }
-};
-
-struct ValueFromKey
-{
- explicit ValueFromKey(const QSettings *settings) : settings(settings) {}
- QString operator()(const QString &key) const
- {
- return settings->value(key).toString();
- }
-
- const QSettings *settings;
-};
-
-bool CeSdkHandler::parseMsBuildFile(QFile *file, CeSdkInfo *info)
-{
- bool result = file->open(QFile::ReadOnly | QFile::Text);
- const QString IncludePath = QStringLiteral("IncludePath");
- const QString LibraryPath = QStringLiteral("LibraryPath");
- const QString PreprocessorDefinitions = QStringLiteral("PreprocessorDefinitions");
- const QString SdkRootPathString = QStringLiteral("SdkRootPath");
- const QString ExecutablePath = QStringLiteral("ExecutablePath");
- enum ParserState{Not, Include, Lib, Define, BinDir, SdkRootPath};
- QString includePath;
- QString libraryPath;
- QString defines;
- QString binDirs;
- QString sdkRootPath;
- ParserState state = Not;
- if (result) {
- QXmlStreamReader xml(file);
- while (!xml.atEnd()) {
- if (xml.isStartElement()) {
- if (xml.name() == IncludePath)
- state = Include;
- else if (xml.name() == LibraryPath)
- state = Lib;
- else if (xml.name() == PreprocessorDefinitions)
- state = Define;
- else if (xml.name() == SdkRootPathString)
- state = SdkRootPath;
- else if (xml.name() == ExecutablePath)
- state = BinDir;
- else
- state = Not;
- } else if (xml.isEndElement()) {
- state = Not;
- } else if (xml.isCharacters()) {
- switch (state) {
- case Include:
- includePath += xml.text();
- break;
- case Lib:
- libraryPath += xml.text();
- break;
- case Define:
- defines += xml.text();
- break;
- case SdkRootPath:
- sdkRootPath = xml.text().toString();
- break;
- case BinDir:
- binDirs += xml.text();
- case(Not):
- break;
- }
- }
- xml.readNext();
- }
- }
- file->close();
- const bool success = result && !includePath.isEmpty() && !libraryPath.isEmpty() &&
- !defines.isEmpty() && !sdkRootPath.isEmpty();
- if (success) {
- const QString startPattern = QStringLiteral("$(Registry:");
- const int startIndex = sdkRootPath.indexOf(startPattern);
- const int endIndex = sdkRootPath.lastIndexOf(QLatin1Char(')'));
- const QString regString = sdkRootPath.mid(startIndex + startPattern.size(),
- endIndex - startIndex - startPattern.size());
- QSettings sdkRootPathRegistry(regString, QSettings::NativeFormat);
- const QString erg = sdkRootPathRegistry.value(QStringLiteral(".")).toString();
- const QString fullSdkRootPath = erg + sdkRootPath.mid(endIndex + 1);
- const QLatin1String rootString("$(SdkRootPath)");
-
- includePath = includePath.replace(rootString, fullSdkRootPath);
- libraryPath = libraryPath.replace(rootString, fullSdkRootPath);
- binDirs = binDirs.replace(rootString, fullSdkRootPath);
- info->m_include = includePath + ";$(INCLUDE)";
- info->m_lib = libraryPath;
- info->m_bin = binDirs;
- }
- return success;
-}
-
-QStringList CeSdkHandler::getMsBuildToolPaths() const
-{
- QSettings msbuildEntries("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\MSBuild\\ToolsVersions",
- QSettings::NativeFormat);
- const QStringList allKeys = msbuildEntries.allKeys();
- QStringList toolVersionKeys;
- toolVersionKeys.push_back(QStringLiteral("c:\\Program Files\\MSBuild\\"));
- std::remove_copy_if(allKeys.cbegin(), allKeys.cend(),
- std::back_inserter(toolVersionKeys), ContainsPathKey());
- QStringList toolVersionValues;
- std::transform(toolVersionKeys.constBegin(), toolVersionKeys.constEnd(),
- std::back_inserter(toolVersionValues),
- ValueFromKey(&msbuildEntries));
- return toolVersionValues;
-}
-
-QStringList CeSdkHandler::filterMsBuildToolPaths(const QStringList &paths) const
-{
- QStringList result;
- for (const QString &path : paths) {
- QDir dirVC110(path);
- if (path.endsWith(QLatin1String("bin")))
- dirVC110.cdUp();
- QDir dirVC120 = dirVC110;
- if (dirVC110.cd(QStringLiteral("Microsoft.Cpp\\v4.0\\V110\\Platforms")))
- result << dirVC110.absolutePath();
- if (dirVC120.cd(QStringLiteral("Microsoft.Cpp\\v4.0\\V120\\Platforms")))
- result << dirVC120.absolutePath();
- }
- return result;
-}
-
-bool CeSdkHandler::retrieveEnvironment(const QStringList &relativePaths,
- const QStringList &toolPaths,
- CeSdkInfo *info)
-{
- bool result = false;
- for (const QString &path : toolPaths) {
- const QDir dir(path);
- for (const QString &filePath : relativePaths) {
- QFile file(dir.absoluteFilePath(filePath));
- if (file.exists())
- result = parseMsBuildFile(&file, info) || result;
- }
- }
-
- return result;
-}
-
-void CeSdkHandler::retrieveWEC2013SDKs()
-{
- const QStringList toolPaths = getMsBuildToolPaths();
- const QStringList filteredToolPaths = filterMsBuildToolPaths(toolPaths);
- QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows CE Tools\\SDKs", QSettings::NativeFormat);
- const QStringList keys = settings.allKeys();
- for (const QString &key : keys) {
- if (key.contains(QLatin1String("SDKInformation")) || key.contains(QLatin1Char('.'))) {
- QFile sdkPropertyFile(settings.value(key).toString());
- if (!sdkPropertyFile.exists())
- continue;
- QFileInfo info(sdkPropertyFile);
- if (info.isDir()) {
- const QDir dir = info.absoluteFilePath();
- QFileInfo fInfo(dir.filePath(QLatin1String("Properties.xml")));
- if (fInfo.exists())
- sdkPropertyFile.setFileName(fInfo.absoluteFilePath());
- }
- if (!sdkPropertyFile.open(QFile::ReadOnly))
- continue;
- QXmlStreamReader xml(&sdkPropertyFile);
- QString currentElement;
- QString curName;
- PropertyContainer currentProperty;
- QVector<PropertyContainer> propStack;
- propStack.push_back(currentProperty);
- while (!xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement()) {
- currentElement = xml.name().toString();
- if (currentElement == QLatin1String("Property")) {
- QXmlStreamAttributes attributes = xml.attributes();
- if (attributes.hasAttribute(QLatin1String("NAME")))
- curName = attributes.value(QLatin1String("NAME")).toString();
- Q_ASSERT(!curName.isEmpty());
- currentProperty.clear();
- currentProperty.name = curName;
- propStack.push_back(currentProperty);
- } else if (currentElement == QLatin1String("PropertyBag")) {
- QXmlStreamAttributes attributes = xml.attributes();
- if (attributes.hasAttribute(QLatin1String("NAME")))
- curName = attributes.value(QLatin1String("NAME")).toString();
- Q_ASSERT(!curName.isEmpty());
- currentProperty.clear();
- currentProperty.name = curName;
- propStack.push_back(currentProperty);
- }
- } else if (xml.isEndElement()) {
- currentElement = xml.name().toString();
- PropertyContainer self = propStack.takeLast();
- if (currentElement != QLatin1String("Root")) {
- PropertyContainer &last = propStack.last();
- last.properties[self.name] = self;
- } else {
- currentProperty = self;
- }
- } else if (xml.isCharacters()) {
- PropertyContainer &self = propStack.last();
- self.value = xml.text().toString();
- }
- }
-
- if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) {
- qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString();
- return;
- }
- CeSdkInfo currentSdk;
- const PropertyContainer &cpuInfo = currentProperty.properties.value(QLatin1String("CPU info"));
- if (cpuInfo.properties.isEmpty())
- continue;
- const PropertyContainer &cpuInfoVal = cpuInfo.properties.first().properties.value(QLatin1String("CpuName"));
- if (cpuInfoVal.name != QLatin1String("CpuName"))
- continue;
- const QString SDKName = QStringLiteral("SDK name");
- currentSdk.m_name = currentProperty.properties.value(SDKName).value+
- QStringLiteral(" (") + cpuInfoVal.value + ")";
- currentSdk.m_major = currentProperty.properties.value(QLatin1String("OSMajor")).value.toInt();
- currentSdk.m_minor = currentProperty.properties.value(QLatin1String("OSMinor")).value.toInt();
- retrieveEnvironment(currentProperty.properties.value(QLatin1String("MSBuild Files110")).value.split(';'),
- filteredToolPaths, &currentSdk);
- retrieveEnvironment(currentProperty.properties.value(QLatin1String("MSBuild Files120")).value.split(';'),
- filteredToolPaths, &currentSdk);
- if (!currentSdk.m_include.isEmpty())
- m_list.append(currentSdk);
- }
- }
-}
-
-void CeSdkHandler::retrieveWEC6n7SDKs()
-{
- // look at the file at %VCInstallDir%/vcpackages/WCE.VCPlatform.config
- // and scan through all installed sdks...
- m_vcInstallDir = QString::fromLatin1(qgetenv("VCInstallDir"));
- if (m_vcInstallDir.isEmpty())
- return;
-
- QDir vStudioDir(m_vcInstallDir);
- if (!vStudioDir.cd(QLatin1String("vcpackages")))
- return;
-
- QFile configFile(vStudioDir.absoluteFilePath(QLatin1String("WCE.VCPlatform.config")));
- if (!configFile.open(QIODevice::ReadOnly))
- return;
-
- QString currentElement;
- CeSdkInfo currentItem;
- QXmlStreamReader xml(&configFile);
- while (!xml.atEnd()) {
- xml.readNext();
- if (xml.isStartElement()) {
- currentElement = xml.name().toString();
- if (currentElement == QLatin1String("Platform")) {
- currentItem = CeSdkInfo();
- } else if (currentElement == QLatin1String("Directories")) {
- QXmlStreamAttributes attr = xml.attributes();
- currentItem.m_include = fixPaths(attr.value(QLatin1String("Include")).toString());
- currentItem.m_lib = fixPaths(attr.value(QLatin1String("Library")).toString());
- currentItem.m_bin = fixPaths(attr.value(QLatin1String("Path")).toString());
- }
- } else if (xml.isEndElement()) {
- if (xml.name().toString() == QLatin1String("Platform"))
- m_list.append(currentItem);
- } else if (xml.isCharacters() && !xml.isWhitespace()) {
- if (currentElement == QLatin1String("PlatformName"))
- currentItem.m_name = xml.text().toString();
- else if (currentElement == QLatin1String("OSMajorVersion"))
- currentItem.m_major = xml.text().toString().toInt();
- else if (currentElement == QLatin1String("OSMinorVersion"))
- currentItem.m_minor = xml.text().toString().toInt();
- }
- }
-
- if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) {
- qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString();
- return;
- }
-}
-
-bool CeSdkHandler::retrieveAvailableSDKs()
-{
- m_list.clear();
- retrieveWEC2013SDKs();
- retrieveWEC6n7SDKs();
- return !m_list.empty();
-}
-
-QString CeSdkHandler::fixPaths(const QString &path) const
-{
- QRegExp searchStr(QLatin1String("(\\$\\(\\w+\\))"));
- QString fixedString = path;
- for (int index = fixedString.indexOf(searchStr, 0);
- index >= 0;
- index = fixedString.indexOf(searchStr, index)) {
- const QString capture = searchStr.cap(0);
- fixedString.replace(index, capture.length(), capture.toUpper());
- index += capture.length(); // don't count the zero terminator
- fixedString.insert(index, '\\'); // the configuration file lacks a directory separator for env vars
- ++index;
- }
- return fixedString;
-}
-
-QT_END_NAMESPACE
diff --git a/qmake/generators/win32/cesdkhandler.h b/qmake/generators/win32/cesdkhandler.h
deleted file mode 100644
index 3bb8d2adcb..0000000000
--- a/qmake/generators/win32/cesdkhandler.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 tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CE_SDK_HANDLER_INCL
-#define CE_SDK_HANDLER_INCL
-
-#include <qstringlist.h>
-#include <qdir.h>
-
-QT_BEGIN_NAMESPACE
-
-class CeSdkInfo
-{
-public:
- CeSdkInfo();
- inline QString name() const { return m_name; }
- inline QString binPath() const { return m_bin; }
- inline QString includePath() const { return m_include; }
- inline QString libPath() const { return m_lib; }
- inline bool isValid() const;
- inline int majorVersion() const { return m_major; }
- inline int minorVersion() const { return m_minor; }
- inline bool isSupported() const { return m_major >= 5; }
-private:
- friend class CeSdkHandler;
- QString m_name;
- QString m_bin;
- QString m_include;
- QString m_lib;
- int m_major;
- int m_minor;
-};
-
-bool CeSdkInfo::isValid() const
-{
- return !m_name.isEmpty() &&
- !m_bin.isEmpty() &&
- !m_include.isEmpty() &&
- !m_lib.isEmpty();
-}
-
-class CeSdkHandler
-{
-public:
- CeSdkHandler();
- bool retrieveAvailableSDKs();
- inline QList<CeSdkInfo> listAll() const { return m_list; }
-private:
- void retrieveWEC6n7SDKs();
- void retrieveWEC2013SDKs();
- inline QString fixPaths(const QString &path) const;
- QStringList getMsBuildToolPaths() const;
- QStringList filterMsBuildToolPaths(const QStringList &paths) const;
- bool parseMsBuildFile(QFile *file, CeSdkInfo *info);
- bool retrieveEnvironment(const QStringList &relativePaths,
- const QStringList &toolPaths,
- CeSdkInfo *info);
- QList<CeSdkInfo> m_list;
- QString m_vcInstallDir;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 00d5d248ed..029092fdaa 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -28,7 +28,6 @@
#include "msvc_nmake.h"
#include "option.h"
-#include "cesdkhandler.h"
#include <qregexp.h>
#include <qdir.h>
@@ -72,38 +71,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return MakefileGenerator::writeStubMakefile(t);
#endif
if (!project->isHostBuild()) {
- const ProValueMap &variables = project->variables();
- if (project->isActiveConfig("wince")) {
- CeSdkHandler sdkhandler;
- sdkhandler.retrieveAvailableSDKs();
- const QString sdkName = variables["CE_SDK"].join(' ')
- + " (" + variables["CE_ARCH"].join(' ') + ")";
- const QList<CeSdkInfo> sdkList = sdkhandler.listAll();
- CeSdkInfo sdk;
- for (const CeSdkInfo &info : sdkList) {
- if (info.name().compare(sdkName, Qt::CaseInsensitive ) == 0) {
- sdk = info;
- break;
- }
- }
- if (sdk.isValid()) {
- t << "\nINCLUDE = " << sdk.includePath();
- t << "\nLIB = " << sdk.libPath();
- t << "\nPATH = " << sdk.binPath() << "\n";
- } else {
- QStringList sdkStringList;
- sdkStringList.reserve(sdkList.size());
- for (const CeSdkInfo &info : sdkList)
- sdkStringList << info.name();
-
- fprintf(stderr, "Failed to find Windows CE SDK matching %s, found: %s\n"
- "SDK needs to be specified in mkspec (using: %s/qmake.conf)\n"
- "SDK name needs to match the following format: CE_SDK (CE_ARCH)\n",
- qPrintable(sdkName), qPrintable(sdkStringList.join(", ")),
- qPrintable(variables["QMAKESPEC"].first().toQString()));
- return false;
- }
- } else if (project->isActiveConfig(QStringLiteral("winrt"))) {
+ if (project->isActiveConfig(QStringLiteral("winrt"))) {
QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
QString compiler;
QString compilerArch;
@@ -623,12 +591,6 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
writeLinkCommand(t);
}
}
- QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE");
- bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") &&
- !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH");
- if(useSignature) {
- t << "\n\tsigntool sign /F " << escapeFilePath(signature) << " $(DESTDIR_TARGET)";
- }
if(!project->isEmpty("QMAKE_POST_LINK")) {
t << "\n\t" << var("QMAKE_POST_LINK");
}
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index dfbfaacfa8..0f3665eba8 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -860,7 +860,6 @@ class VCConfiguration
public:
// Functions
VCConfiguration();
- ~VCConfiguration(){}
bool suppressUnknownOptionWarnings;
DotNET CompilerVersion;
@@ -936,7 +935,6 @@ class VCFilter
public:
// Functions
VCFilter();
- ~VCFilter(){}
void addFile(const QString& filename);
void addFile(const VCFilterFile& fileInfo);
@@ -962,7 +960,7 @@ public:
VCCLCompilerTool CompilerTool;
};
-typedef QList<VCFilter> VCFilterList;
+typedef QVector<VCFilter> VCFilterList;
class VCProjectSingleConfig
{
public:
@@ -976,9 +974,6 @@ public:
Resources,
Extras
};
- // Functions
- VCProjectSingleConfig(){}
- ~VCProjectSingleConfig(){}
// Variables
QString Name;
@@ -1009,6 +1004,7 @@ public:
const VCFilter &filterByName(const QString &name) const;
const VCFilter &filterForExtraCompiler(const QString &compilerName) const;
};
+Q_DECLARE_TYPEINFO(VCProjectSingleConfig, Q_MOVABLE_TYPE);
// Tree & Flat view of files --------------------------------------------------
class VCFilter;
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 7a713e1b65..cb44937bea 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -36,7 +36,6 @@
#include <qhash.h>
#include <quuid.h>
#include <stdlib.h>
-#include <qlinkedlist.h>
//#define DEBUG_SOLUTION_GEN
@@ -378,8 +377,6 @@ QString VcprojGenerator::retrievePlatformToolSet() const
QString suffix;
if (project->isActiveConfig("winphone"))
suffix = '_' + project->first("WINTARGET_VER").toQString().toLower();
- else if (project->first("QMAKE_TARGET_OS") == "xp")
- suffix = "_xp";
switch (vcProject.Configuration.CompilerVersion)
{
@@ -490,7 +487,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
// Check if all requirements are fulfilled
if (!tmp_proj.isEmpty("QMAKE_FAILED_REQUIREMENTS")) {
fprintf(stderr, "Project file(%s) not added to Solution because all requirements not met:\n\t%s\n",
- fn.toLatin1().constData(), tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
+ fn.toLatin1().constData(),
+ tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(' ').toLatin1().constData());
qmake_setpwd(oldpwd);
Option::output_dir = oldoutpwd;
continue;
@@ -700,11 +698,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QString slnConf = _slnSolutionConf;
if (!project->isEmpty("VCPROJ_ARCH")) {
slnConf.replace(QLatin1String("|Win32"), "|" + project->first("VCPROJ_ARCH"));
- } else if (!project->isEmpty("CE_PLATFORMNAME")) {
- slnConf.replace(QLatin1String("|Win32"), "|" + project->first("CE_PLATFORMNAME"));
- } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) {
- QString slnPlatform = QString("|") + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
- slnConf.replace(QLatin1String("|Win32"), slnPlatform);
} else if (is64Bit) {
slnConf.replace(QLatin1String("|Win32"), QLatin1String("|x64"));
}
@@ -719,10 +712,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
QString xplatform = platform;
if (!project->isEmpty("VCPROJ_ARCH")) {
xplatform = project->first("VCPROJ_ARCH").toQString();
- } else if (!project->isEmpty("CE_PLATFORMNAME")) {
- xplatform = project->first("CE_PLATFORMNAME").toQString();
- } else if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH")) {
- xplatform = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
}
if (!project->isHostBuild())
platform = xplatform;
@@ -980,12 +969,8 @@ void VcprojGenerator::initProject()
vcProject.Keyword = project->first("VCPROJ_KEYWORD").toQString();
if (!project->isEmpty("VCPROJ_ARCH")) {
vcProject.PlatformName = project->first("VCPROJ_ARCH").toQString();
- } else if (!project->isEmpty("CE_PLATFORMNAME")) {
- vcProject.PlatformName = project->first("CE_PLATFORMNAME").toQString();
- } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
- vcProject.PlatformName = (is64Bit ? "x64" : "Win32");
} else {
- vcProject.PlatformName = project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
+ vcProject.PlatformName = (is64Bit ? "x64" : "Win32");
}
vcProject.SdkVersion = project->first("WINSDK_VER").toQString();
// These are not used by Qt, but may be used by customers
@@ -1066,12 +1051,8 @@ void VcprojGenerator::initConfiguration()
conf.ConfigurationName = conf.Name;
if (!project->isEmpty("VCPROJ_ARCH")) {
conf.Name += "|" + project->first("VCPROJ_ARCH");
- } else if (!project->isEmpty("CE_PLATFORMNAME")) {
- conf.Name += "|" + project->first("CE_PLATFORMNAME");
- } else if (project->isHostBuild() || project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
- conf.Name += (is64Bit ? "|x64" : "|Win32");
} else {
- conf.Name += "|" + project->values("CE_SDK").join(' ') + " (" + project->first("CE_ARCH") + ")";
+ conf.Name += (is64Bit ? "|x64" : "|Win32");
}
conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True);
conf.BuildBrowserInformation = triState(temp.isEmpty() ? (short)unset : temp.toShort());
@@ -1094,8 +1075,7 @@ void VcprojGenerator::initConfiguration()
initPreBuildEventTools();
initPostBuildEventTools();
// Only deploy for CE and WinRT projects
- if ((!project->isHostBuild() && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"))
- || conf.WinRT)
+ if (!project->isHostBuild() || conf.WinRT)
initDeploymentTool();
initWinDeployQtTool();
initPreLinkEventTools();
@@ -1243,16 +1223,6 @@ void VcprojGenerator::initPostBuildEventTools()
conf.postBuild.Description = cmdline.join(QLatin1String("\r\n"));
conf.postBuild.ExcludedFromBuild = _False;
}
-
- QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE");
- bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") &&
- !project->isHostBuild() && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH");
- if (useSignature) {
- conf.postBuild.CommandLine.prepend(
- QLatin1String("signtool sign /F ") + escapeFilePath(signature) + QLatin1String(" \"$(TargetPath)\""));
- conf.postBuild.ExcludedFromBuild = _False;
- }
-
if (!project->values("MSVCPROJ_COPY_DLL").isEmpty()) {
conf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC");
conf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL");
@@ -1346,45 +1316,6 @@ void VcprojGenerator::initDeploymentTool()
}
}
- if (!conf.WinRT) {
- // C-runtime deployment
- QString runtime = project->values("QT_CE_C_RUNTIME").join(QLatin1Char(' '));
- if (!runtime.isEmpty() && (runtime != QLatin1String("no"))) {
- QString runtimeVersion = QLatin1String("msvcr");
- ProString mkspec = project->first("QMAKESPEC");
-
- if (!mkspec.isEmpty()) {
- if (mkspec.endsWith("2008"))
- runtimeVersion.append("90");
- else
- runtimeVersion.append("80");
- if (project->isActiveConfig("debug"))
- runtimeVersion.append("d");
- runtimeVersion.append(".dll");
-
- if (runtime == "yes") {
- // Auto-find C-runtime
- QString vcInstallDir = qgetenv("VCINSTALLDIR");
- if (!vcInstallDir.isEmpty()) {
- vcInstallDir += "\\ce\\dll\\";
- vcInstallDir += project->values("CE_ARCH").join(QLatin1Char(' '));
- if (!QFileInfo::exists(vcInstallDir + QDir::separator() + runtimeVersion))
- runtime.clear();
- else
- runtime = vcInstallDir;
- }
- }
- }
-
- if (!runtime.isEmpty() && runtime != QLatin1String("yes")) {
- conf.deployment.AdditionalFiles += runtimeVersion
- + "|" + QDir::toNativeSeparators(runtime)
- + "|" + targetPath
- + "|0;";
- }
- }
- }
-
for (const ProString &item : project->values("INSTALLS")) {
// get item.path
QString devicePath = project->first(ProKey(item + ".path")).toQString();
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 0846cb2d8f..af9fe520f1 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -290,11 +290,7 @@ void Win32MakefileGenerator::processRcFileVar()
int rcLang = project->intValue("RC_LANG", 1033); // default: English(USA)
int rcCodePage = project->intValue("RC_CODEPAGE", 1200); // default: Unicode
- ts << "# if defined(UNDER_CE)\n";
- ts << "# include <winbase.h>\n";
- ts << "# else\n";
- ts << "# include <windows.h>\n";
- ts << "# endif\n";
+ ts << "#include <windows.h>\n";
ts << endl;
if (!rcIcons.isEmpty()) {
for (int i = 0; i < rcIcons.size(); ++i)
diff --git a/qmake/library/proitems.cpp b/qmake/library/proitems.cpp
index 5f923744be..66db190bc1 100644
--- a/qmake/library/proitems.cpp
+++ b/qmake/library/proitems.cpp
@@ -365,6 +365,11 @@ static QString ProStringList_join(const ProStringList &this_, const QChar *sep,
return res;
}
+QString ProStringList::join(const ProString &sep) const
+{
+ return ProStringList_join(*this, sep.constData(), sep.size());
+}
+
QString ProStringList::join(const QString &sep) const
{
return ProStringList_join(*this, sep.constData(), sep.size());
@@ -453,6 +458,14 @@ bool ProStringList::contains(const ProString &str, Qt::CaseSensitivity cs) const
return false;
}
+bool ProStringList::contains(const QStringRef &str, Qt::CaseSensitivity cs) const
+{
+ for (int i = 0; i < size(); i++)
+ if (!at(i).toQStringRef().compare(str, cs))
+ return true;
+ return false;
+}
+
bool ProStringList::contains(const char *str, Qt::CaseSensitivity cs) const
{
for (int i = 0; i < size(); i++)
diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h
index dcff970600..a3d2c01760 100644
--- a/qmake/library/proitems.h
+++ b/qmake/library/proitems.h
@@ -100,6 +100,7 @@ public:
bool operator!=(const QString &other) const { return !(*this == other); }
bool operator!=(QLatin1String other) const { return !(*this == other); }
bool operator!=(const char *other) const { return !(*this == other); }
+ bool operator<(const ProString &other) const { return toQStringRef() < other.toQStringRef(); }
bool isNull() const { return m_string.isNull(); }
bool isEmpty() const { return !m_length; }
int length() const { return m_length; }
@@ -207,9 +208,13 @@ inline QString operator+(const QString &one, const ProString &two)
{ return ProString(one) + two; }
inline QString operator+(const ProString &one, const char *two)
- { return one + ProString(two); } // XXX optimize
+ { QString ret = one.toQStringRef() + two; ret.detach(); return ret; }
inline QString operator+(const char *one, const ProString &two)
- { return ProString(one) + two; } // XXX optimize
+ { QString ret = one + two.toQStringRef(); ret.detach(); return ret; }
+inline QString operator+(const ProString &one, QChar two)
+ { return one.toQStringRef() + two; }
+inline QString operator+(QChar one, const ProString &two)
+ { return one + two.toQStringRef(); }
inline QString &operator+=(QString &that, const ProString &other)
{ return that += other.toQStringRef(); }
@@ -233,6 +238,7 @@ public:
int length() const { return size(); }
+ QString join(const ProString &sep) const;
QString join(const QString &sep) const;
QString join(QChar sep) const;
@@ -246,6 +252,7 @@ public:
void removeDuplicates();
bool contains(const ProString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ bool contains(const QStringRef &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
{ return contains(ProString(str), cs); }
bool contains(const char *str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index ef19c78723..4418c95f4b 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -52,6 +52,8 @@
# include <qthreadpool.h>
#endif
+#include <algorithm>
+
#ifdef Q_OS_UNIX
#include <time.h>
#include <utime.h>
@@ -84,9 +86,10 @@ QT_BEGIN_NAMESPACE
#define fL1S(s) QString::fromLatin1(s)
enum ExpandFunc {
- E_INVALID = 0, E_MEMBER, E_FIRST, E_LAST, E_SIZE, E_CAT, E_FROMFILE, E_EVAL, E_LIST,
- E_SPRINTF, E_FORMAT_NUMBER, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
- E_FIND, E_SYSTEM, E_UNIQUE, E_REVERSE, E_QUOTE, E_ESCAPE_EXPAND,
+ E_INVALID = 0, E_MEMBER, E_STR_MEMBER, E_FIRST, E_TAKE_FIRST, E_LAST, E_TAKE_LAST,
+ E_SIZE, E_STR_SIZE, E_CAT, E_FROMFILE, E_EVAL, E_LIST, E_SPRINTF, E_FORMAT_NUMBER,
+ E_NUM_ADD, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
+ E_FIND, E_SYSTEM, E_UNIQUE, E_SORTED, E_REVERSE, E_QUOTE, E_ESCAPE_EXPAND,
E_UPPER, E_LOWER, E_TITLE, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE,
E_REPLACE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS,
E_SHADOWED, E_ABSOLUTE_PATH, E_RELATIVE_PATH, E_CLEAN_PATH,
@@ -96,7 +99,7 @@ enum ExpandFunc {
enum TestFunc {
T_INVALID = 0, T_REQUIRES, T_GREATERTHAN, T_LESSTHAN, T_EQUALS,
T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM,
- T_DEFINED, T_CONTAINS, T_INFILE,
+ T_DEFINED, T_DISCARD_FROM, T_CONTAINS, T_INFILE,
T_COUNT, T_ISEMPTY, T_PARSE_JSON, T_INCLUDE, T_LOAD, T_DEBUG, T_LOG, T_MESSAGE, T_WARNING, T_ERROR, T_IF,
T_MKPATH, T_WRITE_FILE, T_TOUCH, T_CACHE
};
@@ -108,15 +111,20 @@ void QMakeEvaluator::initFunctionStatics()
const ExpandFunc func;
} expandInits[] = {
{ "member", E_MEMBER },
+ { "str_member", E_STR_MEMBER },
{ "first", E_FIRST },
+ { "take_first", E_TAKE_FIRST },
{ "last", E_LAST },
+ { "take_last", E_TAKE_LAST },
{ "size", E_SIZE },
+ { "str_size", E_STR_SIZE },
{ "cat", E_CAT },
{ "fromfile", E_FROMFILE },
{ "eval", E_EVAL },
{ "list", E_LIST },
{ "sprintf", E_SPRINTF },
{ "format_number", E_FORMAT_NUMBER },
+ { "num_add", E_NUM_ADD },
{ "join", E_JOIN },
{ "split", E_SPLIT },
{ "basename", E_BASENAME },
@@ -125,6 +133,7 @@ void QMakeEvaluator::initFunctionStatics()
{ "find", E_FIND },
{ "system", E_SYSTEM },
{ "unique", E_UNIQUE },
+ { "sorted", E_SORTED },
{ "reverse", E_REVERSE },
{ "quote", E_QUOTE },
{ "escape_expand", E_ESCAPE_EXPAND },
@@ -171,6 +180,7 @@ void QMakeEvaluator::initFunctionStatics()
{ "if", T_IF },
{ "isActiveConfig", T_CONFIG },
{ "system", T_SYSTEM },
+ { "discard_from", T_DISCARD_FROM },
{ "defined", T_DEFINED },
{ "contains", T_CONTAINS },
{ "infile", T_INFILE },
@@ -201,6 +211,49 @@ static bool isTrue(const ProString &str)
return !str.compare(statics.strtrue, Qt::CaseInsensitive) || str.toInt();
}
+bool
+QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringList &args,
+ int *start, int *end)
+{
+ *start = 0, *end = 0;
+ if (args.count() >= 2) {
+ bool ok = true;
+ const ProString &start_str = args.at(1);
+ *start = start_str.toInt(&ok);
+ if (!ok) {
+ if (args.count() == 2) {
+ int dotdot = start_str.indexOf(statics.strDotDot);
+ if (dotdot != -1) {
+ *start = start_str.left(dotdot).toInt(&ok);
+ if (ok)
+ *end = start_str.mid(dotdot+2).toInt(&ok);
+ }
+ }
+ if (!ok) {
+ evalError(fL1S("%1() argument 2 (start) '%2' invalid.")
+ .arg(func.toQString(m_tmp1), start_str.toQString(m_tmp2)));
+ return false;
+ }
+ } else {
+ *end = *start;
+ if (args.count() == 3)
+ *end = args.at(2).toInt(&ok);
+ if (!ok) {
+ evalError(fL1S("%1() argument 3 (end) '%2' invalid.")
+ .arg(func.toQString(m_tmp1), args.at(2).toQString(m_tmp2)));
+ return false;
+ }
+ }
+ }
+ if (*start < 0)
+ *start += srclen;
+ if (*end < 0)
+ *end += srclen;
+ if (*start < 0 || *start >= srclen || *end < 0 || *end >= srclen)
+ return false;
+ return true;
+}
+
#if defined(Q_OS_WIN) && defined(PROEVALUATOR_FULL)
static QString windowsErrorCode()
{
@@ -271,7 +324,7 @@ QMakeEvaluator::quoteValue(const ProString &val)
break;
case 32:
quote = true;
- // fallthrough
+ Q_FALLTHROUGH();
default:
ret += c;
break;
@@ -343,11 +396,16 @@ static void addJsonValue(const QJsonValue &value, const QString &keyPrefix, ProV
}
}
-static QMakeEvaluator::VisitReturn parseJsonInto(const QByteArray &json, const QString &into, ProValueMap *value)
+QMakeEvaluator::VisitReturn QMakeEvaluator::parseJsonInto(const QByteArray &json, const QString &into, ProValueMap *value)
{
- QJsonDocument document = QJsonDocument::fromJson(json);
- if (document.isNull())
+ QJsonParseError error;
+ QJsonDocument document = QJsonDocument::fromJson(json, &error);
+ if (document.isNull()) {
+ if (error.error != QJsonParseError::NoError)
+ evalError(fL1S("Error parsing json at offset %1: %2")
+ .arg(error.offset).arg(error.errorString()));
return QMakeEvaluator::ReturnFalse;
+ }
QString currentKey = into + QLatin1Char('.');
@@ -395,12 +453,13 @@ void QMakeEvaluator::runProcess(QProcess *proc, const QString &command) const
}
#endif
-QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const
+QByteArray QMakeEvaluator::getCommandOutput(const QString &args, int *exitCode) const
{
QByteArray out;
#ifndef QT_BOOTSTRAPPED
QProcess proc;
runProcess(&proc, args);
+ *exitCode = (proc.exitStatus() == QProcess::NormalExit) ? proc.exitCode() : -1;
QByteArray errout = proc.readAllStandardError();
# ifdef PROEVALUATOR_FULL
// FIXME: Qt really should have the option to set forwarding per channel
@@ -428,7 +487,12 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const
break;
out += QByteArray(buff, read_in);
}
- QT_PCLOSE(proc);
+ int ec = QT_PCLOSE(proc);
+# ifdef Q_OS_WIN
+ *exitCode = ec >= 0 ? ec : -1;
+# else
+ *exitCode = WIFEXITED(ec) ? WEXITSTATUS(ec) : -1;
+# endif
}
# ifdef Q_OS_WIN
out.replace("\r\n", "\n");
@@ -539,31 +603,30 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
bool leftalign = false;
enum { DefaultSign, PadSign, AlwaysSign } sign = DefaultSign;
if (args.count() >= 2) {
- const auto opts = split_value_list(args.at(1).toQString(m_tmp2));
+ const auto opts = split_value_list(args.at(1).toQStringRef());
for (const ProString &opt : opts) {
- opt.toQString(m_tmp3);
- if (m_tmp3.startsWith(QLatin1String("ibase="))) {
- ibase = m_tmp3.mid(6).toInt();
- } else if (m_tmp3.startsWith(QLatin1String("obase="))) {
- obase = m_tmp3.mid(6).toInt();
- } else if (m_tmp3.startsWith(QLatin1String("width="))) {
- width = m_tmp3.mid(6).toInt();
- } else if (m_tmp3 == QLatin1String("zeropad")) {
+ if (opt.startsWith(QLatin1String("ibase="))) {
+ ibase = opt.mid(6).toInt();
+ } else if (opt.startsWith(QLatin1String("obase="))) {
+ obase = opt.mid(6).toInt();
+ } else if (opt.startsWith(QLatin1String("width="))) {
+ width = opt.mid(6).toInt();
+ } else if (opt == QLatin1String("zeropad")) {
zeropad = true;
- } else if (m_tmp3 == QLatin1String("padsign")) {
+ } else if (opt == QLatin1String("padsign")) {
sign = PadSign;
- } else if (m_tmp3 == QLatin1String("alwayssign")) {
+ } else if (opt == QLatin1String("alwayssign")) {
sign = AlwaysSign;
- } else if (m_tmp3 == QLatin1String("leftalign")) {
+ } else if (opt == QLatin1String("leftalign")) {
leftalign = true;
} else {
- evalError(fL1S("format_number(): invalid format option %1.").arg(m_tmp3));
+ evalError(fL1S("format_number(): invalid format option %1.")
+ .arg(opt.toQString(m_tmp3)));
goto formfail;
}
}
}
- args.at(0).toQString(m_tmp3);
- if (m_tmp3.contains(QLatin1Char('.'))) {
+ if (args.at(0).contains(QLatin1Char('.'))) {
evalError(fL1S("format_number(): floats are currently not supported."));
break;
}
@@ -571,7 +634,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
qlonglong num = args.at(0).toLongLong(&ok, ibase);
if (!ok) {
evalError(fL1S("format_number(): malformed number %2 for base %1.")
- .arg(ibase).arg(m_tmp3));
+ .arg(ibase).arg(args.at(0).toQString(m_tmp3)));
break;
}
QString outstr;
@@ -599,14 +662,36 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
}
formfail:
break;
+ case E_NUM_ADD:
+ if (args.count() < 1 || args.at(0).isEmpty()) {
+ evalError(fL1S("num_add(num, ...) requires at least one argument."));
+ } else {
+ qlonglong sum = 0;
+ for (const ProString &arg : qAsConst(args)) {
+ if (arg.contains(QLatin1Char('.'))) {
+ evalError(fL1S("num_add(): floats are currently not supported."));
+ goto nafail;
+ }
+ bool ok;
+ qlonglong num = arg.toLongLong(&ok);
+ if (!ok) {
+ evalError(fL1S("num_add(): malformed number %1.")
+ .arg(arg.toQString(m_tmp3)));
+ goto nafail;
+ }
+ sum += num;
+ }
+ ret += ProString(QString::number(sum));
+ }
+ nafail:
+ break;
case E_JOIN: {
if (args.count() < 1 || args.count() > 4) {
evalError(fL1S("join(var, glue, before, after) requires one to four arguments."));
} else {
- QString glue;
- ProString before, after;
+ ProString glue, before, after;
if (args.count() >= 2)
- glue = args.at(1).toQString(m_tmp1);
+ glue = args.at(1);
if (args.count() >= 3)
before = args[2];
if (args.count() == 4)
@@ -641,47 +726,37 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
if (args.count() < 1 || args.count() > 3) {
evalError(fL1S("member(var, start, end) requires one to three arguments."));
} else {
- bool ok = true;
- const ProStringList &var = values(map(args.at(0)));
- int start = 0, end = 0;
- if (args.count() >= 2) {
- const ProString &start_str = args.at(1);
- start = start_str.toInt(&ok);
- if (!ok) {
- if (args.count() == 2) {
- int dotdot = start_str.indexOf(statics.strDotDot);
- if (dotdot != -1) {
- start = start_str.left(dotdot).toInt(&ok);
- if (ok)
- end = start_str.mid(dotdot+2).toInt(&ok);
- }
- }
- if (!ok)
- evalError(fL1S("member() argument 2 (start) '%2' invalid.")
- .arg(start_str.toQString(m_tmp1)));
+ const ProStringList &src = values(map(args.at(0)));
+ int start, end;
+ if (getMemberArgs(func, src.size(), args, &start, &end)) {
+ ret.reserve(qAbs(end - start) + 1);
+ if (start < end) {
+ for (int i = start; i <= end && src.size() >= i; i++)
+ ret += src.at(i);
} else {
- end = start;
- if (args.count() == 3)
- end = args.at(2).toInt(&ok);
- if (!ok)
- evalError(fL1S("member() argument 3 (end) '%2' invalid.")
- .arg(args.at(2).toQString(m_tmp1)));
+ for (int i = start; i >= end && src.size() >= i && i >= 0; i--)
+ ret += src.at(i);
}
}
- if (ok) {
- if (start < 0)
- start += var.count();
- if (end < 0)
- end += var.count();
- if (start < 0 || start >= var.count() || end < 0 || end >= var.count()) {
- //nothing
- } else if (start < end) {
- for (int i = start; i <= end && var.count() >= i; i++)
- ret.append(var[i]);
+ }
+ break;
+ case E_STR_MEMBER:
+ if (args.count() < 1 || args.count() > 3) {
+ evalError(fL1S("str_member(str, start, end) requires one to three arguments."));
+ } else {
+ const ProString &src = args.at(0);
+ int start, end;
+ if (getMemberArgs(func, src.size(), args, &start, &end)) {
+ QString res;
+ res.reserve(qAbs(end - start) + 1);
+ if (start < end) {
+ for (int i = start; i <= end && src.size() >= i; i++)
+ res += src.at(i);
} else {
- for (int i = start; i >= end && var.count() >= i && i >= 0; i--)
- ret += var[i];
+ for (int i = start; i >= end && src.size() >= i && i >= 0; i--)
+ res += src.at(i);
}
+ ret += ProString(res);
}
}
break;
@@ -699,12 +774,32 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
}
}
break;
+ case E_TAKE_FIRST:
+ case E_TAKE_LAST:
+ if (args.count() != 1) {
+ evalError(fL1S("%1(var) requires one argument.").arg(func.toQString(m_tmp1)));
+ } else {
+ ProStringList &var = valuesRef(map(args.at(0)));
+ if (!var.isEmpty()) {
+ if (func_t == E_TAKE_FIRST)
+ ret.append(var.takeFirst());
+ else
+ ret.append(var.takeLast());
+ }
+ }
+ break;
case E_SIZE:
if (args.count() != 1)
evalError(fL1S("size(var) requires one argument."));
else
ret.append(ProString(QString::number(values(map(args.at(0))).size())));
break;
+ case E_STR_SIZE:
+ if (args.count() != 1)
+ evalError(fL1S("str_size(str) requires one argument."));
+ else
+ ret.append(ProString(QString::number(args.at(0).size())));
+ break;
case E_CAT:
if (args.count() < 1 || args.count() > 2) {
evalError(fL1S("cat(file, singleline=true) requires one or two arguments."));
@@ -715,12 +810,11 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
bool lines = false;
bool singleLine = true;
if (args.count() > 1) {
- args.at(1).toQString(m_tmp2);
- if (!m_tmp2.compare(QLatin1String("false"), Qt::CaseInsensitive))
+ if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive))
singleLine = false;
- else if (!m_tmp2.compare(QLatin1String("blob"), Qt::CaseInsensitive))
+ else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive))
blob = true;
- else if (!m_tmp2.compare(QLatin1String("lines"), Qt::CaseInsensitive))
+ else if (!args.at(1).compare(QLatin1String("lines"), Qt::CaseInsensitive))
lines = true;
}
@@ -734,7 +828,8 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
if (lines) {
ret += ProString(stream.readLine());
} else {
- ret += split_value_list(stream.readLine().trimmed());
+ const QString &line = stream.readLine();
+ ret += split_value_list(QStringRef(&line).trimmed());
if (!singleLine)
ret += ProString("\n");
}
@@ -766,7 +861,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
ret = ProStringList(ProString(tmp));
ProStringList lst;
for (const ProString &arg : args)
- lst += split_value_list(arg.toQString(m_tmp1), arg.sourceFile()); // Relies on deep copy
+ lst += split_value_list(arg.toQStringRef(), arg.sourceFile()); // Relies on deep copy
m_valuemapStack.top()[ret.at(0).toKey()] = lst;
break; }
case E_FIND:
@@ -785,22 +880,26 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
break;
case E_SYSTEM:
if (!m_skipLevel) {
- if (args.count() < 1 || args.count() > 2) {
- evalError(fL1S("system(execute) requires one or two arguments."));
+ if (args.count() < 1 || args.count() > 3) {
+ evalError(fL1S("system(command, [mode], [stsvar]) requires one to three arguments."));
} else {
bool blob = false;
bool lines = false;
bool singleLine = true;
if (args.count() > 1) {
- args.at(1).toQString(m_tmp2);
- if (!m_tmp2.compare(QLatin1String("false"), Qt::CaseInsensitive))
+ if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive))
singleLine = false;
- else if (!m_tmp2.compare(QLatin1String("blob"), Qt::CaseInsensitive))
+ else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive))
blob = true;
- else if (!m_tmp2.compare(QLatin1String("lines"), Qt::CaseInsensitive))
+ else if (!args.at(1).compare(QLatin1String("lines"), Qt::CaseInsensitive))
lines = true;
}
- QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2));
+ int exitCode;
+ QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2), &exitCode);
+ if (args.count() > 2 && !args.at(2).isEmpty()) {
+ m_valuemapStack.top()[args.at(2).toKey()] =
+ ProStringList(ProString(QString::number(exitCode)));
+ }
if (lines) {
QTextStream stream(bytes);
while (!stream.atEnd())
@@ -813,7 +912,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
output.replace(QLatin1Char('\t'), QLatin1Char(' '));
if (singleLine)
output.replace(QLatin1Char('\n'), QLatin1Char(' '));
- ret += split_value_list(output);
+ ret += split_value_list(QStringRef(&output));
}
}
}
@@ -827,6 +926,14 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
ret.removeDuplicates();
}
break;
+ case E_SORTED:
+ if (args.count() != 1) {
+ evalError(fL1S("sorted(var) requires one argument."));
+ } else {
+ ret = values(map(args.at(0)));
+ std::sort(ret.begin(), ret.end());
+ }
+ break;
case E_REVERSE:
if (args.count() != 1) {
evalError(fL1S("reverse(var) requires one argument."));
@@ -962,7 +1069,8 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
QFile qfile;
if (qfile.open(stdin, QIODevice::ReadOnly)) {
QTextStream t(&qfile);
- ret = split_value_list(t.readLine());
+ const QString &line = t.readLine();
+ ret = split_value_list(QStringRef(&line));
}
}
break; }
@@ -996,7 +1104,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
ProString priosfx = args.count() < 4 ? ProString(".priority") : args.at(3);
populateDeps(orgList, prefix,
args.count() < 3 ? ProStringList(ProString(".depends"))
- : split_value_list(args.at(2).toQString(m_tmp2)),
+ : split_value_list(args.at(2).toQStringRef()),
priosfx, dependencies, dependees, rootSet);
while (!rootSet.isEmpty()) {
QMultiMap<int, ProString>::iterator it = rootSet.begin();
@@ -1187,6 +1295,38 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
return ReturnTrue;
}
+ case T_DISCARD_FROM: {
+ if (args.count() != 1 || args.at(0).isEmpty()) {
+ evalError(fL1S("discard_from(file) requires one argument."));
+ return ReturnFalse;
+ }
+ if (m_valuemapStack.count() != 1) {
+ evalError(fL1S("discard_from() cannot be called from functions."));
+ return ReturnFalse;
+ }
+ QString fn = resolvePath(args.at(0).toQString(m_tmp1));
+ ProFile *pro = m_parser->parsedProFile(fn, QMakeParser::ParseOnlyCached);
+ if (!pro)
+ return ReturnFalse;
+ ProValueMap &vmap = m_valuemapStack.first();
+ for (auto vit = vmap.begin(); vit != vmap.end(); ) {
+ if (!vit->isEmpty()) {
+ auto isFrom = [pro](const ProString &s) {
+ return s.sourceFile() == pro;
+ };
+ vit->erase(std::remove_if(vit->begin(), vit->end(), isFrom), vit->end());
+ if (vit->isEmpty()) {
+ // When an initially non-empty variable becomes entirely empty,
+ // undefine it altogether.
+ vit = vmap.erase(vit);
+ continue;
+ }
+ }
+ ++vit;
+ }
+ pro->deref();
+ return ReturnTrue;
+ }
case T_INFILE:
if (args.count() < 2 || args.count() > 3) {
evalError(fL1S("infile(file, var, [values]) requires two or three arguments."));
@@ -1223,7 +1363,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse; // Another qmake breakage
case T_EVAL: {
VisitReturn ret = ReturnFalse;
- ProFile *pro = m_parser->parsedProBlock(args.join(statics.field_sep),
+ QString contents = args.join(statics.field_sep);
+ ProFile *pro = m_parser->parsedProBlock(QStringRef(&contents),
m_current.pro->fileName(), m_current.line);
if (m_cumulative || pro->isOk()) {
m_locationStack.push(m_current);
@@ -1239,7 +1380,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
evalError(fL1S("if(condition) requires one argument."));
return ReturnFalse;
}
- return evaluateConditional(args.at(0).toQString(),
+ return evaluateConditional(args.at(0).toQStringRef(),
m_current.pro->fileName(), m_current.line);
}
case T_CONFIG: {
@@ -1248,7 +1389,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse;
}
if (args.count() == 1)
- return returnBool(isActiveConfig(args.at(0).toQString(m_tmp2)));
+ return returnBool(isActiveConfig(args.at(0).toQStringRef()));
const QStringList &mutuals = args.at(1).toQString(m_tmp2).split(QLatin1Char('|'));
const ProStringList &configs = values(statics.strCONFIG);
@@ -1331,8 +1472,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
.arg(function.toQString(m_tmp1)));
return ReturnFalse;
}
- const QString &rhs(args.at(1).toQString(m_tmp1)),
- &lhs(values(map(args.at(0))).join(statics.field_sep));
+ const ProString &rhs = args.at(1);
+ const QString &lhs = values(map(args.at(0))).join(statics.field_sep);
bool ok;
int rhs_int = rhs.toInt(&ok);
if (ok) { // do integer compare
@@ -1344,8 +1485,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
}
if (func_t == T_GREATERTHAN)
- return returnBool(lhs > rhs);
- return returnBool(lhs < rhs);
+ return returnBool(lhs > rhs.toQStringRef());
+ return returnBool(lhs < rhs.toQStringRef());
}
case T_EQUALS:
if (args.count() != 2) {
@@ -1413,7 +1554,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (m_cumulative)
flags = LoadSilent;
if (args.count() >= 2) {
- parseInto = args.at(1).toQString(m_tmp2);
+ if (!args.at(1).isEmpty())
+ parseInto = args.at(1) + QLatin1Char('.');
if (args.count() >= 3 && isTrue(args.at(2)))
flags = LoadSilent;
}
@@ -1430,17 +1572,15 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
it = m_valuemapStack.top().constBegin(),
end = m_valuemapStack.top().constEnd();
it != end; ++it) {
- const QString &ky = it.key().toQString(m_tmp1);
- if (!(ky.startsWith(parseInto) &&
- (ky.length() == parseInto.length()
- || ky.at(parseInto.length()) == QLatin1Char('.'))))
+ const ProString &ky = it.key();
+ if (!ky.startsWith(parseInto))
newMap[it.key()] = it.value();
}
for (ProValueMap::ConstIterator it = symbols.constBegin();
it != symbols.constEnd(); ++it) {
const QString &ky = it.key().toQString(m_tmp1);
if (!ky.startsWith(QLatin1Char('.')))
- newMap.insert(ProKey(parseInto + QLatin1Char('.') + ky), it.value());
+ newMap.insert(ProKey(parseInto + ky), it.value());
}
m_valuemapStack.top() = newMap;
}
@@ -1492,7 +1632,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
#ifdef PROEVALUATOR_FULL
fputs(msg.toLatin1().constData(), stderr);
#endif
- } else {
+ } else if (!msg.isEmpty() || func_t != T_ERROR) {
m_handler->fileMessage(
(func_t == T_ERROR ? QMakeHandler::ErrorMessage :
func_t == T_WARNING ? QMakeHandler::WarningMessage :
@@ -1586,7 +1726,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (!vals.isEmpty())
contents = vals.join(QLatin1Char('\n')) + QLatin1Char('\n');
if (args.count() >= 3) {
- const auto opts = split_value_list(args.at(2).toQString(m_tmp2));
+ const auto opts = split_value_list(args.at(2).toQStringRef());
for (const ProString &opt : opts) {
opt.toQString(m_tmp3);
if (m_tmp3 == QLatin1String("append")) {
@@ -1659,7 +1799,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
ProKey srcvar;
if (args.count() >= 2) {
- const auto opts = split_value_list(args.at(1).toQString(m_tmp2));
+ const auto opts = split_value_list(args.at(1).toQStringRef());
for (const ProString &opt : opts) {
opt.toQString(m_tmp3);
if (m_tmp3 == QLatin1String("transient")) {
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 4c2a6d5335..789d6d77f0 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -270,7 +270,7 @@ void QMakeEvaluator::skipHashStr(const ushort *&tokPtr)
// FIXME: this should not build new strings for direct sections.
// Note that the E_SPRINTF and E_LIST implementations rely on the deep copy.
-ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFile *source)
+ProStringList QMakeEvaluator::split_value_list(const QStringRef &vals, const ProFile *source)
{
QString build;
ProStringList ret;
@@ -318,7 +318,7 @@ ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFil
--x;
}
}
- // fallthrough
+ Q_FALLTHROUGH();
default:
hadWord = true;
break;
@@ -629,7 +629,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
evalError(fL1S("Conditional must expand to exactly one word."));
okey = false;
} else {
- okey = isActiveConfig(curr.at(0).toQString(m_tmp2), true);
+ okey = isActiveConfig(curr.at(0).toQStringRef(), true);
traceMsg("condition %s is %s", dbgStr(curr.at(0)), dbgBool(okey));
okey ^= invert;
}
@@ -1291,7 +1291,7 @@ void QMakeEvaluator::setupProject()
void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where)
{
if (!cmds.isEmpty()) {
- ProFile *pro = m_parser->parsedProBlock(cmds, where, -1);
+ ProFile *pro = m_parser->parsedProBlock(QStringRef(&cmds), where, -1);
if (pro->isOk()) {
m_locationStack.push(m_current);
visitProBlock(pro, pro->tokPtr());
@@ -1585,7 +1585,7 @@ QString QMakeEvaluator::currentDirectory() const
return QString();
}
-bool QMakeEvaluator::isActiveConfig(const QString &config, bool regex)
+bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex)
{
// magic types for easy flipping
if (config == statics.strtrue)
@@ -1597,7 +1597,7 @@ bool QMakeEvaluator::isActiveConfig(const QString &config, bool regex)
return m_hostBuild;
if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) {
- QString cfg = config;
+ QString cfg = config.toString();
cfg.detach(); // Keep m_tmp out of QRegExp's cache
QRegExp re(cfg, Qt::CaseSensitive, QRegExp::Wildcard);
@@ -1619,7 +1619,7 @@ bool QMakeEvaluator::isActiveConfig(const QString &config, bool regex)
return true;
// CONFIG variable
- if (values(statics.strCONFIG).contains(ProString(config)))
+ if (values(statics.strCONFIG).contains(config))
return true;
}
@@ -1643,7 +1643,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::expandVariableReferences(
tokPtr++;
continue;
}
- // fallthrough
+ Q_FALLTHROUGH();
default:
Q_ASSERT_X(false, "expandVariableReferences", "Unrecognized token");
break;
@@ -1783,7 +1783,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateExpandFunction(
}
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditional(
- const QString &cond, const QString &where, int line)
+ const QStringRef &cond, const QString &where, int line)
{
VisitReturn ret = ReturnFalse;
ProFile *pro = m_parser->parsedProBlock(cond, where, line, QMakeParser::TestGrammar);
@@ -1801,7 +1801,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::checkRequirements(const ProStringLis
{
ProStringList &failed = valuesRef(ProKey("QMAKE_FAILED_REQUIREMENTS"));
for (const ProString &dep : deps) {
- VisitReturn vr = evaluateConditional(dep.toQString(), m_current.pro->fileName(), m_current.line);
+ VisitReturn vr = evaluateConditional(dep.toQStringRef(), m_current.pro->fileName(), m_current.line);
if (vr == ReturnError)
return ReturnError;
if (vr != ReturnTrue)
@@ -2109,7 +2109,7 @@ QString QMakeEvaluator::formatValue(const ProString &val, bool forceQuote)
break;
case 32:
quote = true;
- // fallthrough
+ Q_FALLTHROUGH();
default:
ret += c;
break;
diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h
index 2fdf6718a6..3f2a22c567 100644
--- a/qmake/library/qmakeevaluator.h
+++ b/qmake/library/qmakeevaluator.h
@@ -176,7 +176,7 @@ public:
void setTemplate();
- ProStringList split_value_list(const QString &vals, const ProFile *source = 0);
+ ProStringList split_value_list(const QStringRef &vals, const ProFile *source = 0);
VisitReturn expandVariableReferences(const ushort *&tokPtr, int sizeHint, ProStringList *ret, bool joined);
QString currentFileName() const;
@@ -215,7 +215,7 @@ public:
ProStringList evaluateBuiltinExpand(int func_t, const ProKey &function, const ProStringList &args);
VisitReturn evaluateBuiltinConditional(int func_t, const ProKey &function, const ProStringList &args);
- VisitReturn evaluateConditional(const QString &cond, const QString &where, int line = -1);
+ VisitReturn evaluateConditional(const QStringRef &cond, const QString &where, int line = -1);
#ifdef PROEVALUATOR_FULL
VisitReturn checkRequirements(const ProStringList &deps);
#endif
@@ -223,7 +223,7 @@ public:
void updateMkspecPaths();
void updateFeaturePaths();
- bool isActiveConfig(const QString &config, bool regex = false);
+ bool isActiveConfig(const QStringRef &config, bool regex = false);
void populateDeps(
const ProStringList &deps, const ProString &prefix, const ProStringList &suffixes,
@@ -231,12 +231,16 @@ public:
QHash<ProKey, QSet<ProKey> > &dependencies, ProValueMap &dependees,
QMultiMap<int, ProString> &rootSet) const;
+ bool getMemberArgs(const ProKey &name, int srclen, const ProStringList &args,
+ int *start, int *end);
+ VisitReturn parseJsonInto(const QByteArray &json, const QString &into, ProValueMap *value);
+
VisitReturn writeFile(const QString &ctx, const QString &fn, QIODevice::OpenMode mode,
bool exe, const QString &contents);
#ifndef QT_BOOTSTRAPPED
void runProcess(QProcess *proc, const QString &command) const;
#endif
- QByteArray getCommandOutput(const QString &args) const;
+ QByteArray getCommandOutput(const QString &args, int *exitCode) const;
QMakeEvaluator *m_caller;
#ifdef PROEVALUATOR_CUMULATIVE
diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp
index 82764e8732..b02bf4aaf8 100644
--- a/qmake/library/qmakeglobals.cpp
+++ b/qmake/library/qmakeglobals.cpp
@@ -136,6 +136,11 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
break;
default:
if (arg.startsWith(QLatin1Char('-'))) {
+ if (arg == QLatin1String("--")) {
+ state.extraargs = args.mid(*pos + 1);
+ *pos = args.size();
+ return ArgumentsOk;
+ }
if (arg == QLatin1String("-after"))
state.after = true;
else if (arg == QLatin1String("-config"))
@@ -181,6 +186,12 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
{
if (!state.preconfigs.isEmpty())
state.precmds << (fL1S("CONFIG += ") + state.preconfigs.join(QLatin1Char(' ')));
+ if (!state.extraargs.isEmpty()) {
+ QString extra = fL1S("QMAKE_EXTRA_ARGS =");
+ for (const QString &ea : qAsConst(state.extraargs))
+ extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea));
+ state.precmds << extra;
+ }
precmds = state.precmds.join(QLatin1Char('\n'));
if (!state.postconfigs.isEmpty())
state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(QLatin1Char(' ')));
diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h
index 79237e6ebe..96c39fa168 100644
--- a/qmake/library/qmakeglobals.h
+++ b/qmake/library/qmakeglobals.h
@@ -85,7 +85,7 @@ class QMAKE_EXPORT QMakeCmdLineParserState
public:
QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), after(false) {}
QString pwd;
- QStringList precmds, preconfigs, postcmds, postconfigs;
+ QStringList precmds, preconfigs, postcmds, postconfigs, extraargs;
bool after;
void flush() { after = false; }
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index fc97310bbd..56b217dfbb 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -165,7 +165,7 @@ QMakeParser::QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler
ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
{
ProFile *pro;
- if ((flags & ParseUseCache) && m_cache) {
+ if ((flags & (ParseUseCache|ParseOnlyCached)) && m_cache) {
ProFileCache::Entry *ent;
#ifdef PROPARSER_THREAD_SAFE
QMutexLocker locker(&m_cache->mutex);
@@ -187,7 +187,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
#endif
if ((pro = ent->pro))
pro->ref();
- } else {
+ } else if (!(flags & ParseOnlyCached)) {
ent = &m_cache->parsed_files[fileName];
#ifdef PROPARSER_THREAD_SAFE
ent->locker = new ProFileCache::Entry::Locker;
@@ -212,19 +212,23 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
ent->locker = 0;
}
#endif
+ } else {
+ pro = 0;
}
- } else {
+ } else if (!(flags & ParseOnlyCached)) {
pro = new ProFile(fileName);
if (!read(pro, flags)) {
delete pro;
pro = 0;
}
+ } else {
+ pro = 0;
}
return pro;
}
ProFile *QMakeParser::parsedProBlock(
- const QString &contents, const QString &name, int line, SubGrammar grammar)
+ const QStringRef &contents, const QString &name, int line, SubGrammar grammar)
{
ProFile *pro = new ProFile(name);
read(pro, contents, line, grammar);
@@ -247,7 +251,7 @@ bool QMakeParser::read(ProFile *pro, ParseFlags flags)
fL1S("Cannot read %1: %2").arg(pro->fileName(), errStr));
return false;
}
- read(pro, content, 1, FullGrammar);
+ read(pro, QStringRef(&content), 1, FullGrammar);
return true;
}
@@ -289,7 +293,7 @@ void QMakeParser::finalizeHashStr(ushort *buf, uint len)
buf[-2] = (ushort)(hash >> 16);
}
-void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar grammar)
+void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar grammar)
{
m_proFile = pro;
m_lineNo = line;
@@ -337,8 +341,8 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
QStack<ParseCtx> xprStack;
xprStack.reserve(10);
- // We rely on QStrings being null-terminated, so don't maintain a global end pointer.
const ushort *cur = (const ushort *)in.unicode();
+ const ushort *inend = cur + in.length();
m_canElse = false;
freshLine:
m_state = StNew;
@@ -421,7 +425,7 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
int indent;
if (context == CtxPureValue) {
- end = (const ushort *)in.unicode() + in.length();
+ end = inend;
cptr = 0;
lineCont = false;
indent = 0; // just gcc being stupid
@@ -433,24 +437,30 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
// First, skip leading whitespace
for (indent = 0; ; ++cur, ++indent) {
+ if (cur == inend) {
+ cur = 0;
+ goto flushLine;
+ }
c = *cur;
if (c == '\n') {
++cur;
goto flushLine;
- } else if (!c) {
- cur = 0;
- goto flushLine;
- } else if (c != ' ' && c != '\t' && c != '\r') {
- break;
}
+ if (c != ' ' && c != '\t' && c != '\r')
+ break;
}
// Then strip comments. Yep - no escaping is possible.
for (cptr = cur;; ++cptr) {
+ if (cptr == inend) {
+ end = cptr;
+ break;
+ }
c = *cptr;
if (c == '#') {
- for (end = cptr; (c = *++cptr);) {
- if (c == '\n') {
+ end = cptr;
+ while (++cptr < inend) {
+ if (*cptr == '\n') {
++cptr;
break;
}
@@ -463,10 +473,6 @@ void QMakeParser::read(ProFile *pro, const QString &in, int line, SubGrammar gra
}
break;
}
- if (!c) {
- end = cptr;
- break;
- }
if (c == '\n') {
end = cptr++;
break;
@@ -1218,7 +1224,7 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort **ptr,
ushort **buf, QString *xprBuff,
ushort **tokPtr, QString *tokBuff,
- const ushort *cur, const QString &in)
+ const ushort *cur, const QStringRef &in)
{
QString out;
m_tmp.setRawData((const QChar *)xprPtr, tlen);
diff --git a/qmake/library/qmakeparser.h b/qmake/library/qmakeparser.h
index f78b3215bb..6557ad65b5 100644
--- a/qmake/library/qmakeparser.h
+++ b/qmake/library/qmakeparser.h
@@ -78,7 +78,8 @@ public:
enum ParseFlag {
ParseDefault = 0,
ParseUseCache = 1,
- ParseReportMissing = 2
+ ParseOnlyCached = 2,
+ ParseReportMissing = 4
};
Q_DECLARE_FLAGS(ParseFlags, ParseFlag)
@@ -87,7 +88,7 @@ public:
enum SubGrammar { FullGrammar, TestGrammar, ValueGrammar };
// fileName is expected to be absolute and cleanPath()ed.
ProFile *parsedProFile(const QString &fileName, ParseFlags flags = ParseDefault);
- ProFile *parsedProBlock(const QString &contents, const QString &name, int line = 0,
+ ProFile *parsedProBlock(const QStringRef &contents, const QString &name, int line = 0,
SubGrammar grammar = FullGrammar);
void discardFileFromCache(const QString &fileName);
@@ -130,7 +131,7 @@ private:
};
bool read(ProFile *pro, ParseFlags flags);
- void read(ProFile *pro, const QString &content, int line, SubGrammar grammar);
+ void read(ProFile *pro, const QStringRef &content, int line, SubGrammar grammar);
ALWAYS_INLINE void putTok(ushort *&tokPtr, ushort tok);
ALWAYS_INLINE void putBlockLen(ushort *&tokPtr, uint len);
@@ -141,7 +142,7 @@ private:
ALWAYS_INLINE bool resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort **ptr,
ushort **buf, QString *xprBuff,
ushort **tokPtr, QString *tokBuff,
- const ushort *cur, const QString &in);
+ const ushort *cur, const QStringRef &in);
void finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount);
void finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int argc);
void warnOperator(const char *msg);
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 8410e83cbf..6d7e023b41 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -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 qmake application of the Qt Toolkit.
@@ -42,6 +43,10 @@
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+#endif
+
QT_BEGIN_NAMESPACE
#ifdef Q_OS_WIN
@@ -241,6 +246,30 @@ static int doInstall(int argc, char **argv)
return 3;
}
+static int dumpMacros(const wchar_t *cmdline)
+{
+ // from http://stackoverflow.com/questions/3665537/how-to-find-out-cl-exes-built-in-macros
+ int argc;
+ wchar_t **argv = CommandLineToArgvW(cmdline, &argc);
+ if (!argv)
+ return 2;
+ for (int i = 0; i < argc; ++i) {
+ if (argv[i][0] != L'-' || argv[i][1] != 'D')
+ continue;
+
+ wchar_t *value = wcschr(argv[i], L'=');
+ if (value) {
+ *value = 0;
+ ++value;
+ } else {
+ // point to the NUL at the end, so we don't print anything
+ value = argv[i] + wcslen(argv[i]);
+ }
+ wprintf(L"#define %Ls %Ls\n", argv[i] + 2, value);
+ }
+ return 0;
+}
+
#endif // Q_OS_WIN
/* This is to work around lame implementation on Darwin. It has been noted that the getpwd(3) function
@@ -275,6 +304,15 @@ int runQMake(int argc, char **argv)
// Workaround for inferior/missing command line tools on Windows: make our own!
if (argc >= 2 && !strcmp(argv[1], "-install"))
return doInstall(argc - 2, argv + 2);
+
+ {
+ // Support running as Visual C++'s compiler
+ const wchar_t *cmdline = _wgetenv(L"MSC_CMD_FLAGS");
+ if (!cmdline || !*cmdline)
+ cmdline = _wgetenv(L"MSC_IDE_FLAGS");
+ if (cmdline && *cmdline)
+ return dumpMacros(cmdline);
+ }
#endif
QMakeVfs vfs;
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 55c8314fa0..2f8411d52f 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -119,7 +119,8 @@ QStringList QMakeProject::expand(const ProKey &func, const QList<ProStringList>
ProString QMakeProject::expand(const QString &expr, const QString &where, int line)
{
ProString ret;
- ProFile *pro = m_parser->parsedProBlock(expr, where, line, QMakeParser::ValueGrammar);
+ ProFile *pro = m_parser->parsedProBlock(QStringRef(&expr), where, line,
+ QMakeParser::ValueGrammar);
if (pro->isOk()) {
m_current.pro = pro;
m_current.line = 0;
diff --git a/qmake/project.h b/qmake/project.h
index 5de4e700b6..d7a5852bed 100644
--- a/qmake/project.h
+++ b/qmake/project.h
@@ -55,7 +55,7 @@ public:
ProString expand(const QString &v, const QString &file, int line);
QStringList expand(const ProKey &func, const QList<ProStringList> &args);
bool test(const QString &v, const QString &file, int line)
- { m_current.clear(); return evaluateConditional(v, file, line) == ReturnTrue; }
+ { m_current.clear(); return evaluateConditional(QStringRef(&v), file, line) == ReturnTrue; }
bool test(const ProKey &func, const QList<ProStringList> &args);
bool isSet(const ProKey &v) const { return m_valuemapStack.first().contains(v); }
@@ -64,6 +64,8 @@ public:
int intValue(const ProKey &v, int defaultValue = 0) const;
const ProValueMap &variables() const { return m_valuemapStack.first(); }
ProValueMap &variables() { return m_valuemapStack.first(); }
+ bool isActiveConfig(const QString &config, bool regex = false)
+ { return QMakeEvaluator::isActiveConfig(QStringRef(&config), regex); }
void dump() const;
@@ -78,7 +80,6 @@ public:
using QMakeEvaluator::propertyValue;
using QMakeEvaluator::values;
using QMakeEvaluator::first;
- using QMakeEvaluator::isActiveConfig;
using QMakeEvaluator::isHostBuild;
using QMakeEvaluator::dirSep;
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index 782151d763..7f49bb9adb 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -11,8 +11,7 @@ SOURCES += project.cpp property.cpp main.cpp \
generators/win32/msvc_nmake.cpp generators/projectgenerator.cpp \
generators/win32/msvc_vcproj.cpp \
generators/win32/msvc_vcxproj.cpp \
- generators/win32/msvc_objectmodel.cpp generators/win32/msbuild_objectmodel.cpp \
- generators/win32/cesdkhandler.cpp
+ generators/win32/msvc_objectmodel.cpp generators/win32/msbuild_objectmodel.cpp
HEADERS += project.h property.h \
library/qmake_global.h library/ioutils.h library/proitems.h library/qmakevfs.h library/qmakeglobals.h \
@@ -24,8 +23,7 @@ HEADERS += project.h property.h \
generators/xmloutput.h generators/win32/msvc_nmake.h \
generators/win32/msvc_vcproj.h \
generators/win32/msvc_vcxproj.h \
- generators/win32/msvc_objectmodel.h generators/win32/msbuild_objectmodel.h \
- generators/win32/cesdkhandler.h
+ generators/win32/msvc_objectmodel.h generators/win32/msbuild_objectmodel.h
bootstrap { #Qt code
SOURCES+= \
diff --git a/qtbase.pro b/qtbase.pro
index 11cff9e8bf..d2d308870d 100644
--- a/qtbase.pro
+++ b/qtbase.pro
@@ -31,6 +31,7 @@ QMAKE_DISTCLEAN += \
mkspecs/qhost.pri \
mkspecs/qmodule.pri \
src/corelib/global/qconfig.h \
+ src/corelib/global/qconfig_p.h \
src/corelib/global/qconfig.cpp \
bin/qt.conf
@@ -74,100 +75,10 @@ prefix_build|!equals(PWD, $$OUT_PWD) {
}
-# Generate qfeatures.h
-features =
-lines = $$cat("src/corelib/global/qfeatures.txt", lines)
-for (line, lines) {
- t = $$replace(line, "^Feature: (\\S+)\\s*$", "\\1")
- !isEqual(t, $$line) {
- feature = $$t
- features += $$t
- } else {
- t = $$replace(line, "^Requires: (.*)$", "\\1")
- !isEqual(t, $$line) {
- features.$${feature}.depends = $$replace(t, \\s+$, )
- } else {
- t = $$replace(line, "^Name: (.*)$", "\\1")
- !isEqual(t, $$line) {
- features.$${feature}.name = $$replace(t, \\s+$, )
- }
- }
- }
-}
-features = $$sort_depends(features, features.)
-features = $$reverse(features)
-FEATURES_H = \
- "/*" \
- " * All feature dependencies." \
- " *" \
- " * This list is generated by qmake from <qtbase>/src/corelib/global/qfeatures.txt" \
- " */"
-FEATURES_PRI =
-for (ft, features) {
- !isEmpty(features.$${ft}.depends) {
- FEATURES_H += \
- "$${LITERAL_HASH}if !defined(QT_NO_$$ft) && ($$join($$list($$split(features.$${ft}.depends)), ") || defined(QT_NO_", "defined(QT_NO_", ")"))" \
- "$${LITERAL_HASH} define QT_NO_$$ft" \
- "$${LITERAL_HASH}endif"
- FEATURES_PRI += \
- "contains(QT_DISABLED_FEATURES, "$$lower($$join($$list($$replace(features.$${ft}.depends, _, -)), "|"))"): \\" \
- " QT_DISABLED_FEATURES += $$lower($$replace(ft, _, -))"
- }
-}
-write_file($$OUT_PWD/src/corelib/global/qfeatures.h, FEATURES_H)|error("Aborting.")
-# Create forwarding header
-FWD_FEATURES_H = \
- '$${LITERAL_HASH}include "../../src/corelib/global/qfeatures.h"'
-write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error("Aborting.")
-
-no_features =
-lines = $$cat($$absolute_path($$QT_QCONFIG_PATH, $$PWD/src/corelib/global), lines)
-for (line, lines) {
- # We ignore all defines that don't follow the #ifndef + indent pattern.
- # This makes it possible to have unchecked defines which are no features.
- t = $$replace(line, "^$${LITERAL_HASH} define QT_NO_(\\S+)\\s*$", "\\1")
- !isEqual(t, $$line) {
- isEmpty(features.$${t}.name): \
- error("$$QT_QCONFIG_PATH disables unknown feature $$t")
- no_features += $$t
- }
-}
-for (def, QT_NO_DEFINES) {
- !isEmpty(features.$${def}.name): \
- no_features += $$def
-}
-no_features = $$unique(no_features)
-
-# Don't simply add these to QT_CONFIG, as then one might expect them to be there without load(qfeatures).
-# And we don't want to do that automatically, as the dynamic dependency resolution is somewhat expensive.
-FEATURES_PRI = \
- "$${LITERAL_HASH} Features disabled by configure:" \
- "QT_DISABLED_FEATURES =$$lower($$join($$list($$replace(no_features, _, -)), " ", " "))" \
- "$$escape_expand(\\n)$${LITERAL_HASH} Dependencies derived from <qtbase>/src/corelib/global/qfeatures.txt:" \
- $$FEATURES_PRI \
- "QT_DISABLED_FEATURES = \$\$unique(QT_DISABLED_FEATURES)"
-write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error("Aborting.")
-
-# Create forwarding headers for qconfig.h
-FWD_QCONFIG_H = \
- '$${LITERAL_HASH}include "../../src/corelib/global/qconfig.h"'
-write_file($$OUT_PWD/include/QtCore/qconfig.h, FWD_QCONFIG_H)|error("Aborting.")
-FWD_QTCONFIG = \
- '$${LITERAL_HASH}include "qconfig.h"'
-write_file($$OUT_PWD/include/QtCore/QtConfig, FWD_QTCONFIG)|error("Aborting.")
-
-# Files created by us
-QMAKE_DISTCLEAN += \
- src/corelib/global/qfeatures.h \
- include/QtCore/qfeatures.h \
- mkspecs/qfeatures.pri \
- include/QtCore/qconfig.h \
- include/QtCore/QtConfig
-
#mkspecs
mkspecs.path = $$[QT_HOST_DATA]/mkspecs
mkspecs.files = \
- $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qfeatures.pri \
+ $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri \
$$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qhost.pri \
$$files($$PWD/mkspecs/*)
mkspecs.files -= $$PWD/mkspecs/modules $$PWD/mkspecs/modules-inst
diff --git a/src/3rdparty/android/LICENSE b/src/3rdparty/android/LICENSE
new file mode 100644
index 0000000000..c026b6b79a
--- /dev/null
+++ b/src/3rdparty/android/LICENSE
@@ -0,0 +1,11 @@
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/src/3rdparty/android/qt_attribution.json b/src/3rdparty/android/qt_attribution.json
new file mode 100644
index 0000000000..c1f89fd8bd
--- /dev/null
+++ b/src/3rdparty/android/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "android-native-style",
+ "Name": "Native Style for Android",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in Android platform plugin.",
+
+ "License": "Apache License 2.0",
+ "LicenseId": "Apache-2.0",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 2005 The Android Open Source Project"
+}
diff --git a/src/3rdparty/angle/SYSTEMINFO_LICENSE b/src/3rdparty/angle/SYSTEMINFO_LICENSE
new file mode 100644
index 0000000000..c12444e3bc
--- /dev/null
+++ b/src/3rdparty/angle/SYSTEMINFO_LICENSE
@@ -0,0 +1,22 @@
+Copyright (C) 2009 Apple Inc. All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/angle/TRACEEVENT_LICENSE b/src/3rdparty/angle/TRACEEVENT_LICENSE
new file mode 100644
index 0000000000..34d6cd9268
--- /dev/null
+++ b/src/3rdparty/angle/TRACEEVENT_LICENSE
@@ -0,0 +1,27 @@
+Copyright 2013 The Chromium Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/angle/qt_attribution.json b/src/3rdparty/angle/qt_attribution.json
new file mode 100644
index 0000000000..230f30940b
--- /dev/null
+++ b/src/3rdparty/angle/qt_attribution.json
@@ -0,0 +1,61 @@
+[
+ {
+ "Id": "angle",
+ "Name": "ANGLE Library",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 2002-2013 The ANGLE Project Authors"
+ },
+ {
+ "Id": "angle-arrayboundsclamper",
+ "Name": "ANGLE Array Bounds Clamper for WebKit",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/compiler",
+ "Description": "Implements clamping of array indexing expressions during shader translation.",
+ "License": "BSD 2-clause \"Simplified\" License",
+ "LicenseId": "BSD-2-Clause",
+ "LicenseFile": "src/third_party/compiler/LICENSE",
+ "Copyright": "Copyright (C) 2012 Apple Inc."
+ },
+ {
+ "Id": "angle-murmurhash",
+ "Name": "Murmurhash (as part of ANGLE)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/murmurhash",
+ "License": "Public Domain",
+ "LicenseId": "NONE",
+ "Copyright": "MurmurHash3 was written by Austin Appleby, and is placed in the public domain. The author hereby disclaims copyright to this source code."
+ },
+ {
+ "Id": "angle-systeminfo",
+ "Name": "Systeminfo (as part of ANGLE)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/systeminfo",
+ "License": "BSD 2-clause \"Simplified\" License",
+ "LicenseId": "BSD-2-Clause",
+ "LicenseFile": "SYSTEMINFO_LICENSE",
+ "Copyright": "Copyright (C) 2009 Apple Inc. All Rights Reserved."
+ },
+ {
+ "Id": "angle-trace_event",
+ "Name": "trace_event (as part of ANGLE)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/trace_event",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "TRACEEVENT_LICENSE",
+ "Copyright": "Copyright (c) 2013 The Chromium Authors."
+ }
+]
diff --git a/src/3rdparty/atspi2/LICENSE b/src/3rdparty/atspi2/LICENSE
new file mode 100644
index 0000000000..dc5f1b170d
--- /dev/null
+++ b/src/3rdparty/atspi2/LICENSE
@@ -0,0 +1,482 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
diff --git a/src/3rdparty/atspi2/qt_attribution.json b/src/3rdparty/atspi2/qt_attribution.json
new file mode 100644
index 0000000000..ed2ef85158
--- /dev/null
+++ b/src/3rdparty/atspi2/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "atspi2",
+ "Name": "at-spi2 (Assistive Technology Service Provider Interface)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally ysed on Linux for accessibility. Configure without dbus (QT_CONFIG-=accessibility-atspi-bridge) to avoid.",
+
+ "License": "GNU Library General Public License v2 or later",
+ "LicenseId": "LGPL-2.0+",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright 2010, 2011 Novell, Inc., Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany."
+}
diff --git a/src/3rdparty/double-conversion/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/double-conversion/qt_attribution.json b/src/3rdparty/double-conversion/qt_attribution.json
new file mode 100644
index 0000000000..92118ac779
--- /dev/null
+++ b/src/3rdparty/double-conversion/qt_attribution.json
@@ -0,0 +1,14 @@
+{
+ "Id": "doubleconversion",
+ "Name": "Efficient Binary-Decimal and Decimal-Binary Conversion Routines for IEEE Doubles",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core. Configure with -system-doubleconversion or -no-doubleconversion to avoid.",
+
+ "Homepage": "https://github.com/google/double-conversion",
+ "Version": "2.0.1",
+ "DownloadLocation": "https://github.com/google/double-conversion/commit/2fb03de56faa32bbba5e02222528e7b760f71d77",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright 2006-2012, the V8 project authors"
+}
diff --git a/src/3rdparty/easing/legal.qdoc b/src/3rdparty/easing/LICENSE
index 466ff1561b..5dc85c4712 100644
--- a/src/3rdparty/easing/legal.qdoc
+++ b/src/3rdparty/easing/LICENSE
@@ -1,10 +1,3 @@
-/*!
-\page legal-easing.html
-\title Easing Equations by Robert Penner
-\ingroup licensing
-
-\legalese
-\code
Copyright (c) 2001 Robert Penner
All rights reserved.
@@ -30,6 +23,3 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\endcode
-\endlegalese
-*/
diff --git a/src/3rdparty/easing/qt_attribution.json b/src/3rdparty/easing/qt_attribution.json
new file mode 100644
index 0000000000..b6240c61c8
--- /dev/null
+++ b/src/3rdparty/easing/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "easing",
+ "Name": "Easing Equations by Robert Penner",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QEasingCurve).",
+
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 2001 Robert Penner"
+}
diff --git a/src/3rdparty/forkfd/LICENSE b/src/3rdparty/forkfd/LICENSE
new file mode 100644
index 0000000000..351ebf705d
--- /dev/null
+++ b/src/3rdparty/forkfd/LICENSE
@@ -0,0 +1,19 @@
+Copyright (C) 2016 Intel Corporation.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/src/3rdparty/forkfd/qt_attribution.json b/src/3rdparty/forkfd/qt_attribution.json
new file mode 100644
index 0000000000..89f25f4870
--- /dev/null
+++ b/src/3rdparty/forkfd/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "forkfd",
+ "Name": "forkfd",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used on most Unix platforms in Qt Core.",
+
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 2013-2016 Intel Corporation
+Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com"
+}
diff --git a/src/3rdparty/freebsd/LICENSE b/src/3rdparty/freebsd/LICENSE
new file mode 100644
index 0000000000..5bb30318eb
--- /dev/null
+++ b/src/3rdparty/freebsd/LICENSE
@@ -0,0 +1,31 @@
+Copyright (c) 1992, 1993
+ The Regents of the University of California. All rights reserved.
+
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/src/3rdparty/freebsd/qt_attribution.json b/src/3rdparty/freebsd/qt_attribution.json
new file mode 100644
index 0000000000..40c337cc67
--- /dev/null
+++ b/src/3rdparty/freebsd/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "freebsd",
+ "Name": "FreeBSD strtoll and strtoull",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core.",
+
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 1992, 1993
+ The Regents of the University of California. All rights reserved.
+
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation."
+}
diff --git a/src/3rdparty/freetype/freetype.pro b/src/3rdparty/freetype/freetype.pro
index 41ca469576..6d630d4190 100644
--- a/src/3rdparty/freetype/freetype.pro
+++ b/src/3rdparty/freetype/freetype.pro
@@ -68,6 +68,8 @@ DEFINES += FT2_BUILD_LIBRARY
DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
include(../zlib_dependency.pri)
+QT_FOR_CONFIG += gui-private
+include($$OUT_PWD/../../gui/qtgui-config.pri)
DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../png_dependency.pri)
diff --git a/src/3rdparty/freetype/qt_attribution.json b/src/3rdparty/freetype/qt_attribution.json
new file mode 100644
index 0000000000..6c11f1b617
--- /dev/null
+++ b/src/3rdparty/freetype/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "freetype",
+ "Name": "Freetype 2",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.",
+
+ "Description": "FreeType is a freely available software library to render fonts.",
+ "Homepage": "http://www.freetype.org",
+ "License": "Freetype Project License or GNU General Public License v2.0 only",
+ "LicenseId": "FTL or GPL-2.0",
+ "LicenseFile": "docs/LICENSE.TXT",
+ "Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
+}
diff --git a/src/3rdparty/freetype_dependency.pri b/src/3rdparty/freetype_dependency.pri
index 39280deb2f..012e4af6c3 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) {
+qtConfig(system-freetype) {
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
+} else: qtConfig(freetype) {
+ INCLUDEPATH += $$PWD/freetype/include
+ LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix()
}
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
index 4325fd153b..1bfeabb8c4 100644
--- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
+++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
@@ -9,7 +9,9 @@ load(qt_helper_lib)
# built-in shapers list configuration:
SHAPERS += opentype # HB's main shaper; enabling it should be enough most of the time
-mac: SHAPERS += coretext # native shaper on OSX/iOS; could be used alone to handle both OT and AAT fonts
+
+# native shaper on Apple platforms; could be used alone to handle both OT and AAT fonts
+darwin:!if(watchos:CONFIG(simulator, simulator|device)): SHAPERS += coretext
DEFINES += HAVE_CONFIG_H
DEFINES += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED
@@ -146,8 +148,8 @@ contains(SHAPERS, coretext) {
HEADERS += \
$$PWD/src/hb-coretext.h
- ios: \
- # On iOS CoreText and CoreGraphics are stand-alone frameworks
+ uikit: \
+ # On iOS/tvOS/watchOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \
# On Mac OS they are part of the ApplicationServices umbrella framework,
diff --git a/src/3rdparty/harfbuzz-ng/qt_attribution.json b/src/3rdparty/harfbuzz-ng/qt_attribution.json
new file mode 100644
index 0000000000..4d3eb79150
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/qt_attribution.json
@@ -0,0 +1,25 @@
+{
+ "Id": "harfbuzz-ng",
+ "Name": "HarfBuzz-NG",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.",
+
+ "Description": "HarfBuzz is an OpenType text shaping engine.",
+ "Homepage": "http://harfbuzz.org",
+
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "COPYING",
+ "Copyright": "Copyright © 2010,2011,2012 Google, Inc.
+Copyright © 2012 Mozilla Foundation
+Copyright © 2011 Codethink Limited
+Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies)
+Copyright © 2009 Keith Stribley
+Copyright © 2009 Martin Hosken and SIL International
+Copyright © 2007 Chris Wilson
+Copyright © 2006 Behdad Esfahbod
+Copyright © 2005 David Turner
+Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc.
+Copyright © 1998-2004 David Turner and Werner Lemberg
+"
+}
diff --git a/src/3rdparty/harfbuzz/qt_attribution.json b/src/3rdparty/harfbuzz/qt_attribution.json
new file mode 100644
index 0000000000..2c2b31e4a9
--- /dev/null
+++ b/src/3rdparty/harfbuzz/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "harfbuzz",
+ "Name": "HarfBuzz",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.",
+
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "COPYING",
+ "Copyright": "Copyright (c) 1992, 1993
+ The Regents of the University of California. All rights reserved.
+
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation."
+}
diff --git a/src/3rdparty/harfbuzz_dependency.pri b/src/3rdparty/harfbuzz_dependency.pri
index 74433688f6..5946f403c5 100644
--- a/src/3rdparty/harfbuzz_dependency.pri
+++ b/src/3rdparty/harfbuzz_dependency.pri
@@ -1,6 +1,6 @@
-contains(QT_CONFIG, harfbuzz) {
+qtConfig(system-harfbuzz) {
+ QMAKE_USE_PRIVATE += harfbuzz
+} else: qtConfig(harfbuzz) {
INCLUDEPATH += $$PWD/harfbuzz-ng/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtharfbuzzng$$qtPlatformTargetSuffix()
-} else:contains(QT_CONFIG, system-harfbuzz) {
- LIBS_PRIVATE += -lharfbuzz
}
diff --git a/src/3rdparty/iaccessible2/LICENSE b/src/3rdparty/iaccessible2/LICENSE
new file mode 100644
index 0000000000..688d9d3197
--- /dev/null
+++ b/src/3rdparty/iaccessible2/LICENSE
@@ -0,0 +1,38 @@
+Copyright (c) 2013 Linux Foundation
+All rights reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. Neither the name of the Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+This BSD License conforms to the Open Source Initiative "Simplified
+BSD License" as published at:
+http://www.opensource.org/licenses/bsd-license.php
diff --git a/src/3rdparty/iaccessible2/qt_attribution.json b/src/3rdparty/iaccessible2/qt_attribution.json
new file mode 100644
index 0000000000..545ffe4d63
--- /dev/null
+++ b/src/3rdparty/iaccessible2/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "iaccessible2",
+ "Name": "IAccessible2 IDL Specification",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in the Windows platform plugin. Configure with -no-accessibility to avoid.",
+
+ "Description": "IAccessible2 is a new accessibility API which complements Microsoft's earlier work on MSAA",
+ "Homepage": "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+Copyright (c) 2006 IBM Corporation
+Copyright (c) 2007, 2010, 2012, 2013 Linux Foundation
+
+IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 mark may be used in accordance with the Linux Foundation Trademark Policy to indicate compliance with the IAccessible2 specification."
+}
diff --git a/src/3rdparty/libjpeg/LICENSE b/src/3rdparty/libjpeg/LICENSE
new file mode 100644
index 0000000000..797a6d5668
--- /dev/null
+++ b/src/3rdparty/libjpeg/LICENSE
@@ -0,0 +1,50 @@
+from qtbase/src/3rdparty/libjpeg/README:
+
+LEGAL ISSUES
+============
+
+In plain English:
+
+1. We don't promise that this software works. (But if you find any bugs,
+ please let us know!)
+2. You can use this software for whatever you want. You don't have to pay us.
+3. You may not pretend that you wrote this software. If you use it in a
+ program, you must acknowledge somewhere in your documentation that
+ you've used the IJG code.
+
+In legalese:
+
+The authors make NO WARRANTY or representation, either express or implied,
+with respect to this software, its quality, accuracy, merchantability, or
+fitness for a particular purpose. This software is provided "AS IS", and you,
+its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json
new file mode 100644
index 0000000000..ee5c094a0f
--- /dev/null
+++ b/src/3rdparty/libjpeg/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "libjpeg",
+ "Name": "LibJPEG",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in the QJPEG image plugin. Configure with -no-jpeg to avoid.",
+
+ "Description": "The Independent JPEG Group's JPEG software",
+ "Homepage": "http://www.ijg.org/",
+ "License": "Independent JPEG Group License",
+ "LicenseId": "IJG",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 1991-2011, Thomas G. Lane, Guido Vollbeding."
+}
diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json
new file mode 100644
index 0000000000..93e73243af
--- /dev/null
+++ b/src/3rdparty/libpng/qt_attribution.json
@@ -0,0 +1,15 @@
+{
+ "Id": "libpng",
+ "Name": "LibPNG",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in the qpng image plugin. Configure with -system-png or -no-png to avoid.",
+
+ "Description": "libpng is the official PNG reference library.",
+ "Homepage": "http://www.libpng.org/pub/png/libpng.html",
+ "License": "libpng License",
+ "LicenseId": "Libpng",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 1998-2015 Glenn Randers-Pehrson
+Copyright (c) 1996-1997 Andreas Dilger
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."
+}
diff --git a/src/3rdparty/md4/qt_attribution.json b/src/3rdparty/md4/qt_attribution.json
new file mode 100644
index 0000000000..f1bca24660
--- /dev/null
+++ b/src/3rdparty/md4/qt_attribution.json
@@ -0,0 +1,10 @@
+{
+ "Id": "md4",
+ "Name": "MD4",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.",
+
+ "Description": "An OpenSSL-compatible implementation of the RSA Data Security, Inc. MD4 Message-Digest Algorithm.",
+ "License": "Public Domain",
+ "Copyright": "Written by Alexander Peslyak - better known as Solar Designer <solar@openwall.com> - in 2001, and placed in the public domain. There's absolutely no warranty."
+}
diff --git a/src/3rdparty/md5/qt_attribution.json b/src/3rdparty/md5/qt_attribution.json
new file mode 100644
index 0000000000..52b613cf6c
--- /dev/null
+++ b/src/3rdparty/md5/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "md5",
+ "Name": "MD5",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.",
+
+ "Description": "MD5 message-digest algorithm.",
+ "License": "Public Domain",
+ "Copyright": "Written by Colin Plumb in 1993, no copyright is claimed.
+Ian Jackson <ian@chiark.greenend.org.uk>."
+}
diff --git a/src/3rdparty/pcre/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/3rdparty/pcre/qt_attribution.json b/src/3rdparty/pcre/qt_attribution.json
new file mode 100644
index 0000000000..ec8832486b
--- /dev/null
+++ b/src/3rdparty/pcre/qt_attribution.json
@@ -0,0 +1,15 @@
+{
+ "Id": "pcre",
+ "Name": "PCRE",
+ "QDocModule": "qtcore",
+ "QtUsage": "Optionally used in Qt Core (QRegularExpression). Configure with -system-pcre or -no-pcre to avoid.",
+
+ "Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.",
+ "Homepage": "http://www.pcre.org/",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENCE",
+ "Copyright": "Copyright (c) 1997-2015 University of Cambridge
+Copyright (c) 2010-2015 Zoltan Herczeg
+Copyright (c) 2007-2012, Google Inc."
+}
diff --git a/src/3rdparty/pcre_dependency.pri b/src/3rdparty/pcre_dependency.pri
index 2a3c99c7ed..f1355eabe6 100644
--- a/src/3rdparty/pcre_dependency.pri
+++ b/src/3rdparty/pcre_dependency.pri
@@ -1,7 +1,7 @@
-pcre {
+qtConfig(system-pcre) {
+ QMAKE_USE_PRIVATE += pcre
+} else {
win32: DEFINES += PCRE_STATIC
INCLUDEPATH += $$PWD/pcre
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtpcre$$qtPlatformTargetSuffix()
-} else {
- LIBS_PRIVATE += -lpcre16
}
diff --git a/src/3rdparty/pixman/LICENSE b/src/3rdparty/pixman/LICENSE
new file mode 100644
index 0000000000..3cb51484f1
--- /dev/null
+++ b/src/3rdparty/pixman/LICENSE
@@ -0,0 +1,20 @@
+Copyright © 2009 Nokia Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/src/3rdparty/pixman/qt_attribution.json b/src/3rdparty/pixman/qt_attribution.json
new file mode 100644
index 0000000000..607bda754d
--- /dev/null
+++ b/src/3rdparty/pixman/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "pixman",
+ "Name": "Pixman",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in Qt GUI on ARM NEON.",
+
+ "Description": "pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.",
+ "Homepage": "http://www.pixman.org/",
+ "License": "MIT License",
+ "LicenseFile": "LICENSE",
+ "LicenseId": "MIT",
+ "Copyright": "Copyright © 2009 Nokia Corporation"
+}
diff --git a/src/3rdparty/png_dependency.pri b/src/3rdparty/png_dependency.pri
index 2ec2e8929d..50711358a0 100644
--- a/src/3rdparty/png_dependency.pri
+++ b/src/3rdparty/png_dependency.pri
@@ -1,15 +1,6 @@
-contains(QT_CONFIG, system-png) {
- unix|mingw {
- !contains(QT_CONFIG, no-pkg-config) {
- CONFIG += link_pkgconfig
- PKGCONFIG_PRIVATE += libpng
- } else {
- LIBS_PRIVATE += -lpng
- }
- } else {
- LIBS += libpng.lib
- }
-} else: contains(QT_CONFIG, png) {
+qtConfig(system-png) {
+ QMAKE_USE_PRIVATE += libpng
+} else: qtConfig(png) {
INCLUDEPATH += $$PWD/libpng
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtpng$$qtPlatformTargetSuffix()
}
diff --git a/src/3rdparty/rfc6234/LICENSE b/src/3rdparty/rfc6234/LICENSE
new file mode 100644
index 0000000000..7075960ee2
--- /dev/null
+++ b/src/3rdparty/rfc6234/LICENSE
@@ -0,0 +1,34 @@
+Copyright (c) 2011 IETF Trust and the persons identified as
+authors of the code. All rights reserved.
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+- Redistributions of source code must retain the above
+ copyright notice, this list of conditions and
+ the following disclaimer.
+
+- Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+- Neither the name of Internet Society, IETF or IETF Trust, nor
+ the names of specific contributors, may be used to endorse or
+ promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/rfc6234/qt_attribution.json b/src/3rdparty/rfc6234/qt_attribution.json
new file mode 100644
index 0000000000..9fc427b4a6
--- /dev/null
+++ b/src/3rdparty/rfc6234/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "rfc6234",
+ "Name": "Secure Hash Algorithms SHA-384 and SHA-512",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash and QMessageAuthenticationCode)",
+
+ "Description": "Implements the Secure Hash Algorithms SHA 384 and SHA-521",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseFile": "LICENSE",
+ "LicenseId": "BSD-3-Clause",
+ "Copyright": "Copyright (c) 2011 IETF Trust and the persons identified as authors of the code."
+}
diff --git a/src/3rdparty/sha1/qt_attribution.json b/src/3rdparty/sha1/qt_attribution.json
new file mode 100644
index 0000000000..707c239f8d
--- /dev/null
+++ b/src/3rdparty/sha1/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "sha1",
+ "Name": "Secure Hash Algorithm SHA-1",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash).",
+
+ "Description": "Implements the Secure Hash Algorithms SHA 1",
+ "Homepage": "http://www.dominik-reichl.de/projects/csha1/",
+ "License": "Public Domain",
+ "Copyright": "Copyright (C) Dominik Reichl <dominik.reichl@t-online.de>
+Copyright (C) 2016 The Qt Company Ltd"
+}
diff --git a/src/3rdparty/sha3/BRG_ENDIAN_LICENSE b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE
new file mode 100644
index 0000000000..0a4fdcbc3b
--- /dev/null
+++ b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.
+
+LICENSE TERMS
+
+The redistribution and use of this software (with or without changes)
+is allowed without the payment of fees or royalties provided that:
+
+ 1. source code distributions include the above copyright notice, this
+ list of conditions and the following disclaimer;
+
+ 2. binary distributions include the above copyright notice, this list
+ of conditions and the following disclaimer in their documentation;
+
+ 3. the name of the copyright holder is not used to endorse products
+ built using this software without specific written permission.
+
+DISCLAIMER
+
+This software is provided 'as is' with no explicit or implied warranties
+in respect of its properties, including, but not limited to, correctness
+and/or fitness for purpose.
diff --git a/src/3rdparty/sha3/CC0_LICENSE b/src/3rdparty/sha3/CC0_LICENSE
new file mode 100644
index 0000000000..cff12c3d88
--- /dev/null
+++ b/src/3rdparty/sha3/CC0_LICENSE
@@ -0,0 +1,99 @@
+CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF
+THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS
+DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES
+RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and
+Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner")
+of an original work of authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing
+to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and
+without fear of later claims of infringement build upon, modify, incorporate in other works, reuse
+and redistribute as freely as possible in any form whatsoever and for any purposes, including
+without limitation commercial purposes. These owners may contribute to the Commons to promote the
+ideal of a free culture and the further production of creative, cultural and scientific works, or to
+gain reputation or greater distribution for their Work in part through the use and efforts of
+others.
+
+For these and/or other purposes and motivations, and without any expectation of additional
+consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the
+extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to
+apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her
+Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those
+rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and
+ related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights
+ include, but are not limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
+
+ ii. moral rights retained by the original author(s) and/or performer(s);
+
+ iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
+
+ iv. rights protecting against unfair competition in regards to a Work, subject to the limitations
+ in paragraph 4(a), below;
+
+ v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
+
+ vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and
+ of the Council of 11 March 1996 on the legal protection of databases, and under any national
+ implementation thereof, including any amended or successor version of such directive); and
+
+ vii. other similar, equivalent or corresponding rights throughout the world based on applicable
+ law or treaty, and any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law,
+ Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons,
+ and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of
+ action, whether now known or unknown (including existing as well as future claims and causes of
+ action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by
+ applicable law or treaty (including future time extensions), (iii) in any current or future
+ medium and for any number of copies, and (iv) for any purpose whatsoever, including without
+ limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the
+ Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's
+ heirs and successors, fully intending that such Waiver shall not be subject to revocation,
+ rescission, cancellation, termination, or any other legal or equitable action to disrupt the
+ quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of
+ Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid
+ or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent
+ permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent
+ the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non
+ transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise
+ Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for
+ the maximum duration provided by applicable law or treaty (including future time extensions),
+ (iii) in any current or future medium and for any number of copies, and (iv) for any purpose
+ whatsoever, including without limitation commercial, advertising or promotional purposes (the
+ "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to
+ the Work. Should any part of the License for any reason be judged legally invalid or ineffective
+ under applicable law, such partial invalidity or ineffectiveness shall not invalidate the
+ remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i)
+ exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any
+ associated claims and causes of action with respect to the Work, in either case contrary to
+ Affirmer's express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or
+ otherwise affected by this document.
+
+b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning
+ the Work, express, implied, statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non infringement, or the absence of
+ latent or other defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+
+c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work
+ or any use thereof, including without limitation any person's Copyright and Related Rights in the
+ Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents,
+ permissions or other rights required for any use of the Work.
+
+d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and
+ has no duty or obligation with respect to this CC0 or use of the Work.
diff --git a/src/3rdparty/sha3/qt_attribution.json b/src/3rdparty/sha3/qt_attribution.json
new file mode 100644
index 0000000000..13e6e971d9
--- /dev/null
+++ b/src/3rdparty/sha3/qt_attribution.json
@@ -0,0 +1,29 @@
+[
+ {
+ "Id": "sha3_endian",
+ "Name": "Secure Hash Algorithm SHA-3 - brg_endian",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash).",
+
+ "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseFile": "BRG_ENDIAN_LICENSE",
+ "LicenseId": "BSD-3-Clause",
+ "Copyright": "Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved."
+ },
+ {
+ "Id": "sha3_keccak",
+ "Name": "Secure Hash Algorithm SHA-3 - Keccak",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash).",
+
+ "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.",
+ "License": "Creative Commons Zero v1.0 Universal",
+ "LicenseId": "CC0-1.0",
+ "LicenseFile": "CC0_LICENSE",
+ "Copyright": "Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
+
+To the extent possible under law, the implementers have waived all copyright
+and related or neighboring rights to the source code in this file."
+ }
+]
diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri
index 29968e323f..87c356870b 100644
--- a/src/3rdparty/sqlite.pri
+++ b/src/3rdparty/sqlite.pri
@@ -1,7 +1,7 @@
CONFIG(release, debug|release):DEFINES *= NDEBUG
DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE
!contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS
-contains(QT_CONFIG, posix_fallocate):DEFINES += HAVE_POSIX_FALLOCATE=1
+qtConfig(posix_fallocate): DEFINES += HAVE_POSIX_FALLOCATE=1
winrt: DEFINES += SQLITE_OS_WINRT
winphone: DEFINES += SQLITE_WIN32_FILEMAPPING_API=1
qnx: DEFINES += _QNX_SOURCE
diff --git a/src/3rdparty/sqlite/qt_attribution.json b/src/3rdparty/sqlite/qt_attribution.json
new file mode 100644
index 0000000000..a4ea0cdbd2
--- /dev/null
+++ b/src/3rdparty/sqlite/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "sqlite",
+ "Name": "SQLite",
+ "QDocModule": "qtsql",
+ "QtUsage": "Used in Qt SQL Lite plugin. Configure Qt with -system-sqlite or -no-sqlite to avoid.",
+
+ "Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.",
+ "Homepage": "http://www.sqlite.org/",
+ "Version": "3.11.1.0",
+ "License": "Public Domain",
+ "Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed."
+}
diff --git a/src/3rdparty/wintab/qt_attribution.json b/src/3rdparty/wintab/qt_attribution.json
new file mode 100644
index 0000000000..742278fb26
--- /dev/null
+++ b/src/3rdparty/wintab/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "wintab",
+ "Name": "Wintab API",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -DQT_NO_TABLETEVENT to avoid.",
+
+ "Description": "Wintab is a de facto API for pointing devices on Windows.",
+ "Homepage": "http://www.pointing.com/Wintab.html",
+ "License": "Public Domain",
+ "LicenseId": "NONE",
+ "Copyright": "Copyright 1991-1998 by LCS/Telegraphics."
+}
diff --git a/src/3rdparty/xcb/LICENSE b/src/3rdparty/xcb/LICENSE
new file mode 100644
index 0000000000..8f4e5c3a72
--- /dev/null
+++ b/src/3rdparty/xcb/LICENSE
@@ -0,0 +1,23 @@
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or
+their institutions shall not be used in advertising or otherwise to
+promote the sale, use or other dealings in this Software without
+prior written authorization from the authors.
diff --git a/src/3rdparty/xcb/qt_attribution.json b/src/3rdparty/xcb/qt_attribution.json
new file mode 100644
index 0000000000..30b9af3818
--- /dev/null
+++ b/src/3rdparty/xcb/qt_attribution.json
@@ -0,0 +1,24 @@
+{
+ "Id": "xcb",
+ "Name": "XCB",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in xcb platform plugin if configured with -qt-xcb.",
+
+ "Description": "Selected xcb libraries.",
+ "Homepage": "https://xcb.freedesktop.org/",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright © 2000 Keith Packard
+Copyright © 2006 Jamey Sharp
+Copyright © 2007-2008 Vincent Torri <vtorri@univ-evry.fr>
+Copyright © 2007 Bart Massey
+Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
+Copyright © 2008 Arnaud Fontaine <arnau@debian.org>
+Copyright © 2008 Bart Massey <bart@cs.pdx.edu>
+Copyright © 2008 Ian Osgood <iano@quirkster.com>
+Copyright © 2008 Jamey Sharp <jamey@minilop.net>
+Copyright © 2008 Josh Triplett <josh@freedesktop.org>
+Copyright © 2008 Ulrich Eckhardt <doomster@knuut.de>
+"
+}
diff --git a/src/3rdparty/xkbcommon-x11.pri b/src/3rdparty/xkbcommon-x11.pri
new file mode 100644
index 0000000000..36f22ce9cc
--- /dev/null
+++ b/src/3rdparty/xkbcommon-x11.pri
@@ -0,0 +1,10 @@
+include(xkbcommon.pri)
+
+# Build xkbcommon-x11 support library, it depends on -lxcb and -lxcb-xkb, linking is done
+# in xcb-plugin.pro (linked to system libraries or if Qt was configured with -qt-xcb then
+# linked to -lxcb-static).
+INCLUDEPATH += $$PWD/xkbcommon/src/x11
+SOURCES += \
+ $$PWD/xkbcommon/src/x11/util.c \
+ $$PWD/xkbcommon/src/x11/x11-keymap.c \ # renamed: keymap.c -> x11-keymap.c
+ $$PWD/xkbcommon/src/x11/x11-state.c # renamed: state.c -> x11-state.c
diff --git a/src/3rdparty/xkbcommon.pri b/src/3rdparty/xkbcommon.pri
index eaef4749db..12e7a4d8a3 100644
--- a/src/3rdparty/xkbcommon.pri
+++ b/src/3rdparty/xkbcommon.pri
@@ -47,15 +47,4 @@ SOURCES += \
$$PWD/xkbcommon/src/xkbcomp/xkbcomp.c \
$$PWD/xkbcommon/src/xkbcomp/parser.c
-!contains(DEFINES, QT_NO_XKB):contains(QT_CONFIG, use-xkbcommon-x11support): {
- # Build xkbcommon-x11 support library, it depends on -lxcb and -lxcb-xkb, linking is done
- # in xcb-plugin.pro (linked to system libraries or if Qt was configured with -qt-xcb then
- # linked to -lxcb-static).
- INCLUDEPATH += $$PWD/xkbcommon/src/x11
- SOURCES += \
- $$PWD/xkbcommon/src/x11/util.c \
- $$PWD/xkbcommon/src/x11/x11-keymap.c \ # renamed: keymap.c -> x11-keymap.c
- $$PWD/xkbcommon/src/x11/x11-state.c # renamed: state.c -> x11-state.c
-}
-
TR_EXCLUDE += $$PWD/*
diff --git a/src/3rdparty/xkbcommon/qt_attribution.json b/src/3rdparty/xkbcommon/qt_attribution.json
new file mode 100644
index 0000000000..8ee0df1b22
--- /dev/null
+++ b/src/3rdparty/xkbcommon/qt_attribution.json
@@ -0,0 +1,26 @@
+{
+ "Id": "xkbcommon",
+ "Name": "xkbcommon",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in xcb platform plugin. Configure with -system-xkbcommon-x11 to avoid.",
+
+ "Description": "xkbcommon is a keymap compiler and support library which processes a reduced subset of keymaps as defined by the XKB specification.",
+ "Homepage": "http://xkbcommon.org/",
+ "License": "MIT Licenses (with no-advertisement clause)",
+ "LicenseId": "MIT",
+ "LicenseFile": "COPYING",
+ "Copyright": "Copyright 1985, 1987, 1988, 1990, 1998 The Open Group
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+Copyright 1993, 1994, 1995, 1996 by Silicon Graphics Computer Systems, Inc.
+Copyright 1996 by Joseph Moss
+Copyright 2002-2007 Free Software Foundation, Inc.
+Copyright 2003-2004 Dmitry Golubev <lastguru@mail.ru>
+Copyright 2004, Gregory Mokhin <mokhin@bog.msu.ru>
+Copyright 2006 Erdal Ronahî
+Copyright 2008, 2009 Dan Nicholson
+Copyright 2009-2012 Daniel Stone
+Copyright 2010, 2012 Intel Corporation
+Copyright 2010 Francisco Jerez <currojerez@riseup.net>
+Copyright 2011 Joseph Adams <joeyadams3.14159@gmail.com>
+Copyright 2012 Ran Benita <ran234@gmail.com>"
+}
diff --git a/src/3rdparty/zlib/LICENSE b/src/3rdparty/zlib/LICENSE
new file mode 100644
index 0000000000..9c57e18006
--- /dev/null
+++ b/src/3rdparty/zlib/LICENSE
@@ -0,0 +1,28 @@
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not* receiving
+lengthy legal documents to sign. The sources are provided for free but without
+warranty of any kind. The library has been entirely written by Jean-loup
+Gailly and Mark Adler; it does not include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include in
+the file ChangeLog history information documenting your changes. Please read
+the FAQ for more information on the distribution of modified source versions.
+
diff --git a/src/3rdparty/zlib/gzguts.h b/src/3rdparty/zlib/gzguts.h
index 9e4368e889..3daf1070c4 100644
--- a/src/3rdparty/zlib/gzguts.h
+++ b/src/3rdparty/zlib/gzguts.h
@@ -21,7 +21,9 @@
# endif
#endif
-#include "qconfig.h"
+#ifndef QT_BOOTSTRAPPED
+# include <qconfig.h>
+#endif
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) && defined(QT_VISIBILITY_AVAILABLE)
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
diff --git a/src/3rdparty/zlib/qt_attribution.json b/src/3rdparty/zlib/qt_attribution.json
new file mode 100644
index 0000000000..a10fd1921f
--- /dev/null
+++ b/src/3rdparty/zlib/qt_attribution.json
@@ -0,0 +1,15 @@
+{
+ "Id": "zlib",
+ "Name": "Data Compression Library (zlib)",
+ "QDocModule": "qtcore",
+ "QtUsage": "Optionally used in Qt Core and and development tools. Configure with -system-zlib to avoid.",
+
+ "Description": "zlib is a general purpose data compression library.",
+ "Homepage": "http://zlib.net/",
+ "Version": "1.2.5",
+
+ "License": "ZLib license",
+ "LicenseId": "Zlib",
+ "LicenseFile": "LICENSE",
+ "Copyright": "(C) 1995-2010 Jean-loup Gailly and Mark Adler"
+}
diff --git a/src/3rdparty/zlib/zutil.h b/src/3rdparty/zlib/zutil.h
index 4d367a92db..881a7ecb3f 100644
--- a/src/3rdparty/zlib/zutil.h
+++ b/src/3rdparty/zlib/zutil.h
@@ -13,7 +13,9 @@
#ifndef ZUTIL_H
#define ZUTIL_H
-#include "qconfig.h"
+#ifndef QT_BOOTSTRAPPED
+# include <qconfig.h>
+#endif
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) && defined(QT_VISIBILITY_AVAILABLE)
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
diff --git a/src/3rdparty/zlib_dependency.pri b/src/3rdparty/zlib_dependency.pri
index 53e0b3ef39..6ac7e59158 100644
--- a/src/3rdparty/zlib_dependency.pri
+++ b/src/3rdparty/zlib_dependency.pri
@@ -1,10 +1,6 @@
# zlib dependency satisfied by bundled 3rd party zlib or system zlib
-contains(QT_CONFIG, system-zlib) {
- if(unix|mingw):LIBS_PRIVATE += -lz
- else {
- isEmpty(ZLIB_LIBS): LIBS += zdll.lib
- else: LIBS += $$ZLIB_LIBS
- }
+qtConfig(system-zlib) {
+ QMAKE_USE_PRIVATE += zlib
} else {
INCLUDEPATH += $$PWD/zlib
!no_core_dep {
diff --git a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java
new file mode 100644
index 0000000000..7d26b8fa04
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Android port of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.util.DisplayMetrics;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.ImageView;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.view.MotionEvent;
+import android.widget.PopupWindow;
+import android.app.Activity;
+import android.view.ViewTreeObserver;
+
+/* This view represents one of the handle (selection or cursor handle) */
+class CursorView extends ImageView
+{
+ private CursorHandle mHandle;
+ // The coordinare which where clicked
+ private int m_offsetX;
+ private int m_offsetY;
+
+ CursorView (Context context, CursorHandle handle) {
+ super(context);
+ mHandle = handle;
+ }
+
+ // Called when the handle was moved programatically , with the delta amount in pixels
+ public void adjusted(int dx, int dy) {
+ m_offsetX += dx;
+ m_offsetY += dy;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ switch (ev.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN: {
+ m_offsetX = Math.round(ev.getRawX());
+ m_offsetY = Math.round(ev.getRawY());
+ break;
+ }
+
+ case MotionEvent.ACTION_MOVE: {
+ mHandle.updatePosition(Math.round(ev.getRawX()) - m_offsetX,
+ Math.round(ev.getRawY()) - m_offsetY);
+ break;
+ }
+
+ case MotionEvent.ACTION_UP:
+ break;
+
+ case MotionEvent.ACTION_CANCEL:
+ break;
+ }
+ return true;
+ }
+
+}
+
+// Helper class that manages a cursor or selection handle
+public class CursorHandle implements ViewTreeObserver.OnPreDrawListener
+{
+ private View m_layout = null;
+ private CursorView m_cursorView = null;
+ private PopupWindow m_popup = null;
+ private int m_id;
+ private int m_attr;
+ private Activity m_activity;
+ private int m_posX;
+ private int m_posY;
+ private int m_lastX;
+ private int m_lastY;
+ int tolerance;
+
+ public CursorHandle(Activity activity, View layout, int id, int attr) {
+ m_activity = activity;
+ m_id = id;
+ m_attr = attr;
+ m_layout = layout;
+ DisplayMetrics metrics = new DisplayMetrics();
+ activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
+ tolerance = Math.round(2 * metrics.density);
+ m_lastX = m_lastY = -1 - tolerance;
+ }
+
+ private boolean initOverlay(){
+ if (m_popup == null){
+
+ Context context = m_layout.getContext();
+ int[] attrs = {m_attr};
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs);
+ Drawable drawable = a.getDrawable(0);
+
+ m_cursorView = new CursorView(context, this);
+ m_cursorView.setImageDrawable(drawable);
+ // m_layout.addView(m_cursorView);
+
+ m_popup = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle);
+ m_popup.setSplitTouchEnabled(true);
+ m_popup.setClippingEnabled(false);
+ m_popup.setContentView(m_cursorView);
+ m_popup.setWidth(drawable.getIntrinsicWidth());
+ m_popup.setHeight(drawable.getIntrinsicHeight());
+
+ m_layout.getViewTreeObserver().addOnPreDrawListener(this);
+ }
+ return true;
+ }
+
+ // Show the handle at a given position (or move it if it is already shown)
+ public void setPosition(final int x, final int y){
+ initOverlay();
+
+ final int[] location = new int[2];
+ m_layout.getLocationOnScreen(location);
+
+ int x2 = x + location[0];
+ int y2 = y + location[1];
+
+ if (m_id == QtNative.IdCursorHandle) {
+ x2 -= m_cursorView.getWidth() / 2 ;
+ } else if (m_id == QtNative.IdLeftHandle) {
+ x2 -= m_cursorView.getWidth() * 3 / 4;
+ } else if (m_id == QtNative.IdRightHandle) {
+ x2 -= m_cursorView.getWidth() / 4;
+ }
+
+ if (m_popup.isShowing()) {
+ m_popup.update(x2, y2, -1, -1);
+ m_cursorView.adjusted(x - m_posX, y - m_posY);
+ } else {
+ m_popup.showAtLocation(m_layout, 0, x2, y2);
+ }
+
+ m_posX = x;
+ m_posY = y;
+ }
+
+ public void hide() {
+ if (m_popup != null) {
+ m_popup.dismiss();
+ }
+ }
+
+ // The handle was dragged by a given relative position
+ public void updatePosition(int x, int y) {
+ if (Math.abs(m_lastX - x) > tolerance || Math.abs(m_lastY - y) > tolerance) {
+ QtNative.handleLocationChanged(m_id, x + m_posX, y + m_posY);
+ m_lastX = x;
+ m_lastY = y;
+ }
+ }
+
+ @Override
+ public boolean onPreDraw() {
+ // This hook is called when the view location is changed
+ // For example if the keyboard appears.
+ // Adjust the position of the handle accordingly
+ if (m_popup != null && m_popup.isShowing())
+ setPosition(m_posX, m_posY);
+
+ return true;
+ }
+}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/EditMenu.java b/src/android/jar/src/org/qtproject/qt5/android/EditMenu.java
new file mode 100644
index 0000000000..afe7797914
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt5/android/EditMenu.java
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Android port of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android;
+
+import android.view.ActionMode;
+import android.view.ActionMode.Callback;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.TypedArray;
+
+/**
+ * The edit menu actions (when there is selection)
+ */
+class EditMenu implements ActionMode.Callback {
+
+ private final Activity m_activity;
+ private ActionMode m_actionMode;
+
+ public EditMenu(Activity activity) {
+ m_activity = activity;
+ }
+
+ @Override
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ mode.setTitle(null);
+ mode.setSubtitle(null);
+ mode.setTitleOptionalHint(true);
+
+ Context context = m_activity;
+ int[] attrs = {
+ android.R.attr.actionModeSelectAllDrawable, android.R.attr.actionModeCutDrawable,
+ android.R.attr.actionModeCopyDrawable, android.R.attr.actionModePasteDrawable
+ };
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs);
+
+ menu.add(Menu.NONE, android.R.id.selectAll, Menu.NONE, android.R.string.selectAll)
+ .setIcon(a.getResourceId(0, 0))
+ .setAlphabeticShortcut('a')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add(Menu.NONE, android.R.id.cut, Menu.NONE, android.R.string.cut)
+ .setIcon(a.getResourceId(1, 0))
+ .setAlphabeticShortcut('x')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add(Menu.NONE, android.R.id.copy, Menu.NONE, android.R.string.copy)
+ .setIcon(a.getResourceId(2, 0))
+ .setAlphabeticShortcut('c')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add(Menu.NONE, android.R.id.paste, Menu.NONE, android.R.string.paste)
+ .setIcon(a.getResourceId(3, 0))
+ .setAlphabeticShortcut('v')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ return true;
+ }
+
+ @Override
+ public void onDestroyActionMode(ActionMode mode) {
+ m_actionMode = null;
+ }
+
+ @Override
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+
+ switch (item.getItemId()) {
+ case android.R.id.cut:
+ return QtNativeInputConnection.cut();
+ case android.R.id.copy:
+ return QtNativeInputConnection.copy();
+ case android.R.id.paste:
+ return QtNativeInputConnection.paste();
+ case android.R.id.selectAll:
+ return QtNativeInputConnection.selectAll();
+ }
+ return false;
+ }
+
+ public void hide()
+ {
+ if (m_actionMode != null) {
+ m_actionMode.finish();
+ }
+ }
+
+ public void show()
+ {
+ if (m_actionMode == null) {
+ m_actionMode = m_activity.startActionMode(this);
+ }
+ }
+
+ public boolean isShown()
+ {
+ return m_actionMode != null;
+ }
+}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java b/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java
new file mode 100644
index 0000000000..246be1aeb2
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Android port of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.ImageView;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.view.MotionEvent;
+import android.widget.PopupWindow;
+import android.app.Activity;
+import android.view.ViewTreeObserver;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup.LayoutParams;
+import android.view.ViewGroup;
+
+// Helper class that manages a cursor or selection handle
+public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, OnClickListener
+{
+ private View m_layout = null;
+ private View m_view = null;
+ private PopupWindow m_popup = null;
+ private Activity m_activity;
+ private int m_posX;
+ private int m_posY;
+
+ public EditPopupMenu(Activity activity, View layout) {
+ m_activity = activity;
+ m_layout = layout;
+ }
+
+ private boolean initOverlay(){
+ if (m_popup == null){
+ Context context = m_layout.getContext();
+ int[] attrs = { android.R.attr.textEditPasteWindowLayout };
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs);
+ final int layout = a.getResourceId(0, 0);
+ LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ m_view = inflater.inflate(layout, null);
+
+ final int size = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+ m_view.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT));
+ m_view.measure(size, size);
+ m_view.setOnClickListener(this);
+
+ m_popup = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle);
+ m_popup.setSplitTouchEnabled(true);
+ m_popup.setClippingEnabled(false);
+ m_popup.setContentView(m_view);
+ m_popup.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
+ m_popup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+
+ m_layout.getViewTreeObserver().addOnPreDrawListener(this);
+ }
+ return true;
+ }
+
+ public int getHeight()
+ {
+ initOverlay();
+ return m_view.getHeight();
+ }
+
+ // Show the handle at a given position (or move it if it is already shown)
+ public void setPosition(final int x, final int y){
+ initOverlay();
+
+ final int[] location = new int[2];
+ m_layout.getLocationOnScreen(location);
+
+ int x2 = x + location[0];
+ int y2 = y + location[1];
+
+ x2 -= m_view.getWidth() / 2 ;
+ if (x2 < 0)
+ x2 = 0;
+ y2 -= m_view.getHeight();
+
+ if (m_popup.isShowing())
+ m_popup.update(x2, y2, -1, -1);
+ else
+ m_popup.showAtLocation(m_layout, 0, x2, y2);
+
+ m_posX = x;
+ m_posY = y;
+
+ }
+
+ public void hide() {
+ if (m_popup != null) {
+ m_popup.dismiss();
+ }
+ }
+
+ @Override
+ public boolean onPreDraw() {
+ // This hook is called when the view location is changed
+ // For example if the keyboard appears.
+ // Adjust the position of the handle accordingly
+ if (m_popup != null && m_popup.isShowing())
+ setPosition(m_posX, m_posY);
+
+ return true;
+ }
+
+ @Override
+ public void onClick(View v) {
+ QtNativeInputConnection.paste();
+ hide();
+ }
+}
+
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 656dbdda45..bfdbaed43f 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -2,6 +2,7 @@
**
** Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Android port of the Qt Toolkit.
@@ -143,6 +144,11 @@ public class QtActivityDelegate
private int m_portraitKeyboardHeight = 0;
private int m_landscapeKeyboardHeight = 0;
private int m_probeKeyboardHeightDelay = 50; // ms
+ private CursorHandle m_cursorHandle;
+ private CursorHandle m_leftSelectionHandle;
+ private CursorHandle m_rightSelectionHandle;
+ private EditMenu m_editMenu;
+ private EditPopupMenu m_editPopupMenu;
public void setFullScreen(boolean enterFullScreen)
{
@@ -470,6 +476,72 @@ public class QtActivityDelegate
m_imm.updateSelection(m_editText, selStart, selEnd, candidatesStart, candidatesEnd);
}
+ // Values coming from QAndroidInputContext::CursorHandleShowMode
+ private static final int CursorHandleNotShown = 0;
+ private static final int CursorHandleShowNormal = 1;
+ private static final int CursorHandleShowSelection = 2;
+ private static final int CursorHandleShowPopup = 3;
+
+ /* called from the C++ code when the position of the cursor or selection handles needs to
+ be adjusted.
+ mode is one of QAndroidInputContext::CursorHandleShowMode
+ */
+ public void updateHandles(int mode, int x1, int y1, int x2, int y2)
+ {
+ if (mode == CursorHandleNotShown) {
+ if (m_cursorHandle != null)
+ m_cursorHandle.hide();
+ if (m_rightSelectionHandle != null) {
+ m_rightSelectionHandle.hide();
+ m_leftSelectionHandle.hide();
+ }
+ if (m_editMenu != null)
+ m_editMenu.hide();
+ if (m_editPopupMenu != null)
+ m_editPopupMenu.hide();
+ } else if (mode == CursorHandleShowNormal || mode == CursorHandleShowPopup) {
+ if (m_cursorHandle == null) {
+ m_cursorHandle = new CursorHandle(m_activity, m_layout, QtNative.IdCursorHandle,
+ android.R.attr.textSelectHandle);
+ }
+ m_cursorHandle.setPosition(x1, y1);
+ if (m_rightSelectionHandle != null) {
+ m_rightSelectionHandle.hide();
+ m_leftSelectionHandle.hide();
+ }
+ } else if (mode == CursorHandleShowSelection) {
+ if (m_rightSelectionHandle == null) {
+ m_leftSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdLeftHandle,
+ android.R.attr.textSelectHandleLeft);
+ m_rightSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdRightHandle,
+ android.R.attr.textSelectHandleRight);
+ }
+ m_leftSelectionHandle.setPosition(x1,y1);
+ m_rightSelectionHandle.setPosition(x2,y2);
+ if (m_cursorHandle != null)
+ m_cursorHandle.hide();
+
+ if (m_editMenu == null)
+ m_editMenu = new EditMenu(m_activity);
+ m_editMenu.show();
+ }
+
+ // show the edit popup menu
+ if (mode == CursorHandleShowPopup && (m_editMenu == null || !m_editMenu.isShown())
+ && QtNative.hasClipboardText()) {
+ if (m_editPopupMenu == null)
+ m_editPopupMenu = new EditPopupMenu(m_activity, m_layout);
+ if (y2 < m_editPopupMenu.getHeight()) {
+ // If the popup cannot be shown over the text, it must be shown under the anchors
+ y2 = y1 + 2 * m_editPopupMenu.getHeight();
+ }
+ m_editPopupMenu.setPosition(x2, y2);
+ } else if (m_editPopupMenu != null) {
+ m_editPopupMenu.hide();
+ }
+
+ }
+
public boolean loadApplication(Activity activity, ClassLoader classLoader, Bundle loaderParams)
{
/// check parameters integrity
@@ -1383,4 +1455,9 @@ public class QtActivityDelegate
}
return false;
}
+
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
+ {
+ QtNative.sendRequestPermissionsResult(requestCode, permissions, grantResults);
+ }
}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 04b8e6a06f..af4f20679c 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -455,20 +455,25 @@ public class QtNative
}
}
- public static int checkSelfPermission(final String permission)
+ public static Context getContext() {
+ if (m_activity != null)
+ return m_activity;
+ return m_service;
+ }
+
+ public static int checkSelfPermission(String permission)
{
int perm = PackageManager.PERMISSION_DENIED;
synchronized (m_mainActivityMutex) {
- if (m_activity == null)
- return perm;
+ Context context = getContext();
try {
if (Build.VERSION.SDK_INT >= 23) {
if (m_checkSelfPermissionMethod == null)
m_checkSelfPermissionMethod = Context.class.getMethod("checkSelfPermission", String.class);
- perm = (Integer)m_checkSelfPermissionMethod.invoke(m_activity, permission);
+ perm = (Integer)m_checkSelfPermissionMethod.invoke(context, permission);
} else {
- final PackageManager pm = m_activity.getPackageManager();
- perm = pm.checkPermission(permission, m_activity.getPackageName());
+ final PackageManager pm = context.getPackageManager();
+ perm = pm.checkPermission(permission, context.getApplicationContext().getPackageName());
}
} catch (Exception e) {
e.printStackTrace();
@@ -492,6 +497,20 @@ public class QtNative
});
}
+ private static void updateHandles(final int mode,
+ final int x1,
+ final int y1,
+ final int x2,
+ final int y2)
+ {
+ runAction(new Runnable() {
+ @Override
+ public void run() {
+ m_activityDelegate.updateHandles(mode, x1, y1, x2, y2);
+ }
+ });
+ }
+
private static void showSoftwareKeyboard(final int x,
final int y,
final int width,
@@ -569,7 +588,7 @@ public class QtNative
m_clipboardManager.setText(text);
}
- private static boolean hasClipboardText()
+ public static boolean hasClipboardText()
{
if (m_clipboardManager != null)
return m_clipboardManager.hasText();
@@ -777,6 +796,13 @@ public class QtNative
public static native void keyboardGeometryChanged(int x, int y, int width, int height);
// keyboard methods
+ // handle methods
+ public static final int IdCursorHandle = 1;
+ public static final int IdLeftHandle = 2;
+ public static final int IdRightHandle = 3;
+ public static native void handleLocationChanged(int id, int x, int y);
+ // handle methods
+
// dispatch events methods
public static native boolean dispatchGenericMotionEvent(MotionEvent ev);
public static native boolean dispatchKeyEvent(KeyEvent event);
@@ -810,6 +836,8 @@ public class QtNative
public static native void runPendingCppRunnables();
+ public static native void sendRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults);
+
private static native void setNativeActivity(Activity activity);
private static native void setNativeService(Service service);
}
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
index 573a28e44b..22ff1738c8 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
@@ -981,4 +981,11 @@ public class QtActivity extends Activity
//---------------------------------------------------------------------------
//@ANDROID-12
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
+ {
+ if (QtApplication.m_delegateObject != null && QtApplication.onRequestPermissionsResult != null) {
+ QtApplication.invokeDelegateMethod(QtApplication.onRequestPermissionsResult, requestCode , permissions, grantResults);
+ return;
+ }
+ }
}
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java
index 1078060d7f..afc0432bdd 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java
@@ -64,6 +64,7 @@ public class QtApplication extends Application
public static Method onKeyShortcut = null;
public static Method dispatchGenericMotionEvent = null;
public static Method onGenericMotionEvent = null;
+ public static Method onRequestPermissionsResult = null;
private static String activityClassName;
public static void setQtContextDelegate(Class<?> clazz, Object listener)
{
diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
index 9eae06d410..3da59c61e2 100644
--- a/src/angle/src/common/common.pri
+++ b/src/angle/src/common/common.pri
@@ -1,5 +1,6 @@
# static builds should still link ANGLE dynamically when dynamic GL is enabled
-static:contains(QT_CONFIG, dynamicgl) {
+include($$OUT_PWD/../../../gui/qtgui-config.pri)
+static:qtConfig(dynamicgl) {
CONFIG -= static
CONFIG += shared
}
diff --git a/src/angle/src/compiler/preprocessor/preprocessor.pro b/src/angle/src/compiler/preprocessor/preprocessor.pro
index cbf411623d..9d0728a72d 100644
--- a/src/angle/src/compiler/preprocessor/preprocessor.pro
+++ b/src/angle/src/compiler/preprocessor/preprocessor.pro
@@ -1,5 +1,6 @@
CONFIG += static
-contains(QT_CONFIG, dynamicgl): CONFIG += not_installed
+include($$OUT_PWD/../../../../gui/qtgui-config.pri)
+qtConfig(dynamicgl): CONFIG += not_installed
include(../../config.pri)
INCLUDEPATH = $$ANGLE_DIR/src/compiler/preprocessor
diff --git a/src/angle/src/compiler/translator.pro b/src/angle/src/compiler/translator.pro
index d48ac70472..2e5adaee96 100644
--- a/src/angle/src/compiler/translator.pro
+++ b/src/angle/src/compiler/translator.pro
@@ -1,5 +1,6 @@
CONFIG += static
-contains(QT_CONFIG, dynamicgl): CONFIG += not_installed
+include($$OUT_PWD/../../../gui/qtgui-config.pri)
+qtConfig(dynamicgl): CONFIG += not_installed
include(../config.pri)
INCLUDEPATH += \
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri
index 2c5b5ec615..4beb095217 100644
--- a/src/angle/src/config.pri
+++ b/src/angle/src/config.pri
@@ -40,8 +40,6 @@ DEFINES += _WINDOWS \
CONFIG += angle_d3d11 # Remove to disable D3D11 renderer
-equals(QMAKE_TARGET_OS, xp): CONFIG -= angle_d3d11
-
angle_d3d11 {
DEFINES += ANGLE_ENABLE_D3D11 ANGLE_DEFAULT_D3D11=1
!build_pass: message("Enabling D3D11 mode for ANGLE")
diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro
index fd15a3c758..017153c74d 100644
--- a/src/concurrent/concurrent.pro
+++ b/src/concurrent/concurrent.pro
@@ -37,8 +37,4 @@ HEADERS += \
# private headers
HEADERS += \
-contains(QT_CONFIG, clock-gettime) {
- linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt
-}
-
load(qt_module)
diff --git a/src/concurrent/qtconcurrentiteratekernel.cpp b/src/concurrent/qtconcurrentiteratekernel.cpp
index 4b6ccc2810..52218f794b 100644
--- a/src/concurrent/qtconcurrentiteratekernel.cpp
+++ b/src/concurrent/qtconcurrentiteratekernel.cpp
@@ -39,20 +39,7 @@
#include "qtconcurrentiteratekernel.h"
-#if defined(Q_OS_MAC)
-#include <mach/mach.h>
-#include <mach/mach_time.h>
-#include <unistd.h>
-#elif defined(Q_OS_UNIX)
-#if defined(Q_OS_HURD)
-#include <sys/time.h>
-#endif
-#include <time.h>
-#include <unistd.h>
-#elif defined(Q_OS_WIN)
-#include <qt_windows.h>
-#endif
-
+#include <qdeadlinetimer.h>
#include "private/qfunctions_p.h"
@@ -65,69 +52,11 @@ enum {
MedianSize = 7
};
-#if defined(Q_OS_MAC)
-
static qint64 getticks()
{
- return mach_absolute_time();
+ return QDeadlineTimer::current(Qt::PreciseTimer).deadlineNSecs();
}
-#elif defined(Q_OS_UNIX)
-
-
-static qint64 getticks()
-{
-#if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)) || defined(Q_OS_OPENBSD)
- clockid_t clockId;
-
-#ifndef _POSIX_THREAD_CPUTIME
- clockId = CLOCK_REALTIME;
-#elif (_POSIX_THREAD_CPUTIME-0 <= 0)
- // if we don't have CLOCK_THREAD_CPUTIME_ID, we have to just use elapsed realtime instead
- clockId = CLOCK_REALTIME;
-
-# if (_POSIX_THREAD_CPUTIME-0 == 0)
- // detect availablility of CLOCK_THREAD_CPUTIME_ID
- static QBasicAtomicInt sUseThreadCpuTime = Q_BASIC_ATOMIC_INITIALIZER(-2);
- int useThreadCpuTime = sUseThreadCpuTime.load();
- if (useThreadCpuTime == -2) {
- // sysconf() will return either -1L or _POSIX_VERSION
- // (don't care about sysconf's exact return value)
- useThreadCpuTime = sysconf(_SC_THREAD_CPUTIME) == -1L ? -1 : 0 ;
- sUseThreadCpuTime.store(useThreadCpuTime); // might happen multiple times, but doesn't matter
- }
- if (useThreadCpuTime != -1)
- clockId = CLOCK_THREAD_CPUTIME_ID;
-# endif
-#else
- clockId = CLOCK_THREAD_CPUTIME_ID;
-#endif
-
- struct timespec ts;
- if (clock_gettime(clockId, &ts) == -1)
- return 0;
- return (ts.tv_sec * 1000000000) + ts.tv_nsec;
-#else
-
- // no clock_gettime(), fall back to wall time
- struct timeval tv;
- gettimeofday(&tv, 0);
- return (tv.tv_sec * 1000000) + tv.tv_usec;
-#endif
-}
-
-#elif defined(Q_OS_WIN)
-
-static qint64 getticks()
-{
- LARGE_INTEGER x;
- if (!QueryPerformanceCounter(&x))
- return 0;
- return x.QuadPart;
-}
-
-#endif
-
static double elapsed(qint64 after, qint64 before)
{
return double(after - before);
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index a5ed8b2ea3..545b9a3d1e 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -116,7 +116,7 @@ set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<
set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
-!!IF contains(QT_CONFIG, reduce_exports)
+!!IF qtConfig(reduce_exports)
set(QT_VISIBILITY_AVAILABLE \"True\")
!!ENDIF
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 9235641544..23909c9f3f 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -90,6 +90,9 @@ macro(QT5_GET_MOC_FLAGS _moc_flags)
if(WIN32)
set(${_moc_flags} ${${_moc_flags}} -DWIN32)
endif()
+ if (MSVC)
+ set(${_moc_flags} --compiler-flavor=msvc)
+ endif()
endmacro()
diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h
index 240e5100b9..31c2cd08e8 100644
--- a/src/corelib/animation/qanimationgroup_p.h
+++ b/src/corelib/animation/qanimationgroup_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// 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.
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index 752a7c5359..069ba8e51a 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// 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.
diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h
index 5e189f4ced..cfb1f247e0 100644
--- a/src/corelib/animation/qpropertyanimation_p.h
+++ b/src/corelib/animation/qpropertyanimation_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// 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.
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index edcae7db2a..1b07e1330a 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// 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.
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index c75933dff8..37318a5339 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -44,8 +44,8 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
+// 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.
diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri
index ec617386a4..b628bcc6ec 100644
--- a/src/corelib/arch/arch.pri
+++ b/src/corelib/arch/arch.pri
@@ -1,7 +1,7 @@
-win32|wince:HEADERS += arch/qatomic_msvc.h
+win32:HEADERS += arch/qatomic_msvc.h
HEADERS += \
arch/qatomic_bootstrap.h \
arch/qatomic_cxx11.h
-atomic64-libatomic: LIBS += -latomic
+qtConfig(libatomic): QMAKE_USE += libatomic
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..4fa778d042 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -17,7 +17,7 @@ SOURCES += \
codecs/qtsciicodec.cpp \
codecs/qutfcodec.cpp
-contains(QT_CONFIG,icu) {
+qtConfig(icu) {
HEADERS += \
codecs/qicucodec_p.h
SOURCES += \
@@ -40,23 +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
- }
- } else:!win32-msvc* {
- DEFINES += QT_NO_ICONV
+ qtConfig(iconv) {
+ HEADERS += codecs/qiconvcodec_p.h
+ SOURCES += codecs/qiconvcodec.cpp
+ qtConfig(gnu-libiconv) {
+ DEFINES += GNU_LIBICONV
+ QMAKE_USE_PRIVATE += iconv
+ } else: qtConfig(sun-libiconv) {
+ DEFINES += GNU_LIBICONV
+ }
}
+
win32 {
SOURCES += codecs/qwindowscodec.cpp
HEADERS += codecs/qwindowscodec_p.h
diff --git a/src/corelib/codecs/cp949codetbl_p.h b/src/corelib/codecs/cp949codetbl_p.h
index 3d55bcfac9..3b615d4e17 100644
--- a/src/corelib/codecs/cp949codetbl_p.h
+++ b/src/corelib/codecs/cp949codetbl_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
static const unsigned short cp949_icode_to_unicode[] = {
0xac02, 0xac03, 0xac05, 0xac06, 0xac0b, 0xac0c, 0xac0d, 0xac0e, 0xac0f, 0xac18, 0xac1e, 0xac1f, 0xac21, 0xac22, 0xac23,
0xac25, 0xac26, 0xac27, 0xac28, 0xac29, 0xac2a, 0xac2b, 0xac2e, 0xac32, 0xac33, 0xac34, 0xac35, 0xac36, 0xac37, 0xac3a,
diff --git a/src/corelib/codecs/qbig5codec_p.h b/src/corelib/codecs/qbig5codec_p.h
index 24a520a119..9dbcf41a6d 100644
--- a/src/corelib/codecs/qbig5codec_p.h
+++ b/src/corelib/codecs/qbig5codec_p.h
@@ -55,6 +55,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
diff --git a/src/corelib/codecs/qeuckrcodec_p.h b/src/corelib/codecs/qeuckrcodec_p.h
index 0311fb689c..2cf950a350 100644
--- a/src/corelib/codecs/qeuckrcodec_p.h
+++ b/src/corelib/codecs/qeuckrcodec_p.h
@@ -76,6 +76,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
diff --git a/src/corelib/codecs/qgb18030codec_p.h b/src/corelib/codecs/qgb18030codec_p.h
index 3884eea6fd..dd136aeddb 100644
--- a/src/corelib/codecs/qgb18030codec_p.h
+++ b/src/corelib/codecs/qgb18030codec_p.h
@@ -53,6 +53,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 96f1ee16ac..845155dce0 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -411,7 +411,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
switch (errno) {
case EILSEQ:
++invalidCount;
- // fall through
+ Q_FALLTHROUGH();
case EINVAL:
{
inBytes += sizeof(QChar);
diff --git a/src/corelib/codecs/qiconvcodec_p.h b/src/corelib/codecs/qiconvcodec_p.h
index 4c7f7084e6..238351bc81 100644
--- a/src/corelib/codecs/qiconvcodec_p.h
+++ b/src/corelib/codecs/qiconvcodec_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qtextcodec.h"
#if defined(Q_OS_UNIX) && !defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED)
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/qicucodec_p.h b/src/corelib/codecs/qicucodec_p.h
index a277529dc4..3a373ce5b3 100644
--- a/src/corelib/codecs/qicucodec_p.h
+++ b/src/corelib/codecs/qicucodec_p.h
@@ -53,6 +53,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
extern "C" {
typedef struct UConverter UConverter;
}
diff --git a/src/corelib/codecs/qisciicodec_p.h b/src/corelib/codecs/qisciicodec_p.h
index 94a3171d7d..f92c0091ce 100644
--- a/src/corelib/codecs/qisciicodec_p.h
+++ b/src/corelib/codecs/qisciicodec_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/codecs/qjiscodec.cpp b/src/corelib/codecs/qjiscodec.cpp
index 9c628c6012..a8625db054 100644
--- a/src/corelib/codecs/qjiscodec.cpp
+++ b/src/corelib/codecs/qjiscodec.cpp
@@ -288,7 +288,7 @@ QString QJisCodec::convertToUnicode(const char* chars, int len, ConverterState *
result += QLatin1Char(ch);
break;
}
- /* fall through */
+ Q_FALLTHROUGH();
case JISX0201_Latin:
u = conv->jisx0201ToUnicode(ch);
result += QValidChar(u);
diff --git a/src/corelib/codecs/qjpunicode_p.h b/src/corelib/codecs/qjpunicode_p.h
index 104f540b66..4fa2b9f757 100644
--- a/src/corelib/codecs/qjpunicode_p.h
+++ b/src/corelib/codecs/qjpunicode_p.h
@@ -80,7 +80,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/codecs/qlatincodec_p.h b/src/corelib/codecs/qlatincodec_p.h
index b3556a411a..1042c3b80d 100644
--- a/src/corelib/codecs/qlatincodec_p.h
+++ b/src/corelib/codecs/qlatincodec_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/codecs/qsimplecodec_p.h b/src/corelib/codecs/qsimplecodec_p.h
index d45cf2377f..d268a9f5b8 100644
--- a/src/corelib/codecs/qsimplecodec_p.h
+++ b/src/corelib/codecs/qsimplecodec_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE
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/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h
index ad05d01b90..f3c2d090c9 100644
--- a/src/corelib/codecs/qtextcodec_p.h
+++ b/src/corelib/codecs/qtextcodec_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qtextcodec.h"
#include <string.h>
diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h
index 6beb22cf6a..68ab01f7b5 100644
--- a/src/corelib/codecs/qtsciicodec_p.h
+++ b/src/corelib/codecs/qtsciicodec_p.h
@@ -80,6 +80,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE
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/codecs/qwindowscodec_p.h b/src/corelib/codecs/qwindowscodec_p.h
index 529c621b2e..2fd3c35378 100644
--- a/src/corelib/codecs/qwindowscodec_p.h
+++ b/src/corelib/codecs/qwindowscodec_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qtextcodec.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
new file mode 100644
index 0000000000..b0c78f5122
--- /dev/null
+++ b/src/corelib/configure.json
@@ -0,0 +1,611 @@
+{
+ "module": "core",
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "options": {
+ "doubleconversion": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "eventfd": "boolean",
+ "glib": "boolean",
+ "iconv": { "type": "enum", "values": [ "no", "yes", "posix", "sun", "gnu" ] },
+ "icu": "boolean",
+ "inotify": "boolean",
+ "journald": "boolean",
+ "pcre": { "type": "enum", "values": [ "qt", "system" ] },
+ "posix-ipc": { "type": "boolean", "name": "ipc_posix" },
+ "pps": { "type": "boolean", "name": "qqnx_pps" },
+ "slog2": "boolean",
+ "syslog": "boolean"
+ }
+ },
+
+ "libraries": {
+ "doubleconversion": {
+ "label": "DoubleConversion",
+ "test": "unix/doubleconversion",
+ "sources": [
+ "-ldouble-conversion"
+ ]
+ },
+ "glib": {
+ "label": "GLib",
+ "test": "unix/glib",
+ "sources": [
+ { "type": "pkgConfig", "args": "glib-2.0 gthread-2.0" }
+ ]
+ },
+ "gnu_iconv": {
+ "label": "GNU libiconv",
+ "export": "iconv",
+ "test": "unix/gnu-libiconv",
+ "sources": [
+ "-liconv"
+ ]
+ },
+ "icu": {
+ "label": "ICU",
+ "export": "",
+ "test": "unix/icu",
+ "sources": [
+ {
+ "builds": {
+ "debug": "-lsicuind -lsicuucd -lsicudtd",
+ "release": "-lsicuin -lsicuuc -lsicudt"
+ },
+ "condition": "config.win32 && !features.shared"
+ },
+ { "libs": "-licuin -licuuc -licudt", "condition": "config.win32 && features.shared" },
+ { "libs": "-licui18n -licuuc -licudata", "condition": "!config.win32" }
+ ]
+ },
+ "journald": {
+ "label": "journald",
+ "test": "unix/journald",
+ "export": "",
+ "sources": [
+ { "type": "pkgConfig", "args": "libsystemd" },
+ { "type": "pkgConfig", "args": "libsystemd-journal" }
+ ]
+ },
+ "libatomic": {
+ "label": "64 bit atomics in libatomic",
+ "test": "common/atomic64",
+ "sources": [
+ "-latomic"
+ ]
+ },
+ "libdl": {
+ "label": "dlopen() in libdl",
+ "export": "",
+ "test": "unix/dlopen",
+ "sources": [
+ "-ldl"
+ ]
+ },
+ "pcre": {
+ "label": "PCRE",
+ "test": "unix/pcre",
+ "sources": [
+ "-lpcre16"
+ ]
+ },
+ "pps": {
+ "label": "PPS",
+ "test": "unix/pps",
+ "sources": [
+ "-lpps"
+ ]
+ },
+ "slog2": {
+ "label": "slog2",
+ "test": "unix/slog2",
+ "export": "",
+ "sources": [
+ "-lslog2"
+ ]
+ }
+ },
+
+ "tests": {
+ "atomic64": {
+ "label": "64 bit atomics",
+ "type": "compile",
+ "test": "common/atomic64"
+ },
+ "atomicfptr": {
+ "label": "working std::atomic for function pointers",
+ "type": "compile",
+ "test": "common/atomicfptr"
+ },
+ "clock-gettime": {
+ "label": "clock_gettime()",
+ "type": "compile",
+ "test": "unix/clock-gettime"
+ },
+ "clock-monotonic": {
+ "label": "POSIX monotonic clock",
+ "type": "compile",
+ "test": "unix/clock-monotonic"
+ },
+ "cloexec": {
+ "label": "O_CLOEXEC",
+ "type": "compile",
+ "test": "unix/cloexec"
+ },
+ "dlopen": {
+ "label": "dlopen() in libc",
+ "type": "compile",
+ "test": "unix/dlopen"
+ },
+ "eventfd": {
+ "label": "eventfd",
+ "type": "compile",
+ "test": "unix/eventfd"
+ },
+ "posix-iconv": {
+ "label": "POSIX iconv",
+ "type": "compile",
+ "test": "unix/iconv"
+ },
+ "sun-iconv": {
+ "label": "SUN libiconv",
+ "type": "compile",
+ "test": "unix/sun-libiconv"
+ },
+ "inotify": {
+ "label": "inotify",
+ "type": "compile",
+ "test": "unix/inotify"
+ },
+ "ipc_sysv": {
+ "label": "SysV IPC",
+ "type": "compile",
+ "test": "unix/ipc_sysv"
+ },
+ "ipc_posix": {
+ "label": "POSIX IPC",
+ "type": "compile",
+ "test": "unix/ipc_posix"
+ },
+ "journald": {
+ "label": "journald",
+ "type": "compile",
+ "test": "unix/journald"
+ },
+ "ppoll": {
+ "label": "ppoll()",
+ "type": "compile",
+ "test": "unix/ppoll"
+ },
+ "pollts": {
+ "label": "pollts()",
+ "type": "compile",
+ "test": "unix/pollts"
+ },
+ "poll": {
+ "label": "poll()",
+ "type": "compile",
+ "test": "unix/poll"
+ },
+ "syslog": {
+ "label": "syslog",
+ "type": "compile",
+ "test": "unix/syslog"
+ },
+ "xlocalescanprint": {
+ "label": "xlocale.h (or equivalents)",
+ "type": "compile",
+ "test": "common/xlocalescanprint"
+ }
+ },
+
+ "features": {
+ "clock-gettime": {
+ "label": "clock_gettime()",
+ "condition": "tests.clock-gettime",
+ "output": [ "privateFeature" ]
+ },
+ "clock-monotonic": {
+ "label": "POSIX monotonic clock",
+ "condition": "features.clock-gettime && tests.clock-monotonic",
+ "output": [ "feature" ]
+ },
+ "dlopen": {
+ "label": "dlopen()",
+ "condition": "tests.dlopen || libs.libdl",
+ "output": [ { "type": "define", "negative": true, "name": "QT_NO_DYNAMIC_LIBRARY" } ]
+ },
+ "libdl": {
+ "label": "dlopen() in libdl",
+ "condition": "!tests.dlopen && libs.libdl",
+ "output": [ { "type": "privateConfig", "negative": true } ]
+ },
+ "doubleconversion": {
+ "label": "DoubleConversion",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "system-doubleconversion": {
+ "label": " Using system DoubleConversion",
+ "enable": "input.doubleconversion == 'system'",
+ "disable": "input.doubleconversion == 'qt'",
+ "condition": "features.doubleconversion && libs.doubleconversion",
+ "output": [ "privateFeature" ]
+ },
+ "eventfd": {
+ "label": "eventfd",
+ "condition": "tests.eventfd",
+ "output": [ "feature" ]
+ },
+ "glib": {
+ "label": "GLib",
+ "autoDetect": "!config.win32",
+ "condition": "libs.glib",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "iconv": {
+ "label": "iconv",
+ "purpose": "Provides internationalization on Unix.",
+ "section": "Internationalization",
+ "condition": "features.posix-libiconv || features.sun-libiconv || features.gnu-libiconv",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "posix-libiconv": {
+ "label": "POSIX iconv",
+ "enable": "input.iconv == 'posix'",
+ "disable": "input.iconv == 'sun' || input.iconv == 'gnu' || input.iconv == 'no'",
+ "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && tests.posix-iconv"
+ },
+ "sun-libiconv": {
+ "label": "SUN iconv",
+ "enable": "input.iconv == 'sun'",
+ "disable": "input.iconv == 'posix' || input.iconv == 'gnu' || input.iconv == 'no'",
+ "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && !features.posix-libiconv && tests.sun-iconv",
+ "output": [ "privateFeature", "publicQtConfig" ]
+ },
+ "gnu-libiconv": {
+ "label": "GNU iconv",
+ "enable": "input.iconv == 'gnu'",
+ "disable": "input.iconv == 'posix' || input.iconv == 'sun' || input.iconv == 'no'",
+ "condition": "!config.win32 && !config.qnx && !config.android && !config.darwin && !features.posix-libiconv && !features.sun-libiconv && libs.gnu_iconv",
+ "output": [ "privateFeature" ]
+ },
+ "icu": {
+ "label": "ICU",
+ "autoDetect": "!config.win32",
+ "condition": "libs.icu",
+ "output": [ "privateFeature" ]
+ },
+ "inotify": {
+ "label": "inotify",
+ "condition": "tests.inotify",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "ipc_posix": {
+ "label": "Using POSIX IPC",
+ "autoDetect": "!config.win32",
+ "condition": "!tests.ipc_sysv && tests.ipc_posix",
+ "output": [ { "type": "define", "name": "QT_POSIX_IPC" } ]
+ },
+ "journald": {
+ "label": "journald",
+ "autoDetect": false,
+ "condition": "libs.journald",
+ "output": [ "privateConfig" ]
+ },
+ "std-atomic64": {
+ "label": "64 bit atomic operations",
+ "condition": "tests.atomic64 || libs.libatomic",
+ "output": [ { "type": "define", "negative": true, "name": "QT_NO_STD_ATOMIC64" } ]
+ },
+ "libatomic": {
+ "label": "64 bit atomic operations in libatomic",
+ "condition": "!tests.atomic64 && libs.libatomic",
+ "output": [ "privateFeature" ]
+ },
+ "mimetype": {
+ "label": "Mimetype handling",
+ "purpose": "Provides MIME type handling.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "system-pcre": {
+ "label": "Using system PCRE",
+ "disable": "input.pcre == 'qt'",
+ "enable": "input.pcre == 'system'",
+ "condition": "libs.pcre",
+ "output": [
+ "privateFeature",
+ { "type": "privateConfig", "negative": true, "name": "pcre" }
+ ]
+ },
+ "poll_ppoll": {
+ "label": "Native ppoll()",
+ "emitIf": "!config.win32",
+ "condition": "tests.ppoll",
+ "output": [ "privateFeature" ]
+ },
+ "poll_pollts": {
+ "label": "Native pollts()",
+ "emitIf": "!config.win32",
+ "condition": "!features.poll_ppoll && tests.pollts",
+ "output": [ "privateFeature" ]
+ },
+ "poll_poll": {
+ "label": "Native poll()",
+ "emitIf": "!config.win32",
+ "condition": "!features.poll_ppoll && !features.poll_pollts && tests.poll",
+ "output": [ "privateFeature" ]
+ },
+ "poll_select": {
+ "label": "Emulated poll()",
+ "emitIf": "!config.win32",
+ "condition": "!features.poll_ppoll && !features.poll_pollts && !features.poll_poll",
+ "output": [
+ "privateFeature",
+ { "type": "define", "name": "QT_NO_NATIVE_POLL" }
+ ]
+ },
+ "qqnx_pps": {
+ "label": "PPS",
+ "emitIf": "config.qnx",
+ "condition": "libs.pps",
+ "output": [ "privateConfig" ]
+ },
+ "qeventtransition": {
+ "label": "QEventTransition class",
+ "output": [ "publicFeature" ]
+ },
+ "sharedmemory": {
+ "label": "Enable QSharedMemory",
+ "condition": "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix",
+ "output": [ { "type": "define", "negative": true, "name": "QT_NO_SHAREDMEMORY" } ]
+ },
+ "slog2": {
+ "label": "slog2",
+ "condition": "libs.slog2",
+ "emitIf": "config.qnx",
+ "output": [ "privateConfig" ]
+ },
+ "syslog": {
+ "label": "syslog",
+ "autoDetect": false,
+ "condition": "tests.syslog",
+ "output": [ "privateConfig" ]
+ },
+ "systemsemaphore": {
+ "label": "Enable QSystemSemaphore",
+ "condition": "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix",
+ "output": [ { "type": "define", "negative": true, "name": "QT_NO_SYSTEMSEMAPHORE" } ]
+ },
+ "threadsafe-cloexec": {
+ "label": "Threadsafe pipe creation",
+ "condition": "tests.cloexec",
+ "output": [
+ "publicQtConfig",
+ { "type": "define", "name": "QT_THREADSAFE_CLOEXEC", "value": 1 }
+ ]
+ },
+ "properties": {
+ "label": "Properties",
+ "purpose": "Supports scripting Qt-based applications.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "regularexpression": {
+ "label": "QRegularExpression",
+ "purpose": "Provides an API to Perl-compatible regular expressions.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "sharedmemory": {
+ "label": "QSharedMemory",
+ "purpose": "Provides access to a shared memory segment.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "systemsemaphore": {
+ "label": "QSystemSemaphore",
+ "purpose": "Provides a general counting system semaphore.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "xmlstream": {
+ "label": "XML Streaming APIs",
+ "purpose": "Provides a simple streaming API for XML.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "xmlstreamreader": {
+ "label": "QXmlStreamReader",
+ "purpose": "Provides a well-formed XML parser with a simple streaming API.",
+ "section": "Kernel",
+ "condition": "features.xmlstream",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "xmlstreamwriter": {
+ "label": "QXmlStreamWriter",
+ "purpose": "Provides a XML writer with a simple streaming API.",
+ "section": "Kernel",
+ "condition": "features.xmlstream",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "textdate": {
+ "label": "Text Date",
+ "purpose": "Supports month and day names in dates.",
+ "section": "Data structures",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "datestring": {
+ "label": "QDate/QTime/QDateTime",
+ "purpose": "Provides convertion between dates and strings.",
+ "section": "Data structures",
+ "condition": "features.textdate",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "process": {
+ "label": "QProcess",
+ "purpose": "Supports external process invocation.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "temporaryfile": {
+ "label": "QTemporaryFile",
+ "purpose": "Provides an I/O device that operates on temporary files.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "library": {
+ "label": "QLibrary",
+ "purpose": "Provides a wrapper for dynamically loaded libraries.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "settings": {
+ "label": "QSettings",
+ "purpose": "Provides persistent application settings.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "filesystemwatcher": {
+ "label": "QFileSystemWatcher",
+ "purpose": "Provides an interface for monitoring files and directories for modifications.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "filesystemiterator": {
+ "label": "QFileSystemIterator",
+ "purpose": "Provides fast file system iteration.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "itemmodel": {
+ "label": "Qt Item Model",
+ "purpose": "Provides the item model for item views",
+ "section": "ItemViews",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "proxymodel": {
+ "label": "QAbstractProxyModel",
+ "purpose": "Supports processing of data passed between another model and a view.",
+ "section": "ItemViews",
+ "condition": "features.itemmodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "sortfilterproxymodel": {
+ "label": "QSortFilterProxyModel",
+ "purpose": "Supports sorting and filtering of data passed between another model and a view.",
+ "section": "ItemViews",
+ "condition": "features.proxymodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "identityproxymodel": {
+ "label": "QIdentityProxyModel",
+ "purpose": "Supports proxying a source model unmodified.",
+ "section": "ItemViews",
+ "condition": "features.proxymodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "stringlistmodel": {
+ "label": "QStringListModel",
+ "purpose": "Provides a model that supplies strings to views.",
+ "section": "ItemViews",
+ "condition": "features.itemmodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "translation": {
+ "label": "Translation",
+ "purpose": "Supports translations using QObject::tr().",
+ "section": "Internationalization",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "textcodec": {
+ "label": "QTextCodec",
+ "purpose": "Supports conversions between text encodings.",
+ "section": "Internationalization",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "codecs": {
+ "label": "Codecs",
+ "purpose": "Supports non-unicode text conversions.",
+ "section": "Internationalization",
+ "condition": "features.textcodec",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "big_codecs": {
+ "label": "Big Codecs",
+ "purpose": "Supports big codecs, e.g. CJK.",
+ "section": "Internationalization",
+ "condition": "features.textcodec",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "animation": {
+ "label": "Animation",
+ "purpose": "Provides a framework for animations.",
+ "section": "Utilities",
+ "condition": "features.properties",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "statemachine": {
+ "label": "State machine",
+ "purpose": "Provides hierarchical finite state machines.",
+ "section": "Utilities",
+ "condition": "features.properties",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "gestures": {
+ "label": "Gesture",
+ "purpose": "Provides a framework for gestures.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ }
+ },
+
+ "report": [
+ {
+ "type": "note",
+ "condition": "features.journald || features.syslog || (config.qnx && features.slog2)",
+ "message": "journald, syslog or slog2 integration is enabled.
+If your users intend to develop applications against this build,
+ensure that the IDEs they use either set QT_LOGGING_TO_CONSOLE to 1
+or are able to read the logged output from journald, syslog or slog2."
+ },
+ {
+ "type": "error",
+ "condition": "input.doubleconversion == 'no' && !tests.xlocalescanprint",
+ "message": "Your C library does not provide sscanf_l or snprintf_l.
+You need to use libdouble-conversion for double/string conversion."
+ },
+ {
+ "type": "error",
+ "condition": "!tests.atomicfptr",
+ "message": "detected a std::atomic implementation that fails for function pointers.
+Please apply the patch corresponding to your Standard Library vendor, found in
+ qtbase/config.tests/common/atomicfptr"
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt Core",
+ "entries": [
+ "doubleconversion",
+ "system-doubleconversion",
+ "glib",
+ "iconv",
+ "icu",
+ {
+ "section": "Logging backends",
+ "entries": [
+ "journald", "syslog", "slog2"
+ ]
+ },
+ {
+ "type": "feature",
+ "args": "qqnx_pps",
+ "condition": "config.qnx"
+ },
+ "system-pcre"
+ ]
+ }
+ ]
+}
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 2faa97eb17..616a9641a1 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -31,8 +31,6 @@ ANDROID_PERMISSIONS = \
# OpenBSD 6.0 will include environ in libc.
freebsd|openbsd: QMAKE_LFLAGS_NOUNDEF =
-load(qfeatures)
-
include(animation/animation.pri)
include(arch/arch.pri)
include(global/global.pri)
@@ -48,11 +46,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
}
@@ -92,6 +98,7 @@ cmake_umbrella_config_version_file.output = $$DESTDIR/cmake/Qt5/Qt5ConfigVersion
load(cmake_functions)
+##### This requires fixing, so that the feature system works with cmake as well
CMAKE_DISABLED_FEATURES = $$join(QT_DISABLED_FEATURES, "$$escape_expand(\\n) ")
CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA/src], $$[QT_INSTALL_PREFIX])
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 54b5c95a34..1169ad5536 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/doc/src/animation.qdoc b/src/corelib/doc/src/animation.qdoc
index 4e71ed4268..0c1b2aed17 100644
--- a/src/corelib/doc/src/animation.qdoc
+++ b/src/corelib/doc/src/animation.qdoc
@@ -121,7 +121,7 @@
As mentioned in the previous section, the QPropertyAnimation class can
interpolate over Qt properties. It is often this class that should be used
for animation of values; in fact, its superclass, QVariantAnimation, has an
- empty implementation of \l{QAbstractAnimation::}{updateCurrentValue()}, and
+ empty implementation of \l{QVariantAnimation::}{updateCurrentValue()}, and
does not change any value unless we change it ourselves on the
\l{QVariantAnimation::valueChanged()}{valueChanged signal}.
diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc
index e2fce5797d..fe9b43507c 100644
--- a/src/corelib/doc/src/qtcore-index.qdoc
+++ b/src/corelib/doc/src/qtcore-index.qdoc
@@ -101,7 +101,19 @@
\li \l{The Event System}
\endlist
- \section1 Related Information
+ \section1 Licenses and Attributions
+
+ Qt Core is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt Core potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtcore}
+
\section1 Reference
These are links to the API reference materials.
\list
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index d0eb2af423..a3d816f0c3 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -656,14 +656,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
@@ -1039,7 +1031,8 @@
// critical definitions. (Reported as Intel Issue ID 6000117277)
# define __USE_CONSTEXPR 1
# define __USE_NOEXCEPT 1
-# elif defined(Q_CC_MSVC) && (defined(Q_CC_CLANG) || defined(Q_CC_INTEL))
+# endif
+# if defined(Q_CC_MSVC) && defined(Q_CC_CLANG)
// Clang and the Intel compiler support more C++ features than the Microsoft compiler
// so make sure we don't enable them if the MS headers aren't properly adapted.
# ifndef _HAS_CONSTEXPR
@@ -1066,7 +1059,8 @@
# ifndef _HAS_VARIADIC_TEMPLATES
# undef Q_COMPILER_VARIADIC_TEMPLATES
# endif
-# elif defined(_LIBCPP_VERSION)
+# endif
+# if defined(_LIBCPP_VERSION)
// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
// doesn't support it. That's required for the Intel compiler 14.x or earlier on OS X, for example.
# if !__has_feature(cxx_atomic)
@@ -1351,6 +1345,18 @@
Q_ASSUME_IMPL(valueOfExpression);\
} while (0)
+#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
+# define Q_FALLTHROUGH() [[fallthrough]]
+#elif defined(__cplusplus)
+/* Clang can not parse namespaced attributes in C mode, but defines __has_cpp_attribute */
+# if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
+# define Q_FALLTHROUGH() [[clang::fallthrough]]
+# endif
+#endif
+#ifndef Q_FALLTHROUGH
+# define Q_FALLTHROUGH() (void)0
+#endif
+
/*
Sanitize compiler feature availability
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/qfeatures.txt b/src/corelib/global/qfeatures.txt
index dec16eaef1..458f87ec16 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -107,7 +107,7 @@ Name: QSharedMemory
Feature: SYSTEMSEMAPHORE
Description: Provides a general counting system semaphore.
Section: Kernel
-Requires:
+Requires: SHAREDMEMORY
Name: QSystemSemaphore
Feature: XMLSTREAM
@@ -500,7 +500,7 @@ Name: QColorDialog
Feature: FILEDIALOG
Description: Supports a dialog widget for selecting files or directories.
Section: Dialogs
-Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL
+Requires: FILESYSTEMMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL
Name: QFileDialog
Feature: FONTDIALOG
@@ -512,7 +512,7 @@ Name: QFontDialog
Feature: PRINTDIALOG
Description: Supports a dialog widget for specifying printer configuration.
Section: Dialogs
-Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TREEVIEW TABWIDGET
+Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TABWIDGET
Name: QPrintDialog
Feature: PRINTPREVIEWDIALOG
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 c14f774bd6..743d9d14a5 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(qreal value)
+/*! \fn qint64 qRound64(double 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 12A
+*/
+
+/*! \fn qint64 qRound64(float value)
+ \relates <QtGlobal>
+
+ Rounds \a value to the nearest 64-bit integer.
+
+ Example:
+
+ \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,20 +1164,20 @@ 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
- \omitvalue WV_CE
- \omitvalue WV_CENET
- \omitvalue WV_CE_5
- \omitvalue WV_CE_6
-
The following masks can be used for testing whether a Windows
version is MS-DOS-based or NT-based:
\value WV_DOS_based MS-DOS-based version of Windows
\value WV_NT_based NT-based version of Windows
- \omitvalue WV_CE_based
\value WV_None Operating system other than Windows.
+ \omitvalue WV_CE
+ \omitvalue WV_CENET
+ \omitvalue WV_CE_5
+ \omitvalue WV_CE_6
+ \omitvalue WV_CE_based
+
\sa MacVersion
*/
@@ -1221,6 +1238,12 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_IOS_9_3 iOS 9.3
\value MV_IOS_10_0 iOS 10.0
+ \value MV_TVOS tvOS (any)
+ \value MV_TVOS_9_0 tvOS 9.0
+ \value MV_TVOS_9_1 tvOS 9.1
+ \value MV_TVOS_9_2 tvOS 9.2
+ \value MV_TVOS_10_0 tvOS 10.0
+
\value MV_None Not a Darwin operating system
\sa WinVersion
@@ -1927,13 +1950,37 @@ 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));
+#elif defined(Q_OS_WATCHOS)
+ return QSysInfo::MacVersion(Q_MV_WATCHOS(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";
+ case 12:
+ return "Sierra";
+ }
+ }
+ // 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"
@@ -1986,9 +2033,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,
@@ -2037,113 +2082,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()
@@ -2162,37 +2160,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;
}
@@ -2449,7 +2431,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).
@@ -2601,9 +2583,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;
@@ -2617,7 +2597,7 @@ QString QSysInfo::kernelType()
\since 5.4
Returns the release version of the operating system kernel. On Windows, it
- returns the version of the NT or CE kernel. On Unix systems, including
+ returns the version of the NT kernel. On Unix systems, including
Android and \macos, it returns the same as the \c{uname -r}
command would return.
@@ -2659,9 +2639,10 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, \macos and iOS note}: this function returns "macos" for macOS
- systems, "ios" for iOS systems and "darwin" in case the system could not be
- determined.
+ \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns
+ "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems,
+ "watchos" for watchOS systems, and "darwin" in case the system could not
+ be determined.
\b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
@@ -2682,8 +2663,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");
@@ -2695,6 +2674,10 @@ QString QSysInfo::productType()
#elif defined(Q_OS_IOS)
return QStringLiteral("ios");
+#elif defined(Q_OS_TVOS)
+ return QStringLiteral("tvos");
+#elif defined(Q_OS_WATCHOS)
+ return QStringLiteral("watchos");
#elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version();
if (version.major == 10 && version.minor < 12)
@@ -2728,9 +2711,8 @@ QString QSysInfo::productType()
In all other Unix-type systems, this function always returns "unknown".
- \note The version string returned from this function is only guaranteed to
- be orderable on Android, \macos and iOS. On Windows, some Windows
- versions are text ("XP" and "Vista", for example). On Linux, the version of
+ \note The version string returned from this function is not guaranteed to
+ be orderable. On Linux, the version of
the distribution may jump unexpectedly, please refer to the distribution's
documentation for versioning practices.
@@ -2781,53 +2763,40 @@ 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_WATCHOS)
+ return QLatin1String("watchOS ") + productVersion();
#elif defined(Q_OS_MACOS)
- // 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;
- case MV_SIERRA:
- basename = "macOS Sierra (";
- break;
+ const QAppleOperatingSystemVersion version = qt_apple_os_version();
+ const char *name = osxVer_helper(version);
+ if (name) {
+ return (version.major == 10 && version.minor < 12
+ ? QLatin1String("OS X ")
+ : QLatin1String("macOS "))
+ + QLatin1String(name)
+ + QLatin1String(" (") + QString::number(version.major)
+ + QLatin1Char('.') + QString::number(version.minor)
+ + QLatin1Char(')');
+ } else {
+ return QLatin1String("macOS ")
+ + QString::number(version.major) + QLatin1Char('.')
+ + QString::number(version.minor);
}
- if (basename)
- return QLatin1String(basename) + productVersion() + QLatin1Char(')');
-
- // a future version of macOS
- return QLatin1String("macOS ") + 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)
@@ -2994,6 +2963,20 @@ QString QSysInfo::machineHostName()
*/
/*!
+ \macro void Q_FALLTHROUGH()
+ \relates <QtGlobal>
+ \since 5.8
+
+ Can be used in switch statements at the end of case block to tell the compiler
+ and other developers that that the lack of a break statement is intentional.
+
+ This is useful since a missing break statement is often a bug, and some
+ compilers can be configured to emit warnings when one is not found.
+
+ \sa Q_UNREACHABLE()
+*/
+
+/*!
\macro void Q_CHECK_PTR(void *pointer)
\relates <QtGlobal>
@@ -4291,6 +4274,24 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
*/
/*!
+ \fn bool qFuzzyIsNull(double d)
+ \relates <QtGlobal>
+ \since 4.4
+ \threadsafe
+
+ Returns true if the absolute value of \a d is within 0.000000000001 of 0.0.
+*/
+
+/*!
+ \fn bool qFuzzyIsNull(float f)
+ \relates <QtGlobal>
+ \since 4.4
+ \threadsafe
+
+ Returns true if the absolute value of \a f is within 0.00001f of 0.0.
+*/
+
+/*!
\macro QT_REQUIRE_VERSION(int argc, char **argv, const char *version)
\relates <QtGlobal>
@@ -4505,7 +4506,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
On QNX the message is sent to slogger2
If you are using the \b{default message handler} this function will
- abort on Unix systems to create a core dump. On Windows, for debug builds,
+ abort to create a core dump. On Windows, for debug builds,
this function will report a _CRT_ERROR enabling you to connect a debugger
to the application.
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 118203f720..dd8b6110b3 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -56,19 +56,30 @@
*/
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-#if !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE)
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/qconfig.h>
-#include <QtCore/qfeatures.h>
+#include <QtCore/qtcore-config.h>
#endif
// The QT_SUPPORTS macro is deprecated. Don't use it in new code.
-// Instead, use #ifdef/ndef QT_NO_feature.
+// Instead, use QT_CONFIG(feature)
// ### Qt6: remove macro
#ifdef _MSC_VER
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else
# define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE))
#endif
+
+/*
+ The QT_CONFIG macro implements a safe compile time check for features of Qt.
+ Features can be in three states:
+ 0 or undefined: This will lead to a compile error when testing for it
+ -1: The feature is not available
+ 1: The feature is available
+*/
+#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
+#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not vailable.")
+
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
# define QT_NO_UNSHARABLE_CONTAINERS
#endif
@@ -296,26 +307,8 @@ typedef double qreal;
# else
# define Q_CORE_EXPORT Q_DECL_IMPORT
# endif
-# if defined(QT_BUILD_GUI_LIB)
-# define Q_GUI_EXPORT Q_DECL_EXPORT
-# else
-# define Q_GUI_EXPORT Q_DECL_IMPORT
-# endif
-# if defined(QT_BUILD_WIDGETS_LIB)
-# define Q_WIDGETS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_WIDGETS_EXPORT Q_DECL_IMPORT
-# endif
-# if defined(QT_BUILD_NETWORK_LIB)
-# define Q_NETWORK_EXPORT Q_DECL_EXPORT
-# else
-# define Q_NETWORK_EXPORT Q_DECL_IMPORT
-# endif
#else
# define Q_CORE_EXPORT
-# define Q_GUI_EXPORT
-# define Q_WIDGETS_EXPORT
-# define Q_NETWORK_EXPORT
#endif
/*
@@ -469,7 +462,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 +522,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; }
@@ -568,25 +549,53 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
#ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE
# define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref
#endif
+#ifndef Q_FORWARD_DECLARE_CG_TYPE
+#define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref;
+#endif
+#ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE
+#define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref;
+#endif
-#ifdef Q_OS_MAC
-# define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) \
- ((defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MAX_ALLOWED >= osx) || \
- (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios))
+#ifdef Q_OS_DARWIN
+# define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \
+ ((defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MAX_ALLOWED >= macos) || \
+ (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios) || \
+ (defined(__TV_OS_VERSION_MAX_ALLOWED) && tvos != __TVOS_NA && __TV_OS_VERSION_MAX_ALLOWED >= tvos) || \
+ (defined(__WATCH_OS_VERSION_MAX_ALLOWED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MAX_ALLOWED >= watchos))
-# define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) \
- ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < osx) || \
- (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios))
+# define QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, tvos, watchos) \
+ ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < macos) || \
+ (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios) || \
+ (defined(__TV_OS_VERSION_MIN_REQUIRED) && tvos != __TVOS_NA && __TV_OS_VERSION_MIN_REQUIRED < tvos) || \
+ (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MIN_REQUIRED < watchos))
+# define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) \
+ QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, __TVOS_NA, __WATCHOS_NA)
+# define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) \
+ QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA)
# define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \
- QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios)
-# define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) \
- QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, __IPHONE_NA)
-
+ QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA)
+# define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) \
+ QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA)
+# define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) \
+ QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos)
+
+# define QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(macos, ios) \
+ QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, __TVOS_NA, __WATCHOS_NA)
+# define QT_MACOS_DEPLOYMENT_TARGET_BELOW(macos) \
+ QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA)
# define QT_IOS_DEPLOYMENT_TARGET_BELOW(ios) \
- QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios)
-# define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) \
- QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, __IPHONE_NA)
+ QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA)
+# define QT_TVOS_DEPLOYMENT_TARGET_BELOW(tvos) \
+ QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA)
+# define QT_WATCHOS_DEPLOYMENT_TARGET_BELOW(watchos) \
+ QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos)
+
+# define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios)
+# define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(osx, ios)
+
+# define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(osx)
+# define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) QT_MACOS_DEPLOYMENT_TARGET_BELOW(osx)
// Implemented in qcore_mac_objc.mm
class Q_CORE_EXPORT QMacAutoReleasePool
@@ -599,7 +608,7 @@ private:
void *pool;
};
-#endif // Q_OS_MAC
+#endif // Q_OS_DARWIN
/*
Data stream functions are provided by many classes (defined in qdatastream.h)
@@ -622,7 +631,7 @@ class QDataStream;
# define QT_NO_SOCKS5
#endif
-#if defined(Q_OS_IOS)
+#if defined(QT_PLATFORM_UIKIT)
# define QT_NO_PROCESS
#endif
@@ -795,18 +804,12 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
}
-/*!
- \internal
-*/
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
{
return qAbs(d) <= 0.000000000001;
}
-/*!
- \internal
-*/
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
{
@@ -941,10 +944,11 @@ template <typename T>
class QForeachContainer {
QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE;
public:
- inline QForeachContainer(const T& t) : c(t), i(c.begin()), e(c.end()), control(1) { }
+ QForeachContainer(const T &t) : c(t) {}
+ QForeachContainer(T &&t) : c(std::move(t)) {}
const T c;
- typename T::const_iterator i, e;
- int control;
+ typename T::const_iterator i = c.begin(), e = c.end();
+ int control = 1;
};
// Explanation of the control word:
@@ -1032,8 +1036,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/qglobal_p.h b/src/corelib/global/qglobal_p.h
new file mode 100644
index 0000000000..c329357f46
--- /dev/null
+++ b/src/corelib/global/qglobal_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Intel Corporation.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGLOBAL_P_H
+#define QGLOBAL_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 "qglobal.h"
+#include "qglobal_p.h" // include self to avoid syncqt warning - no-op
+
+#ifndef QT_BOOTSTRAPPED
+#include <QtCore/private/qconfig_p.h>
+#include <QtCore/private/qtcore-config_p.h>
+#endif
+
+#define QT_LIBRARY_VERSION(lib) QT_LIBRARY_VERSION_##lib
+#define QT_LIBRARY_VERSION_MAJOR(lib) (QT_LIBRARY_VERSION_##lib >> 16)
+#define QT_LIBRARY_VERSION_MINOR(lib) ((QT_LIBRARY_VERSION_##lib >> 8) & 0xff)
+#define QT_LIBRARY_VERSION_PATCH(lib) (QT_LIBRARY_VERSION_##lib & 0xff)
+
+#endif // QGLOBAL_P_H
+
diff --git a/src/corelib/global/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/qhooks_p.h b/src/corelib/global/qhooks_p.h
index 47270d8ad2..a51a2ec86b 100644
--- a/src/corelib/global/qhooks_p.h
+++ b/src/corelib/global/qhooks_p.h
@@ -52,7 +52,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 458200180e..1a7d64780f 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
/*
@@ -519,7 +532,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
reg_var.setMinimal(true);
while((rep = reg_var.indexIn(ret)) != -1) {
ret.replace(rep, reg_var.matchedLength(),
- QString::fromLocal8Bit(qgetenv(ret.mid(rep + 2,
+ QString::fromLocal8Bit(qgetenv(ret.midRef(rep + 2,
reg_var.matchedLength() - 3).toLatin1().constData()).constData()));
}
@@ -603,10 +616,10 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
#if !defined(QT_BUILD_QMAKE) && !defined(QT_NO_SETTINGS)
QScopedPointer<const QSettings> settings(QLibraryInfoPrivate::findConfiguration());
if (!settings.isNull()) {
- QString key = QLatin1String(platformsSection);
- key += QLatin1Char('/');
- key += platformName;
- key += QLatin1String("Arguments");
+ const QString key = QLatin1String(platformsSection)
+ + QLatin1Char('/')
+ + platformName
+ + QLatin1String("Arguments");
return settings->value(key).toStringList();
}
#endif // !QT_BUILD_QMAKE && !QT_NO_SETTINGS
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 e8262aa0c0..0ca6829564 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -140,6 +140,8 @@ static QT_PREPEND_NAMESPACE(qint64) qt_gettid()
#endif
#endif // !QT_BOOTSTRAPPED
+#include <cstdlib>
+
#include <stdio.h>
QT_BEGIN_NAMESPACE
@@ -170,7 +172,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)
@@ -1177,7 +1179,7 @@ void QMessagePattern::setPattern(const QString &pattern)
else if (inIf)
error += QLatin1String("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)
@@ -1678,11 +1680,7 @@ static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const
Q_UNUSED(message);
#endif
-#if (defined(Q_OS_UNIX) || defined(Q_CC_MINGW))
- abort(); // trap; generates core dump
-#else
- exit(1); // goodbye cruel world
-#endif
+ std::abort();
}
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 86c38839d2..d8df25dcc6 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
@@ -2218,10 +2223,6 @@
the bottom. This window hint is currently not implemented
for \macos.
- \omitvalue WindowOkButtonHint
-
- \omitvalue WindowCancelButtonHint
-
\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 3451b2158d..ef40a45dc4 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -52,11 +52,11 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include "QtCore/private/qglobal_p.h"
#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 d1a4102f29..23f412aa6a 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
@@ -127,6 +127,8 @@ public:
#define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0))
#define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor)
+#define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor)
+#define Q_MV_WATCHOS(major, minor) (QSysInfo::MV_WATCHOS | major << 4 | minor)
enum MacVersion {
MV_None = 0xffff,
MV_Unknown = 0x0000,
@@ -180,7 +182,21 @@ public:
MV_IOS_9_1 = Q_MV_IOS(9, 1),
MV_IOS_9_2 = Q_MV_IOS(9, 2),
MV_IOS_9_3 = Q_MV_IOS(9, 3),
- MV_IOS_10_0 = Q_MV_IOS(10, 0)
+ MV_IOS_10_0 = Q_MV_IOS(10, 0),
+
+ /* tvOS */
+ MV_TVOS = 1 << 9,
+ MV_TVOS_9_0 = Q_MV_TVOS(9, 0),
+ MV_TVOS_9_1 = Q_MV_TVOS(9, 1),
+ MV_TVOS_9_2 = Q_MV_TVOS(9, 2),
+ MV_TVOS_10_0 = Q_MV_TVOS(10, 0),
+
+ /* watchOS */
+ MV_WATCHOS = 1 << 10,
+ MV_WATCHOS_2_0 = Q_MV_WATCHOS(2, 0),
+ MV_WATCHOS_2_1 = Q_MV_WATCHOS(2, 1),
+ MV_WATCHOS_2_2 = Q_MV_WATCHOS(2, 2),
+ MV_WATCHOS_3_0 = Q_MV_WATCHOS(3, 0)
};
#if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 1e852ae538..3b486b8f6f 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -47,7 +47,7 @@
/*
The operating system, must be one of: (Q_OS_x)
- DARWIN - Any Darwin system (OS X, iOS, watchOS, tvOS)
+ DARWIN - Any Darwin system (macOS, iOS, watchOS, tvOS)
MACOS - macOS
IOS - iOS
WATCHOS - watchOS
@@ -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,18 +102,19 @@
# 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
+# define QT_PLATFORM_UIKIT
+# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
# define Q_OS_WATCHOS
+# elif defined(TARGET_OS_TV) && TARGET_OS_TV
+# define Q_OS_TVOS
# else
# // TARGET_OS_IOS is only available in newer SDKs,
# // so assume any other iOS-based platform is iOS for now
# define Q_OS_IOS
# endif
# else
-# // there is no "real" OS X define (rdar://22640089),
-# // assume any non iOS-based platform is OS X for now
+# // TARGET_OS_OSX is only available in newer SDKs,
+# // so assume any non iOS-based platform is macOS for now
# define Q_OS_MACOS
# endif
# else
@@ -129,9 +129,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 +207,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..0414ae966a 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:!uikit {
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 {
@@ -174,7 +169,7 @@ win32 {
io/qstorageinfo_unix.cpp
}
- linux|if(qnx:contains(QT_CONFIG, inotify)) {
+ linux|if(qnx:qtConfig(inotify)) {
SOURCES += io/qfilesystemwatcher_inotify.cpp
HEADERS += io/qfilesystemwatcher_inotify_p.h
}
diff --git a/src/corelib/io/qabstractfileengine_p.h b/src/corelib/io/qabstractfileengine_p.h
index 0293184645..48b3dec324 100644
--- a/src/corelib/io/qabstractfileengine_p.h
+++ b/src/corelib/io/qabstractfileengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qfile.h"
#include "QtCore/qdir.h"
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index de1fc18cd0..b4eb98e062 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -556,6 +556,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_5_5 Same as Qt_5_4
\value Qt_5_6 Version 17 (Qt 5.6)
\value Qt_5_7 Same as Qt_5_6
+ \value Qt_5_8 Same as Qt_5_6
\omitvalue Qt_DefaultCompiledVersion
\sa setVersion(), version()
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index e8634fddef..ac58677b77 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -94,10 +94,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/qdatastream_p.h b/src/corelib/io/qdatastream_p.h
index 73f57e2d6c..3ca0ae840e 100644
--- a/src/corelib/io/qdatastream_p.h
+++ b/src/corelib/io/qdatastream_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qdatastream.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qdataurl_p.h b/src/corelib/io/qdataurl_p.h
index d2fa247b95..fd5c7df50b 100644
--- a/src/corelib/io/qdataurl_p.h
+++ b/src/corelib/io/qdataurl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qurl.h"
#include "QtCore/qbytearray.h"
#include "QtCore/qstring.h"
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 8021f29e16..abc2abeaec 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -438,8 +438,8 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
#define QT_FORWARD_DECLARE_CF_TYPE(type) Q_FORWARD_DECLARE_CF_TYPE(type);
#define QT_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type);
-#define QT_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref;
-#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref;
+#define QT_FORWARD_DECLARE_CG_TYPE(type) Q_FORWARD_DECLARE_CG_TYPE(type);
+#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type);
QT_END_NAMESPACE
Q_FORWARD_DECLARE_CF_TYPE(CFString);
diff --git a/src/corelib/io/qdebug_p.h b/src/corelib/io/qdebug_p.h
index ead86bbb6d..a1887655d2 100644
--- a/src/corelib/io/qdebug_p.h
+++ b/src/corelib/io/qdebug_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qdebug.h"
#include "QtCore/qmetaobject.h"
#include "QtCore/qflags.h"
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index f8fae711f2..91953ebf26 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -146,9 +146,11 @@ inline QStringList QDirPrivate::splitFilters(const QString &nameFilter, QChar se
{
if (sep.isNull())
sep = getFilterSepChar(nameFilter);
- QStringList ret = nameFilter.split(sep);
- for (int i = 0; i < ret.count(); ++i)
- ret[i] = ret[i].trimmed();
+ const QVector<QStringRef> split = nameFilter.splitRef(sep);
+ QStringList ret;
+ ret.reserve(split.size());
+ for (const auto &e : split)
+ ret.append(e.trimmed().toString());
return ret;
}
@@ -2187,7 +2189,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/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index a6394c16cc..5fd9edc552 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -254,6 +254,7 @@ void QDirIteratorPrivate::advance()
if (entryMatches(nextEntry.fileName(), info))
return;
+ nextMetaData = QFileSystemMetaData();
}
nativeIterators.pop();
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index b2f4b6931f..920281cef7 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.cpp b/src/corelib/io/qfilesystemengine.cpp
index fd8f251ccb..6424012a9a 100644
--- a/src/corelib/io/qfilesystemengine.cpp
+++ b/src/corelib/io/qfilesystemengine.cpp
@@ -91,7 +91,7 @@ QString QFileSystemEngine::slowCanonicalized(const QString &path)
if (separatorPos != -1) {
if (fi.isDir() && !target.endsWith(slash))
target.append(slash);
- target.append(tmpPath.mid(separatorPos));
+ target.append(tmpPath.midRef(separatorPos));
}
tmpPath = QDir::cleanPath(target);
separatorPos = 0;
@@ -227,14 +227,27 @@ static void fillStat64fromStat32(struct stat64 *statBuf64, const struct stat &st
{
statBuf64->st_mode = statBuf32.st_mode;
statBuf64->st_size = statBuf32.st_size;
+#if _POSIX_VERSION >= 200809L
+ statBuf64->st_ctim = statBuf32.st_ctim;
+ statBuf64->st_mtim = statBuf32.st_mtim;
+ statBuf64->st_atim = statBuf32.st_atim;
+#else
statBuf64->st_ctime = statBuf32.st_ctime;
statBuf64->st_mtime = statBuf32.st_mtime;
statBuf64->st_atime = statBuf32.st_atime;
+#endif
statBuf64->st_uid = statBuf32.st_uid;
statBuf64->st_gid = statBuf32.st_gid;
}
#endif
+#if _POSIX_VERSION >= 200809L
+static qint64 timespecToMSecs(const timespec &spec)
+{
+ return (qint64(spec.tv_sec) * 1000) + (spec.tv_nsec / 1000000);
+}
+#endif
+
void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
{
// Permissions
@@ -278,9 +291,17 @@ void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer)
#endif
// Times
- creationTime_ = statBuffer.st_ctime ? statBuffer.st_ctime : statBuffer.st_mtime;
- modificationTime_ = statBuffer.st_mtime;
- accessTime_ = statBuffer.st_atime;
+#if _POSIX_VERSION >= 200809L
+ modificationTime_ = timespecToMSecs(statBuffer.st_mtim);
+ creationTime_ = timespecToMSecs(statBuffer.st_ctim);
+ if (!creationTime_)
+ creationTime_ = modificationTime_;
+ accessTime_ = timespecToMSecs(statBuffer.st_atim);
+#else
+ creationTime_ = qint64(statBuffer.st_ctime ? statBuffer.st_ctime : statBuffer.st_mtime) * 1000;
+ modificationTime_ = qint64(statBuffer.st_mtime) * 1000;
+ accessTime_ = qint64(statBuffer.st_atime) * 1000;
+#endif
userId_ = statBuffer.st_uid;
groupId_ = statBuffer.st_gid;
}
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 75797e58da..6aaaa4c05a 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
@@ -182,8 +182,9 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
#endif
if (!ret.startsWith(QLatin1Char('/'))) {
- if (link.filePath().startsWith(QLatin1Char('/'))) {
- ret.prepend(link.filePath().left(link.filePath().lastIndexOf(QLatin1Char('/')))
+ const QString linkFilePath = link.filePath();
+ if (linkFilePath.startsWith(QLatin1Char('/'))) {
+ ret.prepend(linkFilePath.leftRef(linkFilePath.lastIndexOf(QLatin1Char('/')))
+ QLatin1Char('/'));
} else {
ret.prepend(QDir::currentPath() + QLatin1Char('/'));
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 85c795fadd..cdb64d08e1 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -52,14 +52,11 @@
#include "qvarlengtharray.h"
#include "qdatetime.h"
#include "qt_windows.h"
+#include "qvector.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 +113,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 +139,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 +177,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 +226,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 +271,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 +297,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 +312,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 +345,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];
+ const QString volumeName = QLatin1String("\\\\?\\") + result.leftRef(matchVolName.matchedLength());
+ 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,31 +403,16 @@ 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)
{
// This code assumes the UNC path is always like \\?\UNC\server...
- QStringList parts = server.split(QLatin1Char('\\'), QString::SkipEmptyParts);
+ const QVector<QStringRef> parts = server.splitRef(QLatin1Char('\\'), QString::SkipEmptyParts);
if (parts.count() >= 3) {
QStringList shares;
if (QFileSystemEngine::uncListSharesOnServer(QLatin1String("\\\\") + parts.at(2), &shares))
- return parts.count() >= 4 ? shares.contains(parts.at(3), Qt::CaseInsensitive) : true;
+ return parts.count() < 4 || shares.contains(parts.at(3).toString(), Qt::CaseInsensitive);
}
return false;
}
@@ -533,7 +503,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 +523,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 +545,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 +577,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 +607,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 +642,6 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
CloseHandle(handle);
}
return result;
-#else // !Q_OS_WINCE
- return entry.nativeFilePath().toLower().toLatin1();
-#endif
}
//static
@@ -882,7 +810,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 +853,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 +877,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 +887,6 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data,
}
return false;
}
-#endif
//static
bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data,
@@ -1069,25 +995,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.
@@ -1200,9 +1107,10 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
if (removeEmptyParents) {
dirName = QDir::toNativeSeparators(QDir::cleanPath(dirName));
for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) {
- QString chunk = dirName.left(slash);
- if (chunk.length() == 2 && chunk.at(0).isLetter() && chunk.at(1) == QLatin1Char(':'))
+ const QStringRef chunkRef = dirName.leftRef(slash);
+ if (chunkRef.length() == 2 && chunkRef.at(0).isLetter() && chunkRef.at(1) == QLatin1Char(':'))
break;
+ const QString chunk = chunkRef.toString();
if (!isDirPath(chunk, 0))
return false;
if (!rmDir(chunk))
@@ -1217,9 +1125,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 +1191,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 +1205,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 +1212,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 +1239,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 +1252,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 +1265,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 +1281,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 +1370,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/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h
index 6bb8fc2400..300a375377 100644
--- a/src/corelib/io/qfilesystementry_p.h
+++ b/src/corelib/io/qfilesystementry_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qstring.h>
#include <QtCore/qbytearray.h>
diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp
index ba195b2330..2ce7bd7a4b 100644
--- a/src/corelib/io/qfilesystemiterator_win.cpp
+++ b/src/corelib/io/qfilesystemiterator_win.cpp
@@ -40,6 +40,7 @@
#include "qfilesystemiterator_p.h"
#include "qfilesystemengine_p.h"
#include "qplatformdefs.h"
+#include "qvector.h"
#include <QtCore/qt_windows.h>
@@ -92,12 +93,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
@@ -105,7 +104,7 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
FINDEX_SEARCH_OPS(searchOps), 0, dwAdditionalFlags);
if (findFileHandle == INVALID_HANDLE_VALUE) {
if (nativePath.startsWith(QLatin1String("\\\\?\\UNC\\"))) {
- QStringList parts = nativePath.split(QLatin1Char('\\'), QString::SkipEmptyParts);
+ const QVector<QStringRef> parts = nativePath.splitRef(QLatin1Char('\\'), QString::SkipEmptyParts);
if (parts.count() == 4 && QFileSystemEngine::uncListSharesOnServer(
QLatin1String("\\\\") + parts.at(2), &uncShares)) {
if (uncShares.isEmpty())
diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h
index 7135c9b19b..091552f86e 100644
--- a/src/corelib/io/qfilesystemmetadata_p.h
+++ b/src/corelib/io/qfilesystemmetadata_p.h
@@ -237,9 +237,10 @@ private:
FILETIME lastAccessTime_;
FILETIME lastWriteTime_;
#else
- time_t creationTime_;
- time_t modificationTime_;
- time_t accessTime_;
+ // msec precision
+ qint64 creationTime_;
+ qint64 modificationTime_;
+ qint64 accessTime_;
uint userId_;
uint groupId_;
@@ -276,9 +277,9 @@ inline QDateTime QFileSystemMetaData::fileTime(QAbstractFileEngine::FileTime tim
#endif
#if defined(Q_OS_UNIX)
-inline QDateTime QFileSystemMetaData::creationTime() const { return QDateTime::fromTime_t(creationTime_); }
-inline QDateTime QFileSystemMetaData::modificationTime() const { return QDateTime::fromTime_t(modificationTime_); }
-inline QDateTime QFileSystemMetaData::accessTime() const { return QDateTime::fromTime_t(accessTime_); }
+inline QDateTime QFileSystemMetaData::creationTime() const { return QDateTime::fromMSecsSinceEpoch(creationTime_); }
+inline QDateTime QFileSystemMetaData::modificationTime() const { return QDateTime::fromMSecsSinceEpoch(modificationTime_); }
+inline QDateTime QFileSystemMetaData::accessTime() const { return QDateTime::fromMSecsSinceEpoch(accessTime_); }
inline uint QFileSystemMetaData::userId() const { return userId_; }
inline uint QFileSystemMetaData::groupId() const { return groupId_; }
@@ -331,13 +332,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 a3915cdf02..a1d90c76f4 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_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
index 5281d64d63..dc4e5bf38b 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h
index 57a5abba4f..777d62dc8a 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/corelib/io/qfilesystemwatcher_kqueue_p.h b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
index 27910a0543..9d4b6d1fe6 100644
--- a/src/corelib/io/qfilesystemwatcher_kqueue_p.h
+++ b/src/corelib/io/qfilesystemwatcher_kqueue_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h
index 1ceda492ef..6c64411f92 100644
--- a/src/corelib/io/qfilesystemwatcher_p.h
+++ b/src/corelib/io/qfilesystemwatcher_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h
index 9101f73c16..6dff08ac05 100644
--- a/src/corelib/io/qfilesystemwatcher_polling_p.h
+++ b/src/corelib/io/qfilesystemwatcher_polling_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
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/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 83f3831c5c..e8f5c49dec 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index cd24a54fd0..0b9cd0557f 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 af026b8976..5c79a745fa 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
}
/*
@@ -460,7 +409,6 @@ int QFSFileEnginePrivate::nativeHandle() const
{
if (fh || fd != -1)
return fh ? QT_FILENO(fh) : fd;
-#ifndef Q_OS_WINCE
if (cachedFd != -1)
return cachedFd;
@@ -471,9 +419,6 @@ int QFSFileEnginePrivate::nativeHandle() const
flags |= _O_RDONLY;
cachedFd = _open_osfhandle((intptr_t) fileHandle, flags);
return cachedFd;
-#else
- return -1;
-#endif
}
/*
@@ -481,7 +426,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);
@@ -529,35 +474,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;
@@ -585,7 +504,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 &&
@@ -604,10 +523,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()
@@ -628,12 +547,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) {
@@ -643,10 +562,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
@@ -654,13 +573,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));
}
@@ -671,8 +588,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;
@@ -713,24 +630,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;
@@ -811,7 +715,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
@@ -819,9 +722,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 {
@@ -903,14 +804,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();
@@ -982,10 +881,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 f5b17318be..c560bc7a03 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -739,6 +739,18 @@ void QIODevicePrivate::setWriteChannelCount(int count)
}
/*!
+ \internal
+*/
+bool QIODevicePrivate::allWriteBuffersEmpty() const
+{
+ for (const QRingBuffer &ringBuffer : writeBuffers) {
+ if (!ringBuffer.isEmpty())
+ return false;
+ }
+ return true;
+}
+
+/*!
Opens the device and sets its OpenMode to \a mode. Returns \c true if successful;
otherwise returns \c false. This function should be called from any
reimplementations of open() or other functions that open the device.
@@ -1148,34 +1160,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/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index d264bfd31d..76bec89ef2 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -92,6 +92,8 @@ public:
friend class QIODevicePrivate;
public:
// wrap functions from QRingBuffer
+ inline void setChunkSize(int size) { Q_ASSERT(m_buf); m_buf->setChunkSize(size); }
+ inline int chunkSize() const { Q_ASSERT(m_buf); return m_buf->chunkSize(); }
inline qint64 nextDataBlockSize() const { return (m_buf ? m_buf->nextDataBlockSize() : Q_INT64_C(0)); }
inline const char *readPointer() const { return (m_buf ? m_buf->readPointer() : Q_NULLPTR); }
inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const { Q_ASSERT(m_buf); return m_buf->readPointerAtPosition(pos, length); }
@@ -152,6 +154,8 @@ public:
return buffer.isEmpty() || (transactionStarted && isSequential()
&& transactionPos == buffer.size());
}
+ bool allWriteBuffersEmpty() const;
+
void seekBuffer(qint64 newPos);
inline void setCurrentReadChannel(int channel)
diff --git a/src/corelib/io/qipaddress_p.h b/src/corelib/io/qipaddress_p.h
index 52fa9c05ad..d95cccb3bd 100644
--- a/src/corelib/io/qipaddress_p.h
+++ b/src/corelib/io/qipaddress_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience of
-// qurl*.cpp This header file may change from version to version without
-// notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qstring.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp
index cb61a52c04..ae3a7c6abc 100644
--- a/src/corelib/io/qlockfile.cpp
+++ b/src/corelib/io/qlockfile.cpp
@@ -42,7 +42,7 @@
#include "qlockfile_p.h"
#include <QtCore/qthread.h>
-#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qdeadlinetimer.h>
#include <QtCore/qdatetime.h>
QT_BEGIN_NAMESPACE
@@ -210,9 +210,7 @@ bool QLockFile::lock()
bool QLockFile::tryLock(int timeout)
{
Q_D(QLockFile);
- QElapsedTimer timer;
- if (timeout > 0)
- timer.start();
+ QDeadlineTimer timer(qMax(timeout, -1)); // QDT only takes -1 as "forever"
int sleepTime = 100;
forever {
d->lockError = d->tryLock_sys();
@@ -235,8 +233,13 @@ bool QLockFile::tryLock(int timeout)
}
break;
}
- if (timeout == 0 || (timeout > 0 && timer.hasExpired(timeout)))
+
+ int remainingTime = timer.remainingTime();
+ if (remainingTime == 0)
return false;
+ else if (uint(sleepTime) > uint(remainingTime))
+ sleepTime = remainingTime;
+
QThread::msleep(sleepTime);
if (sleepTime < 5 * 1000)
sleepTime *= 2;
diff --git a/src/corelib/io/qlockfile_p.h b/src/corelib/io/qlockfile_p.h
index d7f2a1d52d..86a606ec00 100644
--- a/src/corelib/io/qlockfile_p.h
+++ b/src/corelib/io/qlockfile_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qlockfile.h>
#include <QtCore/qfile.h>
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index fda012dad3..82beb15912 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)
# include <sys/cdefs.h>
# include <sys/param.h>
# include <sys/sysctl.h>
@@ -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/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h
index b8b62e034f..5197da1ba4 100644
--- a/src/corelib/io/qloggingregistry_p.h
+++ b/src/corelib/io/qloggingregistry_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/qmap.h>
#include <QtCore/qmutex.h>
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 1d10e34018..23a3cc1a16 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
/*
@@ -1975,13 +1972,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)",
@@ -2158,7 +2148,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());
@@ -2166,7 +2155,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode)
&& processChannelMode != QProcess::MergedChannels)
q->setStandardErrorFile(q->nullDevice());
}
-#endif
q->QIODevice::open(mode);
@@ -2524,7 +2512,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_win.cpp b/src/corelib/io/qprocess_win.cpp
index 96b39efe3a..8579db1694 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -867,13 +867,15 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
bool success = false;
PROCESS_INFORMATION pinfo;
+ DWORD dwCreationFlags = (GetConsoleWindow() ? 0 : CREATE_NO_WINDOW);
+ dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
success = CreateProcess(0, (wchar_t*)args.utf16(),
- 0, 0, FALSE, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE, 0,
+ 0, 0, FALSE, dwCreationFlags, 0,
workingDir.isEmpty() ? 0 : (wchar_t*)workingDir.utf16(),
&startupInfo, &pinfo);
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/qresource.cpp b/src/corelib/io/qresource.cpp
index 96957ac11d..7fe3753da4 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -303,12 +303,12 @@ QResourcePrivate::ensureInitialized() const
if(!that->absoluteFilePath.startsWith(QLatin1Char(':')))
that->absoluteFilePath.prepend(QLatin1Char(':'));
- QString path = fileName;
+ QStringRef path(&fileName);
if(path.startsWith(QLatin1Char(':')))
path = path.mid(1);
if(path.startsWith(QLatin1Char('/'))) {
- that->load(path);
+ that->load(path.toString());
} else {
QMutexLocker lock(resourceMutex());
QStringList searchPaths = *resourceSearchPaths();
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 8bdd148e28..fcdc1e362b 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
@@ -814,7 +813,7 @@ StNormal:
++i;
goto StSkipSpaces;
}
- // fallthrough
+ Q_FALLTHROUGH();
default: {
int j = i + 1;
while (j < to) {
@@ -966,21 +965,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:
;
}
@@ -1365,7 +1355,6 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
{
QConfFile *confFile = confFiles[confFileNo].data();
bool readOnly = confFile->addedKeys.isEmpty() && confFile->removedKeys.isEmpty();
- bool ok;
/*
We can often optimize the read-only case, if the file on disk
@@ -1425,31 +1414,26 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
because they don't exist) are treated as empty files.
*/
if (file.isReadable() && fileInfo.size() != 0) {
+ bool ok = false;
#ifdef Q_OS_MAC
if (format == QSettings::NativeFormat) {
- ok = readPlistFile(confFile->name, &confFile->originalKeys);
+ QByteArray data = file.readAll();
+ ok = readPlistFile(data, &confFile->originalKeys);
} else
#endif
- {
- if (format <= QSettings::IniFormat) {
- QByteArray data = file.readAll();
- ok = readIniFile(data, &confFile->unparsedIniSections);
- } else {
- if (readFunc) {
- QSettings::SettingsMap tempNewKeys;
- ok = readFunc(file, tempNewKeys);
-
- if (ok) {
- QSettings::SettingsMap::const_iterator i = tempNewKeys.constBegin();
- while (i != tempNewKeys.constEnd()) {
- confFile->originalKeys.insert(QSettingsKey(i.key(),
- caseSensitivity),
- i.value());
- ++i;
- }
- }
- } else {
- ok = false;
+ if (format <= QSettings::IniFormat) {
+ QByteArray data = file.readAll();
+ ok = readIniFile(data, &confFile->unparsedIniSections);
+ } else if (readFunc) {
+ QSettings::SettingsMap tempNewKeys;
+ ok = readFunc(file, tempNewKeys);
+
+ if (ok) {
+ QSettings::SettingsMap::const_iterator i = tempNewKeys.constBegin();
+ while (i != tempNewKeys.constEnd()) {
+ confFile->originalKeys.insert(QSettingsKey(i.key(), caseSensitivity),
+ i.value());
+ ++i;
}
}
}
@@ -1467,44 +1451,42 @@ void QConfFileSettingsPrivate::syncConfFile(int confFileNo)
so everything is under control.
*/
if (!readOnly) {
+ bool ok = false;
ensureAllSectionsParsed(confFile);
ParsedSettingsMap mergedKeys = confFile->mergedKeyMap();
-#ifdef Q_OS_MAC
- if (format == QSettings::NativeFormat) {
- ok = writePlistFile(confFile->name, mergedKeys);
- } else
-#endif
- {
#ifndef QT_BOOTSTRAPPED
- QSaveFile sf(confFile->name);
+ QSaveFile sf(confFile->name);
#else
- QFile sf(confFile->name);
+ QFile sf(confFile->name);
#endif
- if (!sf.open(QIODevice::WriteOnly)) {
- setStatus(QSettings::AccessError);
- ok = false;
- } else if (format <= QSettings::IniFormat) {
- ok = writeIniFile(sf, mergedKeys);
- } else {
- if (writeFunc) {
- QSettings::SettingsMap tempOriginalKeys;
+ if (!sf.open(QIODevice::WriteOnly)) {
+ setStatus(QSettings::AccessError);
+ return;
+ }
- ParsedSettingsMap::const_iterator i = mergedKeys.constBegin();
- while (i != mergedKeys.constEnd()) {
- tempOriginalKeys.insert(i.key(), i.value());
- ++i;
- }
- ok = writeFunc(sf, tempOriginalKeys);
- } else {
- ok = false;
- }
+#ifdef Q_OS_MAC
+ if (format == QSettings::NativeFormat) {
+ ok = writePlistFile(sf, mergedKeys);
+ } else
+#endif
+ if (format <= QSettings::IniFormat) {
+ ok = writeIniFile(sf, mergedKeys);
+ } else if (writeFunc) {
+ QSettings::SettingsMap tempOriginalKeys;
+
+ ParsedSettingsMap::const_iterator i = mergedKeys.constBegin();
+ while (i != mergedKeys.constEnd()) {
+ tempOriginalKeys.insert(i.key(), i.value());
+ ++i;
}
+ ok = writeFunc(sf, tempOriginalKeys);
+ }
+
#ifndef QT_BOOTSTRAPPED
- if (ok)
- ok = sf.commit();
+ if (ok)
+ ok = sf.commit();
#endif
- }
if (ok) {
confFile->unparsedIniSections.clear();
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index d73cc4d298..bc397055ff 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -181,7 +181,7 @@ static QCFType<CFPropertyListRef> macValue(const QVariant &value)
QDateTime dt = value.toDateTime();
if (dt.timeSpec() == Qt::LocalTime) {
QDateTime reference;
- reference.setTime_t((uint)kCFAbsoluteTimeIntervalSince1970);
+ reference.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970));
result = CFDateCreate(kCFAllocatorDefault, CFAbsoluteTime(reference.secsTo(dt)));
} else {
goto string_case;
@@ -293,7 +293,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
return map;
} else if (typeId == CFDateGetTypeID()) {
QDateTime dt;
- dt.setTime_t((uint)kCFAbsoluteTimeIntervalSince1970);
+ dt.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970));
return dt.addSecs((int)CFDateGetAbsoluteTime(static_cast<CFDateRef>(cfvalue)));
}
return QVariant();
@@ -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);
}
}
}
@@ -637,24 +613,11 @@ QSettingsPrivate *QSettingsPrivate::create(QSettings::Format format,
}
}
-static QCFType<CFURLRef> urlFromFileName(const QString &fileName)
-{
- return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, QCFString(fileName),
- kCFURLPOSIXPathStyle, false);
-}
-
-bool QConfFileSettingsPrivate::readPlistFile(const QString &fileName, ParsedSettingsMap *map) const
+bool QConfFileSettingsPrivate::readPlistFile(const QByteArray &data, ParsedSettingsMap *map) const
{
- QCFType<CFDataRef> resource;
- SInt32 code;
- if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, urlFromFileName(fileName),
- &resource, 0, 0, &code))
- return false;
-
- QCFString errorStr;
+ QCFType<CFDataRef> cfData = data.toRawCFData();
QCFType<CFPropertyListRef> propertyList =
- CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resource, kCFPropertyListImmutable,
- &errorStr);
+ CFPropertyListCreateWithData(kCFAllocatorDefault, cfData, kCFPropertyListImmutable, Q_NULLPTR, Q_NULLPTR);
if (!propertyList)
return true;
@@ -675,8 +638,7 @@ bool QConfFileSettingsPrivate::readPlistFile(const QString &fileName, ParsedSett
return true;
}
-bool QConfFileSettingsPrivate::writePlistFile(const QString &fileName,
- const ParsedSettingsMap &map) const
+bool QConfFileSettingsPrivate::writePlistFile(QIODevice &file, const ParsedSettingsMap &map) const
{
QVarLengthArray<QCFType<CFStringRef> > cfkeys(map.size());
QVarLengthArray<QCFType<CFPropertyListRef> > cfvalues(map.size());
@@ -699,8 +661,7 @@ bool QConfFileSettingsPrivate::writePlistFile(const QString &fileName,
QCFType<CFDataRef> xmlData = CFPropertyListCreateData(
kCFAllocatorDefault, propertyList, kCFPropertyListXMLFormat_v1_0, 0, 0);
- SInt32 code;
- return CFURLWriteDataAndPropertiesToResource(urlFromFileName(fileName), xmlData, 0, &code);
+ return file.write(QByteArray::fromRawCFData(xmlData)) == CFDataGetLength(xmlData);
}
QT_END_NAMESPACE
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index 9d7b667514..e6d3413bab 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -296,8 +296,8 @@ private:
void syncConfFile(int confFileNo);
bool writeIniFile(QIODevice &device, const ParsedSettingsMap &map);
#ifdef Q_OS_MAC
- bool readPlistFile(const QString &fileName, ParsedSettingsMap *map) const;
- bool writePlistFile(const QString &fileName, const ParsedSettingsMap &map) const;
+ bool readPlistFile(const QByteArray &data, ParsedSettingsMap *map) const;
+ bool writePlistFile(QIODevice &file, const ParsedSettingsMap &map) const;
#endif
void ensureAllSectionsParsed(QConfFile *confFile) const;
void ensureSectionParsed(QConfFile *confFile, const QSettingsKey &key) const;
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 05ed51e999..3f06ab7043 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) {
@@ -750,7 +742,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
}
case QVariant::ByteArray:
- // fallthrough intended
+ Q_FALLTHROUGH();
default: {
// If the string does not contain '\0', we can use REG_SZ, the native registry
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index fff1a29bf3..df76d73eae 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -41,6 +41,7 @@
#define QSTANDARDPATHS_H
#include <QtCore/qstringlist.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -49,6 +50,8 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QStandardPaths
{
+ Q_GADGET
+
public:
// Do not re-order, must match QDesktopServices
enum StandardLocation {
@@ -73,6 +76,7 @@ public:
AppConfigLocation,
AppLocalDataLocation = DataLocation
};
+ Q_ENUM(StandardLocation)
static QString writableLocation(StandardLocation type);
static QStringList standardLocations(StandardLocation type);
@@ -82,6 +86,7 @@ public:
LocateDirectory = 0x1
};
Q_DECLARE_FLAGS(LocateOptions, LocateOption)
+ Q_FLAG(LocateOptions)
static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
@@ -103,6 +108,8 @@ private:
~QStandardPaths();
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions)
+
#endif // QT_NO_STANDARDPATHS
QT_END_NAMESPACE
diff --git a/src/corelib/io/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_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index bcbc9664ef..0561e5833f 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -223,7 +223,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (!value.isEmpty()) {
// value can start with $HOME
if (value.startsWith(QLatin1String("$HOME")))
- value = QDir::homePath() + value.mid(5);
+ value = QDir::homePath() + value.midRef(5);
if (value.length() > 1 && value.endsWith(QLatin1Char('/')))
value.chop(1);
return value;
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..a14fa8480a 100644
--- a/src/corelib/io/qstorageinfo_p.h
+++ b/src/corelib/io/qstorageinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qstorageinfo.h"
QT_BEGIN_NAMESPACE
@@ -70,7 +71,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..4fdb1505ff 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>
@@ -2646,6 +2644,7 @@ QTextStream &QTextStream::operator<<(const char *string)
{
Q_D(QTextStream);
CHECK_VALID_STREAM(*this);
+ // ### Qt6: consider changing to UTF-8
d->putString(QLatin1String(string));
return *this;
}
diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h
index 684cff6aa1..a642beddc4 100644
--- a/src/corelib/io/qtextstream_p.h
+++ b/src/corelib/io/qtextstream_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qtextstream.h"
#ifndef QT_NO_TEXTCODEC
#include "qtextcodec.h"
diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h
index b1fde0c700..b9fbdebbc5 100644
--- a/src/corelib/io/qtldurl_p.h
+++ b/src/corelib/io/qtldurl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qurl.h"
#include "QtCore/qstring.h"
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index b79ec78aa9..42a742213b 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
@@ -836,7 +833,7 @@ recodeFromUser(const QString &input, const ushort *actions, int from, int to)
// appendXXXX functions: copy from the internal form to the external, user form.
// the internal value is stored in its PrettyDecoded form, so that case is easy.
-static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,
+static inline void appendToUser(QString &appendTo, const QStringRef &value, QUrl::FormattingOptions options,
const ushort *actions)
{
if (options == QUrl::PrettyDecoded) {
@@ -844,10 +841,17 @@ static inline void appendToUser(QString &appendTo, const QString &value, QUrl::F
return;
}
- if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions))
+ if (!qt_urlRecode(appendTo, value.data(), value.end(), options, actions))
appendTo += value;
}
+static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,
+ const ushort *actions)
+{
+ appendToUser(appendTo, QStringRef(&value), options, actions);
+}
+
+
inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
{
if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
@@ -927,21 +931,22 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o
if (options & QUrl::NormalizePathSegments) {
thePath = qt_normalizePathSegments(path, false);
}
+
+ QStringRef thePathRef(&thePath);
if (options & QUrl::RemoveFilename) {
const int slash = path.lastIndexOf(QLatin1Char('/'));
if (slash == -1)
return;
- thePath = path.left(slash+1);
+ thePathRef = path.leftRef(slash + 1);
}
// check if we need to remove trailing slashes
if (options & QUrl::StripTrailingSlash) {
- while (thePath.length() > 1 && thePath.endsWith(QLatin1Char('/')))
- thePath.chop(1);
+ while (thePathRef.length() > 1 && thePathRef.endsWith(QLatin1Char('/')))
+ thePathRef.chop(1);
}
- appendToUser(appendTo, thePath, options,
+ appendToUser(appendTo, thePathRef, options,
appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? pathInUrl : pathInIsolation);
-
}
inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
@@ -3456,33 +3461,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
@@ -3816,13 +3794,13 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
} else if (deslashified.startsWith(QLatin1String("//"))) {
// magic for shared drive on windows
int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2);
- QString hostSpec = deslashified.mid(2, indexOfPath - 2);
+ QStringRef hostSpec = deslashified.midRef(2, indexOfPath - 2);
// Check for Windows-specific WebDAV specification: "//host@SSL/path".
if (hostSpec.endsWith(webDavSslTag(), Qt::CaseInsensitive)) {
- hostSpec.chop(4);
+ hostSpec.truncate(hostSpec.size() - 4);
scheme = webDavScheme();
}
- url.setHost(hostSpec);
+ url.setHost(hostSpec.toString());
if (indexOfPath > 2)
deslashified = deslashified.right(deslashified.length() - indexOfPath);
@@ -4287,8 +4265,8 @@ QUrl QUrl::fromUserInput(const QString &userInput)
if (urlPrepended.isValid() && (!urlPrepended.host().isEmpty() || !urlPrepended.path().isEmpty()))
{
int dotIndex = trimmedString.indexOf(QLatin1Char('.'));
- const QString hostscheme = trimmedString.left(dotIndex).toLower();
- if (hostscheme == ftpScheme())
+ const QStringRef hostscheme = trimmedString.leftRef(dotIndex);
+ if (hostscheme.compare(ftpScheme(), Qt::CaseInsensitive) == 0)
urlPrepended.setScheme(ftpScheme());
return adjustFtpPath(urlPrepended);
}
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/qurl_p.h b/src/corelib/io/qurl_p.h
index 49dcdeb144..cb88cac35e 100644
--- a/src/corelib/io/qurl_p.h
+++ b/src/corelib/io/qurl_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qurl.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qurltlds_p.h b/src/corelib/io/qurltlds_p.h
index 69d0701faa..2bd5c68c7b 100644
--- a/src/corelib/io/qurltlds_p.h
+++ b/src/corelib/io/qurltlds_p.h
@@ -52,6 +52,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
// note to maintainer:
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/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index 3c641670b6..5a0d04855f 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qelapsedtimer.h>
#include <qobject.h>
#include <qbytearray.h>
diff --git a/src/corelib/io/qwinoverlappedionotifier_p.h b/src/corelib/io/qwinoverlappedionotifier_p.h
index febdfe310f..276a1d861e 100644
--- a/src/corelib/io/qwinoverlappedionotifier_p.h
+++ b/src/corelib/io/qwinoverlappedionotifier_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qobject.h>
typedef struct _OVERLAPPED OVERLAPPED;
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index d645205155..7fdf107383 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -47,6 +47,7 @@
#include <qvector.h>
#include <qstack.h>
#include <qbitarray.h>
+#include <qdatetime.h>
#include <limits.h>
@@ -363,7 +364,7 @@ quintptr QPersistentModelIndex::internalId() const
Returns the parent QModelIndex for this persistent index, or an invalid
QModelIndex if it has no parent.
- \sa child(), sibling(), model()
+ \sa sibling(), model()
*/
QModelIndex QPersistentModelIndex::parent() const
{
@@ -376,7 +377,7 @@ QModelIndex QPersistentModelIndex::parent() const
Returns the sibling at \a row and \a column or an invalid QModelIndex if
there is no sibling at this position.
- \sa parent(), child()
+ \sa parent()
*/
QModelIndex QPersistentModelIndex::sibling(int row, int column) const
@@ -386,7 +387,12 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const
return QModelIndex();
}
+#if QT_DEPRECATED_SINCE(5, 8)
/*!
+ \obsolete
+
+ Use QAbstractItemModel::index() instead.
+
Returns the child of the model index that is stored in the given \a row
and \a column.
@@ -396,9 +402,10 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const
QModelIndex QPersistentModelIndex::child(int row, int column) const
{
if (d)
- return d->index.child(row, column);
+ return d->index.model()->index(row, column, d->index);
return QModelIndex();
}
+#endif
/*!
Returns the data for the given \a role for the item referred to by the
@@ -547,6 +554,43 @@ const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames()
return *qDefaultRoleNames();
}
+bool QAbstractItemModelPrivate::isVariantLessThan(const QVariant &left, const QVariant &right,
+ Qt::CaseSensitivity cs, bool isLocaleAware)
+{
+ if (left.userType() == QVariant::Invalid)
+ return false;
+ if (right.userType() == QVariant::Invalid)
+ return true;
+ switch (left.userType()) {
+ case QVariant::Int:
+ return left.toInt() < right.toInt();
+ case QVariant::UInt:
+ return left.toUInt() < right.toUInt();
+ case QVariant::LongLong:
+ return left.toLongLong() < right.toLongLong();
+ case QVariant::ULongLong:
+ return left.toULongLong() < right.toULongLong();
+ case QMetaType::Float:
+ return left.toFloat() < right.toFloat();
+ case QVariant::Double:
+ return left.toDouble() < right.toDouble();
+ case QVariant::Char:
+ return left.toChar() < right.toChar();
+ case QVariant::Date:
+ return left.toDate() < right.toDate();
+ case QVariant::Time:
+ return left.toTime() < right.toTime();
+ case QVariant::DateTime:
+ return left.toDateTime() < right.toDateTime();
+ case QVariant::String:
+ default:
+ if (isLocaleAware)
+ return left.toString().localeAwareCompare(right.toString()) < 0;
+ else
+ return left.toString().compare(right.toString(), cs) < 0;
+ }
+}
+
static uint typeOfVariant(const QVariant &value)
{
@@ -1061,12 +1105,16 @@ void QAbstractItemModel::resetInternalData()
Returns the sibling at \a row and \a column. If there is no sibling at this
position, an invalid QModelIndex is returned.
- \sa parent(), child()
+ \sa parent()
*/
/*!
\fn QModelIndex QModelIndex::child(int row, int column) const
+ \obsolete
+
+ Use QAbstractItemModel::index() instead.
+
Returns the child of the model index that is stored in the given \a row and
\a column.
@@ -1115,7 +1163,7 @@ void QAbstractItemModel::resetInternalData()
Returns the parent of the model index, or QModelIndex() if it has no
parent.
- \sa child(), sibling(), model()
+ \sa sibling(), model()
*/
/*!
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 0820626452..907ba09676 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -63,7 +63,9 @@ public:
inline void *internalPointer() const Q_DECL_NOTHROW { return reinterpret_cast<void*>(i); }
inline QModelIndex parent() const;
inline QModelIndex sibling(int row, int column) const;
- inline QModelIndex child(int row, int column) const;
+#if QT_DEPRECATED_SINCE(5, 8)
+ QT_DEPRECATED_X("Use QAbstractItemModel::index") inline QModelIndex child(int row, int column) const;
+#endif
inline QVariant data(int role = Qt::DisplayRole) const;
inline Qt::ItemFlags flags() const;
Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; }
@@ -128,7 +130,9 @@ public:
quintptr internalId() const;
QModelIndex parent() const;
QModelIndex sibling(int row, int column) const;
- QModelIndex child(int row, int column) const;
+#if QT_DEPRECATED_SINCE(5, 8)
+ QT_DEPRECATED_X("Use QAbstractItemModel::index") QModelIndex child(int row, int column) const;
+#endif
QVariant data(int role = Qt::DisplayRole) const;
Qt::ItemFlags flags() const;
const QAbstractItemModel *model() const;
@@ -419,8 +423,10 @@ inline QModelIndex QModelIndex::parent() const
inline QModelIndex QModelIndex::sibling(int arow, int acolumn) const
{ return m ? (r == arow && c == acolumn) ? *this : m->sibling(arow, acolumn, *this) : QModelIndex(); }
+#if QT_DEPRECATED_SINCE(5, 8)
inline QModelIndex QModelIndex::child(int arow, int acolumn) const
{ return m ? m->index(arow, acolumn, *this) : QModelIndex(); }
+#endif
inline QVariant QModelIndex::data(int arole) const
{ return m ? m->data(*this, arole) : QVariant(); }
diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h
index 9ff40cd60e..7086ae730a 100644
--- a/src/corelib/itemmodels/qabstractitemmodel_p.h
+++ b/src/corelib/itemmodels/qabstractitemmodel_p.h
@@ -150,6 +150,8 @@ public:
QHash<int,QByteArray> roleNames;
static const QHash<int,QByteArray> &defaultRoleNames();
+ static bool isVariantLessThan(const QVariant &left, const QVariant &right,
+ Qt::CaseSensitivity cs = Qt::CaseSensitive, bool isLocaleAware = false);
};
Q_DECLARE_TYPEINFO(QAbstractItemModelPrivate::Change, Q_MOVABLE_TYPE);
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index d79b99541e..3d3cb00750 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -40,6 +40,10 @@
#ifndef QITEMSELECTIONMODEL_H
#define QITEMSELECTIONMODEL_H
+#include <QtCore/qglobal.h>
+
+#ifndef QT_NO_ITEMVIEWS
+
#include <QtCore/qset.h>
#include <QtCore/qvector.h>
#include <QtCore/qlist.h>
@@ -47,9 +51,6 @@
QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_ITEMVIEWS
-
class Q_CORE_EXPORT QItemSelectionRange
{
@@ -272,11 +273,11 @@ Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QItemSelection)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &);
#endif
-#endif // QT_NO_ITEMVIEWS
-
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QItemSelectionRange)
Q_DECLARE_METATYPE(QItemSelection)
+#endif // QT_NO_ITEMVIEWS
+
#endif // QITEMSELECTIONMODEL_H
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 0f45862035..b0ddfa879d 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -2654,40 +2654,7 @@ bool QSortFilterProxyModel::lessThan(const QModelIndex &source_left, const QMode
Q_D(const QSortFilterProxyModel);
QVariant l = (source_left.model() ? source_left.model()->data(source_left, d->sort_role) : QVariant());
QVariant r = (source_right.model() ? source_right.model()->data(source_right, d->sort_role) : QVariant());
- // Duplicated in QStandardItem::operator<()
- if (l.userType() == QVariant::Invalid)
- return false;
- if (r.userType() == QVariant::Invalid)
- return true;
- switch (l.userType()) {
- case QVariant::Int:
- return l.toInt() < r.toInt();
- case QVariant::UInt:
- return l.toUInt() < r.toUInt();
- case QVariant::LongLong:
- return l.toLongLong() < r.toLongLong();
- case QVariant::ULongLong:
- return l.toULongLong() < r.toULongLong();
- case QMetaType::Float:
- return l.toFloat() < r.toFloat();
- case QVariant::Double:
- return l.toDouble() < r.toDouble();
- case QVariant::Char:
- return l.toChar() < r.toChar();
- case QVariant::Date:
- return l.toDate() < r.toDate();
- case QVariant::Time:
- return l.toTime() < r.toTime();
- case QVariant::DateTime:
- return l.toDateTime() < r.toDateTime();
- case QVariant::String:
- default:
- if (d->sort_localeaware)
- return l.toString().localeAwareCompare(r.toString()) < 0;
- else
- return l.toString().compare(r.toString(), d->sort_casesensitivity) < 0;
- }
- return false;
+ return QAbstractItemModelPrivate::isVariantLessThan(l, r, d->sort_casesensitivity, d->sort_localeaware);
}
/*!
diff --git a/src/corelib/json/qjson.cpp b/src/corelib/json/qjson.cpp
index 4b98ef076c..e9a1366af0 100644
--- a/src/corelib/json/qjson.cpp
+++ b/src/corelib/json/qjson.cpp
@@ -339,7 +339,7 @@ bool Value::isValid(const Base *b) const
case QJsonValue::Double:
if (latinOrIntValue)
break;
- // fall through
+ Q_FALLTHROUGH();
case QJsonValue::String:
case QJsonValue::Array:
case QJsonValue::Object:
@@ -418,7 +418,7 @@ uint Value::valueToStore(const QJsonValue &v, uint offset)
if (c != INT_MAX)
return c;
}
- // fall through
+ Q_FALLTHROUGH();
case QJsonValue::String:
case QJsonValue::Array:
case QJsonValue::Object:
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index 8eeff01b59..4be62172a2 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -151,6 +151,14 @@ public:
val = qToLittleEndian(qFromLittleEndian(val) + i);
return *this;
}
+ q_littleendian &operator |=(T i) {
+ val = qToLittleEndian(qFromLittleEndian(val) | i);
+ return *this;
+ }
+ q_littleendian &operator &=(T i) {
+ val = qToLittleEndian(qFromLittleEndian(val) & i);
+ return *this;
+ }
};
} // namespace QJsonPrivate
@@ -205,6 +213,14 @@ public:
*this = (uint(*this) - i);
return *this;
}
+ qle_bitfield &operator |=(uint i) {
+ *this = (uint(*this) | i);
+ return *this;
+ }
+ qle_bitfield &operator &=(uint i) {
+ *this = (uint(*this) & i);
+ return *this;
+ }
};
template<int pos, int width>
@@ -396,7 +412,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 +421,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/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp
index 6eca54bdf0..86fd63ead4 100644
--- a/src/corelib/json/qjsondocument.cpp
+++ b/src/corelib/json/qjsondocument.cpp
@@ -260,7 +260,7 @@ QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidati
Creates a QJsonDocument from the QVariant \a variant.
If the \a variant contains any other type than a QVariantMap,
- QVariantList or QStringList, the returned document
+ QVariantHash, QVariantList or QStringList, the returned document
document is invalid.
\sa toVariant()
@@ -270,6 +270,8 @@ QJsonDocument QJsonDocument::fromVariant(const QVariant &variant)
QJsonDocument doc;
if (variant.type() == QVariant::Map) {
doc.setObject(QJsonObject::fromVariantMap(variant.toMap()));
+ } else if (variant.type() == QVariant::Hash) {
+ doc.setObject(QJsonObject::fromVariantHash(variant.toHash()));
} else if (variant.type() == QVariant::List) {
doc.setArray(QJsonArray::fromVariantList(variant.toList()));
} else if (variant.type() == QVariant::StringList) {
diff --git a/src/corelib/json/qjsonparser_p.h b/src/corelib/json/qjsonparser_p.h
index ceb366b0f8..e3b95109c6 100644
--- a/src/corelib/json/qjsonparser_p.h
+++ b/src/corelib/json/qjsonparser_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qjsondocument.h>
#include <qvarlengtharray.h>
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp
index 718dfa43b3..5a906dda7b 100644
--- a/src/corelib/json/qjsonvalue.cpp
+++ b/src/corelib/json/qjsonvalue.cpp
@@ -438,7 +438,7 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant)
The QJsonValue types will be converted as follows:
- \value Null \l {QVariant::}{QVariant()}
+ \value Null QMetaType::Nullptr
\value Bool QMetaType::Bool
\value Double QMetaType::Double
\value String QString
@@ -466,6 +466,7 @@ QVariant QJsonValue::toVariant() const
QJsonObject(d, static_cast<QJsonPrivate::Object *>(base)).toVariantMap() :
QVariantMap();
case Null:
+ return QVariant::fromValue(nullptr);
case Undefined:
break;
}
diff --git a/src/corelib/json/qjsonwriter_p.h b/src/corelib/json/qjsonwriter_p.h
index b9cdbb6976..76a8460449 100644
--- a/src/corelib/json/qjsonwriter_p.h
+++ b/src/corelib/json/qjsonwriter_p.h
@@ -50,6 +50,8 @@
//
// We mean it.
//
+
+#include <QtCore/private/qglobal_p.h>
#include <qjsonvalue.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 8c16e10c27..a78397e46c 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -4,6 +4,9 @@ HEADERS += \
kernel/qabstracteventdispatcher.h \
kernel/qabstractnativeeventfilter.h \
kernel/qbasictimer.h \
+ kernel/qdeadlinetimer.h \
+ kernel/qdeadlinetimer_p.h \
+ kernel/qelapsedtimer.h \
kernel/qeventloop.h\
kernel/qpointer.h \
kernel/qcorecmdlineargs_p.h \
@@ -45,6 +48,8 @@ SOURCES += \
kernel/qabstracteventdispatcher.cpp \
kernel/qabstractnativeeventfilter.cpp \
kernel/qbasictimer.cpp \
+ kernel/qdeadlinetimer.cpp \
+ kernel/qelapsedtimer.cpp \
kernel/qeventloop.cpp \
kernel/qcoreapplication.cpp \
kernel/qcoreevent.cpp \
@@ -69,6 +74,7 @@ SOURCES += \
win32 {
SOURCES += \
kernel/qcoreapplication_win.cpp \
+ kernel/qelapsedtimer_win.cpp \
kernel/qwineventnotifier.cpp \
kernel/qsharedmemory_win.cpp \
kernel/qsystemsemaphore_win.cpp
@@ -84,14 +90,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 +107,9 @@ mac {
SOURCES += \
kernel/qcfsocketnotifier.cpp \
kernel/qcoreapplication_mac.cpp \
- kernel/qcore_mac.cpp
+ kernel/qcore_mac.cpp \
+ kernel/qcore_foundation.mm
+ !nacl: SOURCES += kernel/qelapsedtimer_mac.cpp
OBJECTIVE_SOURCES += \
kernel/qcore_mac_objc.mm \
@@ -119,10 +119,15 @@ mac {
osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit
- ios {
+ uikit {
# We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit
}
+
+ watchos {
+ # We need WatchKit for WKExtension in qeventdispatcher_cf.mm
+ LIBS_PRIVATE += -framework WatchKit
+ }
}
nacl {
@@ -138,6 +143,7 @@ unix|integrity {
kernel/qcrashhandler.cpp \
kernel/qeventdispatcher_unix.cpp \
kernel/qtimerinfo_unix.cpp
+ !darwin|nacl: SOURCES += kernel/qelapsedtimer_unix.cpp
HEADERS += \
kernel/qcore_unix_p.h \
@@ -146,21 +152,20 @@ unix|integrity {
kernel/qpoll_p.h \
kernel/qtimerinfo_unix_p.h
- contains(QT_CONFIG, poll_select): SOURCES += kernel/qpoll.cpp
- contains(QT_CONFIG, poll_poll): DEFINES += QT_HAVE_POLL
- contains(QT_CONFIG, poll_ppoll): DEFINES += QT_HAVE_POLL QT_HAVE_PPOLL
- contains(QT_CONFIG, poll_pollts): DEFINES += QT_HAVE_POLL QT_HAVE_POLLTS
+ qtConfig(poll_select): SOURCES += kernel/qpoll.cpp
+ qtConfig(poll_poll): DEFINES += QT_HAVE_POLL
+ qtConfig(poll_ppoll): DEFINES += QT_HAVE_POLL QT_HAVE_PPOLL
+ qtConfig(poll_pollts): DEFINES += QT_HAVE_POLL QT_HAVE_POLLTS
- contains(QT_CONFIG, glib) {
+ qtConfig(glib) {
SOURCES += \
kernel/qeventdispatcher_glib.cpp
HEADERS += \
kernel/qeventdispatcher_glib_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE +=$$QT_LIBS_GLIB
+ QMAKE_USE_PRIVATE += glib
}
- contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
+ qtConfig(clock-gettime): include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
!android {
SOURCES += kernel/qsharedmemory_posix.cpp \
@@ -183,7 +188,7 @@ vxworks {
}
qqnx_pps {
- LIBS_PRIVATE += -lpps
+ QMAKE_USE_PRIVATE += pps
SOURCES += \
kernel/qppsattribute.cpp \
kernel/qppsobject.cpp
@@ -203,3 +208,5 @@ android {
kernel/qjnihelpers_p.h \
kernel/qjni_p.h
}
+
+!darwin:!unix:!win32: SOURCES += kernel/qelapsedtimer_generic.cpp
diff --git a/src/corelib/kernel/qcfsocketnotifier_p.h b/src/corelib/kernel/qcfsocketnotifier_p.h
index c11c345361..12c5bf6334 100644
--- a/src/corelib/kernel/qcfsocketnotifier_p.h
+++ b/src/corelib/kernel/qcfsocketnotifier_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qabstracteventdispatcher.h>
#include <QtCore/qhash.h>
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..ee1a290386 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) || defined(Q_OS_WATCHOS)
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion;
v.major = osv.majorVersion;
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index b94aac1093..63e1cb48dc 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -61,7 +61,7 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
-#include "qglobal.h"
+#include "private/qglobal_p.h"
#ifdef __OBJC__
#include <Foundation/Foundation.h>
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index 125ced6fc9..b5756af994 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qplatformdefs.h"
#include "qatomic.h"
#include "qhash.h"
@@ -298,8 +299,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/watchOS don't have processes
+#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS)
static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[])
{
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 2179a0d323..0413e06665 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -72,7 +72,7 @@
#ifndef QT_NO_QOBJECT
#if defined(Q_OS_UNIX)
-# if defined(Q_OS_OSX)
+# if defined(Q_OS_DARWIN)
# include "qeventdispatcher_cf_p.h"
# else
# if !defined(QT_NO_GLIB)
@@ -483,7 +483,7 @@ void QCoreApplicationPrivate::createEventDispatcher()
{
Q_Q(QCoreApplication);
#if defined(Q_OS_UNIX)
-# if defined(Q_OS_OSX)
+# if defined(Q_OS_DARWIN)
bool ok = false;
int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);
if (ok && value > 0)
@@ -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
}
/*****************************************************************************
@@ -2259,14 +2246,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);
@@ -2497,6 +2476,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 0e2d4e2324..67e509eeef 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -122,6 +122,7 @@ QString QCoreApplicationPrivate::appName() const
#ifndef Q_OS_WINRT
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle
{
return GetModuleHandle(0);
@@ -145,12 +146,13 @@ Q_CORE_EXPORT int qWinAppCmdShow() // get main window sho
: SW_SHOWDEFAULT;
#endif
}
+#endif
/*****************************************************************************
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
@@ -171,30 +173,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
@@ -212,11 +191,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..33445a1625 100644
--- a/src/corelib/kernel/qcorecmdlineargs_p.h
+++ b/src/corelib/kernel/qcorecmdlineargs_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qstring.h"
#include "QtCore/qstringlist.h"
@@ -81,93 +82,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/qcoreglobaldata_p.h b/src/corelib/kernel/qcoreglobaldata_p.h
index 4f97449c75..32b5becf4f 100644
--- a/src/corelib/kernel/qcoreglobaldata_p.h
+++ b/src/corelib/kernel/qcoreglobaldata_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qmap.h"
#include "QtCore/qstringlist.h"
#include "QtCore/qreadwritelock.h"
diff --git a/src/corelib/kernel/qcrashhandler_p.h b/src/corelib/kernel/qcrashhandler_p.h
index 1fd0ff3af8..64c15ce66c 100644
--- a/src/corelib/kernel/qcrashhandler_p.h
+++ b/src/corelib/kernel/qcrashhandler_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#ifndef QT_NO_CRASHHANDLER
diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp
new file mode 100644
index 0000000000..17a74b22d7
--- /dev/null
+++ b/src/corelib/kernel/qdeadlinetimer.cpp
@@ -0,0 +1,811 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.h"
+#include <qpair.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECL_CONST_FUNCTION static inline QPair<qint64, qint64> toSecsAndNSecs(qint64 nsecs)
+{
+ qint64 secs = nsecs / (1000*1000*1000);
+ if (nsecs < 0)
+ --secs;
+ nsecs -= secs * 1000*1000*1000;
+ return qMakePair(secs, nsecs);
+}
+
+/*!
+ \class QDeadlineTimer
+ \inmodule QtCore
+ \brief The QDeadlineTimer class marks a deadline in the future.
+ \since 5.8
+
+ \reentrant
+ \ingroup tools
+
+ The QDeadlineTimer class is usually used to calculate future deadlines and
+ verify whether the deadline has expired. QDeadlineTimer can also be used
+ for deadlines without expiration ("forever"). It forms a counterpart to
+ QElapsedTimer, which calculates how much time has elapsed since
+ QElapsedTimer::start() was called.
+
+ QDeadlineTimer provides a more convenient API compared to
+ QElapsedTimer::hasExpired().
+
+ The typical use-case for the class is to create a QDeadlineTimer before the
+ operation in question is started, and then use remainingTime() or
+ hasExpired() to determine whether to continue trying the operation.
+ QDeadlineTimer objects can be passed to functions being called to execute
+ this operation so they know how long to still operate.
+
+ \code
+ void executeOperation(int msecs)
+ {
+ QDeadlineTimer deadline(msecs);
+ do {
+ if (readFromDevice(deadline.remainingTime())
+ break;
+ waitForReadyRead(deadline);
+ } while (!deadline.hasExpired());
+ }
+ \endcode
+
+ Many QDeadlineTimer functions deal with time out values, which all are
+ measured in milliseconds. There are two special values, the same as many
+ other Qt functions named \c{waitFor} or similar:
+
+ \list
+ \li 0: no time left, expired
+ \li -1: infinite time left, timer never expires
+ \endlist
+
+ \section1 Reference Clocks
+
+ QDeadlineTimer will use the same clock as QElapsedTimer (see
+ QElapsedTimer::clockType() and QElapsedTimer::isMonotonic()).
+
+ \section1 Timer types
+
+ Like QTimer, QDeadlineTimer can select among different levels of coarseness
+ on the timers. You can select precise timing by passing Qt::PreciseTimer to
+ the functions that set of change the timer, or you can select coarse timing
+ by passing Qt::CoarseTimer. Qt::VeryCoarseTimer is currently interpreted
+ the same way as Qt::CoarseTimer.
+
+ This feature is dependent on support from the operating system: if the OS
+ does not support a coarse timer functionality, then QDeadlineTimer will
+ behave like Qt::PreciseTimer was passed.
+
+ QDeadlineTimer defaults to Qt::CoarseTimer because on operating systems
+ that do support coarse timing, making timing calls to that clock source is
+ often much more efficient. The level of coarseness depends on the
+ operating system, but should be in the order of a couple of milliseconds.
+
+ \section1 \c{std::chrono} Compatibility
+
+ QDeadlineTimer is compatible with the \c{std::chrono} API from C++11 and
+ can be constructed from or compared to both \c{std::chrono::duration} and
+ \c{std::chrono::time_point} objects. In addition, it is fully compatible
+ with the time literals from C++14, which allow one to write code as:
+
+ \code
+ using namespace std::chrono;
+
+ QDeadlineTimer deadline(30s);
+ device->waitForReadyRead(deadline);
+ if (deadline.remainingTime<nanoseconds>() > 300ms)
+ cleanup();
+ \endcode
+
+ As can be seen in the example above, QDeadlineTimer offers a templated
+ version of remainingTime() and deadline() that can be used to return
+ \c{std::chrono} objects.
+
+ Note that comparing to \c{time_point} is not as efficient as comparing to
+ \c{duration}, since QDeadlineTimer may need to convert from its own
+ internal clock source to the clock source used by the \c{time_point} object.
+ Also note that, due to this conversion, the deadlines will not be precise,
+ so the following code is not expected to compare equally:
+
+ \code
+ using namespace std::chrono;
+ auto now = steady_clock::now();
+ QDeadlineTimer deadline(now + 1s);
+ Q_ASSERT(deadline == now + 1s);
+ \endcode
+
+ \sa QTime, QTimer, QDeadlineTimer, Qt::TimerType
+*/
+
+/*!
+ \enum QDeadlineTimer::ForeverConstant
+
+ \value Forever Used when creating a QDeadlineTimer to indicate the
+ deadline should not expire
+*/
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(Qt::TimerType timerType)
+
+ Constructs an expired QDeadlineTimer object. For this object,
+ remainingTime() will return 0.
+
+ The timer type \a timerType may be ignored, since the timer is already
+ expired. Similarly, for optimization purposes, this function will not
+ attempt to obtain the current time and will use a value known to be in the
+ past. Therefore, deadline() may return an unexpected value and this object
+ cannot be used in calculation of how long it is overdue. If that
+ functionality is required, use QDeadlineTimer::current().
+
+ \sa hasExpired(), remainingTime(), Qt::TimerType, current()
+*/
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(ForeverConstant, Qt::TimerType timerType)
+
+ QDeadlineTimer objects created with parameter \a ForeverConstant never expire.
+ For such objects, remainingTime() will return -1, deadline() will return the
+ maximum value, and isForever() will return true.
+
+ The timer type \a timerType may be ignored, since the timer is already
+ expired.
+
+ \sa ForeverConstant, hasExpired(), isForever(), remainingTime(), timerType()
+*/
+
+/*!
+ Constructs a QDeadlineTimer object with an expiry time of \a msecs msecs
+ from the moment of the creation of this object, if msecs is positive. If \a
+ msecs is zero, this QDeadlineTimer will be marked as expired, causing
+ remainingTime() to return zero and deadline() to return an indeterminate
+ time point in the past. If \a msecs is -1, the timer will be set it to
+ never expire, causing remainingTime() to return -1 and deadline() to return
+ the maximum value.
+
+ The QDeadlineTimer object will be constructed with the specified timer \a type.
+
+ For optimization purposes, if \a msecs is zero, this function may skip
+ obtaining the current time and may instead use a value known to be in the
+ past. If that happens, deadline() may return an unexpected value and this
+ object cannot be used in calculation of how long it is overdue. If that
+ functionality is required, use QDeadlineTimer::current() and add time to
+ it.
+
+ \sa hasExpired(), isForever(), remainingTime(), setRemainingTime()
+*/
+QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
+ : t2(0)
+{
+ setRemainingTime(msecs, type);
+}
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(std::chrono::time_point<Clock, Duration> deadline, Qt::TimerType type)
+
+ Constructs a QDeadlineTimer object with a deadline at \a deadline time
+ point, converting from the clock source \c{Clock} to Qt's internal clock
+ source (see QElapsedTimer::clcokType()).
+
+ If \a deadline is in the past, this QDeadlineTimer object is set to
+ expired, whereas if \a deadline is equal to \c{Duration::max()}, then this
+ object is set to never expire.
+
+ The QDeadlineTimer object will be constructed with the specified timer \a type.
+
+ \sa hasExpired(), isForever(), remainingTime(), setDeadline()
+*/
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type)
+
+ Constructs a QDeadlineTimer object with a remaining time of \a remaining.
+ If \a remaining is zero or negative, this QDeadlineTimer object will be
+ mark as expired, whereas if \a remaining is equal to \c{duration::max()},
+ the object will be set to never expire.
+
+ The QDeadlineTimer object will be constructed with the specified timer \a type.
+
+ This constructor can be used with C++14's user-defined literals for time, such as in:
+
+ \code
+ using namespace std::chrono;
+ QDeadlineTimer deadline(250ms);
+ \endcode
+
+ For optimization purposes, if \a remaining is zero or negative, this
+ function may skip obtaining the current time and may instead use a value
+ known to be in the past. If that happens, deadline() may return an
+ unexpected value and this object cannot be used in calculation of how long
+ it is overdue. If that functionality is required, use
+ QDeadlineTimer::current() and add time to it.
+
+ \sa hasExpired(), isForever(), remainingTime(), setRemainingTime()
+*/
+
+/*!
+ \fn void QDeadlineTimer::setDeadline(std::chrono::time_point<Clock, Duration> deadline, Qt::TimerType type)
+
+ Sets this QDeadlineTimer to the deadline marked by \a deadline time
+ point, converting from the clock source \c{Clock} to Qt's internal clock
+ source (see QElapsedTimer::clcokType()).
+
+ If \a deadline is in the past, this QDeadlineTimer object is set to
+ expired, whereas if \a deadline is equal to \c{Duration::max()}, then this
+ object is set to never expire.
+
+ The timer type for this QDeadlineTimer object will be set to the specified \a type.
+
+ \sa hasExpired(), isForever(), remainingTime(),
+*/
+
+/*!
+ Sets the remaining time for this QDeadlineTimer object to \a msecs
+ milliseconds from now, if \a msecs has a positive value. If \a msecs is
+ zero, this QDeadlineTimer object will be marked as expired, whereas a value
+ of -1 will set it to never expire.
+
+ The timer type for this QDeadlineTimer object will be set to the specified \a timerType.
+
+ \sa setPreciseRemainingTime(), hasExpired(), isForever(), remainingTime()
+*/
+void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ if (msecs == -1)
+ *this = QDeadlineTimer(Forever, timerType);
+ else
+ setPreciseRemainingTime(0, msecs * 1000 * 1000, timerType);
+}
+
+/*!
+ Sets the remaining time for this QDeadlineTimer object to \a secs seconds
+ plus \a nsecs nanoseconds from now, if \a secs has a positive value. If \a
+ secs is -1, this QDeadlineTimer will be set it to never expire. If both
+ parameters are zero, this QDeadlineTimer will be marked as expired.
+
+ The timer type for this QDeadlineTimer object will be set to the specified
+ \a type.
+
+ \sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
+*/
+void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ if (secs == -1) {
+ *this = QDeadlineTimer(Forever, timerType);
+ return;
+ }
+
+ *this = current(timerType);
+ if (QDeadlineTimerNanosecondsInT2) {
+ t1 += secs + toSecsAndNSecs(nsecs).first;
+ t2 += toSecsAndNSecs(nsecs).second;
+ if (t2 > 1000*1000*1000) {
+ t2 -= 1000*1000*1000;
+ ++t1;
+ }
+ } else {
+ t1 += secs * 1000 * 1000 * 1000 + nsecs;
+ }
+}
+
+/*!
+ \overload
+ \fn void QDeadlineTimer::setRemainingTime(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type)
+
+ Sets the remaining time for this QDeadlineTimer object to \a remaining. If
+ \a remaining is zero or negative, this QDeadlineTimer object will be mark
+ as expired, whereas if \a remaining is equal to \c{duration::max()}, the
+ object will be set to never expire.
+
+ The timer type for this QDeadlineTimer object will be set to the specified \a type.
+
+ This function can be used with C++14's user-defined literals for time, such as in:
+
+ \code
+ using namespace std::chrono;
+ deadline.setRemainingTime(250ms);
+ \endcode
+
+ \sa setDeadline(), remainingTime(), hasExpired(), isForever()
+*/
+
+/*!
+ \fn void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, unsigned nsecs, Qt::TimerType type)
+
+ Sets the remaining time for this QDeadlineTimer object to \a secs seconds
+ and \a nsecs nanoseconds from now, if \a secs is a positive value. If both
+ values are zero, this QDeadlineTimer object will be marked as expired,
+ whereas if \a secs is -1, it will set it to never expire.
+
+ If value of \a nsecs is more than 1 billion nanoseconds (1 second), this
+ function will adjust \a secs accordingly.
+
+ The timer type for this QDeadlineTimer object will be set to the specified \a type.
+
+ \sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
+*/
+
+/*!
+ \overload
+ \fn Duration QDeadlineTimer::remainingTime() const
+
+ Returns a \c{std::chrono::duration} object of type \c{Duration} containing
+ the remaining time in this QDeadlineTimer, if it still has time left. If
+ the deadline has passed, this returns \c{Duration::zero()}, whereas if the
+ object is set to never expire, it returns \c{Duration::max()} (instead of
+ -1).
+
+ It is not possible to obtain the overdue time for expired timers with this
+ function. To do that, see deadline().
+
+ \note The overload of this function without template parameter always
+ returns milliseconds.
+
+ \sa setRemainingTime(), deadline<Clock, Duration>()
+*/
+
+/*!
+ \overload
+ \fn std::chrono::time_point<Clock, Duration> QDeadlineTimer::deadline() const
+
+ Returns the absolute time point for the deadline stored in QDeadlineTimer
+ object as a \c{std::chrono::time_point} object. The template parameter
+ \c{Clock} is mandatory and indicates which of the C++ timekeeping clocks to
+ use as a reference. The value will be in the past if this QDeadlineTimer
+ has expired.
+
+ If this QDeadlineTimer never expires, this function returns
+ \c{std::chrono::time_point<Clock, Duration>::max()}.
+
+ This function can be used to calculate the amount of time a timer is
+ overdue, by subtracting the current time point of the reference clock, as
+ in the following example:
+
+ \code
+ auto realTimeLeft = std::chrono::nanoseconds::max();
+ auto tp = deadline.deadline<std::chrono::steady_clock>();
+ if (tp != std::chrono::steady_clock::max())
+ realTimeLeft = tp - std::chrono::steady_clock::now();
+ \endcode
+
+ \note Timers that were created as expired have an indetermine time point in
+ the past as their deadline, so the above calculation may not work.
+
+ \sa remainingTime(), deadlineNSecs(), setDeadline()
+*/
+
+/*!
+ \fn bool QDeadlineTimer::isForever() const
+
+ Returns true if this QDeadlineTimer object never expires, false otherwise.
+ For timers that never expire, remainingTime() always returns -1 and
+ deadline() returns the maximum value.
+
+ \sa ForeverConstant, hasExpired(), remainingTime()
+*/
+
+/*!
+ Returns true if this QDeadlineTimer object has expired, false if there
+ remains time left. For objects that have expired, remainingTime() will
+ return zero and deadline() will return a time point in the past.
+
+ QDeadlineTimer objects created with the \l {ForeverConstant} never expire
+ and this function always returns false for them.
+
+ \sa isForever(), remainingTime()
+*/
+bool QDeadlineTimer::hasExpired() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return false;
+ return *this <= current(timerType());
+}
+
+/*!
+ \fn Qt::TimerType QDeadlineTimer::timerType() const
+
+ Returns the timer type is active for this object.
+
+ \sa setTimerType()
+*/
+
+/*!
+ Changes the timer type for this object to \a timerType.
+
+ The behavior for each possible value of \a timerType is operating-system
+ dependent. Qt::PreciseTimer will use the most precise timer that Qt can
+ find, with resolution of 1 millisecond or better, whereas QDeadlineTimer
+ will try to use a more coarse timer for Qt::CoarseTimer and
+ Qt::VeryCoarseTimer.
+
+ \sa Qt::TimerType
+ */
+void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
+{
+ type = timerType;
+}
+
+/*!
+ Returns the remaining time in this QDeadlineTimer object in milliseconds.
+ If the timer has already expired, this function will return zero and it is
+ not possible to obtain the amount of time overdue with this function (to do
+ that, see deadline()). If the timer was set to never expire, this function
+ returns -1.
+
+ This function is suitable for use in Qt APIs that take a millisecond
+ timeout, such as the many \l QIODevice \c waitFor functions or the timed
+ lock functions in \l QMutex, \l QWaitCondition, \l QSemaphore, or
+ \l QReadWriteLock. For example:
+
+ \code
+ mutex.tryLock(deadline.remainingTime());
+ \endcode
+
+ \sa remainingTimeNSecs(), isForever(), hasExpired()
+*/
+qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
+{
+ qint64 ns = remainingTimeNSecs();
+ return ns <= 0 ? ns : ns / (1000 * 1000);
+}
+
+/*!
+ Returns the remaining time in this QDeadlineTimer object in nanoseconds. If
+ the timer has already expired, this function will return zero and it is not
+ possible to obtain the amount of time overdue with this function. If the
+ timer was set to never expire, this function returns -1.
+
+ \sa remainingTime(), isForever(), hasExpired()
+*/
+qint64 QDeadlineTimer::remainingTimeNSecs() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return -1;
+ qint64 raw = rawRemainingTimeNSecs();
+ return raw < 0 ? 0 : raw;
+}
+
+/*!
+ \internal
+ Same as remainingTimeNSecs, but may return negative remaining times. Does
+ not deal with Forever.
+*/
+qint64 QDeadlineTimer::rawRemainingTimeNSecs() const Q_DECL_NOTHROW
+{
+ QDeadlineTimer now = current(timerType());
+ if (QDeadlineTimerNanosecondsInT2)
+ return (t1 - now.t1) * (1000*1000*1000) + t2 - now.t2;
+ return t1 - now.t1;
+}
+
+/*!
+ Returns the absolute time point for the deadline stored in QDeadlineTimer
+ object, calculated in milliseconds relative to the reference clock, the
+ same as QElapsedTimer::msecsSinceReference(). The value will be in the past
+ if this QDeadlineTimer has expired.
+
+ If this QDeadlineTimer never expires, this function returns
+ \c{std::numeric_limits<qint64>::max()}.
+
+ This function can be used to calculate the amount of time a timer is
+ overdue, by subtracting QDeadlineTimer::current() or
+ QElapsedTimer::msecsSinceReference(), as in the following example:
+
+ \code
+ qint64 realTimeLeft = deadline.deadline();
+ if (realTimeLeft != (std::numeric_limits<qint64>::max)()) {
+ realTimeLeft -= QDeadlineTimer::current().deadline();
+ // or:
+ //QElapsedTimer timer;
+ //timer.start();
+ //realTimeLeft -= timer.msecsSinceReference();
+ }
+ \endcode
+
+ \note Timers that were created as expired have an indetermine time point in
+ the past as their deadline, so the above calculation may not work.
+
+ \sa remainingTime(), deadlineNSecs(), setDeadline()
+*/
+qint64 QDeadlineTimer::deadline() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return t1;
+ return deadlineNSecs() / (1000 * 1000);
+}
+
+/*!
+ Returns the absolute time point for the deadline stored in QDeadlineTimer
+ object, calculated in nanoseconds relative to the reference clock, the
+ same as QElapsedTimer::msecsSinceReference(). The value will be in the past
+ if this QDeadlineTimer has expired.
+
+ If this QDeadlineTimer never expires, this function returns
+ \c{std::numeric_limits<qint64>::max()}.
+
+ This function can be used to calculate the amount of time a timer is
+ overdue, by subtracting QDeadlineTimer::current(), as in the following
+ example:
+
+ \code
+ qint64 realTimeLeft = deadline.deadlineNSecs();
+ if (realTimeLeft != std::numeric_limits<qint64>::max())
+ realTimeLeft -= QDeadlineTimer::current().deadlineNSecs();
+ \endcode
+
+ \note Timers that were created as expired have an indetermine time point in
+ the past as their deadline, so the above calculation may not work.
+
+ \sa remainingTime(), deadlineNSecs()
+*/
+qint64 QDeadlineTimer::deadlineNSecs() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return t1;
+ if (QDeadlineTimerNanosecondsInT2)
+ return t1 * 1000 * 1000 * 1000 + t2;
+ return t1;
+}
+
+/*!
+ Sets the deadline for this QDeadlineTimer object to be the \a msecs
+ absolute time point, counted in milliseconds since the reference clock (the
+ same as QElapsedTimer::msecsSinceReference()), and the timer type to \a
+ timerType. If the value is in the past, this QDeadlineTimer will be marked
+ as expired.
+
+ If \a msecs is \c{std::numeric_limits<qint64>::max()}, this QDeadlineTimer
+ will be set to never expire.
+
+ \sa setPreciseDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
+*/
+void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ if (msecs == (std::numeric_limits<qint64>::max)()) {
+ setPreciseDeadline(msecs, 0, timerType); // msecs == MAX implies Forever
+ } else {
+ setPreciseDeadline(msecs / 1000, msecs % 1000 * 1000 * 1000, timerType);
+ }
+}
+
+/*!
+ Sets the deadline for this QDeadlineTimer object to be \a secs seconds and
+ \a nsecs nanoseconds since the reference clock epoch (the same as
+ QElapsedTimer::msecsSinceReference()), and the timer type to \a timerType.
+ If the value is in the past, this QDeadlineTimer will be marked as expired.
+
+ If \a secs or \a nsecs is \c{std::numeric_limits<qint64>::max()}, this
+ QDeadlineTimer will be set to never expire. If \a nsecs is more than 1
+ billion nanoseconds (1 second), then \a secs will be adjusted accordingly.
+
+ \sa setDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
+*/
+void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ type = timerType;
+ if (secs == (std::numeric_limits<qint64>::max)() || nsecs == (std::numeric_limits<qint64>::max)()) {
+ *this = QDeadlineTimer(Forever, timerType);
+ } else if (QDeadlineTimerNanosecondsInT2) {
+ t1 = secs + toSecsAndNSecs(nsecs).first;
+ t2 = toSecsAndNSecs(nsecs).second;
+ } else {
+ t1 = secs * (1000*1000*1000) + nsecs;
+ }
+}
+
+/*!
+ Returns a QDeadlineTimer object whose deadline is extended from \a dt's
+ deadline by \a nsecs nanoseconds. If \a dt was set to never expire, this
+ function returns a QDeadlineTimer that will not expire either.
+
+ \note if \a dt was created as expired, its deadline is indeterminate and
+ adding an amount of time may or may not cause it to become unexpired.
+*/
+QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW
+{
+ if (dt.isForever() || nsecs == (std::numeric_limits<qint64>::max)()) {
+ dt = QDeadlineTimer(Forever, dt.timerType());
+ } else if (QDeadlineTimerNanosecondsInT2) {
+ dt.t1 += toSecsAndNSecs(nsecs).first;
+ dt.t2 += toSecsAndNSecs(nsecs).second;
+ if (dt.t2 > 1000*1000*1000) {
+ dt.t2 -= 1000*1000*1000;
+ ++dt.t1;
+ }
+ } else {
+ dt.t1 += nsecs;
+ }
+ return dt;
+}
+
+/*!
+ \fn QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType)
+
+ Returns a QDeadlineTimer that is expired but is guaranteed to contain the
+ current time. Objects created by this function can participate in the
+ calculation of how long a timer is overdue, using the deadline() function.
+
+ The QDeadlineTimer object will be constructed with the specified \a timerType.
+*/
+
+/*!
+ \fn bool operator==(QDeadlineTimer d1, QDeadlineTimer d2)
+ \relates QDeadlineTimer
+
+ Returns true if the deadline on \a d1 and the deadline in \a d2 are the
+ same, false otherwise. The timer type used to create the two deadlines is
+ ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() == d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2)
+ \relates QDeadlineTimer
+
+ Returns true if the deadline on \a d1 and the deadline in \a d2 are
+ diferent, false otherwise. The timer type used to create the two deadlines
+ is ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() != d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator<(QDeadlineTimer d1, QDeadlineTimer d2)
+ \relates QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is earlier than the deadline in \a
+ d2, false otherwise. The timer type used to create the two deadlines is
+ ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() < d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2)
+ \relates QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is earlier than or the same as the
+ deadline in \a d2, false otherwise. The timer type used to create the two
+ deadlines is ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() <= d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator>(QDeadlineTimer d1, QDeadlineTimer d2)
+ \relates QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is later than the deadline in \a
+ d2, false otherwise. The timer type used to create the two deadlines is
+ ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() > d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2)
+ \relates QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is later than or the same as the
+ deadline in \a d2, false otherwise. The timer type used to create the two
+ deadlines is ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() >= d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
+ \relates QDeadlineTimer
+
+ Returns a QDeadlineTimer object whose deadline is \a msecs later than the
+ deadline stored in \a dt. If \a dt is set to never expire, this function
+ returns a QDeadlineTimer that does not expire either.
+
+ To add times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt)
+ \relates QDeadlineTimer
+
+ Returns a QDeadlineTimer object whose deadline is \a msecs later than the
+ deadline stored in \a dt. If \a dt is set to never expire, this function
+ returns a QDeadlineTimer that does not expire either.
+
+ To add times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs)
+ \relates QDeadlineTimer
+
+ Returns a QDeadlineTimer object whose deadline is \a msecs before the
+ deadline stored in \a dt. If \a dt is set to never expire, this function
+ returns a QDeadlineTimer that does not expire either.
+
+ To subtract times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer &QDeadlineTimer::operator+=(qint64 msecs)
+
+ Extends this QDeadlineTimer object by \a msecs milliseconds and returns
+ itself. If this object is set to never expire, this function does nothing.
+
+ To add times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer &QDeadlineTimer::operator-=(qint64 msecs)
+
+ Shortens this QDeadlineTimer object by \a msecs milliseconds and returns
+ itself. If this object is set to never expire, this function does nothing.
+
+ To subtract times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+// the rest of the functions are in qelapsedtimer_xxx.cpp
+
+QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h
new file mode 100644
index 0000000000..3b97b89359
--- /dev/null
+++ b/src/corelib/kernel/qdeadlinetimer.h
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDEADLINETIMER_H
+#define QDEADLINETIMER_H
+
+#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qnamespace.h>
+
+#ifdef max
+// un-pollute the namespace. We need std::numeric_limits::max() and std::chrono::duration::max()
+# undef max
+#endif
+
+#include <limits>
+
+#if QT_HAS_INCLUDE(<chrono>)
+# include <chrono>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class Q_CORE_EXPORT QDeadlineTimer
+{
+public:
+ enum ForeverConstant { Forever };
+
+ Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
+ : t1(0), t2(0), type(type_) {}
+ Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
+ : t1(std::numeric_limits<qint64>::max()), t2(0), type(type_) {}
+ explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ void swap(QDeadlineTimer &other)
+ { qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); }
+
+ Q_DECL_CONSTEXPR bool isForever() const Q_DECL_NOTHROW
+ { return t1 == (std::numeric_limits<qint64>::max)(); }
+ bool hasExpired() const Q_DECL_NOTHROW;
+
+ Qt::TimerType timerType() const Q_DECL_NOTHROW
+ { return Qt::TimerType(type & 0xff); }
+ void setTimerType(Qt::TimerType type);
+
+ qint64 remainingTime() const Q_DECL_NOTHROW;
+ qint64 remainingTimeNSecs() const Q_DECL_NOTHROW;
+ void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+ void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0,
+ Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ qint64 deadline() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
+ qint64 deadlineNSecs() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
+ void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
+ void setPreciseDeadline(qint64 secs, qint64 nsecs = 0,
+ Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
+ static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d1.t1 == d2.t1 && d1.t2 == d2.t2; }
+ friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return !(d1 == d2); }
+ friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d1.t1 < d2.t1 || (d1.t1 == d2.t1 && d1.t2 < d2.t2); }
+ friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d1 == d2 || d1 < d2; }
+ friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d2 < d1; }
+ friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return !(d1 < d2); }
+
+ friend QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
+ { return QDeadlineTimer::addNSecs(dt, msecs * 1000 * 1000); }
+ friend QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt)
+ { return dt + msecs; }
+ friend QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs)
+ { return dt + (-msecs); }
+ friend qint64 operator-(QDeadlineTimer dt1, QDeadlineTimer dt2)
+ { return (dt1.deadlineNSecs() - dt2.deadlineNSecs()) / (1000 * 1000); }
+ QDeadlineTimer &operator+=(qint64 msecs)
+ { *this = *this + msecs; return *this; }
+ QDeadlineTimer &operator-=(qint64 msecs)
+ { *this = *this + (-msecs); return *this; }
+
+#if QT_HAS_INCLUDE(<chrono>) || defined(Q_QDOC)
+ template <class Clock, class Duration>
+ QDeadlineTimer(std::chrono::time_point<Clock, Duration> deadline_,
+ Qt::TimerType type_ = Qt::CoarseTimer) : t2(0)
+ { setDeadline(deadline_, type_); }
+ template <class Clock, class Duration>
+ QDeadlineTimer &operator=(std::chrono::time_point<Clock, Duration> deadline_)
+ { setDeadline(deadline_); return *this; }
+
+ template <class Clock, class Duration>
+ void setDeadline(std::chrono::time_point<Clock, Duration> deadline_,
+ Qt::TimerType type_ = Qt::CoarseTimer)
+ { setRemainingTime(deadline_ == deadline_.max() ? Duration::max() : deadline_ - Clock::now(), type_); }
+
+ template <class Clock, class Duration = typename Clock::duration>
+ std::chrono::time_point<Clock, Duration> deadline() const
+ {
+ auto val = std::chrono::nanoseconds(rawRemainingTimeNSecs()) + Clock::now();
+ return std::chrono::time_point_cast<Duration>(val);
+ }
+
+ template <class Rep, class Period>
+ QDeadlineTimer(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type_ = Qt::CoarseTimer)
+ : t2(0)
+ { setRemainingTime(remaining, type_); }
+
+ template <class Rep, class Period>
+ QDeadlineTimer &operator=(std::chrono::duration<Rep, Period> remaining)
+ { setRemainingTime(remaining); return *this; }
+
+ template <class Rep, class Period>
+ void setRemainingTime(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type_ = Qt::CoarseTimer)
+ {
+ if (remaining == remaining.max())
+ *this = QDeadlineTimer(Forever, type_);
+ else
+ setPreciseRemainingTime(0, std::chrono::nanoseconds(remaining).count(), type_);
+ }
+
+ std::chrono::nanoseconds remainingTimeAsDuration() const Q_DECL_NOTHROW
+ {
+ if (isForever())
+ return std::chrono::nanoseconds::max();
+ qint64 nsecs = rawRemainingTimeNSecs();
+ if (nsecs <= 0)
+ return std::chrono::nanoseconds::zero();
+ return std::chrono::nanoseconds(nsecs);
+ }
+
+ template <class Rep, class Period>
+ friend QDeadlineTimer operator+(QDeadlineTimer dt, std::chrono::duration<Rep, Period> value)
+ { return QDeadlineTimer::addNSecs(dt, std::chrono::duration_cast<std::chrono::nanoseconds>(value).count()); }
+ template <class Rep, class Period>
+ friend QDeadlineTimer operator+(std::chrono::duration<Rep, Period> value, QDeadlineTimer dt)
+ { return dt + value; }
+ template <class Rep, class Period>
+ friend QDeadlineTimer operator+=(QDeadlineTimer &dt, std::chrono::duration<Rep, Period> value)
+ { return dt = dt + value; }
+#endif
+
+private:
+ qint64 t1;
+ unsigned t2;
+ unsigned type;
+
+ qint64 rawRemainingTimeNSecs() const Q_DECL_NOTHROW;
+};
+
+Q_DECLARE_SHARED(QDeadlineTimer)
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QDeadlineTimer)
+
+#endif // QDEADLINETIMER_H
diff --git a/src/corelib/io/qurl_mac.mm b/src/corelib/kernel/qdeadlinetimer_p.h
index 04d05f1b23..46e12de6c1 100644
--- a/src/corelib/io/qurl_mac.mm
+++ b/src/corelib/kernel/qdeadlinetimer_p.h
@@ -37,38 +37,34 @@
**
****************************************************************************/
-#include "qurl.h"
+#ifndef QDEADLINETIMER_P_H
+#define QDEADLINETIMER_P_H
-#ifdef Q_OS_MAC
-#include <Foundation/Foundation.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QUrl QUrl::fromCFURL(CFURLRef url)
-{
- return QUrl(QString::fromCFString(CFURLGetString(url)));
-}
+//
+// 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.
+//
-CFURLRef QUrl::toCFURL() const
-{
- CFURLRef url = 0;
- CFStringRef str = toString(FullyEncoded).toCFString();
- if (str) {
- url = CFURLCreateWithString(0, str, 0);
- CFRelease(str);
- }
- return url;
-}
+#include <QtCore/qglobal.h>
-QUrl QUrl::fromNSURL(const NSURL *url)
-{
- return QUrl(QString::fromNSString([url absoluteString]));
-}
+QT_BEGIN_NAMESPACE
-NSURL *QUrl::toNSURL() const
-{
- return [NSURL URLWithString:toString(FullyEncoded).toNSString()];
-}
+enum {
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
+ // t1 contains seconds and t2 contains nanoseconds
+ QDeadlineTimerNanosecondsInT2 = 1
+#else
+ // t1 contains nanoseconds, t2 is always zero
+ QDeadlineTimerNanosecondsInT2 = 0
+#endif
+};
QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp
index addecc0236..5e9d1317ac 100644
--- a/src/corelib/tools/qelapsedtimer.cpp
+++ b/src/corelib/kernel/qelapsedtimer.cpp
@@ -83,6 +83,9 @@ QT_BEGIN_NAMESPACE
\snippet qelapsedtimer/main.cpp 2
+ It is often more convenient to use \ref{QDeadlineTimer} in this case, which
+ counts towards a timeout in the future instead of tracking elapsed time.
+
\section1 Reference Clocks
QElapsedTimer will use the platform's monotonic reference clock in all
@@ -120,7 +123,7 @@ QT_BEGIN_NAMESPACE
The information on which clocks types may overflow and how to remedy that
issue is documented along with the clock types.
- \sa QTime, QTimer
+ \sa QTime, QTimer, QDeadlineTimer
*/
/*!
@@ -255,7 +258,7 @@ bool QElapsedTimer::isValid() const Q_DECL_NOTHROW
The value of \a timeout can be -1 to indicate that this timer does not
expire, in which case this function will always return false.
- \sa elapsed()
+ \sa elapsed(), QDeadlineTimer
*/
bool QElapsedTimer::hasExpired(qint64 timeout) const Q_DECL_NOTHROW
{
diff --git a/src/corelib/tools/qelapsedtimer.h b/src/corelib/kernel/qelapsedtimer.h
index 7954b41bf4..7954b41bf4 100644
--- a/src/corelib/tools/qelapsedtimer.h
+++ b/src/corelib/kernel/qelapsedtimer.h
diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/kernel/qelapsedtimer_generic.cpp
index 29ba1517ed..fdeb385188 100644
--- a/src/corelib/tools/qelapsedtimer_generic.cpp
+++ b/src/corelib/kernel/qelapsedtimer_generic.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
#include "qdatetime.h"
QT_BEGIN_NAMESPACE
@@ -201,4 +202,12 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return v1.t1 < v2.t1;
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ QDeadlineTimer result;
+ result.t1 = QDateTime::currentMSecsSinceEpoch() * 1000 * 1000;
+ result.type = timerType;
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qelapsedtimer_mac.cpp b/src/corelib/kernel/qelapsedtimer_mac.cpp
index 886e0f41b2..7490693991 100644
--- a/src/corelib/tools/qelapsedtimer_mac.cpp
+++ b/src/corelib/kernel/qelapsedtimer_mac.cpp
@@ -41,6 +41,8 @@
#define _POSIX_C_SOURCE 200809L
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.h"
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
@@ -50,6 +52,12 @@
QT_BEGIN_NAMESPACE
+#ifdef __LP64__
+typedef __int128_t LargeInt;
+#else
+typedef qint64 LargeInt;
+#endif
+
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
{
return MachAbsoluteTime;
@@ -65,13 +73,13 @@ static qint64 absoluteToNSecs(qint64 cpuTime)
{
if (info.denom == 0)
mach_timebase_info(&info);
-#ifdef __LP64__
- __uint128_t nsecs = static_cast<__uint128_t>(cpuTime) * info.numer / info.denom;
- return static_cast<qint64>(nsecs);
-#else
- qint64 nsecs = cpuTime * info.numer / info.denom;
+
+ // don't do multiplication & division if those are equal
+ // (mathematically it would be the same, but it's computationally expensive)
+ if (info.numer == info.denom)
+ return cpuTime;
+ qint64 nsecs = LargeInt(cpuTime) * info.numer / info.denom;
return nsecs;
-#endif
}
static qint64 absoluteToMSecs(qint64 cpuTime)
@@ -146,4 +154,13 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return v1.t1 < v2.t1;
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
+ QDeadlineTimer result;
+ result.type = timerType;
+ result.t1 = absoluteToNSecs(mach_absolute_time());
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/kernel/qelapsedtimer_unix.cpp
index e2c3ae6280..e166d4e3d2 100644
--- a/src/corelib/tools/qelapsedtimer_unix.cpp
+++ b/src/corelib/kernel/qelapsedtimer_unix.cpp
@@ -39,6 +39,8 @@
****************************************************************************/
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.h"
#if defined(Q_OS_VXWORKS)
#include "qfunctions_vxworks.h"
#else
@@ -248,4 +250,16 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2);
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ Q_STATIC_ASSERT(QDeadlineTimerNanosecondsInT2);
+ QDeadlineTimer result;
+ qint64 cursec, curnsec;
+ do_gettime(&cursec, &curnsec);
+ result.t1 = cursec;
+ result.t2 = curnsec;
+ result.type = timerType;
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/kernel/qelapsedtimer_win.cpp
index 734aaf80f2..0c380b2f6a 100644
--- a/src/corelib/tools/qelapsedtimer_win.cpp
+++ b/src/corelib/kernel/qelapsedtimer_win.cpp
@@ -38,37 +38,25 @@
****************************************************************************/
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.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;
@@ -90,37 +78,33 @@ static inline qint64 ticksToNanoseconds(qint64 ticks)
}
}
+static inline qint64 nanosecondsToTicks(qint64 nsec)
+{
+ if (counterFrequency > 0) {
+ // QueryPerformanceCounter uses an arbitrary frequency
+ return double(nsec) * counterFrequency / 1000000000.;
+ } else {
+ // GetTickCount(64) uses milliseconds
+ return nsec / 1000000;
+ }
+}
+
static quint64 getTickCount()
{
- 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 +114,7 @@ quint64 qt_msectime()
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
{
- resolveLibs();
+ resolveCounterFrequency();
if (counterFrequency > 0)
return PerformanceCounter;
@@ -190,4 +174,13 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return (v1.t1 - v2.t1) < 0;
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
+ QDeadlineTimer result;
+ result.t1 = ticksToNanoseconds(getTickCount());
+ result.type = timerType;
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm
index 55f27a5b60..eecc72fd94 100644
--- a/src/corelib/kernel/qeventdispatcher_cf.mm
+++ b/src/corelib/kernel/qeventdispatcher_cf.mm
@@ -51,6 +51,8 @@
#ifdef Q_OS_OSX
# include <AppKit/NSApplication.h>
+#elif defined(Q_OS_WATCHOS)
+# include <WatchKit/WatchKit.h>
#else
# include <UIKit/UIApplication.h>
#endif
@@ -75,6 +77,8 @@ QT_USE_NAMESPACE
name:nil
#ifdef Q_OS_OSX
object:[NSApplication sharedApplication]];
+#elif defined(Q_OS_WATCHOS)
+ object:[WKExtension sharedExtension]];
#else
object:[UIApplication sharedApplication]];
#endif
@@ -210,6 +214,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 +313,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..1a0efae2dc 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -55,7 +55,6 @@
QT_BEGIN_NAMESPACE
-HINSTANCE qWinAppInst();
extern uint qGlobalPostedEventsCount();
#ifndef TIME_KILL_SYNCHRONOUS
@@ -63,11 +62,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 +84,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 +100,6 @@ QEventDispatcherWin32Private::QEventDispatcherWin32Private()
, activateNotifiersPosted(false)
#endif
{
- resolveTimerAPI();
}
QEventDispatcherWin32Private::~QEventDispatcherWin32Private()
@@ -502,11 +280,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
@@ -535,7 +309,7 @@ QWindowsMessageWindowClassContext::QWindowsMessageWindowClassContext()
wc.lpfnWndProc = qt_internal_proc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
- wc.hInstance = qWinAppInst();
+ wc.hInstance = GetModuleHandle(0);
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = 0;
@@ -552,7 +326,7 @@ QWindowsMessageWindowClassContext::QWindowsMessageWindowClassContext()
QWindowsMessageWindowClassContext::~QWindowsMessageWindowClassContext()
{
if (className) {
- UnregisterClass(className, qWinAppInst());
+ UnregisterClass(className, GetModuleHandle(0));
delete [] className;
}
}
@@ -564,18 +338,13 @@ 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
+ GetModuleHandle(0), // application
0); // windows creation data.
if (!wnd) {
@@ -609,24 +378,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 +407,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 +474,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 +481,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 +934,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/qeventdispatcher_winrt.cpp b/src/corelib/kernel/qeventdispatcher_winrt.cpp
index 2ffcf03eb2..3b2321aa49 100644
--- a/src/corelib/kernel/qeventdispatcher_winrt.cpp
+++ b/src/corelib/kernel/qeventdispatcher_winrt.cpp
@@ -95,6 +95,51 @@ private:
std::function<HRESULT()> delegate;
};
+class QWorkHandler : public IWorkItemHandler
+{
+public:
+ QWorkHandler(const std::function<HRESULT()> &delegate)
+ : m_delegate(delegate)
+ {
+ }
+
+ STDMETHODIMP Invoke(ABI::Windows::Foundation::IAsyncAction *operation)
+ {
+ HRESULT res = m_delegate();
+ Q_UNUSED(operation);
+ return res;
+ }
+
+ STDMETHODIMP QueryInterface(REFIID riid, void FAR* FAR* ppvObj)
+ {
+ if (riid == IID_IUnknown || riid == IID_IWorkItemHandler) {
+ *ppvObj = this;
+ AddRef();
+ return NOERROR;
+ }
+ *ppvObj = NULL;
+ return ResultFromScode(E_NOINTERFACE);
+ }
+
+ STDMETHODIMP_(ULONG) AddRef(void)
+ {
+ return ++m_refs;
+ }
+
+ STDMETHODIMP_(ULONG) Release(void)
+ {
+ if (--m_refs == 0) {
+ delete this;
+ return 0;
+ }
+ return m_refs;
+ }
+
+private:
+ std::function<HRESULT()> m_delegate;
+ ULONG m_refs{0};
+};
+
class QEventDispatcherWinRTPrivate : public QAbstractEventDispatcherPrivate
{
Q_DECLARE_PUBLIC(QEventDispatcherWinRT)
@@ -175,48 +220,62 @@ QEventDispatcherWinRT::~QEventDispatcherWinRT()
HRESULT QEventDispatcherWinRT::runOnXamlThread(const std::function<HRESULT ()> &delegate, bool waitForRun)
{
static __declspec(thread) ICoreDispatcher *dispatcher = nullptr;
+ HRESULT hr;
if (!dispatcher) {
- HRESULT hr;
ComPtr<ICoreImmersiveApplication> application;
hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
IID_PPV_ARGS(&application));
ComPtr<ICoreApplicationView> view;
hr = application->get_MainView(&view);
- Q_ASSERT_SUCCEEDED(hr);
- ComPtr<ICoreWindow> window;
- hr = view->get_CoreWindow(&window);
- Q_ASSERT_SUCCEEDED(hr);
- if (!window) {
- // In case the application is launched via activation
- // there might not be a main view (eg ShareTarget).
- // Hence iterate through the available views and try to find
- // a dispatcher in there
- ComPtr<IVectorView<CoreApplicationView*>> appViews;
- hr = application->get_Views(&appViews);
+ if (SUCCEEDED(hr) && view) {
+ ComPtr<ICoreWindow> window;
+ hr = view->get_CoreWindow(&window);
Q_ASSERT_SUCCEEDED(hr);
- quint32 count;
- hr = appViews->get_Size(&count);
- Q_ASSERT_SUCCEEDED(hr);
- for (quint32 i = 0; i < count; ++i) {
- hr = appViews->GetAt(i, &view);
+ if (!window) {
+ // In case the application is launched via activation
+ // there might not be a main view (eg ShareTarget).
+ // Hence iterate through the available views and try to find
+ // a dispatcher in there
+ ComPtr<IVectorView<CoreApplicationView*>> appViews;
+ hr = application->get_Views(&appViews);
Q_ASSERT_SUCCEEDED(hr);
- hr = view->get_CoreWindow(&window);
+ quint32 count;
+ hr = appViews->get_Size(&count);
Q_ASSERT_SUCCEEDED(hr);
- if (window) {
- hr = window->get_Dispatcher(&dispatcher);
+ for (quint32 i = 0; i < count; ++i) {
+ hr = appViews->GetAt(i, &view);
+ Q_ASSERT_SUCCEEDED(hr);
+ hr = view->get_CoreWindow(&window);
Q_ASSERT_SUCCEEDED(hr);
- if (dispatcher)
- break;
+ if (window) {
+ hr = window->get_Dispatcher(&dispatcher);
+ Q_ASSERT_SUCCEEDED(hr);
+ if (dispatcher)
+ break;
+ }
}
+ } else {
+ hr = window->get_Dispatcher(&dispatcher);
+ Q_ASSERT_SUCCEEDED(hr);
}
- Q_ASSERT(dispatcher);
- } else {
- hr = window->get_Dispatcher(&dispatcher);
- Q_ASSERT_SUCCEEDED(hr);
}
}
- HRESULT hr;
+ if (Q_UNLIKELY(!dispatcher)) {
+ // In case the application is launched in a way that has no UI and
+ // also does not allow to create one, e.g. as a background task.
+ // Features like network operations do still work, others might cause
+ // errors in that case.
+ ComPtr<IThreadPoolStatics> tpStatics;
+ hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_System_Threading_ThreadPool).Get(),
+ IID_PPV_ARGS(&tpStatics));
+ ComPtr<IAsyncAction> op;
+ hr = tpStatics.Get()->RunAsync(new QWorkHandler(delegate), &op);
+ if (FAILED(hr) || !waitForRun)
+ return hr;
+ return QWinRTFunctions::await(op);
+ }
+
boolean onXamlThread;
hr = dispatcher->get_HasThreadAccess(&onXamlThread);
Q_ASSERT_SUCCEEDED(hr);
diff --git a/src/corelib/kernel/qeventdispatcher_winrt_p.h b/src/corelib/kernel/qeventdispatcher_winrt_p.h
index abcb3bf99c..f69bb9cf3f 100644
--- a/src/corelib/kernel/qeventdispatcher_winrt_p.h
+++ b/src/corelib/kernel/qeventdispatcher_winrt_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qabstracteventdispatcher.h"
#include <qt_windows.h>
diff --git a/src/corelib/kernel/qeventloop_p.h b/src/corelib/kernel/qeventloop_p.h
index 3ce707a6a9..dcbb5c63c6 100644
--- a/src/corelib/kernel/qeventloop_p.h
+++ b/src/corelib/kernel/qeventloop_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include "qcoreapplication.h"
#include "qobject_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/kernel/qfunctions_fake_env_p.h b/src/corelib/kernel/qfunctions_fake_env_p.h
index 31d8bd2f26..16d18c4d88 100644
--- a/src/corelib/kernel/qfunctions_fake_env_p.h
+++ b/src/corelib/kernel/qfunctions_fake_env_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h
index 06f5ea09da..715c553dc5 100644
--- a/src/corelib/kernel/qfunctions_p.h
+++ b/src/corelib/kernel/qfunctions_p.h
@@ -51,11 +51,9 @@
#ifndef QFUNCTIONS_P_H
#define QFUNCTIONS_P_H
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.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/qjni_p.h b/src/corelib/kernel/qjni_p.h
index 79cbe1de72..52abd51dc1 100644
--- a/src/corelib/kernel/qjni_p.h
+++ b/src/corelib/kernel/qjni_p.h
@@ -52,7 +52,7 @@
#define QJNI_P_H
#include <jni.h>
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qsharedpointer.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index 76f530ab9c..6a46f7dd11 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -38,14 +38,17 @@
****************************************************************************/
#include "qjnihelpers_p.h"
+#include "qjni_p.h"
#include "qmutex.h"
#include "qlist.h"
#include "qsemaphore.h"
#include "qsharedpointer.h"
#include "qvector.h"
+#include "qthread.h"
#include <QtCore/qrunnable.h>
#include <deque>
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -60,6 +63,22 @@ static jmethodID g_hideSplashScreenMethodID = Q_NULLPTR;
Q_GLOBAL_STATIC(std::deque<QtAndroidPrivate::Runnable>, g_pendingRunnables);
Q_GLOBAL_STATIC(QMutex, g_pendingRunnablesMutex);
+class PermissionsResultClass : public QObject
+{
+ Q_OBJECT
+public:
+ PermissionsResultClass(const QtAndroidPrivate::PermissionsResultFunc &func) : m_func(func) {}
+ Q_INVOKABLE void sendResult(const QtAndroidPrivate::PermissionsHash &result) { m_func(result); }
+
+private:
+ QtAndroidPrivate::PermissionsResultFunc m_func;
+};
+
+typedef QHash<int, QSharedPointer<PermissionsResultClass>> PendingPermissionRequestsHash;
+Q_GLOBAL_STATIC(PendingPermissionRequestsHash, g_pendingPermissionRequests);
+Q_GLOBAL_STATIC(QMutex, g_pendingPermissionRequestsMutex);
+Q_GLOBAL_STATIC(QAtomicInt, g_requestPermissionsRequestCode);
+
// function called from Java from Android UI thread
static void runPendingCppRunnables(JNIEnv */*env*/, jobject /*obj*/)
{
@@ -81,9 +100,43 @@ namespace {
QMutex mutex;
QVector<QtAndroidPrivate::GenericMotionEventListener *> listeners;
};
+
+ enum {
+ PERMISSION_GRANTED = 0
+ };
}
Q_GLOBAL_STATIC(GenericMotionEventListeners, g_genericMotionEventListeners)
+static void sendRequestPermissionsResult(JNIEnv *env, jobject /*obj*/, jint requestCode,
+ jobjectArray permissions, jintArray grantResults)
+{
+ g_pendingPermissionRequestsMutex->lock();
+ auto it = g_pendingPermissionRequests->find(requestCode);
+ if (it == g_pendingPermissionRequests->end()) {
+ g_pendingPermissionRequestsMutex->unlock();
+ // show an error or something ?
+ return;
+ }
+ g_pendingPermissionRequestsMutex->unlock();
+
+ Qt::ConnectionType connection = QThread::currentThread() == it.value()->thread() ? Qt::DirectConnection : Qt::BlockingQueuedConnection;
+ QtAndroidPrivate::PermissionsHash hash;
+ const int size = env->GetArrayLength(permissions);
+ std::unique_ptr<jint[]> results(new jint[size]);
+ env->GetIntArrayRegion(grantResults, 0, size, results.get());
+ for (int i = 0 ; i < size; ++i) {
+ const auto &permission = QJNIObjectPrivate(env->GetObjectArrayElement(permissions, i)).toString();
+ auto value = results[i] == PERMISSION_GRANTED ?
+ QtAndroidPrivate::PermissionsResult::Granted :
+ QtAndroidPrivate::PermissionsResult::Denied;
+ hash[permission] = value;
+ }
+ QMetaObject::invokeMethod(it.value().data(), "sendResult", connection, Q_ARG(QtAndroidPrivate::PermissionsHash, hash));
+ g_pendingPermissionRequestsMutex->lock();
+ g_pendingPermissionRequests->erase(it);
+ g_pendingPermissionRequestsMutex->unlock();
+}
+
static jboolean dispatchGenericMotionEvent(JNIEnv *, jclass, jobject event)
{
jboolean ret = JNI_FALSE;
@@ -328,7 +381,8 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env)
{"dispatchGenericMotionEvent", "(Landroid/view/MotionEvent;)Z", reinterpret_cast<void *>(dispatchGenericMotionEvent)},
{"dispatchKeyEvent", "(Landroid/view/KeyEvent;)Z", reinterpret_cast<void *>(dispatchKeyEvent)},
{"setNativeActivity", "(Landroid/app/Activity;)V", reinterpret_cast<void *>(setNativeActivity)},
- {"setNativeService", "(Landroid/app/Service;)V", reinterpret_cast<void *>(setNativeService)}
+ {"setNativeService", "(Landroid/app/Service;)V", reinterpret_cast<void *>(setNativeService)},
+ {"sendRequestPermissionsResult", "(I[Ljava/lang/String;[I)V", reinterpret_cast<void *>(sendRequestPermissionsResult)},
};
const bool regOk = (env->RegisterNatives(jQtNative, methods, sizeof(methods) / sizeof(methods[0])) == JNI_OK);
@@ -357,6 +411,16 @@ jobject QtAndroidPrivate::service()
return g_jService;
}
+jobject QtAndroidPrivate::context()
+{
+ if (g_jActivity)
+ return g_jActivity;
+ if (g_jService)
+ return g_jService;
+
+ return 0;
+}
+
JavaVM *QtAndroidPrivate::javaVM()
{
return g_javaVM;
@@ -401,6 +465,70 @@ void QtAndroidPrivate::runOnAndroidThreadSync(const QtAndroidPrivate::Runnable &
sem->tryAcquire(1, timeoutMs);
}
+void QtAndroidPrivate::requestPermissions(JNIEnv *env, const QStringList &permissions, const QtAndroidPrivate::PermissionsResultFunc &callbackFunc, bool directCall)
+{
+ if (androidSdkVersion() < 23 || !activity()) {
+ QHash<QString, QtAndroidPrivate::PermissionsResult> res;
+ for (const auto &perm : permissions)
+ res[perm] = checkPermission(perm);
+ callbackFunc(res);
+ return;
+ }
+ // Check API 23+ permissions
+ const int requestCode = (*g_requestPermissionsRequestCode)++;
+ if (!directCall) {
+ g_pendingPermissionRequestsMutex->lock();
+ (*g_pendingPermissionRequests)[requestCode] = QSharedPointer<PermissionsResultClass>::create(callbackFunc);
+ g_pendingPermissionRequestsMutex->unlock();
+ }
+
+ runOnAndroidThread([permissions, callbackFunc, requestCode, directCall] {
+ if (directCall) {
+ g_pendingPermissionRequestsMutex->lock();
+ (*g_pendingPermissionRequests)[requestCode] = QSharedPointer<PermissionsResultClass>::create(callbackFunc);
+ g_pendingPermissionRequestsMutex->unlock();
+ }
+
+ QJNIEnvironmentPrivate env;
+ auto array = env->NewObjectArray(permissions.size(), env->FindClass("java/lang/String"), nullptr);
+ int index = 0;
+ for (const auto &perm : permissions)
+ env->SetObjectArrayElement(array, index++, QJNIObjectPrivate::fromString(perm).object());
+ QJNIObjectPrivate(activity()).callMethod<void>("requestPermissions", "([Ljava/lang/String;I)V", array, requestCode);
+ env->DeleteLocalRef(array);
+ }, env);
+}
+
+QHash<QString, QtAndroidPrivate::PermissionsResult> QtAndroidPrivate::requestPermissionsSync(JNIEnv *env, const QStringList &permissions, int timeoutMs)
+{
+ QSharedPointer<QHash<QString, QtAndroidPrivate::PermissionsResult>> res(new QHash<QString, QtAndroidPrivate::PermissionsResult>());
+ QSharedPointer<QSemaphore> sem(new QSemaphore);
+ requestPermissions(env, permissions, [sem, res](const QHash<QString, PermissionsResult> &result){
+ *res = result;
+ sem->release();
+ }, true);
+ sem->tryAcquire(1, timeoutMs);
+ return *res;
+}
+
+QtAndroidPrivate::PermissionsResult QtAndroidPrivate::checkPermission(const QString &permission)
+{
+ const auto res = QJNIObjectPrivate::callStaticMethod<jint>("org/qtproject/qt5/android/QtNative",
+ "checkSelfPermission",
+ "(Ljava/lang/String;)I",
+ QJNIObjectPrivate::fromString(permission).object());
+ return res == PERMISSION_GRANTED ? PermissionsResult::Granted : PermissionsResult::Denied;
+}
+
+bool QtAndroidPrivate::shouldShowRequestPermissionRationale(const QString &permission)
+{
+ if (androidSdkVersion() < 23 || !activity())
+ return false;
+
+ return QJNIObjectPrivate(activity()).callMethod<jboolean>("shouldShowRequestPermissionRationale", "(Ljava/lang/String;)Z",
+ QJNIObjectPrivate::fromString(permission).object());
+}
+
void QtAndroidPrivate::registerGenericMotionEventListener(QtAndroidPrivate::GenericMotionEventListener *listener)
{
QMutexLocker locker(&g_genericMotionEventListeners()->mutex);
@@ -431,3 +559,5 @@ void QtAndroidPrivate::hideSplashScreen(JNIEnv *env)
}
QT_END_NAMESPACE
+
+#include "qjnihelpers.moc"
diff --git a/src/corelib/kernel/qjnihelpers_p.h b/src/corelib/kernel/qjnihelpers_p.h
index 78ad08a09e..478f62a5c7 100644
--- a/src/corelib/kernel/qjnihelpers_p.h
+++ b/src/corelib/kernel/qjnihelpers_p.h
@@ -52,12 +52,13 @@
//
#include <jni.h>
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <functional>
QT_BEGIN_NAMESPACE
class QRunnable;
+class QStringList;
namespace QtAndroidPrivate
{
@@ -97,10 +98,17 @@ namespace QtAndroidPrivate
virtual bool handleKeyEvent(jobject event) = 0;
};
+ enum class PermissionsResult {
+ Granted,
+ Denied
+ };
+ typedef QHash<QString, QtAndroidPrivate::PermissionsResult> PermissionsHash;
typedef std::function<void()> Runnable;
+ typedef std::function<void(const PermissionsHash &)> PermissionsResultFunc;
Q_CORE_EXPORT jobject activity();
Q_CORE_EXPORT jobject service();
+ Q_CORE_EXPORT jobject context();
Q_CORE_EXPORT JavaVM *javaVM();
Q_CORE_EXPORT jint initJNI(JavaVM *vm, JNIEnv *env);
jobject classLoader();
@@ -108,6 +116,10 @@ namespace QtAndroidPrivate
Q_CORE_EXPORT void runOnAndroidThread(const Runnable &runnable, JNIEnv *env);
Q_CORE_EXPORT void runOnAndroidThreadSync(const Runnable &runnable, JNIEnv *env, int timeoutMs = INT_MAX);
Q_CORE_EXPORT void runOnUiThread(QRunnable *runnable, JNIEnv *env);
+ Q_CORE_EXPORT void requestPermissions(JNIEnv *env, const QStringList &permissions, const PermissionsResultFunc &callbackFunc, bool directCall = false);
+ Q_CORE_EXPORT QHash<QString, PermissionsResult> requestPermissionsSync(JNIEnv *env, const QStringList &permissions, int timeoutMs = INT_MAX);
+ Q_CORE_EXPORT PermissionsResult checkPermission(const QString &permission);
+ Q_CORE_EXPORT bool shouldShowRequestPermissionRationale(const QString &permission);
Q_CORE_EXPORT void handleActivityResult(jint requestCode, jint resultCode, jobject data);
Q_CORE_EXPORT void registerActivityResultListener(ActivityResultListener *listener);
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.cpp b/src/corelib/kernel/qmetaobject.cpp
index f4f75e39e6..2e0dd8e5d2 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -2557,9 +2557,19 @@ int QMetaEnum::value(int index) const
*/
bool QMetaEnum::isFlag() const
{
- return mobj && mobj->d.data[handle + 1];
+ return mobj && mobj->d.data[handle + 1] & EnumIsFlag;
}
+/*!
+ \since 5.8
+
+ Returns \c true if this enumerator is declared as a C++11 enum class;
+ otherwise returns false.
+*/
+bool QMetaEnum::isScoped() const
+{
+ return mobj && mobj->d.data[handle + 1] & EnumIsScoped;
+}
/*!
Returns the scope this enumerator was declared in.
@@ -2652,15 +2662,16 @@ int QMetaEnum::keysToValue(const char *keys, bool *ok) const
return -1;
if (ok != 0)
*ok = true;
- QStringList l = QString::fromLatin1(keys).split(QLatin1Char('|'));
- if (l.isEmpty())
+ const QString keysString = QString::fromLatin1(keys);
+ const QVector<QStringRef> splitKeys = keysString.splitRef(QLatin1Char('|'));
+ if (splitKeys.isEmpty())
return 0;
- //#### TODO write proper code, do not use QStringList
+ // ### TODO write proper code: do not allocate memory, so we can go nothrow
int value = 0;
int count = mobj->d.data[handle + 2];
int data = mobj->d.data[handle + 3];
- for (int li = 0; li < l.size(); ++li) {
- QString trimmed = l.at(li).trimmed();
+ for (const QStringRef &untrimmed : splitKeys) {
+ const QStringRef trimmed = untrimmed.trimmed();
QByteArray qualified_key = trimmed.toLatin1();
const char *key = qualified_key.constData();
uint scope = 0;
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 85ac7e77e4..40b2aa6402 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)
@@ -214,6 +210,7 @@ public:
const char *name() const;
bool isFlag() const;
+ bool isScoped() const;
int keyCount() const;
const char *key(int index) const;
diff --git a/src/corelib/kernel/qmetaobject_moc_p.h b/src/corelib/kernel/qmetaobject_moc_p.h
index 1b24837ec0..ad258acfcd 100644
--- a/src/corelib/kernel/qmetaobject_moc_p.h
+++ b/src/corelib/kernel/qmetaobject_moc_p.h
@@ -52,6 +52,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
// This function is shared with moc.cpp. This file should be included where needed.
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index 0790af2bb5..1c540f64c7 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -114,6 +114,11 @@ enum MetaDataFlags {
TypeNameIndexMask = 0x7FFFFFFF
};
+enum EnumFlags {
+ EnumIsFlag = 0x1,
+ EnumIsScoped = 0x2
+};
+
extern int qMetaTypeTypeInternal(const char *);
class QArgumentType
@@ -168,6 +173,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 +182,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/qmetaobjectbuilder_p.h b/src/corelib/kernel/qmetaobjectbuilder_p.h
index 0934873ad0..144595330d 100644
--- a/src/corelib/kernel/qmetaobjectbuilder_p.h
+++ b/src/corelib/kernel/qmetaobjectbuilder_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qdatastream.h>
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 3ac1f28638..f27fde6b8d 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
@@ -1270,6 +1268,7 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::UnknownType:
case QMetaType::Void:
case QMetaType::VoidStar:
+ case QMetaType::Nullptr:
case QMetaType::QObjectStar:
case QMetaType::QModelIndex:
case QMetaType::QPersistentModelIndex:
@@ -1491,6 +1490,7 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::UnknownType:
case QMetaType::Void:
case QMetaType::VoidStar:
+ case QMetaType::Nullptr:
case QMetaType::QObjectStar:
case QMetaType::QModelIndex:
case QMetaType::QPersistentModelIndex:
@@ -1840,6 +1840,8 @@ public:
template<typename T>
void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); }
+ // MSVC2013 and earlier can not const_cast a std::nullptr_t pointer.
+ void delegate(const std::nullptr_t *) {}
void delegate(const void *) {}
void delegate(const QMetaTypeSwitcher::UnknownType*) {}
void delegate(const QMetaTypeSwitcher::NotBuiltinType *where)
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index b68dbacbd3..9e2a5bf75d 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -86,6 +86,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(UChar, 37, uchar) \
F(Float, 38, float) \
F(SChar, 40, signed char) \
+ F(Nullptr, 51, std::nullptr_t) \
#define QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(F)\
F(VoidStar, 31, void*) \
@@ -414,7 +415,7 @@ public:
QT_FOR_EACH_STATIC_TYPE(QT_DEFINE_METATYPE_ID)
FirstCoreType = Bool,
- LastCoreType = QPersistentModelIndex,
+ LastCoreType = Nullptr,
FirstGuiType = QFont,
LastGuiType = QPolygonF,
FirstWidgetsType = QSizePolicy,
@@ -506,11 +507,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 +598,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"
@@ -1621,16 +1622,9 @@ namespace QtPrivate {
{ return -1; }
};
-#ifndef Q_COMPILER_VARIADIC_TEMPLATES
// Function pointers don't derive from QObject
- template <class Result> struct IsPointerToTypeDerivedFromQObject<Result(*)()> { enum { Value = false }; };
- template <class Result, class Arg0> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0)> { enum { Value = false }; };
- template <class Result, class Arg0, class Arg1> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1)> { enum { Value = false }; };
- template <class Result, class Arg0, class Arg1, class Arg2> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1, Arg2)> { enum { Value = false }; };
-#else
template <typename Result, typename... Args>
struct IsPointerToTypeDerivedFromQObject<Result(*)(Args...)> { enum { Value = false }; };
-#endif
template<typename T>
struct QMetaTypeTypeFlags
@@ -1857,6 +1851,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 +1871,7 @@ inline int qRegisterMetaTypeStreamOperators()
} \
}; \
QT_END_NAMESPACE
-
+#endif // Q_MOC_RUN
#define Q_DECLARE_BUILTIN_METATYPE(TYPE, METATYPEID, NAME) \
QT_BEGIN_NAMESPACE \
@@ -1899,7 +1894,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/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h
index 445e912cf7..dd0bce2645 100644
--- a/src/corelib/kernel/qmetatype_p.h
+++ b/src/corelib/kernel/qmetatype_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qmetatype.h"
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index 84e680dbd9..a550ca6ca1 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -122,7 +122,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
const QList<QVariant> list = data.toList();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).type() == QVariant::Url) {
- text.append(list.at(i).toUrl().toDisplayString() + QLatin1Char('\n'));
+ text += list.at(i).toUrl().toDisplayString() + QLatin1Char('\n');
++numUrls;
}
}
@@ -167,7 +167,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
case QVariant::List: {
if (format != QLatin1String("text/uri-list"))
break;
- // fall through
+ Q_FALLTHROUGH();
}
case QVariant::Url: {
QByteArray ba = data.toByteArray();
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index c235260f1b..63b02d2c0c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -222,7 +222,7 @@ QObjectPrivate::QObjectPrivate(int version)
blockSig = false; // not blocking signals
wasDeleted = false; // double-delete catcher
isDeletingChildren = false; // set by deleteChildren()
- sendChildEvents = true; // if we should send ChildInsert and ChildRemove events to parent
+ sendChildEvents = true; // if we should send ChildAdded and ChildRemoved events to parent
receiveChildEvents = true;
postedEvents = 0;
extraData = 0;
@@ -4248,7 +4248,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
This macro registers an enum type with the meta-object system.
It must be placed after the enum declaration in a class that has the Q_OBJECT or the
- Q_GADGET macro.
+ Q_GADGET macro. For namespaces use \l Q_ENUM_NS instead.
For example:
@@ -4275,7 +4275,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
This macro registers a single \l{QFlags}{flags type} with the
meta-object system. It is typically used in a class definition to declare
that values of a given enum can be used as flags and combined using the
- bitwise OR operator.
+ bitwise OR operator. For namespaces use \l Q_FLAG_NS instead.
The macro must be placed after the enum declaration.
@@ -4294,6 +4294,48 @@ QDebug operator<<(QDebug dbg, const QObject *o)
\sa {Qt's Property System}
*/
+/*!
+ \macro Q_ENUM_NS(...)
+ \since 5.8
+
+ This macro registers an enum type with the meta-object system.
+ It must be placed after the enum declaration in a namespace that
+ has the Q_NAMESPACE macro. It is the same as \l Q_ENUM but in a
+ namespace.
+
+ Enumerations that are declared with Q_ENUM_NS have their QMetaEnum
+ registered in the enclosing QMetaObject. You can also use
+ QMetaEnum::fromType() to get the QMetaEnum.
+
+ Registered enumerations are automatically registered also to the Qt meta
+ type system, making them known to QMetaType without the need to use
+ Q_DECLARE_METATYPE(). This will enable useful features; for example, if
+ used in a QVariant, you can convert them to strings. Likewise, passing them
+ to QDebug will print out their names.
+
+ \sa {Qt's Property System}
+*/
+
+
+/*!
+ \macro Q_FLAG_NS(...)
+ \since 5.8
+
+ This macro registers a single \l{QFlags}{flags type} with the
+ meta-object system. It is used in a namespace that has the
+ Q_NAMESPACE macro, to declare that values of a given enum can be
+ used as flags and combined using the bitwise OR operator.
+ It is the same as \l Q_FLAG but in a namespace.
+
+ The macro must be placed after the enum declaration.
+
+ \note The Q_FLAG_NS macro takes care of registering individual flag
+ values with the meta-object system, so it is unnecessary to use
+ Q_ENUM_NS() in addition to this macro.
+
+ \sa {Qt's Property System}
+*/
+
/*!
\macro Q_OBJECT
@@ -4335,6 +4377,21 @@ QDebug operator<<(QDebug dbg, const QObject *o)
*/
/*!
+ \macro Q_NAMESPACE
+ \since 5.8
+
+ The Q_NAMESPACE macro can be used to add QMetaObject capabilities
+ to a namespace.
+
+ Q_NAMESPACEs can have Q_CLASSINFO, Q_ENUM_NS, Q_FLAG_NS, but they
+ cannot have Q_ENUM, Q_FLAG, Q_PROPERTY, Q_INVOKABLE, signals nor slots.
+
+ Q_NAMESPACE makes an external variable, \c{staticMetaObject}, available.
+ \c{staticMetaObject} is of type QMetaObject and provides access to the
+ enums declared with Q_ENUM_NS/Q_FLAG_NS.
+*/
+
+/*!
\macro Q_SIGNALS
\relates QObject
@@ -4471,6 +4528,19 @@ QDebug operator<<(QDebug dbg, const QObject *o)
*/
/*!
+ \macro QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
+ \relates QObject
+ \since 5.8
+
+ Defining this macro will disable narrowing and floating-point-to-integral
+ conversions between the arguments carried by a signal and the arguments
+ accepted by a slot, when the signal and the slot are connected using the
+ PMF-based syntax.
+
+ \sa QObject::connect
+*/
+
+/*!
\typedef QObjectList
\relates QObject
@@ -4776,11 +4846,12 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
c->isSlotObject = false;
}
+ c->sender->disconnectNotify(QMetaObjectPrivate::signal(c->sender->metaObject(),
+ c->signal_index));
+
const_cast<QMetaObject::Connection &>(connection).d_ptr = 0;
c->deref(); // has been removed from the QMetaObject::Connection object
- // disconnectNotify() not called (the signal index is unknown).
-
return true;
}
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/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 4383ece245..a7d7ef0889 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qobject.h"
#include "QtCore/qpointer.h"
#include "QtCore/qsharedpointer.h"
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index a40614bd31..5cdbef443b 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -124,6 +124,11 @@ class QString;
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
+#define Q_ENUM_NS_IMPL(ENUM) \
+ inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
+ inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
+#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
+#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
#define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable)
#define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal)
@@ -227,6 +232,12 @@ private: \
QT_WARNING_POP \
QT_ANNOTATE_CLASS(qt_qgadget, "") \
/*end*/
+
+#define Q_NAMESPACE \
+ extern const QMetaObject staticMetaObject; \
+ QT_ANNOTATE_CLASS(qt_qnamespace, "") \
+ /*end*/
+
#endif // QT_NO_META_MACROS
#else // Q_MOC_RUN
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h
index 5eae70ecc5..e94e713e1f 100644
--- a/src/corelib/kernel/qobjectdefs_impl.h
+++ b/src/corelib/kernel/qobjectdefs_impl.h
@@ -50,6 +50,8 @@
#pragma qt_sync_stop_processing
#endif
+#include <type_traits>
+
QT_BEGIN_NAMESPACE
@@ -194,6 +196,46 @@ namespace QtPrivate {
};
/*
+ Logic that checks if the underlying type of an enum is signed or not.
+ Needs an external, explicit check that E is indeed an enum. Works
+ around the fact that it's undefined behavior to instantiate
+ std::underlying_type on non-enums (cf. §20.13.7.6 [meta.trans.other]).
+ */
+ template<typename E, typename Enable = void>
+ struct IsEnumUnderlyingTypeSigned : std::false_type
+ {
+ };
+
+ template<typename E>
+ struct IsEnumUnderlyingTypeSigned<E, typename std::enable_if<std::is_enum<E>::value>::type>
+ : std::integral_constant<bool, std::is_signed<typename std::underlying_type<E>::type>::value>
+ {
+ };
+
+ /*
+ Logic that checks if the argument of the slot does not narrow the
+ argument of the signal when used in list initialization. Cf. §8.5.4.7
+ [dcl.init.list] for the definition of narrowing.
+ For incomplete From/To types, there's no narrowing.
+ */
+ template<typename From, typename To, typename Enable = void>
+ struct AreArgumentsNarrowedBase : std::false_type
+ {
+ };
+
+ template<typename From, typename To>
+ struct AreArgumentsNarrowedBase<From, To, typename std::enable_if<sizeof(From) && sizeof(To)>::type>
+ : std::integral_constant<bool,
+ (std::is_floating_point<From>::value && std::is_integral<To>::value) ||
+ (std::is_floating_point<From>::value && std::is_floating_point<To>::value && sizeof(From) > sizeof(To)) ||
+ ((std::is_integral<From>::value || std::is_enum<From>::value) && std::is_floating_point<To>::value) ||
+ (std::is_integral<From>::value && std::is_integral<To>::value && (sizeof(From) > sizeof(To) || std::is_signed<From>::value != std::is_signed<To>::value)) ||
+ (std::is_enum<From>::value && std::is_integral<To>::value && (sizeof(From) > sizeof(To) || IsEnumUnderlyingTypeSigned<From>::value != std::is_signed<To>::value))
+ >
+ {
+ };
+
+ /*
Logic that check if the arguments of the slot matches the argument of the signal.
To be used like this:
Q_STATIC_ASSERT(CheckCompatibleArguments<FunctionPointer<Signal>::Arguments, FunctionPointer<Slot>::Arguments>::value)
@@ -203,6 +245,10 @@ namespace QtPrivate {
static char test(...);
static const typename RemoveRef<A1>::Type &dummy();
enum { value = sizeof(test(dummy())) == sizeof(int) };
+#ifdef QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
+ struct AreArgumentsNarrowed : AreArgumentsNarrowedBase<typename RemoveRef<A1>::Type, typename RemoveRef<A2>::Type> {};
+ Q_STATIC_ASSERT_X(!AreArgumentsNarrowed::value, "Signal and slot arguments are not compatible (narrowing)");
+#endif
};
template<typename A1, typename A2> struct AreArgumentsCompatible<A1, A2&> { enum { value = false }; };
template<typename A> struct AreArgumentsCompatible<A&, A&> { enum { value = true }; };
diff --git a/src/corelib/kernel/qppsattribute_p.h b/src/corelib/kernel/qppsattribute_p.h
index 1d9cc4484c..035756e002 100644
--- a/src/corelib/kernel/qppsattribute_p.h
+++ b/src/corelib/kernel/qppsattribute_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QList>
#include <QMap>
#include <QSharedDataPointer>
diff --git a/src/corelib/kernel/qppsobject.cpp b/src/corelib/kernel/qppsobject.cpp
index 30498a380d..dd01d48cc0 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..3899f24d3b 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) {
@@ -159,12 +149,13 @@ QString QSystemError::toString() const
return windowsErrorString(errorCode);
#else
//unix: fall through as native and standard library are the same
+ Q_FALLTHROUGH();
#endif
case StandardLibraryError:
return standardLibraryErrorString(errorCode);
default:
qWarning("invalid error scope");
- //fall through
+ Q_FALLTHROUGH();
case NoError:
return QLatin1String("No error");
}
diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h
index c3d8118711..440b763149 100644
--- a/src/corelib/kernel/qsystemerror_p.h
+++ b/src/corelib/kernel/qsystemerror_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qstring.h>
QT_BEGIN_NAMESPACE
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.cpp b/src/corelib/kernel/qtimer.cpp
index 80accc0cb8..8ba494ec3d 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -533,6 +533,78 @@ void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiv
*/
/*!
+ \fn void QTimer::singleShot(std::chrono::duration<Rep, Period> value, const QObject *receiver, const char *member)
+ \since 5.8
+ \overload
+ \reentrant
+
+ This static function calls a slot after a given time interval.
+
+ It is very convenient to use this function because you do not need
+ to bother with a \l{QObject::timerEvent()}{timerEvent} or
+ create a local QTimer object.
+
+ The \a receiver is the receiving object and the \a member is the slot. The
+ time interval is given in the duration object \a value.
+
+ \sa start()
+*/
+
+/*!
+ \fn void QTimer::singleShot(std::chrono::duration<Rep, Period> value, Qt::TimerType timerType, const QObject *receiver, const char *member)
+ \since 5.8
+ \overload
+ \reentrant
+
+ This static function calls a slot after a given time interval.
+
+ It is very convenient to use this function because you do not need
+ to bother with a \l{QObject::timerEvent()}{timerEvent} or
+ create a local QTimer object.
+
+ The \a receiver is the receiving object and the \a member is the slot. The
+ time interval is given in the duration object \a value. The \a timerType affects the
+ accuracy of the timer.
+
+ \sa start()
+*/
+
+/*!
+ \fn void QTimer::start(std::chrono::duration<Rep, Period> value)
+ \since 5.8
+ \overload
+
+ Starts or restarts the timer with a timeout of duration \a value.
+
+ If the timer is already running, it will be
+ \l{QTimer::stop()}{stopped} and restarted.
+
+ If \l singleShot is true, the timer will be activated only once.
+*/
+
+/*!
+ \fn std::chrono::milliseconds QTimer::intervalAsDuration() const
+ \since 5.8
+
+ Returns the interval of this timer as a \c std::chrono::milliseconds object.
+
+ \sa interval
+*/
+
+/*!
+ \fn std::chrono::milliseconds QTimer::remainingTimeAsDuration() const
+ \since 5.8
+
+ Returns the time remaining in this timer object as a \c
+ std::chrono::milliseconds object. If this timer is due or overdue, the
+ returned value is \c std::chrono::milliseconds::zero(). If the remaining
+ time could not be found or the timer is not active, this function returns a
+ negative duration.
+
+ \sa remainingTime()
+*/
+
+/*!
\property QTimer::singleShot
\brief whether the timer is a single-shot timer
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index dd52d52a1c..1567fe760c 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -47,6 +47,10 @@
#include <QtCore/qbasictimer.h> // conceptual inheritance
#include <QtCore/qobject.h>
+#if QT_HAS_INCLUDE(<chrono>)
+# include <chrono>
+#endif
+
QT_BEGIN_NAMESPACE
@@ -80,21 +84,27 @@ 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
- template <typename Func1>
- static inline void singleShot(int msec, const typename QtPrivate::FunctionPointer<Func1>::Object *receiver, Func1 slot)
+ template <typename Duration, typename Func1>
+ static inline void singleShot(Duration interval, const typename QtPrivate::FunctionPointer<Func1>::Object *receiver, Func1 slot)
{
- singleShot(msec, msec >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer, receiver, slot);
+ singleShot(interval, defaultTypeFor(interval), receiver, slot);
}
- template <typename Func1>
- static inline void singleShot(int msec, Qt::TimerType timerType, const typename QtPrivate::FunctionPointer<Func1>::Object *receiver,
+ template <typename Duration, typename Func1>
+ static inline void singleShot(Duration interval, Qt::TimerType timerType, const typename QtPrivate::FunctionPointer<Func1>::Object *receiver,
Func1 slot)
{
typedef QtPrivate::FunctionPointer<Func1> SlotType;
@@ -103,42 +113,42 @@ public:
Q_STATIC_ASSERT_X(int(SlotType::ArgumentCount) == 0,
"The slot must not have any arguments.");
- singleShotImpl(msec, timerType, receiver,
+ singleShotImpl(interval, timerType, receiver,
new QtPrivate::QSlotObject<Func1, typename SlotType::Arguments, void>(slot));
}
// singleShot to a functor or function pointer (without context)
- template <typename Func1>
+ template <typename Duration, typename Func1>
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
!QtPrivate::is_same<const char*, Func1>::value, void>::Type
- singleShot(int msec, Func1 slot)
+ singleShot(Duration interval, Func1 slot)
{
- singleShot(msec, msec >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer, Q_NULLPTR, slot);
+ singleShot(interval, defaultTypeFor(interval), nullptr, slot);
}
- template <typename Func1>
+ template <typename Duration, typename Func1>
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
!QtPrivate::is_same<const char*, Func1>::value, void>::Type
- singleShot(int msec, Qt::TimerType timerType, Func1 slot)
+ singleShot(Duration interval, Qt::TimerType timerType, Func1 slot)
{
- singleShot(msec, timerType, Q_NULLPTR, slot);
+ singleShot(interval, timerType, nullptr, slot);
}
// singleShot to a functor or function pointer (with context)
- template <typename Func1>
+ template <typename Duration, typename Func1>
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
!QtPrivate::is_same<const char*, Func1>::value, void>::Type
- singleShot(int msec, QObject *context, Func1 slot)
+ singleShot(Duration interval, QObject *context, Func1 slot)
{
- singleShot(msec, msec >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer, context, slot);
+ singleShot(interval, defaultTypeFor(interval), context, slot);
}
- template <typename Func1>
+ template <typename Duration, typename Func1>
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
!QtPrivate::is_same<const char*, Func1>::value, void>::Type
- singleShot(int msec, Qt::TimerType timerType, QObject *context, Func1 slot)
+ singleShot(Duration interval, Qt::TimerType timerType, QObject *context, Func1 slot)
{
//compilation error if the slot has arguments.
typedef QtPrivate::FunctionPointer<Func1> SlotType;
Q_STATIC_ASSERT_X(int(SlotType::ArgumentCount) <= 0, "The slot must not have any arguments.");
- singleShotImpl(msec, timerType, context,
+ singleShotImpl(interval, timerType, context,
new QtPrivate::QFunctorSlotObject<Func1, 0,
typename QtPrivate::List_Left<void, 0>::Value, void>(slot));
}
@@ -153,6 +163,43 @@ public Q_SLOTS:
Q_SIGNALS:
void timeout(QPrivateSignal);
+public:
+#if QT_HAS_INCLUDE(<chrono>) || defined(Q_QDOC)
+ template <class Rep, class Period>
+ void setInterval(std::chrono::duration<Rep, Period> value)
+ {
+ setInterval(std::chrono::duration_cast<std::chrono::milliseconds>(value).count());
+ }
+
+ std::chrono::milliseconds intervalAsDuration() const
+ {
+ return std::chrono::milliseconds(interval());
+ }
+
+ std::chrono::milliseconds remainingTimeAsDuration() const
+ {
+ return std::chrono::milliseconds(remainingTime());
+ }
+
+ template <class Rep, class Period>
+ static void singleShot(std::chrono::duration<Rep, Period> value, const QObject *receiver, const char *member)
+ {
+ singleShot(int(std::chrono::duration_cast<std::chrono::milliseconds>(value).count()), receiver, member);
+ }
+
+ template <class Rep, class Period>
+ static void singleShot(std::chrono::duration<Rep, Period> value, Qt::TimerType timerType, const QObject *receiver, const char *member)
+ {
+ singleShot(int(std::chrono::duration_cast<std::chrono::milliseconds>(value).count()), timerType, receiver, member);
+ }
+
+ template <class Rep, class Period>
+ void start(std::chrono::duration<Rep, Period> value)
+ {
+ start(int(std::chrono::duration_cast<std::chrono::milliseconds>(value).count()));
+ }
+#endif
+
protected:
void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
@@ -162,9 +209,25 @@ private:
inline int startTimer(int){ return -1;}
inline void killTimer(int){}
+ static Q_DECL_CONSTEXPR Qt::TimerType defaultTypeFor(int msecs) Q_DECL_NOTHROW
+ { return msecs >= 2000 ? Qt::CoarseTimer : Qt::PreciseTimer; }
static void singleShotImpl(int msec, Qt::TimerType timerType,
const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj);
+#if QT_HAS_INCLUDE(<chrono>)
+ template <class Rep, class Period>
+ static Qt::TimerType defaultTypeFor(std::chrono::duration<Rep, Period> interval)
+ { return defaultTypeFor(int(std::chrono::duration_cast<std::chrono::milliseconds>(interval).count())); }
+
+ template <class Rep, class Period>
+ static void singleShotImpl(std::chrono::duration<Rep, Period> interval, Qt::TimerType timerType,
+ const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj)
+ {
+ singleShotImpl(int(std::chrono::duration_cast<std::chrono::milliseconds>(interval).count()),
+ timerType, receiver, slotObj);
+ }
+#endif
+
int id, inter, del;
uint single : 1;
uint nulltimer : 1;
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index 56337bdb45..c3b8c86063 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -468,7 +468,6 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
// above 20 s, 5% inaccuracy is above 1 s, so we convert to VeryCoarseTimer
if (interval >= 20000) {
t->timerType = Qt::VeryCoarseTimer;
- // fall through
} else {
t->timeout = expected;
if (interval <= 20) {
@@ -479,7 +478,7 @@ void QTimerInfoList::registerTimer(int timerId, int interval, Qt::TimerType time
}
break;
}
- // fall through
+ Q_FALLTHROUGH();
case Qt::VeryCoarseTimer:
// the very coarse timer is based on full second precision,
// so we keep the interval in seconds (round to closest second)
diff --git a/src/corelib/kernel/qtimerinfo_unix_p.h b/src/corelib/kernel/qtimerinfo_unix_p.h
index 2de8a4681f..7bd6f16ea1 100644
--- a/src/corelib/kernel/qtimerinfo_unix_p.h
+++ b/src/corelib/kernel/qtimerinfo_unix_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
// #define QTIMERINFO_DEBUG
#include "qabstracteventdispatcher.h"
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 2c813b5156..04a5e7ed7a 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -487,10 +487,9 @@ bool QTranslator::load(const QString & filename, const QString & directory,
}
const QString suffixOrDotQM = suffix.isNull() ? dotQmLiteral() : suffix;
- QString fname = filename;
+ QStringRef fname(&filename);
QString realname;
- QString delims;
- delims = search_delimiters.isNull() ? QStringLiteral("_.") : search_delimiters;
+ const QString delims = search_delimiters.isNull() ? QStringLiteral("_.") : search_delimiters;
for (;;) {
QFileInfo fi;
diff --git a/src/corelib/kernel/qtranslator_p.h b/src/corelib/kernel/qtranslator_p.h
index 21de8e2a8c..e148637ac6 100644
--- a/src/corelib/kernel/qtranslator_p.h
+++ b/src/corelib/kernel/qtranslator_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
enum {
Q_EQ = 0x01,
Q_LT = 0x02,
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index a8cc1095fe..72ae3b063f 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -203,7 +203,7 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok)
case QMetaType::QJsonValue:
if (!v_cast<QJsonValue>(d)->isDouble())
break;
- // no break
+ Q_FALLTHROUGH();
#endif
case QVariant::Double:
case QVariant::Int:
@@ -278,7 +278,7 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok)
case QMetaType::QJsonValue:
if (!v_cast<QJsonValue>(d)->isDouble())
break;
- // no break
+ Q_FALLTHROUGH();
#endif
case QVariant::Double:
case QVariant::Int:
@@ -3119,7 +3119,7 @@ bool QVariant::canConvert(int targetTypeId) const
case QVariant::Int:
if (currentType == QVariant::KeySequence)
return true;
- // fall through
+ Q_FALLTHROUGH();
case QVariant::UInt:
case QVariant::LongLong:
case QVariant::ULongLong:
diff --git a/src/corelib/mimetypes/mimetypes.pri b/src/corelib/mimetypes/mimetypes.pri
index 1ab773fc10..870b6c65a5 100644
--- a/src/corelib/mimetypes/mimetypes.pri
+++ b/src/corelib/mimetypes/mimetypes.pri
@@ -1,6 +1,7 @@
# Qt core mimetype module
-HEADERS += \
+qtConfig(mimetype) {
+ HEADERS += \
mimetypes/qmimedatabase.h \
mimetypes/qmimetype.h \
mimetypes/qmimemagicrulematcher_p.h \
@@ -11,7 +12,7 @@ HEADERS += \
mimetypes/qmimeglobpattern_p.h \
mimetypes/qmimeprovider_p.h
-SOURCES += \
+ SOURCES += \
mimetypes/qmimedatabase.cpp \
mimetypes/qmimetype.cpp \
mimetypes/qmimemagicrulematcher.cpp \
@@ -20,6 +21,5 @@ SOURCES += \
mimetypes/qmimeglobpattern.cpp \
mimetypes/qmimeprovider.cpp
-!contains(DEFINES, QT_NO_MIMETYPE) {
RESOURCES += mimetypes/mimetypes.qrc
}
diff --git a/src/corelib/mimetypes/qmimeglobpattern.cpp b/src/corelib/mimetypes/qmimeglobpattern.cpp
index 94be5385f3..568f9bf4de 100644
--- a/src/corelib/mimetypes/qmimeglobpattern.cpp
+++ b/src/corelib/mimetypes/qmimeglobpattern.cpp
@@ -124,7 +124,7 @@ bool QMimeGlobPattern::matchFileName(const QString &inputFilename) const
if (starCount == 1 && m_pattern.at(pattern_len - 1) == QLatin1Char('*')) {
if (len + 1 < pattern_len) return false;
if (m_pattern.at(0) == QLatin1Char('*'))
- return filename.indexOf(m_pattern.mid(1, pattern_len - 2)) != -1;
+ return filename.indexOf(m_pattern.midRef(1, pattern_len - 2)) != -1;
const QChar *c1 = m_pattern.unicode();
const QChar *c2 = filename.unicode();
diff --git a/src/corelib/mimetypes/qmimeglobpattern_p.h b/src/corelib/mimetypes/qmimeglobpattern_p.h
index e4c74ff7fa..3e4fdb50f6 100644
--- a/src/corelib/mimetypes/qmimeglobpattern_p.h
+++ b/src/corelib/mimetypes/qmimeglobpattern_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#ifndef QT_NO_MIMETYPE
diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h
index 26f93d96cc..0c6c1dbcd7 100644
--- a/src/corelib/mimetypes/qmimemagicrule_p.h
+++ b/src/corelib/mimetypes/qmimemagicrule_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#ifndef QT_NO_MIMETYPE
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index dc6eb05d9a..a798d9eff6 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
static QString fallbackParent(const QString &mimeTypeName)
{
- const QString myGroup = mimeTypeName.left(mimeTypeName.indexOf(QLatin1Char('/')));
+ const QStringRef myGroup = mimeTypeName.leftRef(mimeTypeName.indexOf(QLatin1Char('/')));
// All text/* types are subclasses of text/plain.
if (myGroup == QLatin1String("text") && mimeTypeName != QLatin1String("text/plain"))
return QLatin1String("text/plain");
@@ -217,22 +217,24 @@ bool QMimeBinaryProvider::isValid()
bool QMimeBinaryProvider::CacheFileList::checkCacheChanged()
{
bool somethingChanged = false;
- QMutableListIterator<CacheFile *> it(*this);
- while (it.hasNext()) {
- CacheFile *cacheFile = it.next();
+ for (CacheFile *cacheFile : qAsConst(*this)) {
QFileInfo fileInfo(cacheFile->file);
- if (!fileInfo.exists()) { // This can't happen by just running update-mime-database. But the user could use rm -rf :-)
- delete cacheFile;
- it.remove();
- somethingChanged = true;
- } else if (fileInfo.lastModified() > cacheFile->m_mtime) {
- if (!cacheFile->reload()) {
- delete cacheFile;
- it.remove();
- }
+ if (!fileInfo.exists() || fileInfo.lastModified() > cacheFile->m_mtime) {
+ // Deletion can't happen by just running update-mime-database.
+ // But the user could use rm -rf :-)
+ cacheFile->reload(); // will mark itself as invalid on failure
somethingChanged = true;
}
}
+ if (somethingChanged) {
+ auto deleteIfNoLongerValid = [](CacheFile *cacheFile) -> bool {
+ const bool invalid = !cacheFile->isValid();
+ if (invalid)
+ delete cacheFile;
+ return invalid;
+ };
+ erase(std::remove_if(begin(), end(), deleteIfNoLongerValid), end());
+ }
return somethingChanged;
}
@@ -363,7 +365,8 @@ bool QMimeBinaryProvider::matchSuffixTree(QMimeGlobMatchResult &result, QMimeBin
const int weight = flagsAndWeight & 0xff;
const bool caseSensitive = flagsAndWeight & 0x100;
if (caseSensitiveCheck || !caseSensitive) {
- result.addMatch(QLatin1String(mimeType), weight, QLatin1Char('*') + fileName.mid(charPos+1));
+ result.addMatch(QLatin1String(mimeType), weight,
+ QLatin1Char('*') + fileName.midRef(charPos + 1));
success = true;
}
}
@@ -569,10 +572,9 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
const QString file = data.name + QLatin1String(".xml");
// shared-mime-info since 1.3 lowercases the xml files
- QStringList mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1("mime/") + file.toLower());
- if (mimeFiles.isEmpty()) {
- mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1("mime/") + file); // pre-1.3
- }
+ QStringList mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/") + file.toLower());
+ if (mimeFiles.isEmpty())
+ mimeFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/") + file); // pre-1.3
if (mimeFiles.isEmpty()) {
qWarning() << "No file found for" << file << ", even though update-mime-info said it would exist.\n"
"Either it was just removed, or the directory doesn't have executable permission..."
@@ -804,7 +806,7 @@ bool QMimeXMLProvider::load(const QString &fileName, QString *errorMessage)
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (errorMessage)
- *errorMessage = QString::fromLatin1("Cannot open %1: %2").arg(fileName, file.errorString());
+ *errorMessage = QLatin1String("Cannot open ") + fileName + QLatin1String(": ") + file.errorString();
return false;
}
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index b259b42ac8..98a0e8eb1b 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -286,11 +286,12 @@ QString QMimeType::genericIconName() const
// then the mimetype is used to generate the generic icon by using the top-level
// media type (e.g. "video" in "video/ogg") and appending "-x-generic"
// (i.e. "video-x-generic" in the previous example).
- QString group = name();
- const int slashindex = group.indexOf(QLatin1Char('/'));
+ const QString group = name();
+ QStringRef groupRef(&group);
+ const int slashindex = groupRef.indexOf(QLatin1Char('/'));
if (slashindex != -1)
- group = group.left(slashindex);
- return group + QLatin1String("-x-generic");
+ groupRef = groupRef.left(slashindex);
+ return groupRef + QLatin1String("-x-generic");
}
return d->genericIconName;
}
diff --git a/src/corelib/mimetypes/qmimetype_p.h b/src/corelib/mimetypes/qmimetype_p.h
index c89ffbefa3..b0bfad2f65 100644
--- a/src/corelib/mimetypes/qmimetype_p.h
+++ b/src/corelib/mimetypes/qmimetype_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qmimetype.h"
#ifndef QT_NO_MIMETYPE
diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp
index 535fa51c92..7693055cc1 100644
--- a/src/corelib/mimetypes/qmimetypeparser.cpp
+++ b/src/corelib/mimetypes/qmimetypeparser.cpp
@@ -85,7 +85,7 @@ static const char matchMaskAttributeC[] = "mask";
\class QMimeTypeParser
\inmodule QtCore
\internal
- \brief The QMimeTypeParser class parses MIME types, and builds a MIME database hierarchy by adding to QMimeDatabasePrivate.
+ \brief The QMimeTypeParser class parses MIME types, and builds a MIME database hierarchy by adding to QMimeDatabase.
Populates QMimeDataBase
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/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h
index 145f00df43..bcda19e8b5 100644
--- a/src/corelib/plugin/qelfparser_p.h
+++ b/src/corelib/plugin/qelfparser_p.h
@@ -52,7 +52,7 @@
//
#include <qendian.h>
-#include <qglobal.h>
+#include <private/qglobal_p.h>
#ifndef QT_NO_LIBRARY
#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
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/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index 6f62da484b..0876d141c4 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -91,8 +91,6 @@ public:
QObject *instance(int index) const;
};
-#ifdef Q_COMPILER_VARIADIC_TEMPLATES
-
template <class PluginInterface, class FactoryInterface, typename ...Args>
PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key, Args &&...args)
{
@@ -106,68 +104,6 @@ PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key, A
return nullptr;
}
-#else
-
-template <class PluginInterface, class FactoryInterface>
- PluginInterface *qLoadPlugin(const QFactoryLoader *loader, const QString &key)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key))
- return result;
- }
- return 0;
-}
-
-template <class PluginInterface, class FactoryInterface, class P1>
-PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
- const QString &key,
- P1 &&p1)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key, std::forward<P1>(p1)))
- return result;
- }
- return 0;
-}
-
-template <class PluginInterface, class FactoryInterface, class P1, class P2>
-PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
- const QString &key,
- P1 &&p1, P2 &&p2)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key, std::forward<P1>(p1), std::forward<P2>(p2)))
- return result;
- }
- return 0;
-}
-
-template <class PluginInterface, class FactoryInterface, class P1, class P2, class P3>
-PluginInterface *qLoadPlugin(const QFactoryLoader *loader,
- const QString &key,
- P1 &&p1, P2 &&p2, P3 &&p3)
-{
- const int index = loader->indexOf(key);
- if (index != -1) {
- QObject *factoryObject = loader->instance(index);
- if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
- if (PluginInterface *result = factory->create(key, std::forward<P1>(p1), std::forward<P2>(p2), std::forward<P3>(p3)))
- return result;
- }
- return 0;
-}
-
-#endif
-
template <class PluginInterface, class FactoryInterface, typename Arg>
Q_DECL_DEPRECATED PluginInterface *qLoadPlugin1(const QFactoryLoader *loader, const QString &key, Arg &&arg)
{ return qLoadPlugin<PluginInterface, FactoryInterface>(loader, key, std::forward<Arg>(arg)); }
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 18ce085856..aff2991ed1 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -621,12 +621,12 @@ bool QLibrary::isLibrary(const QString &fileName)
QString completeSuffix = QFileInfo(fileName).completeSuffix();
if (completeSuffix.isEmpty())
return false;
- QStringList suffixes = completeSuffix.split(QLatin1Char('.'));
+ const QVector<QStringRef> suffixes = completeSuffix.splitRef(QLatin1Char('.'));
# if defined(Q_OS_DARWIN)
// On Mac, libs look like libmylib.1.0.0.dylib
- const QString lastSuffix = suffixes.at(suffixes.count() - 1);
- const QString firstSuffix = suffixes.at(0);
+ const QStringRef &lastSuffix = suffixes.at(suffixes.count() - 1);
+ const QStringRef &firstSuffix = suffixes.at(0);
bool valid = (lastSuffix == QLatin1String("dylib")
|| firstSuffix == QLatin1String("so")
@@ -662,7 +662,7 @@ bool QLibrary::isLibrary(const QString &fileName)
int suffix;
int suffixPos = -1;
for (suffix = 0; suffix < validSuffixList.count() && suffixPos == -1; ++suffix)
- suffixPos = suffixes.indexOf(validSuffixList.at(suffix));
+ suffixPos = suffixes.indexOf(QStringRef(&validSuffixList.at(suffix)));
bool valid = suffixPos != -1;
for (int i = suffixPos + 1; i < suffixes.count() && valid; ++i)
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index c3bdc5a832..f883e74843 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qlibrary.h"
#include "QtCore/qpointer.h"
#include "QtCore/qstringlist.h"
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/qmachparser_p.h b/src/corelib/plugin/qmachparser_p.h
index 0df7a98f96..ff7eaadb70 100644
--- a/src/corelib/plugin/qmachparser_p.h
+++ b/src/corelib/plugin/qmachparser_p.h
@@ -52,7 +52,7 @@
//
#include <qendian.h>
-#include <qglobal.h>
+#include <private/qglobal_p.h>
#ifndef QT_NO_LIBRARY
#if defined(Q_OF_MACH_O)
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 094280e3b4..4ec4e43952 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..4e093c0b7c 100644
--- a/src/corelib/plugin/qsystemlibrary_p.h
+++ b/src/corelib/plugin/qsystemlibrary_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#ifdef Q_OS_WIN
# include <QtCore/qstring.h>
# include <qt_windows.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..f11ac6548b 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
@@ -1002,7 +969,7 @@ QUuid QUuid::createUuid()
{
int *pseed = new int;
static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2);
- qsrand(*pseed = QDateTime::currentDateTimeUtc().toTime_t()
+ qsrand(*pseed = QDateTime::currentSecsSinceEpoch()
+ quintptr(&pseed)
+ serial.fetchAndAddRelaxed(1));
uuidseed.setLocalData(pseed);
@@ -1010,7 +977,7 @@ QUuid QUuid::createUuid()
#else
static bool seeded = false;
if (!seeded)
- qsrand(QDateTime::currentDateTimeUtc().toTime_t()
+ qsrand(QDateTime::currentSecsSinceEpoch()
+ quintptr(&seeded));
#endif
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/qabstractstate_p.h b/src/corelib/statemachine/qabstractstate_p.h
index b5e1b19862..552125f95a 100644
--- a/src/corelib/statemachine/qabstractstate_p.h
+++ b/src/corelib/statemachine/qabstractstate_p.h
@@ -51,6 +51,10 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
+#ifndef QT_NO_STATEMACHINE
+
#include <private/qobject_p.h>
#include <QtCore/qabstractstate.h>
@@ -94,4 +98,6 @@ public:
QT_END_NAMESPACE
-#endif
+#endif // QT_NO_STATEMACHINE
+
+#endif // QABSTRACTSTATE_P_H
diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h
index 2e93c31982..ae9ed431cb 100644
--- a/src/corelib/statemachine/qhistorystate_p.h
+++ b/src/corelib/statemachine/qhistorystate_p.h
@@ -53,6 +53,8 @@
#include "private/qabstractstate_p.h"
+#ifndef QT_NO_STATEMACHINE
+
#include <QtCore/qabstracttransition.h>
#include <QtCore/qhistorystate.h>
#include <QtCore/qlist.h>
@@ -93,4 +95,6 @@ protected:
QT_END_NAMESPACE
-#endif
+#endif // QT_NO_STATEMACHINE
+
+#endif // QHISTORYSTATE_P_H
diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h
index c0bb52c480..92b1ee3b70 100644
--- a/src/corelib/statemachine/qsignaleventgenerator_p.h
+++ b/src/corelib/statemachine/qsignaleventgenerator_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qobject.h>
QT_BEGIN_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/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index e3cfd7b988..db395b24dd 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -57,7 +57,7 @@
#include "private/qobject_p.h"
#include "private/qthread_p.h"
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
#include "qeventtransition.h"
#include "qeventtransition_p.h"
#endif
@@ -2196,7 +2196,7 @@ void QStateMachinePrivate::maybeRegisterTransition(QAbstractTransition *transiti
if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
maybeRegisterSignalTransition(st);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
else if (QEventTransition *et = qobject_cast<QEventTransition*>(transition)) {
maybeRegisterEventTransition(et);
}
@@ -2208,7 +2208,7 @@ void QStateMachinePrivate::registerTransition(QAbstractTransition *transition)
if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
registerSignalTransition(st);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) {
registerEventTransition(oet);
}
@@ -2220,7 +2220,7 @@ void QStateMachinePrivate::unregisterTransition(QAbstractTransition *transition)
if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
unregisterSignalTransition(st);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) {
unregisterEventTransition(oet);
}
@@ -2342,7 +2342,7 @@ void QStateMachinePrivate::unregisterAllTransitions()
}
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
void QStateMachinePrivate::maybeRegisterEventTransition(QEventTransition *transition)
{
if ((state == Running) && configuration.contains(transition->sourceState()))
@@ -2872,7 +2872,7 @@ bool QStateMachine::event(QEvent *e)
return QState::event(e);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
/*!
\reimp
*/
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 843844e172..031d9ceee2 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -141,7 +141,7 @@ public:
QSet<QAbstractState*> configuration() const;
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
#endif
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index 1305558ef8..45634e27fb 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -66,7 +66,7 @@
QT_BEGIN_NAMESPACE
class QEvent;
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
class QEventTransition;
#endif
class QSignalEventGenerator;
@@ -186,7 +186,7 @@ public:
void registerSignalTransition(QSignalTransition *transition);
void unregisterSignalTransition(QSignalTransition *transition);
void registerMultiThreadedSignalTransitions();
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
void maybeRegisterEventTransition(QEventTransition *transition);
void registerEventTransition(QEventTransition *transition);
void unregisterEventTransition(QEventTransition *transition);
@@ -301,7 +301,7 @@ public:
QHash<const QObject*, QVector<int> > connections;
QMutex connectionsMutex;
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
QHash<QObject*, QHash<QEvent::Type, int> > qobjectEvents;
#endif
QFreeList<void> delayedEventIdFreeList;
diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri
index c5396a2ef8..52df10a3bc 100644
--- a/src/corelib/statemachine/statemachine.pri
+++ b/src/corelib/statemachine/statemachine.pri
@@ -22,8 +22,10 @@ SOURCES += $$PWD/qstatemachine.cpp \
$$PWD/qabstracttransition.cpp \
$$PWD/qsignaltransition.cpp
-!contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) {
-HEADERS += $$PWD/qeventtransition.h \
- $$PWD/qeventtransition_p.h
-SOURCES += $$PWD/qeventtransition.cpp
+qtConfig(qeventtransition) {
+ HEADERS += \
+ $$PWD/qeventtransition.h \
+ $$PWD/qeventtransition_p.h
+ SOURCES += \
+ $$PWD/qeventtransition.cpp
}
diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h
index 7ae5c68bb9..1f0c747f40 100644
--- a/src/corelib/thread/qfuture.h
+++ b/src/corelib/thread/qfuture.h
@@ -65,13 +65,7 @@ public:
explicit QFuture(QFutureInterface<T> *p) // internal
: d(*p)
{ }
- QFuture(const QFuture &other)
- : d(other.d)
- { }
- ~QFuture()
- { }
- inline QFuture &operator=(const QFuture &other);
bool operator==(const QFuture &other) const { return (d == other.d); }
bool operator!=(const QFuture &other) const { return (d != other.d); }
@@ -157,13 +151,6 @@ public: // Warning: the d pointer is not documented and is considered private.
};
template <typename T>
-inline QFuture<T> &QFuture<T>::operator=(const QFuture<T> &other)
-{
- d = other.d;
- return *this;
-}
-
-template <typename T>
inline T QFuture<T>::result() const
{
d.waitForResult(0);
@@ -195,13 +182,7 @@ public:
explicit QFuture(QFutureInterfaceBase *p) // internal
: d(*p)
{ }
- QFuture(const QFuture &other)
- : d(other.d)
- { }
- ~QFuture()
- { }
- QFuture &operator=(const QFuture &other);
bool operator==(const QFuture &other) const { return (d == other.d); }
bool operator!=(const QFuture &other) const { return (d != other.d); }
@@ -248,12 +229,6 @@ public:
mutable QFutureInterfaceBase d;
};
-inline QFuture<void> &QFuture<void>::operator=(const QFuture<void> &other)
-{
- d = other.d;
- return *this;
-}
-
inline QFuture<void> QFutureInterface<void>::future()
{
return QFuture<void>(this);
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 1787ff3b93..559d26e231 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -285,21 +285,13 @@ template <>
class QFutureInterface<void> : public QFutureInterfaceBase
{
public:
- QFutureInterface<void>(State initialState = NoState)
+ explicit QFutureInterface<void>(State initialState = NoState)
: QFutureInterfaceBase(initialState)
{ }
- QFutureInterface<void>(const QFutureInterface<void> &other)
- : QFutureInterfaceBase(other)
- { }
static QFutureInterface<void> canceledResult()
{ return QFutureInterface(State(Started | Finished | Canceled)); }
- QFutureInterface<void> &operator=(const QFutureInterface<void> &other)
- {
- QFutureInterfaceBase::operator=(other);
- return *this;
- }
inline QFuture<void> future(); // implemented in qfuture.h
diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h
index f5f0e7047f..ee8dfe1354 100644
--- a/src/corelib/thread/qfutureinterface_p.h
+++ b/src/corelib/thread/qfutureinterface_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qelapsedtimer.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qlist.h>
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index 878a920ffc..366413e82e 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -264,6 +264,61 @@ bool QMutex::tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT
return lockInternal(timeout);
}
+/*! \fn bool QMutex::try_lock()
+ \since 5.8
+
+ This function is provided for compatibility with the Standard Library
+ concept \c Lockable. It is equivalent to tryLock().
+*/
+
+/*! \fn bool QMutex::try_lock_for(std::chrono::duration<Rep, Period> duration)
+ \since 5.8
+
+ Attempts to lock the mutex. This function returns \c true if the lock
+ was obtained; otherwise it returns \c false. If another thread has
+ locked the mutex, this function will wait for at most \a duration
+ for the mutex to become available.
+
+ Note: Passing a negative duration as the \a duration is equivalent to
+ calling try_lock(). This behavior is different from tryLock.
+
+ If the lock was obtained, the mutex must be unlocked with unlock()
+ before another thread can successfully lock it.
+
+ Calling this function multiple times on the same mutex from the
+ same thread is allowed if this mutex is a
+ \l{QMutex::Recursive}{recursive mutex}. If this mutex is a
+ \l{QMutex::NonRecursive}{non-recursive mutex}, this function will
+ \e always return false when attempting to lock the mutex
+ recursively.
+
+ \sa lock(), unlock()
+*/
+
+/*! \fn bool QMutex::try_lock_until(std::chrono::time_point<Clock, Duration> timePoint)
+ \since 5.8
+
+ Attempts to lock the mutex. This function returns \c true if the lock
+ was obtained; otherwise it returns \c false. If another thread has
+ locked the mutex, this function will wait at most until \a timePoint
+ for the mutex to become available.
+
+ Note: Passing a \a timePoint which has already passed is equivalent
+ to calling try_lock. This behavior is different from tryLock.
+
+ If the lock was obtained, the mutex must be unlocked with unlock()
+ before another thread can successfully lock it.
+
+ Calling this function multiple times on the same mutex from the
+ same thread is allowed if this mutex is a
+ \l{QMutex::Recursive}{recursive mutex}. If this mutex is a
+ \l{QMutex::NonRecursive}{non-recursive mutex}, this function will
+ \e always return false when attempting to lock the mutex
+ recursively.
+
+ \sa lock(), unlock()
+*/
+
/*! \fn void QMutex::unlock()
Unlocks the mutex. Attempting to unlock a mutex in a different
thread to the one that locked it results in an error. Unlocking a
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index a06bcd99ac..3a0e22e3bd 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -44,6 +44,10 @@
#include <QtCore/qatomic.h>
#include <new>
+#if QT_HAS_INCLUDE(<chrono>)
+# include <chrono>
+#endif
+
QT_BEGIN_NAMESPACE
@@ -60,11 +64,13 @@ class QMutexData;
class Q_CORE_EXPORT QBasicMutex
{
public:
+ // BasicLockable concept
inline void lock() QT_MUTEX_LOCK_NOEXCEPT {
if (!fastTryLock())
lockInternal();
}
+ // BasicLockable concept
inline void unlock() Q_DECL_NOTHROW {
Q_ASSERT(d_ptr.load()); //mutex must be locked
if (!fastTryUnlock())
@@ -75,6 +81,9 @@ public:
return fastTryLock();
}
+ // Lockable concept
+ bool try_lock() Q_DECL_NOTHROW { return tryLock(); }
+
bool isRecursive() Q_DECL_NOTHROW; //### Qt6: remove me
bool isRecursive() const Q_DECL_NOTHROW;
@@ -112,10 +121,41 @@ public:
explicit QMutex(RecursionMode mode = NonRecursive);
~QMutex();
+ // BasicLockable concept
void lock() QT_MUTEX_LOCK_NOEXCEPT;
bool tryLock(int timeout = 0) QT_MUTEX_LOCK_NOEXCEPT;
+ // BasicLockable concept
void unlock() Q_DECL_NOTHROW;
+ // Lockable concept
+ bool try_lock() QT_MUTEX_LOCK_NOEXCEPT { return tryLock(); }
+
+#if QT_HAS_INCLUDE(<chrono>)
+ // TimedLockable concept
+ template <class Rep, class Period>
+ bool try_lock_for(std::chrono::duration<Rep, Period> duration)
+ {
+ // N4606 § 30.4.1.3 [thread.timedmutex.requirements]/5 specifies that
+ // a duration less than or equal to duration.zero() shall result in a
+ // try_lock, unlike QMutex's tryLock with a negative duration which
+ // results in a lock.
+
+ if (duration <= duration.zero())
+ return tryLock(0);
+ return tryLock(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count());
+ }
+
+ // TimedLockable concept
+ template<class Clock, class Duration>
+ bool try_lock_until(std::chrono::time_point<Clock, Duration> timePoint)
+ {
+ // Implemented in terms of try_lock_for to honor the similar
+ // requirement in N4606 § 30.4.1.3 [thread.timedmutex.requirements]/12.
+
+ return try_lock_for(timePoint - Clock::now());
+ }
+#endif
+
bool isRecursive() const Q_DECL_NOTHROW
{ return QBasicMutex::isRecursive(); }
@@ -189,9 +229,26 @@ public:
inline void lock() Q_DECL_NOTHROW {}
inline bool tryLock(int timeout = 0) Q_DECL_NOTHROW { Q_UNUSED(timeout); return true; }
+ inline bool try_lock() Q_DECL_NOTHROW { return true; }
inline void unlock() Q_DECL_NOTHROW {}
inline bool isRecursive() const Q_DECL_NOTHROW { return true; }
+#if QT_HAS_INCLUDE(<chrono>) || defined(Q_QDOC)
+ template <class Rep, class Period>
+ inline bool try_lock_for(std::chrono::duration<Rep, Period> duration) Q_DECL_NOTHROW
+ {
+ Q_UNUSED(duration);
+ return true;
+ }
+
+ template<class Clock, class Duration>
+ inline bool try_lock_until(std::chrono::time_point<Clock, Duration> timePoint) Q_DECL_NOTHROW
+ {
+ Q_UNUSED(timePoint);
+ return true;
+ }
+#endif
+
private:
Q_DISABLE_COPY(QMutex)
};
diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h
index 20cc5f1f5e..4e6f522a37 100644
--- a/src/corelib/thread/qmutex_p.h
+++ b/src/corelib/thread/qmutex_p.h
@@ -54,7 +54,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qmutex.h>
#include <QtCore/qatomic.h>
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/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h
index 796e65d960..58d853b0e3 100644
--- a/src/corelib/thread/qmutexpool_p.h
+++ b/src/corelib/thread/qmutexpool_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QSettings. This header file may change from version to
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qatomic.h"
#include "QtCore/qmutex.h"
#include "QtCore/qvarlengtharray.h"
diff --git a/src/corelib/thread/qorderedmutexlocker_p.h b/src/corelib/thread/qorderedmutexlocker_p.h
index f54f7c705d..81c7c5268c 100644
--- a/src/corelib/thread/qorderedmutexlocker_p.h
+++ b/src/corelib/thread/qorderedmutexlocker_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qmutex.h>
#include <functional>
diff --git a/src/corelib/thread/qreadwritelock_p.h b/src/corelib/thread/qreadwritelock_p.h
index 24d25eb2be..bb58dfab56 100644
--- a/src/corelib/thread/qreadwritelock_p.h
+++ b/src/corelib/thread/qreadwritelock_p.h
@@ -52,7 +52,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qhash.h>
#include <QtCore/QWaitCondition>
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 4aac24f454..7118ad5c9b 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -403,7 +403,7 @@ QThread::QThread(QThreadPrivate &dd, QObject *parent)
Note that deleting a QThread object will not stop the execution
of the thread it manages. Deleting a running QThread (i.e.
- isFinished() returns \c false) will probably result in a program
+ isFinished() returns \c false) will result in a program
crash. Wait for the finished() signal before deleting the
QThread.
*/
@@ -418,7 +418,7 @@ QThread::~QThread()
locker.relock();
}
if (d->running && !d->finished && !d->data->isAdopted)
- qWarning("QThread: Destroyed while thread is still running");
+ qFatal("QThread: Destroyed while thread is still running");
d->data->thread = 0;
}
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index deedd61c17..ba5f2dca95 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -45,7 +45,7 @@
#include <private/qcoreapplication_p.h>
#include <private/qcore_unix_p.h>
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_DARWIN)
# include <private/qeventdispatcher_cf_p.h>
#else
# if !defined(QT_NO_GLIB)
@@ -279,7 +279,7 @@ typedef void*(*QtThreadCallback)(void*);
void QThreadPrivate::createEventDispatcher(QThreadData *data)
{
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_DARWIN)
bool ok = false;
int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);
if (ok && value > 0)
diff --git a/src/corelib/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.h b/src/corelib/thread/qwaitcondition.h
index d2e018834a..a0c6766833 100644
--- a/src/corelib/thread/qwaitcondition.h
+++ b/src/corelib/thread/qwaitcondition.h
@@ -65,6 +65,9 @@ public:
void wakeOne();
void wakeAll();
+ void notify_one() { wakeOne(); }
+ void notify_all() { wakeAll(); }
+
private:
Q_DISABLE_COPY(QWaitCondition)
diff --git a/src/corelib/thread/qwaitcondition.qdoc b/src/corelib/thread/qwaitcondition.qdoc
index d7de323922..eebc28f059 100644
--- a/src/corelib/thread/qwaitcondition.qdoc
+++ b/src/corelib/thread/qwaitcondition.qdoc
@@ -172,3 +172,18 @@
\sa wakeOne(), wakeAll()
*/
+
+
+/*! \fn void QWaitCondition::notify_one()
+ \since 5.8
+
+ This function is provided for STL compatibility. It is equivalent
+ to wakeOne().
+*/
+
+/*! \fn void QWaitCondition::notify_all()
+ \since 5.8
+
+ This function is provided for STL compatibility. It is equivalent
+ to wakeAll().
+*/
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..6e472e8b22 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,153 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera
#endif // QT_DEPRECATED_SINCE(5, 2)
-} //namespace QAlgorithmsPrivate
-
+#ifdef Q_CC_CLANG
+// Clang had a bug where __builtin_ctz/clz/popcount were not marked as constexpr.
+# if (defined __apple_build_version__ && __clang_major__ >= 7) || (Q_CC_CLANG >= 307)
+# define QT_HAS_CONSTEXPR_BUILTINS
+# endif
+#elif defined(Q_CC_MSVC) && !defined(Q_CC_INTEL) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM)
+# define QT_HAS_CONSTEXPR_BUILTINS
+#elif defined(Q_CC_GNU)
+# define QT_HAS_CONSTEXPR_BUILTINS
+#endif
-// 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) || defined(Q_CC_CLANG)
+# 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 +675,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 +685,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 +695,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 +719,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 +737,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 +752,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 +768,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 +784,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 +799,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 +811,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 +824,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 08a70a06c7..9298472305 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -4468,91 +4468,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/qbytedata_p.h b/src/corelib/tools/qbytedata_p.h
index b275158597..8331be112d 100644
--- a/src/corelib/tools/qbytedata_p.h
+++ b/src/corelib/tools/qbytedata_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <qbytearray.h>
QT_BEGIN_NAMESPACE
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/qcollator_p.h b/src/corelib/tools/qcollator_p.h
index a056fcc4af..fbbce00676 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qcollator.h"
#include <QVector>
#ifdef QT_USE_ICU
diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp
index 751e18c44e..c2b86014ba 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 to \a flags.
+
+ \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 7db0920a29..4c55880915 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>
@@ -297,7 +297,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()
*/
@@ -532,7 +534,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()
@@ -554,7 +556,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);
@@ -567,7 +569,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);
}
@@ -765,6 +767,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()))
@@ -1103,7 +1117,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;
@@ -1122,7 +1136,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 bfc7e1ca0e..f8611b3e68 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
*****************************************************************************/
@@ -1687,9 +1682,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;
@@ -1769,10 +1761,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;
}
@@ -1794,13 +1782,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();
}
@@ -2141,13 +2123,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();
@@ -2161,12 +2144,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;
@@ -2195,16 +2173,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;
@@ -2215,7 +2183,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,
@@ -2230,48 +2197,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
@@ -2333,7 +2258,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat
if (ok)
*ok = false;
}
-#endif // Q_OS_WINCE
return ((qint64)secsSinceEpoch * 1000) + msec;
}
@@ -2349,23 +2273,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();
@@ -2578,240 +2486,423 @@ 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 inline bool msecsCanBeSmall(qint64 msecs)
{
- setTimeSpec(toSpec, offsetSeconds);
- setDateTime(toDate, toTime);
+ if (!QDateTimeData::CanBeSmall)
+ return false;
+
+ ShortData sd;
+ sd.msecs = qintptr(msecs);
+ return sd.msecs == msecs;
}
-#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
+QDateTimePrivate::StatusFlags mergeSpec(QDateTimePrivate::StatusFlags status, Qt::TimeSpec spec)
{
- setDateTime(toDate, toTime);
+ return QDateTimePrivate::StatusFlags((status & ~QDateTimePrivate::TimeSpecMask) |
+ (int(spec) << QDateTimePrivate::TimeSpecShift));
+}
+
+static Q_DECL_CONSTEXPR inline Qt::TimeSpec extractSpec(QDateTimePrivate::StatusFlags status)
+{
+ return Qt::TimeSpec((status & QDateTimePrivate::TimeSpecMask) >> QDateTimePrivate::TimeSpecShift);
+}
+
+// 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)
+{
+ if (status & QDateTimePrivate::SetToDaylightTime)
+ return QDateTimePrivate::DaylightTime;
+ if (status & QDateTimePrivate::SetToStandardTime)
+ return QDateTimePrivate::StandardTime;
+ return QDateTimePrivate::UnknownDaylightTime;
}
-#endif // QT_BOOTSTRAPPED
-void QDateTimePrivate::setTimeSpec(Qt::TimeSpec spec, int offsetSeconds)
+static inline qint64 getMSecs(const QDateTimeData &d)
{
- clearValidDateTime();
- clearSetToDaylightStatus();
+ 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;
+ Q_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
+ if (msecsCanBeSmall(msecs)) {
+ // yes, we can
+ d.data.msecs = qintptr(msecs);
+ 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()
+{
+ // default-constructed data has a special exception:
+ // it can be small even if CanBeSmall == false
+ // (optimization so we don't allocate memory in the default constructor)
+ quintptr value = quintptr(mergeSpec(QDateTimePrivate::ShortData, Qt::LocalTime));
+ d = reinterpret_cast<QDateTimePrivate *>(value);
+}
+
+inline QDateTime::Data::Data(Qt::TimeSpec spec)
+{
+ if (CanBeSmall && Q_LIKELY(specCanBeSmall(spec))) {
+ d = reinterpret_cast<QDateTimePrivate *>(quintptr(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
+ if (specCanBeSmall(extractSpec(d->m_status)) && msecsCanBeSmall(d->m_msecs)) {
+ ShortData sd;
+ sd.msecs = qintptr(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));
+ // reset the other to a short state
+ Data dummy;
+ Q_ASSERT(dummy.isShort());
+ other.d = dummy.d;
+}
- case Qt::LocalTime: {
- // recalculate the local timezone
- DaylightStatus status = daylightStatus();
- return localMSecsToEpochMSecs(m_msecs, &status);
- }
+inline QDateTime::Data &QDateTime::Data::operator=(const Data &other)
+{
+ if (d == other.d)
+ return *this;
- case Qt::TimeZone:
-#ifdef QT_BOOTSTRAPPED
- return 0;
-#else
- return zoneMSecsToEpochMSecs(m_msecs, m_timeZone);
-#endif
+ auto x = d;
+ d = other.d;
+ if (!other.isShort()) {
+ // check if we could shrink
+ if (specCanBeSmall(extractSpec(other.d->m_status)) && msecsCanBeSmall(other.d->m_msecs)) {
+ ShortData sd;
+ sd.msecs = qintptr(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 (!(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;
- }
-
- // If not valid date and time then is invalid
- if (!isValidDate() || !isValidTime()) {
- clearValidDateTime();
- m_offsetFromUtc = 0;
- return;
- }
+ bool b = quintptr(d) & QDateTimePrivate::ShortData;
-#ifndef QT_BOOTSTRAPPED
- // If not valid time zone then is invalid
- if (m_spec == Qt::TimeZone && !m_timeZone.isValid()) {
- clearValidDateTime();
- m_offsetFromUtc = 0;
- return;
- }
-#endif // QT_BOOTSTRAPPED
+ // even if CanBeSmall = false, we have short data for a default-constructed
+ // QDateTime object. But it's unlikely.
+ if (CanBeSmall)
+ return Q_LIKELY(b);
+ return Q_UNLIKELY(b);
+}
- // 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;
+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 {
- clearValidDateTime();
- m_offsetFromUtc = 0;
+ if (d->ref.load() == 1)
+ return;
+
+ x = new QDateTimePrivate(*d);
}
+
+ 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);
@@ -2961,8 +3052,7 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
\sa isValid()
*/
-QDateTime::QDateTime()
- : d(*defaultDateTimePrivate())
+QDateTime::QDateTime() Q_DECL_NOEXCEPT_EXPR(Data::CanBeSmall)
{
}
@@ -2973,7 +3063,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))
{
}
@@ -2993,7 +3083,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))
{
}
@@ -3016,7 +3106,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))
{
}
@@ -3033,7 +3123,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
@@ -3041,13 +3131,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()
@@ -3059,7 +3158,7 @@ QDateTime::~QDateTime()
copy.
*/
-QDateTime &QDateTime::operator=(const QDateTime &other)
+QDateTime &QDateTime::operator=(const QDateTime &other) Q_DECL_NOTHROW
{
d = other.d;
return *this;
@@ -3081,7 +3180,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);
}
/*!
@@ -3098,7 +3199,8 @@ bool QDateTime::isNull() const
bool QDateTime::isValid() const
{
- return (d->isValidDateTime());
+ auto status = getStatus(d);
+ return status & QDateTimePrivate::ValidDateTime;
}
/*!
@@ -3109,10 +3211,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;
}
@@ -3124,10 +3227,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;
}
@@ -3139,7 +3243,7 @@ QTime QDateTime::time() const
Qt::TimeSpec QDateTime::timeSpec() const
{
- return d->m_spec;
+ return getSpec(d);
}
#ifndef QT_BOOTSTRAPPED
@@ -3157,7 +3261,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:
@@ -3192,7 +3296,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;
}
/*!
@@ -3218,7 +3335,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:
@@ -3227,12 +3344,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;
}
}
@@ -3252,7 +3369,7 @@ QString QDateTime::timeZoneAbbreviation() const
bool QDateTime::isDaylightTime() const
{
- switch (d->m_spec) {
+ switch (getSpec(d)) {
case Qt::UTC:
case Qt::OffsetFromUTC:
return false;
@@ -3263,9 +3380,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);
}
}
@@ -3281,7 +3398,7 @@ bool QDateTime::isDaylightTime() const
void QDateTime::setDate(const QDate &date)
{
- d->setDateTime(date, time());
+ setDateTime(d, date, time());
}
/*!
@@ -3299,7 +3416,7 @@ void QDateTime::setDate(const QDate &date)
void QDateTime::setTime(const QTime &time)
{
- d->setDateTime(date(), time);
+ setDateTime(d, date(), time);
}
/*!
@@ -3320,9 +3437,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);
}
/*!
@@ -3342,9 +3458,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
@@ -3361,11 +3476,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
@@ -3382,44 +3497,85 @@ void QDateTime::setTimeZone(const QTimeZone &toZone)
this object is not valid. However, for all valid dates, this function
returns a unique value.
- \sa toTime_t(), setMSecsSinceEpoch()
+ \sa toSecsSinceEpoch(), setMSecsSinceEpoch()
*/
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
+ return 0;
+#else
+ return QDateTimePrivate::zoneMSecsToEpochMSecs(d->m_msecs, d->m_timeZone);
+#endif
+ }
+ Q_UNREACHABLE();
+ return 0;
+}
+
+/*!
+ \since 5.8
+
+ Returns the datetime as the number of seconds that have passed since
+ 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC).
+
+ On systems that do not support time zones, this function will
+ behave as if local time were Qt::UTC.
+
+ The behavior for this function is undefined if the datetime stored in
+ this object is not valid. However, for all valid dates, this function
+ returns a unique value.
+
+ \sa toMSecsSinceEpoch(), setSecsSinceEpoch()
+*/
+qint64 QDateTime::toSecsSinceEpoch() const
+{
+ return toMSecsSinceEpoch() / 1000;
}
+#if QT_DEPRECATED_SINCE(5, 8)
/*!
+ \deprecated
+
Returns the datetime as the number of seconds that have passed
since 1970-01-01T00:00:00, Coordinated Universal Time (Qt::UTC).
On systems that do not support time zones, this function will
behave as if local time were Qt::UTC.
- \note This function returns a 32-bit unsigned integer, so it does not
- support dates before 1970, but it does support dates after
- 2038-01-19T03:14:06, which may not be valid time_t values. Be careful
- when passing those time_t values to system functions, which could
- interpret them as negative dates.
+ \note This function returns a 32-bit unsigned integer and is deprecated.
If the date is outside the range 1970-01-01T00:00:00 to
2106-02-07T06:28:14, this function returns -1 cast to an unsigned integer
(i.e., 0xFFFFFFFF).
- To get an extended range, use toMSecsSinceEpoch().
+ To get an extended range, use toMSecsSinceEpoch() or toSecsSinceEpoch().
- \sa toMSecsSinceEpoch(), setTime_t()
+ \sa toSecsSinceEpoch(), toMSecsSinceEpoch(), setTime_t()
*/
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);
}
+#endif
/*!
\since 4.7
@@ -3433,65 +3589,98 @@ uint QDateTime::toTime_t() const
(\c{std::numeric_limits<qint64>::min()}) to \a msecs will result in
undefined behavior.
- \sa toMSecsSinceEpoch(), setTime_t()
+ \sa toMSecsSinceEpoch(), setSecsSinceEpoch()
*/
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;
}
}
+
+ if (msecsCanBeSmall(msecs) && d.isShort()) {
+ // we can keep short
+ d.data.msecs = qintptr(msecs);
+ d.data.status = status;
+ } else {
+ d.detach();
+ d->m_status = status;
+ d->m_msecs = msecs;
+ }
+
+ if (spec == Qt::LocalTime || spec == Qt::TimeZone)
+ refreshDateTime(d);
}
/*!
+ \since 5.8
+
+ Sets the date and time given the number of seconds \a secs that have
+ passed since 1970-01-01T00:00:00.000, Coordinated Universal Time
+ (Qt::UTC). On systems that do not support time zones this function
+ will behave as if local time were Qt::UTC.
+
+ \sa toSecsSinceEpoch(), setMSecsSinceEpoch()
+*/
+void QDateTime::setSecsSinceEpoch(qint64 secs)
+{
+ setMSecsSinceEpoch(secs * 1000);
+}
+
+#if QT_DEPRECATED_SINCE(5, 8)
+/*!
\fn void QDateTime::setTime_t(uint seconds)
+ \deprecated
Sets the date and time given the number of \a seconds that have
passed since 1970-01-01T00:00:00, Coordinated Universal Time
(Qt::UTC). On systems that do not support time zones this function
will behave as if local time were Qt::UTC.
+ \note This function is deprecated. For new code, use setSecsSinceEpoch().
+
\sa toTime_t()
*/
@@ -3499,6 +3688,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
{
setMSecsSinceEpoch((qint64)secsSince1Jan1970UTC * 1000);
}
+#endif
#ifndef QT_NO_DATESTRING
/*!
@@ -3569,13 +3759,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
@@ -3586,14 +3776,14 @@ QString QDateTime::toString(Qt::DateFormat format) const
.arg(dt.year());
if (timeSpec() != Qt::LocalTime) {
buf += QLatin1String(" 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);
@@ -3601,12 +3791,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;
@@ -3695,12 +3885,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
@@ -3710,24 +3895,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
@@ -3746,12 +3927,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;
}
@@ -3772,12 +3953,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;
}
@@ -3798,15 +3979,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
@@ -3838,12 +4018,26 @@ 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;
+ if (msecsCanBeSmall(msecs)) {
+ dt.d.data.msecs = qintptr(msecs);
+ } else {
+ dt.d.detach();
+ dt.d->m_msecs = msecs;
+ }
+ } else {
+ dt.d.detach();
+ dt.d->m_msecs += msecs;
+ }
+ }
return dt;
}
@@ -3909,7 +4103,7 @@ qint64 QDateTime::msecsTo(const QDateTime &other) const
if (!isValid() || !other.isValid())
return 0;
- return other.d->toMSecsSinceEpoch() - d->toMSecsSinceEpoch();
+ return other.toMSecsSinceEpoch() - toMSecsSinceEpoch();
}
/*!
@@ -3932,7 +4126,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()) {
@@ -3941,7 +4135,7 @@ QDateTime QDateTime::toTimeSpec(Qt::TimeSpec spec) const
return ret;
}
- return fromMSecsSinceEpoch(d->toMSecsSinceEpoch(), spec, 0);
+ return fromMSecsSinceEpoch(toMSecsSinceEpoch(), spec, 0);
}
/*!
@@ -3959,7 +4153,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()) {
@@ -3968,7 +4163,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
@@ -3982,7 +4177,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()) {
@@ -3991,7 +4186,7 @@ QDateTime QDateTime::toTimeZone(const QTimeZone &timeZone) const
return ret;
}
- return fromMSecsSinceEpoch(d->toMSecsSinceEpoch(), timeZone);
+ return fromMSecsSinceEpoch(toMSecsSinceEpoch(), timeZone);
}
#endif // QT_BOOTSTRAPPED
@@ -4004,10 +4199,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());
@@ -4032,10 +4226,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());
@@ -4090,6 +4283,16 @@ bool QDateTime::operator<(const QDateTime &other) const
\sa currentDateTime(), currentDateTimeUtc(), toTime_t(), toTimeSpec()
*/
+/*!
+ \fn qint64 QDateTime::currentSecsSinceEpoch()
+ \since 5.8
+
+ Returns the number of seconds since 1970-01-01T00:00:00 Universal
+ Coordinated Time.
+
+ \sa currentMSecsSinceEpoch()
+*/
+
#if defined(Q_OS_WIN)
static inline uint msecsFromDecomposed(int hour, int minute, int sec, int msec = 0)
{
@@ -4113,9 +4316,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;
}
@@ -4154,6 +4354,17 @@ qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW
- julianDayFromDate(1970, 1, 1)) * Q_INT64_C(86400000);
}
+qint64 QDateTime::currentSecsSinceEpoch() Q_DECL_NOTHROW
+{
+ SYSTEMTIME st;
+ memset(&st, 0, sizeof(SYSTEMTIME));
+ GetSystemTime(&st);
+
+ return st.wHour * SECS_PER_HOUR + st.wMinute * SECS_PER_MIN + st.wSecond +
+ qint64(julianDayFromDate(st.wYear, st.wMonth, st.wDay)
+ - julianDayFromDate(1970, 1, 1)) * Q_INT64_C(86400);
+}
+
#elif defined(Q_OS_UNIX)
QDate QDate::currentDate()
{
@@ -4184,51 +4395,29 @@ qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW
return qint64(tv.tv_sec) * Q_INT64_C(1000) + tv.tv_usec / 1000;
}
+qint64 QDateTime::currentSecsSinceEpoch() Q_DECL_NOTHROW
+{
+ struct timeval tv;
+ gettimeofday(&tv, 0);
+ return qint64(tv.tv_sec);
+}
#else
#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()
-*/
-
+#if QT_DEPRECATED_SINCE(5, 8)
/*!
\since 4.2
+ \deprecated
Returns a datetime whose date and time are the number of \a seconds
that have passed since 1970-01-01T00:00:00, Coordinated Universal
Time (Qt::UTC) and converted to Qt::LocalTime. On systems that do not
support time zones, the time will be set as if local time were Qt::UTC.
+ \note This function is deprecated. Please use fromSecsSinceEpoch() in new
+ code.
+
\sa toTime_t(), setTime_t()
*/
QDateTime QDateTime::fromTime_t(uint seconds)
@@ -4238,6 +4427,7 @@ QDateTime QDateTime::fromTime_t(uint seconds)
/*!
\since 5.2
+ \deprecated
Returns a datetime whose date and time are the number of \a seconds
that have passed since 1970-01-01T00:00:00, Coordinated Universal
@@ -4247,6 +4437,9 @@ QDateTime QDateTime::fromTime_t(uint seconds)
ignored. If the \a spec is Qt::OffsetFromUTC and the \a offsetSeconds is 0
then the spec will be set to Qt::UTC, i.e. an offset of 0 seconds.
+ \note This function is deprecated. Please use fromSecsSinceEpoch() in new
+ code.
+
\sa toTime_t(), setTime_t()
*/
QDateTime QDateTime::fromTime_t(uint seconds, Qt::TimeSpec spec, int offsetSeconds)
@@ -4257,11 +4450,15 @@ QDateTime QDateTime::fromTime_t(uint seconds, Qt::TimeSpec spec, int offsetSecon
#ifndef QT_BOOTSTRAPPED
/*!
\since 5.2
+ \deprecated
Returns a datetime whose date and time are the number of \a seconds
that have passed since 1970-01-01T00:00:00, Coordinated Universal
Time (Qt::UTC) and with the given \a timeZone.
+ \note This function is deprecated. Please use fromSecsSinceEpoch() in new
+ code.
+
\sa toTime_t(), setTime_t()
*/
QDateTime QDateTime::fromTime_t(uint seconds, const QTimeZone &timeZone)
@@ -4269,6 +4466,7 @@ QDateTime QDateTime::fromTime_t(uint seconds, const QTimeZone &timeZone)
return fromMSecsSinceEpoch((qint64)seconds * 1000, timeZone);
}
#endif
+#endif // QT_DEPRECATED_SINCE(5, 8)
/*!
\since 4.7
@@ -4282,7 +4480,7 @@ QDateTime QDateTime::fromTime_t(uint seconds, const QTimeZone &timeZone)
range of QDateTime, both negative and positive. The behavior of this
function is undefined for those values.
- \sa toTime_t(), setTime_t()
+ \sa toMSecsSinceEpoch(), setMSecsSinceEpoch()
*/
QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs)
{
@@ -4307,16 +4505,41 @@ QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs)
If \a spec is Qt::TimeZone then the spec will be set to Qt::LocalTime,
i.e. the current system time zone.
- \sa fromTime_t()
+ \sa toMSecsSinceEpoch(), setMSecsSinceEpoch()
*/
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;
}
+/*!
+ \since 5.8
+
+ Returns a datetime whose date and time are the number of seconds \a secs
+ that have passed since 1970-01-01T00:00:00.000, Coordinated Universal
+ Time (Qt::UTC) and converted to the given \a spec.
+
+ Note that there are possible values for \a secs that lie outside the valid
+ range of QDateTime, both negative and positive. The behavior of this
+ function is undefined for those values.
+
+ If the \a spec is not Qt::OffsetFromUTC then the \a offsetSeconds will be
+ ignored. If the \a spec is Qt::OffsetFromUTC and the \a offsetSeconds is 0
+ then the spec will be set to Qt::UTC, i.e. an offset of 0 seconds.
+
+ If \a spec is Qt::TimeZone then the spec will be set to Qt::LocalTime,
+ i.e. the current system time zone.
+
+ \sa toSecsSinceEpoch(), setSecsSinceEpoch()
+*/
+QDateTime QDateTime::fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec, int offsetSeconds)
+{
+ return fromMSecsSinceEpoch(secs * 1000, spec, offsetSeconds);
+}
+
#ifndef QT_BOOTSTRAPPED
/*!
\since 5.2
@@ -4325,7 +4548,7 @@ QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int of
that have passed since 1970-01-01T00:00:00.000, Coordinated Universal
Time (Qt::UTC) and with the given \a timeZone.
- \sa fromTime_t()
+ \sa fromSecsSinceEpoch()
*/
QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone)
{
@@ -4334,6 +4557,20 @@ QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone
dt.setMSecsSinceEpoch(msecs);
return dt;
}
+
+/*!
+ \since 5.8
+
+ Returns a datetime whose date and time are the number of seconds \a secs
+ that have passed since 1970-01-01T00:00:00.000, Coordinated Universal
+ Time (Qt::UTC) and with the given \a timeZone.
+
+ \sa fromMSecsSinceEpoch()
+*/
+QDateTime QDateTime::fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone)
+{
+ return fromMSecsSinceEpoch(secs * 1000, timeZone);
+}
#endif
#if QT_DEPRECATED_SINCE(5, 2)
@@ -4831,7 +5068,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());
@@ -4846,13 +5083,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:
@@ -4872,7 +5109,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 f292a97db1..ebf9b45570 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,46 @@ 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();
+ 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 +256,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;
@@ -252,8 +281,7 @@ public:
bool isDaylightTime() const;
qint64 toMSecsSinceEpoch() const;
- // ### Qt 6: use quint64 instead of uint
- uint toTime_t() const;
+ qint64 toSecsSinceEpoch() const;
void setDate(const QDate &date);
void setTime(const QTime &time);
@@ -263,8 +291,7 @@ public:
void setTimeZone(const QTimeZone &toZone);
#endif // QT_BOOTSTRAPPED
void setMSecsSinceEpoch(qint64 msecs);
- // ### Qt 6: use quint64 instead of uint
- void setTime_t(uint secsSince1Jan1970UTC);
+ void setSecsSinceEpoch(qint64 secs);
#ifndef QT_NO_DATESTRING
QString toString(Qt::DateFormat f = Qt::TextDate) const;
@@ -306,38 +333,40 @@ public:
static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate);
static QDateTime fromString(const QString &s, const QString &format);
#endif
- // ### Qt 6: use quint64 instead of uint
+
+#if QT_DEPRECATED_SINCE(5, 8)
+ uint toTime_t() const;
+ void setTime_t(uint secsSince1Jan1970UTC);
static QDateTime fromTime_t(uint secsSince1Jan1970UTC);
- // ### Qt 6: Merge with above with default spec = Qt::LocalTime
static QDateTime fromTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec,
int offsetFromUtc = 0);
-#ifndef QT_BOOTSTRAPPED
static QDateTime fromTime_t(uint secsSince1Jan1970UTC, const QTimeZone &timeZone);
#endif
+
static QDateTime fromMSecsSinceEpoch(qint64 msecs);
// ### Qt 6: Merge with above with default spec = Qt::LocalTime
static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetFromUtc = 0);
+ static QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spe = Qt::LocalTime, int offsetFromUtc = 0);
+
#ifndef QT_BOOTSTRAPPED
static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone);
+ static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone);
#endif
+
static qint64 currentMSecsSinceEpoch() Q_DECL_NOTHROW;
+ static qint64 currentSecsSinceEpoch() 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_p.h b/src/corelib/tools/qdatetime_p.h
index 104cbccbd4..38a084b257 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.
@@ -51,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qplatformdefs.h"
#include "QtCore/qatomic.h"
#include "QtCore/qdatetime.h"
@@ -60,9 +62,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 +82,6 @@ public:
// Daylight Time Status
enum DaylightStatus {
- NoDaylightTime = -2,
UnknownDaylightTime = -1,
StandardTime = 0,
DaylightTime = 1
@@ -84,62 +89,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/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 36ab93df1e..3271e2a8c4 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -602,7 +602,7 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
return 2;
#else
mcount = 7;
- // fall through
+ Q_FALLTHROUGH();
#endif
case MonthSection:
#ifdef QT_NO_TEXTDATE
@@ -770,7 +770,8 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
state = Intermediate;
}
break;
- } // else: fall through
+ }
+ Q_FALLTHROUGH();
case DaySection:
case YearSection:
case YearSection2Digits:
@@ -1155,7 +1156,7 @@ end:
done = true;
break;
}
- // fallthrough
+ Q_FALLTHROUGH();
default: {
int toMin;
int toMax;
@@ -1489,7 +1490,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
switch (sn.type) {
case MSecSection:
ret |= Fraction;
- // fallthrough
+ Q_FALLTHROUGH();
case SecondSection:
case MinuteSection:
case Hour24Section:
@@ -1509,7 +1510,7 @@ QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const
switch (sn.count) {
case 2:
ret |= FixedWidth;
- // fallthrough
+ Q_FALLTHROUGH();
case 1:
ret |= (Numeric|AllowPartial);
break;
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index 01a2f20802..6f381965a9 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "qplatformdefs.h"
#include "QtCore/qatomic.h"
#include "QtCore/qdatetime.h"
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index ebe34bc135..c3efc41d62 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qatomic.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qharfbuzz_p.h b/src/corelib/tools/qharfbuzz_p.h
index cc4d9bbd85..2a0307d35f 100644
--- a/src/corelib/tools/qharfbuzz_p.h
+++ b/src/corelib/tools/qharfbuzz_p.h
@@ -48,6 +48,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
#ifndef QHARFBUZZ_P_H
#define QHARFBUZZ_P_H
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 593a87e65d..abec9ebb79 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -2644,4 +2644,24 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHash::constFind()
*/
+/*!
+ \fn uint qHash(const QHash<Key, T> &key, uint seed = 0)
+ \since 5.8
+ \relates QHash
+
+ Returns the hash value for the \a key, using \a seed to seed the calculation.
+
+ Type \c T must be supported by qHash().
+*/
+
+/*!
+ \fn uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
+ \since 5.8
+ \relates QMultiHash
+
+ Returns the hash value for the \a key, using \a seed to seed the calculation.
+
+ Type \c T must be supported by qHash().
+*/
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 7abbeabeae..6a2d7bdd11 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -1095,6 +1095,27 @@ Q_INLINE_TEMPLATE int QMultiHash<Key, T>::count(const Key &key, const T &value)
Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash)
Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash)
+template <class Key, class T>
+uint qHash(const QHash<Key, T> &key, uint seed = 0)
+ Q_DECL_NOEXCEPT_EXPR(noexcept(qHash(std::declval<Key&>())) && noexcept(qHash(std::declval<T&>())))
+{
+ QtPrivate::QHashCombineCommutative hash;
+ for (auto it = key.begin(), end = key.end(); it != end; ++it) {
+ const Key &k = it.key();
+ const T &v = it.value();
+ seed = hash(seed, std::pair<const Key&, const T&>(k, v));
+ }
+ return seed;
+}
+
+template <class Key, class T>
+inline uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
+ Q_DECL_NOEXCEPT_EXPR(noexcept(qHash(std::declval<Key&>())) && noexcept(qHash(std::declval<T&>())))
+{
+ const QHash<Key, T> &key2 = key;
+ return qHash(key2, seed);
+}
+
QT_END_NAMESPACE
#if defined(Q_CC_MSVC)
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/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 838965c4e7..249f76dafd 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -136,8 +136,12 @@ public:
Node *i;
inline iterator() : i(Q_NULLPTR) {}
inline iterator(Node *n) : i(n) {}
- inline iterator(const iterator &o) : i(o.i) {}
- inline iterator &operator=(const iterator &o) { i = o.i; return *this; }
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {}
+ iterator &operator=(const iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
+ iterator(iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
+ iterator &operator=(iterator &&other) Q_DECL_NOTHROW { return *this = other; }
+#endif
inline T &operator*() const { return i->t; }
inline T *operator->() const { return &i->t; }
inline bool operator==(const iterator &o) const { return i == o.i; }
@@ -169,9 +173,13 @@ public:
Node *i;
inline const_iterator() : i(Q_NULLPTR) {}
inline const_iterator(Node *n) : i(n) {}
- inline const_iterator(const const_iterator &o) : i(o.i){}
inline const_iterator(iterator ci) : i(ci.i){}
- inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; }
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ const_iterator(const const_iterator &other) Q_DECL_NOTHROW : i(other.i) {}
+ const_iterator &operator=(const const_iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
+ const_iterator(const_iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
+ const_iterator &operator=(const_iterator &&other) Q_DECL_NOTHROW { return *this = other; }
+#endif
inline const T &operator*() const { return i->t; }
inline const T *operator->() const { return &i->t; }
inline bool operator==(const const_iterator &o) const { return i == o.i; }
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_data_p.h b/src/corelib/tools/qlocale_data_p.h
index 262cecb564..869153942e 100644
--- a/src/corelib/tools/qlocale_data_p.h
+++ b/src/corelib/tools/qlocale_data_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_NAMESPACE
/* This part of the file isn't generated, but written by hand since
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_p.h b/src/corelib/tools/qlocale_p.h
index f95edf4d14..c83c9d3333 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include "QtCore/qstring.h"
#include "QtCore/qvarlengtharray.h"
#include "QtCore/qvariant.h"
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index 9d2db61a11..b5f97b5fe8 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
@@ -60,20 +57,20 @@
#include <wrl.h>
#include <windows.foundation.h>
#include <windows.foundation.collections.h>
-#include <windows.globalization.h>
+#include <windows.system.userprofile.h>
#endif // Q_OS_WINRT
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
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
+using namespace ABI::Windows::System::UserProfile;
static QByteArray getWinLocaleName(LPWSTR id = LOCALE_NAME_USER_DEFAULT);
static const char *winLangCodeToIsoName(int code);
@@ -600,62 +597,45 @@ 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;
- if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Globalization_ApplicationLanguages).Get(), &appLanguagesStatics))) {
+
+ ComPtr<IGlobalizationPreferencesStatics> preferences;
+ HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_System_UserProfile_GlobalizationPreferences).Get(), &preferences);
+ if (FAILED(hr)) {
qWarning("Could not obtain ApplicationLanguagesStatic");
return QStringList();
}
ComPtr<ABI::Windows::Foundation::Collections::IVectorView<HSTRING> > languageList;
- // Languages is a ranked list of "long names" (e.g. en-US) of preferred languages, which matches
- // languages from the manifest with languages from the user's system.
- HRESULT hr = appLanguagesStatics->get_Languages(&languageList);
+ // Languages is a ranked list of "long names" (e.g. en-US) of preferred languages
+ hr = preferences->get_Languages(&languageList);
Q_ASSERT_SUCCEEDED(hr);
unsigned int size;
hr = languageList->get_Size(&size);
@@ -670,36 +650,6 @@ QVariant QSystemLocalePrivate::uiLanguages()
result << QString::fromWCharArray(rawString, length);
}
- // ManifestLanguages covers all languages given in the manifest and uses short names (like "en").
- hr = appLanguagesStatics->get_ManifestLanguages(&languageList);
- Q_ASSERT_SUCCEEDED(hr);
- hr = languageList->get_Size(&size);
- Q_ASSERT_SUCCEEDED(hr);
- for (unsigned int i = 0; i < size; ++i) {
- HString language;
- hr = languageList->GetAt(i, language.GetAddressOf());
- Q_ASSERT_SUCCEEDED(hr);
- UINT32 length;
- PCWSTR rawString = language.GetRawBuffer(&length);
- const QString qLanguage = QString::fromWCharArray(rawString, length);
- bool found = false;
- // Since ApplicationLanguages:::Languages uses long names, we compare the "pre-dash" part of
- // the language and filter it out, if it is already covered by a more specialized form.
- for (const QString &lang : qAsConst(result)) {
- int dashIndex = lang.indexOf('-');
- // There will not be any long name after the first short name was found, so we can stop.
- if (dashIndex == -1)
- break;
-
- if (lang.leftRef(dashIndex) == qLanguage) {
- found = true;
- break;
- }
- }
- if (!found)
- result << qLanguage;
- }
-
return result;
#endif // Q_OS_WINRT
}
@@ -1160,19 +1110,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();
@@ -1180,7 +1127,6 @@ static QByteArray getWinLocaleName(LPWSTR id)
result += '_';
result += country.toLatin1();
}
-#endif // !Q_OS_WINCE
return result;
}
diff --git a/src/corelib/tools/qpodlist_p.h b/src/corelib/tools/qpodlist_p.h
index 810df02000..95990e0bb6 100644
--- a/src/corelib/tools/qpodlist_p.h
+++ b/src/corelib/tools/qpodlist_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qvarlengtharray.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index 4e2e6b91a6..7b1004897a 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) || defined(Q_QDOC)
+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..f973cf3494 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) || defined(Q_QDOC)
+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/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index f8f3347786..96ddca56af 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -3011,7 +3011,7 @@ int QRegExpEngine::getEscape()
case 'I':
if (xmlSchemaExtensions) {
yyCharClass->setNegative(!yyCharClass->negative());
- // fall through
+ Q_FALLTHROUGH();
} else {
break;
}
@@ -3051,7 +3051,7 @@ int QRegExpEngine::getEscape()
case 'C':
if (xmlSchemaExtensions) {
yyCharClass->setNegative(!yyCharClass->negative());
- // fall through
+ Q_FALLTHROUGH();
} else {
break;
}
@@ -3097,7 +3097,7 @@ int QRegExpEngine::getEscape()
case 'P':
if (xmlSchemaExtensions) {
yyCharClass->setNegative(!yyCharClass->negative());
- // fall through
+ Q_FALLTHROUGH();
} else {
break;
}
diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp
index 4a2dfdec2b..cb11e72435 100644
--- a/src/corelib/tools/qringbuffer.cpp
+++ b/src/corelib/tools/qringbuffer.cpp
@@ -108,24 +108,25 @@ char *QRingBuffer::reserve(qint64 bytes)
if (bytes <= 0 || bytes >= MaxByteArraySize)
return 0;
- if (buffers.isEmpty()) {
- buffers.append(QByteArray());
- buffers.first().resize(qMax(basicBlockSize, int(bytes)));
+ if (bufferSize == 0) {
+ if (buffers.isEmpty())
+ buffers.append(QByteArray(qMax(basicBlockSize, int(bytes)), Qt::Uninitialized));
+ else
+ buffers.first().resize(qMax(basicBlockSize, int(bytes)));
} else {
const qint64 newSize = bytes + tail;
- // if need buffer reallocation
- if (newSize > buffers.constLast().size()) {
- if (newSize > buffers.constLast().capacity() && (tail >= basicBlockSize
- || newSize >= MaxByteArraySize)) {
- // shrink this buffer to its current size
- buffers.last().resize(tail);
-
- // create a new QByteArray
- buffers.append(QByteArray());
- ++tailBuffer;
- tail = 0;
- }
- buffers.last().resize(qMax(basicBlockSize, tail + int(bytes)));
+ // if need a new buffer
+ if (basicBlockSize == 0 || (newSize > buffers.constLast().capacity()
+ && (tail >= basicBlockSize || newSize >= MaxByteArraySize))) {
+ // shrink this buffer to its current size
+ buffers.last().resize(tail);
+
+ // create a new QByteArray
+ buffers.append(QByteArray(qMax(basicBlockSize, int(bytes)), Qt::Uninitialized));
+ ++tailBuffer;
+ tail = 0;
+ } else if (newSize > buffers.constLast().size()) {
+ buffers.last().resize(qMax(basicBlockSize, int(newSize)));
}
}
@@ -146,10 +147,8 @@ char *QRingBuffer::reserveFront(qint64 bytes)
if (bytes <= 0 || bytes >= MaxByteArraySize)
return 0;
- if (head < bytes) {
- if (buffers.isEmpty()) {
- buffers.append(QByteArray());
- } else {
+ if (head < bytes || basicBlockSize == 0) {
+ if (head > 0) {
buffers.first().remove(0, head);
if (tailBuffer == 0)
tail -= head;
@@ -157,12 +156,15 @@ char *QRingBuffer::reserveFront(qint64 bytes)
head = qMax(basicBlockSize, int(bytes));
if (bufferSize == 0) {
+ if (buffers.isEmpty())
+ buffers.prepend(QByteArray(head, Qt::Uninitialized));
+ else
+ buffers.first().resize(head);
tail = head;
} else {
- buffers.prepend(QByteArray());
+ buffers.prepend(QByteArray(head, Qt::Uninitialized));
++tailBuffer;
}
- buffers.first().resize(head);
}
head -= int(bytes);
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h
index 9ff1ec49cf..325b71f267 100644
--- a/src/corelib/tools/qringbuffer_p.h
+++ b/src/corelib/tools/qringbuffer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qlist.h>
@@ -66,6 +67,14 @@ public:
explicit inline QRingBuffer(int growth = QRINGBUFFER_CHUNKSIZE) :
head(0), tail(0), tailBuffer(0), basicBlockSize(growth), bufferSize(0) { }
+ inline void setChunkSize(int size) {
+ basicBlockSize = size;
+ }
+
+ inline int chunkSize() const {
+ return basicBlockSize;
+ }
+
inline qint64 nextDataBlockSize() const {
return (tailBuffer == 0 ? tail : buffers.first().size()) - head;
}
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/qscopedpointer_p.h b/src/corelib/tools/qscopedpointer_p.h
index f74a3a7945..c1c44e7695 100644
--- a/src/corelib/tools/qscopedpointer_p.h
+++ b/src/corelib/tools/qscopedpointer_p.h
@@ -48,6 +48,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
#ifndef QSCOPEDPOINTER_P_H
#define QSCOPEDPOINTER_P_H
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 fc23c29148..a0c22c9179 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -67,10 +67,6 @@ QT_END_NAMESPACE
#endif
#include <QtCore/qhashfunctions.h>
-#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
-# include <utility> // for std::forward
-#endif
-
QT_BEGIN_NAMESPACE
@@ -305,23 +301,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(); }
+ 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(); }
- QSharedPointer() Q_DECL_NOTHROW : value(Q_NULLPTR), d(Q_NULLPTR) {}
+ 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 +365,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>
@@ -422,7 +424,6 @@ public:
QWeakPointer<T> toWeakRef() const;
-#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)
template <typename... Args>
static QSharedPointer create(Args && ...arguments)
{
@@ -444,49 +445,6 @@ public:
result.enableSharedFromThis(result.data());
return result;
}
-#else
- static inline QSharedPointer create()
- {
- typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter;
-# else
- typename Private::DestroyerFn destroy = &Private::deleter;
-# endif
- QSharedPointer result(Qt::Uninitialized);
- result.d = Private::create(&result.value, destroy);
-
- // now initialize the data
- new (result.data()) T();
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- internalSafetyCheckAdd(result.d, result.value);
-# endif
- result.d->setQObjectShared(result.value, true);
- result.enableSharedFromThis(result.data());
- return result;
- }
-
- template <typename Arg>
- static inline QSharedPointer create(const Arg &arg)
- {
- typedef QtSharedPointer::ExternalRefCountWithContiguousData<T> Private;
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- typename Private::DestroyerFn destroy = &Private::safetyCheckDeleter;
-# else
- typename Private::DestroyerFn destroy = &Private::deleter;
-# endif
- QSharedPointer result(Qt::Uninitialized);
- result.d = Private::create(&result.value, destroy);
-
- // now initialize the data
- new (result.data()) T(arg);
-# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- internalSafetyCheckAdd(result.d, result.value);
-# endif
- result.d->setQObjectShared(result.value, true);
- return result;
- }
-#endif
private:
explicit QSharedPointer(Qt::Initialization) {}
@@ -511,15 +469,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 +556,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 +626,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 +646,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 +732,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..2fd4be00a5 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -52,7 +52,7 @@
// We mean it.
//
-#include <qglobal.h>
+#include <QtCore/private/qglobal_p.h>
#include <qatomic.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,68 +465,12 @@ 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)
+#define ALIGNMENT_PROLOGUE_32BYTES(ptr, i, length) \
+ for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((8 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x7)) & 0x7))); ++i)
+
QT_END_NAMESPACE
#endif // QSIMD_P_H
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index 5d40c4079a..cd5f8adbf5 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) || defined(Q_QDOC)
+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 69fd4f1e52..bf1bc3e650 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];
}
@@ -687,7 +684,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;
}
}
@@ -1152,7 +1149,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:
@@ -3266,22 +3263,7 @@ static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *nee
*/
int QString::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) const
{
- const int sl = str.d->size;
- if (sl == 1)
- return lastIndexOf(QChar(str.d->data()[0]), from, cs);
-
- const int l = d->size;
- if (from < 0)
- from += l;
- int delta = l-sl;
- if (from == l && sl == 0)
- return from;
- if (uint(from) >= uint(l) || delta < 0)
- return -1;
- if (from > delta)
- from = delta;
-
- return lastIndexOfHelper(d->data(), from, str.d->data(), str.d->size, cs);
+ return QStringRef(this).lastIndexOf(QStringRef(&str), from, cs);
}
/*!
@@ -3305,25 +3287,7 @@ int QString::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) c
*/
int QString::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const
{
- const int sl = str.size();
- if (sl == 1)
- return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs);
-
- const int l = d->size;
- if (from < 0)
- from += l;
- int delta = l-sl;
- if (from == l && sl == 0)
- return from;
- if (uint(from) >= uint(l) || delta < 0)
- return -1;
- if (from > delta)
- from = delta;
-
- QVarLengthArray<ushort> s(sl);
- qt_from_latin1(s.data(), str.latin1(), sl);
-
- return lastIndexOfHelper(d->data(), from, s.data(), sl, cs);
+ return QStringRef(this).lastIndexOf(str, from, cs);
}
/*!
@@ -3354,23 +3318,7 @@ int QString::lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
*/
int QString::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const
{
- const int sl = str.size();
- if (sl == 1)
- return lastIndexOf(str.at(0), from, cs);
-
- const int l = d->size;
- if (from < 0)
- from += l;
- int delta = l - sl;
- if (from == l && sl == 0)
- return from;
- if (uint(from) >= uint(l) || delta < 0)
- return -1;
- if (from > delta)
- from = delta;
-
- return lastIndexOfHelper(d->data(), from, reinterpret_cast<const ushort*>(str.unicode()),
- str.size(), cs);
+ return QStringRef(this).lastIndexOf(str, from, cs);
}
@@ -5045,7 +4993,7 @@ void QString::truncate(int pos)
If you want to remove characters from the \e beginning of the
string, use remove() instead.
- \sa truncate(), resize(), remove()
+ \sa truncate(), resize(), remove(), QStringRef::chop()
*/
void QString::chop(int n)
{
@@ -5453,9 +5401,15 @@ int QString::compare(QLatin1String other, Qt::CaseSensitivity cs) const Q_DECL_N
int QString::compare_helper(const QChar *data1, int length1, const char *data2, int length2,
Qt::CaseSensitivity cs)
{
- // ### optimize me
- const QString s2 = QString::fromUtf8(data2, length2 == -1 ? (data2 ? int(strlen(data2)) : -1) : length2);
- return compare_helper(data1, length1, s2.constData(), s2.size(), cs);
+ if (!data2)
+ return length1;
+ if (Q_UNLIKELY(length2 < 0))
+ length2 = int(strlen(data2));
+ // ### make me nothrow in all cases
+ QVarLengthArray<ushort> s2(length2);
+ const auto beg = reinterpret_cast<QChar *>(s2.data());
+ const auto end = QUtf8::convertToUnicode(beg, data2, length2);
+ return compare_helper(data1, length1, beg, end - beg, cs);
}
/*!
@@ -5556,7 +5510,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
@@ -5571,12 +5525,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:
@@ -7983,40 +7937,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 \macos 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 \macos 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 \macos 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 \macos and iOS.
-*/
-
/*! \fn bool QString::isSimpleText() const
\internal
@@ -8366,6 +8286,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, \a 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 \a 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 \a 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;
@@ -9398,6 +9390,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
@@ -9640,6 +9650,18 @@ QStringRef QString::midRef(int position, int n) const
*/
/*!
+ \fn void QStringRef::chop(int n)
+ \since 5.8
+
+ Removes \a n characters from the end of the string.
+
+ If \a n is greater than or equal to size(), the result is an
+ empty string; if \a n is negative, it is equivalent to passing zero.
+
+ \sa QString::chop(), truncate()
+*/
+
+/*!
\since 4.8
Returns the index position of the first occurrence of the string \a
@@ -9729,23 +9751,7 @@ int QStringRef::indexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs)
*/
int QStringRef::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) const
{
- const int sl = str.size();
- if (sl == 1)
- return lastIndexOf(str.at(0), from, cs);
-
- const int l = size();;
- if (from < 0)
- from += l;
- int delta = l - sl;
- if (from == l && sl == 0)
- return from;
- if (uint(from) >= uint(l) || delta < 0)
- return -1;
- if (from > delta)
- from = delta;
-
- return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from,
- reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs);
+ return lastIndexOf(QStringRef(&str), from, cs);
}
/*!
@@ -9781,7 +9787,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 ce09582ef9..b50b2ee4e5 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);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void expand(int i);
@@ -1423,6 +1441,13 @@ public:
QStringRef mid(int pos, int n = -1) const Q_REQUIRED_RESULT;
void truncate(int pos) Q_DECL_NOTHROW { m_size = qBound(0, pos, m_size); }
+ void chop(int n) Q_DECL_NOTHROW
+ {
+ if (n >= m_size)
+ m_size = 0;
+ else if (n > 0)
+ m_size -= n;
+ }
bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
@@ -1486,6 +1511,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,
@@ -1521,24 +1550,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; }
@@ -1547,7 +1562,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
@@ -1575,23 +1710,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)
@@ -1617,6 +1735,23 @@ inline bool QStringRef::contains(const QStringRef &s, Qt::CaseSensitivity cs) co
inline QString &QString::insert(int i, const QStringRef &s)
{ return insert(i, s.constData(), s.length()); }
+#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER)
+inline QString operator+(const QString &s1, const QStringRef &s2)
+{ QString t; t.reserve(s1.size() + s2.size()); t += s1; t += s2; return t; }
+inline QString operator+(const QStringRef &s1, const QString &s2)
+{ QString t; t.reserve(s1.size() + s2.size()); t += s1; t += s2; return t; }
+inline QString operator+(const QStringRef &s1, QLatin1String s2)
+{ QString t; t.reserve(s1.size() + s2.size()); t += s1; t += s2; return t; }
+inline QString operator+(QLatin1String s1, const QStringRef &s2)
+{ QString t; t.reserve(s1.size() + s2.size()); t += s1; t += s2; return t; }
+inline QString operator+(const QStringRef &s1, const QStringRef &s2)
+{ QString t; t.reserve(s1.size() + s2.size()); t += s1; t += s2; return t; }
+inline QString operator+(const QStringRef &s1, QChar s2)
+{ QString t; t.reserve(s1.size() + 1); t += s1; t += s2; return t; }
+inline QString operator+(QChar s1, const QStringRef &s2)
+{ QString t; t.reserve(1 + s2.size()); t += s1; t += s2; return t; }
+#endif // !(QT_USE_FAST_OPERATOR_PLUS || QT_USE_QSTRINGBUILDER)
+
namespace Qt {
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QString escape(const QString &plain) {
diff --git a/src/corelib/tools/qstringiterator_p.h b/src/corelib/tools/qstringiterator_p.h
index 2e24031ce4..7cf59ae42f 100644
--- a/src/corelib/tools/qstringiterator_p.h
+++ b/src/corelib/tools/qstringiterator_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index eae9e0e5d9..a0b65ea554 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -447,6 +447,17 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularEx
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
+static int accumulatedSize(const QStringList &list, int seplen)
+{
+ int result = 0;
+ if (!list.isEmpty()) {
+ for (const auto &e : list)
+ result += e.size() + seplen;
+ result -= seplen;
+ }
+ return result;
+}
+
/*!
\fn QString QStringList::join(const QString &separator) const
@@ -464,15 +475,9 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularEx
*/
QString QtPrivate::QStringList_join(const QStringList *that, const QChar *sep, int seplen)
{
- int totalLength = 0;
+ const int totalLength = accumulatedSize(*that, seplen);
const int size = that->size();
- for (int i = 0; i < size; ++i)
- totalLength += that->at(i).size();
-
- if(size > 0)
- totalLength += seplen * (size - 1);
-
QString res;
if (totalLength == 0)
return res;
@@ -486,6 +491,27 @@ QString QtPrivate::QStringList_join(const QStringList *that, const QChar *sep, i
}
/*!
+ \fn QString QStringList::join(QLatin1String separator) const
+ \since 5.8
+ \overload join()
+*/
+QString QtPrivate::QStringList_join(const QStringList &list, QLatin1String sep)
+{
+ QString result;
+ if (!list.isEmpty()) {
+ result.reserve(accumulatedSize(list, sep.size()));
+ const auto end = list.end();
+ auto it = list.begin();
+ result += *it;
+ while (++it != end) {
+ result += sep;
+ result += *it;
+ }
+ }
+ return result;
+}
+
+/*!
\fn QStringList QStringList::operator+(const QStringList &other) const
Returns a string list that is the concatenation of this string
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index e01f9e16e8..720d7d7419 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -73,6 +73,7 @@ public:
inline int removeDuplicates();
inline QString join(const QString &sep) const;
+ inline QString join(QLatin1String sep) const;
inline QString join(QChar sep) const;
inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
@@ -149,6 +150,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
@@ -158,6 +160,7 @@ namespace QtPrivate {
void Q_CORE_EXPORT QStringList_sort(QStringList *that, Qt::CaseSensitivity cs);
int Q_CORE_EXPORT QStringList_removeDuplicates(QStringList *that);
QString Q_CORE_EXPORT QStringList_join(const QStringList *that, const QChar *sep, int seplen);
+ Q_CORE_EXPORT QString QStringList_join(const QStringList &list, QLatin1String sep);
QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QString &str,
Qt::CaseSensitivity cs);
@@ -199,6 +202,11 @@ inline QString QListSpecialMethods<QString>::join(const QString &sep) const
return QtPrivate::QStringList_join(self(), sep.constData(), sep.length());
}
+QString QListSpecialMethods<QString>::join(QLatin1String sep) const
+{
+ return QtPrivate::QStringList_join(*self(), sep);
+}
+
inline QString QListSpecialMethods<QString>::join(QChar sep) const
{
return QtPrivate::QStringList_join(self(), &sep, 1);
@@ -284,6 +292,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_data_p.h b/src/corelib/tools/qtimezoneprivate_data_p.h
index b4e52af33a..6bbcb0e2cd 100644
--- a/src/corelib/tools/qtimezoneprivate_data_p.h
+++ b/src/corelib/tools/qtimezoneprivate_data_p.h
@@ -52,6 +52,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
QT_BEGIN_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/qtools_p.h b/src/corelib/tools/qtools_p.h
index 09adee5586..17d2ab852a 100644
--- a/src/corelib/tools/qtools_p.h
+++ b/src/corelib/tools/qtools_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include "QtCore/private/qglobal_p.h"
#include <limits.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index cec84a2490..5a422ea4eb 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -50,6 +50,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
#ifndef QUNICODETABLES_P_H
#define QUNICODETABLES_P_H
diff --git a/src/corelib/tools/qunicodetools.cpp b/src/corelib/tools/qunicodetools.cpp
index fad4267edc..be1d88e260 100644
--- a/src/corelib/tools/qunicodetools.cpp
+++ b/src/corelib/tools/qunicodetools.cpp
@@ -522,13 +522,13 @@ static void getLineBreaks(const ushort *string, quint32 len, QCharAttributes *at
// do not change breaks before and after the expression
for (quint32 j = nestart + 1; j < pos; ++j)
attributes[j].lineBreak = false;
- // fall through
+ Q_FALLTHROUGH();
case LB::NS::None:
nelast = LB::NS::XX; // reset state
break;
case LB::NS::Start:
nestart = i;
- // fall through
+ Q_FALLTHROUGH();
default:
nelast = necur;
break;
diff --git a/src/corelib/tools/qunicodetools_p.h b/src/corelib/tools/qunicodetools_p.h
index 5cde188656..5e2d56a226 100644
--- a/src/corelib/tools/qunicodetools_p.h
+++ b/src/corelib/tools/qunicodetools_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qchar.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index b64ec756ba..e3d89651e4 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -71,7 +71,6 @@ HEADERS += \
tools/qtimezoneprivate_p.h \
tools/qtimezoneprivate_data_p.h \
tools/qtools_p.h \
- tools/qelapsedtimer.h \
tools/qunicodetables_p.h \
tools/qunicodetools_p.h \
tools/qvarlengtharray.h \
@@ -92,7 +91,6 @@ SOURCES += \
tools/qdatetime.cpp \
tools/qdatetimeparser.cpp \
tools/qeasingcurve.cpp \
- tools/qelapsedtimer.cpp \
tools/qfreelist.cpp \
tools/qhash.cpp \
tools/qline.cpp \
@@ -130,36 +128,32 @@ msvc: NO_PCH_SOURCES += tools/qvector_msvc.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
!nacl:mac: {
- 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
+ SOURCES += tools/qlocale_unix.cpp tools/qtimezoneprivate_android.cpp
}
else:unix {
- SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp tools/qtimezoneprivate_tz.cpp
+ SOURCES += tools/qlocale_unix.cpp tools/qtimezoneprivate_tz.cpp
}
else:win32 {
- SOURCES += tools/qelapsedtimer_win.cpp \
- tools/qlocale_win.cpp \
+ SOURCES += tools/qlocale_win.cpp \
tools/qtimezoneprivate_win.cpp
winphone: LIBS_PRIVATE += -lWindowsPhoneGlobalizationUtil
winrt-*-msvc2013: LIBS += advapi32.lib
-} else:integrity:SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp
-else:SOURCES += tools/qelapsedtimer_generic.cpp
+} else:integrity {
+ SOURCES += tools/qlocale_unix.cpp
+}
-contains(QT_CONFIG, zlib) {
- include($$PWD/../../3rdparty/zlib.pri)
+qtConfig(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) {
+qtConfig(icu) {
include($$PWD/../../3rdparty/icu_dependency.pri)
SOURCES += tools/qlocale_icu.cpp \
@@ -174,7 +168,7 @@ contains(QT_CONFIG,icu) {
SOURCES += tools/qcollator_posix.cpp
}
-!contains(QT_DISABLED_FEATURES, regularexpression) {
+qtConfig(regularexpression) {
include($$PWD/../../3rdparty/pcre_dependency.pri)
HEADERS += tools/qregularexpression.h
@@ -198,12 +192,10 @@ INCLUDEPATH += ../3rdparty/md5 \
../3rdparty/md4 \
../3rdparty/sha3
-contains(QT_CONFIG, doubleconversion) {
+qtConfig(system-doubleconversion) {
+ QMAKE_USE_PRIVATE += doubleconversion
+} else: qtConfig(doubleconversion) {
include($$PWD/../../3rdparty/double-conversion/double-conversion.pri)
-} else:contains(QT_CONFIG, system-doubleconversion) {
- LIBS_PRIVATE += -ldouble-conversion
-} else {
- DEFINES += QT_NO_DOUBLECONVERSION
}
# Note: libm should be present by default becaue this is C++
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 83b26d50ab..1ffaeca852 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -976,11 +976,11 @@ bool QXmlStreamReaderPrivate::scanUntil(const char *str, short tokenToInject)
case '\r':
if ((c = filterCarriageReturn()) == 0)
break;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case '\t':
textBuffer += QChar(c);
continue;
@@ -1158,11 +1158,11 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
case '\r':
if (filterCarriageReturn() == 0)
return n;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case ' ':
case '\t':
if (normalizeLiterals)
@@ -1179,7 +1179,7 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
putChar(c);
return n;
}
- // fall through
+ Q_FALLTHROUGH();
default:
if (c < 0x20) {
putChar(c);
@@ -1201,11 +1201,11 @@ inline int QXmlStreamReaderPrivate::fastScanSpace()
case '\r':
if ((c = filterCarriageReturn()) == 0)
return n;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case ' ':
case '\t':
textBuffer += QChar(c);
@@ -1259,11 +1259,11 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
case '\r':
if ((c = filterCarriageReturn()) == 0)
return n;
- // fall through
+ Q_FALLTHROUGH();
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
- // fall through
+ Q_FALLTHROUGH();
case ' ':
case '\t':
textBuffer += QChar(ushort(c));
@@ -1275,7 +1275,7 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
putChar(c);
return n;
}
- // fall through
+ Q_FALLTHROUGH();
default:
if (c < 0x20) {
putChar(c);
@@ -1339,7 +1339,7 @@ inline int QXmlStreamReaderPrivate::fastScanName(int *prefix)
putChar(c);
return n;
}
- // fall through
+ Q_FALLTHROUGH();
default:
textBuffer += QChar(c);
++n;
@@ -2123,7 +2123,7 @@ QString QXmlStreamReader::readElementText(ReadElementTextBehaviour behaviour)
result += readElementText(behaviour);
break;
}
- // Fall through (for ErrorOnUnexpectedElement)
+ Q_FALLTHROUGH();
default:
if (d->error || behaviour == ErrorOnUnexpectedElement) {
if (!d->error)
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index ab0bbba413..b62cc9ac39 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -48,6 +48,8 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
+
// This file was generated by qlalr - DO NOT EDIT!
#ifndef QXMLSTREAM_P_H
#define QXMLSTREAM_P_H
@@ -1046,7 +1048,7 @@ bool QXmlStreamReaderPrivate::parse()
dtdName.clear();
dtdPublicId.clear();
dtdSystemId.clear();
- // fall through
+ Q_FALLTHROUGH();
case QXmlStreamReader::Comment:
case QXmlStreamReader::Characters:
isCDATA = false;
@@ -1078,7 +1080,7 @@ bool QXmlStreamReaderPrivate::parse()
return false;
}
#endif
- // fall through
+ Q_FALLTHROUGH();
default:
clearTextBuffer();
;
@@ -1122,7 +1124,7 @@ bool QXmlStreamReaderPrivate::parse()
} else {
break;
}
- // fall through
+ Q_FALLTHROUGH();
case ~0U: {
token = EOF_SYMBOL;
if (!tagsDone && !inParseEntity) {
@@ -1336,7 +1338,7 @@ bool QXmlStreamReaderPrivate::parse()
case 17:
case 18:
dtdName = symString(3);
- // fall through
+ Q_FALLTHROUGH();
case 19:
case 20:
@@ -1478,7 +1480,7 @@ bool QXmlStreamReaderPrivate::parse()
if (entityDeclaration.parameter)
raiseWellFormedError(QXmlStream::tr("NDATA in parameter entity declaration."));
}
- //fall through
+ Q_FALLTHROUGH();
case 94:
case 95: {
@@ -1586,7 +1588,7 @@ bool QXmlStreamReaderPrivate::parse()
case 129:
isWhitespace = false;
- // fall through
+ Q_FALLTHROUGH();
case 130:
sym(1).len += fastScanContentCharList();
@@ -1758,7 +1760,7 @@ bool QXmlStreamReaderPrivate::parse()
case 236:
isEmptyElement = true;
- // fall through
+ Q_FALLTHROUGH();
case 237:
setType(QXmlStreamReader::StartElement);
diff --git a/src/corelib/xml/qxmlutils_p.h b/src/corelib/xml/qxmlutils_p.h
index d45ecb50b3..d8d25e0efe 100644
--- a/src/corelib/xml/qxmlutils_p.h
+++ b/src/corelib/xml/qxmlutils_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index fa67fc17ef..43050dcea2 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -1,17 +1,11 @@
TARGET = QtDBus
QT = core-private
-CONFIG += link_pkgconfig
MODULE_CONFIG = dbusadaptors dbusinterfaces
-!contains(QT_LIBS_DBUS, .*dbus-1.*) {
- win32:CONFIG(debug, debug|release):QT_LIBS_DBUS += -ldbus-1d
- else:QT_LIBS_DBUS += -ldbus-1
-}
-
DEFINES += DBUS_API_SUBJECT_TO_CHANGE
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
-contains(QT_CONFIG, dbus-linked) {
- LIBS_PRIVATE += $$QT_LIBS_DBUS
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS
+qtConfig(dbus-linked) {
+ QMAKE_USE_PRIVATE += dbus
DEFINES += QT_LINKED_LIBDBUS
}
@@ -27,9 +21,9 @@ DEFINES += QT_NO_FOREACH
QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf
-PUB_HEADERS = qdbusargument.h \
+PUB_HEADERS = qtdbusglobal.h \
+ qdbusargument.h \
qdbusconnectioninterface.h \
- qdbusmacros.h \
qdbuserror.h \
qdbusextratypes.h \
qdbusmessage.h \
@@ -47,6 +41,7 @@ PUB_HEADERS = qdbusargument.h \
qdbusservicewatcher.h \
qdbusunixfiledescriptor.h
HEADERS += $$PUB_HEADERS \
+ qtdbusglobal_p.h \
qdbusconnection_p.h \
qdbusconnectionmanager_p.h \
qdbusmessage_p.h \
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h
index fbeea61c95..cfc0e12046 100644
--- a/src/dbus/qdbus_symbols_p.h
+++ b/src/dbus/qdbus_symbols_p.h
@@ -53,7 +53,7 @@
#ifndef QDBUS_SYMBOLS_P_H
#define QDBUS_SYMBOLS_P_H
-#include <QtCore/qglobal.h>
+#include <QtDBus/private/qtdbusglobal_p.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusabstractadaptor.h b/src/dbus/qdbusabstractadaptor.h
index e506458d33..f86d939fae 100644
--- a/src/dbus/qdbusabstractadaptor.h
+++ b/src/dbus/qdbusabstractadaptor.h
@@ -40,8 +40,8 @@
#ifndef QDBUSABSTRACTADAPTOR_H
#define QDBUSABSTRACTADAPTOR_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qobject.h>
-#include <QtDBus/qdbusmacros.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusabstractadaptor_p.h b/src/dbus/qdbusabstractadaptor_p.h
index e99e35766d..ed28777734 100644
--- a/src/dbus/qdbusabstractadaptor_p.h
+++ b/src/dbus/qdbusabstractadaptor_p.h
@@ -52,6 +52,7 @@
#ifndef QDBUSABSTRACTADAPTOR_P_H
#define QDBUSABSTRACTADAPTOR_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <qdbusabstractadaptor.h>
#include <QtCore/qobject.h>
diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h
index 32c33f19f2..f859c5ee7d 100644
--- a/src/dbus/qdbusabstractinterface.h
+++ b/src/dbus/qdbusabstractinterface.h
@@ -40,6 +40,7 @@
#ifndef QDBUSABSTRACTINTERFACE_H
#define QDBUSABSTRACTINTERFACE_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qvariant.h>
#include <QtCore/qlist.h>
diff --git a/src/dbus/qdbusabstractinterface_p.h b/src/dbus/qdbusabstractinterface_p.h
index ba555d5862..8e45bae88b 100644
--- a/src/dbus/qdbusabstractinterface_p.h
+++ b/src/dbus/qdbusabstractinterface_p.h
@@ -53,6 +53,7 @@
#ifndef QDBUSABSTRACTINTERFACE_P_H
#define QDBUSABSTRACTINTERFACE_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <qdbusabstractinterface.h>
#include <qdbusconnection.h>
#include <qdbuserror.h>
diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h
index 85469fbc3d..5342a79227 100644
--- a/src/dbus/qdbusargument.h
+++ b/src/dbus/qdbusargument.h
@@ -40,6 +40,7 @@
#ifndef QDBUSARGUMENT_H
#define QDBUSARGUMENT_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qhash.h>
#include <QtCore/qglobal.h>
@@ -49,7 +50,6 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qvariant.h>
#include <QtDBus/qdbusextratypes.h>
-#include <QtDBus/qdbusmacros.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusargument_p.h b/src/dbus/qdbusargument_p.h
index ca0a2cde13..559f8b1186 100644
--- a/src/dbus/qdbusargument_p.h
+++ b/src/dbus/qdbusargument_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <qdbusargument.h>
#include "qdbusunixfiledescriptor.h"
#include "qdbus_symbols_p.h"
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index da7557d7e8..f95cc3a15d 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)
struct QDBusConnectionManager::ConnectionRequestData
@@ -143,10 +139,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();
}
@@ -1270,31 +1262,4 @@ QByteArray QDBusConnection::localMachineId()
QT_END_NAMESPACE
-#ifdef Q_OS_WIN
-# include <qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-static void preventDllUnload()
-{
- // Thread termination is really wacky on Windows. For some reason we don't
- // understand, exiting from the thread may try to unload the DLL. Since the
- // QDBusConnectionManager thread runs until the DLL is unloaded, we've got
- // a deadlock: the main thread is waiting for the manager thread to exit,
- // but the manager thread is attempting to acquire a lock to unload the DLL.
- //
- // We work around the issue by preventing the unload from happening in the
- // first place.
- //
- // For this trick, see
- // https://blogs.msdn.microsoft.com/oldnewthing/20131105-00/?p=2733
-
- static HMODULE self;
- GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
- GET_MODULE_HANDLE_EX_FLAG_PIN,
- reinterpret_cast<const wchar_t *>(&self), // any address in this DLL
- &self);
-}
-QT_END_NAMESPACE
-#endif
-
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index d7ba55b3eb..d9a894b637 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -41,7 +41,7 @@
#ifndef QDBUSCONNECTION_H
#define QDBUSCONNECTION_H
-#include <QtDBus/qdbusmacros.h>
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qstring.h>
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index ef8946f9e8..a63e976f99 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -53,6 +53,7 @@
#ifndef QDBUSCONNECTION_P_H
#define QDBUSCONNECTION_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <qdbuserror.h>
#include <qdbusconnection.h>
@@ -279,7 +280,7 @@ public slots:
void socketWrite(int);
void objectDestroyed(QObject *o);
void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args);
- void addSignalHook(const QString &key, const SignalHook &hook);
+ bool addSignalHook(const QString &key, const SignalHook &hook);
bool removeSignalHook(const QString &key, const SignalHook &hook);
private slots:
@@ -292,7 +293,7 @@ signals:
void dispatchStatusChanged();
void spyHooksFinished(const QDBusMessage &msg);
void messageNeedsSending(QDBusPendingCallPrivate *pcall, void *msg, int timeout = -1);
- void signalNeedsConnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
+ bool signalNeedsConnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
bool signalNeedsDisconnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
void callWithCallbackFailed(const QDBusError &error, const QDBusMessage &message);
diff --git a/src/dbus/qdbusconnectioninterface.h b/src/dbus/qdbusconnectioninterface.h
index 862bbbc0cd..7b694a1f96 100644
--- a/src/dbus/qdbusconnectioninterface.h
+++ b/src/dbus/qdbusconnectioninterface.h
@@ -40,6 +40,7 @@
#ifndef QDBUSCONNECTIONINTERFACE_H
#define QDBUSCONNECTIONINTERFACE_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qstringlist.h>
#include <QtDBus/qdbusabstractinterface.h>
diff --git a/src/dbus/qdbusconnectionmanager_p.h b/src/dbus/qdbusconnectionmanager_p.h
index 5e85f86f9f..1c7dea811d 100644
--- a/src/dbus/qdbusconnectionmanager_p.h
+++ b/src/dbus/qdbusconnectionmanager_p.h
@@ -53,6 +53,7 @@
#ifndef QDBUSCONNECTIONMANAGER_P_H
#define QDBUSCONNECTIONMANAGER_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
#include "qdbusconnection_p.h"
#include "private/qthread_p.h"
diff --git a/src/dbus/qdbuscontext.h b/src/dbus/qdbuscontext.h
index 9af6ff52ed..fedfcbd98e 100644
--- a/src/dbus/qdbuscontext.h
+++ b/src/dbus/qdbuscontext.h
@@ -40,6 +40,7 @@
#ifndef QDBUSCONTEXT_H
#define QDBUSCONTEXT_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qstring.h>
#include <QtDBus/qdbuserror.h>
diff --git a/src/dbus/qdbuscontext_p.h b/src/dbus/qdbuscontext_p.h
index 00c749fbc8..087ded8b4f 100644
--- a/src/dbus/qdbuscontext_p.h
+++ b/src/dbus/qdbuscontext_p.h
@@ -52,7 +52,7 @@
#ifndef QDBUSCONTEXT_P_H
#define QDBUSCONTEXT_P_H
-#include <QtCore/qglobal.h>
+#include <QtDBus/private/qtdbusglobal_p.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbuserror.h b/src/dbus/qdbuserror.h
index 6bb1e2241f..c264f62b7d 100644
--- a/src/dbus/qdbuserror.h
+++ b/src/dbus/qdbuserror.h
@@ -40,7 +40,7 @@
#ifndef QDBUSERROR_H
#define QDBUSERROR_H
-#include <QtDBus/qdbusmacros.h>
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qstring.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusextratypes.h b/src/dbus/qdbusextratypes.h
index b65bfc1e9b..12961e2702 100644
--- a/src/dbus/qdbusextratypes.h
+++ b/src/dbus/qdbusextratypes.h
@@ -42,9 +42,9 @@
// define some useful types for D-BUS
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qvariant.h>
#include <QtCore/qstring.h>
-#include <QtDBus/qdbusmacros.h>
#if QT_DEPRECATED_SINCE(5, 6)
#include <QtCore/qhash.h>
#endif
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index d9e7720a06..c63fb05e74 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -2200,20 +2200,16 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service,
// check the slot
QDBusConnectionPrivate::SignalHook hook;
QString key;
- QString name2 = name;
- if (name2.isNull())
- name2.detach();
hook.signature = signature;
if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false))
return false; // don't connect
Q_ASSERT(thread() != QThread::currentThread());
- emit signalNeedsConnecting(key, hook);
- return true;
+ return emit signalNeedsConnecting(key, hook);
}
-void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook &hook)
+bool QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook &hook)
{
QDBusWriteLocker locker(ConnectAction, this);
@@ -2229,7 +2225,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
entry.midx == hook.midx &&
entry.argumentMatch == hook.argumentMatch) {
// no need to compare the parameters if it's the same slot
- return; // already there
+ return false; // already there
}
}
@@ -2241,7 +2237,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
if (mit != matchRefCounts.end()) { // Match already present
mit.value() = mit.value() + 1;
- return;
+ return true;
}
matchRefCounts.insert(hook.matchRule, 1);
@@ -2268,6 +2264,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
}
}
}
+ return true;
}
bool QDBusConnectionPrivate::disconnectSignal(const QString &service,
diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
index 470baeb692..85a067da1e 100644
--- a/src/dbus/qdbusintegrator_p.h
+++ b/src/dbus/qdbusintegrator_p.h
@@ -53,6 +53,7 @@
#ifndef QDBUSINTEGRATOR_P_H
#define QDBUSINTEGRATOR_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
#include "qdbus_symbols_p.h"
#include "qcoreevent.h"
diff --git a/src/dbus/qdbusinterface.h b/src/dbus/qdbusinterface.h
index 9db2cb9ce8..b6c2693400 100644
--- a/src/dbus/qdbusinterface.h
+++ b/src/dbus/qdbusinterface.h
@@ -40,6 +40,7 @@
#ifndef QDBUSINTERFACE_H
#define QDBUSINTERFACE_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtDBus/qdbusabstractinterface.h>
#include <QtDBus/qdbusconnection.h>
diff --git a/src/dbus/qdbusinterface_p.h b/src/dbus/qdbusinterface_p.h
index f35916502b..b726925306 100644
--- a/src/dbus/qdbusinterface_p.h
+++ b/src/dbus/qdbusinterface_p.h
@@ -52,6 +52,7 @@
#ifndef QDBUSINTERFACE_P_H
#define QDBUSINTERFACE_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
#include "qdbusabstractinterface_p.h"
#include "qdbusmetaobject_p.h"
#include <qdbusinterface.h>
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index ad6b06da23..03e04bb2f5 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -116,8 +116,7 @@ static QString generateSubObjectXml(QObject *object)
for ( ; it != end; ++it) {
QString name = (*it)->objectName();
if (!name.isEmpty() && QDBusUtil::isValidPartOfObjectPath(name))
- retval += QString::fromLatin1(" <node name=\"%1\"/>\n")
- .arg(name);
+ retval += QLatin1String(" <node name=\"") + name + QLatin1String("\"/>\n");
}
return retval;
}
@@ -192,8 +191,7 @@ QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node
node.children.constEnd();
for ( ; it != end; ++it)
if (it->obj || !it->children.isEmpty())
- xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n")
- .arg(it->name);
+ xml_data += QLatin1String(" <node name=\"") + it->name + QLatin1String("\"/>\n");
}
xml_data += QLatin1String("</node>\n");
diff --git a/src/dbus/qdbusintrospection_p.h b/src/dbus/qdbusintrospection_p.h
index 2b02a71156..e60900b162 100644
--- a/src/dbus/qdbusintrospection_p.h
+++ b/src/dbus/qdbusintrospection_p.h
@@ -51,13 +51,13 @@
// We mean it.
//
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <QtCore/qstring.h>
#include <QtCore/qvector.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qmap.h>
#include <QtCore/qpair.h>
#include <QtCore/qshareddata.h>
-#include "qdbusmacros.h"
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index 7ba7c79808..4ea6cefff6 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -318,7 +318,7 @@ void QDBusMarshaller::open(QDBusMarshaller &sub, int code, const char *signature
case DBUS_TYPE_ARRAY:
*ba += char(code);
*ba += signature;
- // fall through
+ Q_FALLTHROUGH();
case DBUS_TYPE_DICT_ENTRY:
sub.closeCode = 0;
@@ -495,9 +495,9 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
return true;
default:
- ; // fall through
+ ;
}
- // fall through
+ Q_FALLTHROUGH();
case DBUS_TYPE_STRUCT:
case DBUS_STRUCT_BEGIN_CHAR:
@@ -513,7 +513,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
append(qvariant_cast<QDBusUnixFileDescriptor>(arg));
return true;
}
- // fall through
+ Q_FALLTHROUGH();
default:
qWarning("QDBusMarshaller::appendVariantInternal: Found unknown D-BUS type '%s'",
diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h
index 570dd0b736..9f4a98b855 100644
--- a/src/dbus/qdbusmessage.h
+++ b/src/dbus/qdbusmessage.h
@@ -40,7 +40,7 @@
#ifndef QDBUSMESSAGE_H
#define QDBUSMESSAGE_H
-#include <QtDBus/qdbusmacros.h>
+#include <QtDBus/qtdbusglobal.h>
#include <QtDBus/qdbuserror.h>
#include <QtCore/qlist.h>
#include <QtCore/qvariant.h>
diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h
index 31a333f9fb..4b84b3f0cc 100644
--- a/src/dbus/qdbusmessage_p.h
+++ b/src/dbus/qdbusmessage_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <qatomic.h>
#include <qstring.h>
#include <qdbusmessage.h>
diff --git a/src/dbus/qdbusmetaobject_p.h b/src/dbus/qdbusmetaobject_p.h
index c785849826..599358634b 100644
--- a/src/dbus/qdbusmetaobject_p.h
+++ b/src/dbus/qdbusmetaobject_p.h
@@ -37,6 +37,9 @@
**
****************************************************************************/
+#ifndef QDBUSMETAOBJECT_P_H
+#define QDBUSMETAOBJECT_P_H
+
//
// W A R N I N G
// -------------
@@ -49,11 +52,8 @@
//
//
-#ifndef QDBUSMETAOBJECT_P_H
-#define QDBUSMETAOBJECT_P_H
-
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <QtCore/qmetaobject.h>
-#include <qdbusmacros.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
index 59a71ade3e..fb2b407997 100644
--- a/src/dbus/qdbusmetatype.cpp
+++ b/src/dbus/qdbusmetatype.cpp
@@ -373,7 +373,7 @@ int QDBusMetaType::signatureToType(const char *signature)
return qMetaTypeId<QList<QDBusSignature> >();
}
- // fall through
+ Q_FALLTHROUGH();
default:
return QMetaType::UnknownType;
}
diff --git a/src/dbus/qdbusmetatype.h b/src/dbus/qdbusmetatype.h
index 8b314da78c..9f3d9019d7 100644
--- a/src/dbus/qdbusmetatype.h
+++ b/src/dbus/qdbusmetatype.h
@@ -40,6 +40,7 @@
#ifndef QDBUSMETATYPE_H
#define QDBUSMETATYPE_H
+#include <QtDBus/qtdbusglobal.h>
#include "QtCore/qmetatype.h"
#include <QtDBus/qdbusargument.h>
diff --git a/src/dbus/qdbusmetatype_p.h b/src/dbus/qdbusmetatype_p.h
index 3bfe18729e..1aa11552df 100644
--- a/src/dbus/qdbusmetatype_p.h
+++ b/src/dbus/qdbusmetatype_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <qdbusmetatype.h>
#include <qdbusmessage.h>
diff --git a/src/dbus/qdbuspendingcall.h b/src/dbus/qdbuspendingcall.h
index a89103f242..1e4c6ebfd2 100644
--- a/src/dbus/qdbuspendingcall.h
+++ b/src/dbus/qdbuspendingcall.h
@@ -40,13 +40,11 @@
#ifndef QDBUSPENDINGCALL_H
#define QDBUSPENDINGCALL_H
-#include <QtCore/qglobal.h>
+#include <QtDBus/qtdbusglobal.h>
+#include <QtDBus/qdbusmessage.h>
#include <QtCore/qobject.h>
#include <QtCore/qshareddata.h>
-#include <QtDBus/qdbusmacros.h>
-#include <QtDBus/qdbusmessage.h>
-
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
diff --git a/src/dbus/qdbuspendingcall_p.h b/src/dbus/qdbuspendingcall_p.h
index d6c2ef2114..10f189ae43 100644
--- a/src/dbus/qdbuspendingcall_p.h
+++ b/src/dbus/qdbuspendingcall_p.h
@@ -53,6 +53,7 @@
#ifndef QDBUSPENDINGCALL_P_H
#define QDBUSPENDINGCALL_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
#include <qshareddata.h>
#include <qpointer.h>
#include <qvector.h>
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index 1ee658c0c8..786eab2120 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -40,8 +40,7 @@
#ifndef QDBUSPENDINGREPLY_H
#define QDBUSPENDINGREPLY_H
-#include <QtCore/qglobal.h>
-#include <QtDBus/qdbusmacros.h>
+#include <QtDBus/qtdbusglobal.h>
#include <QtDBus/qdbusargument.h>
#include <QtDBus/qdbuspendingcall.h>
diff --git a/src/dbus/qdbusreply.h b/src/dbus/qdbusreply.h
index 897e9452eb..b6a454d240 100644
--- a/src/dbus/qdbusreply.h
+++ b/src/dbus/qdbusreply.h
@@ -40,10 +40,9 @@
#ifndef QDBUSREPLY_H
#define QDBUSREPLY_H
-#include <QtCore/qglobal.h>
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qvariant.h>
-#include <QtDBus/qdbusmacros.h>
#include <QtDBus/qdbusmessage.h>
#include <QtDBus/qdbuserror.h>
#include <QtDBus/qdbusextratypes.h>
diff --git a/src/dbus/qdbusserver.h b/src/dbus/qdbusserver.h
index 0844229256..ac4dfcb67f 100644
--- a/src/dbus/qdbusserver.h
+++ b/src/dbus/qdbusserver.h
@@ -40,9 +40,9 @@
#ifndef QDBUSSERVER_H
#define QDBUSSERVER_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
-#include <QtDBus/qdbusmacros.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h
index a785c89761..77573beb5d 100644
--- a/src/dbus/qdbusservicewatcher.h
+++ b/src/dbus/qdbusservicewatcher.h
@@ -40,8 +40,7 @@
#ifndef QDBUSSERVICEWATCHER_H
#define QDBUSSERVICEWATCHER_H
-#include <QtCore/qobject.h>
-#include <QtDBus/qdbusmacros.h>
+#include <QtDBus/qtdbusglobal.h>
#if !defined(QT_NO_DBUS) && !defined(QT_NO_QOBJECT)
@@ -63,6 +62,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/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h
index a94621b8d6..866e777be6 100644
--- a/src/dbus/qdbusthreaddebug_p.h
+++ b/src/dbus/qdbusthreaddebug_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtDBus/private/qtdbusglobal_p.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusunixfiledescriptor.h b/src/dbus/qdbusunixfiledescriptor.h
index 05a5617ddc..ed3209ceda 100644
--- a/src/dbus/qdbusunixfiledescriptor.h
+++ b/src/dbus/qdbusunixfiledescriptor.h
@@ -41,8 +41,8 @@
#ifndef QDBUSUNIXFILEDESCRIPTOR_H
#define QDBUSUNIXFILEDESCRIPTOR_H
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qshareddata.h>
-#include <QtDBus/qdbusmacros.h>
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h
index 4331fdb1d1..931a374ad9 100644
--- a/src/dbus/qdbusutil_p.h
+++ b/src/dbus/qdbusutil_p.h
@@ -52,12 +52,11 @@
#ifndef QDBUSUTIL_P_H
#define QDBUSUTIL_P_H
+#include <QtDBus/private/qtdbusglobal_p.h>
+#include <QtDBus/qdbuserror.h>
#include <QtCore/qstring.h>
#include <QtCore/qvariant.h>
-#include <QtDBus/qdbusmacros.h>
-#include <QtDBus/qdbuserror.h>
-
#include "qdbus_symbols_p.h"
#ifndef QT_NO_DBUS
diff --git a/src/dbus/qdbusvirtualobject.h b/src/dbus/qdbusvirtualobject.h
index 8eb4c73f57..1a96d900b4 100644
--- a/src/dbus/qdbusvirtualobject.h
+++ b/src/dbus/qdbusvirtualobject.h
@@ -40,7 +40,7 @@
#ifndef QDBUSVIRTUALOBJECT_H
#define QDBUSVIRTUALOBJECT_H
-#include <QtDBus/qdbusmacros.h>
+#include <QtDBus/qtdbusglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qobject.h>
@@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE
class QDBusMessage;
class QDBusConnection;
-class QDBusVirtualObjectPrivate;
class Q_DBUS_EXPORT QDBusVirtualObject : public QObject
{
Q_OBJECT
@@ -64,7 +63,6 @@ public:
virtual bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) = 0;
private:
- Q_DECLARE_PRIVATE(QDBusVirtualObject)
Q_DISABLE_COPY(QDBusVirtualObject)
};
diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp
index 7e7ce9a7e6..d239a69f73 100644
--- a/src/dbus/qdbusxmlgenerator.cpp
+++ b/src/dbus/qdbusxmlgenerator.cpp
@@ -59,10 +59,10 @@ static inline QString typeNameToXml(const char *typeName)
{
// ### copied from qtextdocument.cpp
// ### move this into Qt Core at some point
- QString plain = QLatin1String(typeName);
+ const QLatin1String plain(typeName);
QString rich;
- rich.reserve(int(plain.length() * 1.1));
- for (int i = 0; i < plain.length(); ++i) {
+ rich.reserve(int(plain.size() * 1.1));
+ for (int i = 0; i < plain.size(); ++i) {
if (plain.at(i) == QLatin1Char('<'))
rich += QLatin1String("&lt;");
else if (plain.at(i) == QLatin1Char('>'))
diff --git a/src/dbus/qdbusxmlparser.cpp b/src/dbus/qdbusxmlparser.cpp
index fa362bc579..3618c76a1d 100644
--- a/src/dbus/qdbusxmlparser.cpp
+++ b/src/dbus/qdbusxmlparser.cpp
@@ -48,15 +48,12 @@
#ifndef QT_NO_DBUS
-//#define QDBUS_PARSER_DEBUG
-#ifdef QDBUS_PARSER_DEBUG
-# define qDBusParserError qDebug
-#else
-# define qDBusParserError if (true) {} else qDebug
-#endif
-
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(dbusParser, "dbus.parser", QtWarningMsg)
+
+#define qDBusParserError(...) qCDebug(dbusParser, ##__VA_ARGS__)
+
static bool parseArg(const QXmlStreamAttributes &attributes, QDBusIntrospection::Argument &argData,
QDBusIntrospection::Interface *ifaceData)
{
diff --git a/src/dbus/qdbusxmlparser_p.h b/src/dbus/qdbusxmlparser_p.h
index 0ba04440c4..d089bae163 100644
--- a/src/dbus/qdbusxmlparser_p.h
+++ b/src/dbus/qdbusxmlparser_p.h
@@ -51,14 +51,17 @@
// We mean it.
//
+#include <QtDBus/private/qtdbusglobal_p.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/qmap.h>
-#include <qdbusmacros.h>
#include "qdbusintrospection_p.h"
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(dbusParser)
+
/*!
\internal
*/
diff --git a/src/dbus/qdbusmacros.h b/src/dbus/qtdbusglobal.h
index 0b4fdb2cf0..633cc352bb 100644
--- a/src/dbus/qdbusmacros.h
+++ b/src/dbus/qtdbusglobal.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QDBUSMACROS_H
-#define QDBUSMACROS_H
+#ifndef QTDBUSGLOBAL_H
+#define QTDBUSGLOBAL_H
#include <QtCore/qglobal.h>
#include <QtCore/qmetatype.h>
diff --git a/config.tests/x11/notype/notypetest.cpp b/src/dbus/qtdbusglobal_p.h
index 1faf4db056..c2788f5c23 100644
--- a/config.tests/x11/notype/notypetest.cpp
+++ b/src/dbus/qtdbusglobal_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 config.tests of the Qt Toolkit.
+** This file is part of the QtDBus module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,14 +37,21 @@
**
****************************************************************************/
-/* Sample program for configure to test for broken X11 headers that
-confuse gcc 2.95 and better on target platforms such as Solaris.
-*/
+#ifndef QTDBUSGLOBAL_P_H
+#define QTDBUSGLOBAL_P_H
-#include <X11/Xlib.h>
-#include <X11/ICE/ICElib.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.
+//
-int main()
-{
- return 0;
-}
+#include <QtDBus/qtdbusglobal.h>
+#include <QtCore/private/qglobal_p.h>
+
+#endif // QTDBUSGLOBAL_P_H
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index b7f341d5b7..8dd821fe6a 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -1,6 +1,6 @@
# Qt accessibility module
-contains(QT_CONFIG, accessibility) {
+qtConfig(accessibility) {
HEADERS += \
accessible/qaccessible.h \
accessible/qaccessiblecache_p.h \
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 7bc124f7d9..27756d764d 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_ACCESSIBILITY
#ifndef QACCESSIBLE_H
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index c161e01b0f..7429716e65 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -40,6 +40,7 @@
#ifndef QACCESSIBLEBRIDGE_H
#define QACCESSIBLEBRIDGE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h
index a9208702e4..f054ee9678 100644
--- a/src/gui/accessible/qaccessiblecache_p.h
+++ b/src/gui/accessible/qaccessiblecache_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qhash.h>
diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h
index 5918e942bd..dd69dcb081 100644
--- a/src/gui/accessible/qaccessibleobject.h
+++ b/src/gui/accessible/qaccessibleobject.h
@@ -40,6 +40,7 @@
#ifndef QACCESSIBLEOBJECT_H
#define QACCESSIBLEOBJECT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qaccessible.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index b0c28e5bf8..09d4c542d3 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -40,6 +40,7 @@
#ifndef QACCESSIBLEPLUGIN_H
#define QACCESSIBLEPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qaccessible.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/accessible/qplatformaccessibility.h b/src/gui/accessible/qplatformaccessibility.h
index 5dc4781bb2..5d668c2bd6 100644
--- a/src/gui/accessible/qplatformaccessibility.h
+++ b/src/gui/accessible/qplatformaccessibility.h
@@ -48,9 +48,11 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qobject.h>
+#include <QtGui/qtguiglobal.h>
+
#ifndef QT_NO_ACCESSIBILITY
+#include <QtCore/qobject.h>
#include <QtGui/qaccessible.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index e18340d302..b72764e048 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -36,11 +36,12 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <QtCore/qvariantanimation.h>
-#include <private/qvariantanimation_p.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_ANIMATION
+#include <QtCore/qvariantanimation.h>
+#include <private/qvariantanimation_p.h>
#include <QtGui/qcolor.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
diff --git a/src/gui/configure.json b/src/gui/configure.json
new file mode 100644
index 0000000000..376359ba37
--- /dev/null
+++ b/src/gui/configure.json
@@ -0,0 +1,1095 @@
+{
+ "module": "gui",
+ "depends": [
+ "core"
+ ],
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "options": {
+ "angle": "boolean",
+ "directfb": "boolean",
+ "directwrite": "boolean",
+ "egl": "boolean",
+ "eglfs": "boolean",
+ "evdev": "boolean",
+ "fontconfig": "boolean",
+ "freetype": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "gbm": "boolean",
+ "gif": "boolean",
+ "harfbuzz": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "ico": "boolean",
+ "imf": { "type": "boolean", "name": "qqnx_imf" },
+ "kms": "boolean",
+ "lgmon": "boolean",
+ "libinput": "boolean",
+ "libjpeg": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "libpng": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "linuxfb": "boolean",
+ "mirclient": "boolean",
+ "mtdev": "boolean",
+ "opengl": { "type": "optionalString", "values": [ "no", "yes", "desktop", "es2", "dynamic" ] },
+ "opengl-es-2": { "type": "void", "name": "opengl", "value": "es2" },
+ "opengles3": "boolean",
+ "qpa": { "type": "string", "name": "qpa_default_platform" },
+ "qpa-platform-guard": "boolean",
+ "sm": { "type": "boolean", "name": "sessionmanager" },
+ "tslib": "boolean",
+ "xcb": { "type": "enum", "values": [ "no", "yes", "qt", "system" ] },
+ "xcb-xlib": "boolean",
+ "xinput2": "boolean",
+ "xkb": "boolean",
+ "xkb-config-root": "string",
+ "xkbcommon": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "xkbcommon-evdev": "boolean",
+ "xkbcommon-x11": { "type": "enum", "name": "xkbcommon", "values": [ "no", "qt", "system" ] },
+ "xrender": "boolean"
+ }
+ },
+
+ "libraries": {
+ "bcm_host": {
+ "export": "",
+ "sources": [
+ "-lbcm_host"
+ ]
+ },
+ "directfb": {
+ "label": "DirectFB",
+ "test": "qpa/directfb",
+ "sources": [
+ { "type": "pkgConfig", "args": "directfb" }
+ ]
+ },
+ "directwrite": {
+ "label": "DirectWrite",
+ "export": "",
+ "test": "win/directwrite",
+ "sources": [
+ "-ldwrite"
+ ]
+ },
+ "drm": {
+ "label": "KMS",
+ "test": "qpa/kms",
+ "sources": [
+ { "type": "pkgConfig", "args": "libdrm" },
+ "-ldrm"
+ ]
+ },
+ "egl": {
+ "label": "EGL",
+ "test": "qpa/egl",
+ "sources": [
+ { "type": "pkgConfig", "args": "egl" },
+ { "type": "makeSpec", "spec": "EGL" }
+ ]
+ },
+ "freetype": {
+ "label": "FreeType",
+ "export": "",
+ "test": "unix/freetype",
+ "sources": [
+ "-lfreetype"
+ ]
+ },
+ "fontconfig": {
+ "label": "Fontconfig",
+ "test": "unix/fontconfig",
+ "sources": [
+ { "type": "pkgConfig", "args": "fontconfig freetype2" },
+ "-lfontconfig -lfreetype"
+ ]
+ },
+ "gbm": {
+ "label": "GBM",
+ "test": "qpa/gbm",
+ "sources": [
+ { "type": "pkgConfig", "args": "gbm" }
+ ]
+ },
+ "harfbuzz": {
+ "label": "HarfBuzz",
+ "test": "unix/harfbuzz",
+ "sources": [
+ "-lharfbuzz"
+ ]
+ },
+ "imf": {
+ "label": "IMF",
+ "export": "",
+ "test": "unix/qqnx_imf",
+ "sources": [
+ "-linput_client"
+ ]
+ },
+ "lgmon": {
+ "label": "lgmon",
+ "test": "unix/lgmon",
+ "sources": [
+ "-llgmon"
+ ]
+ },
+ "libinput": {
+ "label": "libinput",
+ "test": "unix/libinput",
+ "sources": [
+ { "type": "pkgConfig", "args": "libinput" }
+ ]
+ },
+ "libjpeg": {
+ "label": "libjpeg",
+ "test": "unix/libjpeg",
+ "sources": [
+ { "libs": "-llibjpeg", "condition": "config.msvc" },
+ { "libs": "-ljpeg", "condition": "!config.msvc" }
+ ]
+ },
+ "libpng": {
+ "label": "libpng",
+ "test": "unix/libpng",
+ "sources": [
+ { "type": "pkgConfig", "args": "libpng" },
+ { "libs": "-llibpng", "condition": "config.msvc" },
+ { "libs": "-lpng", "condition": "!config.msvc" }
+ ]
+ },
+ "mirclient": {
+ "label": "Mir client libraries",
+ "export": "",
+ "test": "qpa/mirclient",
+ "sources": [
+ { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api" }
+ ]
+ },
+ "mtdev": {
+ "label": "mtdev",
+ "export": "",
+ "test": "unix/mtdev",
+ "sources": [
+ { "type": "pkgConfig", "args": "mtdev" }
+ ]
+ },
+ "opengl": {
+ "label": "Desktop OpenGL",
+ "test": "unix/opengldesktop",
+ "sources": [
+ { "type": "pkgConfig", "args": "gl" },
+ { "type": "makeSpec", "spec": "OPENGL" }
+ ]
+ },
+ "opengl_es2": {
+ "label": "OpenGL ES 2.0",
+ "test": "unix/opengles2",
+ "sources": [
+ { "type": "pkgConfig", "args": "glesv2" },
+ { "type": "makeSpec", "spec": "OPENGL_ES2" }
+ ]
+ },
+ "tslib": {
+ "label": "tslib",
+ "test": "unix/tslib",
+ "sources": [
+ "-lts"
+ ]
+ },
+ "wayland_server": {
+ "label": "Wayland Server",
+ "export": "",
+ "test": "qpa/wayland-server",
+ "sources": [
+ { "type": "pkgConfig", "args": "wayland-server" }
+ ]
+ },
+ "x11sm": {
+ "label": "X11 session management",
+ "sources": [
+ { "type": "pkgConfig", "args": "sm ice" }
+ ]
+ },
+ "xcb": {
+ "label": "XCB >= 1.5 (core)",
+ "test": "qpa/xcb",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb >= 1.5" },
+ "-lxcb"
+ ]
+ },
+ "xcb_syslibs": {
+ "label": "XCB (secondary)",
+ "test": "qpa/xcb-syslibs",
+ "sources": [
+ { "type": "pkgConfig",
+ "args": "xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape" },
+ "-lxcb -lxcb-shm -lxcb-sync -lxcb-xfixes -lxcb-randr -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-shape"
+ ]
+ },
+ "xcb_xlib": {
+ "label": "XCB Xlib",
+ "test": "qpa/xcb-xlib",
+ "sources": [
+ { "type": "pkgConfig", "args": "X11-xcb x11 xcb" },
+ "-lxcb -lX11 -lX11-xcb"
+ ]
+ },
+ "xcb_xkb": {
+ "label": "XCB XKB >= 1.10",
+ "test": "qpa/xcb-xkb",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-xkb >= 1.10 xcb" },
+ "-lxcb-xkb -lxcb"
+ ]
+ },
+ "xcb_render": {
+ "label": "XCB XRender",
+ "test": "qpa/xcb-render",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-renderutil xcb-render xcb" },
+ "-lxcb-render-util -lxcb-render -lxcb"
+ ]
+ },
+ "xcb_glx": {
+ "label": "XCB GLX",
+ "test": "qpa/xcb-glx",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-glx xcb" },
+ "-lxcb-glx -lxcb"
+ ]
+ },
+ "xinput2": {
+ "label": "Xinput2",
+ "test": "x11/xinput2",
+ "sources": [
+ { "type": "pkgConfig", "args": "xi" },
+ "-lXi"
+ ]
+ },
+ "xkbcommon": {
+ "label": "xkbcommon",
+ "export": "xkbcommon_evdev",
+ "test": "unix/xkbcommon",
+ "sources": [
+ { "type": "pkgConfig", "args": "xkbcommon" }
+ ]
+ },
+ "xkbcommon_x11": {
+ "label": "xkbcommon-x11 >= 0.4.1",
+ "export": "xkbcommon",
+ "sources": [
+ { "type": "pkgConfig", "args": "xkbcommon xkbcommon-x11 >= 0.4.1" }
+ ]
+ },
+ "xrender": {
+ "label": "XRender",
+ "test": "x11/xrender",
+ "sources": [
+ "-lXrender"
+ ]
+ }
+ },
+
+ "testTypeAliases": {
+ "files": [ "directX" ],
+ "getPkgConfigVariable": [ "xkbConfigRoot" ]
+ },
+
+ "tests": {
+ "direct2d": {
+ "label": "Direct 2D",
+ "type": "compile",
+ "test": "qpa/direct2d",
+ "use": "direct2d"
+ },
+ "directwrite2": {
+ "label": "DirectWrite 2",
+ "type": "compile",
+ "test": "win/directwrite2",
+ "use": "directwrite"
+ },
+ "directx": {
+ "label": "DirectX SDK",
+ "type": "directX",
+ "files": [
+ "d3dcompiler.h",
+ "d3d11.lib",
+ "fxc.exe"
+ ]
+ },
+ "egl-x11": {
+ "label": "EGL on X11",
+ "type": "compile",
+ "test": "qpa/egl-x11",
+ "use": "egl xcb_xlib"
+ },
+ "egl-brcm": {
+ "label": "Broadcom EGL (Rasberry Pi)",
+ "type": "compile",
+ "test": "qpa/eglfs-brcm",
+ "use": "egl bcm_host"
+ },
+ "egl-egldevice": {
+ "label": "EGLDevice",
+ "type": "compile",
+ "test": "qpa/eglfs-egldevice",
+ "use": "egl"
+ },
+ "egl-mali": {
+ "label": "Mali EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-mali",
+ "use": "egl"
+ },
+ "egl-mali-2": {
+ "label": "Mali 2 EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-mali-2",
+ "use": "egl"
+ },
+ "egl-viv": {
+ "label": "i.Mx6 EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-viv",
+ "use": "egl"
+ },
+ "evdev": {
+ "label": "evdev",
+ "type": "compile",
+ "test": "unix/evdev"
+ },
+ "linuxfb": {
+ "label": "LinuxFB",
+ "type": "compile",
+ "test": "qpa/linuxfb"
+ },
+ "opengles3": {
+ "label": "OpenGL ES 3.0",
+ "type": "compile",
+ "test": "unix/opengles3",
+ "use": "opengl_es2"
+ },
+ "opengles31": {
+ "label": "OpenGL ES 3.1",
+ "type": "compile",
+ "test": "unix/opengles31",
+ "use": "opengl_es2"
+ },
+ "qpa_default_platform": {
+ "label": "default QPA platform",
+ "type": "qpaDefaultPlatform",
+ "log": "value"
+ },
+ "x11prefix": {
+ "label": "X11 prefix",
+ "type": "getPkgConfigVariable",
+ "pkg-config-args": "x11",
+ "pkg-config-variable": "prefix",
+ "value": "/usr",
+ "log": "value"
+ },
+ "xkbconfigroot": {
+ "label": "XKB config root",
+ "type": "xkbConfigRoot",
+ "pkg-config-args": "xkeyboard-config",
+ "pkg-config-variable": "xkb_base",
+ "log": "value"
+ },
+ "xlib": {
+ "label": "XLib",
+ "type": "compile",
+ "test": "x11/xlib"
+ }
+ },
+
+ "features": {
+ "accessibility-atspi-bridge": {
+ "label": "ATSPI Bridge",
+ "condition": "features.accessibility && features.xcb && features.dbus",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "angle": {
+ "label": "ANGLE",
+ "autoDetect": "features.opengles2 || features.opengl-dynamic",
+ "condition": "config.win32 && tests.directx",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" }
+ ]
+ },
+ "directfb": {
+ "label": "DirectFB",
+ "autoDetect": false,
+ "condition": "libs.directfb",
+ "output": [ "privateFeature" ]
+ },
+ "directwrite": {
+ "label": "DirectWrite",
+ "emitIf": "config.win32",
+ "condition": "libs.directwrite",
+ "output": [ "privateFeature" ]
+ },
+ "directwrite2": {
+ "label": "DirectWrite 2",
+ "emitIf": "config.win32",
+ "condition": "features.directwrite && tests.directwrite2",
+ "output": [ "privateFeature" ]
+ },
+ "direct2d": {
+ "label": "Direct 2D",
+ "autoDetect": false,
+ "condition": "tests.direct2d",
+ "output": [ "privateFeature" ]
+ },
+ "evdev": {
+ "label": "evdev",
+ "condition": "tests.evdev",
+ "output": [ "privateFeature" ]
+ },
+ "freetype": {
+ "label": "FreeType",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "system-freetype": {
+ "label": " Using system FreeType",
+ "enable": "input.freetype == 'system'",
+ "disable": "input.freetype == 'qt'",
+ "autoDetect": "!config.win32",
+ "condition": "features.freetype && libs.freetype",
+ "output": [ "privateFeature" ]
+ },
+ "fontconfig": {
+ "label": "Fontconfig",
+ "condition": "!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "gbm": {
+ "label": "GBM",
+ "condition": "libs.gbm",
+ "output": [ "publicQtConfig" ]
+ },
+ "harfbuzz": {
+ "label": "HarfBuzz",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "system-harfbuzz": {
+ "label": " Using system HarfBuzz",
+ "enable": "input.harfbuzz == 'system'",
+ "disable": "input.harfbuzz == 'qt'",
+ "autoDetect": "!config.darwin && !config.win32",
+ "condition": "features.harfbuzz && libs.harfbuzz",
+ "output": [ "privateFeature" ]
+ },
+ "qqnx_imf": {
+ "label": "IMF",
+ "emitIf": "config.qnx",
+ "condition": "libs.imf",
+ "output": [ "privateConfig" ]
+ },
+ "integrityfb": {
+ "label": "INTEGRITY framebuffer",
+ "condition": "config.integrity",
+ "output": [ "privateFeature" ]
+ },
+ "kms": {
+ "label": "KMS",
+ "condition": "libs.drm",
+ "output": [ "publicQtConfig" ]
+ },
+ "libinput": {
+ "label": "libinput",
+ "condition": "features.libudev && libs.libinput",
+ "output": [ "privateFeature" ]
+ },
+ "lgmon": {
+ "label": "lgmon",
+ "emitIf": "config.qnx",
+ "condition": "libs.lgmon",
+ "output": [ "privateConfig" ]
+ },
+ "linuxfb": {
+ "label": "LinuxFB",
+ "condition": "tests.linuxfb",
+ "output": [ "privateFeature" ]
+ },
+ "mirclient": {
+ "label": "Mir client",
+ "condition": "libs.mirclient",
+ "output": [ "privateFeature" ]
+ },
+ "mtdev": {
+ "label": "mtdev",
+ "condition": "libs.mtdev",
+ "output": [ "privateFeature" ]
+ },
+ "opengles2": {
+ "label": "OpenGL ES 2.0",
+ "enable": "input.opengl == 'es2'",
+ "disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'",
+ "condition": "config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)",
+ "output": [
+ "publicFeature",
+ "publicQtConfig",
+ { "type": "define", "name": "QT_OPENGL_ES" },
+ { "type": "define", "name": "QT_OPENGL_ES_2" }
+ ]
+ },
+ "opengles3": {
+ "label": "OpenGL ES 3.0",
+ "condition": "features.opengles2 && !features.angle && tests.opengles3",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_3" }
+ ]
+ },
+ "opengles31": {
+ "label": "OpenGL ES 3.1",
+ "condition": "features.opengles3 && tests.opengles31",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_3_1" }
+ ]
+ },
+ "opengl-desktop": {
+ "label": "Desktop OpenGL",
+ "enable": "input.opengl == 'desktop'",
+ "disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'",
+ "condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
+ || (!config.watchos && !config.win32 && libs.opengl)"
+ },
+ "opengl-dynamic": {
+ "label": "Dynamic OpenGL",
+ "enable": "input.opengl == 'dynamic'",
+ "autoDetect": false,
+ "condition": "config.win32 && !config.winrt",
+ "output": [
+ { "type": "publicFeature", "name": "dynamicgl" },
+ { "type": "define", "name": "QT_OPENGL_DYNAMIC" }
+ ]
+ },
+ "opengl": {
+ "label": "OpenGL",
+ "condition": "features.opengl-desktop || features.opengl-dynamic || features.opengles2",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "egl": {
+ "label": "EGL",
+ "condition": "features.opengl && (features.angle || libs.egl)",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "egl_x11": {
+ "label": "EGL on X11",
+ "condition": "features.egl && tests.egl-x11",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs": {
+ "label": "EGLFS",
+ "autoDetect": "!config.android && !config.win32",
+ "condition": "features.egl",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_brcm": {
+ "label": "EGLFS Rasberry Pi",
+ "condition": "features.eglfs && tests.egl-brcm",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_egldevice": {
+ "label": "EGLFS EGLDevice",
+ "condition": "features.eglfs && tests.egl-egldevice && features.kms",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_gbm": {
+ "label": "EGLFS GBM",
+ "condition": "features.eglfs && features.gbm && features.kms",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_mali": {
+ "label": "EGLFS Mali",
+ "condition": "features.eglfs && (tests.egl-mali || tests.egl-mali-2)",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_viv": {
+ "label": "EGLFS i.Mx6",
+ "condition": "features.eglfs && tests.egl-viv",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_viv_wl": {
+ "label": "EGLFS i.Mx6 Wayland",
+ "condition": "features.eglfs_viv && libs.wayland_server",
+ "output": [ "privateFeature" ]
+ },
+ "gif": {
+ "label": "GIF",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_GIF" }
+ ]
+ },
+ "ico": {
+ "label": "ICO",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "jpeg": {
+ "label": "JPEG",
+ "disable": "input.libjpeg == 'no'",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_JPEG" }
+ ]
+ },
+ "system-jpeg": {
+ "label": " Using system libjpeg",
+ "disable": "input.libjpeg == 'qt'",
+ "enable": "input.libjpeg == 'system'",
+ "condition": "features.jpeg && libs.libjpeg",
+ "output": [ "privateFeature" ]
+ },
+ "png": {
+ "label": "PNG",
+ "disable": "input.libpng == 'no'",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_PNG" }
+ ]
+ },
+ "system-png": {
+ "label": " Using system libpng",
+ "disable": "input.libpng == 'qt'",
+ "enable": "input.libpng == 'system'",
+ "condition": "features.png && libs.libpng",
+ "output": [ "privateFeature" ]
+ },
+ "qpa_default_platform": {
+ "label": "QPA default platform",
+ "condition": "features.gui",
+ "output": [
+ { "type": "define", "name": "QT_QPA_DEFAULT_PLATFORM_NAME", "value": "tests.qpa_default_platform.name" },
+ { "type": "varAssign", "public": true, "name": "QT_DEFAULT_QPA_PLUGIN", "value": "tests.qpa_default_platform.plugin",
+ "condition": "!features.shared" }
+ ]
+ },
+ "sessionmanager": {
+ "label": "Session Management",
+ "purpose": "Provides an interface to the windowing system's session management.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tslib": {
+ "label": "tslib",
+ "condition": "libs.tslib",
+ "output": [ "privateFeature" ]
+ },
+ "xcb": {
+ "label": "XCB",
+ "autoDetect": "!config.darwin",
+ "condition": "libs.xcb",
+ "output": [ "privateFeature" ]
+ },
+ "system-xcb": {
+ "label": "Using system provided XCB libraries",
+ "enable": "input.xcb == 'system' || input.xcb == 'yes'",
+ "disable": "input.xcb == 'qt' || input.xcb == 'no'",
+ "autoDetect": "!config.darwin",
+ "condition": "libs.xcb && libs.xcb_syslibs",
+ "output": [ "privateFeature" ]
+ },
+ "x11-prefix": {
+ "label": "X11 prefix",
+ "emitIf": "features.xcb",
+ "output": [ { "type": "varAssign", "name": "QMAKE_X11_PREFIX", "value": "tests.x11prefix.value" } ]
+ },
+ "xcb-glx": {
+ "label": "XCB GLX",
+ "emitIf": "features.xcb",
+ "condition": "libs.xcb_glx",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-render": {
+ "label": "XCB render",
+ "emitIf": "features.system-xcb",
+ "condition": "libs.xcb_render",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-xlib": {
+ "label": "XCB Xlib",
+ "emitIf": "features.xcb",
+ "condition": "libs.xcb_xlib",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-sm": {
+ "label": "xcb-sm",
+ "emitIf": "features.xcb",
+ "condition": "features.sessionmanager && libs.x11sm",
+ "output": [ "privateFeature" ]
+ },
+ "xinput2": {
+ "label": "Xinput2",
+ "condition": "libs.xinput2",
+ "output": [ "privateFeature" ]
+ },
+ "xkbcommon-evdev": {
+ "label": "xkbcommon-evdev",
+ "condition": "libs.xkbcommon",
+ "output": [ "privateFeature" ]
+ },
+ "xkbcommon-system": {
+ "label": "Using system-provided xkbcommon",
+ "emitIf": "features.xcb",
+ "enable": "input.xkbcommon == 'system'",
+ "disable": "input.xkbcommon == 'qt' || input.xkbcommon == 'no'",
+ "condition": "libs.xkbcommon_x11",
+ "output": [ "privateFeature" ]
+ },
+ "xkb": {
+ "label": "XCB XKB",
+ "condition": "features.system-xcb && libs.xcb_xkb",
+ "output": [ "privateFeature" ]
+ },
+ "xkb-config-root": {
+ "label": "XKB config root",
+ "emitIf": "features.xcb",
+ "condition": "features.xcb && !features.xkbcommon-system && tests.xkbconfigroot",
+ "output": [ { "type": "varAssign", "name": "QMAKE_XKB_CONFIG_ROOT", "value": "tests.xkbconfigroot.value"} ]
+ },
+ "xlib": {
+ "label": "XLib",
+ "condition": "tests.xlib",
+ "output": [ "privateFeature" ]
+ },
+ "xrender": {
+ "label": "Xrender",
+ "condition": "libs.xrender",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "texthtmlparser": {
+ "label": "HtmlParser",
+ "purpose": "Provides a parser for HTML.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "textodfwriter": {
+ "label": "OdfWriter",
+ "purpose": "Provides an ODF writer.",
+ "section": "Kernel",
+ "condition": "features.xmlstreamwriter",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "cssparser": {
+ "label": "CssParser",
+ "purpose": "Provides a parser for Cascading Style Sheets.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "draganddrop": {
+ "label": "Drag and Drop",
+ "purpose": "Supports the drag and drop mechansim.",
+ "section": "Kernel",
+ "condition": "features.imageformat_xpm",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "shortcut": {
+ "label": "QShortcut",
+ "purpose": "Provides keyboard accelerators and shortcuts.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "action": {
+ "label": "QAction",
+ "purpose": "Provides widget actions.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "cursor": {
+ "label": "QCursor",
+ "purpose": "Provides mouse cursors.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "clipboard": {
+ "label": "QClipboard",
+ "purpose": "Provides cut and paste operations.",
+ "section": "Kernel",
+ "condition": "!config.integrity && !config.qnx",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "wheelevent": {
+ "label": "QWheelEvent",
+ "purpose": "Supports wheel events.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tabletevent": {
+ "label": "QTabletEvent",
+ "purpose": "Supports tablet events.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "im": {
+ "label": "QInputContext",
+ "purpose": "Provides complex input methods.",
+ "section": "Kernel",
+ "condition": "features.library",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "validator": {
+ "label": "QValidator",
+ "purpose": "Supports validation of input text.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "standarditemmodel": {
+ "label": "QStandardItemModel",
+ "purpose": "Provides a generic model for storing custom data.",
+ "section": "ItemViews",
+ "condition": "features.itemmodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformatplugin": {
+ "label": "QImageIOPlugin",
+ "purpose": "Provides a base for writing a image format plugins.",
+ "section": "Images",
+ "condition": "features.library",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "movie": {
+ "label": "QMovie",
+ "purpose": "Supports animated images.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_bmp": {
+ "label": "BMP Image Format",
+ "purpose": "Supports Microsoft's Bitmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_ppm": {
+ "label": "PPM Image Format",
+ "purpose": "Supports the Portable Pixmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_xbm": {
+ "label": "XBM Image Format",
+ "purpose": "Supports the X11 Bitmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_xpm": {
+ "label": "XPM Image Format",
+ "purpose": "Supports the X11 Pixmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_png": {
+ "label": "PNG Image Format",
+ "purpose": "Supports the Portable Network Graphics image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_jpeg": {
+ "label": "JPEG Image Format",
+ "purpose": "Supports the Joint Photographic Experts Group image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "image_heuristic_mask": {
+ "label": "QImage::createHeuristicMask()",
+ "purpose": "Supports creating a 1-bpp heuristic mask for images.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "image_text": {
+ "label": "Image Text",
+ "purpose": "Supports image file text strings.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "picture": {
+ "label": "QPicture",
+ "purpose": "Supports recording and replaying QPainter commands.",
+ "section": "Painting",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "colornames": {
+ "label": "Color Names",
+ "purpose": "Supports color names such as \"red\", used by QColor and by some HTML documents.",
+ "section": "Painting",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "pdf": {
+ "label": "QPdf",
+ "purpose": "Provides a PDF backend for QPainter.",
+ "section": "Painting",
+ "condition": "features.temporaryfile",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "freetype": {
+ "label": "Freetype Font Engine",
+ "purpose": "Supports the FreeType 2 font engine (and its supported font formats).",
+ "section": "Fonts",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "desktopservices": {
+ "label": "QDesktopServices",
+ "purpose": "Provides methods for accessing common desktop services.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "systemtrayicon": {
+ "label": "QSystemTrayIcon",
+ "purpose": "Provides an icon for an application in the system tray.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "accessibility": {
+ "label": "Accessibility",
+ "purpose": "Provides accessibility support.",
+ "section": "Utilities",
+ "condition": "features.properties",
+ "output": [ "publicFeature", "feature" ]
+ }
+ },
+
+ "earlyReport": [
+ {
+ "type": "error",
+ "condition": "input.xcb != '' && input.xcb != 'no' && input.xkbcommon == 'no'",
+ "message": "XCB plugin requires libxkbcommon. See -qt-xkbcommon-x11 and -system-xkbcommon-x11."
+ }
+ ],
+
+ "report": [
+ {
+ "type": "warning",
+ "condition": "features.xcb && !features.xkbcommon-system && !features.xkb-config-root",
+ "message": "Could not find XKB config root, use -xkb-config-root to set a path to
+XKB configuration data. This is required for keyboard input support."
+ },
+ {
+ "type": "note",
+ "condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge",
+ "message": "Disabling Linux Accessibility Bridge: D-Bus is missing."
+ },
+ {
+ "type": "warning",
+ "condition": "input.qpa-platform-guard != ''",
+ "message": "The [-no]-qpa-platform-guard argument is deprecated and has no effect."
+ },
+ {
+ "type": "warning",
+ "condition": "features.gui && config.linux && !config.android && !features.xcb && !features.eglfs && !features.directfb && !features.linuxfb && !features.mirclient",
+ "message": "No QPA platform plugin enabled! This will
+produce a Qt that cannot run GUI applications.
+The dependencies needed for xcb to build are listed in
+src/plugins/platforms/xcb/README"
+ },
+ {
+ "type": "warning",
+ "condition": "config.win32 && (features.opengles2 || features.opengl-dynamic) && !features.angle",
+ "message": "Using OpenGL ES 2.0 on Windows without ANGLE.
+The build will most likely fail.
+Specify -opengl desktop to use regular OpenGL."
+ },
+ {
+ "type": "warning",
+ "condition": "config.darwin && features.system-harfbuzz",
+ "message": "On OS X, AAT is supported only with -qt-harfbuzz."
+ },
+ {
+ "type": "error",
+ "condition": "features.gui && !config.watchos && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2 && !features.opengl-dynamic",
+ "message": "The OpenGL functionality tests failed!
+You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
+QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform."
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt Gui",
+ "entries": [
+ "freetype",
+ "system-freetype",
+ "harfbuzz",
+ "system-harfbuzz",
+ "fontconfig",
+ {
+ "section": "Image formats",
+ "entries": [
+ "gif", "ico", "jpeg", "system-jpeg", "png", "system-png"
+ ]
+ },
+ {
+ "section": "OpenGL",
+ "entries": [
+ {
+ "type": "feature",
+ "args": "angle",
+ "condition": "config.win32"
+ },
+ "egl",
+ "opengl-desktop",
+ {
+ "type": "feature",
+ "args": "opengl-dynamic",
+ "condition": "config.win32"
+ },
+ "opengles2",
+ "opengles3",
+ "opengles31"
+ ]
+ },
+ "sessionmanager"
+ ]
+ },
+ {
+ "section": "Features used by QPA backends",
+ "entries": [
+ "evdev",
+ "libinput",
+ "mtdev",
+ "tslib",
+ "xkbcommon-evdev"
+ ]
+ },
+ {
+ "section": "QPA backends",
+ "entries": [
+ "directfb", "eglfs",
+ {
+ "section": "EGLFS details",
+ "condition": "features.eglfs",
+ "entries": [
+ "eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
+ ]
+ },
+ "linuxfb", "mirclient",
+ {
+ "message": "INTEGRITY framebuffer",
+ "condition": "config.integrity",
+ "args": "integrityfb"
+ },
+ {
+ "section": "QNX",
+ "condition": "config.qnx",
+ "entries": [
+ "lgmon", "qqnx_imf"
+ ]
+ },
+ {
+ "section": "X11",
+ "condition": "features.xcb",
+ "entries": [
+ "system-xcb", "egl_x11", "xinput2", "xkb", "xlib", "xrender", "xcb-render", "xcb-glx", "xcb-xlib", "xkbcommon-system"
+ ]
+ },
+ {
+ "section": "Windows",
+ "condition": "config.win32",
+ "entries": [
+ "direct2d", "directwrite", "directwrite2"
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/gui/configure.pri b/src/gui/configure.pri
new file mode 100644
index 0000000000..d79c5a6bba
--- /dev/null
+++ b/src/gui/configure.pri
@@ -0,0 +1,67 @@
+# custom tests
+
+# Check for Direct X SDK (include, lib, and direct shader compiler 'fxc').
+# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
+# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
+# the Windows SDK. Checking for the header is not sufficient, since it
+# is also present in MinGW.
+defineTest(qtConfTest_directX) {
+ dxdir = $$getenv("DXSDK_DIR")
+ !isEmpty(dxdir) {
+ EXTRA_INCLUDEPATH += $$dxdir/include
+ equals(QT_ARCH, x86_64): \
+ EXTRA_LIBDIR += $$dxdir/lib/x64
+ else: \
+ EXTRA_LIBDIR += $$dxdir/lib/x86
+ EXTRA_PATH += $$dxdir/Utilities/bin/x86
+ }
+
+ $$qtConfEvaluate("features.sse2") {
+ ky = $$size($${1}.files._KEYS_)
+ $${1}.files._KEYS_ += $$ky
+ # Not present on MinGW-32
+ $${1}.files.$${ky} = "intrin.h"
+ }
+
+ qtConfTest_files($${1}): return(true)
+ return(false)
+}
+
+defineTest(qtConfTest_xkbConfigRoot) {
+ qtConfTest_getPkgConfigVariable($${1}): return(true)
+
+ for (dir, $$list("/usr/share/X11/xkb", "/usr/local/share/X11/xkb")) {
+ exists($$dir) {
+ $${1}.value = $$dir
+ export($${1}.value)
+ $${1}.cache += value
+ export($${1}.cache)
+ return(true)
+ }
+ }
+ return(false)
+}
+
+defineTest(qtConfTest_qpaDefaultPlatform) {
+ name =
+ !isEmpty(config.input.qpa_default_platform): name = $$config.input.qpa_default_platform
+ else: !isEmpty(QT_QPA_DEFAULT_PLATFORM): name = $$QT_QPA_DEFAULT_PLATFORM
+ else: winrt: name = winrt
+ else: win32: name = windows
+ else: android: name = android
+ else: macos: name = cocoa
+ else: ios: name = ios
+ else: qnx: name = qnx
+ else: integrity: name = integrityfb
+ else: name = xcb
+
+ $${1}.value = $$name
+ $${1}.plugin = q$$name
+ $${1}.name = "\"$$name\""
+ export($${1}.value)
+ export($${1}.plugin)
+ export($${1}.name)
+ $${1}.cache += value plugin name
+ export($${1}.cache)
+ return(true)
+}
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
index 9781135960..a9fe520d5e 100644
--- a/src/gui/doc/src/qtgui.qdoc
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -187,6 +187,19 @@
More info in \l{Drag and Drop}
+ \section1 Licenses and Attributions
+
+ Qt GUI is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt GUI potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtgui}
+
\section1 Reference
\list
\li \l{Qt GUI C++ Classes}
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 462f133ff8..a6eaadd6c5 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -1,7 +1,7 @@
TARGET = QtGui
QT = core-private
-contains(QT_CONFIG, opengl.*): MODULE_CONFIG = opengl
+qtConfig(opengl.*): MODULE_CONFIG = opengl
DEFINES += QT_NO_USING_NAMESPACE
@@ -18,7 +18,7 @@ MODULE_PLUGIN_TYPES = \
egldeviceintegrations
# This is here only because the platform plugin is no module, obviously.
-win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
+qtConfig(angle) {
MODULE_AUX_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtANGLE
}
@@ -53,7 +53,7 @@ load(cmake_functions)
win32: CMAKE_WINDOWS_BUILD = True
-contains(QT_CONFIG, angle) {
+qtConfig(angle) {
CMAKE_GL_INCDIRS = $$CMAKE_INCLUDE_DIR
CMAKE_ANGLE_EGL_DLL_RELEASE = libEGL.dll
CMAKE_ANGLE_EGL_IMPLIB_RELEASE = libEGL.lib
@@ -66,22 +66,22 @@ contains(QT_CONFIG, angle) {
CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
} else {
- contains(QT_CONFIG, egl) {
+ qtConfig(egl) {
CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL)
!isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL)
}
- contains(QT_CONFIG, opengles2) {
+ qtConfig(opengles2) {
!isEmpty(QMAKE_INCDIR_OPENGL_ES2): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL_ES2)
CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL_ES2)
!isEmpty(QMAKE_LIBDIR_OPENGL_ES2): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL_ES2)
CMAKE_GL_HEADER_NAME = GLES2/gl2.h
CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
- } else:contains(QT_CONFIG, opengl) {
+ } else: qtConfig(opengl) {
!isEmpty(QMAKE_INCDIR_OPENGL): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL)
- !contains(QT_CONFIG, dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
+ !qtConfig(dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
!isEmpty(QMAKE_LIBDIR_OPENGL): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL)
CMAKE_GL_HEADER_NAME = GL/gl.h
mac: CMAKE_GL_HEADER_NAME = gl.h
@@ -89,6 +89,6 @@ contains(QT_CONFIG, angle) {
}
}
-contains(QT_CONFIG, egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
+qtConfig(egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 8db944e5e3..3c4d2c0bbf 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -11,7 +11,6 @@ HEADERS += \
image/qimagereader.h \
image/qimagewriter.h \
image/qmovie.h \
- image/qnativeimage_p.h \
image/qpaintengine_pic_p.h \
image/qpicture.h \
image/qpicture_p.h \
@@ -45,7 +44,6 @@ SOURCES += \
image/qmovie.cpp \
image/qpixmap_raster.cpp \
image/qpixmap_blitter.cpp \
- image/qnativeimage.cpp \
image/qimagepixmapcleanuphooks.cpp \
image/qicon.cpp \
image/qiconloader.cpp \
@@ -55,6 +53,8 @@ SOURCES += \
win32:!winrt: SOURCES += image/qpixmap_win.cpp
+darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm
+
NO_PCH_SOURCES += image/qimage_compat.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
@@ -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)
+qtConfig(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/qbitmap.h b/src/gui/image/qbitmap.h
index 68727e74b5..def59b3f89 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -40,6 +40,7 @@
#ifndef QBITMAP_H
#define QBITMAP_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index c4800e3f97..258ce0fce6 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_BMP
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/qicon.h b/src/gui/image/qicon.h
index 1b0e73c21b..40d3e92af9 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -40,7 +40,7 @@
#ifndef QICON_H
#define QICON_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsize.h>
#include <QtCore/qlist.h>
#include <QtGui/qpixmap.h>
diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h
index cfae9b3e52..a978a72192 100644
--- a/src/gui/image/qicon_p.h
+++ b/src/gui/image/qicon_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qsize.h>
#include <QtCore/qlist.h>
#include <QtGui/qpixmap.h>
diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h
index c702a1e8bb..b0c92ced73 100644
--- a/src/gui/image/qiconengine.h
+++ b/src/gui/image/qiconengine.h
@@ -40,7 +40,7 @@
#ifndef QICONENGINE_H
#define QICONENGINE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qlist.h>
#include <QtGui/qicon.h>
diff --git a/src/gui/image/qiconengineplugin.h b/src/gui/image/qiconengineplugin.h
index aacb3a9ebb..7a01d3731c 100644
--- a/src/gui/image/qiconengineplugin.h
+++ b/src/gui/image/qiconengineplugin.h
@@ -40,6 +40,7 @@
#ifndef QICONENGINEPLUGIN_H
#define QICONENGINEPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 0233ccbf87..eda9d6f24e 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -168,7 +168,7 @@ class QIconCacheGtkReader
{
public:
explicit QIconCacheGtkReader(const QString &themeDir);
- QVector<const char *> lookup(const QString &);
+ QVector<const char *> lookup(const QStringRef &);
bool isValid() const { return m_isValid; }
private:
QFile m_file;
@@ -199,7 +199,7 @@ private:
QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
: m_isValid(false)
{
- QFileInfo info(dirName + QLatin1Literal("/icon-theme.cache"));
+ QFileInfo info(dirName + QLatin1String("/icon-theme.cache"));
if (!info.exists() || info.lastModified() < QFileInfo(dirName).lastModified())
return;
m_file.setFileName(info.absoluteFilePath());
@@ -241,7 +241,7 @@ static quint32 icon_name_hash(const char *p)
with this name is present. The char* are pointers to the mapped data.
For example, this would return { "32x32/apps", "24x24/apps" , ... }
*/
-QVector<const char *> QIconCacheGtkReader::lookup(const QString &name)
+QVector<const char *> QIconCacheGtkReader::lookup(const QStringRef &name)
{
QVector<const char *> ret;
if (!isValid())
@@ -316,10 +316,8 @@ QIconTheme::QIconTheme(const QString &themeName)
#ifndef QT_NO_SETTINGS
if (themeIndex.exists()) {
const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
- QStringListIterator keyIterator(indexReader.allKeys());
- while (keyIterator.hasNext()) {
-
- const QString key = keyIterator.next();
+ const QStringList keys = indexReader.allKeys();
+ for (const QString &key : keys) {
if (key.endsWith(QLatin1String("/Size"))) {
// Note the QSettings ini-format does not accept
// slashes in key names, hence we have to cheat
@@ -396,7 +394,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
const QStringList contentDirs = theme.contentDirs();
- QString iconNameFallback = iconName;
+ QStringRef iconNameFallback(&iconName);
// Iterate through all icon's fallbacks in current theme
while (info.entries.isEmpty()) {
@@ -431,27 +429,29 @@ 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);
+ }
}
}
}
if (!info.entries.isEmpty()) {
- info.iconName = iconNameFallback;
+ info.iconName = iconNameFallback.toString();
break;
}
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 0945add2fb..583499be76 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -40,7 +40,7 @@
#ifndef QICONLOADER_P_H
#define QICONLOADER_P_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_ICON
//
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 64673d44b8..8bbcfa612d 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);
}
/*!
@@ -1889,7 +1888,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_RGBA8888:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
xorbits = 0xffffff00;
@@ -1901,7 +1900,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_ARGB32:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
xorbits = 0x00ffffff;
break;
@@ -2286,7 +2285,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);
}
/*!
@@ -2388,7 +2387,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);
}
@@ -2574,7 +2573,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;
@@ -3015,6 +3014,37 @@ template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,
}
}
+inline void do_flip(QImageData *dst, QImageData *src, int w, int h, int depth)
+{
+ const int data_bytes_per_line = w * (depth / 8);
+ if (dst == src) {
+ uint *srcPtr = reinterpret_cast<uint *>(src->data);
+ uint *dstPtr = reinterpret_cast<uint *>(dst->data + (h - 1) * dst->bytes_per_line);
+ h = h / 2;
+ const int uint_per_line = (data_bytes_per_line + 3) >> 2; // bytes per line must be a multiple of 4
+ for (int y = 0; y < h; ++y) {
+ // This is auto-vectorized, no need for SSE2 or NEON versions:
+ for (int x = 0; x < uint_per_line; x++) {
+ const uint d = dstPtr[x];
+ const uint s = srcPtr[x];
+ dstPtr[x] = s;
+ srcPtr[x] = d;
+ }
+ srcPtr += src->bytes_per_line >> 2;
+ dstPtr -= dst->bytes_per_line >> 2;
+ }
+
+ } else {
+ const uchar *srcPtr = src->data;
+ uchar *dstPtr = dst->data + (h - 1) * dst->bytes_per_line;
+ for (int y = 0; y < h; ++y) {
+ memcpy(dstPtr, srcPtr, data_bytes_per_line);
+ srcPtr += src->bytes_per_line;
+ dstPtr -= dst->bytes_per_line;
+ }
+ }
+}
+
inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool vertical)
{
Q_ASSERT(src->width == dst->width && src->height == dst->height && src->depth == dst->depth);
@@ -3027,6 +3057,12 @@ inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool ve
depth = 8;
}
+ if (vertical && !horizontal) {
+ // This one is simple and common, so do it a little more optimized
+ do_flip(dst, src, w, h, depth);
+ return;
+ }
+
int dstX0 = 0, dstXIncr = 1;
int dstY0 = 0, dstYIncr = 1;
if (horizontal) {
@@ -5217,4 +5253,33 @@ Q_GUI_EXPORT void qt_imageTransform(QImage &src, QImageIOHandler::Transformation
}
}
+QMap<QString, QString> qt_getImageText(const QImage &image, const QString &description)
+{
+ QMap<QString, QString> text = qt_getImageTextFromDescription(description);
+ const auto textKeys = image.textKeys();
+ for (const QString &key : textKeys) {
+ if (!key.isEmpty() && !text.contains(key))
+ text.insert(key, image.text(key));
+ }
+ return text;
+}
+
+QMap<QString, QString> qt_getImageTextFromDescription(const QString &description)
+{
+ QMap<QString, QString> text;
+ const auto pairs = description.splitRef(QLatin1String("\n\n"));
+ for (const QStringRef &pair : pairs) {
+ int index = pair.indexOf(QLatin1Char(':'));
+ if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
+ if (!pair.trimmed().isEmpty())
+ text.insert(QLatin1String("Description"), pair.toString().simplified());
+ } else {
+ const QStringRef key = pair.left(index);
+ if (!key.trimmed().isEmpty())
+ text.insert(key.toString(), pair.mid(index + 2).toString().simplified());
+ }
+ }
+ return text;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 6f8e214b11..91aaf673d0 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -40,6 +40,7 @@
#ifndef QIMAGE_H
#define QIMAGE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qcolor.h>
#include <QtGui/qrgb.h>
#include <QtGui/qpaintdevice.h>
@@ -53,6 +54,10 @@
#include <QtCore/qstringlist.h>
#endif
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGImage);
+#endif
+
QT_BEGIN_NAMESPACE
@@ -320,6 +325,11 @@ public:
static QPixelFormat toPixelFormat(QImage::Format format) Q_DECL_NOTHROW;
static QImage::Format toImageFormat(QPixelFormat format) Q_DECL_NOTHROW;
+ // Platform spesific conversion functions
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED;
+#endif
+
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const;
QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index bb0b76d55f..9bd098b7b1 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,16 +124,18 @@ 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);
Q_ASSERT(src->format > QImage::Format_Indexed8);
const int buffer_size = 2048;
- uint buffer[buffer_size];
+ uint buf[buffer_size];
+ uint *buffer = buf;
const QPixelLayout *srcLayout = &qPixelLayouts[src->format];
const QPixelLayout *destLayout = &qPixelLayouts[dest->format];
const uchar *srcData = src->data;
@@ -158,15 +160,26 @@ 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) {
- int l = qMin(src->width - x, buffer_size);
+ dither.x = x;
+ int l = src->width - x;
+ if (destLayout->bpp == QPixelLayout::BPP32)
+ buffer = reinterpret_cast<uint *>(destData) + x;
+ else
+ l = qMin(l, buffer_size);
const uint *ptr = fetch(buffer, srcData, x, l);
- ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0);
- ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0);
- store(destData, ptr, x, l);
+ ptr = convertToARGB32PM(buffer, ptr, l, 0, ditherPtr);
+ ptr = convertFromARGB32PM(buffer, ptr, l, 0, ditherPtr);
+ if (ptr != reinterpret_cast<uint *>(destData))
+ store(destData, ptr, x, l);
x += l;
}
srcData += src->bytes_per_line;
@@ -174,7 +187,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 +220,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_darwin.mm b/src/gui/image/qimage_darwin.mm
new file mode 100644
index 0000000000..d72733abd3
--- /dev/null
+++ b/src/gui/image/qimage_darwin.mm
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qimage.h"
+
+#include <private/qcore_mac_p.h>
+
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ Creates a \c CGImage equivalent to the QImage \a image. Returns a
+ \c CGImageRef handle.
+
+ The returned CGImageRef partakes in the QImage implicit sharing,
+ and holds a reference to the QImage data. CGImage is immutable
+ and will never detach the QImage. Writing to the QImage will detach
+ as usual.
+
+ This function is fast, and does not copy or convert image data.
+
+ The following image formats are supported, and will be mapped to
+ a corresponding native image type:
+
+ \table
+ \header
+ \li Qt
+ \li CoreGraphics
+ \row
+ \li Format_ARGB32
+ \li kCGImageAlphaFirst | kCGBitmapByteOrder32Host
+ \row
+ \li Format_RGB32
+ \li kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host
+ \row
+ \li Format_RGBA8888_Premultiplied
+ \li kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_RGBA8888
+ \li kCGImageAlphaLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_RGBX8888
+ \li kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_ARGB32_Premultiplied
+ \li kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host
+ \endtable
+
+ Other formats are not supported; this function returns a null
+ CGImageRef for those cases. Users of this function may then
+ convert the QImage to a supported formate first, for example
+ Format_ARGB32_Premultiplied.
+
+ The CGImageRef color space is set to the sRGB color space.
+
+ \sa toNSImage()
+*/
+CGImageRef QImage::toCGImage() const
+{
+ if (isNull())
+ return nil;
+
+ // Determine the target native format
+ uint cgflags = kCGImageAlphaNone;
+ switch (format()) {
+ case QImage::Format_ARGB32:
+ cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
+ break;
+ case QImage::Format_RGB32:
+ cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
+ break;
+ case QImage::Format_RGBA8888_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_RGBA8888:
+ cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_RGBX8888:
+ cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_ARGB32_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
+ break;
+ default: break;
+ }
+
+ // Format not supported: return nil CGImageRef
+ if (cgflags == kCGImageAlphaNone)
+ return nil;
+
+ // Create a data provider that owns a copy of the QImage and references the image data.
+ auto deleter = [](void *image, const void *, size_t)
+ { delete static_cast<QImage *>(image); };
+ QCFType<CGDataProviderRef> dataProvider =
+ CGDataProviderCreateWithData(new QImage(*this), bits(), byteCount(), deleter);
+
+ QCFType<CGColorSpaceRef> colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+
+ const size_t bitsPerComponent = 8;
+ const size_t bitsPerPixel = 32;
+ const CGFloat *decode = nullptr;
+ const bool shouldInterpolate = false;
+
+ return CGImageCreate(width(), height(), bitsPerComponent, bitsPerPixel,
+ this->bytesPerLine(), colorSpace, cgflags, dataProvider,
+ decode, shouldInterpolate, kCGRenderingIntentDefault);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 3e76f39b94..775ab6d541 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QMap>
#include <QVector>
@@ -212,6 +212,9 @@ inline QImage::Format qt_alphaVersionForPainting(QImage::Format format)
return toFormat;
}
+Q_GUI_EXPORT QMap<QString, QString> qt_getImageText(const QImage &image, const QString &description);
+Q_GUI_EXPORT QMap<QString, QString> qt_getImageTextFromDescription(const QString &description);
+
QT_END_NAMESPACE
#endif // QIMAGE_P_H
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/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index 8f196ee9e0..baf9853259 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -40,6 +40,7 @@
#ifndef QIMAGEIOHANDLER_H
#define QIMAGEIOHANDLER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index f0ac17b0a9..29144c6656 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 4dada4ca82..4390e46fde 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -147,6 +147,9 @@
#include <private/qfactoryloader_p.h>
#include <QMutexLocker>
+// for qt_getImageText
+#include <private/qimage_p.h>
+
// image handlers
#include <private/qbmphandler_p.h>
#include <private/qppmhandler_p.h>
@@ -155,12 +158,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 +172,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 +200,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 +340,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 +417,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 +453,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;
}
@@ -607,7 +569,7 @@ bool QImageReaderPrivate::initHandler()
do {
file->setFileName(fileName + QLatin1Char('.')
- + QString::fromLatin1(extensions.at(currentExtension++).constData()));
+ + QLatin1String(extensions.at(currentExtension++).constData()));
file->open(QIODevice::ReadOnly);
} while (!file->isOpen() && currentExtension < extensions.size());
@@ -633,18 +595,8 @@ bool QImageReaderPrivate::initHandler()
*/
void QImageReaderPrivate::getText()
{
- if (!text.isEmpty() || (!handler && !initHandler()) || !handler->supportsOption(QImageIOHandler::Description))
- return;
- foreach (const QString &pair, handler->option(QImageIOHandler::Description).toString().split(
- QLatin1String("\n\n"))) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
- text.insert(QLatin1String("Description"), pair.simplified());
- } else {
- QString key = pair.left(index);
- text.insert(key, pair.mid(index + 2).simplified());
- }
- }
+ if (text.isEmpty() && (handler || initHandler()) && handler->supportsOption(QImageIOHandler::Description))
+ text = qt_getImageTextFromDescription(handler->option(QImageIOHandler::Description).toString());
}
/*!
@@ -674,12 +626,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;
}
/*!
@@ -1202,7 +1151,7 @@ bool QImageReader::autoTransform() const
case QImageReaderPrivate::UsePluginDefault:
if (d->initHandler())
return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
- // no break
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index ad4f56c001..9d6c1e0b1e 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -40,6 +40,7 @@
#ifndef QIMAGEREADER_H
#define QIMAGEREADER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qimage.h>
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/qimagewriter.h b/src/gui/image/qimagewriter.h
index a6208ae5dc..58f8c51472 100644
--- a/src/gui/image/qimagewriter.h
+++ b/src/gui/image/qimagewriter.h
@@ -40,6 +40,7 @@
#ifndef QIMAGEWRITER_H
#define QIMAGEWRITER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qlist.h>
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/qmovie.h b/src/gui/image/qmovie.h
index cf644d3347..2b41e07dba 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -40,10 +40,11 @@
#ifndef QMOVIE_H
#define QMOVIE_H
-#include <QtCore/qobject.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_MOVIE
+#include <QtCore/qobject.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qlist.h>
#include <QtGui/qimagereader.h>
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index 6894593092..7c690c1498 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -44,15 +44,15 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QAbstractItemModel*. This header file may change from version
-// to version without notice, or even be removed.
+// 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 "QtGui/qpaintengine.h"
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qpaintengine.h>
#ifndef QT_NO_PICTURE
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index f375157317..8da11caee4 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -40,6 +40,7 @@
#ifndef QPICTURE_H
#define QPICTURE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qsharedpointer.h>
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index df1235469c..67db9aa354 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include "QtCore/qbuffer.h"
#include "QtCore/qobjectdefs.h"
diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h
index 003ccac116..32195687c7 100644
--- a/src/gui/image/qpictureformatplugin.h
+++ b/src/gui/image/qpictureformatplugin.h
@@ -40,6 +40,7 @@
#ifndef QPICTUREFORMATPLUGIN_H
#define QPICTUREFORMATPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 59d6dc12c6..a360debf5b 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);
}
/*!
@@ -778,7 +770,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
QFileInfo info(fileName);
QString key = QLatin1String("qt_pixmap")
% info.absoluteFilePath()
- % HexString<uint>(info.lastModified().toTime_t())
+ % HexString<uint>(info.lastModified().toSecsSinceEpoch())
% HexString<quint64>(info.size())
% HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 165ec4a6b8..d651b57fd5 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -40,6 +40,7 @@
#ifndef QPIXMAP_H
#define QPIXMAP_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qcolor.h>
#include <QtCore/qnamespace.h>
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 0906b65d96..950695a9d7 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -113,10 +113,10 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con
return qRound(h * 25.4 / qt_defaultDpiY());
case QPaintDevice::PdmDepth:
return 32;
- case QPaintDevice::PdmDpiX: // fall-through
+ case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return qt_defaultDpiX();
- case QPaintDevice::PdmDpiY: // fall-through
+ case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return qt_defaultDpiY();
case QPaintDevice::PdmDevicePixelRatio:
@@ -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_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index bc97bbc1df..9889cfb8ec 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpa/qplatformpixmap.h>
#include <private/qpaintengine_blitter_p.h>
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 13104ce17f..741f7713da 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -42,7 +42,6 @@
#include <private/qfont_p.h>
#include "qpixmap_raster_p.h"
-#include "qnativeimage_p.h"
#include "qimage_p.h"
#include "qpaintengine.h"
@@ -50,9 +49,12 @@
#include "qimage.h"
#include <QBuffer>
#include <QImageReader>
+#include <QGuiApplication>
+#include <QScreen>
#include <private/qimage_p.h>
#include <private/qsimd_p.h>
#include <private/qdrawhelper_p.h>
+#include <qpa/qplatformscreen.h>
QT_BEGIN_NAMESPACE
@@ -88,6 +90,13 @@ QRasterPlatformPixmap::~QRasterPlatformPixmap()
{
}
+QImage::Format QRasterPlatformPixmap::systemOpaqueFormat()
+{
+ if (!QGuiApplication::primaryScreen())
+ return QImage::Format_RGB32;
+ return QGuiApplication::primaryScreen()->handle()->format();
+}
+
QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const
{
return new QRasterPlatformPixmap(pixelType());
@@ -99,7 +108,7 @@ void QRasterPlatformPixmap::resize(int width, int height)
if (pixelType() == BitmapType)
format = QImage::Format_MonoLSB;
else
- format = QNativeImage::systemFormat();
+ format = systemOpaqueFormat();
image = QImage(width, height, format);
w = width;
@@ -195,7 +204,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) {
@@ -306,13 +315,13 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32;
} else {
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
+ QImage::Format opaqueFormat = systemOpaqueFormat();
QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat);
if (!sourceImage.hasAlphaChannel()) {
format = opaqueFormat;
} else if ((flags & Qt::NoOpaqueDetection) == 0
- && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())
+ && !sourceImage.data_ptr()->checkForAlphaPixels())
{
format = opaqueFormat;
} else {
@@ -335,7 +344,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_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 1a42757669..95e018eb35 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpa/qplatformpixmap.h>
@@ -87,6 +88,7 @@ protected:
void createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace);
void setImage(const QImage &image);
QImage image;
+ static QImage::Format systemOpaqueFormat();
private:
friend class QPixmap;
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/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index cc35fd0fd2..856b82f559 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -40,6 +40,7 @@
#ifndef QPIXMAPCACHE_H
#define QPIXMAPCACHE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 951c4ea9b1..3c57367514 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qpixmapcache.h"
#include "qpaintengine.h"
#include <private/qimage_p.h>
diff --git a/src/gui/image/qplatformpixmap.h b/src/gui/image/qplatformpixmap.h
index c83278a4c3..8513755cca 100644
--- a/src/gui/image/qplatformpixmap.h
+++ b/src/gui/image/qplatformpixmap.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpixmap.h>
#include <QtCore/qatomic.h>
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index d021e6f09f..fdf77e162c 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -49,6 +49,8 @@
#include <qvariant.h>
#include <qvector.h>
+#include <private/qimage_p.h> // for qt_getImageText
+
#include <png.h>
#include <pngconf.h>
@@ -75,20 +77,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 +180,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 +205,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 +219,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 +477,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 +485,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 +512,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 +556,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;
@@ -730,27 +720,10 @@ void QPNGImageWriter::setGamma(float g)
gamma = g;
}
-
static void set_text(const QImage &image, png_structp png_ptr, png_infop info_ptr,
const QString &description)
{
- QMap<QString, QString> text;
- foreach (const QString &key, image.textKeys()) {
- if (!key.isEmpty())
- text.insert(key, image.text(key));
- }
- foreach (const QString &pair, description.split(QLatin1String("\n\n"))) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
- QString s = pair.simplified();
- if (!s.isEmpty())
- text.insert(QLatin1String("Description"), s);
- } else {
- QString key = pair.left(index);
- if (!key.simplified().isEmpty())
- text.insert(key, pair.mid(index + 2).simplified());
- }
- }
+ const QMap<QString, QString> text = qt_getImageText(image, description);
if (text.isEmpty())
return;
@@ -810,7 +783,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/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index fb5a830baa..269df25794 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_PNG
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index 1e8ca2b81e..8889d9e663 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_PPM
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index 5094a43ef6..561153376d 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_XBM
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index c8c8f993d3..1f1f6b388f 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/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index 9a2041be94..af3e98d3ff 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_XPM
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 5c04510af1..e965045524 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);
}
@@ -1877,36 +1868,7 @@ bool QStandardItem::operator<(const QStandardItem &other) const
{
const int role = model() ? model()->sortRole() : Qt::DisplayRole;
const QVariant l = data(role), r = other.data(role);
- // this code is copied from QSortFilterProxyModel::lessThan()
- if (l.userType() == QVariant::Invalid)
- return false;
- if (r.userType() == QVariant::Invalid)
- return true;
- switch (l.userType()) {
- case QVariant::Int:
- return l.toInt() < r.toInt();
- case QVariant::UInt:
- return l.toUInt() < r.toUInt();
- case QVariant::LongLong:
- return l.toLongLong() < r.toLongLong();
- case QVariant::ULongLong:
- return l.toULongLong() < r.toULongLong();
- case QMetaType::Float:
- return l.toFloat() < r.toFloat();
- case QVariant::Double:
- return l.toDouble() < r.toDouble();
- case QVariant::Char:
- return l.toChar() < r.toChar();
- case QVariant::Date:
- return l.toDate() < r.toDate();
- case QVariant::Time:
- return l.toTime() < r.toTime();
- case QVariant::DateTime:
- return l.toDateTime() < r.toDateTime();
- case QVariant::String:
- default:
- return l.toString().compare(r.toString()) < 0;
- }
+ return QAbstractItemModelPrivate::isVariantLessThan(l, r);
}
/*!
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index 476b936a25..a9cde106c1 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -40,6 +40,7 @@
#ifndef QSTANDARDITEMMODEL_H
#define QSTANDARDITEMMODEL_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtGui/qbrush.h>
#include <QtGui/qfont.h>
diff --git a/src/gui/itemmodels/qstandarditemmodel_p.h b/src/gui/itemmodels/qstandarditemmodel_p.h
index 1849e1a850..fbba93b93a 100644
--- a/src/gui/itemmodels/qstandarditemmodel_p.h
+++ b/src/gui/itemmodels/qstandarditemmodel_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qabstractitemmodel_p.h"
#ifndef QT_NO_STANDARDITEMMODEL
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 73a5a7b6ab..3b7e03a0ff 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -6,6 +6,8 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h
KERNEL_P= kernel
HEADERS += \
+ kernel/qtguiglobal.h \
+ kernel/qtguiglobal_p.h \
kernel/qgenericpluginfactory.h \
kernel/qgenericplugin.h \
kernel/qwindowsysteminterface.h \
@@ -137,7 +139,7 @@ SOURCES += \
kernel/qhighdpiscaling.cpp
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+qtConfig(opengl(es2)?) {
HEADERS += \
kernel/qplatformopenglcontext.h \
kernel/qopenglcontext.h \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index bb3895c2f5..21127eebbd 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -438,6 +438,10 @@ void QClipboard::setPixmap(const QPixmap &pixmap, Mode mode)
The text(), image(), and pixmap() functions are simpler
wrappers for retrieving text, image, and pixmap data.
+ \note The pointer returned might become invalidated when the contents
+ of the clipboard changes; either by calling one of the setter functions
+ or externally by the system clipboard changing.
+
\sa setMimeData()
*/
const QMimeData* QClipboard::mimeData(Mode mode) const
@@ -553,7 +557,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 +569,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/qclipboard.h b/src/gui/kernel/qclipboard.h
index 2588288880..e91444d3dc 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -40,6 +40,7 @@
#ifndef QCLIPBOARD_H
#define QCLIPBOARD_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 814e8ab7bd..c7e9188e5b 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -40,6 +40,7 @@
#ifndef QCURSOR_H
#define QCURSOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtGui/qwindowdefs.h>
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 8dcea7fdcc..37245a793f 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -51,8 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
-#include "QtCore/qglobal.h"
#include "QtCore/qnamespace.h"
#include "QtGui/qpixmap.h"
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 21f9b46654..a59612474b 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -149,17 +149,12 @@ Qt::DropAction QDragManager::drag(QDrag *o)
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
-static QStringList imageReadMimeFormats()
+static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
{
QStringList formats;
- QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ formats.reserve(imageFormats.size());
+ for (const auto &format : imageFormats)
+ formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
//put png at the front because it is best
int pngIndex = formats.indexOf(QLatin1String("image/png"));
@@ -169,25 +164,15 @@ static QStringList imageReadMimeFormats()
return formats;
}
-
-static QStringList imageWriteMimeFormats()
+static inline QStringList imageReadMimeFormats()
{
- QStringList formats;
- QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ return imageMimeFormats(QImageReader::supportedImageFormats());
+}
- //put png at the front because it is best
- int pngIndex = formats.indexOf(QLatin1String("image/png"));
- if (pngIndex != -1 && pngIndex != 0)
- formats.move(pngIndex, 0);
- return formats;
+static inline QStringList imageWriteMimeFormats()
+{
+ return imageMimeFormats(QImageWriter::supportedImageFormats());
}
QInternalMimeData::QInternalMimeData()
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index af7aaf771a..6f2ec46252 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qobject.h"
#include "QtCore/qmap.h"
#include "QtCore/qmimedata.h"
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 6332899c39..a8288e1b53 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -40,6 +40,7 @@
#ifndef QDRAG_H
#define QDRAG_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 19220b5492..affc4c2526 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);
}
@@ -405,6 +405,18 @@ Qt::MouseEventFlags QMouseEvent::flags() const
*/
/*!
+ \fn void QMouseEvent::setLocalPos(const QPointF &localPosition)
+
+ \since 5.8
+
+ \internal
+
+ Sets the local position in the mouse event to \a localPosition. This allows to re-use one event
+ when sending it to a series of receivers that expect the local pos in their
+ respective local coordinates.
+*/
+
+/*!
\fn QPointF QMouseEvent::windowPos() const
\since 5.0
@@ -829,9 +841,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 +871,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 +906,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 +1776,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 +2074,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 +2459,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)
{
}
@@ -3967,6 +3975,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#ifndef QT_NO_SHORTCUT
case QEvent::Shortcut: {
const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);
dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();
@@ -3975,6 +3984,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#endif
case QEvent::FocusAboutToChange:
case QEvent::FocusIn:
case QEvent::FocusOut:
@@ -4414,6 +4424,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 +4471,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 +4690,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 +4753,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 +4897,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 +5175,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() const
+{
+ return m_numericId;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 570212966f..a062331bd8 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -40,6 +40,7 @@
#ifndef QEVENT_H
#define QEVENT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qregion.h>
#include <QtCore/qnamespace.h>
@@ -51,7 +52,7 @@
#include <QtCore/qvector.h>
#include <QtCore/qset.h> // ### Qt 6: Remove
#include <QtCore/qurl.h>
-#include <QtCore/qfile.h> // ### Qt 6: Replace by <qiodevice.h> and forward declare QFile
+#include <QtCore/qfile.h> // ### Qt 6: Replace by <QtCore/qiodevice.h> and forward declare QFile
#include <QtGui/qvector2d.h>
#include <QtGui/qtouchdevice.h> // ### Qt 6: Replace by forward declaration
@@ -131,6 +132,8 @@ public:
inline Qt::MouseButton button() const { return b; }
inline Qt::MouseButtons buttons() const { return mouseState; }
+ inline void setLocalPos(const QPointF &localPosition) { l = localPosition; }
+
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QPointF posF() const { return l; }
#endif
@@ -535,8 +538,9 @@ public:
class Attribute {
public:
Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(qMove(val)) {}
- AttributeType type;
+ Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {}
+ AttributeType type;
int start;
int length;
QVariant value;
@@ -789,6 +793,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() const;
+
+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 +817,8 @@ public:
{
public:
enum InfoFlag {
- Pen = 0x0001
+ Pen = 0x0001,
+ Token = 0x0002
};
#ifndef Q_MOC_RUN
// otherwise moc gives
@@ -823,6 +844,7 @@ public:
{ qSwap(d, other.d); }
int id() const;
+ QPointerUniqueId uniqueId() const;
Qt::TouchPointState state() const;
@@ -847,12 +869,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 +894,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..7e82b9c654 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -40,7 +40,7 @@
#ifndef QEVENT_P_H
#define QEVENT_P_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qurl.h>
#include <QtGui/qevent.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/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h
index 7f1a493861..e8aa2e6f32 100644
--- a/src/gui/kernel/qgenericplugin.h
+++ b/src/gui/kernel/qgenericplugin.h
@@ -40,6 +40,7 @@
#ifndef QGENERICPLUGIN_H
#define QGENERICPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qgenericpluginfactory.h b/src/gui/kernel/qgenericpluginfactory.h
index 282f3fed6d..9cc77a0590 100644
--- a/src/gui/kernel/qgenericpluginfactory.h
+++ b/src/gui/kernel/qgenericpluginfactory.h
@@ -40,6 +40,7 @@
#ifndef QGENERICPLUGINFACTORY_H
#define QGENERICPLUGINFACTORY_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 353b623a3b..d8457bc041 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());
}
}
@@ -1304,7 +1315,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);
@@ -1418,9 +1429,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
@@ -1449,6 +1459,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();
@@ -2444,6 +2458,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);
@@ -2520,8 +2535,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;
}
@@ -2555,7 +2576,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;
@@ -2764,10 +2788,10 @@ void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePriva
void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
{
- if (!e->exposed)
+ if (!e->window)
return;
- QWindow *window = e->exposed.data();
+ QWindow *window = e->window.data();
if (!window)
return;
QWindowPrivate *p = qt_window_private(window);
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 10057c5b7f..6721970222 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -40,6 +40,7 @@
#ifndef QGUIAPPLICATION_H
#define QGUIAPPLICATION_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qinputmethod.h>
@@ -72,7 +73,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 +184,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/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index a028441a2f..e1a35e048c 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qguiapplication.h>
#include <QtCore/QPointF>
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 4ae4b209ca..bde0d20ea8 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -260,8 +260,7 @@ static bool convert(const QVariant::Private *d, int t,
static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d));
return static_cast<QColor *>(result)->isValid();
} else if (d->type == QVariant::ByteArray) {
- static_cast<QColor *>(result)->setNamedColor(QString::fromLatin1(
- *v_cast<QByteArray>(d)));
+ static_cast<QColor *>(result)->setNamedColor(QLatin1String(*v_cast<QByteArray>(d)));
return true;
} else if (d->type == QVariant::Brush) {
if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) {
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index fccd81f8e8..1085b546a7 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..32c8f07dc0 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qmargins.h>
#include <QtCore/qmath.h>
#include <QtCore/qrect.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/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index 1cf0443834..11bbaae592 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
index 45d8b64172..ae91f3a2ab 100644
--- a/src/gui/kernel/qinputdevicemanager_p_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qmap.h>
#include <private/qobject_p.h>
#include "qinputdevicemanager_p.h"
diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
index 1a63d1314e..efdefb6e5a 100644
--- a/src/gui/kernel/qinputmethod.h
+++ b/src/gui/kernel/qinputmethod.h
@@ -40,6 +40,7 @@
#ifndef QINPUTMETHOD_H
#define QINPUTMETHOD_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index 3f7cd195ea..81723bbe30 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qinputmethod.h>
#include <private/qobject_p.h>
#include <QtCore/QWeakPointer>
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 59977688e4..aeec7b7414 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qobject.h>
#include <private/qobject_p.h>
#include <qkeysequence.h>
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 9a75f4bc83..d59bd63caf 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1211,9 +1211,13 @@ QString QKeySequence::encodeString(int key)
static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
{
- if (!str.isEmpty())
- str += (format == QKeySequence::NativeText) ? QCoreApplication::translate("QShortcut", "+")
- : QString::fromLatin1("+");
+ if (!str.isEmpty()) {
+ if (format == QKeySequence::NativeText)
+ str += QCoreApplication::translate("QShortcut", "+");
+ else
+ str += QLatin1Char('+');
+ }
+
str += theKey;
}
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 3a660b063e..6bdfd84ca3 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -40,7 +40,7 @@
#ifndef QKEYSEQUENCE_H
#define QKEYSEQUENCE_H
-#include <QtCore/qnamespace.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qobjectdefs.h>
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 116e91c0cd..8ba86c31b8 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qkeysequence.h"
#include <algorithm>
diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h
index d639407e1a..bacc9c851a 100644
--- a/src/gui/kernel/qoffscreensurface.h
+++ b/src/gui/kernel/qoffscreensurface.h
@@ -40,6 +40,7 @@
#ifndef QOFFSCREENSURFACE_H
#define QOFFSCREENSURFACE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QObject>
#include <QtGui/qsurface.h>
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/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 33e3f1c3f6..3ec9ce3188 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLCONTEXT_H
#define QOPENGLCONTEXT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 2fe8446c65..57f70356b8 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
+
#ifndef QT_NO_OPENGL
#include "qopengl.h"
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index 8ab5c08442..e1bd3d11b2 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -42,7 +42,7 @@
#include <QtGui/QOpenGLFramebufferObject>
#include <QtGui/QOpenGLPaintDevice>
#include <QtGui/QOpenGLFunctions>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/QOpenGLTextureBlitter>
#include <QtGui/private/qopenglextensions_p.h>
#include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/QMatrix4x4>
diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h
index 6e2a8ab904..fe236f9538 100644
--- a/src/gui/kernel/qopenglwindow.h
+++ b/src/gui/kernel/qopenglwindow.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLWINDOW_H
#define QOPENGLWINDOW_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index c35478da38..4521c2f62c 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.cpp
@@ -187,9 +187,6 @@ void QPaintDeviceWindow::exposeEvent(QExposeEvent *exposeEvent)
// sometimes relative to the parent, depending on the platform plugin.
// We require local coords here.
d->doFlush(QRect(QPoint(0, 0), size()));
- } else if (!d->dirtyRegion.isEmpty()) {
- // Updates while non-exposed were ignored. Schedule an update now.
- requestUpdate();
}
}
diff --git a/src/gui/kernel/qpaintdevicewindow.h b/src/gui/kernel/qpaintdevicewindow.h
index 1b66ed7c41..81b41dcdd5 100644
--- a/src/gui/kernel/qpaintdevicewindow.h
+++ b/src/gui/kernel/qpaintdevicewindow.h
@@ -40,6 +40,7 @@
#ifndef QPAINTDEVICEWINDOW_H
#define QPAINTDEVICEWINDOW_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/QWindow>
#include <QtGui/QPaintDevice>
diff --git a/src/gui/kernel/qpaintdevicewindow_p.h b/src/gui/kernel/qpaintdevicewindow_p.h
index 39cd1b3615..a16b83689e 100644
--- a/src/gui/kernel/qpaintdevicewindow_p.h
+++ b/src/gui/kernel/qpaintdevicewindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/QPaintDeviceWindow>
#include <QtCore/QCoreApplication>
#include <QtGui/private/qwindow_p.h>
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index c130a1844b..d04fb1f0c5 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -40,6 +40,7 @@
#ifndef QPALETTE_H
#define QPALETTE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h
index a78a3b5ad3..6b2d6a6ac7 100644
--- a/src/gui/kernel/qpixelformat.h
+++ b/src/gui/kernel/qpixelformat.h
@@ -40,7 +40,7 @@
#ifndef QPIXELFORMAT_H
#define QPIXELFORMAT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformclipboard.h b/src/gui/kernel/qplatformclipboard.h
index c30e085d00..60733b0a9f 100644
--- a/src/gui/kernel/qplatformclipboard.h
+++ b/src/gui/kernel/qplatformclipboard.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index c644d4769a..af0214e016 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -49,16 +49,6 @@
QT_BEGIN_NAMESPACE
-QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
-{
- QList<QPlatformCursor *> result;
- for (const QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list)) {
- if (QPlatformCursor *cursor = screen->handle()->cursor())
- result.push_back(cursor);
- }
- return result;
-}
-
/*!
\class QPlatformCursor
\since 5.0
diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index 52c93c87e3..dddd9e5831 100644
--- a/src/gui/kernel/qplatformcursor.h
+++ b/src/gui/kernel/qplatformcursor.h
@@ -48,6 +48,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QList>
#include <QtGui/QImage>
#include <QtGui/QMouseEvent>
@@ -75,13 +76,6 @@ private:
QPoint hot;
};
-class QPlatformCursor;
-
-class Q_GUI_EXPORT QPlatformCursorPrivate {
-public:
- static QList<QPlatformCursor *> getInstances();
-};
-
class Q_GUI_EXPORT QPlatformCursor : public QObject {
public:
QPlatformCursor();
@@ -95,7 +89,6 @@ public:
virtual void setPos(const QPoint &pos);
private:
- Q_DECLARE_PRIVATE(QPlatformCursor)
friend void qt_qpa_set_cursor(QWidget * w, bool force);
friend class QApplicationPrivate;
};
diff --git a/src/gui/kernel/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..6caef070e2 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#include <QtCore/QList>
@@ -72,6 +73,8 @@ class QFontDialogOptionsPrivate;
class QFileDialogOptionsPrivate;
class QMessageDialogOptionsPrivate;
+#define QPLATFORMDIALOGHELPERS_HAS_CREATE
+
class Q_GUI_EXPORT QPlatformDialogHelper : public QObject
{
Q_OBJECT
@@ -176,6 +179,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 +193,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 +214,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 +238,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 +256,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 +268,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 +292,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 +324,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 +384,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 +422,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 +454,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/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h
index a9744a17ac..560f984a5b 100644
--- a/src/gui/kernel/qplatformdrag.h
+++ b/src/gui/kernel/qplatformdrag.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtGui/QPixmap>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.h b/src/gui/kernel/qplatformgraphicsbuffer.h
index 53fc551ad2..0aeef946e6 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.h
+++ b/src/gui/kernel/qplatformgraphicsbuffer.h
@@ -50,6 +50,7 @@
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QSize>
#include <QtCore/QRect>
#include <QtGui/QPixelFormat>
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index 82a88eca04..2afb5e6ba5 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -154,14 +154,14 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
switch (imageformat) {
case QImage::Format_ARGB32_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
swizzle = true;
break;
case QImage::Format_RGBA8888_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h
index 59fcd12fd0..5b7daff65a 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.h
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h
@@ -40,6 +40,7 @@
#ifndef QPLATFORMGRAPHICSBUFFERHELPER_H
#define QPLATFORMGRAPHICSBUFFERHELPER_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpa/qplatformgraphicsbuffer.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext.h b/src/gui/kernel/qplatforminputcontext.h
index 7afa6b82f2..26d40cd2c6 100644
--- a/src/gui/kernel/qplatforminputcontext.h
+++ b/src/gui/kernel/qplatforminputcontext.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qinputmethod.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_p.h b/src/gui/kernel/qplatforminputcontext_p.h
index 14e9dda072..c4f4b97d03 100644
--- a/src/gui/kernel/qplatforminputcontext_p.h
+++ b/src/gui/kernel/qplatforminputcontext_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontextfactory_p.h b/src/gui/kernel/qplatforminputcontextfactory_p.h
index 4106b2fedc..881421ce49 100644
--- a/src/gui/kernel/qplatforminputcontextfactory_p.h
+++ b/src/gui/kernel/qplatforminputcontextfactory_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontextplugin_p.h b/src/gui/kernel/qplatforminputcontextplugin_p.h
index 1bb0332ac7..3f45df922e 100644
--- a/src/gui/kernel/qplatforminputcontextplugin_p.h
+++ b/src/gui/kernel/qplatforminputcontextplugin_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 3490e786a8..5bf0df67db 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -402,6 +402,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return true;
case ItemViewActivateItemOnSingleClick:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick);
+ case UiEffects:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::UiEffects);
}
return 0;
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 6ac98c20ce..22a834f0e1 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <qpa/qplatformscreen.h>
#include <QtGui/qsurfaceformat.h>
@@ -155,7 +156,8 @@ public:
MousePressAndHoldInterval,
TabFocusBehavior,
ReplayMousePressOutsidePopup,
- ItemViewActivateItemOnSingleClick
+ ItemViewActivateItemOnSingleClick,
+ UiEffects
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qplatformintegrationfactory_p.h b/src/gui/kernel/qplatformintegrationfactory_p.h
index ea8c846557..22c77ce8bd 100644
--- a/src/gui/kernel/qplatformintegrationfactory_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegrationplugin.h b/src/gui/kernel/qplatformintegrationplugin.h
index 7d2a9b2a5f..f1136965b7 100644
--- a/src/gui/kernel/qplatformintegrationplugin.h
+++ b/src/gui/kernel/qplatformintegrationplugin.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index bd4f4d9beb..f08f0ef494 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpointer.h>
#include <QtGui/QFont>
#include <QtGui/QKeySequence>
@@ -83,7 +83,9 @@ public:
virtual void setRole(MenuRole role) = 0;
virtual void setCheckable(bool checkable) = 0;
virtual void setChecked(bool isChecked) = 0;
+#ifndef QT_NO_SHORTCUT
virtual void setShortcut(const QKeySequence& shortcut) = 0;
+#endif
virtual void setEnabled(bool enabled) = 0;
virtual void setIconSize(int size) = 0;
virtual void setNativeContents(WId item) { Q_UNUSED(item); }
diff --git a/src/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h
index f830221c70..95d6a03dbb 100644
--- a/src/gui/kernel/qplatformnativeinterface.h
+++ b/src/gui/kernel/qplatformnativeinterface.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/QObject>
#include <QtCore/QVariant>
diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h
index 77a8f63316..7f2e0d475b 100644
--- a/src/gui/kernel/qplatformoffscreensurface.h
+++ b/src/gui/kernel/qplatformoffscreensurface.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include "qplatformsurface.h"
#include <QtCore/qscopedpointer.h>
diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h
index 1a38a5fed3..f307cc14f9 100644
--- a/src/gui/kernel/qplatformopenglcontext.h
+++ b/src/gui/kernel/qplatformopenglcontext.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index cd300c34c8..030edea880 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qcoreevent.h>
diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h
index aa31c4db25..d5dc7b471a 100644
--- a/src/gui/kernel/qplatformscreen_p.h
+++ b/src/gui/kernel/qplatformscreen_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QScreen;
diff --git a/src/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h
index 52b8ce7854..339bbfde3f 100644
--- a/src/gui/kernel/qplatformservices.h
+++ b/src/gui/kernel/qplatformservices.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/QtGlobal>
+#include <QtGui/qtguiglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformsessionmanager.h b/src/gui/kernel/qplatformsessionmanager.h
index 98c364f7fe..ca7cab389b 100644
--- a/src/gui/kernel/qplatformsessionmanager.h
+++ b/src/gui/kernel/qplatformsessionmanager.h
@@ -51,6 +51,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qnamespace.h>
diff --git a/src/gui/kernel/qplatformsharedgraphicscache.h b/src/gui/kernel/qplatformsharedgraphicscache.h
index 6e0ba9151f..e11d2f41a9 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qimage.h>
diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 0bbe811803..5a1e4fe82d 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtGui/qsurface.h>
#include <QtGui/qsurfaceformat.h>
diff --git a/src/gui/kernel/qplatformsystemtrayicon.h b/src/gui/kernel/qplatformsystemtrayicon.h
index dcd7225180..c52dbfbd78 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.h
+++ b/src/gui/kernel/qplatformsystemtrayicon.h
@@ -41,6 +41,7 @@
#ifndef QPLATFORMSYSTEMTRAYICON_H
#define QPLATFORMSYSTEMTRAYICON_H
+#include <QtGui/qtguiglobal.h>
#include "QtCore/qobject.h"
#ifndef QT_NO_SYSTEMTRAYICON
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 7f74959a60..9c140f1d68 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -44,6 +44,7 @@
#include <QtCore/QVariant>
#include <QtCore/QStringList>
#include <QtCore/qfileinfo.h>
+#include <qicon.h>
#include <qpalette.h>
#include <qtextformat.h>
#include <private/qiconloader_p.h>
@@ -152,6 +153,7 @@ QT_BEGIN_NAMESPACE
*/
+#ifndef QT_NO_SHORTCUT
// Table of key bindings. It must be sorted on key sequence:
// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.)
// A priority of 1 indicates that this is the primary key binding when multiple are defined.
@@ -335,6 +337,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
};
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
+#endif
QPlatformThemePrivate::QPlatformThemePrivate()
: systemPalette(0)
@@ -405,14 +408,22 @@ QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) co
return QPixmap();
}
-QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions) const
+/*!
+ \brief Return an icon for \a fileInfo, observing \a iconOptions.
+
+ This function is queried by QFileIconProvider and similar classes to obtain
+ an icon for a file. If it does not return a non-null icon, fileIconPixmap()
+ is queried for a specific size.
+
+ \since 5.8
+*/
+
+QIcon QPlatformTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const
{
Q_UNUSED(fileInfo);
- Q_UNUSED(size);
Q_UNUSED(iconOptions);
// TODO Should return QCommonStyle pixmaps?
- return QPixmap();
+ return QIcon();
}
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
@@ -444,6 +455,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval);
case QPlatformTheme::ItemViewActivateItemOnSingleClick:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick);
+ case QPlatformTheme::UiEffects:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::UiEffects);
default:
return QPlatformTheme::defaultThemeHint(hint);
}
@@ -580,6 +593,7 @@ static inline int maybeSwapShortcut(int shortcut)
}
#endif
+#ifndef QT_NO_SHORTCUT
// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
struct ByStandardKey {
typedef bool result_type;
@@ -630,6 +644,7 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c
return list;
}
+#endif
/*!
Returns the text of a standard \a button.
@@ -727,10 +742,12 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
{
const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt();
unsigned result = 1u << keyboardScheme;
+#ifndef QT_NO_SHORTCUT
if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
|| keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
|| keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
result |= KB_X11;
+#endif
return result;
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index c4c7482995..686dbed4b1 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -49,12 +49,13 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/QtGlobal>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QScopedPointer>
#include <QtGui/QKeySequence>
QT_BEGIN_NAMESPACE
+class QIcon;
class QIconEngine;
class QMenu;
class QMenuBar;
@@ -270,7 +271,8 @@ public:
AnimateComboUiEffect = 0x8,
AnimateTooltipUiEffect = 0x10,
FadeTooltipUiEffect = 0x20,
- AnimateToolBoxUiEffect = 0x40
+ AnimateToolBoxUiEffect = 0x40,
+ HoverEffect = 0x80
};
enum IconOption {
@@ -300,12 +302,13 @@ public:
virtual QVariant themeHint(ThemeHint hint) const;
virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
- virtual QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions = 0) const;
-
+ virtual QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions iconOptions = 0) const;
virtual QIconEngine *createIconEngine(const QString &iconName) const;
+#ifndef QT_NO_SHORTCUT
virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
+#endif
virtual QString standardButtonText(int button) const;
diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h
index 11f9e261ef..73deb890bb 100644
--- a/src/gui/kernel/qplatformtheme_p.h
+++ b/src/gui/kernel/qplatformtheme_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/QtGlobal>
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qkeysequence_p.h"
QT_BEGIN_NAMESPACE
@@ -67,8 +67,10 @@ public:
void initializeSystemPalette();
+#ifndef QT_NO_SHORTCUT
static const QKeyBinding keyBindings[];
static const uint numberOfKeyBindings;
+#endif
static unsigned currentKeyPlatforms();
diff --git a/src/gui/kernel/qplatformthemefactory_p.h b/src/gui/kernel/qplatformthemefactory_p.h
index abd78d544d..3f77f03485 100644
--- a/src/gui/kernel/qplatformthemefactory_p.h
+++ b/src/gui/kernel/qplatformthemefactory_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformthemeplugin.h b/src/gui/kernel/qplatformthemeplugin.h
index 52aa09d1d5..7b56879940 100644
--- a/src/gui/kernel/qplatformthemeplugin.h
+++ b/src/gui/kernel/qplatformthemeplugin.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index b2a19dd3d9..dcee4d2d84 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -48,6 +48,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qrect.h>
#include <QtCore/qmargins.h>
diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h
index dc76adca86..62ecd61d9e 100644
--- a/src/gui/kernel/qplatformwindow_p.h
+++ b/src/gui/kernel/qplatformwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qrect.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h
index 915aea598f..76312bcda2 100644
--- a/src/gui/kernel/qrasterwindow.h
+++ b/src/gui/kernel/qrasterwindow.h
@@ -40,6 +40,7 @@
#ifndef QRASTERWINDOW_H
#define QRASTERWINDOW_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/QPaintDeviceWindow>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index bc4a25a65f..1dd8fb5e67 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -667,6 +667,10 @@ void QScreenPrivate::updatePrimaryOrientation()
that are not part of the application, window system frames, and so
on.
+ \warning Grabbing windows that are not part of the application is
+ not supported on systems such as iOS, where sandboxing/security
+ prevents reading pixels of windows not owned by the application.
+
The grabWindow() function grabs pixels from the screen, not from
the window, i.e. if there is another window partially or entirely
over the one you grab, you get pixels from the overlying window,
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index af4e8f4760..98e35aff43 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -40,6 +40,7 @@
#ifndef QSCREEN_H
#define QSCREEN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QList>
#include <QtCore/QObject>
#include <QtCore/QRect>
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
index 544c29a18f..f31658355b 100644
--- a/src/gui/kernel/qscreen_p.h
+++ b/src/gui/kernel/qscreen_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qscreen.h>
#include <qpa/qplatformscreen.h>
#include "qhighdpiscaling_p.h"
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 54c278afbf..21100b25d9 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -40,6 +40,7 @@
#ifndef QSESSIONMANAGER_H
#define QSESSIONMANAGER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
diff --git a/src/gui/kernel/qsessionmanager_p.h b/src/gui/kernel/qsessionmanager_p.h
index 982fc801ff..954443430e 100644
--- a/src/gui/kernel/qsessionmanager_p.h
+++ b/src/gui/kernel/qsessionmanager_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qobject_p.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index 21cecba9e8..2c25ca7c76 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/QRasterWindow>
#include <QtGui/QPixmap>
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index f513863e5b..8fc68229fb 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qkeysequence.h"
#include "QtCore/qvector.h"
#include "QtCore/qscopedpointer.h"
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index 8924b4d08f..0b8a0bc703 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpa/qplatformdrag.h>
#include <QtCore/QObject>
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index ecc2886a04..7ccf1d86b0 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -77,6 +77,7 @@ public:
, m_keyboardInputInterval(-1)
, m_cursorFlashTime(-1)
, m_tabFocusBehavior(-1)
+ , m_uiEffects(-1)
{}
int m_mouseDoubleClickInterval;
@@ -86,6 +87,7 @@ public:
int m_keyboardInputInterval;
int m_cursorFlashTime;
int m_tabFocusBehavior;
+ int m_uiEffects;
};
/*!
@@ -451,4 +453,34 @@ bool QStyleHints::singleClickActivation() const
return themeableHint(QPlatformTheme::ItemViewActivateItemOnSingleClick, QPlatformIntegration::ItemViewActivateItemOnSingleClick).toBool();
}
+/*!
+ \property QStyleHints::useHoverEffects
+ \brief \c true if UI elements should use hover effects. This is the
+ standard behavior on desktop platforms with a mouse pointer, whereas
+ on touch platforms the overhead of hover event delivery can be avoided.
+
+ \since 5.8
+*/
+bool QStyleHints::useHoverEffects() const
+{
+ Q_D(const QStyleHints);
+ return (d->m_uiEffects >= 0 ?
+ d->m_uiEffects :
+ themeableHint(QPlatformTheme::UiEffects, QPlatformIntegration::UiEffects).toInt()) & QPlatformTheme::HoverEffect;
+}
+
+void QStyleHints::setUseHoverEffects(bool useHoverEffects)
+{
+ Q_D(QStyleHints);
+ if (d->m_uiEffects >= 0 && useHoverEffects == bool(d->m_uiEffects & QPlatformTheme::HoverEffect))
+ return;
+ if (d->m_uiEffects == -1)
+ d->m_uiEffects = 0;
+ if (useHoverEffects)
+ d->m_uiEffects |= QPlatformTheme::HoverEffect;
+ else
+ d->m_uiEffects &= ~QPlatformTheme::HoverEffect;
+ emit useHoverEffectsChanged(useHoverEffects);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 0b07e60579..fb55cc7ed6 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEHINTS_H
#define QSTYLEHINTS_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
@@ -69,6 +70,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false CONSTANT FINAL)
Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior NOTIFY tabFocusBehaviorChanged FINAL)
Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool useHoverEffects READ useHoverEffects WRITE setUseHoverEffects NOTIFY useHoverEffectsChanged FINAL)
public:
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
@@ -95,6 +97,8 @@ public:
Qt::TabFocusBehavior tabFocusBehavior() const;
void setTabFocusBehavior(Qt::TabFocusBehavior tabFocusBehavior);
bool singleClickActivation() const;
+ bool useHoverEffects() const;
+ void setUseHoverEffects(bool useHoverEffects);
Q_SIGNALS:
void cursorFlashTimeChanged(int cursorFlashTime);
@@ -104,6 +108,7 @@ Q_SIGNALS:
void startDragDistanceChanged(int startDragDistance);
void startDragTimeChanged(int startDragTime);
void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior);
+ void useHoverEffectsChanged(bool useHoverEffects);
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index 86b800a6db..d9ccdc096d 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -40,6 +40,7 @@
#ifndef QSURFACE_H
#define QSURFACE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtGui/qsurfaceformat.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index 9e8bcc91a7..246163609e 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -39,8 +39,9 @@
#ifndef QSURFACEFORMAT_H
#define QSURFACEFORMAT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpair.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -50,6 +51,7 @@ class QSurfaceFormatPrivate;
class Q_GUI_EXPORT QSurfaceFormat
{
+ Q_GADGET
public:
enum FormatOption {
StereoBuffers = 0x0001,
@@ -57,6 +59,7 @@ public:
DeprecatedFunctions = 0x0004,
ResetNotification = 0x0008
};
+ Q_ENUM(FormatOption)
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
enum SwapBehavior {
@@ -65,6 +68,7 @@ public:
DoubleBuffer,
TripleBuffer
};
+ Q_ENUM(SwapBehavior)
enum RenderableType {
DefaultRenderableType = 0x0,
@@ -72,12 +76,14 @@ public:
OpenGLES = 0x2,
OpenVG = 0x4
};
+ Q_ENUM(RenderableType)
enum OpenGLContextProfile {
NoProfile,
CoreProfile,
CompatibilityProfile
};
+ Q_ENUM(OpenGLContextProfile)
QSurfaceFormat();
/*implicit*/ QSurfaceFormat(FormatOptions options);
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 8d1455f6c8..db12ba1078 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -47,7 +47,7 @@
// from corelib/global/qt_pch.h
#if defined __cplusplus
-#include <qglobal.h>
+#include <qtguiglobal.h>
#ifdef Q_OS_WIN
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/gui/kernel/qtguiglobal.h
index cc6c325b58..8a7409e3d9 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.h
+++ b/src/gui/kernel/qtguiglobal.h
@@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,20 +37,24 @@
**
****************************************************************************/
-#ifndef QEGLFSHOOKS_H
-#define QEGLFSHOOKS_H
+#ifndef QTGUIGLOBAL_H
+#define QTGUIGLOBAL_H
-#include "qeglfsglobal.h"
-#include "qeglfsdeviceintegration.h"
+#include <QtCore/qglobal.h>
+#include <QtGui/qtgui-config.h>
QT_BEGIN_NAMESPACE
-class QEglFSHooks : public QEGLDeviceIntegration
-{
-};
-
-Q_EGLFS_EXPORT QEGLDeviceIntegration *qt_egl_device_integration();
+#ifndef QT_STATIC
+# if defined(QT_BUILD_GUI_LIB)
+# define Q_GUI_EXPORT Q_DECL_EXPORT
+# else
+# define Q_GUI_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_GUI_EXPORT
+#endif
QT_END_NAMESPACE
-#endif // QEGLFSHOOKS_H
+#endif // QTGUIGLOBAL_H
diff --git a/src/gui/kernel/qtguiglobal_p.h b/src/gui/kernel/qtguiglobal_p.h
new file mode 100644
index 0000000000..d2c0b3c5d1
--- /dev/null
+++ b/src/gui/kernel/qtguiglobal_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTGUIGLOBAL_P_H
+#define QTGUIGLOBAL_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 <QtGui/qtguiglobal.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtGui/private/qtgui-config_p.h>
+
+#endif // QTGUIGLOBAL_P_H
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index 243f53d4ca..0fb24e47bf 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -40,6 +40,7 @@
#ifndef QTOUCHDEVICE_H
#define QTOUCHDEVICE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index b42b0507d9..203d9fca74 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qtouchdevice.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index a20f4329b1..edb65a2d4c 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2175,11 +2175,14 @@ void QWindowPrivate::deliverUpdateRequest()
Schedules a QEvent::UpdateRequest event to be delivered to this window.
The event is delivered in sync with the display vsync on platforms
- where this is possible. When driving animations, this function should
- be called once after drawing has completed.
-
- Calling this function multiple times will result in a single event
- being delivered to the window.
+ where this is possible. Otherwise, the event is delivered after a
+ delay of 5 ms. The additional time is there to give the event loop
+ a bit of idle time to gather system events, and can be overridden
+ using the QT_QPA_UPDATE_IDLE_TIME environment variable.
+
+ When driving animations, this function should be called once after drawing
+ has completed. Calling this function multiple times will result in a single
+ event being delivered to the window.
Subclasses of QWindow should reimplement event(), intercept the event and
call the application's rendering code, then call the base class
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 06bd788262..bf25cf64c9 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -40,6 +40,7 @@
#ifndef QWINDOW_H
#define QWINDOW_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QObject>
#include <QtCore/QEvent>
#include <QtCore/QMargins>
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 4020376feb..b8a9f5d3de 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
#include <qpa/qplatformwindow.h>
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index fb6b1831af..b4f3ed4712 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWDEFS_H
#define QWINDOWDEFS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qnamespace.h>
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index d1000856bb..b546fe305e 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWDEFS_WIN_H
#define QWINDOWDEFS_WIN_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
QT_BEGIN_NAMESPACE
@@ -111,13 +111,4 @@ typedef long HRESULT;
typedef struct tagMSG MSG;
-QT_BEGIN_NAMESPACE
-
-Q_CORE_EXPORT HINSTANCE qWinAppInst();
-Q_CORE_EXPORT HINSTANCE qWinAppPrevInst();
-Q_CORE_EXPORT int qWinAppCmdShow();
-Q_WIDGETS_EXPORT HDC qt_win_display_dc();
-
-QT_END_NAMESPACE
-
#endif // QWINDOWDEFS_WIN_H
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 1b7edb1278..bb778bc5fc 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -236,7 +236,7 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
#else
Q_UNUSED(window)
Q_UNUSED(timestamp)
- Q_UNUSED(key)
+ Q_UNUSED(keyCode)
Q_UNUSED(modifiers)
Q_UNUSED(nativeScanCode)
Q_UNUSED(nativeVirtualKey)
@@ -361,10 +361,10 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
}
-QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *exposed, const QRegion &region)
+QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion &region)
: WindowSystemEvent(Expose)
- , exposed(exposed)
- , isExposed(exposed && exposed->handle() ? exposed->handle()->isExposed() : false)
+ , window(window)
+ , isExposed(window && window->handle() ? window->handle()->isExposed() : false)
, region(region)
{
}
@@ -474,7 +474,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);
@@ -922,6 +925,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 6bf87439b9..e7e47ac6d9 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -48,6 +48,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QTime>
#include <QtGui/qwindowdefs.h>
#include <QtCore/QEvent>
@@ -117,11 +118,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/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index b218c1c68c..f471e1f550 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qwindowsysteminterface.h"
#include <QElapsedTimer>
@@ -329,8 +330,8 @@ public:
class ExposeEvent : public WindowSystemEvent {
public:
- ExposeEvent(QWindow *exposed, const QRegion &region);
- QPointer<QWindow> exposed;
+ ExposeEvent(QWindow *window, const QRegion &region);
+ QPointer<QWindow> window;
bool isExposed;
QRegion region;
};
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index 5e22fa6730..9a1ab54124 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -40,6 +40,7 @@
#ifndef QGENERICMATRIX_H
#define QGENERICMATRIX_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qdebug.h>
#include <QtCore/qdatastream.h>
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index bdcf4555d7..19540308a1 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -40,6 +40,7 @@
#ifndef QMATRIX4X4_H
#define QMATRIX4X4_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
#include <QtGui/qquaternion.h>
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index d4c91c430a..21b051e08e 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -40,6 +40,7 @@
#ifndef QQUATERNION_H
#define QQUATERNION_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qgenericmatrix.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index 697360bd5b..d2724c9498 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -40,6 +40,7 @@
#ifndef QVECTOR2D_H
#define QVECTOR2D_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index c3b335cf7c..c1d881a735 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -40,6 +40,7 @@
#ifndef QVECTOR3D_H
#define QVECTOR3D_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index 28a438f3ac..9387e8d187 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -40,6 +40,7 @@
#ifndef QVECTOR4D_H
#define QVECTOR4D_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index b13f258fda..2c3cca6b18 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -1,9 +1,9 @@
# Qt gui library, opengl module
-contains(QT_CONFIG, opengl):CONFIG += opengl
-contains(QT_CONFIG, opengles2):CONFIG += opengles2
+qtConfig(opengl): CONFIG += opengl
+qtConfig(opengles2): CONFIG += opengles2
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+qtConfig(opengl(es2)?) {
HEADERS += opengl/qopengl.h \
opengl/qopengl_p.h \
@@ -22,17 +22,14 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglpaintengine_p.h \
opengl/qopenglengineshadersource_p.h \
opengl/qopenglcustomshaderstage_p.h \
- opengl/qtriangulatingstroker_p.h \
opengl/qopengltextureglyphcache_p.h \
opengl/qopenglshadercache_p.h \
opengl/qopenglshadercache_meego_p.h \
- opengl/qtriangulator_p.h \
- opengl/qrbtree_p.h \
opengl/qopenglversionfunctions.h \
opengl/qopenglversionfunctionsfactory_p.h \
opengl/qopenglvertexarrayobject.h \
opengl/qopengldebug.h \
- opengl/qopengltextureblitter_p.h \
+ opengl/qopengltextureblitter.h \
opengl/qopengltexture.h \
opengl/qopengltexture_p.h \
opengl/qopengltexturehelper_p.h \
@@ -51,9 +48,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengl2pexvertexarray.cpp \
opengl/qopenglpaintengine.cpp \
opengl/qopenglcustomshaderstage.cpp \
- opengl/qtriangulatingstroker.cpp \
opengl/qopengltextureglyphcache.cpp \
- opengl/qtriangulator.cpp \
opengl/qopenglversionfunctions.cpp \
opengl/qopenglversionfunctionsfactory.cpp \
opengl/qopenglvertexarrayobject.cpp \
@@ -63,7 +58,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengltexturehelper.cpp \
opengl/qopenglpixeltransferoptions.cpp
- !contains(QT_CONFIG, opengles2) {
+ !qtConfig(opengles2) {
HEADERS += opengl/qopenglfunctions_1_0.h \
opengl/qopenglfunctions_1_1.h \
opengl/qopenglfunctions_1_2.h \
@@ -122,7 +117,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengltimerquery.cpp
}
- contains(QT_CONFIG, opengles2) {
+ qtConfig(opengles2) {
HEADERS += opengl/qopenglfunctions_es2.h
SOURCES += opengl/qopenglfunctions_es2.cpp
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 5f9d78b780..c7a3e79666 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -40,7 +40,7 @@
#ifndef QOPENGL_H
#define QOPENGL_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
@@ -95,14 +95,15 @@ typedef void* GLeglImageOES;
// applications cannot target ES 3. Therefore QOpenGLFunctions and
// friends do everything dynamically and never rely on these macros.
+# ifndef GL_GLEXT_PROTOTYPES
+# define GL_GLEXT_PROTOTYPES
+# endif
+
# if defined(QT_OPENGL_ES_3_1)
# include <GLES3/gl31.h>
# elif defined(QT_OPENGL_ES_3)
# include <GLES3/gl3.h>
# else
-# ifndef GL_GLEXT_PROTOTYPES
-# define GL_GLEXT_PROTOTYPES
-# endif
# include <GLES2/gl2.h>
#endif
@@ -119,10 +120,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 +130,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/qopengl2pexvertexarray_p.h b/src/gui/opengl/qopengl2pexvertexarray_p.h
index 22397391dd..5dc060ff3d 100644
--- a/src/gui/opengl/qopengl2pexvertexarray_p.h
+++ b/src/gui/opengl/qopengl2pexvertexarray_p.h
@@ -51,6 +51,7 @@
#ifndef QOPENGL2PEXVERTEXARRAY_P_H
#define QOPENGL2PEXVERTEXARRAY_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QRectF>
#include <private/qdatabuffer_p.h>
diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h
index 042b903625..cda062eacf 100644
--- a/src/gui/opengl/qopengl_p.h
+++ b/src/gui/opengl/qopengl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qopengl.h>
#include <private/qopenglcontext_p.h>
#include <QtCore/qset.h>
diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h
index bd947bc1d8..f2dfec3bb4 100644
--- a/src/gui/opengl/qopenglbuffer.h
+++ b/src/gui/opengl/qopenglbuffer.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLBUFFER_H
#define QOPENGLBUFFER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h
index 2342991e5e..f4a71af88e 100644
--- a/src/gui/opengl/qopenglcustomshaderstage_p.h
+++ b/src/gui/opengl/qopenglcustomshaderstage_p.h
@@ -51,8 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QOpenGLShaderProgram>
-#include <QtGlobal>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopengldebug.h b/src/gui/opengl/qopengldebug.h
index 90e12fb8b1..74b2731f7e 100644
--- a/src/gui/opengl/qopengldebug.h
+++ b/src/gui/opengl/qopengldebug.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLDEBUG_H
#define QOPENGLDEBUG_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
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/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h
index a5e190a48d..23b2ccf486 100644
--- a/src/gui/opengl/qopenglengineshadermanager_p.h
+++ b/src/gui/opengl/qopenglengineshadermanager_p.h
@@ -220,6 +220,7 @@
#ifndef QOPENGLENGINE_SHADER_MANAGER_H
#define QOPENGLENGINE_SHADER_MANAGER_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QOpenGLShader>
#include <QOpenGLShaderProgram>
#include <QPainter>
diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h
index 876d2775d3..1e88ac63b5 100644
--- a/src/gui/opengl/qopenglengineshadersource_p.h
+++ b/src/gui/opengl/qopenglengineshadersource_p.h
@@ -52,6 +52,7 @@
#ifndef QOPENGL_ENGINE_SHADER_SOURCE_H
#define QOPENGL_ENGINE_SHADER_SOURCE_H
+#include <QtGui/private/qtguiglobal_p.h>
#include "qopenglengineshadermanager_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index 894b6f2dc6..a5f1a2cc88 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qopenglextrafunctions.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglextrafunctions.h b/src/gui/opengl/qopenglextrafunctions.h
index aa29d685bc..1b36068588 100644
--- a/src/gui/opengl/qopenglextrafunctions.h
+++ b/src/gui/opengl/qopenglextrafunctions.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLEXTRAFUNCTIONS_H
#define QOPENGLEXTRAFUNCTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 14581c89f6..e0f469cbcb 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/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
index b22726cafb..b9e61e9ee4 100644
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ b/src/gui/opengl/qopenglframebufferobject.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLFRAMEBUFFEROBJECT_H
#define QOPENGLFRAMEBUFFEROBJECT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index c677b5e344..778a38b823 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtGui/private/qtguiglobal_p.h>
#include <qopenglframebufferobject.h>
#include <private/qopenglcontext_p.h>
#include <private/qopenglextensions_p.h>
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index f6cd0e553e..aad48571b3 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLFUNCTIONS_H
#define QOPENGLFUNCTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
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_0.h b/src/gui/opengl/qopenglfunctions_1_0.h
index 825a6255a3..8284604086 100644
--- a/src/gui/opengl/qopenglfunctions_1_0.h
+++ b/src/gui/opengl/qopenglfunctions_1_0.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_0_H
#define QOPENGLVERSIONFUNCTIONS_1_0_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_1.h b/src/gui/opengl/qopenglfunctions_1_1.h
index f312258f00..052d3e93bd 100644
--- a/src/gui/opengl/qopenglfunctions_1_1.h
+++ b/src/gui/opengl/qopenglfunctions_1_1.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_1_H
#define QOPENGLVERSIONFUNCTIONS_1_1_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_2.h b/src/gui/opengl/qopenglfunctions_1_2.h
index fd4e7f74f9..6b36500a79 100644
--- a/src/gui/opengl/qopenglfunctions_1_2.h
+++ b/src/gui/opengl/qopenglfunctions_1_2.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_2_H
#define QOPENGLVERSIONFUNCTIONS_1_2_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_3.h b/src/gui/opengl/qopenglfunctions_1_3.h
index a8509c46c5..3ed5851d5d 100644
--- a/src/gui/opengl/qopenglfunctions_1_3.h
+++ b/src/gui/opengl/qopenglfunctions_1_3.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_3_H
#define QOPENGLVERSIONFUNCTIONS_1_3_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_4.h b/src/gui/opengl/qopenglfunctions_1_4.h
index eeb99dbb1b..849fad6744 100644
--- a/src/gui/opengl/qopenglfunctions_1_4.h
+++ b/src/gui/opengl/qopenglfunctions_1_4.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_4_H
#define QOPENGLVERSIONFUNCTIONS_1_4_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_1_5.h b/src/gui/opengl/qopenglfunctions_1_5.h
index d5f23c146b..18914a8957 100644
--- a/src/gui/opengl/qopenglfunctions_1_5.h
+++ b/src/gui/opengl/qopenglfunctions_1_5.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_5_H
#define QOPENGLVERSIONFUNCTIONS_1_5_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_0.h b/src/gui/opengl/qopenglfunctions_2_0.h
index 81b7274a93..74a91e0ff0 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.h
+++ b/src/gui/opengl/qopenglfunctions_2_0.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_2_0_H
#define QOPENGLVERSIONFUNCTIONS_2_0_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_2_1.h b/src/gui/opengl/qopenglfunctions_2_1.h
index 7bac5af9da..e9212640f7 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.h
+++ b/src/gui/opengl/qopenglfunctions_2_1.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_2_1_H
#define QOPENGLVERSIONFUNCTIONS_2_1_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_0.h b/src/gui/opengl/qopenglfunctions_3_0.h
index da8d5ec5ff..1082d869d1 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.h
+++ b/src/gui/opengl/qopenglfunctions_3_0.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_0_H
#define QOPENGLVERSIONFUNCTIONS_3_0_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_1.h b/src/gui/opengl/qopenglfunctions_3_1.h
index d5957381e9..2691dd29e7 100644
--- a/src/gui/opengl/qopenglfunctions_3_1.h
+++ b/src/gui/opengl/qopenglfunctions_3_1.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_1_H
#define QOPENGLVERSIONFUNCTIONS_3_1_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
index 44fa6759e5..9f34190721 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_2_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_3_2_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_2_core.h b/src/gui/opengl/qopenglfunctions_3_2_core.h
index 36f959c04b..2d5ee14bee 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_core.h
+++ b/src/gui/opengl/qopenglfunctions_3_2_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_2_CORE_H
#define QOPENGLVERSIONFUNCTIONS_3_2_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
index 126cc16858..a5c0cab63c 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_3_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_3_3_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_3_3_core.h b/src/gui/opengl/qopenglfunctions_3_3_core.h
index 15a62802ab..4f0132d959 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_core.h
+++ b/src/gui/opengl/qopenglfunctions_3_3_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_3_CORE_H
#define QOPENGLVERSIONFUNCTIONS_3_3_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
index 9ca6eb8a36..1fa5e8a361 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_0_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_0_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_0_core.h b/src/gui/opengl/qopenglfunctions_4_0_core.h
index c3e1e9ce5a..8fd2af2d04 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_0_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_0_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_0_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
index e06803f0aa..a284f8e6d3 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_1_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_1_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_1_core.h b/src/gui/opengl/qopenglfunctions_4_1_core.h
index 17d922e261..d35db3c839 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_1_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_1_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_1_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
index cb95c39936..7b45859984 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_2_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_2_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_2_core.h b/src/gui/opengl/qopenglfunctions_4_2_core.h
index 14b748b3f5..80bb33e7d8 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_2_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_2_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_2_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
index 33d3065500..515467a38d 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_3_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_3_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_3_core.h b/src/gui/opengl/qopenglfunctions_4_3_core.h
index 7e18292bb0..4a700c36d7 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_3_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_3_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_3_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
index d369ff27ff..f2d640cdaf 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_4_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_4_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_4_core.h b/src/gui/opengl/qopenglfunctions_4_4_core.h
index e508478c50..bcb7383a9e 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_4_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_4_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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_compatibility.h b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
index 1c50dafd65..b164538686 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_5_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_5_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
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/qopenglfunctions_4_5_core.h b/src/gui/opengl/qopenglfunctions_4_5_core.h
index b086e63917..0940d8cf61 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_5_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_5_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_5_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_es2.h b/src/gui/opengl/qopenglfunctions_es2.h
index 45cb329a87..3b7d2806ea 100644
--- a/src/gui/opengl/qopenglfunctions_es2.h
+++ b/src/gui/opengl/qopenglfunctions_es2.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_ES2_H
#define QOPENGLVERSIONFUNCTIONS_ES2_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if defined(QT_OPENGL_ES_2) || defined(Q_QDOC)
diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/gui/opengl/qopenglgradientcache_p.h
index 12423452f2..a2ed85c061 100644
--- a/src/gui/opengl/qopenglgradientcache_p.h
+++ b/src/gui/opengl/qopenglgradientcache_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QMultiHash>
#include <QObject>
#include <private/qopenglcontext_p.h>
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/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index dffa68c29e..27b7fba84f 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLPAINTDEVICE_H
#define QOPENGLPAINTDEVICE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglpaintdevice_p.h b/src/gui/opengl/qopenglpaintdevice_p.h
index 78e6b7a464..3683ebebac 100644
--- a/src/gui/opengl/qopenglpaintdevice_p.h
+++ b/src/gui/opengl/qopenglpaintdevice_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qopenglpaintdevice.h>
QT_BEGIN_NAMESPACE
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/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
index c9f328203c..807efb1ec2 100644
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ b/src/gui/opengl/qopenglpaintengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QDebug>
#include <qopenglpaintdevice.h>
diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h
index 81aa588ae4..2fc52b82d8 100644
--- a/src/gui/opengl/qopenglpixeltransferoptions.h
+++ b/src/gui/opengl/qopenglpixeltransferoptions.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLPIXELUPLOADOPTIONS_H
#define QOPENGLPIXELUPLOADOPTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL)
diff --git a/src/gui/opengl/qopenglqueryhelper_p.h b/src/gui/opengl/qopenglqueryhelper_p.h
index be36c32217..60dbf9c743 100644
--- a/src/gui/opengl/qopenglqueryhelper_p.h
+++ b/src/gui/opengl/qopenglqueryhelper_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#if !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglshadercache_p.h b/src/gui/opengl/qopenglshadercache_p.h
index 5070874d83..b4d1d64721 100644
--- a/src/gui/opengl/qopenglshadercache_p.h
+++ b/src/gui/opengl/qopenglshadercache_p.h
@@ -51,7 +51,7 @@
#ifndef QOPENGLSHADERCACHE_P_H
#define QOPENGLSHADERCACHE_P_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2)
# include "qopenglshadercache_meego_p.h"
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index a7c8aae989..61343e5f5a 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
@@ -1225,8 +1226,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;
}
}
@@ -1489,7 +1489,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) {
@@ -1901,8 +1901,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;
}
}
@@ -2829,7 +2828,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/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h
index da20228e51..2da359c535 100644
--- a/src/gui/opengl/qopenglshaderprogram.h
+++ b/src/gui/opengl/qopenglshaderprogram.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLSHADERPROGRAM_H
#define QOPENGLSHADERPROGRAM_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
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/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
index 8c32fcef26..0a948488a6 100644
--- a/src/gui/opengl/qopengltexture.h
+++ b/src/gui/opengl/qopengltexture.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLABSTRACTTEXTURE_H
#define QOPENGLABSTRACTTEXTURE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopengltexture_p.h b/src/gui/opengl/qopengltexture_p.h
index e9ada026ed..9914316bb4 100644
--- a/src/gui/opengl/qopengltexture_p.h
+++ b/src/gui/opengl/qopengltexture_p.h
@@ -53,6 +53,7 @@
#ifndef QT_NO_OPENGL
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qobject_p.h"
#include "qopengltexture.h"
#include "qopengl.h"
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
index 18ff0c4acf..858fc0d857 100644
--- a/src/gui/opengl/qopengltextureblitter.cpp
+++ b/src/gui/opengl/qopengltextureblitter.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qopengltextureblitter_p.h"
+#include "qopengltextureblitter.h"
#include <QtGui/QOpenGLBuffer>
#include <QtGui/QOpenGLShaderProgram>
@@ -51,6 +51,49 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QOpenGLTextureBlitter
+ \brief The QOpenGLTextureBlitter class provides a convenient way to draw textured quads via OpenGL.
+ \since 5.8
+ \ingroup painting-3D
+ \inmodule QtGui
+
+ Drawing textured quads, in order to get the contents of a texture
+ onto the screen, is a common operation when developing 2D user
+ interfaces. QOpenGLTextureBlitter provides a convenience class to
+ avoid repeating vertex data, shader sources, buffer and program
+ management and matrix calculations.
+
+ For example, a QOpenGLWidget subclass can do the following to draw
+ the contents rendered into a framebuffer at the pixel position \c{(x, y)}:
+
+ \code
+ void OpenGLWidget::initializeGL()
+ {
+ m_blitter.create();
+ m_fbo = new QOpenGLFramebufferObject(size);
+ }
+
+ void OpenGLWidget::paintGL()
+ {
+ m_fbo->bind();
+ // update offscreen content
+ m_fbo->release();
+
+ m_blitter.bind();
+ const QRect targetRect(QPoint(x, y), m_fbo->size());
+ const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(0, 0), m_fbo->size()));
+ m_blitter.blit(m_fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft);
+ m_blitter.release();
+ }
+ \endcode
+
+ The blitter implements GLSL shaders both for GLSL 1.00 (suitable
+ for OpenGL (ES) 2.x and compatibility profiles of newer OpenGL
+ versions) and version 150 (suitable for core profile contexts with
+ OpenGL 3.2 and newer).
+ */
+
static const char vertex_shader150[] =
"#version 150 core\n"
"in vec3 vertexCoord;"
@@ -309,16 +352,44 @@ bool QOpenGLTextureBlitterPrivate::buildProgram(ProgramIndex idx, const char *vs
return true;
}
+/*!
+ Constructs a new QOpenGLTextureBlitter instance.
+
+ \note no graphics resources are initialized in the
+ constructor. This makes it safe to place plain
+ QOpenGLTextureBlitter members into classes because the actual
+ initialization that depends on the OpenGL context happens only in
+ create().
+ */
QOpenGLTextureBlitter::QOpenGLTextureBlitter()
: d_ptr(new QOpenGLTextureBlitterPrivate)
{
}
+/*!
+ Destructs the instance.
+
+ \note When the OpenGL context - or a context sharing resources
+ with it - that was current when calling create() is not current,
+ graphics resources will not be released. Therefore, it is
+ recommended to call destroy() manually instead of relying on the
+ destructor to perform OpenGL resource cleanup.
+ */
QOpenGLTextureBlitter::~QOpenGLTextureBlitter()
{
destroy();
}
+/*!
+ Initializes the graphics resources used by the blitter.
+
+ \return \c true if successful, \c false if there was a
+ failure. Failures can occur when there is no OpenGL context
+ current on the current thread, or when shader compilation fails
+ for some reason.
+
+ \sa isCreated(), destroy()
+ */
bool QOpenGLTextureBlitter::create()
{
QOpenGLContext *currentContext = QOpenGLContext::currentContext();
@@ -358,12 +429,26 @@ bool QOpenGLTextureBlitter::create()
return true;
}
+/*!
+ \return \c true if create() was called and succeeded. \c false otherwise.
+
+ \sa create(), destroy()
+ */
bool QOpenGLTextureBlitter::isCreated() const
{
Q_D(const QOpenGLTextureBlitter);
return d->programs[QOpenGLTextureBlitterPrivate::TEXTURE_2D].glProgram;
}
+/*!
+ Frees all graphics resources held by the blitter. Assumes that
+ the OpenGL context, or another context sharing resources with it,
+ that was current on the thread when invoking create() is current.
+
+ The function has no effect when the blitter is not in created state.
+
+ \sa create()
+ */
void QOpenGLTextureBlitter::destroy()
{
if (!isCreated())
@@ -376,12 +461,29 @@ void QOpenGLTextureBlitter::destroy()
d->vao.reset();
}
+/*!
+ \return \c true when bind() accepts \c GL_TEXTURE_EXTERNAL_OES as
+ its target argument.
+
+ \sa bind(), blit()
+ */
bool QOpenGLTextureBlitter::supportsExternalOESTarget() const
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
return ctx && ctx->isOpenGLES() && ctx->hasExtension("GL_OES_EGL_image_external");
}
+/*!
+ Binds the graphics resources used by the blitter. This must be
+ called before calling blit(). Code modifying the OpenGL state
+ should be avoided between the call to bind() and blit() because
+ otherwise conflicts may arise.
+
+ \a target is the texture target for the source texture and must be
+ either \c GL_TEXTURE_2D or \c GL_OES_EGL_image_external.
+
+ \sa release(), blit()
+ */
void QOpenGLTextureBlitter::bind(GLenum target)
{
Q_D(QOpenGLTextureBlitter);
@@ -404,6 +506,11 @@ void QOpenGLTextureBlitter::bind(GLenum target)
d->textureBuffer.release();
}
+/*!
+ Unbinds the graphics resources used by the blitter.
+
+ \sa bind()
+ */
void QOpenGLTextureBlitter::release()
{
Q_D(QOpenGLTextureBlitter);
@@ -412,18 +519,65 @@ void QOpenGLTextureBlitter::release()
d->vao->release();
}
-void QOpenGLTextureBlitter::setSwizzleRB(bool swizzle)
+/*!
+ Sets whether swizzling is enabled for the red and blue color channels to
+ \a swizzle. An BGRA to RGBA conversion (occurring in the shader on
+ the GPU, instead of a slow CPU-side transformation) can be useful
+ when the source texture contains data from a QImage with a format
+ like QImage::Format_ARGB32 which maps to BGRA on little endian
+ systems.
+
+ By default the red-blue swizzle is disabled since this is what a
+ texture attached to an framebuffer object or a texture based on a
+ byte ordered QImage format (like QImage::Format_RGBA8888) needs.
+ */
+void QOpenGLTextureBlitter::setRedBlueSwizzle(bool swizzle)
{
Q_D(QOpenGLTextureBlitter);
d->swizzle = swizzle;
}
+/*!
+ Changes the opacity to \a opacity. The default opacity is 1.0.
+
+ \note the blitter does not alter the blend state. It is up to the
+ caller of blit() to ensure the correct blend settings are active.
+
+ */
void QOpenGLTextureBlitter::setOpacity(float opacity)
{
Q_D(QOpenGLTextureBlitter);
d->opacity = opacity;
}
+/*!
+ \enum QOpenGLTextureBlitter::Origin
+
+ \value OriginBottomLeft Indicates that the data in the texture
+ follows the OpenGL convention of coordinate systems, meaning Y is
+ running from bottom to top.
+
+ \value OriginTopLeft Indicates that the data in the texture has Y
+ running from top to bottom, which is typical with regular,
+ unflipped image data.
+
+ \sa blit()
+ */
+
+/*!
+ Performs the blit with the source texture \a texture.
+
+ \a targetTransform specifies the transformation applied. This is
+ usually generated by the targetTransform() helper function.
+
+ \a sourceOrigin specifies if the image data needs flipping. When
+ \a texture corresponds to a texture attached to an FBO pass
+ OriginBottomLeft. On the other hand, when \a texture is based on
+ unflipped image data, pass OriginTopLeft. This is more efficient
+ than using QImage::mirrored().
+
+ \sa targetTransform(), Origin, bind()
+ */
void QOpenGLTextureBlitter::blit(GLuint texture,
const QMatrix4x4 &targetTransform,
Origin sourceOrigin)
@@ -432,6 +586,19 @@ void QOpenGLTextureBlitter::blit(GLuint texture,
d->blit(texture,targetTransform, sourceOrigin);
}
+/*!
+ Performs the blit with the source texture \a texture.
+
+ \a targetTransform specifies the transformation applied. This is
+ usually generated by the targetTransform() helper function.
+
+ \a sourceTransform specifies the transformation applied to the
+ source. This allows using only a sub-rect of the source
+ texture. This is usually generated by the sourceTransform() helper
+ function.
+
+ \sa sourceTransform(), targetTransform(), Origin, bind()
+ */
void QOpenGLTextureBlitter::blit(GLuint texture,
const QMatrix4x4 &targetTransform,
const QMatrix3x3 &sourceTransform)
@@ -440,6 +607,18 @@ void QOpenGLTextureBlitter::blit(GLuint texture,
d->blit(texture, targetTransform, sourceTransform);
}
+/*!
+ Calculates a target transform suitable for blit().
+
+ \a target is the target rectangle in pixels. \a viewport describes
+ the source dimensions and will in most cases be set to (0, 0,
+ image width, image height).
+
+ For unscaled output the size of \a target and \a viewport should
+ match.
+
+ \sa blit()
+ */
QMatrix4x4 QOpenGLTextureBlitter::targetTransform(const QRectF &target,
const QRect &viewport)
{
@@ -460,6 +639,17 @@ QMatrix4x4 QOpenGLTextureBlitter::targetTransform(const QRectF &target,
return matrix;
}
+/*!
+ Calculates a 3x3 matrix suitable as the input to blit(). This is
+ used when only a part of the texture is to be used in the blit.
+
+ \a subTexture is the desired source rectangle in pixels, \a
+ textureSize is the full width and height of the texture data. \a
+ origin specifies the orientation of the image data when it comes
+ to the Y axis.
+
+ \sa blit(), Origin
+ */
QMatrix3x3 QOpenGLTextureBlitter::sourceTransform(const QRectF &subTexture,
const QSize &textureSize,
Origin origin)
diff --git a/src/gui/opengl/qopengltextureblitter_p.h b/src/gui/opengl/qopengltextureblitter.h
index 5d39a3e8fa..2f7c6b1a0a 100644
--- a/src/gui/opengl/qopengltextureblitter_p.h
+++ b/src/gui/opengl/qopengltextureblitter.h
@@ -37,28 +37,21 @@
**
****************************************************************************/
-#ifndef QOPENGLTEXTUREBLITTER_P_H
-#define QOPENGLTEXTUREBLITTER_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.
-//
+#ifndef QOPENGLTEXTUREBLITTER_H
+#define QOPENGLTEXTUREBLITTER_H
+
+#include <QtGui/qtguiglobal.h>
+
+#ifndef QT_NO_OPENGL
#include <QtGui/qopengl.h>
#include <QtGui/QMatrix3x3>
+#include <QtGui/QMatrix4x4>
QT_BEGIN_NAMESPACE
class QOpenGLTextureBlitterPrivate;
-
class Q_GUI_EXPORT QOpenGLTextureBlitter
{
public:
@@ -79,7 +72,7 @@ public:
void bind(GLenum target = GL_TEXTURE_2D);
void release();
- void setSwizzleRB(bool swizzle);
+ void setRedBlueSwizzle(bool swizzle);
void setOpacity(float opacity);
void blit(GLuint texture, const QMatrix4x4 &targetTransform, Origin sourceOrigin);
@@ -96,4 +89,6 @@ private:
QT_END_NAMESPACE
-#endif //QOPENGLTEXTUREBLITTER_P_H
+#endif
+
+#endif //QOPENGLTEXTUREBLITTER_H
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
index aedc8e7e47..c68b068739 100644
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ b/src/gui/opengl/qopengltexturecache_p.h
@@ -51,6 +51,7 @@
#ifndef QOPENGLTEXTURECACHE_P_H
#define QOPENGLTEXTURECACHE_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QHash>
#include <QObject>
#include <QCache>
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index 6cd7667d78..6a1550dbed 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtGui/private/qtguiglobal_p.h>
#include <private/qtextureglyphcache_p.h>
#include <private/qopenglcontext_p.h>
#include <qopenglshaderprogram.h>
diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/gui/opengl/qopengltexturehelper_p.h
index 6b26527269..00f6f9e5aa 100644
--- a/src/gui/opengl/qopengltexturehelper_p.h
+++ b/src/gui/opengl/qopengltexturehelper_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopengltimerquery.h b/src/gui/opengl/qopengltimerquery.h
index 80e52a4c99..7b9ab850e2 100644
--- a/src/gui/opengl/qopengltimerquery.h
+++ b/src/gui/opengl/qopengltimerquery.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLTIMERQUERY_H
#define QOPENGLTIMERQUERY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 7f991b1955..63209cf392 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_H
#define QOPENGLVERSIONFUNCTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglversionfunctionsfactory_p.h b/src/gui/opengl/qopenglversionfunctionsfactory_p.h
index 0af2e4d572..469a9cc624 100644
--- a/src/gui/opengl/qopenglversionfunctionsfactory_p.h
+++ b/src/gui/opengl/qopenglversionfunctionsfactory_p.h
@@ -60,9 +60,10 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
+
#ifndef QT_NO_OPENGL
-#include <QtCore/QtGlobal>
#include <QtGui/qopenglcontext.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglvertexarrayobject.h b/src/gui/opengl/qopenglvertexarrayobject.h
index 228c29fce7..a8153ea40b 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.h
+++ b/src/gui/opengl/qopenglvertexarrayobject.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLVERTEXARRAYOBJECT_H
#define QOPENGLVERTEXARRAYOBJECT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 283b6643b9..a61865a0b6 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -42,6 +42,7 @@ HEADERS += \
painting/qpolygonclipper_p.h \
painting/qrasterdefs_p.h \
painting/qrasterizer_p.h \
+ painting/qrbtree_p.h \
painting/qregion.h \
painting/qrgb.h \
painting/qrgba64.h \
@@ -49,6 +50,8 @@ HEADERS += \
painting/qstroker_p.h \
painting/qtextureglyphcache_p.h \
painting/qtransform.h \
+ painting/qtriangulatingstroker_p.h \
+ painting/qtriangulator_p.h \
painting/qplatformbackingstore.h \
painting/qpathsimplifier_p.h
@@ -60,7 +63,6 @@ SOURCES += \
painting/qblittable.cpp \
painting/qbrush.cpp \
painting/qcolor.cpp \
- painting/qcolor_p.cpp \
painting/qcompositionfunctions.cpp \
painting/qcosmeticstroker.cpp \
painting/qcssutil.cpp \
@@ -92,9 +94,16 @@ SOURCES += \
painting/qstroker.cpp \
painting/qtextureglyphcache.cpp \
painting/qtransform.cpp \
+ painting/qtriangulatingstroker.cpp \
+ painting/qtriangulator.cpp \
painting/qplatformbackingstore.cpp \
painting/qpathsimplifier.cpp
+darwin {
+ HEADERS += painting/qcoregraphics_p.h
+ SOURCES += painting/qcoregraphics.mm
+}
+
SSE2_SOURCES += painting/qdrawhelper_sse2.cpp
SSSE3_SOURCES += painting/qdrawhelper_ssse3.cpp
SSE4_1_SOURCES += painting/qdrawhelper_sse4.cpp \
@@ -104,8 +113,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/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index e3d18512dd..ceaad61e13 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -138,6 +138,7 @@ QBackingStore::QBackingStore(QWindow *window)
: d_ptr(new QBackingStorePrivate(window))
{
d_ptr->platformBackingStore = QGuiApplicationPrivate::platformIntegration()->createPlatformBackingStore(window);
+ d_ptr->platformBackingStore->setBackingStore(this);
}
/*!
diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h
index 886cf29f0e..2ba6e1c906 100644
--- a/src/gui/painting/qbackingstore.h
+++ b/src/gui/painting/qbackingstore.h
@@ -40,6 +40,7 @@
#ifndef QBACKINGSTORE_H
#define QBACKINGSTORE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qrect.h>
#include <QtGui/qwindow.h>
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index c4e14a18cb..f8a91e9ef3 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qpoint.h"
#include "QtCore/qline.h"
#include "QtCore/qrect.h"
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index d21765bcde..7ee04987fe 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -40,6 +40,7 @@
#ifndef QBLENDFUNCTIONS_P_H
#define QBLENDFUNCTIONS_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <qmath.h>
#include "qdrawhelper_p.h"
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index 8df56f6d0c..24440c3c61 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qsize.h>
#include <QtGui/private/qpixmap_blitter_p.h>
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 0d26457c15..ebb035a2c1 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();
- }
}
/*!
@@ -579,11 +569,20 @@ void QBrush::cleanUp(QBrushData *x)
QBrushDataPointerDeleter::deleteData(x);
}
+static Q_DECL_CONSTEXPR inline bool use_same_brushdata(Qt::BrushStyle lhs, Qt::BrushStyle rhs)
+{
+ return lhs == rhs // includes Qt::TexturePattern
+ || (lhs >= Qt::NoBrush && lhs <= Qt::DiagCrossPattern && rhs >= Qt::NoBrush && rhs <= Qt::DiagCrossPattern)
+ || (lhs >= Qt::LinearGradientPattern && lhs <= Qt::ConicalGradientPattern && rhs >= Qt::LinearGradientPattern && rhs <= Qt::ConicalGradientPattern)
+ ;
+}
void QBrush::detach(Qt::BrushStyle newStyle)
{
- if (newStyle == d->style && d->ref.load() == 1)
+ if (use_same_brushdata(newStyle, d->style) && d->ref.load() == 1) {
+ d->style = newStyle;
return;
+ }
QScopedPointer<QBrushData, QBrushDataPointerDeleter> x;
switch(newStyle) {
@@ -1675,13 +1674,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;
}
@@ -1884,19 +1878,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();
}
/*!
@@ -1906,14 +1889,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;
}
@@ -2213,12 +2190,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/qbrush.h b/src/gui/painting/qbrush.h
index 568c06ef84..e5cff9cc9b 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -40,6 +40,7 @@
#ifndef QBRUSH_H
#define QBRUSH_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpair.h>
#include <QtCore/qpoint.h>
#include <QtCore/qvector.h>
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 0d24fd94f5..05790c4504 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -43,6 +43,9 @@
#include "qdatastream.h"
#include "qvariant.h"
#include "qdebug.h"
+#include "private/qtools_p.h"
+
+#include <algorithm>
#include <stdio.h>
#include <limits.h>
@@ -50,6 +53,319 @@
QT_BEGIN_NAMESPACE
/*!
+ \internal
+ If s[0..1] is a valid hex number, returns its integer value,
+ otherwise returns -1.
+ */
+static inline int hex2int(const char *s)
+{
+ const int hi = QtMiscUtils::fromHex(s[0]);
+ if (hi < 0)
+ return -1;
+ const int lo = QtMiscUtils::fromHex(s[1]);
+ if (lo < 0)
+ return -1;
+ return (hi << 4) | lo;
+}
+
+/*!
+ \internal
+ If s is a valid hex digit, returns its integer value,
+ multiplied by 0x11, otherwise returns -1.
+ */
+static inline int hex2int(char s)
+{
+ const int h = QtMiscUtils::fromHex(s);
+ return h < 0 ? h : (h << 4) | h;
+}
+
+static bool get_hex_rgb(const char *name, int len, QRgb *rgb)
+{
+ if (name[0] != '#')
+ return false;
+ name++;
+ --len;
+ int a, r, g, b;
+ a = 255;
+ if (len == 12) {
+ r = hex2int(name);
+ g = hex2int(name + 4);
+ b = hex2int(name + 8);
+ } else if (len == 9) {
+ r = hex2int(name);
+ g = hex2int(name + 3);
+ b = hex2int(name + 6);
+ } else if (len == 8) {
+ a = hex2int(name);
+ r = hex2int(name + 2);
+ g = hex2int(name + 4);
+ b = hex2int(name + 6);
+ } else if (len == 6) {
+ r = hex2int(name);
+ g = hex2int(name + 2);
+ b = hex2int(name + 4);
+ } else if (len == 3) {
+ r = hex2int(name[0]);
+ g = hex2int(name[1]);
+ b = hex2int(name[2]);
+ } else {
+ r = g = b = -1;
+ }
+ if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
+ *rgb = 0;
+ return false;
+ }
+ *rgb = qRgba(r, g ,b, a);
+ return true;
+}
+
+bool qt_get_hex_rgb(const char *name, QRgb *rgb)
+{
+ return get_hex_rgb(name, qstrlen(name), rgb);
+}
+
+static bool get_hex_rgb(const QChar *str, int len, QRgb *rgb)
+{
+ if (len > 13)
+ return false;
+ char tmp[16];
+ for (int i = 0; i < len; ++i)
+ tmp[i] = str[i].toLatin1();
+ return get_hex_rgb(tmp, len, rgb);
+}
+
+#ifndef QT_NO_COLORNAMES
+
+/*
+ CSS color names = SVG 1.0 color names + transparent (rgba(0,0,0,0))
+*/
+
+#ifdef rgb
+# undef rgb
+#endif
+#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
+
+static const struct RGBData {
+ const char name[21];
+ uint value;
+} rgbTbl[] = {
+ { "aliceblue", rgb(240, 248, 255) },
+ { "antiquewhite", rgb(250, 235, 215) },
+ { "aqua", rgb( 0, 255, 255) },
+ { "aquamarine", rgb(127, 255, 212) },
+ { "azure", rgb(240, 255, 255) },
+ { "beige", rgb(245, 245, 220) },
+ { "bisque", rgb(255, 228, 196) },
+ { "black", rgb( 0, 0, 0) },
+ { "blanchedalmond", rgb(255, 235, 205) },
+ { "blue", rgb( 0, 0, 255) },
+ { "blueviolet", rgb(138, 43, 226) },
+ { "brown", rgb(165, 42, 42) },
+ { "burlywood", rgb(222, 184, 135) },
+ { "cadetblue", rgb( 95, 158, 160) },
+ { "chartreuse", rgb(127, 255, 0) },
+ { "chocolate", rgb(210, 105, 30) },
+ { "coral", rgb(255, 127, 80) },
+ { "cornflowerblue", rgb(100, 149, 237) },
+ { "cornsilk", rgb(255, 248, 220) },
+ { "crimson", rgb(220, 20, 60) },
+ { "cyan", rgb( 0, 255, 255) },
+ { "darkblue", rgb( 0, 0, 139) },
+ { "darkcyan", rgb( 0, 139, 139) },
+ { "darkgoldenrod", rgb(184, 134, 11) },
+ { "darkgray", rgb(169, 169, 169) },
+ { "darkgreen", rgb( 0, 100, 0) },
+ { "darkgrey", rgb(169, 169, 169) },
+ { "darkkhaki", rgb(189, 183, 107) },
+ { "darkmagenta", rgb(139, 0, 139) },
+ { "darkolivegreen", rgb( 85, 107, 47) },
+ { "darkorange", rgb(255, 140, 0) },
+ { "darkorchid", rgb(153, 50, 204) },
+ { "darkred", rgb(139, 0, 0) },
+ { "darksalmon", rgb(233, 150, 122) },
+ { "darkseagreen", rgb(143, 188, 143) },
+ { "darkslateblue", rgb( 72, 61, 139) },
+ { "darkslategray", rgb( 47, 79, 79) },
+ { "darkslategrey", rgb( 47, 79, 79) },
+ { "darkturquoise", rgb( 0, 206, 209) },
+ { "darkviolet", rgb(148, 0, 211) },
+ { "deeppink", rgb(255, 20, 147) },
+ { "deepskyblue", rgb( 0, 191, 255) },
+ { "dimgray", rgb(105, 105, 105) },
+ { "dimgrey", rgb(105, 105, 105) },
+ { "dodgerblue", rgb( 30, 144, 255) },
+ { "firebrick", rgb(178, 34, 34) },
+ { "floralwhite", rgb(255, 250, 240) },
+ { "forestgreen", rgb( 34, 139, 34) },
+ { "fuchsia", rgb(255, 0, 255) },
+ { "gainsboro", rgb(220, 220, 220) },
+ { "ghostwhite", rgb(248, 248, 255) },
+ { "gold", rgb(255, 215, 0) },
+ { "goldenrod", rgb(218, 165, 32) },
+ { "gray", rgb(128, 128, 128) },
+ { "green", rgb( 0, 128, 0) },
+ { "greenyellow", rgb(173, 255, 47) },
+ { "grey", rgb(128, 128, 128) },
+ { "honeydew", rgb(240, 255, 240) },
+ { "hotpink", rgb(255, 105, 180) },
+ { "indianred", rgb(205, 92, 92) },
+ { "indigo", rgb( 75, 0, 130) },
+ { "ivory", rgb(255, 255, 240) },
+ { "khaki", rgb(240, 230, 140) },
+ { "lavender", rgb(230, 230, 250) },
+ { "lavenderblush", rgb(255, 240, 245) },
+ { "lawngreen", rgb(124, 252, 0) },
+ { "lemonchiffon", rgb(255, 250, 205) },
+ { "lightblue", rgb(173, 216, 230) },
+ { "lightcoral", rgb(240, 128, 128) },
+ { "lightcyan", rgb(224, 255, 255) },
+ { "lightgoldenrodyellow", rgb(250, 250, 210) },
+ { "lightgray", rgb(211, 211, 211) },
+ { "lightgreen", rgb(144, 238, 144) },
+ { "lightgrey", rgb(211, 211, 211) },
+ { "lightpink", rgb(255, 182, 193) },
+ { "lightsalmon", rgb(255, 160, 122) },
+ { "lightseagreen", rgb( 32, 178, 170) },
+ { "lightskyblue", rgb(135, 206, 250) },
+ { "lightslategray", rgb(119, 136, 153) },
+ { "lightslategrey", rgb(119, 136, 153) },
+ { "lightsteelblue", rgb(176, 196, 222) },
+ { "lightyellow", rgb(255, 255, 224) },
+ { "lime", rgb( 0, 255, 0) },
+ { "limegreen", rgb( 50, 205, 50) },
+ { "linen", rgb(250, 240, 230) },
+ { "magenta", rgb(255, 0, 255) },
+ { "maroon", rgb(128, 0, 0) },
+ { "mediumaquamarine", rgb(102, 205, 170) },
+ { "mediumblue", rgb( 0, 0, 205) },
+ { "mediumorchid", rgb(186, 85, 211) },
+ { "mediumpurple", rgb(147, 112, 219) },
+ { "mediumseagreen", rgb( 60, 179, 113) },
+ { "mediumslateblue", rgb(123, 104, 238) },
+ { "mediumspringgreen", rgb( 0, 250, 154) },
+ { "mediumturquoise", rgb( 72, 209, 204) },
+ { "mediumvioletred", rgb(199, 21, 133) },
+ { "midnightblue", rgb( 25, 25, 112) },
+ { "mintcream", rgb(245, 255, 250) },
+ { "mistyrose", rgb(255, 228, 225) },
+ { "moccasin", rgb(255, 228, 181) },
+ { "navajowhite", rgb(255, 222, 173) },
+ { "navy", rgb( 0, 0, 128) },
+ { "oldlace", rgb(253, 245, 230) },
+ { "olive", rgb(128, 128, 0) },
+ { "olivedrab", rgb(107, 142, 35) },
+ { "orange", rgb(255, 165, 0) },
+ { "orangered", rgb(255, 69, 0) },
+ { "orchid", rgb(218, 112, 214) },
+ { "palegoldenrod", rgb(238, 232, 170) },
+ { "palegreen", rgb(152, 251, 152) },
+ { "paleturquoise", rgb(175, 238, 238) },
+ { "palevioletred", rgb(219, 112, 147) },
+ { "papayawhip", rgb(255, 239, 213) },
+ { "peachpuff", rgb(255, 218, 185) },
+ { "peru", rgb(205, 133, 63) },
+ { "pink", rgb(255, 192, 203) },
+ { "plum", rgb(221, 160, 221) },
+ { "powderblue", rgb(176, 224, 230) },
+ { "purple", rgb(128, 0, 128) },
+ { "red", rgb(255, 0, 0) },
+ { "rosybrown", rgb(188, 143, 143) },
+ { "royalblue", rgb( 65, 105, 225) },
+ { "saddlebrown", rgb(139, 69, 19) },
+ { "salmon", rgb(250, 128, 114) },
+ { "sandybrown", rgb(244, 164, 96) },
+ { "seagreen", rgb( 46, 139, 87) },
+ { "seashell", rgb(255, 245, 238) },
+ { "sienna", rgb(160, 82, 45) },
+ { "silver", rgb(192, 192, 192) },
+ { "skyblue", rgb(135, 206, 235) },
+ { "slateblue", rgb(106, 90, 205) },
+ { "slategray", rgb(112, 128, 144) },
+ { "slategrey", rgb(112, 128, 144) },
+ { "snow", rgb(255, 250, 250) },
+ { "springgreen", rgb( 0, 255, 127) },
+ { "steelblue", rgb( 70, 130, 180) },
+ { "tan", rgb(210, 180, 140) },
+ { "teal", rgb( 0, 128, 128) },
+ { "thistle", rgb(216, 191, 216) },
+ { "tomato", rgb(255, 99, 71) },
+ { "transparent", 0 },
+ { "turquoise", rgb( 64, 224, 208) },
+ { "violet", rgb(238, 130, 238) },
+ { "wheat", rgb(245, 222, 179) },
+ { "white", rgb(255, 255, 255) },
+ { "whitesmoke", rgb(245, 245, 245) },
+ { "yellow", rgb(255, 255, 0) },
+ { "yellowgreen", rgb(154, 205, 50) }
+};
+
+static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
+
+#undef rgb
+
+#if defined(Q_CC_MSVC) && _MSC_VER < 1600
+inline bool operator<(const RGBData &data1, const RGBData &data2)
+{ return qstrcmp(data1.name, data2.name) < 0; }
+#endif
+
+inline bool operator<(const char *name, const RGBData &data)
+{ return qstrcmp(name, data.name) < 0; }
+inline bool operator<(const RGBData &data, const char *name)
+{ return qstrcmp(data.name, name) < 0; }
+
+static bool get_named_rgb_no_space(const char *name_no_space, QRgb *rgb)
+{
+ const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
+ if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
+ *rgb = r->value;
+ return true;
+ }
+ return false;
+}
+
+static bool get_named_rgb(const char *name, int len, QRgb* rgb)
+{
+ if (len > 255)
+ return false;
+ char name_no_space[256];
+ int pos = 0;
+ for (int i = 0; i < len; i++) {
+ if (name[i] != '\t' && name[i] != ' ')
+ name_no_space[pos++] = QChar::toLower(name[i]);
+ }
+ name_no_space[pos] = 0;
+
+ return get_named_rgb_no_space(name_no_space, rgb);
+}
+
+static bool get_named_rgb(const QChar *name, int len, QRgb *rgb)
+{
+ if (len > 255)
+ return false;
+ char name_no_space[256];
+ int pos = 0;
+ for (int i = 0; i < len; i++) {
+ if (name[i] != QLatin1Char('\t') && name[i] != QLatin1Char(' '))
+ name_no_space[pos++] = name[i].toLower().toLatin1();
+ }
+ name_no_space[pos] = 0;
+ return get_named_rgb_no_space(name_no_space, rgb);
+}
+
+#endif // QT_NO_COLORNAMES
+
+static QStringList get_colornames()
+{
+ QStringList lst;
+#ifndef QT_NO_COLORNAMES
+ lst.reserve(rgbTblSize);
+ for (int i = 0; i < rgbTblSize; i++)
+ lst << QLatin1String(rgbTbl[i].name);
+#endif
+ return lst;
+}
+
+/*!
\class QColor
\brief The QColor class provides colors based on RGB, HSV or CMYK values.
@@ -261,7 +577,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) \
@@ -478,12 +794,14 @@ QColor::QColor(Spec spec) Q_DECL_NOTHROW
/*!
\fn QColor::QColor(const char *name)
+ \overload
+ \sa setNamedColor(), name(), isValid()
+*/
- Constructs a named color in the same way as setNamedColor() using
- the given \a name.
-
- The color is left invalid if the \a name cannot be parsed.
-
+/*!
+ \fn QColor::QColor(QLatin1String name)
+ \overload
+ \since 5.8
\sa setNamedColor(), name(), isValid()
*/
@@ -564,6 +882,16 @@ void QColor::setNamedColor(const QString &name)
}
/*!
+ \overload
+ \since 5.8
+*/
+
+void QColor::setNamedColor(QLatin1String name)
+{
+ setColorFromString(name);
+}
+
+/*!
\since 4.7
Returns \c true if the \a name is a valid color name and can
@@ -579,16 +907,26 @@ bool QColor::isValidColor(const QString &name)
return !name.isEmpty() && QColor().setColorFromString(name);
}
-bool QColor::setColorFromString(const QString &name)
+/*!
+ \overload
+ \since 5.8
+*/
+bool QColor::isValidColor(QLatin1String name) Q_DECL_NOTHROW
{
- if (name.isEmpty()) {
+ return name.size() && QColor().setColorFromString(name);
+}
+
+template <typename String>
+bool QColor::setColorFromString(const String &name)
+{
+ if (!name.size()) {
invalidate();
return true;
}
- if (name.startsWith(QLatin1Char('#'))) {
+ if (name[0] == QLatin1Char('#')) {
QRgb rgba;
- if (qt_get_hex_rgb(name.constData(), name.length(), &rgba)) {
+ if (get_hex_rgb(name.data(), name.size(), &rgba)) {
setRgba(rgba);
return true;
} else {
@@ -599,7 +937,7 @@ bool QColor::setColorFromString(const QString &name)
#ifndef QT_NO_COLORNAMES
QRgb rgb;
- if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) {
+ if (get_named_rgb(name.data(), name.size(), &rgb)) {
setRgba(rgb);
return true;
} else
@@ -617,11 +955,7 @@ bool QColor::setColorFromString(const QString &name)
*/
QStringList QColor::colorNames()
{
-#ifndef QT_NO_COLORNAMES
- return qt_get_colornames();
-#else
- return QStringList();
-#endif
+ return get_colornames();
}
/*!
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 6338eedd22..db6eb92916 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -40,6 +40,7 @@
#ifndef QCOLOR_H
#define QCOLOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qrgb.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qstringlist.h>
@@ -72,7 +73,8 @@ public:
QColor(QRgb rgb) Q_DECL_NOTHROW;
QColor(QRgba64 rgba64) Q_DECL_NOTHROW;
QColor(const QString& name);
- QColor(const char *name);
+ QColor(const char *aname) : QColor(QLatin1String(aname)) {}
+ QColor(QLatin1String name);
QColor(Spec spec) Q_DECL_NOTHROW;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
@@ -92,7 +94,9 @@ public:
// ### Qt 6: merge overloads
QString name() const;
QString name(NameFormat format) const;
+
void setNamedColor(const QString& name);
+ void setNamedColor(QLatin1String name);
static QStringList colorNames();
@@ -218,11 +222,13 @@ public:
operator QVariant() const;
static bool isValidColor(const QString &name);
+ static bool isValidColor(QLatin1String) Q_DECL_NOTHROW;
private:
void invalidate() Q_DECL_NOTHROW;
- bool setColorFromString(const QString &name);
+ template <typename String>
+ bool setColorFromString(const String &name);
Spec cspec;
union {
@@ -263,6 +269,7 @@ private:
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &);
#endif
};
+Q_DECLARE_TYPEINFO(QColor, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_RELOCATABLE_TYPE);
inline QColor::QColor() Q_DECL_NOTHROW
{ invalidate(); }
@@ -270,8 +277,8 @@ inline QColor::QColor() Q_DECL_NOTHROW
inline QColor::QColor(int r, int g, int b, int a)
{ setRgb(r, g, b, a); }
-inline QColor::QColor(const char *aname)
-{ setNamedColor(QLatin1String(aname)); }
+inline QColor::QColor(QLatin1String aname)
+{ setNamedColor(aname); }
inline QColor::QColor(const QString& aname)
{ setNamedColor(aname); }
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
deleted file mode 100644
index 773e4096ee..0000000000
--- a/src/gui/painting/qcolor_p.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglobal.h"
-#include "qrgb.h"
-#include "qstringlist.h"
-#include "private/qtools_p.h"
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
- If s[0..1] is a valid hex number, returns its integer value,
- otherwise returns -1.
- */
-static inline int hex2int(const char *s)
-{
- const int hi = QtMiscUtils::fromHex(s[0]);
- if (hi < 0)
- return -1;
- const int lo = QtMiscUtils::fromHex(s[1]);
- if (lo < 0)
- return -1;
- return (hi << 4) | lo;
-}
-
-/*!
- \internal
- If s is a valid hex digit, returns its integer value,
- multiplied by 0x11, otherwise returns -1.
- */
-static inline int hex2int(char s)
-{
- const int h = QtMiscUtils::fromHex(s);
- return h < 0 ? h : (h << 4) | h;
-}
-
-bool qt_get_hex_rgb(const char *name, QRgb *rgb)
-{
- if(name[0] != '#')
- return false;
- name++;
- int len = qstrlen(name);
- int a, r, g, b;
- a = 255;
- if (len == 12) {
- r = hex2int(name);
- g = hex2int(name + 4);
- b = hex2int(name + 8);
- } else if (len == 9) {
- r = hex2int(name);
- g = hex2int(name + 3);
- b = hex2int(name + 6);
- } else if (len == 8) {
- a = hex2int(name);
- r = hex2int(name + 2);
- g = hex2int(name + 4);
- b = hex2int(name + 6);
- } else if (len == 6) {
- r = hex2int(name);
- g = hex2int(name + 2);
- b = hex2int(name + 4);
- } else if (len == 3) {
- r = hex2int(name[0]);
- g = hex2int(name[1]);
- b = hex2int(name[2]);
- } else {
- r = g = b = -1;
- }
- if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
- *rgb = 0;
- return false;
- }
- *rgb = qRgba(r, g ,b, a);
- return true;
-}
-
-bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
-{
- if (len > 13)
- return false;
- char tmp[16];
- for(int i = 0; i < len; ++i)
- tmp[i] = str[i].toLatin1();
- tmp[len] = 0;
- return qt_get_hex_rgb(tmp, rgb);
-}
-
-#ifndef QT_NO_COLORNAMES
-
-/*
- CSS color names = SVG 1.0 color names + transparent (rgba(0,0,0,0))
-*/
-
-#ifdef rgb
-# undef rgb
-#endif
-#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
-
-static const struct RGBData {
- const char name[21];
- uint value;
-} rgbTbl[] = {
- { "aliceblue", rgb(240, 248, 255) },
- { "antiquewhite", rgb(250, 235, 215) },
- { "aqua", rgb( 0, 255, 255) },
- { "aquamarine", rgb(127, 255, 212) },
- { "azure", rgb(240, 255, 255) },
- { "beige", rgb(245, 245, 220) },
- { "bisque", rgb(255, 228, 196) },
- { "black", rgb( 0, 0, 0) },
- { "blanchedalmond", rgb(255, 235, 205) },
- { "blue", rgb( 0, 0, 255) },
- { "blueviolet", rgb(138, 43, 226) },
- { "brown", rgb(165, 42, 42) },
- { "burlywood", rgb(222, 184, 135) },
- { "cadetblue", rgb( 95, 158, 160) },
- { "chartreuse", rgb(127, 255, 0) },
- { "chocolate", rgb(210, 105, 30) },
- { "coral", rgb(255, 127, 80) },
- { "cornflowerblue", rgb(100, 149, 237) },
- { "cornsilk", rgb(255, 248, 220) },
- { "crimson", rgb(220, 20, 60) },
- { "cyan", rgb( 0, 255, 255) },
- { "darkblue", rgb( 0, 0, 139) },
- { "darkcyan", rgb( 0, 139, 139) },
- { "darkgoldenrod", rgb(184, 134, 11) },
- { "darkgray", rgb(169, 169, 169) },
- { "darkgreen", rgb( 0, 100, 0) },
- { "darkgrey", rgb(169, 169, 169) },
- { "darkkhaki", rgb(189, 183, 107) },
- { "darkmagenta", rgb(139, 0, 139) },
- { "darkolivegreen", rgb( 85, 107, 47) },
- { "darkorange", rgb(255, 140, 0) },
- { "darkorchid", rgb(153, 50, 204) },
- { "darkred", rgb(139, 0, 0) },
- { "darksalmon", rgb(233, 150, 122) },
- { "darkseagreen", rgb(143, 188, 143) },
- { "darkslateblue", rgb( 72, 61, 139) },
- { "darkslategray", rgb( 47, 79, 79) },
- { "darkslategrey", rgb( 47, 79, 79) },
- { "darkturquoise", rgb( 0, 206, 209) },
- { "darkviolet", rgb(148, 0, 211) },
- { "deeppink", rgb(255, 20, 147) },
- { "deepskyblue", rgb( 0, 191, 255) },
- { "dimgray", rgb(105, 105, 105) },
- { "dimgrey", rgb(105, 105, 105) },
- { "dodgerblue", rgb( 30, 144, 255) },
- { "firebrick", rgb(178, 34, 34) },
- { "floralwhite", rgb(255, 250, 240) },
- { "forestgreen", rgb( 34, 139, 34) },
- { "fuchsia", rgb(255, 0, 255) },
- { "gainsboro", rgb(220, 220, 220) },
- { "ghostwhite", rgb(248, 248, 255) },
- { "gold", rgb(255, 215, 0) },
- { "goldenrod", rgb(218, 165, 32) },
- { "gray", rgb(128, 128, 128) },
- { "green", rgb( 0, 128, 0) },
- { "greenyellow", rgb(173, 255, 47) },
- { "grey", rgb(128, 128, 128) },
- { "honeydew", rgb(240, 255, 240) },
- { "hotpink", rgb(255, 105, 180) },
- { "indianred", rgb(205, 92, 92) },
- { "indigo", rgb( 75, 0, 130) },
- { "ivory", rgb(255, 255, 240) },
- { "khaki", rgb(240, 230, 140) },
- { "lavender", rgb(230, 230, 250) },
- { "lavenderblush", rgb(255, 240, 245) },
- { "lawngreen", rgb(124, 252, 0) },
- { "lemonchiffon", rgb(255, 250, 205) },
- { "lightblue", rgb(173, 216, 230) },
- { "lightcoral", rgb(240, 128, 128) },
- { "lightcyan", rgb(224, 255, 255) },
- { "lightgoldenrodyellow", rgb(250, 250, 210) },
- { "lightgray", rgb(211, 211, 211) },
- { "lightgreen", rgb(144, 238, 144) },
- { "lightgrey", rgb(211, 211, 211) },
- { "lightpink", rgb(255, 182, 193) },
- { "lightsalmon", rgb(255, 160, 122) },
- { "lightseagreen", rgb( 32, 178, 170) },
- { "lightskyblue", rgb(135, 206, 250) },
- { "lightslategray", rgb(119, 136, 153) },
- { "lightslategrey", rgb(119, 136, 153) },
- { "lightsteelblue", rgb(176, 196, 222) },
- { "lightyellow", rgb(255, 255, 224) },
- { "lime", rgb( 0, 255, 0) },
- { "limegreen", rgb( 50, 205, 50) },
- { "linen", rgb(250, 240, 230) },
- { "magenta", rgb(255, 0, 255) },
- { "maroon", rgb(128, 0, 0) },
- { "mediumaquamarine", rgb(102, 205, 170) },
- { "mediumblue", rgb( 0, 0, 205) },
- { "mediumorchid", rgb(186, 85, 211) },
- { "mediumpurple", rgb(147, 112, 219) },
- { "mediumseagreen", rgb( 60, 179, 113) },
- { "mediumslateblue", rgb(123, 104, 238) },
- { "mediumspringgreen", rgb( 0, 250, 154) },
- { "mediumturquoise", rgb( 72, 209, 204) },
- { "mediumvioletred", rgb(199, 21, 133) },
- { "midnightblue", rgb( 25, 25, 112) },
- { "mintcream", rgb(245, 255, 250) },
- { "mistyrose", rgb(255, 228, 225) },
- { "moccasin", rgb(255, 228, 181) },
- { "navajowhite", rgb(255, 222, 173) },
- { "navy", rgb( 0, 0, 128) },
- { "oldlace", rgb(253, 245, 230) },
- { "olive", rgb(128, 128, 0) },
- { "olivedrab", rgb(107, 142, 35) },
- { "orange", rgb(255, 165, 0) },
- { "orangered", rgb(255, 69, 0) },
- { "orchid", rgb(218, 112, 214) },
- { "palegoldenrod", rgb(238, 232, 170) },
- { "palegreen", rgb(152, 251, 152) },
- { "paleturquoise", rgb(175, 238, 238) },
- { "palevioletred", rgb(219, 112, 147) },
- { "papayawhip", rgb(255, 239, 213) },
- { "peachpuff", rgb(255, 218, 185) },
- { "peru", rgb(205, 133, 63) },
- { "pink", rgb(255, 192, 203) },
- { "plum", rgb(221, 160, 221) },
- { "powderblue", rgb(176, 224, 230) },
- { "purple", rgb(128, 0, 128) },
- { "red", rgb(255, 0, 0) },
- { "rosybrown", rgb(188, 143, 143) },
- { "royalblue", rgb( 65, 105, 225) },
- { "saddlebrown", rgb(139, 69, 19) },
- { "salmon", rgb(250, 128, 114) },
- { "sandybrown", rgb(244, 164, 96) },
- { "seagreen", rgb( 46, 139, 87) },
- { "seashell", rgb(255, 245, 238) },
- { "sienna", rgb(160, 82, 45) },
- { "silver", rgb(192, 192, 192) },
- { "skyblue", rgb(135, 206, 235) },
- { "slateblue", rgb(106, 90, 205) },
- { "slategray", rgb(112, 128, 144) },
- { "slategrey", rgb(112, 128, 144) },
- { "snow", rgb(255, 250, 250) },
- { "springgreen", rgb( 0, 255, 127) },
- { "steelblue", rgb( 70, 130, 180) },
- { "tan", rgb(210, 180, 140) },
- { "teal", rgb( 0, 128, 128) },
- { "thistle", rgb(216, 191, 216) },
- { "tomato", rgb(255, 99, 71) },
- { "transparent", 0 },
- { "turquoise", rgb( 64, 224, 208) },
- { "violet", rgb(238, 130, 238) },
- { "wheat", rgb(245, 222, 179) },
- { "white", rgb(255, 255, 255) },
- { "whitesmoke", rgb(245, 245, 245) },
- { "yellow", rgb(255, 255, 0) },
- { "yellowgreen", rgb(154, 205, 50) }
-};
-
-static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
-
-#undef rgb
-
-#if defined(Q_CC_MSVC) && _MSC_VER < 1600
-inline bool operator<(const RGBData &data1, const RGBData &data2)
-{ return qstrcmp(data1.name, data2.name) < 0; }
-#endif
-
-inline bool operator<(const char *name, const RGBData &data)
-{ return qstrcmp(name, data.name) < 0; }
-inline bool operator<(const RGBData &data, const char *name)
-{ return qstrcmp(data.name, name) < 0; }
-
-static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
-{
- const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
- if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
- *rgb = r->value;
- return true;
- }
- return false;
-}
-
-bool qt_get_named_rgb(const char *name, QRgb* rgb)
-{
- int len = int(strlen(name));
- if(len > 255)
- return false;
- char name_no_space[256];
- int pos = 0;
- for(int i = 0; i < len; i++) {
- if(name[i] != '\t' && name[i] != ' ')
- name_no_space[pos++] = QChar::toLower(name[i]);
- }
- name_no_space[pos] = 0;
-
- return get_named_rgb(name_no_space, rgb);
-}
-
-bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
-{
- if(len > 255)
- return false;
- char name_no_space[256];
- int pos = 0;
- for(int i = 0; i < len; i++) {
- if(name[i] != QLatin1Char('\t') && name[i] != QLatin1Char(' '))
- name_no_space[pos++] = name[i].toLower().toLatin1();
- }
- name_no_space[pos] = 0;
- return get_named_rgb(name_no_space, rgb);
-}
-
-
-uint qt_get_rgb_val(const char *name)
-{
- QRgb r = 0;
- qt_get_named_rgb(name,&r);
- return r;
-}
-
-QStringList qt_get_colornames()
-{
- int i = 0;
- QStringList lst;
- lst.reserve(rgbTblSize);
- for (i = 0; i < rgbTblSize; i++)
- lst << QLatin1String(rgbTbl[i].name);
- return lst;
-}
-
-#else
-
-bool qt_get_named_rgb(const char *, QRgb*)
-{
- return false;
-}
-
-uint qt_get_rgb_val(const char *)
-{
- return 0;
-}
-QStringList qt_get_colornames()
-{
- return QStringList();
-}
-#endif // QT_NO_COLORNAMES
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h
index 75bc888952..b44f2b163a 100644
--- a/src/gui/painting/qcolor_p.h
+++ b/src/gui/painting/qcolor_p.h
@@ -51,18 +51,12 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qrgb.h"
-#include "QtCore/qstringlist.h"
QT_BEGIN_NAMESPACE
-uint qt_get_rgb_val(const char *name);
-bool qt_get_named_rgb(const char *, QRgb*);
-bool qt_get_named_rgb(const QChar *, int len, QRgb*);
bool qt_get_hex_rgb(const char *, QRgb *);
-bool qt_get_hex_rgb(const QChar *, int len, QRgb *);
-QStringList qt_get_colornames();
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp
index 9312ee9540..6d2cb9aadb 100644
--- a/src/gui/painting/qcompositionfunctions.cpp
+++ b/src/gui/painting/qcompositionfunctions.cpp
@@ -87,6 +87,36 @@ QT_BEGIN_NAMESPACE
}\
}
+#if defined __SSE2__
+# define LOAD(ptr) _mm_loadl_epi64(reinterpret_cast<const __m128i *>(ptr))
+#ifdef Q_PROCESSOR_X86_64
+# define CONVERT(value) _mm_cvtsi64_si128(value)
+#else
+# define CONVERT(value) LOAD(&value)
+#endif
+# 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) _mm_shufflelo_epi16(_mm_cvtsi32_si128(n), _MM_SHUFFLE(0, 0, 0, 0))
+# 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 +129,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 +146,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 +176,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 +204,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 +251,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 +290,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 +319,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 +351,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 +426,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 +464,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 +918,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 +962,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/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
new file mode 100644
index 0000000000..6af12c19d8
--- /dev/null
+++ b/src/gui/painting/qcoregraphics.mm
@@ -0,0 +1,565 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcoregraphics_p.h"
+
+#include <private/qcore_mac_p.h>
+#include <qpa/qplatformpixmap.h>
+#include <QtGui/qicon.h>
+#include <QtGui/private/qpaintengine_p.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qcoreapplication.h>
+
+QT_BEGIN_NAMESPACE
+
+// ---------------------- Images ----------------------
+
+CGImageRef qt_mac_toCGImage(const QImage &inImage)
+{
+ CGImageRef cgImage = inImage.toCGImage();
+ if (cgImage)
+ return cgImage;
+
+ // Convert image data to a known-good format if the fast conversion fails.
+ return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage();
+}
+
+CGImageRef qt_mac_toCGImageMask(const QImage &image)
+{
+ static const auto deleter = [](void *image, const void *, size_t) { delete static_cast<QImage *>(image); };
+ QCFType<CGDataProviderRef> dataProvider =
+ CGDataProviderCreateWithData(new QImage(image), image.bits(),
+ image.byteCount(), deleter);
+
+ return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(),
+ image.bytesPerLine(), dataProvider, NULL, false);
+}
+
+OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
+{
+ // Verbatim copy if HIViewDrawCGImage (as shown on Carbon-Dev)
+ OSStatus err = noErr;
+
+#ifdef Q_OS_MACOS
+ require_action(inContext != NULL, InvalidContext, err = paramErr);
+ require_action(inBounds != NULL, InvalidBounds, err = paramErr);
+ require_action(inImage != NULL, InvalidImage, err = paramErr);
+#endif
+
+ CGContextSaveGState( inContext );
+ CGContextTranslateCTM (inContext, 0, inBounds->origin.y + CGRectGetMaxY(*inBounds));
+ CGContextScaleCTM(inContext, 1, -1);
+
+ CGContextDrawImage(inContext, *inBounds, inImage);
+
+ CGContextRestoreGState(inContext);
+
+#ifdef Q_OS_MACOS
+InvalidImage:
+InvalidBounds:
+InvalidContext:
+#endif
+ return err;
+}
+
+QImage qt_mac_toQImage(CGImageRef image)
+{
+ const size_t w = CGImageGetWidth(image),
+ h = CGImageGetHeight(image);
+ QImage ret(w, h, QImage::Format_ARGB32_Premultiplied);
+ ret.fill(Qt::transparent);
+ CGRect rect = CGRectMake(0, 0, w, h);
+ QMacCGContext ctx(&ret);
+ qt_mac_drawCGImage(ctx, &rect, image);
+ return ret;
+}
+
+#ifdef Q_OS_MACOS
+
+QT_END_NAMESPACE
+
+@interface NSGraphicsContext (QtAdditions)
+
++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState;
+
+@end
+
+@implementation NSGraphicsContext (QtAdditions)
+
++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState
+{
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_NA)
+ if (QT_PREPEND_NAMESPACE(QSysInfo::MacintoshVersion) >= QT_PREPEND_NAMESPACE(QSysInfo::MV_10_10))
+ return [self graphicsContextWithCGContext:graphicsPort flipped:initialFlippedState];
+#endif
+ return [self graphicsContextWithGraphicsPort:graphicsPort flipped:initialFlippedState];
+}
+
+@end
+
+QT_BEGIN_NAMESPACE
+
+static NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
+{
+ NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
+ return newImage;
+}
+
+NSImage *qt_mac_create_nsimage(const QPixmap &pm)
+{
+ if (pm.isNull())
+ return 0;
+ QImage image = pm.toImage();
+ CGImageRef cgImage = qt_mac_toCGImage(image);
+ NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
+ CGImageRelease(cgImage);
+ return nsImage;
+}
+
+NSImage *qt_mac_create_nsimage(const QIcon &icon)
+{
+ if (icon.isNull())
+ return nil;
+
+ NSImage *nsImage = [[NSImage alloc] init];
+ foreach (QSize size, icon.availableSizes()) {
+ QPixmap pm = icon.pixmap(size);
+ QImage image = pm.toImage();
+ CGImageRef cgImage = qt_mac_toCGImage(image);
+ NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
+ [nsImage addRepresentation:imageRep];
+ [imageRep release];
+ CGImageRelease(cgImage);
+ }
+ return nsImage;
+}
+
+QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
+{
+ const NSSize pixmapSize = NSMakeSize(size.width(), size.height());
+ QPixmap pixmap(pixmapSize.width, pixmapSize.height);
+ pixmap.fill(Qt::transparent);
+ [image setSize:pixmapSize];
+ const NSRect iconRect = NSMakeRect(0, 0, pixmapSize.width, pixmapSize.height);
+ QMacCGContext ctx(&pixmap);
+ if (!ctx)
+ return QPixmap();
+ NSGraphicsContext *gc = [NSGraphicsContext qt_graphicsContextWithCGContext:ctx flipped:YES];
+ if (!gc)
+ return QPixmap();
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:gc];
+ [image drawInRect:iconRect fromRect:iconRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
+ [NSGraphicsContext restoreGraphicsState];
+ return pixmap;
+}
+
+#endif // Q_OS_MACOS
+
+// ---------------------- Colors and Brushes ----------------------
+
+QColor qt_mac_toQColor(CGColorRef color)
+{
+ QColor qtColor;
+ CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(color));
+ const CGFloat *components = CGColorGetComponents(color);
+ if (model == kCGColorSpaceModelRGB) {
+ qtColor.setRgbF(components[0], components[1], components[2], components[3]);
+ } else if (model == kCGColorSpaceModelCMYK) {
+ qtColor.setCmykF(components[0], components[1], components[2], components[3]);
+ } else if (model == kCGColorSpaceModelMonochrome) {
+ qtColor.setRgbF(components[0], components[0], components[0], components[1]);
+ } else {
+ // Colorspace we can't deal with.
+ qWarning("Qt: qt_mac_toQColor: cannot convert from colorspace model: %d", model);
+ Q_ASSERT(false);
+ }
+ return qtColor;
+}
+
+#ifdef Q_OS_MACOS
+QColor qt_mac_toQColor(const NSColor *color)
+{
+ QColor qtColor;
+ NSString *colorSpace = [color colorSpaceName];
+ if (colorSpace == NSDeviceCMYKColorSpace) {
+ CGFloat cyan, magenta, yellow, black, alpha;
+ [color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
+ qtColor.setCmykF(cyan, magenta, yellow, black, alpha);
+ } else {
+ NSColor *tmpColor;
+ tmpColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
+ CGFloat red, green, blue, alpha;
+ [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha];
+ qtColor.setRgbF(red, green, blue, alpha);
+ }
+ return qtColor;
+}
+#endif
+
+QBrush qt_mac_toQBrush(CGColorRef color)
+{
+ QBrush qtBrush;
+ CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(color));
+ if (model == kCGColorSpaceModelPattern) {
+ // Colorspace we can't deal with; the color is drawn directly using a callback.
+ qWarning("Qt: qt_mac_toQBrush: cannot convert from colorspace model: %d", model);
+ Q_ASSERT(false);
+ } else {
+ qtBrush.setStyle(Qt::SolidPattern);
+ qtBrush.setColor(qt_mac_toQColor(color));
+ }
+ return qtBrush;
+}
+
+#ifdef Q_OS_MACOS
+static bool qt_mac_isSystemColorOrInstance(const NSColor *color, NSString *colorNameComponent, NSString *className)
+{
+ // We specifically do not want isKindOfClass: here
+ if ([color.className isEqualToString:className]) // NSPatternColorSpace
+ return true;
+ if ([color.catalogNameComponent isEqualToString:@"System"] &&
+ [color.colorNameComponent isEqualToString:colorNameComponent] &&
+ [color.colorSpaceName isEqualToString:NSNamedColorSpace])
+ return true;
+ return false;
+}
+
+QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
+{
+ QBrush qtBrush;
+
+ // QTBUG-49773: This calls NSDrawMenuItemBackground to render a 1 by n gradient; could use HITheme
+ if ([color.className isEqualToString:@"NSMenuItemHighlightColor"]) {
+ qWarning("Qt: qt_mac_toQBrush: cannot convert from NSMenuItemHighlightColor");
+ return qtBrush;
+ }
+
+ // Not a catalog color or a manifestation of System.windowBackgroundColor;
+ // only retrieved from NSWindow.backgroundColor directly
+ if ([color.className isEqualToString:@"NSMetalPatternColor"]) {
+ // NSTexturedBackgroundWindowMask, could theoretically handle this without private API by
+ // creating a window with the appropriate properties and then calling NSWindow.backgroundColor.patternImage,
+ // which returns a texture sized 1 by (window height, including frame), backed by a CGPattern
+ // which follows the window key state... probably need to allow QBrush to store a function pointer
+ // like CGPattern does
+ qWarning("Qt: qt_mac_toQBrush: cannot convert from NSMetalPatternColor");
+ return qtBrush;
+ }
+
+ // No public API to get these colors/stops;
+ // both accurately obtained through runtime object inspection on OS X 10.11
+ // (the NSColor object has NSGradient i-vars for both color groups)
+ if (qt_mac_isSystemColorOrInstance(color, @"_sourceListBackgroundColor", @"NSSourceListBackgroundColor")) {
+ QLinearGradient gradient;
+ if (colorGroup == QPalette::Active) {
+ gradient.setColorAt(0, QColor(233, 237, 242));
+ gradient.setColorAt(0.5, QColor(225, 229, 235));
+ gradient.setColorAt(1, QColor(209, 216, 224));
+ } else {
+ gradient.setColorAt(0, QColor(248, 248, 248));
+ gradient.setColorAt(0.5, QColor(240, 240, 240));
+ gradient.setColorAt(1, QColor(235, 235, 235));
+ }
+ return QBrush(gradient);
+ }
+
+ // A couple colors are special... they are actually instances of NSGradientPatternColor, which
+ // override set/setFill/setStroke to instead initialize an internal color
+ // ([NSColor colorWithCalibratedWhite:0.909804 alpha:1.000000]) while still returning the
+ // ruled lines pattern image (from OS X 10.4) to the user from -[NSColor patternImage]
+ // (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")) {
+ qtBrush.setStyle(Qt::SolidPattern);
+ qtBrush.setColor(qt_mac_toQColor(color.CGColor));
+ return qtBrush;
+ }
+
+ if (NSColor *patternColor = [color colorUsingColorSpaceName:NSPatternColorSpace]) {
+ NSImage *patternImage = patternColor.patternImage;
+ const QSizeF sz(patternImage.size.width, patternImage.size.height);
+ // FIXME: QBrush is not resolution independent (QTBUG-49774)
+ qtBrush.setTexture(qt_mac_toQPixmap(patternImage, sz));
+ } else {
+ qtBrush.setStyle(Qt::SolidPattern);
+ qtBrush.setColor(qt_mac_toQColor(color));
+ }
+ return qtBrush;
+}
+#endif
+
+// ---------------------- Color Management ----------------------
+
+static CGColorSpaceRef m_genericColorSpace = 0;
+static QHash<uint32_t, CGColorSpaceRef> m_displayColorSpaceHash;
+static bool m_postRoutineRegistered = false;
+
+static void qt_mac_cleanUpMacColorSpaces()
+{
+ if (m_genericColorSpace) {
+ CFRelease(m_genericColorSpace);
+ m_genericColorSpace = 0;
+ }
+ QHash<uint32_t, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
+ while (it != m_displayColorSpaceHash.constEnd()) {
+ if (it.value())
+ CFRelease(it.value());
+ ++it;
+ }
+ m_displayColorSpaceHash.clear();
+}
+
+static CGColorSpaceRef qt_mac_displayColorSpace(const QWindow *window)
+{
+ CGColorSpaceRef colorSpace = 0;
+ uint32_t displayID = 0;
+
+#ifdef Q_OS_MACOS
+ if (window == 0) {
+ displayID = CGMainDisplayID();
+ } else {
+ displayID = CGMainDisplayID();
+ /*
+ ### get correct display
+ const QRect &qrect = window->geometry();
+ CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
+ CGDisplayCount throwAway;
+ CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
+ if (dErr != kCGErrorSuccess)
+ return macDisplayColorSpace(0); // fall back on main display
+ */
+ }
+ if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
+ return colorSpace;
+
+ colorSpace = CGDisplayCopyColorSpace(displayID);
+#else
+ Q_UNUSED(window);
+#endif
+
+ if (colorSpace == 0)
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
+ m_displayColorSpaceHash.insert(displayID, colorSpace);
+ if (!m_postRoutineRegistered) {
+ m_postRoutineRegistered = true;
+ qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
+ }
+ return colorSpace;
+}
+
+CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
+{
+ Q_UNUSED(paintDevice);
+
+ // FIXME: Move logic into each paint device once Qt has support for color spaces
+ return qt_mac_displayColorSpace(0);
+
+ // The following code seems to take care of QWidget, but in reality doesn't, as
+ // qt_mac_displayColorSpace ignores the argument and always uses the main display.
+#if 0
+ bool isWidget = (paintDevice->devType() == QInternal::Widget);
+ return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice)->window() : 0);
+#endif
+}
+
+CGColorSpaceRef qt_mac_genericColorSpace()
+{
+#if 0
+ if (!m_genericColorSpace) {
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
+ m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+ } else
+ {
+ m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
+ }
+ if (!m_postRoutineRegistered) {
+ m_postRoutineRegistered = true;
+ qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
+ }
+ }
+ return m_genericColorSpace;
+#else
+ // Just return the main display colorspace for the moment.
+ return qt_mac_displayColorSpace(0);
+#endif
+}
+
+// ---------------------- Geometry Helpers ----------------------
+
+void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
+{
+ CGAffineTransform old_xform = CGAffineTransformIdentity;
+ if (orig_xform) { //setup xforms
+ old_xform = CGContextGetCTM(hd);
+ CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform));
+ CGContextConcatCTM(hd, *orig_xform);
+ }
+
+ //do the clipping
+ CGContextBeginPath(hd);
+ if (rgn.isEmpty()) {
+ CGContextAddRect(hd, CGRectMake(0, 0, 0, 0));
+ } else {
+ for (const QRect &r : rgn) {
+ CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height());
+ CGContextAddRect(hd, mac_r);
+ }
+ }
+ CGContextClip(hd);
+
+ if (orig_xform) {//reset xforms
+ CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
+ CGContextConcatCTM(hd, old_xform);
+ }
+}
+
+// move to QRegion?
+void qt_mac_scale_region(QRegion *region, qreal scaleFactor)
+{
+ if (!region || !region->rectCount())
+ return;
+
+ QVector<QRect> scaledRects;
+ scaledRects.reserve(region->rectCount());
+
+ for (const QRect &rect : *region)
+ scaledRects.append(QRect(rect.topLeft() * scaleFactor, rect.size() * scaleFactor));
+
+ region->setRects(&scaledRects[0], scaledRects.count());
+}
+
+// ---------------------- QMacCGContext ----------------------
+
+QMacCGContext::QMacCGContext(QPaintDevice *paintDevice) : context(0)
+{
+ // In Qt 5, QWidget and QPixmap (and QImage) paint devices are all QImages under the hood.
+ QImage *image = 0;
+ if (paintDevice->devType() == QInternal::Image) {
+ image = static_cast<QImage *>(paintDevice);
+ } else if (paintDevice->devType() == QInternal::Pixmap) {
+
+ const QPixmap *pm = static_cast<const QPixmap*>(paintDevice);
+ QPlatformPixmap *data = const_cast<QPixmap *>(pm)->data_ptr().data();
+ if (data && data->classId() == QPlatformPixmap::RasterClass) {
+ image = data->buffer();
+ } else {
+ qDebug("QMacCGContext: Unsupported pixmap class");
+ }
+ } else if (paintDevice->devType() == QInternal::Widget) {
+ // TODO test: image = static_cast<QImage *>(static_cast<const QWidget *>(paintDevice)->backingStore()->paintDevice());
+ qDebug("QMacCGContext: not implemented: Widget class");
+ }
+
+ if (!image)
+ return; // Context type not supported.
+
+ CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintDevice);
+ uint flags = kCGImageAlphaPremultipliedFirst;
+ flags |= kCGBitmapByteOrder32Host;
+
+ context = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
+ 8, image->bytesPerLine(), colorspace, flags);
+ CGContextTranslateCTM(context, 0, image->height());
+ CGContextScaleCTM(context, 1, -1);
+}
+
+QMacCGContext::QMacCGContext(QPainter *painter) : context(0)
+{
+ QPaintEngine *paintEngine = painter->paintEngine();
+
+ // Handle the case of QMacPrintEngine, which has an internal QCoreGraphicsPaintEngine
+ while (QPaintEngine *aggregateEngine = QPaintEnginePrivate::get(paintEngine)->aggregateEngine())
+ paintEngine = aggregateEngine;
+
+ paintEngine->syncState();
+
+ if (Qt::HANDLE handle = QPaintEnginePrivate::get(paintEngine)->nativeHandle()) {
+ context = static_cast<CGContextRef>(handle);
+ return;
+ }
+
+ int devType = painter->device()->devType();
+ if (paintEngine->type() == QPaintEngine::Raster
+ && (devType == QInternal::Widget ||
+ devType == QInternal::Pixmap ||
+ devType == QInternal::Image)) {
+
+ CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintEngine->paintDevice());
+ uint flags = kCGImageAlphaPremultipliedFirst;
+#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
+ flags |= kCGBitmapByteOrder32Host;
+#endif
+ const QImage *image = static_cast<const QImage *>(paintEngine->paintDevice());
+
+ context = CGBitmapContextCreate((void *)image->bits(), image->width(), image->height(),
+ 8, image->bytesPerLine(), colorspace, flags);
+
+ // Invert y axis
+ CGContextTranslateCTM(context, 0, image->height());
+ CGContextScaleCTM(context, 1, -1);
+
+ const qreal devicePixelRatio = image->devicePixelRatio();
+
+ if (devType == QInternal::Widget) {
+ // Set the clip rect which is an intersection of the system clip
+ // and the painter clip. To make matters more interesting these
+ // are in device pixels and device-independent pixels, respectively.
+ QRegion clip = painter->paintEngine()->systemClip(); // get system clip in device pixels
+ QTransform native = painter->deviceTransform(); // get device transform. dx/dy is in device pixels
+
+ if (painter->hasClipping()) {
+ QRegion r = painter->clipRegion(); // get painter clip, which is in device-independent pixels
+ qt_mac_scale_region(&r, devicePixelRatio); // scale painter clip to device pixels
+ r.translate(native.dx(), native.dy());
+ if (clip.isEmpty())
+ clip = r;
+ else
+ clip &= r;
+ }
+ qt_mac_clip_cg(context, clip, 0); // clip in device pixels
+
+ // Scale the context so that painting happens in device-independent pixels
+ CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
+ CGContextTranslateCTM(context, native.dx() / devicePixelRatio, native.dy() / devicePixelRatio);
+ } else {
+ // Scale to paint in device-independent pixels
+ CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
+ }
+ } else {
+ qDebug() << "QMacCGContext:: Unsupported painter devtype type" << devType;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
new file mode 100644
index 0000000000..ab2579387e
--- /dev/null
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCOREGRAPHICS_P_H
+#define QCOREGRAPHICS_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 <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qregion.h>
+#include <QtGui/qpalette.h>
+
+#include <CoreGraphics/CoreGraphics.h>
+#ifdef Q_OS_MACOS
+#include <AppKit/AppKit.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#ifdef Q_OS_MACOS
+Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
+Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon);
+Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
+#endif
+Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
+Q_GUI_EXPORT CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
+Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
+
+Q_GUI_EXPORT OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
+
+Q_GUI_EXPORT CGColorSpaceRef qt_mac_genericColorSpace();
+Q_GUI_EXPORT CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
+
+Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
+
+#ifdef Q_OS_MACOS
+Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
+Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
+#endif
+Q_GUI_EXPORT QColor qt_mac_toQColor(CGColorRef color);
+Q_GUI_EXPORT QBrush qt_mac_toQBrush(CGColorRef color);
+
+class Q_GUI_EXPORT QMacCGContext
+{
+public:
+ inline QMacCGContext() { context = 0; }
+ QMacCGContext(QPaintDevice *pdev);
+ QMacCGContext(QPainter *p);
+ inline QMacCGContext(CGContextRef cg, bool takeOwnership = false) {
+ context = cg;
+ if (!takeOwnership)
+ CGContextRetain(context);
+ }
+ inline QMacCGContext(const QMacCGContext &copy) : context(0) { *this = copy; }
+ inline ~QMacCGContext() {
+ if (context)
+ CGContextRelease(context);
+ }
+ inline bool isNull() const { return context; }
+ inline operator CGContextRef() { return context; }
+ inline QMacCGContext &operator=(const QMacCGContext &copy) {
+ if (context)
+ CGContextRelease(context);
+ context = copy.context;
+ CGContextRetain(context);
+ return *this;
+ }
+ inline QMacCGContext &operator=(CGContextRef cg) {
+ if (context)
+ CGContextRelease(context);
+ context = cg;
+ CGContextRetain(context); //we do not take ownership
+ return *this;
+ }
+
+private:
+ CGContextRef context;
+};
+
+QT_END_NAMESPACE
+
+#endif // QCOREGRAPHICS_P_H
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index b22e2c2cf5..68f4e00cdc 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qdrawhelper_p.h>
#include <private/qvectorpath_p.h>
#include <private/qpaintengine_raster_p.h>
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index a826532b43..2d514e14e0 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -197,7 +197,7 @@ void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, q
if ((style == BorderStyle_Outset && (edge == TopEdge || edge == LeftEdge))
|| (style == BorderStyle_Inset && (edge == BottomEdge || edge == RightEdge)))
c = c.color().lighter();
- // fall through!
+ Q_FALLTHROUGH();
case BorderStyle_Solid: {
p->setPen(Qt::NoPen);
p->setBrush(c);
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index f5a3fa1432..77b5be0c4c 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qbytearray.h"
#include <stdlib.h>
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 1c772ef232..3e01d34cb2 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]));
@@ -756,7 +836,10 @@ static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const
}
template <QPixelLayout::BPP bpp> static
-uint QT_FASTCALL fetchPixel(const uchar *src, int index);
+uint QT_FASTCALL fetchPixel(const uchar *, int)
+{
+ Q_UNREACHABLE();
+}
template <>
inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index)
@@ -1037,7 +1120,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 +1128,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 +1302,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 +1330,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 +1519,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,103 +1547,21 @@ 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);
- }
-}
-
-// blendType is either BlendTransformed or BlendTransformedTiled
-template<TextureBlendType blendType>
-static const uint *QT_FASTCALL fetchTransformedARGB32PM(uint *buffer, const Operator *, const QSpanData *data,
- int y, int x, int length)
-{
- int image_width = data->texture.width;
- int image_height = data->texture.height;
-
- const qreal cx = x + qreal(0.5);
- const qreal cy = y + qreal(0.5);
-
- const uint *end = buffer + length;
- uint *b = buffer;
- if (data->fast_matrix) {
- // The increment pr x in the scanline
- int fdx = (int)(data->m11 * fixed_scale);
- int fdy = (int)(data->m12 * fixed_scale);
-
- int fx = int((data->m21 * cy
- + data->m11 * cx + data->dx) * fixed_scale);
- int fy = int((data->m22 * cy
- + data->m12 * cx + data->dy) * fixed_scale);
-
- while (b < end) {
- int px = fx >> 16;
- int py = fy >> 16;
-
- if (blendType == BlendTransformedTiled) {
- px %= image_width;
- py %= image_height;
- if (px < 0) px += image_width;
- if (py < 0) py += image_height;
- } else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
- }
- *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
-
- fx += fdx;
- fy += fdy;
- ++b;
- }
- } else {
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- qreal fx = data->m21 * cy + data->m11 * cx + data->dx;
- qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
- qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
-
- while (b < end) {
- const qreal iw = fw == 0 ? 1 : 1 / fw;
- const qreal tx = fx * iw;
- const qreal ty = fy * iw;
- int px = int(tx) - (tx < 0);
- int py = int(ty) - (ty < 0);
-
- if (blendType == BlendTransformedTiled) {
- px %= image_width;
- py %= image_height;
- if (px < 0) px += image_width;
- if (py < 0) py += image_height;
- } else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
- }
- *b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
-
- fx += fdx;
- fy += fdy;
- fw += fdw;
- //force increment to avoid /0
- if (!fw) {
- fw += fdw;
- }
- ++b;
- }
+ return layout->convertToARGB64PM(buffer, src, length, data->texture.colorTable, 0);
}
- return buffer;
}
-template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
+template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
+ Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -1569,9 +1569,12 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
const qreal cy = y + qreal(0.5);
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
+ if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
+ Q_ASSERT(layout->bpp == bpp);
+ // When templated 'fetch' should be inlined at compile time:
+ const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
- const uint *end = buffer + length;
+ uint *const end = buffer + length;
uint *b = buffer;
if (data->fast_matrix) {
// The increment pr x in the scanline
@@ -1639,8 +1642,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 +1657,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 +1674,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 +1697,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 +1712,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 +1743,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;
}
}
@@ -1750,9 +1752,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
/** \internal
interpolate 4 argb pixels with the distx and disty factor.
- distx and disty bust be between 0 and 16
+ distx and disty must be between 0 and 16
*/
-static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, int distx, int disty)
+static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, uint distx, uint disty)
{
uint distxy = distx * disty;
//idistx * disty = (16-distx) * disty = 16*disty - distxy
@@ -2099,30 +2101,30 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
const uint *s1 = (const uint *)data->texture.scanLine(y1);
const uint *s2 = (const uint *)data->texture.scanLine(y2);
- int disty = (fy & 0x0000ffff) >> 12;
+ const int disty8 = (fy & 0x0000ffff) >> 8;
+ const int disty4 = (disty8 + 0x08) >> 4;
if (blendType != BlendTransformedBilinearTiled) {
#define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \
+ const qint64 min_fx = qint64(image_x1) * fixed_scale; \
+ const qint64 max_fx = qint64(image_x2) * fixed_scale; \
while (b < end) { \
int x1 = (fx >> 16); \
int x2; \
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); \
if (x1 != x2) \
break; \
- uint tl = s1[x1]; \
- uint tr = s1[x2]; \
- uint bl = s2[x1]; \
- uint br = s2[x2]; \
- int distx = (fx & 0x0000ffff) >> 12; \
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); \
+ uint top = s1[x1]; \
+ uint bot = s2[x1]; \
+ *b = INTERPOLATE_PIXEL_256(top, 256 - disty8, bot, disty8); \
fx += fdx; \
++b; \
} \
- uint *boundedEnd; \
+ uint *boundedEnd = end; \
if (fdx > 0) \
- boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); \
- else \
- boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); \
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \
+ else if (fdx < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \
boundedEnd -= 3;
#if defined(__SSE2__)
@@ -2130,8 +2132,9 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
const __m128i v_256 = _mm_set1_epi16(256);
- const __m128i v_disty = _mm_set1_epi16(disty);
+ const __m128i v_disty = _mm_set1_epi16(disty4);
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
+ const __m128i v_fx_r = _mm_set1_epi32(0x8);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
while (b < boundedEnd) {
@@ -2145,7 +2148,8 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i bl = _mm_setr_epi32(s2[offset0], s2[offset1], s2[offset2], s2[offset3]);
const __m128i br = _mm_setr_epi32(s2[offset0 + 1], s2[offset1 + 1], s2[offset2 + 1], s2[offset3 + 1]);
- __m128i v_distx = _mm_srli_epi16(v_fx, 12);
+ __m128i v_distx = _mm_srli_epi16(v_fx, 8);
+ v_distx = _mm_srli_epi16(_mm_add_epi32(v_distx, v_fx_r), 4);
v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
@@ -2160,48 +2164,49 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const int16x8_t colorMask = vdupq_n_s16(0x00ff);
const int16x8_t invColorMask = vmvnq_s16(colorMask);
const int16x8_t v_256 = vdupq_n_s16(256);
- const int16x8_t v_disty = vdupq_n_s16(disty);
+ const int16x8_t v_disty = vdupq_n_s16(disty4);
const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4);
int32x4_t v_fdx = vdupq_n_s32(fdx*4);
- ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1);
-
- union Vect_buffer { int32x4_t vect; quint32 i[4]; };
- Vect_buffer v_fx;
-
- for (int i = 0; i < 4; i++) {
- v_fx.i[i] = fx;
- fx += fdx;
- }
+ int32x4_t v_fx = vmovq_n_s32(fx);
+ v_fx = vsetq_lane_s32(fx + fdx, v_fx, 1);
+ v_fx = vsetq_lane_s32(fx + fdx * 2, v_fx, 2);
+ v_fx = vsetq_lane_s32(fx + fdx * 3, v_fx, 3);
const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
+ const int32x4_t v_fx_r = vdupq_n_s32(0x0800);
while (b < boundedEnd) {
+ uint32x4x2_t v_top, v_bot;
- Vect_buffer tl, tr, bl, br;
-
- Vect_buffer v_fx_shifted;
- v_fx_shifted.vect = vshrq_n_s32(v_fx.vect, 16);
-
- int32x4_t v_distx = vshrq_n_s32(vandq_s32(v_fx.vect, v_ffff_mask), 12);
-
- for (int i = 0; i < 4; i++) {
- int x1 = v_fx_shifted.i[i];
- const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1;
- const uint *addr_tr = addr_tl + 1;
- tl.i[i] = *addr_tl;
- tr.i[i] = *addr_tr;
- bl.i[i] = *(addr_tl+secondLine);
- br.i[i] = *(addr_tr+secondLine);
- }
+ int x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
+ x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
+ x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
+ x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
+ int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_fx_r), 12);
v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
- interpolate_4_pixels_16_neon(vreinterpretq_s16_s32(tl.vect), vreinterpretq_s16_s32(tr.vect), vreinterpretq_s16_s32(bl.vect), vreinterpretq_s16_s32(br.vect), vreinterpretq_s16_s32(v_distx), v_disty, v_disty_, colorMask, invColorMask, v_256, b);
+ interpolate_4_pixels_16_neon(
+ vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
+ vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
+ vreinterpretq_s16_s32(v_distx), v_disty, v_disty_,
+ colorMask, invColorMask, v_256, b);
b+=4;
- v_fx.vect = vaddq_s32(v_fx.vect, v_fdx);
+ v_fx = vaddq_s32(v_fx, v_fdx);
}
- fx = v_fx.i[0];
#endif
}
@@ -2213,8 +2218,14 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
uint tr = s1[x2];
uint bl = s2[x1];
uint br = s2[x2];
- int distx = (fx & 0x0000ffff) >> 12;
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
+#if defined(__SSE2__) || defined(__ARM_NEON__)
+ // The optimized interpolate_4_pixels are faster than interpolate_4_pixels_16.
+ int distx8 = (fx & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(tl, tr, bl, br, distx8, disty8);
+#else
+ int distx4 = ((fx & 0x0000ffff) + 0x0800) >> 12;
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx4, disty4);
+#endif
fx += fdx;
++b;
}
@@ -2253,6 +2264,10 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
if (blendType != BlendTransformedBilinearTiled) {
#define BILINEAR_ROTATE_BOUNDS_PROLOG \
+ const qint64 min_fx = qint64(image_x1) * fixed_scale; \
+ const qint64 max_fx = qint64(image_x2) * fixed_scale; \
+ const qint64 min_fy = qint64(image_y1) * fixed_scale; \
+ const qint64 max_fy = qint64(image_y2) * fixed_scale; \
while (b < end) { \
int x1 = (fx >> 16); \
int x2; \
@@ -2275,7 +2290,15 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fy += fdy; \
++b; \
} \
- uint *boundedEnd = end - 3; \
+ uint *boundedEnd = end; \
+ if (fdx > 0) \
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \
+ else if (fdx < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \
+ if (fdy > 0) \
+ boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy); \
+ else if (fdy < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy); \
boundedEnd -= 3;
#if defined(__SSE2__)
@@ -2285,6 +2308,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i v_256 = _mm_set1_epi16(256);
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
const __m128i v_fdy = _mm_set1_epi32(fdy*4);
+ const __m128i v_fxy_r = _mm_set1_epi32(0x8);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
__m128i v_fy = _mm_setr_epi32(fy, fy + fdy, fy + fdy + fdy, fy + fdy + fdy + fdy);
@@ -2293,15 +2317,6 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0));
while (b < boundedEnd) {
- if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
- break;
- if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
- break;
- if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
- break;
- if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
- break;
-
const __m128i vy = _mm_packs_epi32(_mm_srli_epi32(v_fy, 16), _mm_setzero_si128());
// 4x16bit * 4x16bit -> 4x32bit
__m128i offset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epi16(vy, vbpl));
@@ -2317,8 +2332,10 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i bl = _mm_setr_epi32(bottomData[offset0], bottomData[offset1], bottomData[offset2], bottomData[offset3]);
const __m128i br = _mm_setr_epi32(bottomData[offset0 + 1], bottomData[offset1 + 1], bottomData[offset2 + 1], bottomData[offset3 + 1]);
- __m128i v_distx = _mm_srli_epi16(v_fx, 12);
- __m128i v_disty = _mm_srli_epi16(v_fy, 12);
+ __m128i v_distx = _mm_srli_epi16(v_fx, 8);
+ __m128i v_disty = _mm_srli_epi16(v_fy, 8);
+ v_distx = _mm_srli_epi16(_mm_add_epi32(v_distx, v_fxy_r), 4);
+ v_disty = _mm_srli_epi16(_mm_add_epi32(v_disty, v_fxy_r), 4);
v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_disty = _mm_shufflehi_epi16(v_disty, _MM_SHUFFLE(2,2,0,0));
@@ -2331,6 +2348,81 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
fx = _mm_cvtsi128_si32(v_fx);
fy = _mm_cvtsi128_si32(v_fy);
+#elif defined(__ARM_NEON__)
+ BILINEAR_ROTATE_BOUNDS_PROLOG
+
+ const int16x8_t colorMask = vdupq_n_s16(0x00ff);
+ const int16x8_t invColorMask = vmvnq_s16(colorMask);
+ const int16x8_t v_256 = vdupq_n_s16(256);
+ int32x4_t v_fdx = vdupq_n_s32(fdx * 4);
+ int32x4_t v_fdy = vdupq_n_s32(fdy * 4);
+
+ const uchar *textureData = data->texture.imageData;
+ const int bytesPerLine = data->texture.bytesPerLine;
+
+ int32x4_t v_fx = vmovq_n_s32(fx);
+ int32x4_t v_fy = vmovq_n_s32(fy);
+ v_fx = vsetq_lane_s32(fx + fdx, v_fx, 1);
+ v_fy = vsetq_lane_s32(fy + fdy, v_fy, 1);
+ v_fx = vsetq_lane_s32(fx + fdx * 2, v_fx, 2);
+ v_fy = vsetq_lane_s32(fy + fdy * 2, v_fy, 2);
+ v_fx = vsetq_lane_s32(fx + fdx * 3, v_fx, 3);
+ v_fy = vsetq_lane_s32(fy + fdy * 3, v_fy, 3);
+
+ const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
+ const int32x4_t v_round = vdupq_n_s32(0x0800);
+
+ while (b < boundedEnd) {
+ uint32x4x2_t v_top, v_bot;
+
+ int x1 = (fx >> 16);
+ int y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ const uchar *sl = textureData + bytesPerLine * y1;
+ const uint *s1 = reinterpret_cast<const uint *>(sl);
+ const uint *s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
+
+ int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_round), 12);
+ int32x4_t v_disty = vshrq_n_s32(vaddq_s32(vandq_s32(v_fy, v_ffff_mask), v_round), 12);
+ v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
+ v_disty = vorrq_s32(v_disty, vshlq_n_s32(v_disty, 16));
+ int16x8_t v_disty_ = vshlq_n_s16(vreinterpretq_s16_s32(v_disty), 4);
+
+ interpolate_4_pixels_16_neon(
+ vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
+ vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
+ vreinterpretq_s16_s32(v_distx), vreinterpretq_s16_s32(v_disty),
+ v_disty_, colorMask, invColorMask, v_256, b);
+ b += 4;
+ v_fx = vaddq_s32(v_fx, v_fdx);
+ v_fy = vaddq_s32(v_fy, v_fdy);
+ }
#endif
}
@@ -2357,8 +2449,8 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
int disty = (fy & 0x0000ffff) >> 8;
*b = interpolate_4_pixels(tl, tr, bl, br, distx, disty);
#else
- int distx = (fx & 0x0000ffff) >> 12;
- int disty = (fy & 0x0000ffff) >> 12;
+ int distx = ((fx & 0x0000ffff) + 0x0800) >> 12;
+ int disty = ((fy & 0x0000ffff) + 0x0800) >> 12;
*b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
#endif
@@ -2418,12 +2510,17 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
// blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled
-template<TextureBlendType blendType>
+template<TextureBlendType blendType, QPixelLayout::BPP bpp>
static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *,
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;
+ if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
+ Q_ASSERT(layout->bpp == bpp);
+ // When templated 'fetch' should be inlined at compile time:
+ const FetchPixelsFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixels[layout->bpp] : fetchPixels<bpp>;
+ const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -2461,7 +2558,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
// The idea is first to do the interpolation between the row s1 and the row s2
// into an intermediate buffer, then we interpolate between two pixel of this buffer.
- FetchPixelsFunc fetch = qFetchPixels[layout->bpp];
// +1 for the last pixel to interpolate with, and +1 for rounding errors.
uint buf1[buffer_size + 2];
uint buf2[buffer_size + 2];
@@ -2479,9 +2575,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 +2587,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 +2608,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];
@@ -2550,7 +2646,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
}
} else {
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2561,23 +2656,14 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int x1 = (fx >> 16);
int x2;
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
-
- if (layout->bpp == QPixelLayout::BPP32) {
- buf1[i * 2 + 0] = ((const uint*)s1)[x1];
- buf1[i * 2 + 1] = ((const uint*)s1)[x2];
- buf2[i * 2 + 0] = ((const uint*)s2)[x1];
- buf2[i * 2 + 1] = ((const uint*)s2)[x2];
- } else {
- buf1[i * 2 + 0] = fetch(s1, x1);
- buf1[i * 2 + 1] = fetch(s1, x2);
- buf2[i * 2 + 0] = fetch(s2, x1);
- buf2[i * 2 + 1] = fetch(s2, x2);
- }
-
+ buf1[i * 2 + 0] = fetch1(s1, x1);
+ buf1[i * 2 + 1] = fetch1(s1, x2);
+ buf2[i * 2 + 0] = fetch1(s2, x1);
+ buf2[i * 2 + 1] = fetch1(s2, x2);
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;
@@ -2587,13 +2673,13 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fracX += fdx;
}
} else { //scale down
- int disty = (fy & 0x0000ffff) >> 12;
+ int disty = ((fy & 0x0000ffff) + 0x0800) >> 12;
for (int i = 0; i < len; ++i) {
uint tl = buf1[i * 2 + 0];
uint tr = buf1[i * 2 + 1];
uint bl = buf2[i * 2 + 0];
uint br = buf2[i * 2 + 1];
- int distx = (fracX & 0x0000ffff) >> 12;
+ int distx = ((fracX & 0x0000ffff) + 0x0800) >> 12;
b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
fracX += fdx;
}
@@ -2603,7 +2689,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
}
}
} else { //rotation
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2622,24 +2707,15 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
-
- if (layout->bpp == QPixelLayout::BPP32) {
- buf1[i * 2 + 0] = ((const uint*)s1)[x1];
- buf1[i * 2 + 1] = ((const uint*)s1)[x2];
- buf2[i * 2 + 0] = ((const uint*)s2)[x1];
- buf2[i * 2 + 1] = ((const uint*)s2)[x2];
- } else {
- buf1[i * 2 + 0] = fetch(s1, x1);
- buf1[i * 2 + 1] = fetch(s1, x2);
- buf2[i * 2 + 0] = fetch(s2, x1);
- buf2[i * 2 + 1] = fetch(s2, x2);
- }
-
+ buf1[i * 2 + 0] = fetch1(s1, x1);
+ buf1[i * 2 + 1] = fetch1(s1, x2);
+ buf2[i * 2 + 0] = fetch1(s2, x1);
+ buf2[i * 2 + 1] = fetch1(s2, x2);
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.
@@ -2659,8 +2735,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
uint bl = buf2[i * 2 + 0];
uint br = buf2[i * 2 + 1];
- int distx = (fracX & 0x0000ffff) >> 12;
- int disty = (fracY & 0x0000ffff) >> 12;
+ int distx = ((fracX & 0x0000ffff) + 0x0800) >> 12;
+ int disty = ((fracY & 0x0000ffff) + 0x0800) >> 12;
b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
fracX += fdx;
@@ -2681,7 +2757,6 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
qreal fy = data->m22 * cy + data->m12 * cx + data->dy;
qreal fw = data->m23 * cy + data->m13 * cx + data->m33;
- FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint buf1[buffer_size];
uint buf2[buffer_size];
uint *b = buffer;
@@ -2709,18 +2784,10 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
-
- if (layout->bpp == QPixelLayout::BPP32) {
- buf1[i * 2 + 0] = ((const uint*)s1)[x1];
- buf1[i * 2 + 1] = ((const uint*)s1)[x2];
- buf2[i * 2 + 0] = ((const uint*)s2)[x1];
- buf2[i * 2 + 1] = ((const uint*)s2)[x2];
- } else {
- buf1[i * 2 + 0] = fetch(s1, x1);
- buf1[i * 2 + 1] = fetch(s1, x2);
- buf2[i * 2 + 0] = fetch(s2, x1);
- buf2[i * 2 + 1] = fetch(s2, x2);
- }
+ buf1[i * 2 + 0] = fetch1(s1, x1);
+ buf1[i * 2 + 1] = fetch1(s1, x2);
+ buf2[i * 2 + 0] = fetch1(s2, x1);
+ buf2[i * 2 + 1] = fetch1(s2, x2);
fx += fdx;
fy += fdy;
@@ -2730,8 +2797,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 +2819,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;
@@ -2808,10 +2875,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
if (x1 != x2)
break;
- sbuf1[i * 2 + 0] = ((const uint*)s1)[x1];
- sbuf1[i * 2 + 1] = ((const uint*)s1)[x2];
- sbuf2[i * 2 + 0] = ((const uint*)s2)[x1];
- sbuf2[i * 2 + 1] = ((const uint*)s2)[x2];
+ sbuf1[i * 2 + 0] = sbuf1[i * 2 + 1] = ((const uint*)s1)[x1];
+ sbuf2[i * 2 + 0] = sbuf2[i * 2 + 1] = ((const uint*)s2)[x1];
fx += fdx;
}
int fastLen;
@@ -2869,9 +2934,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);
@@ -2930,6 +2995,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
fy += fdy;
}
+ int fastLen = len;
+ if (fdx > 0)
+ fastLen = qMin(fastLen, int((qint64(image_x2) * fixed_scale - fx) / fdx));
+ else if (fdx < 0)
+ fastLen = qMin(fastLen, int((qint64(image_x1) * fixed_scale - fx) / fdx));
+ if (fdy > 0)
+ fastLen = qMin(fastLen, int((qint64(image_y2) * fixed_scale - fy) / fdy));
+ else if (fdy < 0)
+ fastLen = qMin(fastLen, int((qint64(image_y1) * fixed_scale - fy) / fdy));
+ fastLen -= 3;
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
const __m128i v_fdy = _mm_set1_epi32(fdy*4);
@@ -2939,15 +3014,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
const uchar *s1 = data->texture.imageData;
const uchar *s2 = s1 + bytesPerLine;
const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0));
- for (; i < len-3; i+=4) {
- if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
- break;
- if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
- break;
- if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
- break;
- if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
- break;
+ for (; i < fastLen; i += 4) {
const __m128i vy = _mm_packs_epi32(_mm_srai_epi32(v_fy, 16), _mm_setzero_si128());
__m128i voffset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epu16(vy, vbpl));
voffset = _mm_add_epi32(voffset, _mm_srli_epi32(v_fx, 16));
@@ -3007,8 +3074,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);
@@ -3079,8 +3146,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];
@@ -3096,342 +3163,83 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
return buffer;
}
-static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
- // Untransformed
- {
- 0, // Invalid
- fetchUntransformed, // Mono
- fetchUntransformed, // MonoLsb
- fetchUntransformed, // Indexed8
- fetchUntransformedARGB32PM, // RGB32
- fetchUntransformed, // ARGB32
- fetchUntransformedARGB32PM, // ARGB32_Premultiplied
- fetchUntransformedRGB16, // RGB16
- fetchUntransformed, // ARGB8565_Premultiplied
- fetchUntransformed, // RGB666
- fetchUntransformed, // ARGB6666_Premultiplied
- fetchUntransformed, // RGB555
- fetchUntransformed, // ARGB8555_Premultiplied
- fetchUntransformed, // RGB888
- fetchUntransformed, // RGB444
- fetchUntransformed, // ARGB4444_Premultiplied
- fetchUntransformed, // RGBX8888
- fetchUntransformed, // RGBA8888
- fetchUntransformed, // RGBA8888_Premultiplied
- fetchUntransformed, // Format_BGR30
- fetchUntransformed, // Format_A2BGR30_Premultiplied
- fetchUntransformed, // Format_RGB30
- fetchUntransformed, // Format_A2RGB30_Premultiplied
- fetchUntransformed, // Alpha8
- fetchUntransformed, // Grayscale8
- },
- // Tiled
- {
- 0, // Invalid
- fetchUntransformed, // Mono
- fetchUntransformed, // MonoLsb
- fetchUntransformed, // Indexed8
- fetchUntransformedARGB32PM, // RGB32
- fetchUntransformed, // ARGB32
- fetchUntransformedARGB32PM, // ARGB32_Premultiplied
- fetchUntransformedRGB16, // RGB16
- fetchUntransformed, // ARGB8565_Premultiplied
- fetchUntransformed, // RGB666
- fetchUntransformed, // ARGB6666_Premultiplied
- fetchUntransformed, // RGB555
- fetchUntransformed, // ARGB8555_Premultiplied
- fetchUntransformed, // RGB888
- fetchUntransformed, // RGB444
- fetchUntransformed, // ARGB4444_Premultiplied
- fetchUntransformed, // RGBX8888
- fetchUntransformed, // RGBA8888
- fetchUntransformed, // RGBA8888_Premultiplied
- fetchUntransformed, // BGR30
- fetchUntransformed, // A2BGR30_Premultiplied
- fetchUntransformed, // RGB30
- fetchUntransformed, // A2RGB30_Premultiplied
- fetchUntransformed, // Alpha8
- fetchUntransformed, // Grayscale8
- },
- // Transformed
- {
- 0, // Invalid
- fetchTransformed<BlendTransformed>, // Mono
- fetchTransformed<BlendTransformed>, // MonoLsb
- fetchTransformed<BlendTransformed>, // Indexed8
- fetchTransformedARGB32PM<BlendTransformed>, // RGB32
- fetchTransformed<BlendTransformed>, // ARGB32
- fetchTransformedARGB32PM<BlendTransformed>, // ARGB32_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB16
- fetchTransformed<BlendTransformed>, // ARGB8565_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB666
- fetchTransformed<BlendTransformed>, // ARGB6666_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB555
- fetchTransformed<BlendTransformed>, // ARGB8555_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB888
- fetchTransformed<BlendTransformed>, // RGB444
- fetchTransformed<BlendTransformed>, // ARGB4444_Premultiplied
- fetchTransformed<BlendTransformed>, // RGBX8888
- fetchTransformed<BlendTransformed>, // RGBA8888
- fetchTransformed<BlendTransformed>, // RGBA8888_Premultiplied
- fetchTransformed<BlendTransformed>, // BGR30
- fetchTransformed<BlendTransformed>, // A2BGR30_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB30
- fetchTransformed<BlendTransformed>, // A2RGB30_Premultiplied
- fetchTransformed<BlendTransformed>, // Alpah8
- fetchTransformed<BlendTransformed>, // Grayscale8
- },
- {
- 0, // TransformedTiled
- fetchTransformed<BlendTransformedTiled>, // Mono
- fetchTransformed<BlendTransformedTiled>, // MonoLsb
- fetchTransformed<BlendTransformedTiled>, // Indexed8
- fetchTransformedARGB32PM<BlendTransformedTiled>, // RGB32
- fetchTransformed<BlendTransformedTiled>, // ARGB32
- fetchTransformedARGB32PM<BlendTransformedTiled>, // ARGB32_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB16
- fetchTransformed<BlendTransformedTiled>, // ARGB8565_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB666
- fetchTransformed<BlendTransformedTiled>, // ARGB6666_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB555
- fetchTransformed<BlendTransformedTiled>, // ARGB8555_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB888
- fetchTransformed<BlendTransformedTiled>, // RGB444
- fetchTransformed<BlendTransformedTiled>, // ARGB4444_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGBX8888
- fetchTransformed<BlendTransformedTiled>, // RGBA8888
- fetchTransformed<BlendTransformedTiled>, // RGBA8888_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // BGR30
- fetchTransformed<BlendTransformedTiled>, // A2BGR30_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB30
- fetchTransformed<BlendTransformedTiled>, // A2RGB30_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // Alpha8
- fetchTransformed<BlendTransformedTiled>, // Grayscale8
- },
- {
- 0, // Bilinear
- fetchTransformedBilinear<BlendTransformedBilinear>, // Mono
- fetchTransformedBilinear<BlendTransformedBilinear>, // MonoLsb
- fetchTransformedBilinear<BlendTransformedBilinear>, // Indexed8
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // RGB32
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB32
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // ARGB32_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB16
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB8565_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB666
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB6666_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB555
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB8555_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB888
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB444
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB4444_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGBX8888
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // BGR30
- fetchTransformedBilinear<BlendTransformedBilinear>, // A2BGR30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB30
- fetchTransformedBilinear<BlendTransformedBilinear>, // A2RGB30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // Alpha8
- fetchTransformedBilinear<BlendTransformedBilinear>, // Grayscale8
- },
- {
- 0, // BilinearTiled
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Mono
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // MonoLsb
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Indexed8
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, // RGB32
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB32
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB16
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB8565_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB666
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB6666_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB555
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB8555_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB888
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB444
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB4444_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBX8888
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // BGR30
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB30
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Alpha8
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Grayscale8
- },
+// FetchUntransformed can have more specialized methods added depending on SIMD features.
+static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
+ 0, // Invalid
+ fetchUntransformed, // Mono
+ fetchUntransformed, // MonoLsb
+ fetchUntransformed, // Indexed8
+ fetchUntransformedARGB32PM, // RGB32
+ fetchUntransformed, // ARGB32
+ fetchUntransformedARGB32PM, // ARGB32_Premultiplied
+ fetchUntransformedRGB16, // RGB16
+ fetchUntransformed, // ARGB8565_Premultiplied
+ fetchUntransformed, // RGB666
+ fetchUntransformed, // ARGB6666_Premultiplied
+ fetchUntransformed, // RGB555
+ fetchUntransformed, // ARGB8555_Premultiplied
+ fetchUntransformed, // RGB888
+ fetchUntransformed, // RGB444
+ fetchUntransformed, // ARGB4444_Premultiplied
+ fetchUntransformed, // RGBX8888
+ fetchUntransformed, // RGBA8888
+ fetchUntransformed, // RGBA8888_Premultiplied
+ fetchUntransformed, // Format_BGR30
+ fetchUntransformed, // Format_A2BGR30_Premultiplied
+ fetchUntransformed, // Format_RGB30
+ fetchUntransformed, // Format_A2RGB30_Premultiplied
+ fetchUntransformed, // Alpha8
+ fetchUntransformed, // Grayscale8
};
-static SourceFetchProc64 sourceFetch64[NBlendTypes][QImage::NImageFormats] = {
- // Untransformed
- {
- 0, // Invalid
- fetchUntransformed64, // Mono
- fetchUntransformed64, // MonoLsb
- fetchUntransformed64, // Indexed8
- fetchUntransformed64, // RGB32
- fetchUntransformed64, // ARGB32
- fetchUntransformed64, // ARGB32_Premultiplied
- fetchUntransformed64, // RGB16
- fetchUntransformed64, // ARGB8565_Premultiplied
- fetchUntransformed64, // RGB666
- fetchUntransformed64, // ARGB6666_Premultiplied
- fetchUntransformed64, // RGB555
- fetchUntransformed64, // ARGB8555_Premultiplied
- fetchUntransformed64, // RGB888
- fetchUntransformed64, // RGB444
- fetchUntransformed64, // ARGB4444_Premultiplied
- fetchUntransformed64, // RGBX8888
- fetchUntransformed64, // RGBA8888
- fetchUntransformed64, // RGBA8888_Premultiplied
- fetchUntransformed64, // Format_BGR30
- fetchUntransformed64, // Format_A2BGR30_Premultiplied
- fetchUntransformed64, // Format_RGB30
- fetchUntransformed64, // Format_A2RGB30_Premultiplied
- fetchUntransformed64, // Alpha8
- fetchUntransformed64, // Grayscale8
- },
- // Tiled
- {
- 0, // Invalid
- fetchUntransformed64, // Mono
- fetchUntransformed64, // MonoLsb
- fetchUntransformed64, // Indexed8
- fetchUntransformed64, // RGB32
- fetchUntransformed64, // ARGB32
- fetchUntransformed64, // ARGB32_Premultiplied
- fetchUntransformed64, // RGB16
- fetchUntransformed64, // ARGB8565_Premultiplied
- fetchUntransformed64, // RGB666
- fetchUntransformed64, // ARGB6666_Premultiplied
- fetchUntransformed64, // RGB555
- fetchUntransformed64, // ARGB8555_Premultiplied
- fetchUntransformed64, // RGB888
- fetchUntransformed64, // RGB444
- fetchUntransformed64, // ARGB4444_Premultiplied
- fetchUntransformed64, // RGBX8888
- fetchUntransformed64, // RGBA8888
- fetchUntransformed64, // RGBA8888_Premultiplied
- fetchUntransformed64, // BGR30
- fetchUntransformed64, // A2BGR30_Premultiplied
- fetchUntransformed64, // RGB30
- fetchUntransformed64, // A2RGB30_Premultiplied
- fetchUntransformed64, // Alpha8
- fetchUntransformed64, // Grayscale8
- },
- // Transformed
- {
- 0, // Invalid
- fetchTransformed64<BlendTransformed>, // Mono
- fetchTransformed64<BlendTransformed>, // MonoLsb
- fetchTransformed64<BlendTransformed>, // Indexed8
- fetchTransformed64<BlendTransformed>, // RGB32
- fetchTransformed64<BlendTransformed>, // ARGB32
- fetchTransformed64<BlendTransformed>, // ARGB32_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB16
- fetchTransformed64<BlendTransformed>, // ARGB8565_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB666
- fetchTransformed64<BlendTransformed>, // ARGB6666_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB555
- fetchTransformed64<BlendTransformed>, // ARGB8555_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB888
- fetchTransformed64<BlendTransformed>, // RGB444
- fetchTransformed64<BlendTransformed>, // ARGB4444_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGBX8888
- fetchTransformed64<BlendTransformed>, // RGBA8888
- fetchTransformed64<BlendTransformed>, // RGBA8888_Premultiplied
- fetchTransformed64<BlendTransformed>, // BGR30
- fetchTransformed64<BlendTransformed>, // A2BGR30_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB30
- fetchTransformed64<BlendTransformed>, // A2RGB30_Premultiplied
- fetchTransformed64<BlendTransformed>, // Alpah8
- fetchTransformed64<BlendTransformed>, // Grayscale8
- },
- {
- 0, // TransformedTiled
- fetchTransformed64<BlendTransformedTiled>, // Mono
- fetchTransformed64<BlendTransformedTiled>, // MonoLsb
- fetchTransformed64<BlendTransformedTiled>, // Indexed8
- fetchTransformed64<BlendTransformedTiled>, // RGB32
- fetchTransformed64<BlendTransformedTiled>, // ARGB32
- fetchTransformed64<BlendTransformedTiled>, // ARGB32_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB16
- fetchTransformed64<BlendTransformedTiled>, // ARGB8565_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB666
- fetchTransformed64<BlendTransformedTiled>, // ARGB6666_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB555
- fetchTransformed64<BlendTransformedTiled>, // ARGB8555_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB888
- fetchTransformed64<BlendTransformedTiled>, // RGB444
- fetchTransformed64<BlendTransformedTiled>, // ARGB4444_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGBX8888
- fetchTransformed64<BlendTransformedTiled>, // RGBA8888
- fetchTransformed64<BlendTransformedTiled>, // RGBA8888_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // BGR30
- fetchTransformed64<BlendTransformedTiled>, // A2BGR30_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB30
- fetchTransformed64<BlendTransformedTiled>, // A2RGB30_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // Alpha8
- fetchTransformed64<BlendTransformedTiled>, // Grayscale8
- },
- {
- 0, // Bilinear
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Mono
- fetchTransformedBilinear64<BlendTransformedBilinear>, // MonoLsb
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Indexed8
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB32
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB32
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB32_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB16
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB8565_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB666
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB6666_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB555
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB8555_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB888
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB444
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB4444_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBX8888
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBA8888
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBA8888_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // BGR30
- fetchTransformedBilinear64<BlendTransformedBilinear>, // A2BGR30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB30
- fetchTransformedBilinear64<BlendTransformedBilinear>, // A2RGB30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Alpha8
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Grayscale8
- },
- {
- 0, // BilinearTiled
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Mono
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // MonoLsb
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Indexed8
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB32
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB32
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB16
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB8565_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB666
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB6666_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB555
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB8555_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB888
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB444
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB4444_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBX8888
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBA8888
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBA8888_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // BGR30
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB30
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Alpha8
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Grayscale8
- },
+static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = {
+ fetchUntransformed, // Untransformed
+ fetchUntransformed, // Tiled
+ fetchTransformed<BlendTransformed, QPixelLayout::BPPNone>, // Transformed
+ fetchTransformed<BlendTransformedTiled, QPixelLayout::BPPNone>, // TransformedTiled
+ fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPPNone>, // TransformedBilinear
+ fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPPNone> // TransformedBilinearTiled
};
+static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = {
+ fetchUntransformedARGB32PM, // Untransformed
+ fetchUntransformedARGB32PM, // Tiled
+ fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
+ fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
+ fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // Bilinear
+ fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled> // BilinearTiled
+};
+
+static SourceFetchProc sourceFetchAny32[NBlendTypes] = {
+ fetchUntransformed, // Untransformed
+ fetchUntransformed, // Tiled
+ fetchTransformed<BlendTransformed, QPixelLayout::BPP32>, // Transformed
+ fetchTransformed<BlendTransformedTiled, QPixelLayout::BPP32>, // TransformedTiled
+ fetchTransformedBilinear<BlendTransformedBilinear, QPixelLayout::BPP32>, // TransformedBilinear
+ fetchTransformedBilinear<BlendTransformedBilinearTiled, QPixelLayout::BPP32> // TransformedBilinearTiled
+};
+
+static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = {
+ fetchUntransformed64, // Untransformed
+ fetchUntransformed64, // Tiled
+ fetchTransformed64<BlendTransformed>, // Transformed
+ fetchTransformed64<BlendTransformedTiled>, // TransformedTiled
+ fetchTransformedBilinear64<BlendTransformedBilinear>, // Bilinear
+ fetchTransformedBilinear64<BlendTransformedBilinearTiled> // BilinearTiled
+};
+
+static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage::Format format)
+{
+ if (format == QImage::Format_RGB32 || format == QImage::Format_ARGB32_Premultiplied)
+ return sourceFetchARGB32PM[blendType];
+ if (blendType == BlendUntransformed || blendType == BlendTiled)
+ return sourceFetchUntransformed[format];
+ if (qPixelLayouts[format].bpp == QPixelLayout::BPP32)
+ return sourceFetchAny32[blendType];
+ return sourceFetchGeneric[blendType];
+}
+
+
#define FIXPT_BITS 8
#define FIXPT_SIZE (1<<FIXPT_BITS)
@@ -3772,8 +3580,8 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
break;
case QSpanData::Texture:
solidSource = !data->texture.hasAlpha;
- op.srcFetch = sourceFetch[getBlendType(data)][data->texture.format];
- op.srcFetch64 = sourceFetch64[getBlendType(data)][data->texture.format];
+ op.srcFetch = getSourceFetch(getBlendType(data), data->texture.format);
+ op.srcFetch64 = sourceFetchGeneric64[getBlendType(data)];
break;
default:
Q_UNREACHABLE();
@@ -4038,7 +3846,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)
@@ -4057,7 +3865,7 @@ struct QBlendBase
class BlendSrcGeneric : public QBlendBase<uint>
{
public:
- BlendSrcGeneric(QSpanData *d, Operator o)
+ BlendSrcGeneric(QSpanData *d, const Operator &o)
: QBlendBase<uint>(d, o)
{
}
@@ -4083,7 +3891,7 @@ public:
class BlendSrcGenericRGB64 : public QBlendBase<QRgba64>
{
public:
- BlendSrcGenericRGB64(QSpanData *d, Operator o)
+ BlendSrcGenericRGB64(QSpanData *d, const Operator &o)
: QBlendBase<QRgba64>(d, o)
{
}
@@ -5316,181 +5124,67 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *
/* Image formats here are target formats */
-static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats] = {
- // Untransformed
- {
- 0, // Invalid
- blend_untransformed_generic, // Mono
- blend_untransformed_generic, // MonoLsb
- blend_untransformed_generic, // Indexed8
- blend_untransformed_generic, // RGB32
- blend_untransformed_generic, // ARGB32
- blend_untransformed_argb, // ARGB32_Premultiplied
- blend_untransformed_rgb565,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic,
- blend_untransformed_generic,
- },
- // Tiled
- {
- 0, // Invalid
- blend_tiled_generic, // Mono
- blend_tiled_generic, // MonoLsb
- blend_tiled_generic, // Indexed8
- blend_tiled_generic, // RGB32
- blend_tiled_generic, // ARGB32
- blend_tiled_argb, // ARGB32_Premultiplied
- blend_tiled_rgb565,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic_rgb64,
- blend_tiled_generic_rgb64,
- blend_tiled_generic_rgb64,
- blend_tiled_generic_rgb64,
- blend_tiled_generic,
- blend_tiled_generic,
- },
- // Transformed
- {
- 0, // Invalid
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_transformed_argb, // ARGB32_Premultiplied
- blend_transformed_rgb565,
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic,
- blend_src_generic,
- },
- // TransformedTiled
- {
- 0,
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_transformed_tiled_argb, // ARGB32_Premultiplied
- blend_transformed_tiled_rgb565,
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic,
- blend_src_generic,
- },
- // Bilinear
- {
- 0,
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_src_generic, // ARGB32_Premultiplied
- blend_transformed_bilinear_rgb565,
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic,
- blend_src_generic,
- },
- // BilinearTiled
- {
- 0,
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_src_generic, // ARGB32_Premultiplied
- blend_src_generic, // RGB16
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64, // BGR30
- blend_src_generic_rgb64, // A2BGR30_Premultiplied
- blend_src_generic_rgb64, // RGB30
- blend_src_generic_rgb64, // A2RGB30_Premultiplied
- blend_src_generic, // Alpha8
- blend_src_generic, // Grayscale8
- }
+static const ProcessSpans processTextureSpansARGB32PM[NBlendTypes] = {
+ blend_untransformed_argb, // Untransformed
+ blend_tiled_argb, // Tiled
+ blend_transformed_argb, // Transformed
+ blend_transformed_tiled_argb, // TransformedTiled
+ blend_src_generic, // TransformedBilinear
+ blend_src_generic // TransformedBilinearTiled
+};
+
+static const ProcessSpans processTextureSpansRGB16[NBlendTypes] = {
+ blend_untransformed_rgb565, // Untransformed
+ blend_tiled_rgb565, // Tiled
+ blend_transformed_rgb565, // Transformed
+ blend_transformed_tiled_rgb565, // TransformedTiled
+ blend_transformed_bilinear_rgb565, // TransformedBilinear
+ blend_src_generic // TransformedBilinearTiled
+};
+
+static const ProcessSpans processTextureSpansGeneric[NBlendTypes] = {
+ blend_untransformed_generic, // Untransformed
+ blend_tiled_generic, // Tiled
+ blend_src_generic, // Transformed
+ blend_src_generic, // TransformedTiled
+ blend_src_generic, // TransformedBilinear
+ blend_src_generic // TransformedBilinearTiled
+};
+
+static const ProcessSpans processTextureSpansGeneric64[NBlendTypes] = {
+ blend_untransformed_generic_rgb64, // Untransformed
+ blend_tiled_generic_rgb64, // Tiled
+ blend_src_generic_rgb64, // Transformed
+ blend_src_generic_rgb64, // TransformedTiled
+ blend_src_generic_rgb64, // TransformedBilinear
+ blend_src_generic_rgb64 // TransformedBilinearTiled
};
void qBlendTexture(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- ProcessSpans proc = processTextureSpans[getBlendType(data)][data->rasterBuffer->format];
+ TextureBlendType blendType = getBlendType(data);
+ ProcessSpans proc;
+ switch (data->rasterBuffer->format) {
+ case QImage::Format_ARGB32_Premultiplied:
+ proc = processTextureSpansARGB32PM[blendType];
+ break;
+ case QImage::Format_RGB16:
+ proc = processTextureSpansRGB16[blendType];
+ break;
+ case QImage::Format_BGR30:
+ case QImage::Format_A2BGR30_Premultiplied:
+ case QImage::Format_RGB30:
+ case QImage::Format_A2RGB30_Premultiplied:
+ proc = processTextureSpansGeneric64[blendType];
+ break;
+ case QImage::Format_Invalid:
+ Q_UNREACHABLE();
+ return;
+ default:
+ proc = processTextureSpansGeneric[blendType];
+ break;
+ }
proc(count, spans, userData);
}
@@ -5766,7 +5460,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)
@@ -5803,7 +5497,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;
@@ -5830,7 +5524,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);
@@ -5871,7 +5565,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);
@@ -6329,7 +6023,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();
@@ -6382,6 +6076,15 @@ static void qInitDrawhelperFunctions()
qt_fetch_radial_gradient = qt_fetch_radial_gradient_sse2;
+ extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Source_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Plus_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_sse2;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_sse2;
+ qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
+ qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
+
#ifdef QT_COMPILER_SUPPORTS_SSSE3
if (qCpuHasFeature(SSSE3)) {
extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
@@ -6397,22 +6100,26 @@ static void qInitDrawhelperFunctions()
qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
qStorePixels[QPixelLayout::BPP24] = storePixelsBPP24_ssse3;
- sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3;
- sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3;
+ sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3;
}
#endif // SSSE3
#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;
@@ -6421,22 +6128,39 @@ static void qInitDrawhelperFunctions()
}
#endif
-#if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__)
+#if defined(QT_COMPILER_SUPPORTS_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 *);
+#if !defined(__AVX2__)
+ 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;
+#endif
+ extern void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h, int const_alpha);
+ extern void qt_blend_argb32_on_argb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h, int const_alpha);
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+ qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+ qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+
+ extern void QT_FASTCALL comp_func_SourceOver_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, uint color, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Source_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_avx2;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_avx2;
+ qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_avx2;
}
#endif
- extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
- extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
- extern void QT_FASTCALL comp_func_Source_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
- extern void QT_FASTCALL comp_func_Plus_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
- qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_sse2;
- qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_sse2;
- qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
- qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
#endif // SSE2
@@ -6461,8 +6185,7 @@ static void qInitDrawhelperFunctions()
qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon;
- sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
- sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
+ sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
#if defined(ENABLE_PIXMAN_DRAWHELPERS)
// The RGB16 helpers are using Arm32 assemblythat has not been ported to AArch64
@@ -6523,14 +6246,9 @@ static void qInitDrawhelperFunctions()
destStoreProc[QImage::Format_ARGB32] = qt_destStoreARGB32_mips_dsp;
- sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
- sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
-
- sourceFetch[BlendUntransformed][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
- sourceFetch[BlendTiled][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
-
- sourceFetch[BlendUntransformed][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
- sourceFetch[BlendTiled][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2;
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index e11536ebd0..01ffd54918 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -37,24 +37,327 @@
**
****************************************************************************/
-#include <private/qdrawhelper_p.h>
+#include "qdrawhelper_p.h"
+#include "qdrawingprimitive_sse2_p.h"
#if defined(QT_COMPILER_SUPPORTS_AVX2)
QT_BEGIN_NAMESPACE
+// Autovectorized premultiply functions:
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);
}
+// Vectorized blend functions:
+
+// See BYTE_MUL_SSE2 for details.
+inline static void BYTE_MUL_AVX2(__m256i &pixelVector, const __m256i &alphaChannel, const __m256i &colorMask, const __m256i &half)
+{
+ __m256i pixelVectorAG = _mm256_srli_epi16(pixelVector, 8);
+ __m256i pixelVectorRB = _mm256_and_si256(pixelVector, colorMask);
+
+ pixelVectorAG = _mm256_mullo_epi16(pixelVectorAG, alphaChannel);
+ pixelVectorRB = _mm256_mullo_epi16(pixelVectorRB, alphaChannel);
+
+ pixelVectorRB = _mm256_add_epi16(pixelVectorRB, _mm256_srli_epi16(pixelVectorRB, 8));
+ pixelVectorAG = _mm256_add_epi16(pixelVectorAG, _mm256_srli_epi16(pixelVectorAG, 8));
+ pixelVectorRB = _mm256_add_epi16(pixelVectorRB, half);
+ pixelVectorAG = _mm256_add_epi16(pixelVectorAG, half);
+
+ pixelVectorRB = _mm256_srli_epi16(pixelVectorRB, 8);
+ pixelVectorAG = _mm256_andnot_si256(colorMask, pixelVectorAG);
+
+ pixelVector = _mm256_or_si256(pixelVectorAG, pixelVectorRB);
+}
+
+// See INTERPOLATE_PIXEL_255_SSE2 for details.
+inline static void INTERPOLATE_PIXEL_255_AVX2(const __m256i &srcVector, __m256i &dstVector, const __m256i &alphaChannel, const __m256i &oneMinusAlphaChannel, const __m256i &colorMask, const __m256i &half)
+{
+ const __m256i srcVectorAG = _mm256_srli_epi16(srcVector, 8);
+ const __m256i dstVectorAG = _mm256_srli_epi16(dstVector, 8);
+ const __m256i srcVectorRB = _mm256_and_si256(srcVector, colorMask);
+ const __m256i dstVectorRB = _mm256_and_si256(dstVector, colorMask);
+ const __m256i srcVectorAGalpha = _mm256_mullo_epi16(srcVectorAG, alphaChannel);
+ const __m256i srcVectorRBalpha = _mm256_mullo_epi16(srcVectorRB, alphaChannel);
+ const __m256i dstVectorAGoneMinusAlpha = _mm256_mullo_epi16(dstVectorAG, oneMinusAlphaChannel);
+ const __m256i dstVectorRBoneMinusAlpha = _mm256_mullo_epi16(dstVectorRB, oneMinusAlphaChannel);
+ __m256i finalAG = _mm256_add_epi16(srcVectorAGalpha, dstVectorAGoneMinusAlpha);
+ __m256i finalRB = _mm256_add_epi16(srcVectorRBalpha, dstVectorRBoneMinusAlpha);
+ finalAG = _mm256_add_epi16(finalAG, _mm256_srli_epi16(finalAG, 8));
+ finalRB = _mm256_add_epi16(finalRB, _mm256_srli_epi16(finalRB, 8));
+ finalAG = _mm256_add_epi16(finalAG, half);
+ finalRB = _mm256_add_epi16(finalRB, half);
+ finalAG = _mm256_andnot_si256(colorMask, finalAG);
+ finalRB = _mm256_srli_epi16(finalRB, 8);
+
+ dstVector = _mm256_or_si256(finalAG, finalRB);
+}
+
+// See BLEND_SOURCE_OVER_ARGB32_SSE2 for details.
+inline static void BLEND_SOURCE_OVER_ARGB32_AVX2(quint32 *dst, const quint32 *src, const int length)
+{
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i one = _mm256_set1_epi16(0xff);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i alphaMask = _mm256_set1_epi32(0xff000000);
+ const __m256i offsetMask = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
+ const __m256i alphaShuffleMask = _mm256_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3,
+ char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);
+
+ const int minusOffsetToAlignDstOn32Bytes = (reinterpret_cast<quintptr>(dst) >> 2) & 0x7;
+
+ int x = 0;
+ // Prologue to handle all pixels until dst is 32-byte aligned in one step.
+ if (minusOffsetToAlignDstOn32Bytes != 0 && x < (length - 7)) {
+ const __m256i prologueMask = _mm256_sub_epi32(_mm256_set1_epi32(minusOffsetToAlignDstOn32Bytes - 1), offsetMask);
+ const __m256i srcVector = _mm256_maskload_epi32((const int *)&src[x - minusOffsetToAlignDstOn32Bytes], prologueMask);
+ const __m256i prologueAlphaMask = _mm256_blendv_epi8(_mm256_setzero_si256(), alphaMask, prologueMask);
+ if (!_mm256_testz_si256(srcVector, prologueAlphaMask)) {
+ if (_mm256_testc_si256(srcVector, prologueAlphaMask)) {
+ _mm256_maskstore_epi32((int *)&dst[x - minusOffsetToAlignDstOn32Bytes], prologueMask, srcVector);
+ } else {
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_maskload_epi32((int *)&dst[x - minusOffsetToAlignDstOn32Bytes], prologueMask);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_maskstore_epi32((int *)&dst[x - minusOffsetToAlignDstOn32Bytes], prologueMask, dstVector);
+ }
+ }
+ x += (8 - minusOffsetToAlignDstOn32Bytes);
+ }
+
+ for (; x < (length - 7); x += 8) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testz_si256(srcVector, alphaMask)) {
+ if (_mm256_testc_si256(srcVector, alphaMask)) {
+ _mm256_store_si256((__m256i *)&dst[x], srcVector);
+ } else {
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+ }
+
+ // Epilogue to handle all remaining pixels in one step.
+ if (x < length) {
+ const __m256i epilogueMask = _mm256_add_epi32(offsetMask, _mm256_set1_epi32(x - length));
+ const __m256i srcVector = _mm256_maskload_epi32((const int *)&src[x], epilogueMask);
+ const __m256i epilogueAlphaMask = _mm256_blendv_epi8(_mm256_setzero_si256(), alphaMask, epilogueMask);
+ if (!_mm256_testz_si256(srcVector, epilogueAlphaMask)) {
+ if (_mm256_testc_si256(srcVector, epilogueAlphaMask)) {
+ _mm256_maskstore_epi32((int *)&dst[x], epilogueMask, srcVector);
+ } else {
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_maskload_epi32((int *)&dst[x], epilogueMask);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_maskstore_epi32((int *)&dst[x], epilogueMask, dstVector);
+ }
+ }
+ }
+}
+
+
+// See BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2 for details.
+inline static void BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(quint32 *dst, const quint32 *src, const int length, const int const_alpha)
+{
+ int x = 0;
+
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, length)
+ blend_pixel(dst[x], src[x], const_alpha);
+
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i one = _mm256_set1_epi16(0xff);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i alphaMask = _mm256_set1_epi32(0xff000000);
+ const __m256i alphaShuffleMask = _mm256_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3,
+ char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);
+ const __m256i constAlphaVector = _mm256_set1_epi16(const_alpha);
+ for (; x < (length - 7); x += 8) {
+ __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testz_si256(srcVector, alphaMask)) {
+ BYTE_MUL_AVX2(srcVector, constAlphaVector, colorMask, half);
+
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+ for (; x < length; ++x)
+ blend_pixel(dst[x], src[x], const_alpha);
+}
+
+void qt_blend_argb32_on_argb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ BLEND_SOURCE_OVER_ARGB32_AVX2(dst, src, w);
+ destPixels += dbpl;
+ srcPixels += sbpl;
+ }
+ } else if (const_alpha != 0) {
+ const_alpha = (const_alpha * 255) >> 8;
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(dst, src, w, const_alpha);
+ destPixels += dbpl;
+ srcPixels += sbpl;
+ }
+ }
+}
+
+void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ ::memcpy(dst, src, w * sizeof(uint));
+ srcPixels += sbpl;
+ destPixels += dbpl;
+ }
+ return;
+ }
+ if (const_alpha == 0)
+ return;
+
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+
+ const_alpha = (const_alpha * 255) >> 8;
+ int one_minus_const_alpha = 255 - const_alpha;
+ const __m256i constAlphaVector = _mm256_set1_epi16(const_alpha);
+ const __m256i oneMinusConstAlpha = _mm256_set1_epi16(one_minus_const_alpha);
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ int x = 0;
+
+ // First, align dest to 32 bytes:
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, w)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
+
+ // 2) interpolate pixels with AVX2
+ for (; x < (w - 7); x += 8) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testc_si256(srcVector, _mm256_setzero_si256())) {
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ INTERPOLATE_PIXEL_255_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+
+ // 3) Epilogue
+ for (; x < w; ++x)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
+
+ srcPixels += sbpl;
+ destPixels += dbpl;
+ }
+}
+
+void QT_FASTCALL comp_func_SourceOver_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256);
+
+ const quint32 *src = (const quint32 *) srcPixels;
+ quint32 *dst = (quint32 *) destPixels;
+
+ if (const_alpha == 255)
+ BLEND_SOURCE_OVER_ARGB32_AVX2(dst, src, length);
+ else
+ BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(dst, src, length, const_alpha);
+}
+
+void QT_FASTCALL comp_func_Source_avx2(uint *dst, const uint *src, int length, uint const_alpha)
+{
+ if (const_alpha == 255) {
+ ::memcpy(dst, src, length * sizeof(uint));
+ } else {
+ const int ialpha = 255 - const_alpha;
+
+ int x = 0;
+
+ // 1) prologue, align on 32 bytes
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, length)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
+
+ // 2) interpolate pixels with AVX2
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i constAlphaVector = _mm256_set1_epi16(const_alpha);
+ const __m256i oneMinusConstAlpha = _mm256_set1_epi16(ialpha);
+ for (; x < length - 7; x += 8) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ INTERPOLATE_PIXEL_255_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+
+ // 3) Epilogue
+ for (; x < length; ++x)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
+ }
+}
+
+void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, uint color, uint const_alpha)
+{
+ if ((const_alpha & qAlpha(color)) == 255) {
+ qt_memfill32(destPixels, color, length);
+ } else {
+ if (const_alpha != 255)
+ color = BYTE_MUL(color, const_alpha);
+
+ const quint32 minusAlphaOfColor = qAlpha(~color);
+ int x = 0;
+
+ quint32 *dst = (quint32 *) destPixels;
+ const __m256i colorVector = _mm256_set1_epi32(color);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i minusAlphaOfColorVector = _mm256_set1_epi16(minusAlphaOfColor);
+
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, length)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
+
+ for (; x < length - 7; x += 8) {
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_AVX2(dstVector, minusAlphaOfColorVector, colorMask, half);
+ dstVector = _mm256_add_epi8(colorVector, dstVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ for (; x < length; ++x)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
+ }
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index fa3e6396ec..45a3174734 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qmath.h"
#include "QtGui/qcolor.h"
#include "QtGui/qpainter.h"
@@ -636,6 +636,22 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
}
#endif
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src)
+{
+ if (src >= 0xff000000)
+ dst = src;
+ else if (src != 0)
+ dst = src + BYTE_MUL(dst, qAlpha(~src));
+}
+
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
+{
+ if (src != 0) {
+ const quint32 s = BYTE_MUL(src, const_alpha);
+ dst = s + BYTE_MUL(dst, qAlpha(~s));
+ }
+}
+
#if defined(__SSE2__)
static Q_ALWAYS_INLINE uint interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty)
{
@@ -1172,11 +1188,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/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index 7cd3e9ca1b..2026a4e656 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -45,15 +45,6 @@
QT_BEGIN_NAMESPACE
-inline static void blend_pixel(quint32 &dst, const quint32 src)
-{
- if (src >= 0xff000000)
- dst = src;
- else if (src != 0)
- dst = src + BYTE_MUL(dst, qAlpha(~src));
-}
-
-
/* The instruction palignr uses direct arguments, so we have to generate the code fo the different
shift (4, 8, 12). Checking the alignment inside the loop is unfortunatelly way too slow.
*/
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index 37be8b89a9..cefc213999 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qdrawhelper_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index e16529e2d0..7affc63b32 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -40,6 +40,7 @@
#ifndef QDRAWINGPRIMITIVE_SSE2_P_H
#define QDRAWINGPRIMITIVE_SSE2_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qsimd_p.h>
#include "qdrawhelper_p.h"
@@ -170,11 +171,7 @@ QT_BEGIN_NAMESPACE
\
/* First, get dst aligned. */ \
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
- uint s = src[x]; \
- if (s >= 0xff000000) \
- dst[x] = s; \
- else if (s != 0) \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ blend_pixel(dst[x], src[x]); \
} \
\
for (; x < length-3; x += 4) { \
@@ -182,11 +179,7 @@ QT_BEGIN_NAMESPACE
BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask) \
} \
for (; x < length; ++x) { \
- uint s = src[x]; \
- if (s >= 0xff000000) \
- dst[x] = s; \
- else if (s != 0) \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ blend_pixel(dst[x], src[x]); \
} \
}
@@ -206,11 +199,7 @@ QT_BEGIN_NAMESPACE
int x = 0; \
\
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
- quint32 s = src[x]; \
- if (s != 0) { \
- s = BYTE_MUL(s, const_alpha); \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
- } \
+ blend_pixel(dst[x], src[x], const_alpha); \
} \
\
for (; x < length-3; x += 4) { \
@@ -231,11 +220,7 @@ QT_BEGIN_NAMESPACE
} \
} \
for (; x < length; ++x) { \
- quint32 s = src[x]; \
- if (s != 0) { \
- s = BYTE_MUL(s, const_alpha); \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
- } \
+ blend_pixel(dst[x], src[x], const_alpha); \
} \
}
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index f3cf88af17..457cc06d63 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qpaintengineex_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index d2b6e51ab1..846592881c 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qdebug.h"
#include "QtCore/qpoint.h"
#include "QtCore/qsize.h"
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index b28c8433cd..76bf61671c 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -40,6 +40,7 @@
#ifndef QMATRIX_H
#define QMATRIX_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpolygon.h>
#include <QtGui/qregion.h>
#include <QtGui/qwindowdefs.h>
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index 64cfb22517..62613d301a 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qdrawhelper_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 47413d920c..71999fbdee 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qrect.h>
#include <QtGui/qtransform.h>
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index 3aebbb7551..c516f6a963 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -40,6 +40,7 @@
#ifndef QPAGEDPAINTDEVICE_H
#define QPAGEDPAINTDEVICE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpagelayout.h>
diff --git a/src/gui/painting/qpagedpaintdevice_p.h b/src/gui/painting/qpagedpaintdevice_p.h
index 028ab3b5af..a993ea4cac 100644
--- a/src/gui/painting/qpagedpaintdevice_p.h
+++ b/src/gui/painting/qpagedpaintdevice_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpagedpaintdevice.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h
index bd29165777..b41689d33b 100644
--- a/src/gui/painting/qpagelayout.h
+++ b/src/gui/painting/qpagelayout.h
@@ -40,6 +40,7 @@
#ifndef QPAGELAYOUT_H
#define QPAGELAYOUT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qstring.h>
#include <QtCore/qmargins.h>
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index f53285d9cb..8831d60d48 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -400,7 +400,7 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match
{
if (ppdKey.isEmpty())
return QPageSize::Custom;
- QString key = ppdKey;
+ QStringRef key(&ppdKey);
// Remove any Rotated or Tranverse modifiers
if (key.endsWith(QLatin1String("Rotated")))
key.chop(7);
diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h
index 4916ddd4b5..82054824b4 100644
--- a/src/gui/painting/qpagesize.h
+++ b/src/gui/painting/qpagesize.h
@@ -40,6 +40,7 @@
#ifndef QPAGESIZE_H
#define QPAGESIZE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsharedpointer.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 5c9b966029..9458b4ba9a 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -40,6 +40,7 @@
#ifndef QPAINTDEVICE_H
#define QPAINTDEVICE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index a9da37b354..9fb67e253e 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -40,6 +40,7 @@
#ifndef QPAINTENGINE_H
#define QPAINTENGINE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qscopedpointer.h>
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/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index 3feabcf6fc..40f5347b26 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qpaintengine_raster_p.h"
#ifndef QT_NO_BLITTABLE
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index c14f085721..9d511f9bad 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainter.h"
#include "QtGui/qpaintengine.h"
#include "QtGui/qregion.h"
@@ -117,6 +118,11 @@ public:
virtual void systemStateChanged() { }
void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti);
+
+ static QPaintEnginePrivate *get(QPaintEngine *paintEngine) { return paintEngine->d_func(); }
+
+ virtual QPaintEngine *aggregateEngine() { return 0; }
+ virtual Qt::HANDLE nativeHandle() { return 0; }
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 1afb119535..8cde88fa82 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qpaintengineex_p.h"
#include "QtGui/qpainterpath.h"
#include "private/qdatabuffer_p.h"
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 643c39c80f..7c2c98140f 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpaintengine.h>
#include <private/qpaintengine_p.h>
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/qpainter.h b/src/gui/painting/qpainter.h
index 5743d97405..46817b9c73 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -40,6 +40,7 @@
#ifndef QPAINTER_H
#define QPAINTER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qrect.h>
#include <QtCore/qpoint.h>
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 23ab5db7b4..2d44577310 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qbrush.h"
#include "QtGui/qfont.h"
#include "QtGui/qpen.h"
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/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 882918fc87..131fcde8cc 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -40,6 +40,7 @@
#ifndef QPAINTERPATH_H
#define QPAINTERPATH_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qmatrix.h>
#include <QtCore/qglobal.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index e90cdb0f43..92d9a4ea66 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainterpath.h"
#include "QtGui/qregion.h"
#include "QtCore/qlist.h"
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 4f2b59c775..f92a681eca 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1760,7 +1760,7 @@ static bool bool_op(bool a, bool b, QPathClipper::Operation op)
switch (op) {
case QPathClipper::BoolAnd:
return a && b;
- case QPathClipper::BoolOr: // fall-through
+ case QPathClipper::BoolOr:
case QPathClipper::Simplify:
return a || b;
case QPathClipper::BoolSub:
@@ -1956,7 +1956,7 @@ QPointF intersectLine(const QPointF &a, const QPointF &b, qreal t)
{
QLineF line(a, b);
switch (edge) {
- case Left: // fall-through
+ case Left:
case Right:
return line.pointAt((t - a.x()) / (b.x() - a.x()));
default:
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index fe3ce84e4a..64e684e1ad 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpainterpath.h>
#include <QtCore/qlist.h>
diff --git a/src/gui/painting/qpathsimplifier_p.h b/src/gui/painting/qpathsimplifier_p.h
index 47b1c3c623..6ef298f6bf 100644
--- a/src/gui/painting/qpathsimplifier_p.h
+++ b/src/gui/painting/qpathsimplifier_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/private/qdatabuffer_p.h>
#include <QtGui/private/qvectorpath_p.h>
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index d568dca6b9..d246c96da6 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) {
@@ -2092,7 +2091,7 @@ int QPdfEnginePrivate::generateLinearGradientShader(const QLinearGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
// calculate required bounds
QRectF pageRect = m_pageLayout.fullRectPixels(resolution);
@@ -2155,7 +2154,7 @@ int QPdfEnginePrivate::generateRadialGradientShader(const QRadialGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
Q_ASSERT(qFuzzyIsNull(r0)); // QPainter emulates if this is not 0
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index ef41f1efc1..cb1a91e09f 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_PDF
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index cf1da95bf1..baad274818 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -40,7 +40,7 @@
#ifndef QPDFWRITER_H
#define QPDFWRITER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_PDF
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index 7469931a48..d8d99ba800 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -40,6 +40,7 @@
#ifndef QPEN_H
#define QPEN_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 35cf1dae86..b8bbdefa37 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -49,7 +49,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions>
#ifndef QT_NO_OPENGL
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/qopengltextureblitter.h>
#endif
#include <qpa/qplatformgraphicsbuffer.h>
#include <qpa/qplatformgraphicsbufferhelper.h>
@@ -77,6 +77,7 @@ class QPlatformBackingStorePrivate
public:
QPlatformBackingStorePrivate(QWindow *w)
: window(w)
+ , backingStore(0)
#ifndef QT_NO_OPENGL
, textureId(0)
, blitter(0)
@@ -100,6 +101,7 @@ public:
#endif
}
QWindow *window;
+ QBackingStore *backingStore;
#ifndef QT_NO_OPENGL
mutable GLuint textureId;
mutable QSize textureSize;
@@ -251,9 +253,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;
@@ -390,7 +391,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
if (textureId) {
if (d_ptr->needsSwizzle)
- d_ptr->blitter->setSwizzleRB(true);
+ d_ptr->blitter->setRedBlueSwizzle(true);
// The backingstore is for the entire tlw.
// In case of native children offset tells the position relative to the tlw.
const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset), d_ptr->textureSize.height());
@@ -399,7 +400,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
origin);
d_ptr->blitter->blit(textureId, QMatrix4x4(), source);
if (d_ptr->needsSwizzle)
- d_ptr->blitter->setSwizzleRB(false);
+ d_ptr->blitter->setRedBlueSwizzle(false);
}
// Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
@@ -413,7 +414,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 +427,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
@@ -472,14 +473,14 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
switch (image.format()) {
case QImage::Format_ARGB32_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
*flags |= TextureSwizzle;
break;
case QImage::Format_RGBA8888_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
@@ -624,6 +625,23 @@ QWindow* QPlatformBackingStore::window() const
}
/*!
+ Sets the backing store associated with this surface.
+*/
+void QPlatformBackingStore::setBackingStore(QBackingStore *backingStore)
+{
+ d_ptr->backingStore = backingStore;
+}
+
+/*!
+ Returns a pointer to the backing store associated with this
+ surface.
+*/
+QBackingStore *QPlatformBackingStore::backingStore() const
+{
+ return d_ptr->backingStore;
+}
+
+/*!
This function is called before painting onto the surface begins,
with the \a region in which the painting will occur.
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 9b09620cce..ec56aaa002 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qrect.h>
#include <QtCore/qobject.h>
@@ -111,6 +112,7 @@ public:
virtual ~QPlatformBackingStore();
QWindow *window() const;
+ QBackingStore *backingStore() const;
virtual QPaintDevice *paintDevice() = 0;
@@ -121,7 +123,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,
@@ -142,6 +146,9 @@ public:
private:
QPlatformBackingStorePrivate *d_ptr;
+
+ void setBackingStore(QBackingStore *);
+ friend class QBackingStore;
};
#ifndef QT_NO_OPENGL
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index d2203595c8..126b752811 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -443,14 +443,15 @@ void QPolygon::putPoints(int index, int nPoints, const QPolygon & from, int from
QRect QPolygon::boundingRect() const
{
- if (isEmpty())
- return QRect(0, 0, 0, 0);
const QPoint *pd = constData();
+ const QPoint *pe = pd + size();
+ if (pd == pe)
+ return QRect(0, 0, 0, 0);
int minx, maxx, miny, maxy;
minx = maxx = pd->x();
miny = maxy = pd->y();
++pd;
- for (int i = 1; i < size(); ++i) {
+ for (; pd != pe; ++pd) {
if (pd->x() < minx)
minx = pd->x();
else if (pd->x() > maxx)
@@ -459,7 +460,6 @@ QRect QPolygon::boundingRect() const
miny = pd->y();
else if (pd->y() > maxy)
maxy = pd->y();
- ++pd;
}
return QRect(QPoint(minx,miny), QPoint(maxx,maxy));
}
@@ -657,14 +657,15 @@ QPolygonF QPolygonF::translated(const QPointF &offset) const
QRectF QPolygonF::boundingRect() const
{
- if (isEmpty())
- return QRectF(0, 0, 0, 0);
const QPointF *pd = constData();
+ const QPointF *pe = pd + size();
+ if (pd == pe)
+ return QRectF(0, 0, 0, 0);
qreal minx, maxx, miny, maxy;
minx = maxx = pd->x();
miny = maxy = pd->y();
++pd;
- for (int i = 1; i < size(); ++i) {
+ while (pd != pe) {
if (pd->x() < minx)
minx = pd->x();
else if (pd->x() > maxx)
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index 23bdd1933f..c57802e84e 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -40,6 +40,7 @@
#ifndef QPOLYGON_H
#define QPOLYGON_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qvector.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/painting/qpolygonclipper_p.h b/src/gui/painting/qpolygonclipper_p.h
index c67a692b52..04a31111c9 100644
--- a/src/gui/painting/qpolygonclipper_p.h
+++ b/src/gui/painting/qpolygonclipper_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qdatabuffer_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h
index a3e12c076d..955577f4a3 100644
--- a/src/gui/painting/qrasterizer_p.h
+++ b/src/gui/painting/qrasterizer_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainter.h"
#include <private/qdrawhelper_p.h>
diff --git a/src/gui/opengl/qrbtree_p.h b/src/gui/painting/qrbtree_p.h
index 4c9dfe1af4..d3ee23a91c 100644
--- a/src/gui/opengl/qrbtree_p.h
+++ b/src/gui/painting/qrbtree_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 7571b5c3e8..0571e1a328 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..4f0a071da8 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -40,6 +40,7 @@
#ifndef QREGION_H
#define QREGION_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qatomic.h>
#include <QtCore/qrect.h>
#include <QtGui/qwindowdefs.h>
@@ -81,6 +82,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 +121,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;
@@ -165,6 +178,7 @@ Q_GUI_EXPORT
static const struct QRegionData shared_empty;
static void cleanUp(QRegionData *x);
};
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QRegion)
/*****************************************************************************
QRegion stream functions
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 6e666025ac..fe8306109b 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -40,7 +40,7 @@
#ifndef QRGB_H
#define QRGB_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qprocessordetection.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h
index 27e1e6e06d..a3ae0c9b14 100644
--- a/src/gui/painting/qrgba64.h
+++ b/src/gui/painting/qrgba64.h
@@ -40,7 +40,7 @@
#ifndef QRGBA64_H
#define QRGBA64_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qprocessordetection.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h
index cf3dad5f90..0dadc038fa 100644
--- a/src/gui/painting/qrgba64_p.h
+++ b/src/gui/painting/qrgba64_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qrgba64.h>
#include <QtGui/private/qdrawhelper_p.h>
#include <private/qsimd_p.h>
@@ -72,27 +73,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 +135,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/qstroker_p.h b/src/gui/painting/qstroker_p.h
index e17e68b237..ededb5d80b 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainterpath.h"
#include "private/qdatabuffer_p.h"
#include "private/qnumeric_p.h"
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index d2c3eceeef..86a53c21a3 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -42,7 +42,6 @@
#include "qtextureglyphcache_p.h"
#include "private/qfontengine_p.h"
#include "private/qnumeric_p.h"
-#include "private/qnativeimage_p.h"
QT_BEGIN_NAMESPACE
@@ -247,6 +246,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 +256,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..25253b496a 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qhash.h>
#include <qimage.h>
#include <qobject.h>
@@ -117,7 +118,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/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 6058811176..2d841b2953 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -446,7 +446,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
break;
case TxProject:
m_33 += dx*m_13 + dy*m_23;
- // Fall through
+ Q_FALLTHROUGH();
case TxShear:
case TxRotate:
affine._dx += dx*affine._m11 + dy*affine._m21;
@@ -508,12 +508,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
case TxProject:
m_13 *= sx;
m_23 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear:
affine._m12 *= sx;
affine._m21 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxScale:
affine._m11 *= sx;
affine._m22 *= sy;
@@ -581,7 +581,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
m_13 += tm13;
m_23 += tm23;
}
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear: {
qreal tm11 = sv*affine._m21;
@@ -663,7 +663,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
@@ -742,7 +742,7 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 470a5565e1..2aea19eca0 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -39,6 +39,7 @@
#ifndef QTRANSFORM_H
#define QTRANSFORM_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qmatrix.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/qpolygon.h>
diff --git a/src/gui/opengl/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index d9a3231165..d9a3231165 100644
--- a/src/gui/opengl/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
diff --git a/src/gui/opengl/qtriangulatingstroker_p.h b/src/gui/painting/qtriangulatingstroker_p.h
index 5c037cb05d..2b0f08972b 100644
--- a/src/gui/opengl/qtriangulatingstroker_p.h
+++ b/src/gui/painting/qtriangulatingstroker_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qdatabuffer_p.h>
#include <qvarlengtharray.h>
#include <private/qvectorpath_p.h>
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp
index 601b51a5fb..6604d407f0 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/painting/qtriangulator.cpp
@@ -50,9 +50,10 @@
#include <QtCore/qglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qalgorithms.h>
-
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglextensions_p.h>
+#ifndef QT_NO_OPENGL
+# include <private/qopenglcontext_p.h>
+# include <private/qopenglextensions_p.h>
+#endif
#include <private/qrbtree_p.h>
QT_BEGIN_NAMESPACE
@@ -873,7 +874,7 @@ void QTriangulator<T>::initialize(const QVectorPath &path, const QTransform &mat
case QPainterPath::MoveToElement:
if (!m_indices.isEmpty())
m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON
- // Fall through.
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
m_indices.push_back(T(m_vertices.size()));
m_vertices.resize(m_vertices.size() + 1);
@@ -2099,7 +2100,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#3)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case StartVertex:
if (m_clockwiseOrder) {
leftEdgeNode = searchEdgeLeftOfEdge(j);
@@ -2128,7 +2129,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#4)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case EndVertex:
if (m_clockwiseOrder) {
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
@@ -2267,10 +2268,14 @@ void QTriangulator<T>::MonotoneToTriangles::decompose()
static bool hasElementIndexUint()
{
+#ifndef QT_NO_OPENGL
QOpenGLContext *context = QOpenGLContext::currentContext();
if (!context)
return false;
return static_cast<QOpenGLExtensions *>(context->functions())->hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint);
+#else
+ return false;
+#endif
}
Q_GUI_EXPORT QTriangleSet qTriangulate(const qreal *polygon,
diff --git a/src/gui/opengl/qtriangulator_p.h b/src/gui/painting/qtriangulator_p.h
index 2ef635ff84..4d1aba099c 100644
--- a/src/gui/opengl/qtriangulator_p.h
+++ b/src/gui/painting/qtriangulator_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qvector.h>
#include <QtGui/private/qvectorpath_p.h>
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 01f7418930..d1b08ed423 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpaintengine.h>
#include <private/qpaintengine_p.h>
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..438ad6e70b 100644
--- a/src/gui/text/qabstracttextdocumentlayout.h
+++ b/src/gui/text/qabstracttextdocumentlayout.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTTEXTDOCUMENTLAYOUT_H
#define QABSTRACTTEXTDOCUMENTLAYOUT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qtextlayout.h>
#include <QtGui/qtextdocument.h>
@@ -82,7 +83,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/qabstracttextdocumentlayout_p.h b/src/gui/text/qabstracttextdocumentlayout_p.h
index fc39d8ec5c..191c463dc6 100644
--- a/src/gui/text/qabstracttextdocumentlayout_p.h
+++ b/src/gui/text/qabstracttextdocumentlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qobject_p.h"
#include "QtCore/qhash.h"
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 966ab3fcdb..cb19a42688 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -403,8 +403,8 @@ ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette
LengthData ValueExtractor::lengthValue(const Value& v)
{
- QString s = v.variant.toString();
- s.reserve(s.length());
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
LengthData data;
data.unit = LengthData::None;
if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive))
@@ -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()) {
@@ -1442,11 +1442,13 @@ bool Declaration::realValue(qreal *real, const char *unit) const
const Value &v = d->values.at(0);
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
qreal val = s.toDouble(&ok);
@@ -1459,11 +1461,13 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
{
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
int val = s.toInt(&ok);
@@ -1867,12 +1871,15 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
do {
match = basicSelectorMatches(sel, node);
if (!match) {
- if (sel.relationToNext == BasicSelector::MatchNextSelectorIfParent
- || i == selector.basicSelectors.count() - 1) // first element must always match!
+ if (i == selector.basicSelectors.count() - 1) // first element must always match!
+ break;
+ if (sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor &&
+ sel.relationToNext != BasicSelector::MatchNextSelectorIfIndirectAdjecent)
break;
}
- if (match || sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor)
+ if (match || (sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor &&
+ sel.relationToNext != BasicSelector::MatchNextSelectorIfIndirectAdjecent))
--i;
if (i < 0)
@@ -1885,16 +1892,18 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
NodePtr nextParent = parentNode(node);
freeNode(node);
node = nextParent;
- } else if (sel.relationToNext == BasicSelector::MatchNextSelectorIfPreceeds) {
+ } else if (sel.relationToNext == BasicSelector::MatchNextSelectorIfDirectAdjecent
+ || sel.relationToNext == BasicSelector::MatchNextSelectorIfIndirectAdjecent) {
NodePtr previousSibling = previousSiblingNode(node);
freeNode(node);
node = previousSibling;
- }
+ }
if (isNullNode(node)) {
match = false;
break;
}
- } while (i >= 0 && (match || sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor));
+ } while (i >= 0 && (match || sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor
+ || sel.relationToNext == BasicSelector::MatchNextSelectorIfIndirectAdjecent));
freeNode(node);
@@ -1914,18 +1923,38 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node)
if (attrValue.isNull())
return false;
- if (a.valueMatchCriterium == QCss::AttributeSelector::MatchContains) {
+ switch (a.valueMatchCriterium) {
+ case QCss::AttributeSelector::NoMatch:
+ break;
+ case QCss::AttributeSelector::MatchEqual:
+ if (attrValue != a.value)
+ return false;
+ break;
+ case QCss::AttributeSelector::MatchIncludes: {
const auto lst = attrValue.splitRef(QLatin1Char(' '));
if (!lst.contains(QStringRef(&a.value)))
return false;
- } else if (
- (a.valueMatchCriterium == QCss::AttributeSelector::MatchEqual
- && attrValue != a.value)
- ||
- (a.valueMatchCriterium == QCss::AttributeSelector::MatchBeginsWith
- && !attrValue.startsWith(a.value))
- )
- return false;
+ break;
+ }
+ case QCss::AttributeSelector::MatchDashMatch: {
+ const QString dashPrefix = a.value + QLatin1Char('-');
+ if (attrValue != a.value && !attrValue.startsWith(dashPrefix))
+ return false;
+ break;
+ }
+ case QCss::AttributeSelector::MatchBeginsWith:
+ if (!attrValue.startsWith(a.value))
+ return false;
+ break;
+ case QCss::AttributeSelector::MatchEndsWith:
+ if (!attrValue.endsWith(a.value))
+ return false;
+ break;
+ case QCss::AttributeSelector::MatchContains:
+ if (!attrValue.contains(a.value))
+ return false;
+ break;
+ }
}
}
@@ -2082,7 +2111,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
hexCount = qMin(hexCount, 6);
bool ok = false;
- ushort code = output.mid(hexStart, hexCount).toUShort(&ok, 16);
+ ushort code = output.midRef(hexStart, hexCount).toUShort(&ok, 16);
if (ok) {
output.replace(hexStart - 1, hexCount + 1, QChar(code));
i = hexStart;
@@ -2336,9 +2365,11 @@ bool Parser::parseCombinator(BasicSelector::Relation *relation)
prev();
}
if (test(PLUS)) {
- *relation = BasicSelector::MatchNextSelectorIfPreceeds;
+ *relation = BasicSelector::MatchNextSelectorIfDirectAdjecent;
} else if (test(GREATER)) {
*relation = BasicSelector::MatchNextSelectorIfParent;
+ } else if (test(TILDE)) {
+ *relation = BasicSelector::MatchNextSelectorIfIndirectAdjecent;
}
skipSpace();
return true;
@@ -2439,7 +2470,7 @@ bool Parser::parseSimpleSelector(BasicSelector *basicSel)
onceMore = true;
AttributeSelector a;
a.name = QLatin1String("class");
- a.valueMatchCriterium = AttributeSelector::MatchContains;
+ a.valueMatchCriterium = AttributeSelector::MatchIncludes;
if (!parseClass(&a.value)) return false;
basicSel->attributeSelectors.append(a);
} else if (testAttrib()) {
@@ -2485,9 +2516,15 @@ bool Parser::parseAttrib(AttributeSelector *attr)
if (test(EQUAL)) {
attr->valueMatchCriterium = AttributeSelector::MatchEqual;
} else if (test(INCLUDES)) {
- attr->valueMatchCriterium = AttributeSelector::MatchContains;
+ attr->valueMatchCriterium = AttributeSelector::MatchIncludes;
} else if (test(DASHMATCH)) {
+ attr->valueMatchCriterium = AttributeSelector::MatchDashMatch;
+ } else if (test(BEGINSWITH)) {
attr->valueMatchCriterium = AttributeSelector::MatchBeginsWith;
+ } else if (test(ENDSWITH)) {
+ attr->valueMatchCriterium = AttributeSelector::MatchEndsWith;
+ } else if (test(CONTAINS)) {
+ attr->valueMatchCriterium = AttributeSelector::MatchContains;
} else {
return next(RBRACKET);
}
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 4da7b62dba..9f79e9934e 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtCore/QVariant>
@@ -538,8 +539,11 @@ struct AttributeSelector
enum ValueMatchType {
NoMatch,
MatchEqual,
- MatchContains,
- MatchBeginsWith
+ MatchIncludes,
+ MatchDashMatch,
+ MatchBeginsWith,
+ MatchEndsWith,
+ MatchContains
};
inline AttributeSelector() : valueMatchCriterium(NoMatch) {}
@@ -557,7 +561,8 @@ struct BasicSelector
NoRelation,
MatchNextSelectorIfAncestor,
MatchNextSelectorIfParent,
- MatchNextSelectorIfPreceeds
+ MatchNextSelectorIfDirectAdjecent,
+ MatchNextSelectorIfIndirectAdjecent,
};
QString elementName;
@@ -678,11 +683,15 @@ enum TokenType {
CDC,
INCLUDES,
DASHMATCH,
+ BEGINSWITH,
+ ENDSWITH,
+ CONTAINS,
LBRACE,
PLUS,
GREATER,
COMMA,
+ TILDE,
STRING,
INVALID,
@@ -782,7 +791,7 @@ public:
inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("import")); }
inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("media")); }
inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("page")); }
- inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(S); }
+ inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(TILDE) || test(S); }
inline bool testProperty() { return test(IDENT); }
bool testTerm();
inline bool testExpr() { return testTerm(); }
diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp
index f6b25d50ba..33dc01c8bc 100644
--- a/src/gui/text/qcssscanner.cpp
+++ b/src/gui/text/qcssscanner.cpp
@@ -88,8 +88,10 @@ int QCssScanner_Generated::lex()
goto state_3;
if (ch.unicode() == 35)
goto state_4;
- if (ch.unicode() == 39)
+ if (ch.unicode() == 36)
goto state_5;
+ if (ch.unicode() == 39)
+ goto state_6;
if (ch.unicode() == 40) {
token = QCss::LPAREN;
goto found;
@@ -98,22 +100,20 @@ int QCssScanner_Generated::lex()
token = QCss::RPAREN;
goto found;
}
- if (ch.unicode() == 42) {
- token = QCss::STAR;
- goto found;
- }
- if (ch.unicode() == 43)
+ if (ch.unicode() == 42)
goto state_9;
- if (ch.unicode() == 44)
+ if (ch.unicode() == 43)
goto state_10;
- if (ch.unicode() == 45)
+ if (ch.unicode() == 44)
goto state_11;
- if (ch.unicode() == 46)
+ if (ch.unicode() == 45)
goto state_12;
- if (ch.unicode() == 47)
+ if (ch.unicode() == 46)
goto state_13;
- if (ch.unicode() >= 48 && ch.unicode() <= 57)
+ if (ch.unicode() == 47)
goto state_14;
+ if (ch.unicode() >= 48 && ch.unicode() <= 57)
+ goto state_15;
if (ch.unicode() == 58) {
token = QCss::COLON;
goto found;
@@ -123,147 +123,167 @@ int QCssScanner_Generated::lex()
goto found;
}
if (ch.unicode() == 60)
- goto state_17;
+ goto state_18;
if (ch.unicode() == 61) {
token = QCss::EQUAL;
goto found;
}
if (ch.unicode() == 62)
- goto state_19;
- if (ch.unicode() == 64)
goto state_20;
+ if (ch.unicode() == 64)
+ goto state_21;
if (ch.unicode() == 91) {
token = QCss::LBRACKET;
goto found;
}
if (ch.unicode() == 92)
- goto state_22;
+ goto state_23;
if (ch.unicode() == 93) {
token = QCss::RBRACKET;
goto found;
}
+ if (ch.unicode() == 94)
+ goto state_25;
if (ch.unicode() == 95)
- goto state_24;
+ goto state_26;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_24;
+ goto state_26;
if (ch.unicode() == 123)
- goto state_25;
+ goto state_27;
if (ch.unicode() == 124)
- goto state_26;
+ goto state_28;
if (ch.unicode() == 125) {
token = QCss::RBRACE;
goto found;
}
if (ch.unicode() == 126)
- goto state_28;
+ goto state_30;
goto out;
state_1:
lastAcceptingPos = pos;
token = QCss::S;
ch = next();
if (ch.unicode() >= 9 && ch.unicode() <= 10)
- goto state_29;
+ goto state_31;
if (ch.unicode() >= 12 && ch.unicode() <= 13)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 32)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 43)
- goto state_9;
- if (ch.unicode() == 44)
goto state_10;
+ if (ch.unicode() == 44)
+ goto state_11;
if (ch.unicode() == 62)
- goto state_19;
+ goto state_20;
if (ch.unicode() == 123)
- goto state_25;
+ goto state_27;
+ if (ch.unicode() == 126)
+ goto state_32;
goto out;
state_3:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
state_4:
ch = next();
if (ch.unicode() == 45)
- goto state_33;
+ goto state_36;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_33;
+ goto state_36;
if (ch.unicode() == 92)
- goto state_34;
+ goto state_37;
if (ch.unicode() == 95)
- goto state_33;
+ goto state_36;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_33;
+ goto state_36;
goto out;
state_5:
+ ch = next();
+ if (ch.unicode() == 61) {
+ token = QCss::ENDSWITH;
+ goto found;
+ }
+ goto out;
+ state_6:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
state_9:
lastAcceptingPos = pos;
- token = QCss::PLUS;
+ token = QCss::STAR;
+ ch = next();
+ if (ch.unicode() == 61) {
+ token = QCss::CONTAINS;
+ goto found;
+ }
goto out;
state_10:
lastAcceptingPos = pos;
- token = QCss::COMMA;
+ token = QCss::PLUS;
goto out;
state_11:
lastAcceptingPos = pos;
+ token = QCss::COMMA;
+ goto out;
+ state_12:
+ lastAcceptingPos = pos;
token = QCss::MINUS;
ch = next();
if (ch.unicode() == 45)
- goto state_38;
+ goto state_43;
if (ch.unicode() == 92)
- goto state_22;
+ goto state_23;
if (ch.unicode() == 95)
- goto state_24;
+ goto state_26;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_24;
+ goto state_26;
goto out;
- state_12:
+ state_13:
lastAcceptingPos = pos;
token = QCss::DOT;
ch = next();
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_39;
+ goto state_44;
goto out;
- state_13:
+ state_14:
lastAcceptingPos = pos;
token = QCss::SLASH;
ch = next();
@@ -272,80 +292,87 @@ int QCssScanner_Generated::lex()
goto found;
}
goto out;
- state_14:
+ state_15:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() == 46)
- goto state_43;
+ goto state_48;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_44;
+ goto state_49;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_17:
+ state_18:
ch = next();
if (ch.unicode() == 33)
- goto state_47;
+ goto state_52;
goto out;
- state_19:
+ state_20:
lastAcceptingPos = pos;
token = QCss::GREATER;
goto out;
- state_20:
+ state_21:
ch = next();
if (ch.unicode() == 45)
- goto state_48;
+ goto state_53;
if (ch.unicode() == 92)
- goto state_49;
+ goto state_54;
if (ch.unicode() == 95)
- goto state_50;
+ goto state_55;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_50;
+ goto state_55;
goto out;
- state_22:
+ state_23:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_51;
+ goto state_56;
if (ch.unicode() == 11)
- goto state_51;
+ goto state_56;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_51;
+ goto state_56;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_51;
+ goto state_56;
if (ch.unicode() >= 103)
- goto state_51;
+ goto state_56;
+ goto out;
+ state_25:
+ ch = next();
+ if (ch.unicode() == 61) {
+ token = QCss::BEGINSWITH;
+ goto found;
+ }
goto out;
- state_24:
+ state_26:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_25:
+ state_27:
lastAcceptingPos = pos;
token = QCss::LBRACE;
goto out;
- state_26:
+ state_28:
lastAcceptingPos = pos;
token = QCss::OR;
ch = next();
@@ -354,782 +381,790 @@ int QCssScanner_Generated::lex()
goto found;
}
goto out;
- state_28:
+ state_30:
+ lastAcceptingPos = pos;
+ token = QCss::TILDE;
ch = next();
if (ch.unicode() == 61) {
token = QCss::INCLUDES;
goto found;
}
goto out;
- state_29:
+ state_31:
lastAcceptingPos = pos;
token = QCss::S;
ch = next();
if (ch.unicode() >= 9 && ch.unicode() <= 10)
- goto state_29;
+ goto state_31;
if (ch.unicode() >= 12 && ch.unicode() <= 13)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 32)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 43)
- goto state_9;
- if (ch.unicode() == 44)
goto state_10;
+ if (ch.unicode() == 44)
+ goto state_11;
if (ch.unicode() == 62)
- goto state_19;
+ goto state_20;
if (ch.unicode() == 123)
- goto state_25;
+ goto state_27;
+ if (ch.unicode() == 126)
+ goto state_32;
goto out;
- state_30:
+ state_32:
+ lastAcceptingPos = pos;
+ token = QCss::TILDE;
+ goto out;
+ state_33:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_31:
+ state_34:
lastAcceptingPos = pos;
token = QCss::STRING;
goto out;
- state_32:
+ state_35:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_57;
+ goto state_63;
if (ch.unicode() == 10)
- goto state_58;
+ goto state_64;
if (ch.unicode() == 11)
- goto state_57;
+ goto state_63;
if (ch.unicode() == 12)
- goto state_59;
+ goto state_65;
if (ch.unicode() == 13)
- goto state_60;
+ goto state_66;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_57;
+ goto state_63;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_57;
+ goto state_63;
if (ch.unicode() >= 103)
- goto state_57;
+ goto state_63;
goto out;
- state_33:
+ state_36:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_34:
+ state_37:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_63;
+ goto state_69;
if (ch.unicode() == 11)
- goto state_63;
+ goto state_69;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_63;
+ goto state_69;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_63;
+ goto state_69;
if (ch.unicode() >= 103)
- goto state_63;
+ goto state_69;
goto out;
- state_35:
+ state_39:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_36:
+ state_40:
lastAcceptingPos = pos;
token = QCss::STRING;
goto out;
- state_37:
+ state_41:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_64;
+ goto state_70;
if (ch.unicode() == 10)
- goto state_65;
+ goto state_71;
if (ch.unicode() == 11)
- goto state_64;
+ goto state_70;
if (ch.unicode() == 12)
- goto state_66;
+ goto state_72;
if (ch.unicode() == 13)
- goto state_67;
+ goto state_73;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_64;
+ goto state_70;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_64;
+ goto state_70;
if (ch.unicode() >= 103)
- goto state_64;
+ goto state_70;
goto out;
- state_38:
+ state_43:
ch = next();
if (ch.unicode() == 62) {
token = QCss::CDC;
goto found;
}
goto out;
- state_39:
+ state_44:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_69;
+ goto state_75;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_41:
+ state_46:
lastAcceptingPos = pos;
token = QCss::PERCENTAGE;
goto out;
- state_42:
+ state_47:
ch = next();
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_43:
+ state_48:
ch = next();
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_39;
+ goto state_44;
goto out;
- state_44:
+ state_49:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() == 46)
- goto state_43;
+ goto state_48;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_44;
+ goto state_49;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_45:
+ state_50:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_70;
+ goto state_76;
if (ch.unicode() == 11)
- goto state_70;
+ goto state_76;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_70;
+ goto state_76;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_70;
+ goto state_76;
if (ch.unicode() >= 103)
- goto state_70;
+ goto state_76;
goto out;
- state_46:
+ state_51:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_47:
+ state_52:
ch = next();
if (ch.unicode() == 45)
- goto state_73;
+ goto state_79;
goto out;
- state_48:
+ state_53:
ch = next();
if (ch.unicode() == 92)
- goto state_49;
+ goto state_54;
if (ch.unicode() == 95)
- goto state_50;
+ goto state_55;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_50;
+ goto state_55;
goto out;
- state_49:
+ state_54:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_74;
+ goto state_80;
if (ch.unicode() == 11)
- goto state_74;
+ goto state_80;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_74;
+ goto state_80;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_74;
+ goto state_80;
if (ch.unicode() >= 103)
- goto state_74;
+ goto state_80;
goto out;
- state_50:
+ state_55:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
- state_51:
+ state_56:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_52:
+ state_58:
lastAcceptingPos = pos;
token = QCss::FUNCTION;
goto out;
- state_53:
+ state_59:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_54:
+ state_60:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_77;
+ goto state_83;
if (ch.unicode() == 11)
- goto state_77;
+ goto state_83;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_77;
+ goto state_83;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_77;
+ goto state_83;
if (ch.unicode() >= 103)
- goto state_77;
+ goto state_83;
goto out;
- state_57:
+ state_63:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_58:
+ state_64:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_59:
+ state_65:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_60:
+ state_66:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 10)
- goto state_78;
+ goto state_84;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_61:
+ state_67:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_62:
+ state_68:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_79;
+ goto state_85;
if (ch.unicode() == 11)
- goto state_79;
+ goto state_85;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_79;
+ goto state_85;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_79;
+ goto state_85;
if (ch.unicode() >= 103)
- goto state_79;
+ goto state_85;
goto out;
- state_63:
+ state_69:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_64:
+ state_70:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_65:
+ state_71:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_66:
+ state_72:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_67:
+ state_73:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 10)
- goto state_80;
+ goto state_86;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_69:
+ state_75:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_69;
+ goto state_75;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_70:
+ state_76:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_71:
+ state_77:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_72:
+ state_78:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_81;
+ goto state_87;
if (ch.unicode() == 11)
- goto state_81;
+ goto state_87;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_81;
+ goto state_87;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_81;
+ goto state_87;
if (ch.unicode() >= 103)
- goto state_81;
+ goto state_87;
goto out;
- state_73:
+ state_79:
ch = next();
if (ch.unicode() == 45) {
token = QCss::CDO;
goto found;
}
goto out;
- state_74:
+ state_80:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
- state_75:
+ state_81:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
- state_76:
+ state_82:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_83;
+ goto state_89;
if (ch.unicode() == 11)
- goto state_83;
+ goto state_89;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_83;
+ goto state_89;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_83;
+ goto state_89;
if (ch.unicode() >= 103)
- goto state_83;
+ goto state_89;
goto out;
- state_77:
+ state_83:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_78:
+ state_84:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_79:
+ state_85:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_80:
+ state_86:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_81:
+ state_87:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_83:
+ state_89:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
found:
lastAcceptingPos = pos;
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index 5a696807b4..933dd1bf54 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
@@ -736,8 +738,40 @@ static bool imageHasNarrowOutlines(const QImage &im)
return minHThick == 1 || minVThick == 1;
}
+static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54;
+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_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;
@@ -757,6 +791,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;
@@ -769,6 +804,41 @@ 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_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 c6c5e6b650..27ab84332c 100644
--- a/src/gui/text/qdistancefield_p.h
+++ b/src/gui/text/qdistancefield_p.h
@@ -51,30 +51,24 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#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_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_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/qfont.cpp b/src/gui/text/qfont.cpp
index 9e4f61ebee..3b24039ea6 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1376,6 +1376,7 @@ void QFont::setStyleStrategy(StyleStrategy s)
Predefined stretch values that follow the CSS naming convention. The higher
the value, the more stretched the text is.
+ \value AnyStretch 0 Accept any stretch matched using the other QFont properties (added in Qt 5.8)
\value UltraCondensed 50
\value ExtraCondensed 62
\value Condensed 75
@@ -1402,20 +1403,25 @@ int QFont::stretch() const
/*!
Sets the stretch factor for the font.
- The stretch factor changes the width of all characters in the font
- by \a factor percent. For example, setting \a factor to 150
+ The stretch factor matches a condensed or expanded version of the font or
+ applies a stretch transform that changes the width of all characters
+ in the font by \a factor percent. For example, setting \a factor to 150
results in all characters in the font being 1.5 times (ie. 150%)
- wider. The default stretch factor is 100. The minimum stretch
- factor is 1, and the maximum stretch factor is 4000.
+ wider. The minimum stretch factor is 1, and the maximum stretch factor
+ is 4000. The default stretch factor is \c AnyStretch, which will accept
+ any stretch factor and not apply any transform on the font.
The stretch factor is only applied to outline fonts. The stretch
factor is ignored for bitmap fonts.
+ \note When matching a font with a native non-default stretch factor,
+ requesting a stretch of 100 will stretch it back to a medium width font.
+
\sa stretch(), QFont::Stretch
*/
void QFont::setStretch(int factor)
{
- if (factor < 1 || factor > 4000) {
+ if (factor < 0 || factor > 4000) {
qWarning("QFont::setStretch: Parameter '%d' out of range", factor);
return;
}
@@ -2001,7 +2007,7 @@ QString QFont::key() const
QString QFont::toString() const
{
const QChar comma(QLatin1Char(','));
- return family() + comma +
+ QString fontDescription = family() + comma +
QString::number( pointSizeF()) + comma +
QString::number( pixelSize()) + comma +
QString::number((int) styleHint()) + comma +
@@ -2011,6 +2017,12 @@ QString QFont::toString() const
QString::number((int) strikeOut()) + comma +
QString::number((int)fixedPitch()) + comma +
QString::number((int) false);
+
+ QString fontStyle = styleName();
+ if (!fontStyle.isEmpty())
+ fontDescription += comma + fontStyle;
+
+ return fontDescription;
}
/*!
@@ -2054,7 +2066,7 @@ bool QFont::fromString(const QString &descrip)
setUnderline(l[5].toInt());
setStrikeOut(l[6].toInt());
setFixedPitch(l[7].toInt());
- } else if (count == 10) {
+ } else if (count >= 10) {
if (l[2].toInt() > 0)
setPixelSize(l[2].toInt());
setStyleHint((StyleHint) l[3].toInt());
@@ -2063,7 +2075,10 @@ bool QFont::fromString(const QString &descrip)
setUnderline(l[6].toInt());
setStrikeOut(l[7].toInt());
setFixedPitch(l[8].toInt());
+ if (count == 11)
+ d->request.styleName = l[10].toString();
}
+
if (count >= 9 && !d->request.fixedPitch) // assume 'false' fixedPitch equals default
d->request.ignorePitch = true;
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 85a237643c..6f0dd27fbe 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -40,6 +40,7 @@
#ifndef QFONT_H
#define QFONT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
#include <QtCore/qsharedpointer.h>
@@ -112,6 +113,7 @@ public:
};
enum Stretch {
+ AnyStretch = 0,
UltraCondensed = 50,
ExtraCondensed = 62,
Condensed = 75,
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 3979bb27ac..9e5d0b4329 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qfont.h"
#include "QtCore/qmap.h"
#include "QtCore/qhash.h"
@@ -70,7 +71,7 @@ struct QFontDef
inline QFontDef()
: pointSize(-1.0), pixelSize(-1),
styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle),
- weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100),
+ weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(QFont::AnyStretch),
hintingPreference(QFont::PreferDefaultHinting), ignorePitch(true),
fixedPitchComputed(0), reserved(0)
{
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 283d03f22c..7fcac9b9f2 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -663,11 +663,8 @@ struct QtFontDesc
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
{
fontDef->family = desc.family->name;
- if (! desc.foundry->name.isEmpty() && desc.family->count > 1) {
- fontDef->family += QString::fromLatin1(" [");
- fontDef->family += desc.foundry->name;
- fontDef->family += QLatin1Char(']');
- }
+ if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
+ fontDef->family += QLatin1String(" [") + desc.foundry->name + QLatin1Char(']');
if (desc.style->smoothScalable
|| QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
@@ -955,12 +952,14 @@ QFontEngine *loadSingleEngine(int script,
}
}
- // If the font data's native stretch matches the requested stretch we need to set stretch to 100
- // to avoid the fontengine synthesizing stretch. If they didn't match exactly we need to calculate
- // the new stretch factor. This only done if not matched by styleName.
+ // To avoid synthesized stretch we need a matching stretch to be 100 after this point.
+ // If stretch didn't match exactly we need to calculate the new stretch factor.
+ // This only done if not matched by styleName.
if (style->key.stretch != 0 && request.stretch != 0
&& (request.styleName.isEmpty() || request.styleName != style->styleName)) {
- def.stretch = (request.stretch * 100 + 50) / style->key.stretch;
+ def.stretch = (request.stretch * 100 + style->key.stretch / 2) / style->key.stretch;
+ } else {
+ def.stretch = 100;
}
engine = pfdb->fontEngine(def, size->handle);
@@ -1223,7 +1222,8 @@ static int match(int script, const QFontDef &request,
QtFontStyle::Key styleKey;
styleKey.style = request.style;
styleKey.weight = request.weight;
- styleKey.stretch = request.stretch;
+ // Prefer a stretch closest to 100.
+ styleKey.stretch = request.stretch ? request.stretch : 100;
char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
@@ -2225,10 +2225,18 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
sample += QChar(0x05D3);
break;
case Arabic:
+ sample += QChar(0x0623);
+ sample += QChar(0x0628);
+ sample += QChar(0x062C);
+ sample += QChar(0x062F);
+ sample += QChar(0x064A);
+ sample += QChar(0x0629);
+ sample += QChar(0x0020);
+ sample += QChar(0x0639);
+ sample += QChar(0x0631);
sample += QChar(0x0628);
+ sample += QChar(0x064A);
sample += QChar(0x0629);
- sample += QChar(0x062A);
- sample += QChar(0x063A);
break;
case Syriac:
sample += QChar(0x0715);
@@ -2431,7 +2439,7 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
}
if (font.fileName.isEmpty() && !fontData.isEmpty())
- font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);
+ font.fileName = QLatin1String(":qmemoryfonts/") + QString::number(i);
registerFont(&font);
if (font.families.isEmpty())
@@ -2736,8 +2744,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
}
if (req.pointSize < 0)
req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.stretch == 0)
- req.stretch = 100;
// respect the fallback families that might be passed through the request
const QStringList fallBackFamilies = familyList(req);
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 67cf671304..e6aef493bd 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -40,6 +40,7 @@
#ifndef QFONTDATABASE_H
#define QFONTDATABASE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
#include <QtGui/qfont.h>
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 4f0c6d25f7..74ea8d15b7 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -418,6 +418,13 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix
return metrics;
}
+QFixed QFontEngine::calculatedCapHeight() const
+{
+ const glyph_t glyph = glyphIndex('H');
+ glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
+ return bb.height;
+}
+
QFixed QFontEngine::xHeight() const
{
const glyph_t glyph = glyphIndex('x');
@@ -1700,6 +1707,11 @@ QFixed QFontEngineBox::ascent() const
return _size;
}
+QFixed QFontEngineBox::capHeight() const
+{
+ return _size;
+}
+
QFixed QFontEngineBox::descent() const
{
return 0;
@@ -1842,7 +1854,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) {
@@ -1880,7 +1896,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) {
@@ -2152,6 +2172,9 @@ glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph)
QFixed QFontEngineMulti::ascent() const
{ return engine(0)->ascent(); }
+QFixed QFontEngineMulti::capHeight() const
+{ return engine(0)->capHeight(); }
+
QFixed QFontEngineMulti::descent() const
{ return engine(0)->descent(); }
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 5550dc21db..62941b6cac 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -414,6 +414,7 @@ QFontEngine::Properties QFreetypeFace::properties() const
p.italicAngle = 0;
p.capHeight = p.ascent;
p.lineWidth = face->underline_thickness;
+
return p;
}
@@ -585,8 +586,7 @@ static void convertRGBToARGB_helper(const uchar *src, uint *dst, int width, int
uchar green = src[x + 1];
uchar blue = src[x + 1 + offs];
LcdFilter::filterPixel(red, green, blue);
- // alpha = green
- *dd++ = (green << 24) | (red << 16) | (green << 8) | blue;
+ *dd++ = (0xFF << 24) | (red << 16) | (green << 8) | blue;
}
dst += width;
src += src_pitch;
@@ -611,8 +611,7 @@ static void convertRGBToARGB_V_helper(const uchar *src, uint *dst, int width, in
uchar green = src[x + src_pitch];
uchar blue = src[x + src_pitch + offs];
LcdFilter::filterPixel(red, green, blue);
- // alpha = green
- *dst++ = (green << 24) | (red << 16) | (green << 8) | blue;
+ *dst++ = (0XFF << 24) | (red << 16) | (green << 8) | blue;
}
src += 3*src_pitch;
}
@@ -1299,6 +1298,18 @@ QFixed QFontEngineFT::ascent() const
return v;
}
+QFixed QFontEngineFT::capHeight() const
+{
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->version >= 2) {
+ lockFace();
+ QFixed answer = QFixed::fromFixed(FT_MulFix(os2->sCapHeight, freetype->face->size->metrics.y_scale));
+ unlockFace();
+ return answer;
+ }
+ return calculatedCapHeight();
+}
+
QFixed QFontEngineFT::descent() const
{
QFixed v = QFixed::fromFixed(-metrics.descender);
@@ -1317,33 +1328,25 @@ QFixed QFontEngineFT::leading() const
QFixed QFontEngineFT::xHeight() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->sxHeight) {
- lockFace();
- QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- return QFixed(freetype->face->size->metrics.y_ppem) * scalableBitmapScaleFactor;
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->sxHeight) {
+ lockFace();
+ QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
+
return QFontEngine::xHeight();
}
QFixed QFontEngineFT::averageCharWidth() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->xAvgCharWidth) {
- lockFace();
- QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- const qreal aspectRatio = (qreal)xsize / ysize;
- return QFixed::fromReal(fontDef.pixelSize * aspectRatio);
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->xAvgCharWidth) {
+ lockFace();
+ QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
return QFontEngine::averageCharWidth();
@@ -1842,7 +1845,7 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng
bytesPerLine = (glyph->width + 3) & ~3;
break;
case QFontEngine::Format_A32:
- format = QImage::Format_ARGB32;
+ format = QImage::Format_RGB32;
bytesPerLine = glyph->width * 4;
break;
default:
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 3cdf0cda47..5ca3721c71 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -209,6 +209,7 @@ private:
int synthesized() const Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 132531f5bc..42610e9b70 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
#include <QtCore/QLinkedList>
@@ -211,6 +211,7 @@ public:
glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs);
virtual QFixed ascent() const = 0;
+ virtual QFixed capHeight() const = 0;
virtual QFixed descent() const = 0;
virtual QFixed leading() const = 0;
virtual QFixed xHeight() const;
@@ -348,6 +349,7 @@ protected:
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
inline void setUserData(const QVariant &userData) { m_userData = userData; }
+ QFixed calculatedCapHeight() const;
private:
struct GlyphCacheEntry {
@@ -413,6 +415,7 @@ public:
virtual QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
virtual QFixed ascent() const Q_DECL_OVERRIDE;
+ virtual QFixed capHeight() const Q_DECL_OVERRIDE;
virtual QFixed descent() const Q_DECL_OVERRIDE;
virtual QFixed leading() const Q_DECL_OVERRIDE;
virtual qreal maxCharWidth() const Q_DECL_OVERRIDE;
@@ -450,6 +453,7 @@ public:
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE;
virtual QFixed ascent() const Q_DECL_OVERRIDE;
+ virtual QFixed capHeight() const Q_DECL_OVERRIDE;
virtual QFixed descent() const Q_DECL_OVERRIDE;
virtual QFixed leading() const Q_DECL_OVERRIDE;
virtual QFixed xHeight() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp
index 2e4af09550..110d512d39 100644
--- a/src/gui/text/qfontengine_qpf2.cpp
+++ b/src/gui/text/qfontengine_qpf2.cpp
@@ -459,6 +459,11 @@ QFixed QFontEngineQPF2::ascent() const
return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value<qreal>());
}
+QFixed QFontEngineQPF2::capHeight() const
+{
+ return calculatedCapHeight();
+}
+
QFixed QFontEngineQPF2::descent() const
{
return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value<qreal>());
diff --git a/src/gui/text/qfontengine_qpf2_p.h b/src/gui/text/qfontengine_qpf2_p.h
index 50aac245c1..e5c38ffbaf 100644
--- a/src/gui/text/qfontengine_qpf2_p.h
+++ b/src/gui/text/qfontengine_qpf2_p.h
@@ -172,6 +172,7 @@ public:
glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
qreal maxCharWidth() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index 54b9af71df..fd5db1ecf5 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -52,7 +52,7 @@
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
#include "private/qfont_p.h"
diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h
index ee368e26bd..f5e05775b4 100644
--- a/src/gui/text/qfontinfo.h
+++ b/src/gui/text/qfontinfo.h
@@ -40,6 +40,7 @@
#ifndef QFONTINFO_H
#define QFONTINFO_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qfont.h>
#include <QtCore/qsharedpointer.h>
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 2189923b25..aca59d0288 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -274,6 +274,24 @@ int QFontMetrics::ascent() const
return qRound(engine->ascent());
}
+/*!
+ Returns the cap height of the font.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa ascent()
+*/
+int QFontMetrics::capHeight() const
+{
+ QFontEngine *engine = d->engineForScript(QChar::Script_Common);
+ Q_ASSERT(engine != 0);
+ return qRound(engine->capHeight());
+}
/*!
Returns the descent of the font.
@@ -1138,6 +1156,24 @@ qreal QFontMetricsF::ascent() const
return engine->ascent().toReal();
}
+/*!
+ Returns the cap height of the font.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa ascent()
+*/
+qreal QFontMetricsF::capHeight() const
+{
+ QFontEngine *engine = d->engineForScript(QChar::Script_Common);
+ Q_ASSERT(engine != 0);
+ return engine->capHeight().toReal();
+}
/*!
Returns the descent of the font.
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 1d7241c9f2..3eac309092 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -40,6 +40,7 @@
#ifndef QFONTMETRICS_H
#define QFONTMETRICS_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qfont.h>
#include <QtCore/qsharedpointer.h>
#ifndef QT_INCLUDE_COMPAT
@@ -72,6 +73,7 @@ public:
{ qSwap(d, other.d); }
int ascent() const;
+ int capHeight() const;
int descent() const;
int height() const;
int leading() const;
@@ -145,6 +147,7 @@ public:
void swap(QFontMetricsF &other) { qSwap(d, other.d); }
qreal ascent() const;
+ qreal capHeight() const;
qreal descent() const;
qreal height() const;
qreal leading() const;
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index c8f0393084..92eeaf7919 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -740,7 +740,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV
points->takeLast();
endPoints->append(points->size() - 1);
}
- // fall through
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
p.flags = OnCurve;
break;
@@ -966,7 +966,7 @@ static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advanc
glyph.advanceWidth = qRound(advance * 2048. / ppem);
glyph.lsb = qRound(lsb * 2048. / ppem);
- if (!path.elementCount()) {
+ if (path.isEmpty()) {
//qDebug("glyph %d is empty", index);
lsb = 0;
glyph.xMin = glyph.xMax = glyph.yMin = glyph.yMax = 0;
diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h
index a7328df4ed..e7c6053beb 100644
--- a/src/gui/text/qfontsubset_p.h
+++ b/src/gui/text/qfontsubset_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qfontengine_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h
index b54d7261d0..35f60ac961 100644
--- a/src/gui/text/qfragmentmap_p.h
+++ b/src/gui/text/qfragmentmap_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include <stdlib.h>
#include <private/qtools_p.h>
diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h
index 6016925d27..6182c4f749 100644
--- a/src/gui/text/qglyphrun.h
+++ b/src/gui/text/qglyphrun.h
@@ -40,6 +40,7 @@
#ifndef QGLYPHRUN_H
#define QGLYPHRUN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qvector.h>
#include <QtCore/qpoint.h>
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index 52fa03f150..5b6bdad648 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qglyphrun.h"
#include "qrawfont.h"
diff --git a/src/gui/text/qharfbuzzng_p.h b/src/gui/text/qharfbuzzng_p.h
index 28f20338dd..95a21eedb6 100644
--- a/src/gui/text/qharfbuzzng_p.h
+++ b/src/gui/text/qharfbuzzng_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qchar.h>
#include <harfbuzz/hb.h>
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 0d7cb204ff..b83affecdc 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -395,10 +395,8 @@ void QPlatformFontDatabase::releaseHandle(void *handle)
QString QPlatformFontDatabase::fontDir() const
{
QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR"));
- if (fontpath.isEmpty()) {
- fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
- fontpath += QLatin1String("/fonts");
- }
+ if (fontpath.isEmpty())
+ fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath) + QLatin1String("/fonts");
return fontpath;
}
diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h
index 61c892ad8b..13d8cbde60 100644
--- a/src/gui/text/qplatformfontdatabase.h
+++ b/src/gui/text/qplatformfontdatabase.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qconfig.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QList>
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 88b9e218fb..886cf5ef39 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -261,9 +261,13 @@ void QRawFont::loadFromData(const QByteArray &fontData,
\a glyphIndex in the underlying font, using the \a transform specified.
If the QRawFont is not valid, this function will return an invalid QImage.
- If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be
- in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of
- the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of
+ If the font is a color font, then the resulting image will contain the rendered
+ glyph at the current pixel size. In this case, the \a antialiasingType will be
+ ignored.
+
+ Otherwise, if \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image
+ will be in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities
+ of the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of
QImage::Format_Indexed8 and each pixel will contain the opacity of the pixel in the
rasterization.
@@ -275,6 +279,9 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias
if (!d->isValid())
return QImage();
+ if (d->fontEngine->glyphFormat == QFontEngine::Format_ARGB)
+ return d->fontEngine->bitmapForGlyph(glyphIndex, QFixed(), transform);
+
if (antialiasingType == SubPixelAntialiasing)
return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform);
@@ -332,6 +339,23 @@ qreal QRawFont::ascent() const
}
/*!
+ Returns the cap height of this QRawFont in pixel units.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa QFontMetricsF::capHeight()
+*/
+qreal QRawFont::capHeight() const
+{
+ return d->isValid() ? d->fontEngine->capHeight().toReal() : 0.0;
+}
+
+/*!
Returns the descent of this QRawFont in pixel units.
The descent is the distance from the base line to the lowest point
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index aa98363229..0252e62370 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -40,6 +40,7 @@
#ifndef QRAWFONT_H
#define QRAWFONT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qglobal.h>
@@ -117,6 +118,7 @@ public:
QFont::HintingPreference hintingPreference() const;
qreal ascent() const;
+ qreal capHeight() const;
qreal descent() const;
qreal leading() const;
qreal xHeight() const;
diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h
index ee54578cf9..0fc8739bfb 100644
--- a/src/gui/text/qrawfont_p.h
+++ b/src/gui/text/qrawfont_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qrawfont.h"
#include "qfontengine_p.h"
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index 2da74825a2..00dfccc144 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -40,6 +40,7 @@
#ifndef QSTATICTEXT_H
#define QSTATICTEXT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsize.h>
#include <QtCore/qstring.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 7fdf46c101..dda566a22b 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qstatictext.h"
#include <private/qtextureglyphcache_p.h>
diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h
index 2ccb3a68b9..d87f89f0fd 100644
--- a/src/gui/text/qsyntaxhighlighter.h
+++ b/src/gui/text/qsyntaxhighlighter.h
@@ -40,7 +40,7 @@
#ifndef QSYNTAXHIGHLIGHTER_H
#define QSYNTAXHIGHLIGHTER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_SYNTAXHIGHLIGHTER
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index f824d1b369..f32c31d18e 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -438,7 +438,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
if (relativePos < blockIt.length()-1)
++position;
- // FALL THROUGH!
+ Q_FALLTHROUGH();
}
case QTextCursor::PreviousWord:
case QTextCursor::WordLeft:
@@ -590,9 +590,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
adjustX = false;
break;
}
- case QTextCursor::NextCell: // fall through
- case QTextCursor::PreviousCell: // fall through
- case QTextCursor::NextRow: // fall through
+ case QTextCursor::NextCell:
+ case QTextCursor::PreviousCell:
+ case QTextCursor::NextRow:
case QTextCursor::PreviousRow: {
QTextTable *table = qobject_cast<QTextTable *>(priv->frameAt(position));
if (!table)
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index 9610e61b39..1a00b753ad 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -40,6 +40,7 @@
#ifndef QTEXTCURSOR_H
#define QTEXTCURSOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qshareddata.h>
#include <QtGui/qtextformat.h>
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index 84f912a3fa..3569317b6d 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qtextcursor.h"
#include "qtextdocument.h"
#include "qtextdocument_p.h"
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index bb44c19557..07aec6f019 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -94,7 +94,7 @@ bool Qt::mightBeRichText(const QString& text)
++start;
// skip a leading <?xml ... ?> as for example with xhtml
- if (text.mid(start, 5) == QLatin1String("<?xml")) {
+ if (text.midRef(start, 5).compare(QLatin1String("<?xml")) == 0) {
while (start < text.length()) {
if (text.at(start) == QLatin1Char('?')
&& start + 2 < text.length()
@@ -109,12 +109,12 @@ bool Qt::mightBeRichText(const QString& text)
++start;
}
- if (text.mid(start, 5).toLower() == QLatin1String("<!doc"))
+ if (text.midRef(start, 5).compare(QLatin1String("<!doc"), Qt::CaseInsensitive) == 0)
return true;
int open = start;
while (open < text.length() && text.at(open) != QLatin1Char('<')
&& text.at(open) != QLatin1Char('\n')) {
- if (text.at(open) == QLatin1Char('&') && text.mid(open+1,3) == QLatin1String("lt;"))
+ if (text.at(open) == QLatin1Char('&') && text.midRef(open + 1, 3) == QLatin1String("lt;"))
return true; // support desperate attempt of user to see <...>
++open;
}
@@ -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.h b/src/gui/text/qtextdocument.h
index 02cfa97bce..1888088f0d 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -40,6 +40,7 @@
#ifndef QTEXTDOCUMENT_H
#define QTEXTDOCUMENT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qsize.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index ffc5d7418b..7107c7c26e 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -131,7 +131,7 @@ static bool isValidBlockSeparator(QChar ch)
|| ch == QTextEndOfFrame;
}
-static bool noBlockInString(const QString &str)
+static bool noBlockInString(const QStringRef &str)
{
return !str.contains(QChar::ParagraphSeparator)
&& !str.contains(QTextBeginningOfFrame)
@@ -320,7 +320,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout)
void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op)
{
// ##### optimize when only appending to the fragment!
- Q_ASSERT(noBlockInString(text.mid(strPos, length)));
+ Q_ASSERT(noBlockInString(text.midRef(strPos, length)));
split(pos);
uint x = fragments.insert_single(pos, length);
@@ -476,7 +476,7 @@ void QTextDocumentPrivate::insert(int pos, const QString &str, int format)
if (str.size() == 0)
return;
- Q_ASSERT(noBlockInString(str));
+ Q_ASSERT(noBlockInString(QStringRef(&str)));
int strPos = text.length();
text.append(str);
@@ -494,7 +494,7 @@ int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::
Q_ASSERT(blocks.size(b) > length);
Q_ASSERT(x && fragments.position(x) == (uint)pos && fragments.size(x) == length);
- Q_ASSERT(noBlockInString(text.mid(fragments.fragment(x)->stringPosition, length)));
+ Q_ASSERT(noBlockInString(text.midRef(fragments.fragment(x)->stringPosition, length)));
blocks.setSize(b, blocks.size(b)-length);
@@ -629,7 +629,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
if (key+1 != blocks.position(b)) {
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
- Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0])));
+ Q_ASSERT(noBlockInString(text.midRef(X->stringPosition, X->size_array[0])));
w = remove_string(key, X->size_array[0], op);
if (needsInsert) {
@@ -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..cad9131fbf 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qstring.h"
#include "QtCore/qvector.h"
#include "QtCore/qlist.h"
@@ -158,7 +158,7 @@ public:
};
Q_DECLARE_TYPEINFO(QTextUndoCommand, Q_PRIMITIVE_TYPE);
-class Q_AUTOTEST_EXPORT QTextDocumentPrivate : public QObjectPrivate
+class Q_GUI_EXPORT QTextDocumentPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QTextDocument)
public:
@@ -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/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 5727b34e86..079b2e01f7 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -827,7 +827,7 @@ bool QTextHtmlImporter::closeTag()
case Html_div:
if (closedNode->children.isEmpty())
break;
- // fall through
+ Q_FALLTHROUGH();
default:
if (closedNode->isBlock())
blockTagClosed = true;
diff --git a/src/gui/text/qtextdocumentfragment.h b/src/gui/text/qtextdocumentfragment.h
index d1c1adfd0a..a56f6d06d6 100644
--- a/src/gui/text/qtextdocumentfragment.h
+++ b/src/gui/text/qtextdocumentfragment.h
@@ -40,6 +40,7 @@
#ifndef QTEXTDOCUMENTFRAGMENT_H
#define QTEXTDOCUMENTFRAGMENT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h
index 56dff01149..e8699545f7 100644
--- a/src/gui/text/qtextdocumentfragment_p.h
+++ b/src/gui/text/qtextdocumentfragment_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qtextdocument.h"
#include "private/qtexthtmlparser_p.h"
#include "private/qtextdocument_p.h"
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index b6cbd9617f..8ad2d85e7c 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;
@@ -2921,11 +2921,11 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length)
{
Q_D(QTextDocumentLayout);
- QTextBlock startIt = document()->findBlock(from);
+ QTextBlock blockIt = document()->findBlock(from);
QTextBlock endIt = document()->findBlock(qMax(0, from + length - 1));
if (endIt.isValid())
endIt = endIt.next();
- for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
+ for (; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
blockIt.clearLayout();
if (d->docPrivate->pageSize.isNull())
@@ -2967,9 +2967,6 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length)
d->insideDocumentChange = false;
- for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
- emit updateBlock(blockIt);
-
if (d->showLayoutProgress) {
const QSizeF newSize = dynamicDocumentSize();
if (newSize != d->lastReportedSize) {
diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h
index a9cd6cf289..710c49628e 100644
--- a/src/gui/text/qtextdocumentlayout_p.h
+++ b/src/gui/text/qtextdocumentlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtGui/qtextoption.h"
#include "QtGui/qtextobject.h"
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/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h
index b7917e55a4..0502bf1a96 100644
--- a/src/gui/text/qtextdocumentwriter.h
+++ b/src/gui/text/qtextdocumentwriter.h
@@ -39,6 +39,7 @@
#ifndef QTEXTDOCUMENTWRITER_H
#define QTEXTDOCUMENTWRITER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 2f069a9abd..5dbeccff7f 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -508,7 +508,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
case QChar::DirAN:
if (eor >= 0)
appendItems(analysis, sor, eor, control, dir);
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirR:
case QChar::DirAL:
dir = QChar::DirR; eor = current; status.eor = QChar::DirR; break;
@@ -564,7 +564,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.eor = QChar::DirON;
dir = QChar::DirAN;
}
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirEN:
case QChar::DirL:
eor = current;
@@ -744,7 +744,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.last = QChar::DirL;
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
status.last = dirCurrent;
}
@@ -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;
@@ -1666,7 +1664,7 @@ void QTextEngine::itemize() const
analysis->bidiLevel = control.baseLevel();
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
analysis->flags = QScriptAnalysis::None;
break;
@@ -2253,7 +2251,6 @@ void QTextEngine::justify(const QScriptLine &line)
case Justification_Prohibited:
break;
case Justification_Space:
- // fall through
case Justification_Arabic_Space:
if (kashida_pos >= 0) {
// qDebug("kashida position at %d in word", kashida_pos);
@@ -2266,7 +2263,7 @@ void QTextEngine::justify(const QScriptLine &line)
}
kashida_pos = -1;
kashida_type = Justification_Arabic_Normal;
- // fall through
+ Q_FALLTHROUGH();
case Justification_Character:
set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si));
maxJustify = qMax(maxJustify, justification);
@@ -2714,7 +2711,7 @@ static QString stringMidRetainingBidiCC(const QString &string,
suffix += c;
}
- return prefix + ellidePrefix + string.mid(midStart, midLength) + ellideSuffix + suffix;
+ return prefix + ellidePrefix + string.midRef(midStart, midLength) + ellideSuffix + suffix;
}
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const
@@ -2877,7 +2874,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
if (prevCharJoins(layoutData->string, rightPos))
ellipsisText.append(QChar(0x200d) /* ZWJ */);
- return layoutData->string.mid(from, leftPos - from) + ellipsisText + layoutData->string.mid(rightPos, to - rightPos);
+ return layoutData->string.midRef(from, leftPos - from) + ellipsisText + layoutData->string.midRef(rightPos, to - rightPos);
}
return layoutData->string.mid(from, to - from);
@@ -2969,9 +2966,8 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
switch (tabSpec.type) {
case QTextOption::CenterTab:
length /= 2;
- // fall through
+ Q_FALLTHROUGH();
case QTextOption::DelimiterTab:
- // fall through
case QTextOption::RightTab:
tab = QFixed::fromReal(tabSpec.position) * dpiScale - length;
if (tab < x) // default to tab taking no space
@@ -3519,7 +3515,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/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 56c9825cc1..160e9ce490 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qstring.h"
#include "QtCore/qvarlengtharray.h"
#include "QtCore/qnamespace.h"
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index 805affd87c..28c3035537 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -40,6 +40,7 @@
#ifndef QTEXTFORMAT_H
#define QTEXTFORMAT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qcolor.h>
#include <QtGui/qfont.h>
#include <QtCore/qshareddata.h>
diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h
index 45a432d2f5..f05bfaff71 100644
--- a/src/gui/text/qtextformat_p.h
+++ b/src/gui/text/qtextformat_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qtextformat.h"
#include "QtCore/qvector.h"
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index d18d432f46..d4c43b3069 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1872,7 +1872,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
if (node.id == Html_b || node.id == Html_strong)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_big:
case Html_small:
if (node.id != Html_th) {
@@ -1893,7 +1893,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
break;
}
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_center:
case Html_td:
decl = QCss::Declaration();
@@ -1970,7 +1970,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
}
if (node.id != Html_pre)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_br:
case Html_nobr:
decl = QCss::Declaration();
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 38c9108f75..e93d46a59f 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qvector.h"
#include "QtGui/qbrush.h"
#include "QtGui/qcolor.h"
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 18311ed161..f7117bfe0a 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -61,10 +61,10 @@ static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePi
// Also, QFile{Info}::exists works only on filepaths (not urls)
if (url->isValid()) {
- if (url->scheme() == QLatin1Literal("qrc")) {
+ if (url->scheme() == QLatin1String("qrc")) {
fileName = fileName.right(fileName.length() - 3);
}
- else if (url->scheme() == QLatin1Literal("file")) {
+ else if (url->scheme() == QLatin1String("file")) {
fileName = url->toLocalFile();
}
}
diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h
index 4bc19d49c3..a22c91ecbf 100644
--- a/src/gui/text/qtextimagehandler_p.h
+++ b/src/gui/text/qtextimagehandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qobject.h"
#include "QtGui/qabstracttextdocumentlayout.h"
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/qtextlayout.h b/src/gui/text/qtextlayout.h
index 1cbb5ac8d8..980a099b05 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -39,6 +39,7 @@
#ifndef QTEXTLAYOUT_H
#define QTEXTLAYOUT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h
index 71da175a14..3967787f03 100644
--- a/src/gui/text/qtextlist.h
+++ b/src/gui/text/qtextlist.h
@@ -40,6 +40,7 @@
#ifndef QTEXTLIST_H
#define QTEXTLIST_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qtextobject.h>
#include <QtCore/qobject.h>
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index d3f6b3d0ac..a5030de112 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -40,6 +40,7 @@
#ifndef QTEXTOBJECT_H
#define QTEXTOBJECT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qtextformat.h>
#include <QtGui/qtextlayout.h>
diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h
index ffc331e99d..81ab023cc3 100644
--- a/src/gui/text/qtextobject_p.h
+++ b/src/gui/text/qtextobject_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qtextobject.h"
#include "private/qobject_p.h"
#include "QtGui/qtextdocument.h"
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index ad537b7126..e228b3c840 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
static QString pixelToPoint(qreal pixels)
{
// we hardcode 96 DPI, we do the same in the ODF importer to have a perfect roundtrip.
- return QString::number(pixels * 72 / 96) + QString::fromLatin1("pt");
+ return QString::number(pixels * 72 / 96) + QLatin1String("pt");
}
// strategies
@@ -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/text/qtextodfwriter_p.h b/src/gui/text/qtextodfwriter_p.h
index d4cd91f8a3..d0dd7d2b5c 100644
--- a/src/gui/text/qtextodfwriter_p.h
+++ b/src/gui/text/qtextodfwriter_p.h
@@ -40,7 +40,7 @@
#ifndef QTEXTODFWRITER_H
#define QTEXTODFWRITER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_TEXTODFWRITER
@@ -48,9 +48,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index f9c24ffeaf..9ef9cee9bb 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -40,6 +40,7 @@
#ifndef QTEXTOPTION_H
#define QTEXTOPTION_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qchar.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h
index 14525aae25..ee8e974396 100644
--- a/src/gui/text/qtexttable.h
+++ b/src/gui/text/qtexttable.h
@@ -40,7 +40,7 @@
#ifndef QTEXTTABLE_H
#define QTEXTTABLE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qtextobject.h>
diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h
index 72d9d8c639..848537272d 100644
--- a/src/gui/text/qtexttable_p.h
+++ b/src/gui/text/qtexttable_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qtextobject_p.h"
#include "private/qtextdocument_p.h"
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 7cb89543ba..b68c36fd9e 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -498,11 +498,13 @@ QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const
// fix the file path, if broken (convert separators, eat leading and trailing ones)
fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath);
- while (!fileInfo.filePath.isEmpty() && (fileInfo.filePath.at(0) == QLatin1Char('.') || fileInfo.filePath.at(0) == QLatin1Char('/')))
- fileInfo.filePath = fileInfo.filePath.mid(1);
- while (!fileInfo.filePath.isEmpty() && fileInfo.filePath.at(fileInfo.filePath.size() - 1) == QLatin1Char('/'))
- fileInfo.filePath.chop(1);
+ QStringRef filePathRef(&fileInfo.filePath);
+ while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/')))
+ filePathRef = filePathRef.mid(1);
+ while (filePathRef.endsWith(QLatin1Char('/')))
+ filePathRef.chop(1);
+ fileInfo.filePath = filePathRef.toString();
return fileInfo;
}
diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h
index 5603f0f0d6..eed6ee6a62 100644
--- a/src/gui/text/qzipreader_p.h
+++ b/src/gui/text/qzipreader_p.h
@@ -40,6 +40,7 @@
#ifndef QZIPREADER_H
#define QZIPREADER_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qglobal.h>
#ifndef QT_NO_TEXTODFWRITER
diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h
index 0a4763855e..433bbab31e 100644
--- a/src/gui/text/qzipwriter_p.h
+++ b/src/gui/text/qzipwriter_p.h
@@ -39,7 +39,7 @@
#ifndef QZIPWRITER_H
#define QZIPWRITER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_TEXTODFWRITER
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index be60ba72cc..3fe47a6645 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -85,7 +85,7 @@ SOURCES += \
HEADERS += \
text/qplatformfontdatabase.h
-contains(QT_CONFIG, harfbuzz)|contains(QT_CONFIG, system-harfbuzz) {
+qtConfig(harfbuzz)|qtConfig(system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
include($$PWD/../../3rdparty/harfbuzz_dependency.pri)
diff --git a/src/gui/util/qabstractlayoutstyleinfo_p.h b/src/gui/util/qabstractlayoutstyleinfo_p.h
index b8f3825ada..bf1e1fc852 100644
--- a/src/gui/util/qabstractlayoutstyleinfo_p.h
+++ b/src/gui/util/qabstractlayoutstyleinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qnamespace.h>
#include "qlayoutpolicy_p.h"
diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h
index 3d44ab4a1e..21705e2757 100644
--- a/src/gui/util/qdesktopservices.h
+++ b/src/gui/util/qdesktopservices.h
@@ -40,6 +40,7 @@
#ifndef QDESKTOPSERVICES_H
#define QDESKTOPSERVICES_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qstandardpaths.h>
diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h
index d79d4cc9c9..5f0cc5da73 100644
--- a/src/gui/util/qgridlayoutengine_p.h
+++ b/src/gui/util/qgridlayoutengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qalgorithms.h"
#include "qbitarray.h"
#include "qlist.h"
diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h
index ac11c8ad14..511eec0f1b 100644
--- a/src/gui/util/qhexstring_p.h
+++ b/src/gui/util/qhexstring_p.h
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qpoint.h>
#include <QtCore/qstring.h>
#include <QtGui/qpolygon.h>
diff --git a/src/gui/util/qlayoutpolicy_p.h b/src/gui/util/qlayoutpolicy_p.h
index 979b808563..a729a57e8b 100644
--- a/src/gui/util/qlayoutpolicy_p.h
+++ b/src/gui/util/qlayoutpolicy_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qnamespace.h>
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/gui/util/qvalidator.h b/src/gui/util/qvalidator.h
index 85787a66c6..eba4b54672 100644
--- a/src/gui/util/qvalidator.h
+++ b/src/gui/util/qvalidator.h
@@ -41,6 +41,7 @@
#ifndef QVALIDATOR_H
#define QVALIDATOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
#include <QtCore/qregexp.h>
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index 38e9c25269..70ace3f55e 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -37,7 +37,9 @@ HEADERS += \
access/qnetworkdiskcache.h \
access/qhttpthreaddelegate_p.h \
access/qhttpmultipart.h \
- access/qhttpmultipart_p.h
+ access/qhttpmultipart_p.h \
+ access/qnetworkfile_p.h \
+ access/qhttp2protocolhandler_p.h
SOURCES += \
access/qftp.cpp \
@@ -68,8 +70,11 @@ SOURCES += \
access/qabstractnetworkcache.cpp \
access/qnetworkdiskcache.cpp \
access/qhttpthreaddelegate.cpp \
- access/qhttpmultipart.cpp
+ access/qhttpmultipart.cpp \
+ access/qnetworkfile.cpp \
+ access/qhttp2protocolhandler.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..e9f30aeb4a
--- /dev/null
+++ b/src/network/access/http2/http2.pri
@@ -0,0 +1,17 @@
+HEADERS += \
+ access/http2/bitstreams_p.h \
+ access/http2/huffman_p.h \
+ access/http2/hpack_p.h \
+ access/http2/hpacktable_p.h \
+ access/http2/http2frames_p.h \
+ access/http2/http2streams_p.h \
+ access/http2/http2protocol_p.h
+
+SOURCES += \
+ access/http2/bitstreams.cpp \
+ access/http2/huffman.cpp \
+ access/http2/hpack.cpp \
+ access/http2/hpacktable.cpp \
+ access/http2/http2frames.cpp \
+ access/http2/http2streams.cpp \
+ access/http2/http2protocol.cpp
diff --git a/src/network/access/http2/http2frames.cpp b/src/network/access/http2/http2frames.cpp
new file mode 100644
index 0000000000..978bee09b1
--- /dev/null
+++ b/src/network/access/http2/http2frames.cpp
@@ -0,0 +1,495 @@
+/****************************************************************************
+**
+** 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 "http2frames_p.h"
+
+#include <QtNetwork/qabstractsocket.h>
+
+#include <algorithm>
+#include <utility>
+
+QT_BEGIN_NAMESPACE
+
+namespace Http2
+{
+
+// HTTP/2 frames are defined by RFC7540, clauses 4 and 6.
+
+Frame::Frame()
+ : buffer(frameHeaderSize)
+{
+}
+
+FrameType Frame::type() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+
+ if (int(buffer[3]) >= int(FrameType::LAST_FRAME_TYPE))
+ return FrameType::LAST_FRAME_TYPE;
+
+ return FrameType(buffer[3]);
+}
+
+quint32 Frame::streamID() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ return qFromBigEndian<quint32>(&buffer[5]);
+}
+
+FrameFlags Frame::flags() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ return FrameFlags(buffer[4]);
+}
+
+quint32 Frame::payloadSize() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ return buffer[0] << 16 | buffer[1] << 8 | buffer[2];
+}
+
+uchar Frame::padding() const
+{
+ Q_ASSERT(validateHeader() == FrameStatus::goodFrame);
+
+ if (!flags().testFlag(FrameFlag::PADDED))
+ return 0;
+
+ switch (type()) {
+ case FrameType::DATA:
+ case FrameType::PUSH_PROMISE:
+ case FrameType::HEADERS:
+ Q_ASSERT(buffer.size() > frameHeaderSize);
+ return buffer[frameHeaderSize];
+ default:
+ return 0;
+ }
+}
+
+bool Frame::priority(quint32 *streamID, uchar *weight) const
+{
+ Q_ASSERT(validatePayload() == FrameStatus::goodFrame);
+
+ if (buffer.size() <= frameHeaderSize)
+ return false;
+
+ const uchar *src = &buffer[0] + frameHeaderSize;
+ if (type() == FrameType::HEADERS && flags().testFlag(FrameFlag::PADDED))
+ ++src;
+
+ if ((type() == FrameType::HEADERS && flags().testFlag(FrameFlag::PRIORITY))
+ || type() == FrameType::PRIORITY) {
+ if (streamID)
+ *streamID = qFromBigEndian<quint32>(src);
+ if (weight)
+ *weight = src[4];
+ return true;
+ }
+
+ return false;
+}
+
+FrameStatus Frame::validateHeader() const
+{
+ // Should be called only on a frame with
+ // a complete header.
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+
+ const auto framePayloadSize = payloadSize();
+ // 4.2 Frame Size
+ if (framePayloadSize > maxPayloadSize)
+ return FrameStatus::sizeError;
+
+ switch (type()) {
+ case FrameType::SETTINGS:
+ // SETTINGS ACK can not have any payload.
+ // The payload of a SETTINGS frame consists of zero
+ // or more parameters, each consisting of an unsigned
+ // 16-bit setting identifier and an unsigned 32-bit value.
+ // Thus the payload size must be a multiple of 6.
+ if (flags().testFlag(FrameFlag::ACK) ? framePayloadSize : framePayloadSize % 6)
+ return FrameStatus::sizeError;
+ break;
+ case FrameType::PRIORITY:
+ // 6.3 PRIORITY
+ if (framePayloadSize != 5)
+ return FrameStatus::sizeError;
+ break;
+ case FrameType::PING:
+ // 6.7 PING
+ if (framePayloadSize != 8)
+ return FrameStatus::sizeError;
+ break;
+ case FrameType::GOAWAY:
+ // 6.8 GOAWAY
+ if (framePayloadSize < 8)
+ return FrameStatus::sizeError;
+ break;
+ case FrameType::RST_STREAM:
+ case FrameType::WINDOW_UPDATE:
+ // 6.4 RST_STREAM, 6.9 WINDOW_UPDATE
+ if (framePayloadSize != 4)
+ return FrameStatus::sizeError;
+ break;
+ case FrameType::PUSH_PROMISE:
+ // 6.6 PUSH_PROMISE
+ if (framePayloadSize < 4)
+ return FrameStatus::sizeError;
+ default:
+ // DATA/HEADERS/CONTINUATION will be verified
+ // when we have payload.
+ // Frames of unknown types are ignored (5.1)
+ break;
+ }
+
+ return FrameStatus::goodFrame;
+}
+
+FrameStatus Frame::validatePayload() const
+{
+ // Should be called only on a complete frame with a valid header.
+ Q_ASSERT(validateHeader() == FrameStatus::goodFrame);
+
+ // Ignored, 5.1
+ if (type() == FrameType::LAST_FRAME_TYPE)
+ return FrameStatus::goodFrame;
+
+ auto size = payloadSize();
+ Q_ASSERT(buffer.size() >= frameHeaderSize && size == buffer.size() - frameHeaderSize);
+
+ const uchar *src = size ? &buffer[0] + frameHeaderSize : nullptr;
+ const auto frameFlags = flags();
+ switch (type()) {
+ // 6.1 DATA, 6.2 HEADERS
+ case FrameType::DATA:
+ case FrameType::HEADERS:
+ if (frameFlags.testFlag(FrameFlag::PADDED)) {
+ if (!size || size < src[0])
+ return FrameStatus::sizeError;
+ size -= src[0];
+ }
+ if (type() == FrameType::HEADERS && frameFlags.testFlag(FrameFlag::PRIORITY)) {
+ if (size < 5)
+ return FrameStatus::sizeError;
+ }
+ break;
+ // 6.6 PUSH_PROMISE
+ case FrameType::PUSH_PROMISE:
+ if (frameFlags.testFlag(FrameFlag::PADDED)) {
+ if (!size || size < src[0])
+ return FrameStatus::sizeError;
+ size -= src[0];
+ }
+
+ if (size < 4)
+ return FrameStatus::sizeError;
+ break;
+ default:
+ break;
+ }
+
+ return FrameStatus::goodFrame;
+}
+
+
+quint32 Frame::dataSize() const
+{
+ Q_ASSERT(validatePayload() == FrameStatus::goodFrame);
+
+ quint32 size = payloadSize();
+ if (const uchar pad = padding()) {
+ // + 1 one for a byte with padding number itself:
+ size -= pad + 1;
+ }
+
+ if (priority())
+ size -= 5;
+
+ return size;
+}
+
+const uchar *Frame::dataBegin() const
+{
+ Q_ASSERT(validatePayload() == FrameStatus::goodFrame);
+ if (buffer.size() <= frameHeaderSize)
+ return nullptr;
+
+ const uchar *src = &buffer[0] + frameHeaderSize;
+ if (padding())
+ ++src;
+
+ if (priority())
+ src += 5;
+
+ return src;
+}
+
+FrameStatus FrameReader::read(QAbstractSocket &socket)
+{
+ if (offset < frameHeaderSize) {
+ if (!readHeader(socket))
+ return FrameStatus::incompleteFrame;
+
+ const auto status = frame.validateHeader();
+ if (status != FrameStatus::goodFrame) {
+ // No need to read any payload.
+ return status;
+ }
+
+ if (Http2PredefinedParameters::maxFrameSize < frame.payloadSize())
+ return FrameStatus::sizeError;
+
+ frame.buffer.resize(frame.payloadSize() + frameHeaderSize);
+ }
+
+ if (offset < frame.buffer.size() && !readPayload(socket))
+ return FrameStatus::incompleteFrame;
+
+ // Reset the offset, our frame can be re-used
+ // now (re-read):
+ offset = 0;
+
+ return frame.validatePayload();
+}
+
+bool FrameReader::readHeader(QAbstractSocket &socket)
+{
+ Q_ASSERT(offset < frameHeaderSize);
+
+ auto &buffer = frame.buffer;
+ if (buffer.size() < frameHeaderSize)
+ buffer.resize(frameHeaderSize);
+
+ const auto chunkSize = socket.read(reinterpret_cast<char *>(&buffer[offset]),
+ frameHeaderSize - offset);
+ if (chunkSize > 0)
+ offset += chunkSize;
+
+ return offset == frameHeaderSize;
+}
+
+bool FrameReader::readPayload(QAbstractSocket &socket)
+{
+ Q_ASSERT(offset < frame.buffer.size());
+ Q_ASSERT(frame.buffer.size() > frameHeaderSize);
+
+ auto &buffer = frame.buffer;
+ // Casts and ugliness - to deal with MSVC. Values are guaranteed to fit into quint32.
+ const auto chunkSize = socket.read(reinterpret_cast<char *>(&buffer[offset]),
+ qint64(buffer.size() - offset));
+ if (chunkSize > 0)
+ offset += quint32(chunkSize);
+
+ return offset == buffer.size();
+}
+
+FrameWriter::FrameWriter()
+{
+}
+
+FrameWriter::FrameWriter(FrameType type, FrameFlags flags, quint32 streamID)
+{
+ start(type, flags, streamID);
+}
+
+void FrameWriter::start(FrameType type, FrameFlags flags, quint32 streamID)
+{
+ auto &buffer = frame.buffer;
+
+ buffer.resize(frameHeaderSize);
+ // The first three bytes - payload size, which is 0 for now.
+ buffer[0] = 0;
+ buffer[1] = 0;
+ buffer[2] = 0;
+
+ buffer[3] = uchar(type);
+ buffer[4] = uchar(flags);
+
+ qToBigEndian(streamID, &buffer[5]);
+}
+
+void FrameWriter::setPayloadSize(quint32 size)
+{
+ auto &buffer = frame.buffer;
+
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ Q_ASSERT(size < maxPayloadSize);
+
+ buffer[0] = size >> 16;
+ buffer[1] = size >> 8;
+ buffer[2] = size;
+}
+
+void FrameWriter::setType(FrameType type)
+{
+ Q_ASSERT(frame.buffer.size() >= frameHeaderSize);
+ frame.buffer[3] = uchar(type);
+}
+
+void FrameWriter::setFlags(FrameFlags flags)
+{
+ Q_ASSERT(frame.buffer.size() >= frameHeaderSize);
+ frame.buffer[4] = uchar(flags);
+}
+
+void FrameWriter::addFlag(FrameFlag flag)
+{
+ setFlags(frame.flags() | flag);
+}
+
+void FrameWriter::append(const uchar *begin, const uchar *end)
+{
+ Q_ASSERT(begin && end);
+ Q_ASSERT(begin < end);
+
+ frame.buffer.insert(frame.buffer.end(), begin, end);
+ updatePayloadSize();
+}
+
+void FrameWriter::updatePayloadSize()
+{
+ const quint32 size = quint32(frame.buffer.size() - frameHeaderSize);
+ Q_ASSERT(size <= maxPayloadSize);
+ setPayloadSize(size);
+}
+
+bool FrameWriter::write(QAbstractSocket &socket) const
+{
+ auto &buffer = frame.buffer;
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ // Do some sanity check first:
+
+ Q_ASSERT(int(frame.type()) < int(FrameType::LAST_FRAME_TYPE));
+ Q_ASSERT(frame.validateHeader() == FrameStatus::goodFrame);
+
+ const auto nWritten = socket.write(reinterpret_cast<const char *>(&buffer[0]),
+ buffer.size());
+ return nWritten != -1 && size_type(nWritten) == buffer.size();
+}
+
+bool FrameWriter::writeHEADERS(QAbstractSocket &socket, quint32 sizeLimit)
+{
+ auto &buffer = frame.buffer;
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+
+ if (sizeLimit > quint32(maxPayloadSize))
+ sizeLimit = quint32(maxPayloadSize);
+
+ if (quint32(buffer.size() - frameHeaderSize) <= sizeLimit) {
+ addFlag(FrameFlag::END_HEADERS);
+ updatePayloadSize();
+ return write(socket);
+ }
+
+ // Our HPACK block does not fit into the size limit, remove
+ // END_HEADERS bit from the first frame, we'll later set
+ // it on the last CONTINUATION frame:
+ setFlags(frame.flags() & ~FrameFlags(FrameFlag::END_HEADERS));
+ // Write a frame's header (not controlled by sizeLimit) and
+ // as many bytes of payload as we can within sizeLimit,
+ // then send CONTINUATION frames, as needed.
+ setPayloadSize(sizeLimit);
+ const quint32 firstChunkSize = frameHeaderSize + sizeLimit;
+ qint64 written = socket.write(reinterpret_cast<const char *>(&buffer[0]),
+ firstChunkSize);
+
+ if (written != qint64(firstChunkSize))
+ return false;
+
+ FrameWriter continuationWriter(FrameType::CONTINUATION, FrameFlag::EMPTY, frame.streamID());
+ quint32 offset = firstChunkSize;
+
+ while (offset != buffer.size()) {
+ const auto chunkSize = std::min(sizeLimit, quint32(buffer.size() - offset));
+ if (chunkSize + offset == buffer.size())
+ continuationWriter.addFlag(FrameFlag::END_HEADERS);
+ continuationWriter.setPayloadSize(chunkSize);
+ if (!continuationWriter.write(socket))
+ return false;
+ written = socket.write(reinterpret_cast<const char *>(&buffer[offset]),
+ chunkSize);
+ if (written != qint64(chunkSize))
+ return false;
+
+ offset += chunkSize;
+ }
+
+ return true;
+}
+
+bool FrameWriter::writeDATA(QAbstractSocket &socket, quint32 sizeLimit,
+ const uchar *src, quint32 size)
+{
+ // With DATA frame(s) we always have:
+ // 1) frame's header (9 bytes)
+ // 2) a separate payload (from QNonContiguousByteDevice).
+ // We either fit within a sizeLimit, or split into several
+ // DATA frames.
+
+ Q_ASSERT(src);
+
+ if (sizeLimit > quint32(maxPayloadSize))
+ sizeLimit = quint32(maxPayloadSize);
+ // We NEVER set END_STREAM, since QHttp2ProtocolHandler works with
+ // QNonContiguousByteDevice and this 'writeDATA' is probably
+ // not the last one for a given request.
+ // This has to be done externally (sending an empty DATA frame with END_STREAM).
+ for (quint32 offset = 0; offset != size;) {
+ const auto chunkSize = std::min(size - offset, sizeLimit);
+ setPayloadSize(chunkSize);
+ // Frame's header first:
+ if (!write(socket))
+ return false;
+ // Payload (if any):
+ if (chunkSize) {
+ const auto written = socket.write(reinterpret_cast<const char*>(src + offset),
+ chunkSize);
+ if (written != qint64(chunkSize))
+ return false;
+ }
+
+ offset += chunkSize;
+ }
+
+ return true;
+}
+
+} // Namespace Http2
+
+QT_END_NAMESPACE
diff --git a/src/network/access/http2/http2frames_p.h b/src/network/access/http2/http2frames_p.h
new file mode 100644
index 0000000000..84ba9c3662
--- /dev/null
+++ b/src/network/access/http2/http2frames_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 HTTP2FRAMES_P_H
+#define HTTP2FRAMES_P_H
+
+//
+// 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.
+//
+
+#include "http2protocol_p.h"
+#include "hpack_p.h"
+
+#include <QtCore/qendian.h>
+#include <QtCore/qglobal.h>
+
+#include <algorithm>
+#include <vector>
+
+QT_BEGIN_NAMESPACE
+
+class QHttp2ProtocolHandler;
+class QAbstractSocket;
+
+namespace Http2
+{
+
+struct Q_AUTOTEST_EXPORT Frame
+{
+ Frame();
+ // Reading these values without first forming a valid frame
+ // (either reading it from a socket or building it) will result
+ // in undefined behavior:
+ FrameType type() const;
+ quint32 streamID() const;
+ FrameFlags flags() const;
+ quint32 payloadSize() const;
+ uchar padding() const;
+ // In HTTP/2 a stream's priority is specified by its weight
+ // and a stream (id) it depends on:
+ bool priority(quint32 *streamID = nullptr,
+ uchar *weight = nullptr) const;
+
+ FrameStatus validateHeader() const;
+ FrameStatus validatePayload() const;
+
+ // Number of payload bytes without padding and/or priority
+ quint32 dataSize() const;
+ // Beginning of payload without priority/padding
+ // bytes.
+ const uchar *dataBegin() const;
+
+ std::vector<uchar> buffer;
+};
+
+class Q_AUTOTEST_EXPORT FrameReader
+{
+public:
+ FrameStatus read(QAbstractSocket &socket);
+
+ Frame &inboundFrame()
+ {
+ return frame;
+ }
+private:
+ bool readHeader(QAbstractSocket &socket);
+ bool readPayload(QAbstractSocket &socket);
+
+ quint32 offset = 0;
+ Frame frame;
+};
+
+class Q_AUTOTEST_EXPORT FrameWriter
+{
+public:
+ using payload_type = std::vector<uchar>;
+ using size_type = payload_type::size_type;
+
+ FrameWriter();
+ FrameWriter(FrameType type, FrameFlags flags, quint32 streamID);
+
+ Frame &outboundFrame()
+ {
+ return frame;
+ }
+
+ // Frame 'builders':
+ void start(FrameType type, FrameFlags flags, quint32 streamID);
+ void setPayloadSize(quint32 size);
+ void setType(FrameType type);
+ void setFlags(FrameFlags flags);
+ void addFlag(FrameFlag flag);
+
+ // All append functions also update frame's payload
+ // length.
+ template<typename ValueType>
+ void append(ValueType val)
+ {
+ uchar wired[sizeof val] = {};
+ qToBigEndian(val, wired);
+ append(wired, wired + sizeof val);
+ }
+ void append(uchar val)
+ {
+ frame.buffer.push_back(val);
+ updatePayloadSize();
+ }
+ void append(Settings identifier)
+ {
+ append(quint16(identifier));
+ }
+ void append(const payload_type &payload)
+ {
+ append(&payload[0], &payload[0] + payload.size());
+ }
+
+ void append(const uchar *begin, const uchar *end);
+
+ // Write as a single frame:
+ bool write(QAbstractSocket &socket) const;
+ // Two types of frames we are sending are affected by
+ // frame size limits: HEADERS and DATA. HEADERS' payload
+ // (hpacked HTTP headers, following a frame header)
+ // is always in our 'buffer', we send the initial HEADERS
+ // frame first and then CONTINUTATION frame(s) if needed:
+ bool writeHEADERS(QAbstractSocket &socket, quint32 sizeLimit);
+ // With DATA frames the actual payload is never in our 'buffer',
+ // it's a 'readPointer' from QNonContiguousData. We split
+ // this payload as needed into DATA frames with correct
+ // payload size fitting into frame size limit:
+ bool writeDATA(QAbstractSocket &socket, quint32 sizeLimit,
+ const uchar *src, quint32 size);
+private:
+ void updatePayloadSize();
+ Frame frame;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/network/access/http2/http2protocol.cpp b/src/network/access/http2/http2protocol.cpp
new file mode 100644
index 0000000000..7f788a6f42
--- /dev/null
+++ b/src/network/access/http2/http2protocol.cpp
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** 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 <QtCore/qstring.h>
+
+#include "http2protocol_p.h"
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(QT_HTTP2, "qt.network.http2")
+
+namespace Http2
+{
+
+// 3.5 HTTP/2 Connection Preface:
+// "That is, the connection preface starts with the string
+// PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n)."
+const char Http2clientPreface[clientPrefaceLength] =
+ {0x50, 0x52, 0x49, 0x20, 0x2a, 0x20,
+ 0x48, 0x54, 0x54, 0x50, 0x2f, 0x32,
+ 0x2e, 0x30, 0x0d, 0x0a, 0x0d, 0x0a,
+ 0x53, 0x4d, 0x0d, 0x0a, 0x0d, 0x0a};
+
+
+void qt_error(quint32 errorCode, QNetworkReply::NetworkError &error,
+ QString &errorMessage)
+{
+ if (errorCode > quint32(HTTP_1_1_REQUIRED)) {
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("RST_STREAM with unknown error code (%1)");
+ errorMessage = errorMessage.arg(errorCode);
+ return;
+ }
+
+ const Http2Error http2Error = Http2Error(errorCode);
+
+ switch (http2Error) {
+ case HTTP2_NO_ERROR:
+ error = QNetworkReply::NoError;
+ errorMessage.clear();
+ break;
+ case PROTOCOL_ERROR:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("HTTP/2 protocol error");
+ break;
+ case INTERNAL_ERROR:
+ error = QNetworkReply::InternalServerError;
+ errorMessage = QLatin1String("Internal server error");
+ break;
+ case FLOW_CONTROL_ERROR:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("Flow control error");
+ break;
+ case SETTINGS_TIMEOUT:
+ error = QNetworkReply::TimeoutError;
+ errorMessage = QLatin1String("SETTINGS ACK timeout error");
+ break;
+ case STREAM_CLOSED:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("Server received frame(s) on a half-closed stream");
+ break;
+ case FRAME_SIZE_ERROR:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("Server received a frame with an invalid size");
+ break;
+ case REFUSE_STREAM:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("Server refused a stream");
+ break;
+ case CANCEL:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("Stream is no longer needed");
+ break;
+ case COMPRESSION_ERROR:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("Server is unable to maintain the "
+ "header compression context for the connection");
+ break;
+ case CONNECT_ERROR:
+ // TODO: in Qt6 we'll have to add more error codes in QNetworkReply.
+ error = QNetworkReply::UnknownNetworkError;
+ errorMessage = QLatin1String("The connection established in response "
+ "to a CONNECT request was reset or abnormally closed");
+ break;
+ case ENHANCE_YOUR_CALM:
+ error = QNetworkReply::UnknownServerError;
+ errorMessage = QLatin1String("Server dislikes our behavior, excessive load detected.");
+ break;
+ case INADEQUATE_SECURITY:
+ error = QNetworkReply::ContentAccessDenied;
+ errorMessage = QLatin1String("The underlying transport has properties "
+ "that do not meet minimum security "
+ "requirements");
+ break;
+ case HTTP_1_1_REQUIRED:
+ error = QNetworkReply::ProtocolFailure;
+ errorMessage = QLatin1String("Server requires that HTTP/1.1 "
+ "be used instead of HTTP/2.");
+ }
+}
+
+QString qt_error_string(quint32 errorCode)
+{
+ QNetworkReply::NetworkError error = QNetworkReply::NoError;
+ QString message;
+ qt_error(errorCode, error, message);
+ return message;
+}
+
+QNetworkReply::NetworkError qt_error(quint32 errorCode)
+{
+ QNetworkReply::NetworkError error = QNetworkReply::NoError;
+ QString message;
+ qt_error(errorCode, error, message);
+ return error;
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/access/http2/http2protocol_p.h b/src/network/access/http2/http2protocol_p.h
new file mode 100644
index 0000000000..5c46949e23
--- /dev/null
+++ b/src/network/access/http2/http2protocol_p.h
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** 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 HTTP2PROTOCOL_P_H
+#define HTTP2PROTOCOL_P_H
+
+//
+// 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.
+//
+
+#include <QtNetwork/qnetworkreply.h>
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/qglobal.h>
+
+// Different HTTP/2 constants/values as defined by RFC 7540.
+
+QT_BEGIN_NAMESPACE
+
+class QString;
+
+namespace Http2
+{
+
+enum class Settings : quint16
+{
+ HEADER_TABLE_SIZE_ID = 0x1,
+ ENABLE_PUSH_ID = 0x2,
+ MAX_CONCURRENT_STREAMS_ID = 0x3,
+ INITIAL_WINDOW_SIZE_ID = 0x4,
+ MAX_FRAME_SIZE_ID = 0x5,
+ MAX_HEADER_LIST_SIZE_ID = 0x6
+};
+
+enum class FrameType : uchar
+{
+ DATA = 0x0,
+ HEADERS = 0x1,
+ PRIORITY = 0x2,
+ RST_STREAM = 0x3,
+ SETTINGS = 0x4,
+ PUSH_PROMISE = 0x5,
+ PING = 0x6,
+ GOAWAY = 0x7,
+ WINDOW_UPDATE = 0x8,
+ CONTINUATION = 0x9,
+ // ATTENTION: enumerators must be sorted.
+ // We use LAST_FRAME_TYPE to check if
+ // frame type is known, if not - this frame
+ // must be ignored, HTTP/2 5.1).
+ LAST_FRAME_TYPE
+};
+
+enum class FrameFlag : uchar
+{
+ EMPTY = 0x0, // Valid for any frame type.
+ ACK = 0x1, // Valid for PING, SETTINGS
+ END_STREAM = 0x1, // Valid for HEADERS, DATA
+ END_HEADERS = 0x4, // Valid for PUSH_PROMISE, HEADERS,
+ PADDED = 0x8, // Valid for PUSH_PROMISE, HEADERS, DATA
+ PRIORITY = 0x20 // Valid for HEADERS,
+};
+
+Q_DECLARE_FLAGS(FrameFlags, FrameFlag)
+Q_DECLARE_OPERATORS_FOR_FLAGS(FrameFlags)
+
+enum Http2PredefinedParameters
+{
+ // Old-style enum, so we
+ // can use as Http2::frameHeaderSize for example.
+ clientPrefaceLength = 24, // HTTP/2, 3.5
+ connectionStreamID = 0, // HTTP/2, 5.1.1
+ frameHeaderSize = 9, // HTTP/2, 4.1
+
+ // It's our max frame size we send in SETTINGS frame,
+ // it's also the default one and we also use it to later
+ // validate incoming frames:
+ maxFrameSize = 16384, // HTTP/2 6.5.2
+
+ defaultSessionWindowSize = 65535, // HTTP/2 6.5.2
+ maxPayloadSize = (1 << 24) - 1, // HTTP/2 6.5.2
+ // Using 1000 (rather arbitrarily), just to
+ // impose *some* upper limit:
+ maxPeerConcurrentStreams = 1000,
+ maxConcurrentStreams = 100 // HTTP/2, 6.5.2
+};
+
+extern const Q_AUTOTEST_EXPORT char Http2clientPreface[clientPrefaceLength];
+
+enum class FrameStatus
+{
+ protocolError,
+ sizeError,
+ incompleteFrame,
+ goodFrame
+};
+
+enum Http2Error
+{
+ // Old-style enum to avoid excessive name
+ // qualification ...
+ // NB:
+ // I use the last enumerator to check
+ // that errorCode (quint32) is valid,
+ // so it needs to be the highest-numbered!
+ // HTTP/2 7:
+ HTTP2_NO_ERROR = 0x0,
+ PROTOCOL_ERROR = 0x1,
+ INTERNAL_ERROR = 0x2,
+ FLOW_CONTROL_ERROR = 0x3,
+ SETTINGS_TIMEOUT = 0x4,
+ STREAM_CLOSED = 0x5,
+ FRAME_SIZE_ERROR = 0x6,
+ REFUSE_STREAM = 0x7,
+ CANCEL = 0x8,
+ COMPRESSION_ERROR = 0x9,
+ CONNECT_ERROR = 0xa,
+ ENHANCE_YOUR_CALM = 0xb,
+ INADEQUATE_SECURITY = 0xc,
+ HTTP_1_1_REQUIRED = 0xd
+};
+
+void qt_error(quint32 errorCode, QNetworkReply::NetworkError &error, QString &errorString);
+QString qt_error_string(quint32 errorCode);
+QNetworkReply::NetworkError qt_error(quint32 errorCode);
+
+}
+
+Q_DECLARE_LOGGING_CATEGORY(QT_HTTP2)
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/tools/qdatetime_mac.mm b/src/network/access/http2/http2streams.cpp
index d61ea28636..660100f5e4 100644
--- a/src/corelib/tools/qdatetime_mac.mm
+++ b/src/network/access/http2/http2streams.cpp
@@ -1,10 +1,9 @@
/****************************************************************************
**
** 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.
+** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -38,37 +37,68 @@
**
****************************************************************************/
-#include "qdatetime.h"
+#include "http2streams_p.h"
-#import <Foundation/Foundation.h>
+#include "private/qhttp2protocolhandler_p.h"
+#include "private/qhttpnetworkreply_p.h"
+
+#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-QDateTime QDateTime::fromCFDate(CFDateRef date)
+namespace Http2
+{
+
+Stream::Stream()
+{
+}
+
+Stream::Stream(const HttpMessagePair &message, quint32 id, qint32 sendSize, qint32 recvSize)
+ : httpPair(message),
+ streamID(id),
+ sendWindow(sendSize),
+ recvWindow(recvSize)
+{
+}
+
+QHttpNetworkReply *Stream::reply() const
{
- if (!date)
- return QDateTime();
- return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>((CFDateGetAbsoluteTime(date)
- + kCFAbsoluteTimeIntervalSince1970) * 1000));
+ return httpPair.second;
}
-CFDateRef QDateTime::toCFDate() const
+const QHttpNetworkRequest &Stream::request() const
{
- return CFDateCreate(kCFAllocatorDefault, (static_cast<CFAbsoluteTime>(toMSecsSinceEpoch())
- / 1000) - kCFAbsoluteTimeIntervalSince1970);
+ return httpPair.first;
}
-QDateTime QDateTime::fromNSDate(const NSDate *date)
+QHttpNetworkRequest &Stream::request()
{
- if (!date)
- return QDateTime();
- return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>([date timeIntervalSince1970] * 1000));
+ return httpPair.first;
}
-NSDate *QDateTime::toNSDate() const
+QHttpNetworkRequest::Priority Stream::priority() const
{
- return [NSDate
- dateWithTimeIntervalSince1970:static_cast<NSTimeInterval>(toMSecsSinceEpoch()) / 1000];
+ return httpPair.first.priority();
+}
+
+uchar Stream::weight() const
+{
+ switch (priority()) {
+ case QHttpNetworkRequest::LowPriority:
+ return 0;
+ case QHttpNetworkRequest::NormalPriority:
+ return 127;
+ case QHttpNetworkRequest::HighPriority:
+ default:
+ return 255;
+ }
+}
+
+QNonContiguousByteDevice *Stream::data() const
+{
+ return httpPair.first.uploadByteDevice();
+}
+
}
QT_END_NAMESPACE
diff --git a/src/network/access/http2/http2streams_p.h b/src/network/access/http2/http2streams_p.h
new file mode 100644
index 0000000000..8a825a5457
--- /dev/null
+++ b/src/network/access/http2/http2streams_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** 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 HTTP2STREAMS_P_H
+#define HTTP2STREAMS_P_H
+
+//
+// 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.
+//
+
+#include <private/qhttpnetworkconnectionchannel_p.h>
+#include <private/qhttpnetworkrequest_p.h>
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNonContiguousByteDevice;
+
+namespace Http2
+{
+
+struct Q_AUTOTEST_EXPORT Stream
+{
+ enum StreamState {
+ idle,
+ open,
+ halfClosedLocal,
+ halfClosedRemote,
+ closed
+ };
+
+ Stream();
+ Stream(const HttpMessagePair &message, quint32 streamID, qint32 sendSize,
+ qint32 recvSize);
+
+ QHttpNetworkReply *reply() const;
+ const QHttpNetworkRequest &request() const;
+ QHttpNetworkRequest &request();
+ QHttpNetworkRequest::Priority priority() const;
+ uchar weight() const;
+
+ QNonContiguousByteDevice *data() const;
+
+ HttpMessagePair httpPair;
+ quint32 streamID = 0;
+ // Signed as window sizes can become negative:
+ qint32 sendWindow = 65535;
+ qint32 recvWindow = 65535;
+
+ StreamState state = idle;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif
+
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/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h
index 6b80147757..33b0bc4ce3 100644
--- a/src/network/access/qabstractnetworkcache.h
+++ b/src/network/access/qabstractnetworkcache.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTNETWORKCACHE_H
#define QABSTRACTNETWORKCACHE_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qpair.h>
diff --git a/src/network/access/qabstractnetworkcache_p.h b/src/network/access/qabstractnetworkcache_p.h
index 7be89f22b6..fee723e315 100644
--- a/src/network/access/qabstractnetworkcache_p.h
+++ b/src/network/access/qabstractnetworkcache_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "private/qobject_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/network/access/qabstractprotocolhandler_p.h b/src/network/access/qabstractprotocolhandler_p.h
index a05df3e429..30814d6737 100644
--- a/src/network/access/qabstractprotocolhandler_p.h
+++ b/src/network/access/qabstractprotocolhandler_p.h
@@ -51,9 +51,9 @@
// We mean it.
//
-#ifndef QT_NO_HTTP
+#include <QtNetwork/private/qtnetworkglobal_p.h>
-#include <QtCore/qglobal.h>
+#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index 7b6f830333..52b9dd9169 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -1121,7 +1121,7 @@ bool QFtpPI::processReply()
case Success:
// success handling
state = Idle;
- // no break!
+ Q_FALLTHROUGH();
case Idle:
if (dtp.hasError()) {
emit error(QFtp::UnknownError, dtp.errorMessage());
diff --git a/src/network/access/qftp_p.h b/src/network/access/qftp_p.h
index 37f8f2f8d2..6cf5116798 100644
--- a/src/network/access/qftp_p.h
+++ b/src/network/access/qftp_p.h
@@ -48,9 +48,10 @@
// We mean it.
//
-#ifndef QFTP_H
-#define QFTP_H
+#ifndef QFTP_P_H
+#define QFTP_P_H
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/qstring.h>
#include <private/qurlinfo_p.h>
#include <QtCore/qobject.h>
@@ -172,4 +173,4 @@ private:
QT_END_NAMESPACE
-#endif // QFTP_H
+#endif // QFTP_P_H
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
new file mode 100644
index 0000000000..68a00c6837
--- /dev/null
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -0,0 +1,1218 @@
+/****************************************************************************
+**
+** 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 "qhttpnetworkconnection_p.h"
+#include "qhttp2protocolhandler_p.h"
+
+#if !defined(QT_NO_HTTP)
+
+#include "http2/bitstreams_p.h"
+
+#include <private/qnoncontiguousbytedevice_p.h>
+
+#include <QtNetwork/qabstractsocket.h>
+#include <QtCore/qloggingcategory.h>
+#include <QtCore/qendian.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qurl.h>
+
+#include <algorithm>
+#include <vector>
+
+QT_BEGIN_NAMESPACE
+
+namespace
+{
+
+HPack::HttpHeader build_headers(const QHttpNetworkRequest &request, quint32 maxHeaderListSize)
+{
+ using namespace HPack;
+
+ HttpHeader header;
+ header.reserve(300);
+
+ // 1. Before anything - mandatory fields, if they do not fit into maxHeaderList -
+ // then stop immediately with error.
+ const auto auth = request.url().authority(QUrl::FullyEncoded | QUrl::RemoveUserInfo).toLatin1();
+ header.push_back(HeaderField(":authority", auth));
+ header.push_back(HeaderField(":method", request.methodName()));
+ header.push_back(HeaderField(":path", request.uri(false)));
+ header.push_back(HeaderField(":scheme", request.url().scheme().toLatin1()));
+
+ HeaderSize size = header_size(header);
+ if (!size.first) // Ooops!
+ return HttpHeader();
+
+ if (size.second > maxHeaderListSize)
+ return HttpHeader(); // Bad, we cannot send this request ...
+
+ for (const auto &field : request.header()) {
+ const HeaderSize delta = entry_size(field.first, field.second);
+ if (!delta.first) // Overflow???
+ break;
+ if (std::numeric_limits<quint32>::max() - delta.second < size.second)
+ break;
+ size.second += delta.second;
+ if (size.second > maxHeaderListSize)
+ break;
+
+ QByteArray key(field.first.toLower());
+ if (key == "connection" || key == "host" || key == "keep-alive"
+ || key == "proxy-connection" || key == "transfer-encoding")
+ continue; // Those headers are not valid (section 3.2.1) - from QSpdyProtocolHandler
+ // TODO: verify with specs, which fields are valid to send ....
+ // toLower - 8.1.2 .... "header field names MUST be converted to lowercase prior
+ // to their encoding in HTTP/2.
+ // A request or response containing uppercase header field names
+ // MUST be treated as malformed (Section 8.1.2.6)".
+ header.push_back(HeaderField(key, field.second));
+ }
+
+ return header;
+}
+
+bool sum_will_overflow(qint32 windowSize, qint32 delta)
+{
+ if (windowSize > 0)
+ return std::numeric_limits<qint32>::max() - windowSize < delta;
+ return std::numeric_limits<qint32>::min() - windowSize > delta;
+}
+
+}// Unnamed namespace
+
+// Since we anyway end up having this in every function definition:
+using namespace Http2;
+
+const std::deque<quint32>::size_type QHttp2ProtocolHandler::maxRecycledStreams = 10000;
+const qint32 QHttp2ProtocolHandler::sessionMaxRecvWindowSize;
+const qint32 QHttp2ProtocolHandler::streamInitialRecvWindowSize;
+const quint32 QHttp2ProtocolHandler::maxAcceptableTableSize;
+
+QHttp2ProtocolHandler::QHttp2ProtocolHandler(QHttpNetworkConnectionChannel *channel)
+ : QAbstractProtocolHandler(channel),
+ decoder(HPack::FieldLookupTable::DefaultSize),
+ encoder(HPack::FieldLookupTable::DefaultSize, true)
+{
+ continuedFrames.reserve(20);
+}
+
+void QHttp2ProtocolHandler::_q_uploadDataReadyRead()
+{
+ auto data = qobject_cast<QNonContiguousByteDevice *>(sender());
+ Q_ASSERT(data);
+ const qint32 streamID = data->property("HTTP2StreamID").toInt();
+ Q_ASSERT(activeStreams.contains(streamID));
+ auto &stream = activeStreams[streamID];
+
+ if (!sendDATA(stream)) {
+ finishStreamWithError(stream, QNetworkReply::UnknownNetworkError,
+ QLatin1String("failed to send DATA"));
+ sendRST_STREAM(streamID, INTERNAL_ERROR);
+ markAsReset(streamID);
+ deleteActiveStream(streamID);
+ }
+}
+
+void QHttp2ProtocolHandler::_q_replyDestroyed(QObject *reply)
+{
+ const quint32 streamID = reply->property("HTTP2StreamID").toInt();
+ if (activeStreams.contains(streamID)) {
+ sendRST_STREAM(streamID, CANCEL);
+ markAsReset(streamID);
+ deleteActiveStream(streamID);
+ }
+}
+
+void QHttp2ProtocolHandler::_q_readyRead()
+{
+ _q_receiveReply();
+}
+
+void QHttp2ProtocolHandler::_q_receiveReply()
+{
+ Q_ASSERT(m_socket);
+ Q_ASSERT(m_channel);
+
+ do {
+ const auto result = frameReader.read(*m_socket);
+ switch (result) {
+ case FrameStatus::incompleteFrame:
+ return;
+ case FrameStatus::protocolError:
+ return connectionError(PROTOCOL_ERROR, "invalid frame");
+ case FrameStatus::sizeError:
+ return connectionError(FRAME_SIZE_ERROR, "invalid frame size");
+ default:
+ break;
+ }
+
+ Q_ASSERT(result == FrameStatus::goodFrame);
+
+ inboundFrame = std::move(frameReader.inboundFrame());
+
+ const auto frameType = inboundFrame.type();
+ if (continuationExpected && frameType != FrameType::CONTINUATION)
+ return connectionError(PROTOCOL_ERROR, "CONTINUATION expected");
+
+ switch (frameType) {
+ case FrameType::DATA:
+ handleDATA();
+ break;
+ case FrameType::HEADERS:
+ handleHEADERS();
+ break;
+ case FrameType::PRIORITY:
+ handlePRIORITY();
+ break;
+ case FrameType::RST_STREAM:
+ handleRST_STREAM();
+ break;
+ case FrameType::SETTINGS:
+ handleSETTINGS();
+ break;
+ case FrameType::PUSH_PROMISE:
+ handlePUSH_PROMISE();
+ break;
+ case FrameType::PING:
+ handlePING();
+ break;
+ case FrameType::GOAWAY:
+ handleGOAWAY();
+ break;
+ case FrameType::WINDOW_UPDATE:
+ handleWINDOW_UPDATE();
+ break;
+ case FrameType::CONTINUATION:
+ handleCONTINUATION();
+ break;
+ case FrameType::LAST_FRAME_TYPE:
+ // 5.1 - ignore unknown frames.
+ break;
+ }
+ } while (!goingAway || activeStreams.size());
+}
+
+bool QHttp2ProtocolHandler::sendRequest()
+{
+ if (goingAway)
+ return false;
+
+ if (!prefaceSent && !sendClientPreface())
+ return false;
+
+ auto &requests = m_channel->spdyRequestsToSend;
+ if (!requests.size())
+ return true;
+
+ const auto streamsToUse = std::min<quint32>(maxConcurrentStreams - activeStreams.size(),
+ requests.size());
+ auto it = requests.begin();
+ m_channel->state = QHttpNetworkConnectionChannel::WritingState;
+ for (quint32 i = 0; i < streamsToUse; ++i) {
+ const qint32 newStreamID = createNewStream(*it);
+ if (!newStreamID) {
+ // TODO: actually we have to open a new connection.
+ qCCritical(QT_HTTP2, "sendRequest: out of stream IDs");
+ break;
+ }
+
+ it = requests.erase(it);
+
+ Stream &newStream = activeStreams[newStreamID];
+ if (!sendHEADERS(newStream)) {
+ finishStreamWithError(newStream, QNetworkReply::UnknownNetworkError,
+ QLatin1String("failed to send HEADERS frame(s)"));
+ deleteActiveStream(newStreamID);
+ continue;
+ }
+
+ if (newStream.data() && !sendDATA(newStream)) {
+ finishStreamWithError(newStream, QNetworkReply::UnknownNetworkError,
+ QLatin1String("failed to send DATA frame(s)"));
+ sendRST_STREAM(newStreamID, INTERNAL_ERROR);
+ markAsReset(newStreamID);
+ deleteActiveStream(newStreamID);
+ }
+ }
+
+ m_channel->state = QHttpNetworkConnectionChannel::IdleState;
+
+ return true;
+}
+
+
+bool QHttp2ProtocolHandler::sendClientPreface()
+{
+ // 3.5 HTTP/2 Connection Preface
+ Q_ASSERT(m_socket);
+
+ if (prefaceSent)
+ return true;
+
+ const qint64 written = m_socket->write(Http2clientPreface,
+ Http2::clientPrefaceLength);
+ if (written != Http2::clientPrefaceLength)
+ return false;
+
+ // 6.5 SETTINGS
+ frameWriter.start(FrameType::SETTINGS, FrameFlag::EMPTY, Http2::connectionStreamID);
+ // MAX frame size (16 kb), disable PUSH
+ frameWriter.append(Settings::MAX_FRAME_SIZE_ID);
+ frameWriter.append(quint32(Http2::maxFrameSize));
+ frameWriter.append(Settings::ENABLE_PUSH_ID);
+ frameWriter.append(quint32(0));
+
+ if (!frameWriter.write(*m_socket))
+ return false;
+
+ sessionRecvWindowSize = sessionMaxRecvWindowSize;
+ if (defaultSessionWindowSize < sessionMaxRecvWindowSize) {
+ const auto delta = sessionMaxRecvWindowSize - defaultSessionWindowSize;
+ if (!sendWINDOW_UPDATE(connectionStreamID, delta))
+ return false;
+ }
+
+ prefaceSent = true;
+ waitingForSettingsACK = true;
+
+ return true;
+}
+
+bool QHttp2ProtocolHandler::sendSETTINGS_ACK()
+{
+ Q_ASSERT(m_socket);
+
+ if (!prefaceSent && !sendClientPreface())
+ return false;
+
+ frameWriter.start(FrameType::SETTINGS, FrameFlag::ACK, Http2::connectionStreamID);
+
+ return frameWriter.write(*m_socket);
+}
+
+bool QHttp2ProtocolHandler::sendHEADERS(Stream &stream)
+{
+ using namespace HPack;
+
+ frameWriter.start(FrameType::HEADERS, FrameFlag::PRIORITY | FrameFlag::END_HEADERS,
+ stream.streamID);
+
+ if (!stream.data()) {
+ frameWriter.addFlag(FrameFlag::END_STREAM);
+ stream.state = Stream::halfClosedLocal;
+ } else {
+ stream.state = Stream::open;
+ }
+
+ frameWriter.append(quint32()); // No stream dependency in Qt.
+ frameWriter.append(stream.weight());
+
+ const auto headers = build_headers(stream.request(), maxHeaderListSize);
+ if (!headers.size()) // nothing fits into maxHeaderListSize
+ return false;
+
+ // Compress in-place:
+ BitOStream outputStream(frameWriter.outboundFrame().buffer);
+ if (!encoder.encodeRequest(outputStream, headers))
+ return false;
+
+ return frameWriter.writeHEADERS(*m_socket, maxFrameSize);
+}
+
+bool QHttp2ProtocolHandler::sendDATA(Stream &stream)
+{
+ Q_ASSERT(maxFrameSize > frameHeaderSize);
+ Q_ASSERT(m_socket);
+ Q_ASSERT(stream.data());
+
+ const auto &request = stream.request();
+ auto reply = stream.reply();
+ Q_ASSERT(reply);
+ const auto replyPrivate = reply->d_func();
+ Q_ASSERT(replyPrivate);
+
+ auto slot = std::min<qint32>(sessionSendWindowSize, stream.sendWindow);
+ while (!stream.data()->atEnd() && slot) {
+ qint64 chunkSize = 0;
+ const uchar *src =
+ reinterpret_cast<const uchar *>(stream.data()->readPointer(slot, chunkSize));
+
+ if (chunkSize == -1)
+ return false;
+
+ if (!src || !chunkSize) {
+ // Stream is not suspended by the flow control,
+ // we do not have data ready yet.
+ return true;
+ }
+
+ frameWriter.start(FrameType::DATA, FrameFlag::EMPTY, stream.streamID);
+ const qint32 bytesWritten = std::min<qint32>(slot, chunkSize);
+
+ if (!frameWriter.writeDATA(*m_socket, maxFrameSize, src, bytesWritten))
+ return false;
+
+ stream.data()->advanceReadPointer(bytesWritten);
+ stream.sendWindow -= bytesWritten;
+ sessionSendWindowSize -= bytesWritten;
+ replyPrivate->totallyUploadedData += bytesWritten;
+ emit reply->dataSendProgress(replyPrivate->totallyUploadedData,
+ request.contentLength());
+ slot = std::min(sessionSendWindowSize, stream.sendWindow);
+ }
+
+ if (replyPrivate->totallyUploadedData == request.contentLength()) {
+ frameWriter.start(FrameType::DATA, FrameFlag::END_STREAM, stream.streamID);
+ frameWriter.setPayloadSize(0);
+ frameWriter.write(*m_socket);
+ stream.state = Stream::halfClosedLocal;
+ stream.data()->disconnect(this);
+ removeFromSuspended(stream.streamID);
+ } else if (!stream.data()->atEnd()) {
+ addToSuspended(stream);
+ }
+
+ return true;
+}
+
+bool QHttp2ProtocolHandler::sendWINDOW_UPDATE(quint32 streamID, quint32 delta)
+{
+ Q_ASSERT(m_socket);
+
+ frameWriter.start(FrameType::WINDOW_UPDATE, FrameFlag::EMPTY, streamID);
+ frameWriter.append(delta);
+ return frameWriter.write(*m_socket);
+}
+
+bool QHttp2ProtocolHandler::sendRST_STREAM(quint32 streamID, quint32 errorCode)
+{
+ Q_ASSERT(m_socket);
+
+ frameWriter.start(FrameType::RST_STREAM, FrameFlag::EMPTY, streamID);
+ frameWriter.append(errorCode);
+ return frameWriter.write(*m_socket);
+}
+
+bool QHttp2ProtocolHandler::sendGOAWAY(quint32 errorCode)
+{
+ Q_ASSERT(m_socket);
+
+ frameWriter.start(FrameType::GOAWAY, FrameFlag::EMPTY, connectionStreamID);
+ frameWriter.append(quint32(connectionStreamID));
+ frameWriter.append(errorCode);
+ return frameWriter.write(*m_socket);
+}
+
+void QHttp2ProtocolHandler::handleDATA()
+{
+ Q_ASSERT(inboundFrame.type() == FrameType::DATA);
+
+ const auto streamID = inboundFrame.streamID();
+ if (streamID == connectionStreamID)
+ return connectionError(PROTOCOL_ERROR, "DATA on stream 0x0");
+
+ if (!activeStreams.contains(streamID) && !streamWasReset(streamID))
+ return connectionError(ENHANCE_YOUR_CALM, "DATA on invalid stream");
+
+ if (qint32(inboundFrame.payloadSize()) > sessionRecvWindowSize)
+ return connectionError(FLOW_CONTROL_ERROR, "Flow control error");
+
+ sessionRecvWindowSize -= inboundFrame.payloadSize();
+
+ if (activeStreams.contains(streamID)) {
+ auto &stream = activeStreams[streamID];
+
+ if (qint32(inboundFrame.payloadSize()) > stream.recvWindow) {
+ finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError,
+ QLatin1String("flow control error"));
+ sendRST_STREAM(streamID, FLOW_CONTROL_ERROR);
+ markAsReset(streamID);
+ deleteActiveStream(streamID);
+ } else {
+ stream.recvWindow -= inboundFrame.payloadSize();
+ // Uncompress data if needed and append it ...
+ updateStream(stream, inboundFrame);
+
+ if (inboundFrame.flags().testFlag(FrameFlag::END_STREAM)) {
+ finishStream(stream);
+ deleteActiveStream(stream.streamID);
+ } else if (stream.recvWindow < streamInitialRecvWindowSize / 2) {
+ QMetaObject::invokeMethod(this, "sendWINDOW_UPDATE", Qt::QueuedConnection,
+ Q_ARG(quint32, stream.streamID),
+ Q_ARG(quint32, streamInitialRecvWindowSize - stream.recvWindow));
+ stream.recvWindow = streamInitialRecvWindowSize;
+ }
+ }
+ }
+
+ if (sessionRecvWindowSize < sessionMaxRecvWindowSize / 2) {
+ QMetaObject::invokeMethod(this, "sendWINDOW_UPDATE", Qt::QueuedConnection,
+ Q_ARG(quint32, connectionStreamID),
+ Q_ARG(quint32, sessionMaxRecvWindowSize - sessionRecvWindowSize));
+ sessionRecvWindowSize = sessionMaxRecvWindowSize;
+ }
+}
+
+void QHttp2ProtocolHandler::handleHEADERS()
+{
+ Q_ASSERT(inboundFrame.type() == FrameType::HEADERS);
+
+ const auto streamID = inboundFrame.streamID();
+ if (streamID == connectionStreamID)
+ return connectionError(PROTOCOL_ERROR, "HEADERS on 0x0 stream");
+
+ if (!activeStreams.contains(streamID) && !streamWasReset(streamID))
+ return connectionError(ENHANCE_YOUR_CALM, "HEADERS on invalid stream");
+
+ const auto flags = inboundFrame.flags();
+ if (flags.testFlag(FrameFlag::PRIORITY)) {
+ handlePRIORITY();
+ if (goingAway)
+ return;
+ }
+
+ const bool endHeaders = flags.testFlag(FrameFlag::END_HEADERS);
+ continuedFrames.clear();
+ continuedFrames.push_back(std::move(inboundFrame));
+ if (!endHeaders) {
+ continuationExpected = true;
+ return;
+ }
+
+ handleContinuedHEADERS();
+}
+
+void QHttp2ProtocolHandler::handlePRIORITY()
+{
+ Q_ASSERT(inboundFrame.type() == FrameType::PRIORITY ||
+ inboundFrame.type() == FrameType::HEADERS);
+
+ const auto streamID = inboundFrame.streamID();
+ if (streamID == connectionStreamID)
+ return connectionError(PROTOCOL_ERROR, "PIRORITY on 0x0 stream");
+
+ if (!activeStreams.contains(streamID) && !streamWasReset(streamID))
+ return connectionError(ENHANCE_YOUR_CALM, "PRIORITY on invalid stream");
+
+ quint32 streamDependency = 0;
+ uchar weight = 0;
+ const bool noErr = inboundFrame.priority(&streamDependency, &weight);
+ Q_UNUSED(noErr) Q_ASSERT(noErr);
+
+
+ const bool exclusive = streamDependency & 0x80000000;
+ streamDependency &= ~0x80000000;
+
+ // Ignore this for now ...
+ // Can be used for streams (re)prioritization - 5.3
+ Q_UNUSED(exclusive);
+ Q_UNUSED(weight);
+}
+
+void QHttp2ProtocolHandler::handleRST_STREAM()
+{
+ Q_ASSERT(inboundFrame.type() == FrameType::RST_STREAM);
+
+ // "RST_STREAM frames MUST be associated with a stream.
+ // If a RST_STREAM frame is received with a stream identifier of 0x0,
+ // the recipient MUST treat this as a connection error (Section 5.4.1)
+ // of type PROTOCOL_ERROR.
+ const auto streamID = inboundFrame.streamID();
+ if (streamID == connectionStreamID)
+ return connectionError(PROTOCOL_ERROR, "RST_STREAM on 0x0");
+
+ if (!(streamID & 0x1)) {
+ // RST_STREAM on a promised stream:
+ // since we do not keep track of such streams,
+ // just ignore.
+ return;
+ }
+
+ if (streamID >= nextID) {
+ // "RST_STREAM frames MUST NOT be sent for a stream
+ // in the "idle" state. .. the recipient MUST treat this
+ // as a connection error (Section 5.4.1) of type PROTOCOL_ERROR."
+ return connectionError(PROTOCOL_ERROR, "RST_STREAM on idle stream");
+ }
+
+ if (!activeStreams.contains(streamID)) {
+ // 'closed' stream, ignore.
+ return;
+ }
+
+ Q_ASSERT(inboundFrame.dataSize() == 4);
+
+ Stream &stream = activeStreams[streamID];
+ finishStreamWithError(stream, qFromBigEndian<quint32>(inboundFrame.dataBegin()));
+ markAsReset(stream.streamID);
+ deleteActiveStream(stream.streamID);
+}
+
+void QHttp2ProtocolHandler::handleSETTINGS()
+{
+ // 6.5 SETTINGS.
+ Q_ASSERT(inboundFrame.type() == FrameType::SETTINGS);
+
+ if (inboundFrame.streamID() != connectionStreamID)
+ return connectionError(PROTOCOL_ERROR, "SETTINGS on invalid stream");
+
+ if (inboundFrame.flags().testFlag(FrameFlag::ACK)) {
+ if (!waitingForSettingsACK)
+ return connectionError(PROTOCOL_ERROR, "unexpected SETTINGS ACK");
+ waitingForSettingsACK = false;
+ return;
+ }
+
+ if (inboundFrame.dataSize()) {
+ auto src = inboundFrame.dataBegin();
+ for (const uchar *end = src + inboundFrame.dataSize(); src != end; src += 6) {
+ const Settings identifier = Settings(qFromBigEndian<quint16>(src));
+ const quint32 intVal = qFromBigEndian<quint32>(src + 2);
+ if (!acceptSetting(identifier, intVal)) {
+ // If not accepted - we finish with connectionError.
+ return;
+ }
+ }
+ }
+
+ sendSETTINGS_ACK();
+}
+
+
+void QHttp2ProtocolHandler::handlePUSH_PROMISE()
+{
+ // 6.6 PUSH_PROMISE.
+ Q_ASSERT(inboundFrame.type() == FrameType::PUSH_PROMISE);
+
+ if (prefaceSent && !waitingForSettingsACK) {
+ // This means, server ACKed our 'NO PUSH',
+ // but sent us PUSH_PROMISE anyway.
+ return connectionError(PROTOCOL_ERROR, "unexpected PUSH_PROMISE frame");
+ }
+
+ const auto streamID = inboundFrame.streamID();
+ if (streamID == connectionStreamID) {
+ return connectionError(PROTOCOL_ERROR,
+ "PUSH_PROMISE with invalid associated stream (0x0)");
+ }
+
+ if (!activeStreams.contains(streamID) && !streamWasReset(streamID)) {
+ return connectionError(ENHANCE_YOUR_CALM,
+ "PUSH_PROMISE with invalid associated stream");
+ }
+
+ const auto reservedID = qFromBigEndian<quint32>(inboundFrame.dataBegin());
+ if (!reservedID || (reservedID & 0x1)) {
+ return connectionError(PROTOCOL_ERROR,
+ "PUSH_PROMISE with invalid promised stream ID");
+ }
+
+ // "ignoring a PUSH_PROMISE frame causes the stream
+ // state to become indeterminate" - let's RST_STREAM it then ...
+ sendRST_STREAM(reservedID, REFUSE_STREAM);
+ markAsReset(reservedID);
+
+ const bool endHeaders = inboundFrame.flags().testFlag(FrameFlag::END_HEADERS);
+ continuedFrames.clear();
+ continuedFrames.push_back(std::move(inboundFrame));
+
+ if (!endHeaders) {
+ continuationExpected = true;
+ return;
+ }
+
+ handleContinuedHEADERS();
+}
+
+void QHttp2ProtocolHandler::handlePING()
+{
+ // Since we're implementing a client and not
+ // a server, we only reply to a PING, ACKing it.
+ Q_ASSERT(inboundFrame.type() == FrameType::PING);
+ Q_ASSERT(m_socket);
+
+ if (inboundFrame.streamID() != connectionStreamID)
+ return connectionError(PROTOCOL_ERROR, "PING on invalid stream");
+
+ if (inboundFrame.flags() & FrameFlag::ACK)
+ return connectionError(PROTOCOL_ERROR, "unexpected PING ACK");
+
+ Q_ASSERT(inboundFrame.dataSize() == 8);
+
+ frameWriter.start(FrameType::PING, FrameFlag::ACK, connectionStreamID);
+ frameWriter.append(inboundFrame.dataBegin(), inboundFrame.dataBegin() + 8);
+ frameWriter.write(*m_socket);
+}
+
+void QHttp2ProtocolHandler::handleGOAWAY()
+{
+ // 6.8 GOAWAY
+
+ Q_ASSERT(inboundFrame.type() == FrameType::GOAWAY);
+ // "An endpoint MUST treat a GOAWAY frame with a stream identifier
+ // other than 0x0 as a connection error (Section 5.4.1) of type PROTOCOL_ERROR."
+ if (inboundFrame.streamID() != connectionStreamID)
+ return connectionError(PROTOCOL_ERROR, "GOAWAY on invalid stream");
+
+ const auto src = inboundFrame.dataBegin();
+ quint32 lastStreamID = qFromBigEndian<quint32>(src);
+ const quint32 errorCode = qFromBigEndian<quint32>(src + 4);
+
+ if (!lastStreamID) {
+ // "The last stream identifier can be set to 0 if no
+ // streams were processed."
+ lastStreamID = 1;
+ }
+
+ if (!(lastStreamID & 0x1)) {
+ // 5.1.1 - we (client) use only odd numbers as stream identifiers.
+ return connectionError(PROTOCOL_ERROR, "GOAWAY with invalid last stream ID");
+ }
+
+ if (lastStreamID >= nextID) {
+ // "A server that is attempting to gracefully shut down a connection SHOULD
+ // send an initial GOAWAY frame with the last stream identifier set to 2^31-1
+ // and a NO_ERROR code."
+ if (lastStreamID != (quint32(1) << 31) - 1 || errorCode != HTTP2_NO_ERROR)
+ return connectionError(PROTOCOL_ERROR, "GOAWAY invalid stream/error code");
+ lastStreamID = 1;
+ } else {
+ lastStreamID += 2;
+ }
+
+ goingAway = true;
+
+ QNetworkReply::NetworkError error = QNetworkReply::NoError;
+ QString message;
+ qt_error(errorCode, error, message);
+
+ for (quint32 id = lastStreamID; id < nextID; id += 2) {
+ const auto it = activeStreams.find(id);
+ if (it != activeStreams.end()) {
+ Stream &stream = *it;
+ finishStreamWithError(stream, error, message);
+ markAsReset(id);
+ deleteActiveStream(id);
+ } else {
+ removeFromSuspended(id);
+ }
+ }
+
+ if (!activeStreams.size())
+ closeSession();
+}
+
+void QHttp2ProtocolHandler::handleWINDOW_UPDATE()
+{
+ Q_ASSERT(inboundFrame.type() == FrameType::WINDOW_UPDATE);
+
+
+ const quint32 delta = qFromBigEndian<quint32>(inboundFrame.dataBegin());
+ const bool valid = delta && delta <= quint32(std::numeric_limits<qint32>::max());
+ const auto streamID = inboundFrame.streamID();
+
+ if (streamID == Http2::connectionStreamID) {
+ if (!valid || sum_will_overflow(sessionSendWindowSize, delta))
+ return connectionError(PROTOCOL_ERROR, "WINDOW_UPDATE invalid delta");
+ sessionSendWindowSize += delta;
+ } else {
+ if (!activeStreams.contains(streamID)) {
+ // WINDOW_UPDATE on closed streams can be ignored.
+ return;
+ }
+ auto &stream = activeStreams[streamID];
+ if (!valid || sum_will_overflow(stream.sendWindow, delta)) {
+ finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError,
+ QLatin1String("invalid WINDOW_UPDATE delta"));
+ sendRST_STREAM(streamID, PROTOCOL_ERROR);
+ markAsReset(streamID);
+ deleteActiveStream(streamID);
+ return;
+ }
+ stream.sendWindow += delta;
+ }
+
+ // Since we're in _q_receiveReply at the moment, let's first handle other
+ // frames and resume suspended streams (if any) == start sending our own frame
+ // after handling these frames, since one them can be e.g. GOAWAY.
+ QMetaObject::invokeMethod(this, "resumeSuspendedStreams", Qt::QueuedConnection);
+}
+
+void QHttp2ProtocolHandler::handleCONTINUATION()
+{
+ Q_ASSERT(inboundFrame.type() == FrameType::CONTINUATION);
+ Q_ASSERT(continuedFrames.size()); // HEADERS frame must be already in.
+
+ if (inboundFrame.streamID() != continuedFrames.front().streamID())
+ return connectionError(PROTOCOL_ERROR, "CONTINUATION on invalid stream");
+
+ const bool endHeaders = inboundFrame.flags().testFlag(FrameFlag::END_HEADERS);
+ continuedFrames.push_back(std::move(inboundFrame));
+
+ if (!endHeaders)
+ return;
+
+ continuationExpected = false;
+ handleContinuedHEADERS();
+}
+
+void QHttp2ProtocolHandler::handleContinuedHEADERS()
+{
+ Q_ASSERT(continuedFrames.size());
+
+ const auto streamID = continuedFrames[0].streamID();
+
+ if (continuedFrames[0].type() == FrameType::HEADERS) {
+ if (activeStreams.contains(streamID)) {
+ Stream &stream = activeStreams[streamID];
+ if (stream.state != Stream::halfClosedLocal) {
+ // If we're receiving headers, they're a response to a request we sent;
+ // and we closed our end when we finished sending that.
+ finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError,
+ QLatin1String("HEADERS on invalid stream"));
+ sendRST_STREAM(streamID, CANCEL);
+ markAsReset(streamID);
+ deleteActiveStream(streamID);
+ return;
+ }
+ } else if (!streamWasReset(streamID)) {
+ return connectionError(PROTOCOL_ERROR, "HEADERS on invalid stream");
+ }
+ }
+
+ quint32 total = 0;
+ for (const auto &frame : continuedFrames)
+ total += frame.dataSize();
+
+ if (!total) {
+ // It could be a PRIORITY sent in HEADERS - handled by this point.
+ return;
+ }
+
+ std::vector<uchar> hpackBlock(total);
+ auto dst = hpackBlock.begin();
+ for (const auto &frame : continuedFrames) {
+ if (!frame.dataSize())
+ continue;
+ const uchar *src = frame.dataBegin();
+ std::copy(src, src + frame.dataSize(), dst);
+ dst += frame.dataSize();
+ }
+
+ HPack::BitIStream inputStream{&hpackBlock[0],
+ &hpackBlock[0] + hpackBlock.size()};
+
+ if (!decoder.decodeHeaderFields(inputStream))
+ return connectionError(COMPRESSION_ERROR, "HPACK decompression failed");
+
+ if (continuedFrames[0].type() == FrameType::HEADERS) {
+ if (activeStreams.contains(streamID)) {
+ Stream &stream = activeStreams[streamID];
+ updateStream(stream, decoder.decodedHeader());
+ if (continuedFrames[0].flags() & FrameFlag::END_STREAM) {
+ finishStream(stream);
+ deleteActiveStream(stream.streamID);
+ }
+ }
+ }
+}
+
+bool QHttp2ProtocolHandler::acceptSetting(Http2::Settings identifier, quint32 newValue)
+{
+ if (identifier == Settings::HEADER_TABLE_SIZE_ID) {
+ if (newValue > maxAcceptableTableSize) {
+ connectionError(PROTOCOL_ERROR, "SETTINGS invalid table size");
+ return false;
+ }
+ encoder.setMaxDynamicTableSize(newValue);
+ }
+
+ if (identifier == Settings::INITIAL_WINDOW_SIZE_ID) {
+ // For every active stream - adjust its window
+ // (and handle possible overflows as errors).
+ if (newValue > quint32(std::numeric_limits<qint32>::max())) {
+ connectionError(FLOW_CONTROL_ERROR, "SETTINGS invalid initial window size");
+ return false;
+ }
+
+ const qint32 delta = qint32(newValue) - streamInitialSendWindowSize;
+ streamInitialSendWindowSize = newValue;
+
+ std::vector<quint32> brokenStreams;
+ brokenStreams.reserve(activeStreams.size());
+ for (auto &stream : activeStreams) {
+ if (sum_will_overflow(stream.sendWindow, delta)) {
+ brokenStreams.push_back(stream.streamID);
+ continue;
+ }
+ stream.sendWindow += delta;
+ }
+
+ for (auto id : brokenStreams) {
+ auto &stream = activeStreams[id];
+ finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError,
+ QLatin1String("SETTINGS window overflow"));
+ sendRST_STREAM(id, PROTOCOL_ERROR);
+ markAsReset(id);
+ deleteActiveStream(id);
+ }
+
+ QMetaObject::invokeMethod(this, "resumeSuspendedStreams", Qt::QueuedConnection);
+ }
+
+ if (identifier == Settings::MAX_CONCURRENT_STREAMS_ID) {
+ if (maxConcurrentStreams > maxPeerConcurrentStreams) {
+ connectionError(PROTOCOL_ERROR, "SETTINGS invalid number of concurrent streams");
+ return false;
+ }
+ maxConcurrentStreams = newValue;
+ }
+
+ if (identifier == Settings::MAX_FRAME_SIZE_ID) {
+ if (newValue < Http2::maxFrameSize || newValue > Http2::maxPayloadSize) {
+ connectionError(PROTOCOL_ERROR, "SETTGINGS max frame size is out of range");
+ return false;
+ }
+ maxFrameSize = newValue;
+ }
+
+ if (identifier == Settings::MAX_HEADER_LIST_SIZE_ID) {
+ // We just remember this value, it can later
+ // prevent us from sending any request (and this
+ // will end up in request/reply error).
+ maxHeaderListSize = newValue;
+ }
+
+ return true;
+}
+
+void QHttp2ProtocolHandler::updateStream(Stream &stream, const HPack::HttpHeader &headers)
+{
+ const auto httpReply = stream.reply();
+ Q_ASSERT(httpReply);
+ const auto httpReplyPrivate = httpReply->d_func();
+ for (const auto &pair : headers) {
+ const auto &name = pair.name;
+ auto value = pair.value;
+
+ if (name == ":status") {
+ httpReply->setStatusCode(value.left(3).toInt());
+ httpReplyPrivate->reasonPhrase = QString::fromLatin1(value.mid(4));
+ } else if (name == ":version") {
+ httpReplyPrivate->majorVersion = value.at(5) - '0';
+ httpReplyPrivate->minorVersion = value.at(7) - '0';
+ } else if (name == "content-length") {
+ bool ok = false;
+ const qlonglong length = value.toLongLong(&ok);
+ if (ok)
+ httpReply->setContentLength(length);
+ } else {
+ QByteArray binder(", ");
+ if (name == "set-cookie")
+ binder = "\n";
+ httpReply->setHeaderField(name, value.replace('\0', binder));
+ }
+ }
+
+ emit httpReply->headerChanged();
+}
+
+void QHttp2ProtocolHandler::updateStream(Stream &stream, const Frame &frame)
+{
+ Q_ASSERT(frame.type() == FrameType::DATA);
+
+ if (const auto length = frame.dataSize()) {
+ const char *data = reinterpret_cast<const char *>(frame.dataBegin());
+ auto &httpRequest = stream.request();
+ auto httpReply = stream.reply();
+ Q_ASSERT(httpReply);
+ auto replyPrivate = httpReply->d_func();
+
+ replyPrivate->compressedData.append(data, length);
+ replyPrivate->totalProgress += length;
+
+ const QByteArray wrapped(data, length);
+ if (httpRequest.d->autoDecompress && replyPrivate->isCompressed()) {
+ QByteDataBuffer inDataBuffer;
+ inDataBuffer.append(wrapped);
+ replyPrivate->uncompressBodyData(&inDataBuffer, &replyPrivate->responseData);
+ } else {
+ replyPrivate->responseData.append(wrapped);
+ }
+
+ if (replyPrivate->shouldEmitSignals()) {
+ emit httpReply->readyRead();
+ emit httpReply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength);
+ }
+ }
+}
+
+void QHttp2ProtocolHandler::finishStream(Stream &stream)
+{
+ stream.state = Stream::closed;
+ auto httpReply = stream.reply();
+ Q_ASSERT(httpReply);
+ httpReply->disconnect(this);
+ if (stream.data())
+ stream.data()->disconnect(this);
+
+ qCDebug(QT_HTTP2) << "stream" << stream.streamID << "closed";
+
+ emit httpReply->finished();
+}
+
+void QHttp2ProtocolHandler::finishStreamWithError(Stream &stream, quint32 errorCode)
+{
+ QNetworkReply::NetworkError error = QNetworkReply::NoError;
+ QString message;
+ qt_error(errorCode, error, message);
+ finishStreamWithError(stream, error, message);
+}
+
+void QHttp2ProtocolHandler::finishStreamWithError(Stream &stream, QNetworkReply::NetworkError error,
+ const QString &message)
+{
+ stream.state = Stream::closed;
+ auto httpReply = stream.reply();
+ Q_ASSERT(httpReply);
+ httpReply->disconnect(this);
+ if (stream.data())
+ stream.data()->disconnect(this);
+
+ qCWarning(QT_HTTP2) << "stream" << stream.streamID
+ << "finished with error:" << message;
+
+ // TODO: error message must be translated!!! (tr)
+ emit httpReply->finishedWithError(error, message);
+}
+
+quint32 QHttp2ProtocolHandler::createNewStream(const HttpMessagePair &message)
+{
+ const qint32 newStreamID = allocateStreamID();
+ if (!newStreamID)
+ return 0;
+
+ Q_ASSERT(!activeStreams.contains(newStreamID));
+
+ const auto reply = message.second;
+ const auto replyPrivate = reply->d_func();
+ replyPrivate->connection = m_connection;
+ replyPrivate->connectionChannel = m_channel;
+ reply->setSpdyWasUsed(true);
+ reply->setProperty("HTTP2StreamID", newStreamID);
+ connect(reply, SIGNAL(destroyed(QObject*)),
+ this, SLOT(_q_replyDestroyed(QObject*)));
+
+ const Stream newStream(message, newStreamID,
+ streamInitialSendWindowSize,
+ streamInitialRecvWindowSize);
+
+ if (auto src = newStream.data()) {
+ connect(src, SIGNAL(readyRead()), this,
+ SLOT(_q_uploadDataReadyRead()), Qt::QueuedConnection);
+ src->setProperty("HTTP2StreamID", newStreamID);
+ }
+
+ activeStreams.insert(newStreamID, newStream);
+
+ return newStreamID;
+}
+
+void QHttp2ProtocolHandler::addToSuspended(Stream &stream)
+{
+ qCDebug(QT_HTTP2) << "stream" << stream.streamID
+ << "suspended by flow control";
+ const auto priority = stream.priority();
+ Q_ASSERT(int(priority) >= 0 && int(priority) < 3);
+ suspendedStreams[priority].push_back(stream.streamID);
+}
+
+void QHttp2ProtocolHandler::markAsReset(quint32 streamID)
+{
+ // For now, we trace only client's streams (created by us,
+ // odd integer numbers).
+ if (streamID & 0x1) {
+ qCDebug(QT_HTTP2) << "stream" << streamID << "was reset";
+ // This part is quite tricky: I have to clear this set
+ // so that it does not become tOOO big.
+ if (recycledStreams.size() > maxRecycledStreams) {
+ // At least, I'm erasing the oldest first ...
+ recycledStreams.erase(recycledStreams.begin(),
+ recycledStreams.begin() +
+ recycledStreams.size() / 2);
+ }
+
+ const auto it = std::lower_bound(recycledStreams.begin(), recycledStreams.end(),
+ streamID);
+ if (it != recycledStreams.end() && *it == streamID)
+ return;
+
+ recycledStreams.insert(it, streamID);
+ }
+}
+
+quint32 QHttp2ProtocolHandler::popStreamToResume()
+{
+ quint32 streamID = connectionStreamID;
+ const int nQ = sizeof suspendedStreams / sizeof suspendedStreams[0];
+ using QNR = QHttpNetworkRequest;
+ const QNR::Priority ranks[nQ] = {QNR::HighPriority,
+ QNR::NormalPriority,
+ QNR::LowPriority};
+
+ for (int i = 0; i < nQ; ++i) {
+ auto &queue = suspendedStreams[ranks[i]];
+ auto it = queue.begin();
+ for (; it != queue.end(); ++it) {
+ if (!activeStreams.contains(*it))
+ continue;
+ if (activeStreams[*it].sendWindow > 0)
+ break;
+ }
+
+ if (it != queue.end()) {
+ streamID = *it;
+ queue.erase(it);
+ break;
+ }
+ }
+
+ return streamID;
+}
+
+void QHttp2ProtocolHandler::removeFromSuspended(quint32 streamID)
+{
+ const int nQ = sizeof suspendedStreams / sizeof suspendedStreams[0];
+ for (int i = 0; i < nQ; ++i) {
+ auto &q = suspendedStreams[i];
+ q.erase(std::remove(q.begin(), q.end(), streamID), q.end());
+ }
+}
+
+void QHttp2ProtocolHandler::deleteActiveStream(quint32 streamID)
+{
+ if (activeStreams.contains(streamID)) {
+ auto &stream = activeStreams[streamID];
+ if (stream.reply())
+ stream.reply()->disconnect(this);
+ if (stream.data())
+ stream.data()->disconnect(this);
+ activeStreams.remove(streamID);
+ }
+
+ removeFromSuspended(streamID);
+ if (m_channel->spdyRequestsToSend.size())
+ QMetaObject::invokeMethod(this, "sendRequest", Qt::QueuedConnection);
+}
+
+bool QHttp2ProtocolHandler::streamWasReset(quint32 streamID) const
+{
+ const auto it = std::lower_bound(recycledStreams.begin(),
+ recycledStreams.end(),
+ streamID);
+ return it != recycledStreams.end() && *it == streamID;
+}
+
+void QHttp2ProtocolHandler::resumeSuspendedStreams()
+{
+ while (sessionSendWindowSize > 0) {
+ const auto streamID = popStreamToResume();
+ if (!streamID)
+ return;
+
+ if (!activeStreams.contains(streamID))
+ continue;
+
+ Stream &stream = activeStreams[streamID];
+ if (!sendDATA(stream)) {
+ finishStreamWithError(stream, QNetworkReply::UnknownNetworkError,
+ QLatin1String("failed to send DATA"));
+ sendRST_STREAM(streamID, INTERNAL_ERROR);
+ markAsReset(streamID);
+ deleteActiveStream(streamID);
+ }
+ }
+}
+
+quint32 QHttp2ProtocolHandler::allocateStreamID()
+{
+ // With protocol upgrade streamID == 1 will become
+ // invalid. The logic must be updated.
+ if (nextID > quint32(std::numeric_limits<qint32>::max()))
+ return 0;
+
+ const quint32 streamID = nextID;
+ nextID += 2;
+
+ return streamID;
+}
+
+void QHttp2ProtocolHandler::connectionError(Http2::Http2Error errorCode,
+ const char *message)
+{
+ Q_ASSERT(message);
+ Q_ASSERT(!goingAway);
+
+ qCCritical(QT_HTTP2) << "connection error:" << message;
+
+ goingAway = true;
+ sendGOAWAY(errorCode);
+ const auto error = qt_error(errorCode);
+ m_channel->emitFinishedWithError(error, message);
+
+ for (auto &stream: activeStreams)
+ finishStreamWithError(stream, error, QLatin1String(message));
+
+ closeSession();
+}
+
+void QHttp2ProtocolHandler::closeSession()
+{
+ activeStreams.clear();
+ for (auto &q: suspendedStreams)
+ q.clear();
+ recycledStreams.clear();
+
+ m_channel->close();
+}
+
+QT_END_NAMESPACE
+
+#endif // !defined(QT_NO_HTTP)
diff --git a/src/network/access/qhttp2protocolhandler_p.h b/src/network/access/qhttp2protocolhandler_p.h
new file mode 100644
index 0000000000..92c6851078
--- /dev/null
+++ b/src/network/access/qhttp2protocolhandler_p.h
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** 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 QHTTP2PROTOCOLHANDLER_P_H
+#define QHTTP2PROTOCOLHANDLER_P_H
+
+//
+// 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.
+//
+
+#include <private/qhttpnetworkconnectionchannel_p.h>
+#include <private/qabstractprotocolhandler_p.h>
+#include <private/qhttpnetworkrequest_p.h>
+
+#if !defined(QT_NO_HTTP)
+
+#include "http2/http2protocol_p.h"
+#include "http2/http2streams_p.h"
+#include "http2/http2frames_p.h"
+#include "http2/hpacktable_p.h"
+#include "http2/hpack_p.h"
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qflags.h>
+#include <QtCore/qhash.h>
+
+#include <vector>
+#include <limits>
+#include <deque>
+#include <set>
+
+QT_BEGIN_NAMESPACE
+
+class QHttp2ProtocolHandler : public QObject, public QAbstractProtocolHandler
+{
+ Q_OBJECT
+
+public:
+ QHttp2ProtocolHandler(QHttpNetworkConnectionChannel *channel);
+
+ QHttp2ProtocolHandler(const QHttp2ProtocolHandler &rhs) = delete;
+ QHttp2ProtocolHandler(QHttp2ProtocolHandler &&rhs) = delete;
+
+ QHttp2ProtocolHandler &operator = (const QHttp2ProtocolHandler &rhs) = delete;
+ QHttp2ProtocolHandler &operator = (QHttp2ProtocolHandler &&rhs) = delete;
+
+private slots:
+ void _q_uploadDataReadyRead();
+ void _q_replyDestroyed(QObject* reply);
+
+private:
+ using Stream = Http2::Stream;
+
+ void _q_readyRead() override;
+ void _q_receiveReply() override;
+ Q_INVOKABLE bool sendRequest() override;
+
+ bool sendClientPreface();
+ bool sendSETTINGS_ACK();
+ bool sendHEADERS(Stream &stream);
+ bool sendDATA(Stream &stream);
+ Q_INVOKABLE bool sendWINDOW_UPDATE(quint32 streamID, quint32 delta);
+ bool sendRST_STREAM(quint32 streamID, quint32 errorCoder);
+ bool sendGOAWAY(quint32 errorCode);
+
+ void handleDATA();
+ void handleHEADERS();
+ void handlePRIORITY();
+ void handleRST_STREAM();
+ void handleSETTINGS();
+ void handlePUSH_PROMISE();
+ void handlePING();
+ void handleGOAWAY();
+ void handleWINDOW_UPDATE();
+ void handleCONTINUATION();
+
+ void handleContinuedHEADERS();
+
+ bool acceptSetting(Http2::Settings identifier, quint32 newValue);
+
+ void updateStream(Stream &stream, const HPack::HttpHeader &headers);
+ void updateStream(Stream &stream, const Http2::Frame &dataFrame);
+ void finishStream(Stream &stream);
+ // Error code send by a peer (GOAWAY/RST_STREAM):
+ void finishStreamWithError(Stream &stream, quint32 errorCode);
+ // Locally encountered error:
+ void finishStreamWithError(Stream &stream, QNetworkReply::NetworkError error,
+ const QString &message);
+
+ // Stream's lifecycle management:
+ quint32 createNewStream(const HttpMessagePair &message);
+ void addToSuspended(Stream &stream);
+ void markAsReset(quint32 streamID);
+ quint32 popStreamToResume();
+ void removeFromSuspended(quint32 streamID);
+ void deleteActiveStream(quint32 streamID);
+ bool streamWasReset(quint32 streamID) const;
+
+ bool prefaceSent = false;
+ // In the current implementation we send
+ // SETTINGS only once, immediately after
+ // the client's preface 24-byte message.
+ bool waitingForSettingsACK = false;
+
+ static const quint32 maxAcceptableTableSize = 16 * HPack::FieldLookupTable::DefaultSize;
+ // HTTP/2 4.3: Header compression is stateful. One compression context and
+ // one decompression context are used for the entire connection.
+ HPack::Decoder decoder;
+ HPack::Encoder encoder;
+
+ QHash<quint32, Stream> activeStreams;
+ std::deque<quint32> suspendedStreams[3]; // 3 for priorities: High, Normal, Low.
+ static const std::deque<quint32>::size_type maxRecycledStreams;
+ std::deque<quint32> recycledStreams;
+
+ // Peer's max frame size.
+ quint32 maxFrameSize = Http2::maxFrameSize;
+
+ Http2::FrameReader frameReader;
+ Http2::Frame inboundFrame;
+ Http2::FrameWriter frameWriter;
+ // Temporary storage to assemble HEADERS' block
+ // from several CONTINUATION frames ...
+ bool continuationExpected = false;
+ std::vector<Http2::Frame> continuedFrames;
+
+ // Peer's max number of streams ...
+ quint32 maxConcurrentStreams = Http2::maxConcurrentStreams;
+
+ // Control flow:
+ static const qint32 sessionMaxRecvWindowSize = Http2::defaultSessionWindowSize * 10;
+ // Signed integer, it can become negative (it's still a valid window size):
+ qint32 sessionRecvWindowSize = sessionMaxRecvWindowSize;
+
+ // We do not negotiate this window size
+ // We have to send WINDOW_UPDATE frames to our peer also.
+ static const qint32 streamInitialRecvWindowSize = Http2::defaultSessionWindowSize;
+
+ // Updated by SETTINGS and WINDOW_UPDATE.
+ qint32 sessionSendWindowSize = Http2::defaultSessionWindowSize;
+ qint32 streamInitialSendWindowSize = Http2::defaultSessionWindowSize;
+
+ // It's unlimited by default, but can be changed via SETTINGS.
+ quint32 maxHeaderListSize = (std::numeric_limits<quint32>::max)();
+
+ Q_INVOKABLE void resumeSuspendedStreams();
+ // Our stream IDs (all odd), the first valid will be 1.
+ quint32 nextID = 1;
+ quint32 allocateStreamID();
+ bool validPeerStreamID() const;
+ bool goingAway = false;
+
+ // Errors:
+ void connectionError(Http2::Http2Error errorCode,
+ const char *message);
+ void closeSession();
+};
+
+QT_END_NAMESPACE
+
+#endif // !defined(QT_NO_HTTP)
+
+#endif
diff --git a/src/network/access/qhttpmultipart.h b/src/network/access/qhttpmultipart.h
index cbf28c083e..6d4531b099 100644
--- a/src/network/access/qhttpmultipart.h
+++ b/src/network/access/qhttpmultipart.h
@@ -40,6 +40,7 @@
#ifndef QHTTPMULTIPART_H
#define QHTTPMULTIPART_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QByteArray>
#include <QtCore/QIODevice>
diff --git a/src/network/access/qhttpmultipart_p.h b/src/network/access/qhttpmultipart_p.h
index 875f52f8e3..a03df9cb13 100644
--- a/src/network/access/qhttpmultipart_p.h
+++ b/src/network/access/qhttpmultipart_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtCore/qshareddata.h"
#include "qnetworkrequest_p.h" // for deriving QHttpPartPrivate from QNetworkHeadersPrivate
#include "private/qobject_p.h"
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 79f418f675..8e5cfd9497 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -60,6 +60,7 @@
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
# include <QtNetwork/qsslconfiguration.h>
+# include <QtNetwork/qsslerror.h>
#endif
@@ -82,9 +83,10 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host
networkLayerState(Unknown),
hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true)
#ifndef QT_NO_SSL
-, channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY) ? 1 : defaultHttpChannelCount)
+, channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY || type == QHttpNetworkConnection::ConnectionTypeHTTP2)
+ ? 1 : defaultHttpChannelCount)
#else
-, channelCount(defaultHttpChannelCount)
+, channelCount(type == QHttpNetworkConnection::ConnectionTypeHTTP2 ? 1 : defaultHttpChannelCount)
#endif // QT_NO_SSL
#ifndef QT_NO_NETWORKPROXY
, networkProxy(QNetworkProxy::NoProxy)
@@ -317,9 +319,9 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair)
if (systemLocale == QLatin1String("C"))
acceptLanguage = QString::fromLatin1("en,*");
else if (systemLocale.startsWith(QLatin1String("en-")))
- acceptLanguage = QString::fromLatin1("%1,*").arg(systemLocale);
+ acceptLanguage = systemLocale + QLatin1String(",*");
else
- acceptLanguage = QString::fromLatin1("%1,en,*").arg(systemLocale);
+ acceptLanguage = systemLocale + QLatin1String(",en,*");
request.setHeaderField("Accept-Language", acceptLanguage.toLatin1());
}
@@ -617,13 +619,11 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
break;
}
}
-#ifndef QT_NO_SSL
- else { // SPDY
+ else { // SPDY, HTTP/2
if (!pair.second->d_func()->requestIsPrepared)
prepareRequest(pair);
channels[0].spdyRequestsToSend.insertMulti(request.priority(), pair);
}
-#endif // QT_NO_SSL
// For Happy Eyeballs the networkLayerState is set to Unknown
// untill we have started the first connection attempt. So no
@@ -1011,8 +1011,9 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
}
break;
}
+ case QHttpNetworkConnection::ConnectionTypeHTTP2:
case QHttpNetworkConnection::ConnectionTypeSPDY: {
-#ifndef QT_NO_SSL
+
if (channels[0].spdyRequestsToSend.isEmpty())
return;
@@ -1024,7 +1025,6 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState
&& !channels[0].pendingEncrypt)
channels[0].sendRequest();
-#endif // QT_NO_SSL
break;
}
}
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index e05bc1df74..cad0ab1ac4 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -50,6 +50,8 @@
//
// We mean it.
//
+
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/qnetworkreply.h>
#include <QtNetwork/qabstractsocket.h>
@@ -70,17 +72,6 @@
#ifndef QT_NO_HTTP
-#ifndef QT_NO_SSL
-#ifndef QT_NO_OPENSSL
-# include <private/qsslcontext_openssl_p.h>
-#endif
-# include <private/qsslsocket_p.h>
-# include <QtNetwork/qsslsocket.h>
-# include <QtNetwork/qsslerror.h>
-#else
-# include <QtNetwork/qtcpsocket.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QHttpNetworkRequest;
@@ -88,6 +79,10 @@ class QHttpNetworkReply;
class QHttpThreadDelegate;
class QByteArray;
class QHostInfo;
+#ifndef QT_NO_SSL
+class QSslConfiguration;
+class QSslContext;
+#endif // !QT_NO_SSL
class QHttpNetworkConnectionPrivate;
class Q_AUTOTEST_EXPORT QHttpNetworkConnection : public QObject
@@ -97,7 +92,8 @@ public:
enum ConnectionType {
ConnectionTypeHTTP,
- ConnectionTypeSPDY
+ ConnectionTypeSPDY,
+ ConnectionTypeHTTP2
};
#ifndef QT_NO_BEARERMANAGEMENT
@@ -159,6 +155,7 @@ private:
friend class QHttpNetworkReply;
friend class QHttpNetworkReplyPrivate;
friend class QHttpNetworkConnectionChannel;
+ friend class QHttp2ProtocolHandler;
friend class QHttpProtocolHandler;
friend class QSpdyProtocolHandler;
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 2f7be01078..b6a9b80511 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -47,10 +47,12 @@
#ifndef QT_NO_HTTP
+#include <private/qhttp2protocolhandler_p.h>
#include <private/qhttpprotocolhandler_p.h>
#include <private/qspdyprotocolhandler_p.h>
#ifndef QT_NO_SSL
+# include <private/qsslsocket_p.h>
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
# include <QtNetwork/qsslconfiguration.h>
@@ -177,8 +179,11 @@ void QHttpNetworkConnectionChannel::init()
if (!sslConfiguration.isNull())
sslSocket->setSslConfiguration(sslConfiguration);
} else {
-#endif // QT_NO_SSL
- protocolHandler.reset(new QHttpProtocolHandler(this));
+#endif // !QT_NO_SSL
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2)
+ protocolHandler.reset(new QHttp2ProtocolHandler(this));
+ else
+ protocolHandler.reset(new QHttpProtocolHandler(this));
#ifndef QT_NO_SSL
}
#endif
@@ -833,10 +838,17 @@ void QHttpNetworkConnectionChannel::_q_connected()
#endif
} else {
state = QHttpNetworkConnectionChannel::IdleState;
- if (!reply)
- connection->d_func()->dequeueRequest(socket);
- if (reply)
- sendRequest();
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
+ if (spdyRequestsToSend.count() > 0) {
+ // wait for data from the server first (e.g. initial window, max concurrent requests)
+ QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+ }
+ } else {
+ if (!reply)
+ connection->d_func()->dequeueRequest(socket);
+ if (reply)
+ sendRequest();
+ }
}
}
@@ -970,8 +982,12 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
}
} while (!connection->d_func()->highPriorityQueue.isEmpty()
|| !connection->d_func()->lowPriorityQueue.isEmpty());
+
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
#ifndef QT_NO_SSL
- if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) {
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY
+#endif
+ ) {
QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
for (int a = 0; a < spdyPairs.count(); ++a) {
// emit error for all replies
@@ -980,7 +996,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
emit currentReply->finishedWithError(errorCode, errorString);
}
}
-#endif // QT_NO_SSL
// send the next request
QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection);
@@ -1002,19 +1017,19 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
#ifndef QT_NO_NETWORKPROXY
void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth)
{
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
#ifndef QT_NO_SSL
- if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) {
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY
+#endif
+ ) {
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);
} else { // HTTP
-#endif // QT_NO_SSL
// Need to dequeue the request before we can emit the error.
if (!reply)
connection->d_func()->dequeueRequest(socket);
if (reply)
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);
-#ifndef QT_NO_SSL
}
-#endif // QT_NO_SSL
}
#endif
@@ -1024,6 +1039,19 @@ void QHttpNetworkConnectionChannel::_q_uploadDataReadyRead()
sendRequest();
}
+void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::NetworkError error,
+ const char *message)
+{
+ if (reply)
+ emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
+ QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
+ for (int a = 0; a < spdyPairs.count(); ++a) {
+ QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ Q_ASSERT(currentReply);
+ emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
+ }
+}
+
#ifndef QT_NO_SSL
void QHttpNetworkConnectionChannel::_q_encrypted()
{
@@ -1032,7 +1060,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
if (!protocolHandler) {
switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) {
- case QSslConfiguration::NextProtocolNegotiationNegotiated: /* fall through */
+ case QSslConfiguration::NextProtocolNegotiationNegotiated:
case QSslConfiguration::NextProtocolNegotiationUnsupported: {
QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol();
if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) {
@@ -1043,11 +1071,16 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
// no need to re-queue requests, if SPDY was enabled on the request it
// has gone to the SPDY queue already
break;
+ } else if (nextProtocol == QSslConfiguration::ALPNProtocolHTTP2) {
+ protocolHandler.reset(new QHttp2ProtocolHandler(this));
+ connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP2);
+ break;
} else {
emitFinishedWithError(QNetworkReply::SslHandshakeFailedError,
"detected unknown Next Protocol Negotiation protocol");
break;
}
+ Q_FALLTHROUGH();
}
case QSslConfiguration::NextProtocolNegotiationNone:
protocolHandler.reset(new QHttpProtocolHandler(this));
@@ -1066,11 +1099,13 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
state = QHttpNetworkConnectionChannel::IdleState;
pendingEncrypt = false;
- if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) {
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY ||
+ connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
// we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent
- if (spdyRequestsToSend.count() > 0)
+ if (spdyRequestsToSend.count() > 0) {
// wait for data from the server first (e.g. initial window, max concurrent requests)
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+ }
} else { // HTTP
if (!reply)
connection->d_func()->dequeueRequest(socket);
@@ -1092,19 +1127,6 @@ void QHttpNetworkConnectionChannel::requeueSpdyRequests()
spdyRequestsToSend.clear();
}
-void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::NetworkError error,
- const char *message)
-{
- if (reply)
- emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
- QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
- for (int a = 0; a < spdyPairs.count(); ++a) {
- QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
- Q_ASSERT(currentReply);
- emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
- }
-}
-
void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
{
if (!socket)
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index b3b52a7f42..61aea9d35d 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -50,6 +50,8 @@
//
// We mean it.
//
+
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/qnetworkreply.h>
#include <QtNetwork/qabstractsocket.h>
@@ -119,18 +121,21 @@ public:
bool authenticationCredentialsSent;
bool proxyCredentialsSent;
QScopedPointer<QAbstractProtocolHandler> protocolHandler;
+ // SPDY or HTTP/2 requests; SPDY is TLS-only, but
+ // HTTP/2 can be cleartext also, that's why it's
+ // outside of QT_NO_SSL section. Sorted by priority:
+ QMultiMap<int, HttpMessagePair> spdyRequestsToSend;
#ifndef QT_NO_SSL
bool ignoreAllSslErrors;
QList<QSslError> ignoreSslErrorsList;
QSslConfiguration sslConfiguration;
- QMultiMap<int, HttpMessagePair> spdyRequestsToSend; // sorted by priority
void ignoreSslErrors();
void ignoreSslErrors(const QList<QSslError> &errors);
void setSslConfiguration(const QSslConfiguration &config);
void requeueSpdyRequests(); // when we wanted SPDY but got HTTP
+#endif
// to emit the signal for all in-flight replies:
void emitFinishedWithError(QNetworkReply::NetworkError error, const char *message);
-#endif
#ifndef QT_NO_BEARERMANAGEMENT
QSharedPointer<QNetworkSession> networkSession;
#endif
diff --git a/src/network/access/qhttpnetworkheader_p.h b/src/network/access/qhttpnetworkheader_p.h
index 3eaab587a0..89169b9331 100644
--- a/src/network/access/qhttpnetworkheader_p.h
+++ b/src/network/access/qhttpnetworkheader_p.h
@@ -50,6 +50,9 @@
//
// We mean it.
//
+
+#include <QtNetwork/private/qtnetworkglobal_p.h>
+
#ifndef QT_NO_HTTP
#include <qshareddata.h>
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/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index da39633dd1..f3b007f594 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -50,9 +50,13 @@
//
// We mean it.
//
-#include <qplatformdefs.h>
+
+#include <QtNetwork/private/qtnetworkglobal_p.h>
+
#ifndef QT_NO_HTTP
+#include <qplatformdefs.h>
+
#ifndef QT_NO_COMPRESS
struct z_stream_s;
#endif
@@ -176,6 +180,7 @@ private:
friend class QHttpNetworkConnection;
friend class QHttpNetworkConnectionPrivate;
friend class QHttpNetworkConnectionChannel;
+ friend class QHttp2ProtocolHandler;
friend class QHttpProtocolHandler;
friend class QSpdyProtocolHandler;
};
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 5d51e7fb1a..802043d847 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
- autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false),
+ autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false), http2Allowed(false),
withCredentials(true), preConnect(false), followRedirect(false), redirectCount(0)
{
}
@@ -61,6 +61,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
autoDecompress(other.autoDecompress),
pipeliningAllowed(other.pipeliningAllowed),
spdyAllowed(other.spdyAllowed),
+ http2Allowed(other.http2Allowed),
withCredentials(other.withCredentials),
ssl(other.ssl),
preConnect(other.preConnect),
@@ -82,6 +83,7 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot
&& (autoDecompress == other.autoDecompress)
&& (pipeliningAllowed == other.pipeliningAllowed)
&& (spdyAllowed == other.spdyAllowed)
+ && (http2Allowed == other.http2Allowed)
// we do not clear the customVerb in setOperation
&& (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb))
&& (withCredentials == other.withCredentials)
@@ -331,6 +333,16 @@ void QHttpNetworkRequest::setSPDYAllowed(bool b)
d->spdyAllowed = b;
}
+bool QHttpNetworkRequest::isHTTP2Allowed() const
+{
+ return d->http2Allowed;
+}
+
+void QHttpNetworkRequest::setHTTP2Allowed(bool b)
+{
+ d->http2Allowed = b;
+}
+
bool QHttpNetworkRequest::withCredentials() const
{
return d->withCredentials;
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index d9540e6369..d1abb76e28 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -50,6 +50,8 @@
//
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
+
#ifndef QT_NO_HTTP
#include <private/qhttpnetworkheader_p.h>
@@ -115,6 +117,9 @@ public:
bool isSPDYAllowed() const;
void setSPDYAllowed(bool b);
+ bool isHTTP2Allowed() const;
+ void setHTTP2Allowed(bool b);
+
bool withCredentials() const;
void setWithCredentials(bool b);
@@ -142,6 +147,7 @@ private:
friend class QHttpNetworkConnectionPrivate;
friend class QHttpNetworkConnectionChannel;
friend class QHttpProtocolHandler;
+ friend class QHttp2ProtocolHandler;
friend class QSpdyProtocolHandler;
};
@@ -163,6 +169,7 @@ public:
bool autoDecompress;
bool pipeliningAllowed;
bool spdyAllowed;
+ bool http2Allowed;
bool withCredentials;
bool ssl;
bool preConnect;
diff --git a/src/network/access/qhttpprotocolhandler.cpp b/src/network/access/qhttpprotocolhandler.cpp
index b486b75449..37e8b9bed8 100644
--- a/src/network/access/qhttpprotocolhandler.cpp
+++ b/src/network/access/qhttpprotocolhandler.cpp
@@ -99,7 +99,7 @@ void QHttpProtocolHandler::_q_receiveReply()
switch (state) {
case QHttpNetworkReplyPrivate::NothingDoneState: {
m_reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;
- // fallthrough
+ Q_FALLTHROUGH();
}
case QHttpNetworkReplyPrivate::ReadingStatusState: {
qint64 statusBytes = m_reply->d_func()->readStatus(m_socket);
@@ -213,7 +213,8 @@ void QHttpProtocolHandler::_q_receiveReply()
if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState)
break;
- // everything done, fall through
+ // everything done
+ Q_FALLTHROUGH();
}
case QHttpNetworkReplyPrivate::AllDoneState:
m_channel->allDone();
@@ -428,7 +429,7 @@ bool QHttpProtocolHandler::sendRequest()
}
case QHttpNetworkConnectionChannel::ReadingState:
// ignore _q_bytesWritten in these states
- // fall through
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/network/access/qhttpprotocolhandler_p.h b/src/network/access/qhttpprotocolhandler_p.h
index b13993778c..863b988be3 100644
--- a/src/network/access/qhttpprotocolhandler_p.h
+++ b/src/network/access/qhttpprotocolhandler_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <private/qabstractprotocolhandler_p.h>
#ifndef QT_NO_HTTP
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index 3adf71ccfb..1dca7f02fb 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -285,9 +285,16 @@ void QHttpThreadDelegate::startRequest()
urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));
QHttpNetworkConnection::ConnectionType connectionType
- = QHttpNetworkConnection::ConnectionTypeHTTP;
+ = httpRequest.isHTTP2Allowed() ? QHttpNetworkConnection::ConnectionTypeHTTP2
+ : QHttpNetworkConnection::ConnectionTypeHTTP;
+
#ifndef QT_NO_SSL
- if (httpRequest.isSPDYAllowed() && ssl) {
+ if (httpRequest.isHTTP2Allowed() && ssl) {
+ QList<QByteArray> protocols;
+ protocols << QSslConfiguration::ALPNProtocolHTTP2
+ << QSslConfiguration::NextProtocolHttp1_1;
+ incomingSslConfiguration.setAllowedNextProtocols(protocols);
+ } else if (httpRequest.isSPDYAllowed() && ssl) {
connectionType = QHttpNetworkConnection::ConnectionTypeSPDY;
urlCopy.setScheme(QStringLiteral("spdy")); // to differentiate SPDY requests from HTTPS requests
QList<QByteArray> nextProtocols;
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index cec125d7a5..64c58cf648 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QObject>
#include <QThreadStorage>
#include <QNetworkProxy>
diff --git a/src/network/access/qnetworkaccessauthenticationmanager_p.h b/src/network/access/qnetworkaccessauthenticationmanager_p.h
index 3d1cd6b4fb..548675728f 100644
--- a/src/network/access/qnetworkaccessauthenticationmanager_p.h
+++ b/src/network/access/qnetworkaccessauthenticationmanager_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkaccessmanager.h"
#include "qnetworkaccesscache_p.h"
#include "qnetworkaccessbackend_p.h"
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 47f5872235..7f39c942a3 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkreplyimpl_p.h"
#include "QtCore/qobject.h"
diff --git a/src/network/access/qnetworkaccesscache_p.h b/src/network/access/qnetworkaccesscache_p.h
index 2337dd10af..3732b5cbb4 100644
--- a/src/network/access/qnetworkaccesscache_p.h
+++ b/src/network/access/qnetworkaccesscache_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtCore/qobject.h"
#include "QtCore/qbasictimer.h"
#include "QtCore/qbytearray.h"
diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h
index c9b8c84579..8db1a6b1d5 100644
--- a/src/network/access/qnetworkaccesscachebackend_p.h
+++ b/src/network/access/qnetworkaccesscachebackend_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkaccessbackend_p.h"
#include "qnetworkrequest.h"
#include "qnetworkreply.h"
diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h
index 6f8e248880..1d1af61dbd 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend_p.h
+++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkaccessbackend_p.h"
#include "qnetworkrequest.h"
#include "qnetworkreply.h"
diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h
index dec90062e4..081ff2b9e7 100644
--- a/src/network/access/qnetworkaccessfilebackend_p.h
+++ b/src/network/access/qnetworkaccessfilebackend_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkaccessbackend_p.h"
#include "qnetworkrequest.h"
#include "qnetworkreply.h"
diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h
index c5beaf94e8..cdf6b7a07f 100644
--- a/src/network/access/qnetworkaccessftpbackend_p.h
+++ b/src/network/access/qnetworkaccessftpbackend_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkaccessbackend_p.h"
#include "qnetworkaccesscache_p.h"
#include "qnetworkrequest.h"
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 587ab27a0f..246b9a7bad 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1105,6 +1105,47 @@ QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &r
}
/*!
+ \since 5.8
+
+ \overload
+
+ Sends the contents of the \a data byte array to the destination
+ specified by \a request.
+*/
+QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data)
+{
+ QBuffer *buffer = new QBuffer;
+ buffer->setData(data);
+ buffer->open(QIODevice::ReadOnly);
+
+ QNetworkReply *reply = sendCustomRequest(request, verb, buffer);
+ buffer->setParent(reply);
+ return reply;
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Sends a custom request to the server identified by the URL of \a request.
+
+ Sends the contents of the \a multiPart message to the destination
+ specified by \a request.
+
+ This can be used for sending MIME multipart messages for custom verbs.
+
+ \sa QHttpMultiPart, QHttpPart, put()
+*/
+QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart)
+{
+ QNetworkRequest newRequest = d_func()->prepareMultipart(request, multiPart);
+ QIODevice *device = multiPart->d_func()->device;
+ QNetworkReply *reply = sendCustomRequest(newRequest, verb, device);
+ return reply;
+}
+
+/*!
Returns a new QNetworkReply object to handle the operation \a op
and request \a req. The device \a outgoingData is always 0 for Get and
Head requests, but is the value passed to post() and put() in
@@ -1516,27 +1557,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..4b8c4ddf0e 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKACCESSMANAGER_H
#define QNETWORKACCESSMANAGER_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QObject>
#ifndef QT_NO_SSL
#include <QtNetwork/QSslConfiguration>
@@ -128,6 +129,8 @@ public:
QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *deleteResource(const QNetworkRequest &request);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = Q_NULLPTR);
+ QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data);
+ QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart);
#ifndef QT_NO_BEARERMANAGEMENT
void setConfiguration(const QNetworkConfiguration &config);
@@ -173,6 +176,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..bb4641ab8b 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkaccessmanager.h"
#include "qnetworkaccesscache_p.h"
#include "qnetworkaccessbackend_p.h"
@@ -74,7 +75,7 @@ class QNetworkAccessManagerPrivate: public QObjectPrivate
public:
QNetworkAccessManagerPrivate()
: networkCache(0), cookieJar(0),
- httpThread(0),
+ thread(0),
#ifndef QT_NO_NETWORKPROXY
proxyFactory(0),
#endif
@@ -107,6 +108,9 @@ public:
}
~QNetworkAccessManagerPrivate();
+ QThread * createThread();
+ void destroyThread();
+
void _q_replyFinished();
void _q_replyEncrypted();
void _q_replySslErrors(const QList<QSslError> &errors);
@@ -163,7 +167,7 @@ public:
QNetworkCookieJar *cookieJar;
- QThread *httpThread;
+ QThread *thread;
#ifndef QT_NO_NETWORKPROXY
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp
index 21dc12829a..b7cf989477 100644
--- a/src/network/access/qnetworkcookie.cpp
+++ b/src/network/access/qnetworkcookie.cpp
@@ -644,7 +644,7 @@ static QDateTime parseDateString(const QByteArray &dateString)
switch (end - 1) {
case 4:
minutes = atoi(dateString.mid(at + 3, 2).constData());
- // fall through
+ Q_FALLTHROUGH();
case 2:
hours = atoi(dateString.mid(at + 1, 2).constData());
break;
@@ -970,7 +970,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt
if (ok) {
if (secs <= 0) {
//earliest representable time (RFC6265 section 5.2.2)
- cookie.setExpirationDate(QDateTime::fromTime_t(0));
+ cookie.setExpirationDate(QDateTime::fromSecsSinceEpoch(0));
} else {
cookie.setExpirationDate(now.addSecs(secs));
}
diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h
index 8f4b26465a..e462b98555 100644
--- a/src/network/access/qnetworkcookie.h
+++ b/src/network/access/qnetworkcookie.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKCOOKIE_H
#define QNETWORKCOOKIE_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QList>
#include <QtCore/QMetaType>
diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h
index 61f04e7177..13538ad243 100644
--- a/src/network/access/qnetworkcookie_p.h
+++ b/src/network/access/qnetworkcookie_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtCore/qdatetime.h"
QT_BEGIN_NAMESPACE
diff --git a/src/network/access/qnetworkcookiejar.h b/src/network/access/qnetworkcookiejar.h
index d6370cbc05..f9c1549e20 100644
--- a/src/network/access/qnetworkcookiejar.h
+++ b/src/network/access/qnetworkcookiejar.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKCOOKIEJAR_H
#define QNETWORKCOOKIEJAR_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QObject>
#include <QtCore/QUrl>
diff --git a/src/network/access/qnetworkcookiejar_p.h b/src/network/access/qnetworkcookiejar_p.h
index b6f4eb2bc0..43f189a40c 100644
--- a/src/network/access/qnetworkcookiejar_p.h
+++ b/src/network/access/qnetworkcookiejar_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "private/qobject_p.h"
#include "qnetworkcookie.h"
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/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h
index ad8b83a5f3..a3aa8d3a07 100644
--- a/src/network/access/qnetworkdiskcache.h
+++ b/src/network/access/qnetworkdiskcache.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKDISKCACHE_H
#define QNETWORKDISKCACHE_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qabstractnetworkcache.h>
QT_BEGIN_NAMESPACE
diff --git a/src/network/access/qnetworkdiskcache_p.h b/src/network/access/qnetworkdiskcache_p.h
index 9e035863dd..e47b93b09d 100644
--- a/src/network/access/qnetworkdiskcache_p.h
+++ b/src/network/access/qnetworkdiskcache_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "private/qabstractnetworkcache_p.h"
#include <qbuffer.h>
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/network/access/qnetworkfile_p.h b/src/network/access/qnetworkfile_p.h
new file mode 100644
index 0000000000..dd56b24bd8
--- /dev/null
+++ b/src/network/access/qnetworkfile_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 QNETWORKFILE_H
+#define QNETWORKFILE_H
+
+//
+// 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.
+//
+
+#include <QtNetwork/private/qtnetworkglobal_p.h>
+#include <QFile>
+#include <qnetworkreply.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNetworkFile : public QFile
+{
+ Q_OBJECT
+public:
+ QNetworkFile();
+ QNetworkFile(const QString &name);
+ using QFile::open;
+
+public Q_SLOTS:
+ void open();
+ void close() Q_DECL_OVERRIDE;
+
+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/qnetworkreply.h b/src/network/access/qnetworkreply.h
index 9aaf06a803..1419db8597 100644
--- a/src/network/access/qnetworkreply.h
+++ b/src/network/access/qnetworkreply.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKREPLY_H
#define QNETWORKREPLY_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QIODevice>
#include <QtCore/QString>
#include <QtCore/QVariant>
diff --git a/src/network/access/qnetworkreply_p.h b/src/network/access/qnetworkreply_p.h
index 420b862b17..66d8c9d527 100644
--- a/src/network/access/qnetworkreply_p.h
+++ b/src/network/access/qnetworkreply_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkrequest.h"
#include "qnetworkrequest_p.h"
#include "qnetworkreply.h"
diff --git a/src/network/access/qnetworkreplydataimpl_p.h b/src/network/access/qnetworkreplydataimpl_p.h
index 60d3f583cc..c8b44d7539 100644
--- a/src/network/access/qnetworkreplydataimpl_p.h
+++ b/src/network/access/qnetworkreplydataimpl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkreply.h"
#include "qnetworkreply_p.h"
#include "qnetworkaccessmanager.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..d6af66152e 100644
--- a/src/network/access/qnetworkreplyfileimpl_p.h
+++ b/src/network/access/qnetworkreplyfileimpl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkreply.h"
#include "qnetworkreply_p.h"
#include "qnetworkaccessmanager.h"
@@ -59,13 +60,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 +77,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 +88,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..b5e44fa29a 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -522,36 +522,36 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h
* now
* is the current (local) time
*/
- int age_value = 0;
+ qint64 age_value = 0;
it = cacheHeaders.findRawHeader("age");
if (it != cacheHeaders.rawHeaders.constEnd())
- age_value = it->second.toInt();
+ age_value = it->second.toLongLong();
QDateTime dateHeader;
- int date_value = 0;
+ qint64 date_value = 0;
it = cacheHeaders.findRawHeader("date");
if (it != cacheHeaders.rawHeaders.constEnd()) {
dateHeader = QNetworkHeadersPrivate::fromHttpDate(it->second);
- date_value = dateHeader.toTime_t();
+ date_value = dateHeader.toSecsSinceEpoch();
}
- int now = currentDateTime.toTime_t();
- int request_time = now;
- int response_time = now;
+ qint64 now = currentDateTime.toSecsSinceEpoch();
+ qint64 request_time = now;
+ qint64 response_time = now;
// Algorithm from RFC 2616 section 13.2.3
- int apparent_age = qMax(0, response_time - date_value);
- int corrected_received_age = qMax(apparent_age, age_value);
- int response_delay = response_time - request_time;
- int corrected_initial_age = corrected_received_age + response_delay;
- int resident_time = now - response_time;
- int current_age = corrected_initial_age + resident_time;
+ qint64 apparent_age = qMax<qint64>(0, response_time - date_value);
+ qint64 corrected_received_age = qMax(apparent_age, age_value);
+ qint64 response_delay = response_time - request_time;
+ qint64 corrected_initial_age = corrected_received_age + response_delay;
+ qint64 resident_time = now - response_time;
+ qint64 current_age = corrected_initial_age + resident_time;
- int freshness_lifetime = 0;
+ qint64 freshness_lifetime = 0;
// RFC 2616 13.2.4 Expiration Calculations
if (lastModified.isValid() && dateHeader.isValid()) {
- int diff = lastModified.secsTo(dateHeader);
+ qint64 diff = lastModified.secsTo(dateHeader);
freshness_lifetime = diff / 10;
if (httpRequest.headerField("Warning").isEmpty()) {
QDateTime dt = currentDateTime.addSecs(current_age);
@@ -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();
@@ -745,6 +738,9 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
if (request.attribute(QNetworkRequest::SpdyAllowedAttribute).toBool())
httpRequest.setSPDYAllowed(true);
+ if (request.attribute(QNetworkRequest::HTTP2AllowedAttribute).toBool())
+ httpRequest.setHTTP2Allowed(true);
+
if (static_cast<QNetworkRequest::LoadControl>
(newHttpRequest.attribute(QNetworkRequest::AuthenticationReuseAttribute,
QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual)
@@ -1123,8 +1119,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/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index 4aba915c7d..868fa617b6 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkrequest.h"
#include "qnetworkreply.h"
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 054cbcc3a7..7cd99392d3 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkreply.h"
#include "qnetworkreply_p.h"
#include "qnetworkaccessmanager.h"
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 63332d4fd1..29362b81e2 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -260,6 +260,14 @@ QT_BEGIN_NAMESPACE
Indicates whether SPDY was used for receiving
this reply.
+ \value HTTP2AllowedAttribute
+ Requests only, type: QMetaType::Bool (default: false)
+ Indicates whether the QNetworkAccessManager code is
+ allowed to use HTTP/2 with this request. This applies
+ to SSL requests or 'cleartext' HTTP/2.
+
+ \omitvalue HTTP2WasUsedAttribute
+
\value EmitAllUploadProgressSignalsAttribute
Requests only, type: QMetaType::Bool (default: false)
Indicates whether all upload signals should be emitted.
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index 4a90a50e53..ad8f5bddd9 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKREQUEST_H
#define QNETWORKREQUEST_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QString>
#include <QtCore/QUrl>
@@ -88,6 +89,8 @@ public:
SpdyWasUsedAttribute,
EmitAllUploadProgressSignalsAttribute,
FollowRedirectsAttribute,
+ HTTP2AllowedAttribute,
+ HTTP2WasUsedAttribute,
User = 1000,
UserMax = 32767
diff --git a/src/network/access/qnetworkrequest_p.h b/src/network/access/qnetworkrequest_p.h
index de6941c476..5e18da6d55 100644
--- a/src/network/access/qnetworkrequest_p.h
+++ b/src/network/access/qnetworkrequest_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkrequest.h"
#include "QtCore/qbytearray.h"
#include "QtCore/qlist.h"
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/access/qspdyprotocolhandler_p.h b/src/network/access/qspdyprotocolhandler_p.h
index aba081b9d1..0a18505b23 100644
--- a/src/network/access/qspdyprotocolhandler_p.h
+++ b/src/network/access/qspdyprotocolhandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <private/qabstractprotocolhandler_p.h>
#include <QtNetwork/qnetworkreply.h>
#include <private/qbytedata_p.h>
diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h
index b36fedb741..5fc2578a78 100644
--- a/src/network/bearer/qbearerengine_p.h
+++ b/src/network/bearer/qbearerengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkconfiguration_p.h"
#include "qnetworksession.h"
#include "qnetworkconfigmanager.h"
diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h
index caaa71ca1f..0cdde3c06c 100644
--- a/src/network/bearer/qbearerplugin_p.h
+++ b/src/network/bearer/qbearerplugin_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qbearerengine_p.h"
#include <QtCore/qplugin.h>
diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h
index 4d841d8e33..da248bc7d0 100644
--- a/src/network/bearer/qnetworkconfigmanager.h
+++ b/src/network/bearer/qnetworkconfigmanager.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKCONFIGMANAGER_H
#define QNETWORKCONFIGMANAGER_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qobject.h>
#include <QtNetwork/qnetworkconfiguration.h>
diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h
index a322fb5cfe..a804e037a3 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.h
+++ b/src/network/bearer/qnetworkconfigmanager_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkconfigmanager.h"
#include "qnetworkconfiguration_p.h"
diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h
index 45f7402992..208f9f4692 100644
--- a/src/network/bearer/qnetworkconfiguration.h
+++ b/src/network/bearer/qnetworkconfiguration.h
@@ -40,7 +40,7 @@
#ifndef QNETWORKCONFIGURATION_H
#define QNETWORKCONFIGURATION_H
-# include <QtCore/qglobal.h>
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qstring.h>
diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h
index 316000c717..12d9676b59 100644
--- a/src/network/bearer/qnetworkconfiguration_p.h
+++ b/src/network/bearer/qnetworkconfiguration_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworkconfiguration.h"
#include <QtCore/qshareddata.h>
diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h
index 2ff1d89564..d96b8915eb 100644
--- a/src/network/bearer/qnetworksession.h
+++ b/src/network/bearer/qnetworksession.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKSESSION_H
#define QNETWORKSESSION_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
#include <QtNetwork/qnetworkinterface.h>
diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h
index 45596ea003..661587603c 100644
--- a/src/network/bearer/qnetworksession_p.h
+++ b/src/network/bearer/qnetworksession_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworksession.h"
#include "qnetworkconfiguration_p.h"
#include "QtCore/qsharedpointer.h"
diff --git a/src/network/bearer/qsharednetworksession_p.h b/src/network/bearer/qsharednetworksession_p.h
index ba4bd500ac..001b8af02a 100644
--- a/src/network/bearer/qsharednetworksession_p.h
+++ b/src/network/bearer/qsharednetworksession_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qnetworksession.h"
#include "qnetworkconfiguration.h"
#include <QHash>
diff --git a/src/network/configure.json b/src/network/configure.json
new file mode 100644
index 0000000000..97bf92167d
--- /dev/null
+++ b/src/network/configure.json
@@ -0,0 +1,274 @@
+{
+ "module": "network",
+ "depends": [
+ "core"
+ ],
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "assignments": {
+ "OPENSSL_LIBS": "openssl.libs",
+ "OPENSSL_LIBS_DEBUG": "openssl.libs.debug",
+ "OPENSSL_LIBS_RELEASE": "openssl.libs.release",
+ "OPENSSL_PATH": "openssl.prefix"
+ },
+ "options": {
+ "libproxy": "boolean",
+ "openssl": { "type": "optionalString", "values": [ "no", "yes", "linked", "runtime" ] },
+ "openssl-linked": { "type": "void", "name": "openssl", "value": "linked" },
+ "openssl-runtime": { "type": "void", "name": "openssl", "value": "runtime" },
+ "sctp": "boolean",
+ "securetransport": "boolean",
+ "ssl": "boolean",
+ "system-proxies": "boolean"
+ }
+ },
+
+ "libraries": {
+ "corewlan": {
+ "label": "CoreWLan",
+ "export": "",
+ "test": "mac/corewlan",
+ "sources": [
+ "-framework CoreWLAN -framework Foundation"
+ ]
+ },
+ "network": {
+ "export": "",
+ "sources": [
+ { "type": "makeSpec", "spec": "NETWORK" }
+ ]
+ },
+ "libproxy": {
+ "label": "libproxy",
+ "test": "common/libproxy",
+ "sources": [
+ "-lproxy"
+ ]
+ },
+ "openssl": {
+ "label": "OpenSSL Libraries",
+ "export": "",
+ "sources": [
+ { "type": "openssl" },
+ {
+ "comment": "placeholder for OPENSSL_LIBS{,_{DEBUG,RELEASE}}",
+ "libs": "",
+ "builds": {
+ "debug": "",
+ "release": ""
+ },
+ "condition": "config.win32 && !features.shared"
+ },
+ { "libs": "-lssleay32 -llibeay32", "condition": "config.win32 && features.shared" },
+ { "libs": "-lssl -lcrypto", "condition": "!config.win32" }
+ ]
+ }
+ },
+
+ "tests": {
+ "getaddrinfo": {
+ "label": "getaddrinfo()",
+ "type": "compile",
+ "test": "unix/getaddrinfo",
+ "use": "network"
+ },
+ "getifaddrs": {
+ "label": "getifaddrs()",
+ "type": "compile",
+ "test": "unix/getifaddrs",
+ "use": "network"
+ },
+ "ipv6ifname": {
+ "label": "IPv6 ifname",
+ "type": "compile",
+ "test": "unix/ipv6ifname",
+ "use": "network"
+ },
+ "openssl": {
+ "label": "OpenSSL",
+ "type": "compile",
+ "test": "unix/openssl"
+ },
+ "sctp": {
+ "label": "SCTP support",
+ "type": "compile",
+ "test": "unix/sctp",
+ "use": "network"
+ }
+ },
+
+ "features": {
+ "corewlan": {
+ "label": "CoreWLan",
+ "condition": "libs.corewlan",
+ "emitIf": "config.darwin",
+ "output": [ "feature", "privateFeature" ]
+ },
+ "getaddrinfo": {
+ "label": "getaddrinfo()",
+ "condition": "tests.getaddrinfo",
+ "output": [ "feature" ]
+ },
+ "getifaddrs": {
+ "label": "getifaddrs()",
+ "condition": "tests.getifaddrs",
+ "output": [ "feature" ]
+ },
+ "ipv6ifname": {
+ "label": "IPv6 ifname",
+ "condition": "tests.ipv6ifname",
+ "output": [ "feature" ]
+ },
+ "libproxy": {
+ "label": "libproxy",
+ "autoDetect": false,
+ "condition": "libs.libproxy",
+ "output": [ "privateFeature" ]
+ },
+ "openssl": {
+ "label": "OpenSSL",
+ "enable": "input.openssl == 'yes' || input.openssl == 'linked' || input.openssl == 'runtime'",
+ "disable": "input.openssl == 'no' || input.ssl == 'no'",
+ "autoDetect": "!config.winrt",
+ "condition": "!features.securetransport && tests.openssl",
+ "output": [
+ "privateFeature",
+ { "type": "publicQtConfig", "condition": "!features.openssl-linked" },
+ { "type": "define", "negative": true, "name": "QT_NO_OPENSSL" }
+ ]
+ },
+ "openssl-linked": {
+ "label": " Qt directly linked to OpenSSL",
+ "enable": "input.openssl == 'linked'",
+ "disable": "input.openssl != 'linked'",
+ "condition": "features.openssl && libs.openssl",
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "libs.openssl.libs", "eval": "true" },
+ { "type": "varAssign", "name": "OPENSSL_LIBS_DEBUG", "value": "libs.openssl.builds.debug.libs",
+ "eval": "true", "condition": "config.win32" },
+ { "type": "varAssign", "name": "OPENSSL_LIBS_RELEASE", "value": "libs.openssl.builds.release.libs",
+ "eval": "true", "condition": "config.win32" },
+ { "type": "define", "name": "QT_LINKED_OPENSSL" }
+ ]
+ },
+ "securetransport": {
+ "label": "SecureTransport",
+ "disable": "input.securetransport == 'no' || input.ssl == 'no'",
+ "condition": "config.darwin && (input.openssl == '' || input.openssl == 'no')",
+ "output": [
+ "privateFeature",
+ { "type": "define", "name": "QT_SECURETRANSPORT" }
+ ]
+ },
+ "ssl": {
+ "label": "SSL",
+ "condition": "config.winrt || features.securetransport || features.openssl",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "sctp": {
+ "label": "SCTP",
+ "autoDetect": false,
+ "condition": "tests.sctp",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "system-proxies": {
+ "label": "Use system proxies",
+ "output": [ "privateFeature" ]
+ },
+ "ftp": {
+ "label": "FTP",
+ "purpose": "Provides support for the File Transfer Protocol in QNetworkAccessManager.",
+ "section": "Networking",
+ "condition": "features.textdate",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "http": {
+ "label": "HTTP",
+ "purpose": "Provides support for the Hypertext Transfer Protocol in QNetworkAccessManager.",
+ "section": "Networking",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "udpsocket": {
+ "label": "QUdpSocket",
+ "purpose": "Provides access to UDP sockets.",
+ "section": "Networking",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "networkproxy": {
+ "label": "QNetworkProxy",
+ "purpose": "Provides network proxy support.",
+ "section": "Networking",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "socks5": {
+ "label": "SOCKS5",
+ "purpose": "Provides SOCKS5 support in QNetworkProxy.",
+ "section": "Networking",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "networkinterface": {
+ "label": "QNetworkInterface",
+ "purpose": "Supports enumerating a host's IP addresses and network interfaces.",
+ "section": "Networking",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "networkdiskcache": {
+ "label": "QNetworkDiskCache",
+ "purpose": "Provides a disk cache for network resources.",
+ "section": "Networking",
+ "condition": "features.temporaryfile",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "bearermanagement": {
+ "label": "Bearer management",
+ "purpose": "Provides bearer management for the network stack.",
+ "section": "Networking",
+ "condition": "features.library && features.networkinterface && features.properties",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "localserver": {
+ "label": "QLocalServer",
+ "purpose": "Provides a local socket based server.",
+ "section": "Networking",
+ "condition": "features.temporaryfile",
+ "output": [ "publicFeature", "feature" ]
+ }
+ },
+
+ "report": [
+ {
+ "type": "note",
+ "condition": "features.openssl-linked && libs.openssl.source != 0
+ && input.openssl.prefix == '' && input.openssl.libs == '' && input.openssl.libs.debug == ''",
+ "message": "When linking against OpenSSL, you can override the default
+library names through OPENSSL_LIBS.
+For example:
+ OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt Network",
+ "entries": [
+ {
+ "type": "feature",
+ "args": "corewlan",
+ "condition": "config.darwin"
+ },
+ "getaddrinfo", "getifaddrs", "ipv6ifname", "libproxy",
+ {
+ "type": "feature",
+ "args": "securetransport",
+ "condition": "config.darwin"
+ },
+ "openssl",
+ "openssl-linked",
+ "sctp",
+ "system-proxies"
+ ]
+ }
+ ]
+}
diff --git a/src/network/configure.pri b/src/network/configure.pri
new file mode 100644
index 0000000000..57568902e4
--- /dev/null
+++ b/src/network/configure.pri
@@ -0,0 +1,12 @@
+# custom tests
+
+defineTest(qtConfLibrary_openssl) {
+ libs = $$getenv("OPENSSL_LIBS")
+ !isEmpty(libs) {
+ $${1}.libs = $$libs
+ export($${1}.libs)
+ return(true)
+ }
+ return(false)
+}
+
diff --git a/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp
new file mode 100644
index 0000000000..3783a6f939
--- /dev/null
+++ b/src/network/doc/snippets/code/src_network_socket_qsctpsocket.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+QSctpSocket *socket = new QSctpSocket(this);
+
+socket->setMaxChannelCount(16);
+socket->connectToHost(QHostAddress::LocalHost, 1973);
+
+if (socket->waitForConnected(1000)) {
+ int inputChannels = socket->readChannelCount();
+ int outputChannels = socket->writeChannelCount();
+
+ ....
+}
+//! [0]
diff --git a/src/network/doc/snippets/code/src_network_socket_qudpsocket.cpp b/src/network/doc/snippets/code/src_network_socket_qudpsocket.cpp
index 9e491f802e..a98e31b10b 100644
--- a/src/network/doc/snippets/code/src_network_socket_qudpsocket.cpp
+++ b/src/network/doc/snippets/code/src_network_socket_qudpsocket.cpp
@@ -61,14 +61,7 @@ void Server::initSocket()
void Server::readPendingDatagrams()
{
while (udpSocket->hasPendingDatagrams()) {
- QByteArray datagram;
- datagram.resize(udpSocket->pendingDatagramSize());
- QHostAddress sender;
- quint16 senderPort;
-
- udpSocket->readDatagram(datagram.data(), datagram.size(),
- &sender, &senderPort);
-
+ QNetworkDatagram datagram = udpSocket->receiveDatagram();
processTheDatagram(datagram);
}
}
diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
index 811d8b6f0d..8f37e28669 100644
--- a/src/network/kernel/kernel.pri
+++ b/src/network/kernel/kernel.pri
@@ -3,7 +3,9 @@
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
INCLUDEPATH += $$PWD
-HEADERS += kernel/qauthenticator.h \
+HEADERS += kernel/qtnetworkglobal.h \
+ kernel/qtnetworkglobal_p.h \
+ kernel/qauthenticator.h \
kernel/qauthenticator_p.h \
kernel/qdnslookup.h \
kernel/qdnslookup_p.h \
@@ -11,6 +13,7 @@ HEADERS += kernel/qauthenticator.h \
kernel/qhostaddress_p.h \
kernel/qhostinfo.h \
kernel/qhostinfo_p.h \
+ kernel/qnetworkdatagram.h \
kernel/qnetworkdatagram_p.h \
kernel/qnetworkinterface.h \
kernel/qnetworkinterface_p.h \
@@ -22,9 +25,10 @@ SOURCES += kernel/qauthenticator.cpp \
kernel/qdnslookup.cpp \
kernel/qhostaddress.cpp \
kernel/qhostinfo.cpp \
- kernel/qurlinfo.cpp \
+ kernel/qnetworkdatagram.cpp \
+ kernel/qnetworkinterface.cpp \
kernel/qnetworkproxy.cpp \
- kernel/qnetworkinterface.cpp
+ kernel/qurlinfo.cpp
unix {
!integrity: SOURCES += kernel/qdnslookup_unix.cpp
@@ -52,14 +56,15 @@ win32: {
}
mac {
- LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation
- !ios: LIBS_PRIVATE += -framework CoreServices
+ LIBS_PRIVATE += -framework CoreFoundation
+ !uikit: LIBS_PRIVATE += -framework CoreServices
+ !if(watchos:CONFIG(device, simulator|device)): LIBS_PRIVATE += -framework SystemConfiguration
}
-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) {
+else: qtConfig(libproxy) {
SOURCES += kernel/qnetworkproxy_libproxy.cpp
- LIBS_PRIVATE += -lproxy
+ QMAKE_USE_PRIVATE += libproxy
}
else:SOURCES += kernel/qnetworkproxy_generic.cpp
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 6da231d019..107addae58 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -1271,14 +1271,10 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx,
if(timeArray.size()) {
ds.writeRawData(timeArray.constData(), timeArray.size());
} else {
- QDateTime currentTime(QDate::currentDate(),
- QTime::currentTime(), Qt::UTC);
-
- // number of seconds between 1601 and epoc(1970)
+ // number of seconds between 1601 and the epoch (1970)
// 369 years, 89 leap years
// ((369 * 365) + 89) * 24 * 3600 = 11644473600
-
- time = currentTime.toTime_t() + Q_UINT64_C(11644473600);
+ time = QDateTime::currentSecsSinceEpoch() + 11644473600;
// represented as 100 nano seconds
time = time * Q_UINT64_C(10000000);
@@ -1455,15 +1451,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/qauthenticator.h b/src/network/kernel/qauthenticator.h
index 7f8d912b49..1032c2f501 100644
--- a/src/network/kernel/qauthenticator.h
+++ b/src/network/kernel/qauthenticator.h
@@ -40,6 +40,7 @@
#ifndef QAUTHENTICATOR_H
#define QAUTHENTICATOR_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qvariant.h>
diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h
index 46388a0185..8a1ee0ebe6 100644
--- a/src/network/kernel/qauthenticator_p.h
+++ b/src/network/kernel/qauthenticator_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <qhash.h>
#include <qbytearray.h>
#include <qstring.h>
diff --git a/src/network/kernel/qdnslookup.h b/src/network/kernel/qdnslookup.h
index bf8b6debbe..ead5e650f5 100644
--- a/src/network/kernel/qdnslookup.h
+++ b/src/network/kernel/qdnslookup.h
@@ -40,6 +40,7 @@
#ifndef QDNSLOOKUP_H
#define QDNSLOOKUP_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
#include <QtCore/qshareddata.h>
diff --git a/src/network/kernel/qdnslookup_p.h b/src/network/kernel/qdnslookup_p.h
index 98d828b7b5..d070286383 100644
--- a/src/network/kernel/qdnslookup_p.h
+++ b/src/network/kernel/qdnslookup_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtCore/qmutex.h"
#include "QtCore/qrunnable.h"
#include "QtCore/qsharedpointer.h"
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index 13ecfac3f5..7e3d2c5d6e 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()
@@ -504,7 +536,7 @@ QHostAddress::QHostAddress(SpecialAddress address)
case LocalHostIPv6:
ip6[15] = 1;
- // fall through
+ Q_FALLTHROUGH();
case AnyIPv6:
d->setAddress(ip6);
return;
@@ -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..58af14ee33 100644
--- a/src/network/kernel/qhostaddress.h
+++ b/src/network/kernel/qhostaddress.h
@@ -41,6 +41,7 @@
#ifndef QHOSTADDRESS_H
#define QHOSTADDRESS_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qpair.h>
#include <QtCore/qstring.h>
#include <QtCore/qscopedpointer.h>
@@ -79,6 +80,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 +129,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 +151,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/qhostaddress_p.h b/src/network/kernel/qhostaddress_p.h
index 7b43af01bb..55c3e5afde 100644
--- a/src/network/kernel/qhostaddress_p.h
+++ b/src/network/kernel/qhostaddress_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qhostaddress.h"
#include "qabstractsocket.h"
diff --git a/src/network/kernel/qhostinfo.h b/src/network/kernel/qhostinfo.h
index 42317c4c65..9b4a4853d9 100644
--- a/src/network/kernel/qhostinfo.h
+++ b/src/network/kernel/qhostinfo.h
@@ -40,6 +40,7 @@
#ifndef QHOSTINFO_H
#define QHOSTINFO_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qlist.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qhostaddress.h>
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index 68d7dfae5b..ba342bf533 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtCore/qcoreapplication.h"
#include "private/qcoreapplication_p.h"
#include "QtNetwork/qhostinfo.h"
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/qnetworkdatagram.cpp b/src/network/kernel/qnetworkdatagram.cpp
new file mode 100644
index 0000000000..ba8a063edf
--- /dev/null
+++ b/src/network/kernel/qnetworkdatagram.cpp
@@ -0,0 +1,535 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** 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 "qnetworkdatagram.h"
+#include "qnetworkdatagram_p.h"
+
+#ifndef QT_NO_UDPSOCKET
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QNetworkDatagram
+ \brief The QNetworkDatagram class provides the data and matadata of a UDP datagram.
+ \since 5.8
+ \ingroup network
+ \inmodule QtNetwork
+ \reentrant
+
+ QNetworkDatagram can be used with the \l QUdpSocket class to represent the full
+ information contained in a UDP (User Datagram Protocol) datagram.
+ QNetworkDatagram encapsulates the following information of a datagram:
+ \list
+ \li the payload data;
+ \li the sender address and port number;
+ \li the destination address and port number;
+ \li the remaining hop count limit (on IPv4, this field is usually called "time to live" - TTL);
+ \li the network interface index the datagram was received on or to be sent on.
+ \endlist
+
+ QUdpSocket will try to match a common behavior as much as possible on all
+ operating systems, but not all of the metadata above can be obtained in
+ some operating systems. Metadata that cannot be set on the datagram when
+ sending with QUdpSocket::writeDatagram() will be silently discarded.
+
+ Upon reception, the senderAddress() and senderPort() properties contain the
+ address and port of the peer that sent the datagram, while
+ destinationAddress() and destinationPort() contain the target that was
+ contained in the datagram. That is usually an address local to the current
+ machine, but it can also be an IPv4 broadcast address (such as
+ "255.255.255.255") or an IPv4 or IPv6 multicast address. Applications may
+ find it useful to determine if the datagram was sent specifically to this
+ machine via unicast addressing or whether it was sent to multiple destinations.
+
+ When sending, the senderAddress() and senderPort() should contain the local
+ address to be used when sending. The sender address must be an address that
+ is assigned to this machine, which can be obtained using
+ \l{QNetworkInterface}, and the port number must be the port number that the
+ socket is bound to. Either field can be left unset and will be filled in by
+ the operating system with default values. The destinationAddress() and
+ destinationPort() fields may be set to a target address different from the
+ one the UDP socket is currently associated with.
+
+ Usually, when sending a datagram in reply to a datagram previously
+ received, one will set the destinationAddress() to be the senderAddress()
+ of the incoming datagram and similarly for the port numbers. To facilitate
+ this common process, QNetworkDatagram provides the function makeReply().
+
+ The hopCount() function contains, for a received datagram, the remaining
+ hop count limit for the packet. When sending, it contains the hop count
+ limit to be set. Most protocols will leave this value set to the default
+ and let the operating system decide on the best value to be used.
+ Multicasting over IPv4 often uses this field to indicate the scope of the
+ multicast group (link-local, local to an organization or global).
+
+ The interfaceIndex() function contains the index of the operating system's
+ interface that received the packet. This value is the same one that can be
+ set on a QHostAddress::scopeId() property and matches the
+ QNetworkInterface::index() property. When sending packets to global
+ addresses, it is not necessary to set the interface index as the operating
+ system will choose the correct one using the system routing table. This
+ property is important when sending datagrams to link-local destinations,
+ whether unicast or multicast.
+
+ \section1 Feature support
+
+ Some features of QNetworkDatagram are not supported in all operating systems.
+ Only the address and ports of the remote host (sender in received packets
+ and destination for outgoing packets) are supported in all systems. On most
+ operating systems, the other features are supported only for IPv6. Software
+ should check at runtime whether the rest could be determined for IPv4
+ addresses.
+
+ The current feature support is as follows:
+
+ \table
+ \header \li Operating system \li Local address \li Hop count \li Interface index
+ \row \li FreeBSD \li Supported \li Supported \li Only for IPv6
+ \row \li Linux \li Supported \li Supported \li Supported
+ \row \li OS X \li Supported \li Supported \li Only for IPv6
+ \row \li Other Unix supporting RFC 3542 \li Only for IPv6 \li Only for IPv6 \li Only for IPv6
+ \row \li Windows XP and older \li Not supported \li Not supported \li Not supported
+ \row \li Windows Vista & up \li Supported \li Supported \li Supported
+ \row \li Windows CE \li Not supported \li Not supported \li Not supported
+ \row \li Windows RT \li Not supported \li Not supported \li Not supported
+ \endtable
+
+ \sa QUdpSocket, QNetworkInterface
+ */
+
+/*!
+ Creates a QNetworkDatagram object with no payload data and undefined destination address.
+
+ The payload can be modified by using setData() and the destination address
+ can be set with setDestination().
+
+ If the destination address is left undefined, QUdpSocket::writeDatagram()
+ will attempt to send the datagram to the address last associated with, by
+ using QUdpSocket::connectToHost().
+ */
+QNetworkDatagram::QNetworkDatagram()
+ : d(new QNetworkDatagramPrivate)
+{
+}
+
+/*!
+ Creates a QNetworkDatagram object and sets \a data as the payload data, along with
+ \a destinationAddress and \a port as the destination address of the datagram.
+ */
+QNetworkDatagram::QNetworkDatagram(const QByteArray &data, const QHostAddress &destinationAddress, quint16 port)
+ : d(new QNetworkDatagramPrivate(data, destinationAddress, port))
+{
+}
+
+/*!
+ Creates a copy of the \a other datagram, including the payload and metadata.
+
+ To create a datagram suitable for sending in a reply, use QNetworkDatagram::makeReply();
+ */
+QNetworkDatagram::QNetworkDatagram(const QNetworkDatagram &other)
+ : d(new QNetworkDatagramPrivate(*other.d))
+{
+}
+
+/*! \internal */
+QNetworkDatagram::QNetworkDatagram(QNetworkDatagramPrivate &dd)
+ : d(&dd)
+{
+}
+
+/*!
+ Copies the \a other datagram, including the payload and metadata.
+
+ To create a datagram suitable for sending in a reply, use QNetworkDatagram::makeReply();
+ */
+QNetworkDatagram &QNetworkDatagram::operator=(const QNetworkDatagram &other)
+{
+ *d = *other.d;
+ return *this;
+}
+
+/*!
+ Clears the payload data and metadata in this QNetworkDatagram object, resetting
+ them to their default values.
+ */
+void QNetworkDatagram::clear()
+{
+ d->data.clear();
+ d->header.senderAddress.clear();
+ d->header.destinationAddress.clear();
+ d->header.hopLimit = -1;
+ d->header.ifindex = 0;
+}
+
+/*!
+ \fn QNetworkDatagram::isNull() const
+ Returns true if this QNetworkDatagram object is null. This function is the
+ opposite of isValid().
+ */
+
+/*!
+ Returns true if this QNetworkDatagram object is valid. A valid QNetworkDatagram
+ object contains at least one sender or receiver address. Valid datagrams
+ can contain empty payloads.
+ */
+bool QNetworkDatagram::isValid() const
+{
+ return d->header.senderAddress.protocol() != QAbstractSocket::UnknownNetworkLayerProtocol ||
+ d->header.destinationAddress.protocol() != QAbstractSocket::UnknownNetworkLayerProtocol;
+}
+
+/*!
+ Returns the sender address associated with this datagram. For a datagram
+ received from the network, it is the address of the peer node that sent the
+ datagram. For an outgoing datagrams, it is the local address to be used
+ when sending.
+
+ If no sender address was set on this datagram, the returned object will
+ report true to QHostAddress::isNull().
+
+ \sa destinationAddress(), senderPort(), setSender()
+*/
+QHostAddress QNetworkDatagram::senderAddress() const
+{
+ return d->header.senderAddress;
+}
+
+/*!
+ Returns the destination address associated with this datagram. For a
+ datagram received from the network, it is the address the peer node sent
+ the datagram to, which can either be a local address of this machine or a
+ multicast or broadcast address. For an outgoing datagrams, it is the
+ address the datagram should be sent to.
+
+ If no destination address was set on this datagram, the returned object
+ will report true to QHostAddress::isNull().
+
+ \sa senderAddress(), destinationPort(), setDestination()
+*/
+QHostAddress QNetworkDatagram::destinationAddress() const
+{
+ return d->header.destinationAddress;
+}
+
+/*!
+ Returns the port number of the sender associated with this datagram. For a
+ datagram received from the network, it is the port number that the peer
+ node sent the datagram from. For an outgoing datagram, it is the local port
+ the datagram should be sent from.
+
+ If no sender address was associated with this datagram, this function
+ returns -1.
+
+ \sa senderAddress(), destinationPort(), setSender()
+*/
+int QNetworkDatagram::senderPort() const
+{
+ return d->header.senderAddress.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol
+ ? -1 : d->header.senderPort;
+}
+
+/*!
+ Returns the port number of the destination associated with this datagram.
+ For a datagram received from the network, it is the local port number that
+ the peer node sent the datagram to. For an outgoing datagram, it is the
+ peer port the datagram should be sent to.
+
+ If no destination address was associated with this datagram, this function
+ returns -1.
+
+ \sa destinationAddress(), senderPort(), setDestination()
+*/
+int QNetworkDatagram::destinationPort() const
+{
+ return d->header.destinationAddress.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol
+ ? -1 : d->header.destinationPort;
+}
+
+/*!
+ Sets the sender address associated with this datagram to be the address \a
+ address and port number \a port. The sender address and port numbers are
+ usually set by \l QUdpSocket upon reception, so there's no need to call
+ this function on a received datagram.
+
+ For outgoing datagrams, this function can be used to set the address the
+ datagram should carry. The address \a address must usually be one of the
+ local addresses assigned to this machine, which can be obtained using \l
+ QNetworkInterface. If left unset, the operating system will choose the most
+ appropriate address to use given the destination in question.
+
+ The port number \a port must be the port number associated with the socket,
+ if there is one. The value of 0 can be used to indicate that the operating
+ system should choose the port number.
+
+ \sa QUdpSocket::writeDatagram(), senderAddress(), senderPort(), setDestination()
+ */
+void QNetworkDatagram::setSender(const QHostAddress &address, quint16 port)
+{
+ d->header.senderAddress = address;
+ d->header.senderPort = port;
+}
+
+/*!
+ Sets the destination address associated with this datagram to be the
+ address \a address and port number \a port. The destination address and
+ port numbers are usually set by \l QUdpSocket upon reception, so there's no
+ need to call this function on a received datagram.
+
+ For outgoing datagrams, this function can be used to set the address the
+ datagram should be sent to. It can be the unicast address used to
+ communicate with the peer or a broadcast or multicast address to send to a
+ group of devices.
+
+ \sa QUdpSocket::writeDatagram(), destinationAddress(), destinationPort(), setSender()
+ */
+void QNetworkDatagram::setDestination(const QHostAddress &address, quint16 port)
+{
+ d->header.destinationAddress = address;
+ d->header.destinationPort = port;
+}
+
+/*!
+ Returns the hop count limit associated with this datagram. The hop count
+ limit is the number of nodes that are allowed to forward the IP packet
+ before it expires and an error is sent back to the sender of the datagram.
+ In IPv4, this value is usually known as "time to live" (TTL).
+
+ If this datagram was received from the network, this is the remaining hop
+ count of the datagram after reception and was decremented by 1 by each node
+ that forwarded the packet. A value of -1 indicates that the hop limit count
+ not be obtained.
+
+ If this is an outgoing datagram, this is the value to be set in the IP header
+ upon sending. A value of -1 indicates the operating system should choose
+ the value.
+
+ \sa setHopLimit()
+ */
+int QNetworkDatagram::hopLimit() const
+{
+ return d->header.hopLimit;
+}
+
+/*!
+ Sets the hop count limit associated with this datagram to \a count. The hop
+ count limit is the number of nodes that are allowed to forward the IP
+ packet before it expires and an error is sent back to the sender of the
+ datagram. In IPv4, this value is usually known as "time to live" (TTL).
+
+ It is usually not necessary to call this function on datagrams received
+ from the network.
+
+ If this is an outgoing packet, this is the value to be set in the IP header
+ upon sending. The valid range for the value is 1 to 255. This function also
+ accepts a value of -1 to indicate that the operating system should choose
+ the value.
+
+ \sa hopLimit()
+ */
+void QNetworkDatagram::setHopLimit(int count)
+{
+ d->header.hopLimit = count;
+}
+
+/*!
+ Returns the interface index this datagram is associated with. The interface
+ index is a positive number that uniquely identifies the network interface
+ in the operating system. This number matches the value returned by
+ QNetworkInterface::index() for the interface.
+
+ If this datagram was received from the network, this is the index of the
+ interface that the packet was received from. If this is an outgoing
+ datagram, this is the index of the interface that the datagram should be
+ sent on.
+
+ A value of 0 indicates that the interface index is unknown.
+
+ \sa setInterfaceIndex()
+ */
+uint QNetworkDatagram::interfaceIndex() const
+{
+ return d->header.ifindex;
+}
+
+/*!
+ Sets the interface index this datagram is associated with to \a index. The
+ interface index is a positive number that uniquely identifies the network
+ interface in the operating system. This number matches the value returned
+ by QNetworkInterface::index() for the interface.
+
+ It is usually not necessary to call this function on datagrams received
+ from the network.
+
+ If this is an outgoing packet, this is the index of the interface the
+ datagram should be sent on. A value of 0 indicates that the operating
+ system should choose the interface based on other factors.
+
+ Note that the interface index can also be set with
+ QHostAddress::setScopeId() for IPv6 destination addresses and then with
+ setDestination(). If the scope ID set in the destination address and \a
+ index are different and neither is zero, it is undefined which interface
+ the operating system will send the datagram on.
+
+ \sa setInterfaceIndex()
+ */
+void QNetworkDatagram::setInterfaceIndex(uint index)
+{
+ d->header.ifindex = index;
+}
+
+/*!
+ Returns the data payload of this datagram. For a datagram received from the
+ network, it contains the payload of the datagram. For an outgoing datagram,
+ it is the datagram to be sent.
+
+ Note that datagrams can be transmitted with no data, so the returned
+ QByteArray may be empty.
+
+ \sa setData()
+ */
+QByteArray QNetworkDatagram::data() const
+{
+ return d->data;
+}
+
+/*!
+ Sets the data payload of this datagram to \a data. It is usually not
+ necessary to call this function on received datagrams. For outgoing
+ datagrams, this function sets the data to be sent on the network.
+
+ Since datagrams can empty, an empty QByteArray is a valid value for \a
+ data.
+
+ \sa data()
+ */
+void QNetworkDatagram::setData(const QByteArray &data)
+{
+ d->data = data;
+}
+
+/*!
+ \fn QNetworkDatagram QNetworkDatagram::makeReply(const QByteArray &data) const
+
+ Creates a new QNetworkDatagram representing a reply to this incoming datagram
+ and sets the payload data to \a data. This function is a very convenient
+ way of responding to a datagram back to the original sender.
+
+ Example:
+ \code
+ void Server::readPendingDatagrams()
+ {
+ while (udpSocket->hasPendingDatagrams()) {
+ QNetworkDatagram datagram = udpSocket->receiveDatagram();
+ QByteArray replyData = processThePayload(datagram.data());
+ udpSocket->writeDatagram(datagram.makeReply(replyData));
+ }
+ }
+ \endcode
+
+ This function is especially convenient since it will automatically copy
+ parameters from this datagram to the new datagram as appropriate:
+
+ \list
+ \li this datagram's sender address and port are copied to the new
+ datagram's destination address and port;
+ \li this datagram's interface index, if any, is copied to the new
+ datagram's interface index;
+ \li this datagram's destination address and port are copied to the new
+ datagram's sender address and port only if the address is IPv6
+ global (non-multicast) address;
+ \li the hop count limit on the new datagram is reset to the default (-1);
+ \endlist
+
+ If QNetworkDatagram is modified in a future version of Qt to carry further
+ metadata, this function will copy that metadata as appropriate.
+
+ This datagram's destination address is not copied if it is an IPv4 address
+ because it is not possible to tell an IPv4 broadcast address apart from a
+ regular IPv4 address without an exhaustive search of all addresses assigned
+ to this machine. Attempting to send a datagram with the sender address
+ equal to the broadcast address is likely to fail. However, this should not
+ affect the communication as network interfaces with multiple IPv4 addresses
+ are uncommon, so the address the operating system will select will likely
+ be one the peer will understand.
+
+ \note This function comes with both rvalue- and lvalue-reference qualifier
+ overloads, so it is a good idea to make sure this object is rvalue, if
+ possible, before calling makeReply, so as to make better use of move
+ semantics. To achieve that, the example above would use:
+ \code
+ udpSocket->writeDatagram(std::move(datagram).makeReply(replyData));
+ \endcode
+ */
+
+static bool isNonMulticast(const QHostAddress &addr)
+{
+ // is it a multicast address?
+ return !addr.isMulticast();
+}
+
+QNetworkDatagram QNetworkDatagram::makeReply_helper(const QByteArray &data) const
+{
+ QNetworkDatagramPrivate *x = new QNetworkDatagramPrivate(data, d->header.senderAddress, d->header.senderPort);
+ x->header.ifindex = d->header.ifindex;
+ if (isNonMulticast(d->header.destinationAddress)) {
+ x->header.senderAddress = d->header.destinationAddress;
+ x->header.senderPort = d->header.destinationPort;
+ }
+ return QNetworkDatagram(*x);
+}
+
+void QNetworkDatagram::makeReply_helper_inplace(const QByteArray &data)
+{
+ d->data = data;
+ d->header.hopLimit = -1;
+ qSwap(d->header.destinationPort, d->header.senderPort);
+ qSwap(d->header.destinationAddress, d->header.senderAddress);
+ if (!isNonMulticast(d->header.senderAddress))
+ d->header.senderAddress.clear();
+}
+
+void QNetworkDatagram::destroy(QNetworkDatagramPrivate *d)
+{
+ Q_ASSUME(d);
+ delete d;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_UDPSOCKET
diff --git a/src/network/kernel/qnetworkdatagram.h b/src/network/kernel/qnetworkdatagram.h
new file mode 100644
index 0000000000..a20d69185a
--- /dev/null
+++ b/src/network/kernel/qnetworkdatagram.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** 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 QNETWORKDATAGRAM_H
+#define QNETWORKDATAGRAM_H
+
+#include <QtCore/qbytearray.h>
+#include <QtNetwork/qhostaddress.h>
+
+#ifndef QT_NO_UDPSOCKET
+
+QT_BEGIN_NAMESPACE
+
+class QNetworkDatagramPrivate;
+class QUdpSocketPrivate;
+
+class Q_NETWORK_EXPORT QNetworkDatagram
+{
+public:
+ QNetworkDatagram();
+ QNetworkDatagram(const QByteArray &data, const QHostAddress &destinationAddress = QHostAddress(),
+ quint16 port = 0); // implicit
+ QNetworkDatagram(const QNetworkDatagram &other);
+ QNetworkDatagram &operator=(const QNetworkDatagram &other);
+ ~QNetworkDatagram()
+ { if (d) destroy(d); }
+
+ QNetworkDatagram(QNetworkDatagram &&other) Q_DECL_NOTHROW
+ : d(other.d)
+ { other.d = Q_NULLPTR; }
+ QNetworkDatagram &operator=(QNetworkDatagram &&other) Q_DECL_NOTHROW
+ { swap(other); return *this; }
+
+ void swap(QNetworkDatagram &other) Q_DECL_NOTHROW
+ { qSwap(d, other.d); }
+
+ void clear();
+ bool isValid() const;
+ bool isNull() const
+ { return !isValid(); }
+
+ uint interfaceIndex() const;
+ void setInterfaceIndex(uint index);
+
+ QHostAddress senderAddress() const;
+ QHostAddress destinationAddress() const;
+ int senderPort() const;
+ int destinationPort() const;
+ void setSender(const QHostAddress &address, quint16 port = 0);
+ void setDestination(const QHostAddress &address, quint16 port);
+
+ int hopLimit() const;
+ void setHopLimit(int count);
+
+ QByteArray data() const;
+ void setData(const QByteArray &data);
+
+#ifdef Q_COMPILER_REF_QUALIFIERS
+ QNetworkDatagram makeReply(const QByteArray &payload) const &
+ { return makeReply_helper(payload); }
+ QNetworkDatagram makeReply(const QByteArray &payload) &&
+ { makeReply_helper_inplace(payload); return *this; }
+#else
+ QNetworkDatagram makeReply(const QByteArray &paylaod) const
+ { return makeReply_helper(paylaod); }
+#endif
+
+private:
+ QNetworkDatagramPrivate *d;
+ friend class QUdpSocket;
+ friend class QSctpSocket;
+
+ explicit QNetworkDatagram(QNetworkDatagramPrivate &dd);
+ QNetworkDatagram makeReply_helper(const QByteArray &data) const;
+ void makeReply_helper_inplace(const QByteArray &data);
+ static void destroy(QNetworkDatagramPrivate *d);
+};
+
+Q_DECLARE_SHARED(QNetworkDatagram)
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QNetworkDatagram)
+
+#endif // QT_NO_UDPSOCKET
+
+#endif // QNETWORKDATAGRAM_H
diff --git a/src/network/kernel/qnetworkdatagram_p.h b/src/network/kernel/qnetworkdatagram_p.h
index 4941d8c94b..e55651a78b 100644
--- a/src/network/kernel/qnetworkdatagram_p.h
+++ b/src/network/kernel/qnetworkdatagram_p.h
@@ -45,6 +45,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtNetwork/qhostaddress.h>
QT_BEGIN_NAMESPACE
@@ -53,7 +54,8 @@ class QIpPacketHeader
{
public:
QIpPacketHeader(const QHostAddress &dstAddr = QHostAddress(), quint16 port = 0)
- : destinationAddress(dstAddr), ifindex(0), hopLimit(-1), destinationPort(port)
+ : destinationAddress(dstAddr), ifindex(0), hopLimit(-1), streamNumber(-1),
+ destinationPort(port), endOfRecord(false)
{}
void clear()
@@ -62,6 +64,8 @@ public:
destinationAddress.clear();
ifindex = 0;
hopLimit = -1;
+ streamNumber = -1;
+ endOfRecord = false;
}
QHostAddress senderAddress;
@@ -69,8 +73,25 @@ public:
uint ifindex;
int hopLimit;
+ int streamNumber;
quint16 senderPort;
quint16 destinationPort;
+ bool endOfRecord;
+};
+
+class QNetworkDatagramPrivate
+{
+public:
+ QNetworkDatagramPrivate(const QByteArray &data = QByteArray(),
+ const QHostAddress &dstAddr = QHostAddress(), quint16 port = 0)
+ : data(data), header(dstAddr, port)
+ {}
+ QNetworkDatagramPrivate(const QByteArray &data, const QIpPacketHeader &header)
+ : data(data), header(header)
+ {}
+
+ QByteArray data;
+ QIpPacketHeader header;
};
QT_END_NAMESPACE
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.cpp b/src/network/kernel/qnetworkinterface.cpp
index 28893aa71c..c5d1adbef0 100644
--- a/src/network/kernel/qnetworkinterface.cpp
+++ b/src/network/kernel/qnetworkinterface.cpp
@@ -536,7 +536,7 @@ QList<QNetworkAddressEntry> QNetworkInterface::addressEntries() const
QNetworkInterface::interfaceFromName(name).index()
\endcode
- \sa interfaceFromName(), interfaceNameFromIndex()
+ \sa interfaceFromName(), interfaceNameFromIndex(), QNetworkDatagram::interfaceIndex()
*/
int QNetworkInterface::interfaceIndexFromName(const QString &name)
{
@@ -596,7 +596,7 @@ QNetworkInterface QNetworkInterface::interfaceFromIndex(int index)
QNetworkInterface::interfaceFromIndex(index).name()
\endcode
- \sa interfaceFromIndex(), interfaceIndexFromName()
+ \sa interfaceFromIndex(), interfaceIndexFromName(), QNetworkDatagram::interfaceIndex()
*/
QString QNetworkInterface::interfaceNameFromIndex(int index)
{
diff --git a/src/network/kernel/qnetworkinterface.h b/src/network/kernel/qnetworkinterface.h
index c519de8081..c31621c3cb 100644
--- a/src/network/kernel/qnetworkinterface.h
+++ b/src/network/kernel/qnetworkinterface.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKINTERFACE_H
#define QNETWORKINTERFACE_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qhostaddress.h>
diff --git a/src/network/kernel/qnetworkinterface_p.h b/src/network/kernel/qnetworkinterface_p.h
index aa21d7f92c..ec25fdf37e 100644
--- a/src/network/kernel/qnetworkinterface_p.h
+++ b/src/network/kernel/qnetworkinterface_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/qatomic.h>
#include <QtCore/qlist.h>
#include <QtCore/qreadwritelock.h>
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index 53813c7f9c..4f4615d4d0 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -491,7 +491,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
interfaces = createInterfaces(interfaceListing);
for (ifaddrs *ptr = interfaceListing; ptr; ptr = ptr->ifa_next) {
// Find the interface
- QString name = QString::fromLatin1(ptr->ifa_name);
+ QLatin1String name(ptr->ifa_name);
QNetworkInterfacePrivate *iface = 0;
QList<QNetworkInterfacePrivate *>::Iterator if_it = interfaces.begin();
for ( ; if_it != interfaces.end(); ++if_it)
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.cpp b/src/network/kernel/qnetworkproxy.cpp
index 645f74c616..bb1a7d0d8b 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -212,6 +212,12 @@
lookup on a remote host name and connect to it, as opposed to
requiring the application to perform the name lookup and request
connection to IP addresses only.
+
+ \value SctpTunnelingCapability Ability to open transparent, tunneled
+ SCTP connections to a remote host.
+
+ \value SctpListeningCapability Ability to create a listening socket
+ and wait for an incoming SCTP connection from a remote host.
*/
#include "qnetworkproxy.h"
@@ -369,7 +375,9 @@ static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::Pro
/* [QNetworkProxy::DefaultProxy] = */
(int(QNetworkProxy::ListeningCapability) |
int(QNetworkProxy::TunnelingCapability) |
- int(QNetworkProxy::UdpTunnelingCapability)),
+ int(QNetworkProxy::UdpTunnelingCapability) |
+ int(QNetworkProxy::SctpTunnelingCapability) |
+ int(QNetworkProxy::SctpListeningCapability)),
/* [QNetworkProxy::Socks5Proxy] = */
(int(QNetworkProxy::TunnelingCapability) |
int(QNetworkProxy::ListeningCapability) |
@@ -379,7 +387,9 @@ static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::Pro
/* [QNetworkProxy::NoProxy] = */
(int(QNetworkProxy::ListeningCapability) |
int(QNetworkProxy::TunnelingCapability) |
- int(QNetworkProxy::UdpTunnelingCapability)),
+ int(QNetworkProxy::UdpTunnelingCapability) |
+ int(QNetworkProxy::SctpTunnelingCapability) |
+ int(QNetworkProxy::SctpListeningCapability)),
/* [QNetworkProxy::HttpProxy] = */
(int(QNetworkProxy::TunnelingCapability) |
int(QNetworkProxy::CachingCapability) |
@@ -966,6 +976,14 @@ template<> void QSharedDataPointer<QNetworkProxyQueryPrivate>::detach()
characteristics of the socket. The URL component is not used.
\row
+ \li SctpSocket
+ \li Message-oriented sockets requesting a connection to a remote
+ server. The peer hostname and peer port match the values passed
+ to QSctpSocket::connectToHost(). The local port is usually -1,
+ indicating the socket has no preference in which port should be
+ used. The URL component is not used.
+
+ \row
\li TcpServer
\li Passive server sockets that listen on a port and await
incoming connections from the network. Normally, only the
@@ -981,6 +999,14 @@ template<> void QSharedDataPointer<QNetworkProxyQueryPrivate>::detach()
indicate that more detailed information is present in the URL
component. For ease of implementation, the URL's host and
port are set as the destination address.
+
+ \row
+ \li SctpServer
+ \li Passive server sockets that listen on an SCTP port and await
+ incoming connections from the network. Normally, only the
+ local port is used, but the remote address could be used in
+ specific circumstances, for example to indicate which remote
+ host a connection is expected from. The URL component is not used.
\endtable
It should be noted that any of the criteria may be missing or
@@ -1001,10 +1027,13 @@ template<> void QSharedDataPointer<QNetworkProxyQueryPrivate>::detach()
\value TcpSocket a normal, outgoing TCP socket
\value UdpSocket a datagram-based UDP socket, which could send
to multiple destinations
+ \value SctpSocket a message-oriented, outgoing SCTP socket
\value TcpServer a TCP server that listens for incoming
connections from the network
\value UrlRequest a more complex request which involves loading
of a URL
+ \value SctpServer an SCTP server that listens for incoming
+ connections from the network
\sa queryType(), setQueryType()
*/
@@ -1614,6 +1643,10 @@ QDebug operator<<(QDebug debug, const QNetworkProxy &proxy)
scaps << QStringLiteral("Caching");
if (caps & QNetworkProxy::HostNameLookupCapability)
scaps << QStringLiteral("NameLookup");
+ if (caps & QNetworkProxy::SctpTunnelingCapability)
+ scaps << QStringLiteral("SctpTunnel");
+ if (caps & QNetworkProxy::SctpListeningCapability)
+ scaps << QStringLiteral("SctpListen");
debug << '[' << scaps.join(QLatin1Char(' ')) << ']';
return debug;
}
diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h
index e60a84fa34..fc919a24a6 100644
--- a/src/network/kernel/qnetworkproxy.h
+++ b/src/network/kernel/qnetworkproxy.h
@@ -40,6 +40,7 @@
#ifndef QNETWORKPROXY_H
#define QNETWORKPROXY_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtCore/qshareddata.h>
@@ -59,8 +60,10 @@ public:
enum QueryType {
TcpSocket,
UdpSocket,
+ SctpSocket,
TcpServer = 100,
- UrlRequest
+ UrlRequest,
+ SctpServer
};
QNetworkProxyQuery();
@@ -140,7 +143,9 @@ public:
ListeningCapability = 0x0002,
UdpTunnelingCapability = 0x0004,
CachingCapability = 0x0008,
- HostNameLookupCapability = 0x0010
+ HostNameLookupCapability = 0x0010,
+ SctpTunnelingCapability = 0x00020,
+ SctpListeningCapability = 0x00040
};
Q_DECLARE_FLAGS(Capabilities, Capability)
diff --git a/src/network/kernel/qnetworkproxy_generic.cpp b/src/network/kernel/qnetworkproxy_generic.cpp
index e69870a98c..3ff0cc5168 100644
--- a/src/network/kernel/qnetworkproxy_generic.cpp
+++ b/src/network/kernel/qnetworkproxy_generic.cpp
@@ -79,7 +79,7 @@ static bool ignoreProxyFor(const QNetworkProxyQuery &query)
if (!peerHostName.startsWith('.'))
peerHostName.prepend('.');
- if (peerHostName.endsWith(QString::fromLatin1(token)))
+ if (peerHostName.endsWith(QLatin1String(token)))
return true;
}
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 06a6fbac45..76a2d2df9f 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -180,31 +180,23 @@ static QNetworkProxy proxyFromDictionary(CFDictionaryRef dict)
return QNetworkProxy(proxyType, hostName, port, user, password);
}
-const char * cfurlErrorDescription(SInt32 errorCode)
+namespace {
+struct PACInfo {
+ QCFType<CFArrayRef> proxies;
+ QCFType<CFErrorRef> error;
+ bool done = false;
+};
+
+void proxyAutoConfigCallback(void *client, CFArrayRef proxylist, CFErrorRef error)
{
- switch (errorCode) {
- case kCFURLUnknownError:
- return "Unknown Error";
- case kCFURLUnknownSchemeError:
- return "Unknown Scheme";
- case kCFURLResourceNotFoundError:
- return "Resource Not Found";
- case kCFURLResourceAccessViolationError:
- return "Resource Access Violation";
- case kCFURLRemoteHostUnavailableError:
- return "Remote Host Unavailable";
- case kCFURLImproperArgumentsError:
- return "Improper Arguments";
- case kCFURLUnknownPropertyKeyError:
- return "Unknown Property Key";
- case kCFURLPropertyKeyUnavailableError:
- return "Property Key Unavailable";
- case kCFURLTimeoutError:
- return "Timeout";
- default:
- return "Really Unknown Error";
- }
+ PACInfo *info = reinterpret_cast<PACInfo *>(reinterpret_cast<CFStreamClientContext *>(client)->info);
+ info->done = true;
+ if (proxylist)
+ CFRetain(proxylist);
+ info->proxies = proxylist;
+ info->error = error;
}
+} // anon namespace
QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
{
@@ -234,60 +226,51 @@ 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 {
+ }
+
+ 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
+ }
+
+ CFStreamClientContext pacCtx;
+ pacCtx.version = 0;
+ PACInfo pacInfo;
+ pacCtx.info = &pacInfo;
+ pacCtx.retain = NULL;
+ pacCtx.release = NULL;
+ pacCtx.copyDescription = NULL;
+
+ static CFStringRef pacRunLoopMode = CFSTR("qtPACRunLoopMode");
+
+ QCFType<CFRunLoopSourceRef> pacRunLoopSource = CFNetworkExecuteProxyAutoConfigurationURL(pacUrl, targetURL, &proxyAutoConfigCallback, &pacCtx);
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), pacRunLoopSource, pacRunLoopMode);
+ while (!pacInfo.done)
+ CFRunLoopRunInMode(pacRunLoopMode, 1000, /*returnAfterSourceHandled*/ true);
+
+ if (!pacInfo.proxies) {
QString pacLocation = QCFString::toQString(cfPacLocation);
- qWarning("Mac system proxy: PAC script at \"%s\" not handled", qPrintable(pacLocation));
+ QCFType<CFStringRef> pacErrorDescription = CFErrorCopyDescription(pacInfo.error);
+ qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QCFString::toQString(pacErrorDescription)));
+ return result;
+ }
+
+ CFIndex size = CFArrayGetCount(pacInfo.proxies);
+ for (CFIndex i = 0; i < size; ++i) {
+ CFDictionaryRef proxy = (CFDictionaryRef)CFArrayGetValueAtIndex(pacInfo.proxies, i);
+ result << proxyFromDictionary(proxy);
}
+ return result;
}
}
diff --git a/src/network/kernel/qnetworkproxy_p.h b/src/network/kernel/qnetworkproxy_p.h
index 74cc4105a0..733d8436d0 100644
--- a/src/network/kernel/qnetworkproxy_p.h
+++ b/src/network/kernel/qnetworkproxy_p.h
@@ -40,18 +40,19 @@
#ifndef QNETWORKPROXY_P_H
#define QNETWORKPROXY_P_H
-
//
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
+
#ifndef QT_NO_NETWORKPROXY
QT_BEGIN_NAMESPACE
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index 513eeaac12..949f9fe12b 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)
{
@@ -235,9 +232,15 @@ static QList<QNetworkProxy> filterProxyListByCapabilities(const QList<QNetworkPr
case QNetworkProxyQuery::UdpSocket:
requiredCaps = QNetworkProxy::UdpTunnelingCapability;
break;
+ case QNetworkProxyQuery::SctpSocket:
+ requiredCaps = QNetworkProxy::SctpTunnelingCapability;
+ break;
case QNetworkProxyQuery::TcpServer:
requiredCaps = QNetworkProxy::ListeningCapability;
break;
+ case QNetworkProxyQuery::SctpServer:
+ requiredCaps = QNetworkProxy::SctpListeningCapability;
+ break;
default:
return proxyList;
break;
@@ -284,7 +287,10 @@ static QList<QNetworkProxy> parseServerList(const QNetworkProxyQuery &query, con
QList<QNetworkProxy> result;
QHash<QString, QNetworkProxy> taggedProxies;
const QString requiredTag = query.protocolTag();
- bool checkTags = !requiredTag.isEmpty() && query.queryType() != QNetworkProxyQuery::TcpServer; //windows tags are only for clients
+ // windows tags are only for clients
+ bool checkTags = !requiredTag.isEmpty()
+ && query.queryType() != QNetworkProxyQuery::TcpServer
+ && query.queryType() != QNetworkProxyQuery::SctpServer;
for (const QString &entry : proxyList) {
int server = 0;
@@ -361,7 +367,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 +418,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 +437,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 +473,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 +483,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 +571,6 @@ void QWindowsSystemProxy::init()
}
functional = isAutoConfig || !proxyServerList.isEmpty();
-#endif
}
QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)
diff --git a/config.tests/unix/openvg/openvg.cpp b/src/network/kernel/qtnetworkglobal.h
index a322db4824..586b847816 100644
--- a/config.tests/unix/openvg/openvg.cpp
+++ b/src/network/kernel/qtnetworkglobal.h
@@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,19 +37,25 @@
**
****************************************************************************/
-// There is some variation in OpenVG engines as to what case
-// the VG includes use. The Khronos reference implementation
-// for OpenVG 1.1 uses upper case, so we treat that as canonical.
-#if defined(QT_LOWER_CASE_VG_INCLUDES)
-#include <vg/openvg.h>
+#ifndef QTNETWORKGLOBAL_H
+#define QTNETWORKGLOBAL_H
+
+#include <QtCore/qglobal.h>
+#include <QtNetwork/qtnetwork-config.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_NETWORK_LIB)
+# define Q_NETWORK_EXPORT Q_DECL_EXPORT
+# else
+# define Q_NETWORK_EXPORT Q_DECL_IMPORT
+# endif
#else
-#include <VG/openvg.h>
+# define Q_NETWORK_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
#endif
-int main(int, char **)
-{
- VGint i;
- i = 2;
- vgFlush();
- return 0;
-}
diff --git a/src/network/kernel/qtnetworkglobal_p.h b/src/network/kernel/qtnetworkglobal_p.h
new file mode 100644
index 0000000000..859e3d9ebd
--- /dev/null
+++ b/src/network/kernel/qtnetworkglobal_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** 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 QTNETWORKGLOBAL_P_H
+#define QTNETWORKGLOBAL_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 <QtNetwork/qtnetworkglobal.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtNetwork/private/qtnetwork-config_p.h>
+
+#endif // QTNETWORKGLOBAL_P_H
diff --git a/src/network/kernel/qurlinfo_p.h b/src/network/kernel/qurlinfo_p.h
index b239f94c31..3a430a3321 100644
--- a/src/network/kernel/qurlinfo_p.h
+++ b/src/network/kernel/qurlinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qstring.h>
#include <QtCore/qiodevice.h>
diff --git a/src/network/network.pro b/src/network/network.pro
index 256d718df6..75105bd681 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -9,6 +9,7 @@ DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
#DEFINES += QABSTRACTSOCKET_DEBUG QNATIVESOCKETENGINE_DEBUG
#DEFINES += QTCPSOCKETENGINE_DEBUG QTCPSOCKET_DEBUG QTCPSERVER_DEBUG QSSLSOCKET_DEBUG
#DEFINES += QUDPSOCKET_DEBUG QUDPSERVER_DEBUG
+#DEFINES += QSCTPSOCKET_DEBUG QSCTPSERVER_DEBUG
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000
QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 96021f45f4..34a8025cdd 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -267,7 +267,8 @@
\value TcpSocket TCP
\value UdpSocket UDP
- \value UnknownSocketType Other than TCP and UDP
+ \value SctpSocket SCTP
+ \value UnknownSocketType Other than TCP, UDP and SCTP
\sa QAbstractSocket::socketType()
*/
@@ -563,6 +564,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate()
cachedSocketDescriptor(-1),
readBufferMaxSize(0),
isBuffered(false),
+ hasPendingData(false),
connectTimer(0),
disconnectTimer(0),
hostLookupId(-1),
@@ -593,6 +595,7 @@ void QAbstractSocketPrivate::resetSocketLayer()
qDebug("QAbstractSocketPrivate::resetSocketLayer()");
#endif
+ hasPendingData = false;
if (socketEngine) {
socketEngine->close();
socketEngine->disconnect();
@@ -624,6 +627,7 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
QString typeStr;
if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = QLatin1String("TcpSocket");
else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = QLatin1String("UdpSocket");
+ else if (q->socketType() == QAbstractSocket::SctpSocket) typeStr = QLatin1String("SctpSocket");
else typeStr = QLatin1String("UnknownSocketType");
QString protocolStr;
if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = QLatin1String("IPv4Protocol");
@@ -668,6 +672,12 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
*/
void QAbstractSocketPrivate::configureCreatedSocket()
{
+#ifndef QT_NO_SCTP
+ Q_Q(QAbstractSocket);
+ // Set single stream mode for unbuffered SCTP socket
+ if (socketEngine && q->socketType() == QAbstractSocket::SctpSocket)
+ socketEngine->setOption(QAbstractSocketEngine::MaxStreamsSocketOption, 1);
+#endif
}
/*! \internal
@@ -683,15 +693,13 @@ bool QAbstractSocketPrivate::canReadNotification()
qDebug("QAbstractSocketPrivate::canReadNotification()");
#endif
- if (!isBuffered)
- socketEngine->setReadNotificationEnabled(false);
-
// If buffered, read data from the socket into the read buffer
if (isBuffered) {
const qint64 oldBufferSize = buffer.size();
// Return if there is no space in the buffer
if (readBufferMaxSize && oldBufferSize >= readBufferMaxSize) {
+ socketEngine->setReadNotificationEnabled(false);
#if defined (QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::canReadNotification() buffer is full");
#endif
@@ -714,27 +722,21 @@ bool QAbstractSocketPrivate::canReadNotification()
// to indicate that the data was discarded.
return !q->isReadable();
}
-
- // If read buffer is full, disable the read socket notifier.
- if (readBufferMaxSize && buffer.size() == readBufferMaxSize) {
+ } else {
+ if (hasPendingData) {
socketEngine->setReadNotificationEnabled(false);
+ return true;
}
+ hasPendingData = true;
}
emitReadyRead();
- // If we were closed as a result of the readyRead() signal,
- // return.
- if (state == QAbstractSocket::UnconnectedState || state == QAbstractSocket::ClosingState) {
#if defined (QABSTRACTSOCKET_DEBUG)
+ // If we were closed as a result of the readyRead() signal.
+ if (state == QAbstractSocket::UnconnectedState || state == QAbstractSocket::ClosingState)
qDebug("QAbstractSocketPrivate::canReadNotification() socket is closing - returning");
#endif
- return true;
- }
-
- // 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;
}
@@ -776,7 +778,8 @@ void QAbstractSocketPrivate::canCloseNotification()
QMetaObject::invokeMethod(socketEngine, "closeNotification", Qt::QueuedConnection);
}
- } else if (socketType == QAbstractSocket::TcpSocket && socketEngine) {
+ } else if ((socketType == QAbstractSocket::TcpSocket ||
+ socketType == QAbstractSocket::SctpSocket) && socketEngine) {
emitReadyRead();
}
}
@@ -792,12 +795,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
@@ -837,8 +836,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;
}
@@ -867,17 +870,12 @@ bool QAbstractSocketPrivate::writeToSocket()
if (written > 0) {
// Remove what we wrote so far.
writeBuffer.free(written);
- // Don't emit bytesWritten() recursively.
- if (!emittedBytesWritten) {
- QScopedValueRollback<bool> r(emittedBytesWritten);
- emittedBytesWritten = true;
- emit q->bytesWritten(written);
- }
- emit q->channelBytesWritten(0, written);
+
+ // Emit notifications.
+ emitBytesWritten(written);
}
- if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled()
- && !socketEngine->bytesToWrite())
+ if (writeBuffer.isEmpty() && socketEngine && !socketEngine->bytesToWrite())
socketEngine->setWriteNotificationEnabled(false);
if (state == QAbstractSocket::ClosingState)
q->disconnectFromHost();
@@ -895,7 +893,7 @@ bool QAbstractSocketPrivate::flush()
{
bool dataWasWritten = false;
- while (!writeBuffer.isEmpty() && writeToSocket())
+ while (!allWriteBuffersEmpty() && writeToSocket())
dataWasWritten = true;
return dataWasWritten;
@@ -918,6 +916,8 @@ void QAbstractSocketPrivate::resolveProxy(const QString &hostname, quint16 port)
QNetworkProxyQuery query(hostname, port, QString(),
socketType == QAbstractSocket::TcpSocket ?
QNetworkProxyQuery::TcpSocket :
+ socketType == QAbstractSocket::SctpSocket ?
+ QNetworkProxyQuery::SctpSocket :
QNetworkProxyQuery::UdpSocket);
proxies = QNetworkProxyFactory::proxyForQuery(query);
}
@@ -932,6 +932,10 @@ void QAbstractSocketPrivate::resolveProxy(const QString &hostname, quint16 port)
(p.capabilities() & QNetworkProxy::TunnelingCapability) == 0)
continue;
+ if (socketType == QAbstractSocket::SctpSocket &&
+ (p.capabilities() & QNetworkProxy::SctpTunnelingCapability) == 0)
+ continue;
+
proxyInUse = p;
return;
}
@@ -1150,12 +1154,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.
@@ -1172,11 +1174,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");
@@ -1291,18 +1288,36 @@ bool QAbstractSocketPrivate::readFromSocket()
/*! \internal
- Prevents from the recursive readyRead() emission.
+ Emits readyRead(), protecting against recursion.
*/
-void QAbstractSocketPrivate::emitReadyRead()
+void QAbstractSocketPrivate::emitReadyRead(int channel)
{
Q_Q(QAbstractSocket);
// Only emit readyRead() when not recursing.
- if (!emittedReadyRead) {
+ if (!emittedReadyRead && channel == currentReadChannel) {
QScopedValueRollback<bool> r(emittedReadyRead);
emittedReadyRead = true;
emit q->readyRead();
}
- emit q->channelReadyRead(0);
+ // channelReadyRead() can be emitted recursively - even for the same channel.
+ emit q->channelReadyRead(channel);
+}
+
+/*! \internal
+
+ Emits bytesWritten(), protecting against recursion.
+*/
+void QAbstractSocketPrivate::emitBytesWritten(qint64 bytes, int channel)
+{
+ Q_Q(QAbstractSocket);
+ // Only emit bytesWritten() when not recursing.
+ if (!emittedBytesWritten && channel == currentWriteChannel) {
+ QScopedValueRollback<bool> r(emittedBytesWritten);
+ emittedBytesWritten = true;
+ emit q->bytesWritten(bytes);
+ }
+ // channelBytesWritten() can be emitted recursively - even for the same channel.
+ emit q->channelBytesWritten(channel, bytes);
}
/*! \internal
@@ -1413,8 +1428,8 @@ QAbstractSocket::QAbstractSocket(SocketType socketType,
Q_D(QAbstractSocket);
#if defined(QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocket::QAbstractSocket(%sSocket, QAbstractSocketPrivate == %p, parent == %p)",
- socketType == TcpSocket ? "Tcp" : socketType == UdpSocket
- ? "Udp" : "Unknown", &dd, parent);
+ socketType == TcpSocket ? "Tcp" : socketType == UdpSocket ? "Udp"
+ : socketType == SctpSocket ? "Sctp" : "Unknown", &dd, parent);
#endif
d->socketType = socketType;
}
@@ -1678,9 +1693,9 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port,
#endif
if (openMode & QIODevice::Unbuffered)
- d->isBuffered = false; // Unbuffered QTcpSocket
+ d->isBuffered = false;
else if (!d_func()->isBuffered)
- openMode |= QAbstractSocket::Unbuffered; // QUdpSocket
+ openMode |= QAbstractSocket::Unbuffered;
QIODevice::open(openMode);
d->readChannelCount = d->writeChannelCount = 0;
@@ -2385,11 +2400,6 @@ void QAbstractSocket::abort()
return;
}
#endif
- if (d->connectTimer) {
- d->connectTimer->stop();
- delete d->connectTimer;
- d->connectTimer = 0;
- }
d->abortCalled = true;
close();
@@ -2436,15 +2446,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
@@ -2467,8 +2469,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);
}
@@ -2528,10 +2531,8 @@ qint64 QAbstractSocket::writeData(const char *data, qint64 size)
qt_prettyDebug(data, qMin((int)size, 32), size).data(),
size, written);
#endif
- if (written >= 0) {
- emit bytesWritten(written);
- emit channelBytesWritten(0, written);
- }
+ if (written >= 0)
+ d->emitBytesWritten(written);
return written;
}
@@ -2731,14 +2732,14 @@ void QAbstractSocket::disconnectFromHost()
}
// Wait for pending data to be written.
- if (d->socketEngine && d->socketEngine->isValid() && (d->writeBuffer.size() > 0
+ if (d->socketEngine && d->socketEngine->isValid() && (!d->allWriteBuffersEmpty()
|| d->socketEngine->bytesToWrite() > 0)) {
// hack: when we are waiting for the socket engine to write bytes (only
// possible when using Socks5 or HTTP socket engine), then close
// anyway after 2 seconds. This is to prevent a timeout on Mac, where we
// sometimes just did not get the write notifier from the underlying
// CFSocket and no progress was made.
- if (d->writeBuffer.size() == 0 && d->socketEngine->bytesToWrite() > 0) {
+ if (d->allWriteBuffersEmpty() && d->socketEngine->bytesToWrite() > 0) {
if (!d->disconnectTimer) {
d->disconnectTimer = new QTimer(this);
connect(d->disconnectTimer, SIGNAL(timeout()), this,
@@ -2827,12 +2828,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.h b/src/network/socket/qabstractsocket.h
index aabdcd4776..73a8f11537 100644
--- a/src/network/socket/qabstractsocket.h
+++ b/src/network/socket/qabstractsocket.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTSOCKET_H
#define QABSTRACTSOCKET_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qobject.h>
#ifndef QT_NO_DEBUG_STREAM
@@ -63,6 +64,7 @@ public:
enum SocketType {
TcpSocket,
UdpSocket,
+ SctpSocket,
UnknownSocketType = -1
};
Q_ENUM(SocketType)
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index b718c21ff5..1578d7bb35 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtNetwork/qabstractsocket.h"
#include "QtCore/qbytearray.h"
#include "QtCore/qlist.h"
@@ -85,7 +86,7 @@ public:
virtual bool bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode);
- bool canReadNotification();
+ virtual bool canReadNotification();
bool canWriteNotification();
void canCloseNotification();
@@ -128,22 +129,23 @@ 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();
+ virtual bool writeToSocket();
+ void emitReadyRead(int channel = 0);
+ void emitBytesWritten(qint64 bytes, int channel = 0);
void setError(QAbstractSocket::SocketError errorCode, const QString &errorString);
void setErrorAndEmit(QAbstractSocket::SocketError errorCode, const QString &errorString);
qint64 readBufferMaxSize;
bool isBuffered;
+ bool hasPendingData;
QTimer *connectTimer;
QTimer *disconnectTimer;
diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h
index 0073a8b1f2..0cb519ce90 100644
--- a/src/network/socket/qabstractsocketengine_p.h
+++ b/src/network/socket/qabstractsocketengine_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtNetwork/qhostaddress.h"
#include "QtNetwork/qabstractsocket.h"
#include "private/qobject_p.h"
@@ -103,7 +104,8 @@ public:
MulticastLoopbackOption,
TypeOfServiceOption,
ReceivePacketInformation,
- ReceiveHopLimit
+ ReceiveHopLimit,
+ MaxStreamsSocketOption
};
enum PacketHeaderOption {
@@ -111,6 +113,8 @@ public:
WantDatagramSender = 0x01,
WantDatagramDestination = 0x02,
WantDatagramHopLimit = 0x04,
+ WantStreamNumber = 0x08,
+ WantEndOfRecord = 0x10,
WantAll = 0xff
};
@@ -146,13 +150,13 @@ public:
virtual bool setMulticastInterface(const QNetworkInterface &iface) = 0;
#endif // QT_NO_NETWORKINTERFACE
- virtual qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader *header = 0,
- PacketHeaderOptions = WantNone) = 0;
- virtual qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &header) = 0;
virtual bool hasPendingDatagrams() const = 0;
virtual qint64 pendingDatagramSize() const = 0;
#endif // QT_NO_UDPSOCKET
+ virtual qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader *header = 0,
+ PacketHeaderOptions = WantNone) = 0;
+ virtual qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &header) = 0;
virtual qint64 bytesToWrite() const = 0;
virtual int option(SocketOption option) const = 0;
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index f9ff958525..899c02fba6 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -289,34 +289,34 @@ bool QHttpSocketEngine::setMulticastInterface(const QNetworkInterface &)
}
#endif // QT_NO_NETWORKINTERFACE
-qint64 QHttpSocketEngine::readDatagram(char *, qint64, QIpPacketHeader *, PacketHeaderOptions)
+bool QHttpSocketEngine::hasPendingDatagrams() const
{
qWarning("Operation is not supported");
- setError(QAbstractSocket::UnsupportedSocketOperationError,
- QLatin1String("Unsupported socket operation"));
- return -1;
+ return false;
}
-qint64 QHttpSocketEngine::writeDatagram(const char *, qint64, const QIpPacketHeader &)
+qint64 QHttpSocketEngine::pendingDatagramSize() const
{
qWarning("Operation is not supported");
- setError(QAbstractSocket::UnsupportedSocketOperationError,
- QLatin1String("Unsupported socket operation"));
return -1;
}
+#endif // QT_NO_UDPSOCKET
-bool QHttpSocketEngine::hasPendingDatagrams() const
+qint64 QHttpSocketEngine::readDatagram(char *, qint64, QIpPacketHeader *, PacketHeaderOptions)
{
qWarning("Operation is not supported");
- return false;
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ QLatin1String("Unsupported socket operation"));
+ return -1;
}
-qint64 QHttpSocketEngine::pendingDatagramSize() const
+qint64 QHttpSocketEngine::writeDatagram(const char *, qint64, const QIpPacketHeader &)
{
qWarning("Operation is not supported");
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ QLatin1String("Unsupported socket operation"));
return -1;
}
-#endif // QT_NO_UDPSOCKET
qint64 QHttpSocketEngine::bytesToWrite() const
{
diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h
index 1cc168afec..07815a7e51 100644
--- a/src/network/socket/qhttpsocketengine_p.h
+++ b/src/network/socket/qhttpsocketengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "private/qabstractsocketengine_p.h"
#include "qabstractsocket.h"
#include "qnetworkproxy.h"
@@ -111,13 +112,13 @@ public:
bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
#endif // QT_NO_NETWORKINTERFACE
- qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader *,
- PacketHeaderOptions) Q_DECL_OVERRIDE;
- qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
#endif // QT_NO_UDPSOCKET
+ qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader *,
+ PacketHeaderOptions) Q_DECL_OVERRIDE;
+ qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
qint64 bytesToWrite() const Q_DECL_OVERRIDE;
int option(SocketOption option) const Q_DECL_OVERRIDE;
diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h
index 52f0813746..786885b6cd 100644
--- a/src/network/socket/qlocalserver.h
+++ b/src/network/socket/qlocalserver.h
@@ -40,6 +40,7 @@
#ifndef QLOCALSERVER_H
#define QLOCALSERVER_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qabstractsocket.h>
QT_BEGIN_NAMESPACE
diff --git a/src/network/socket/qlocalserver_p.h b/src/network/socket/qlocalserver_p.h
index 28d2b08902..988140c1a4 100644
--- a/src/network/socket/qlocalserver_p.h
+++ b/src/network/socket/qlocalserver_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
+
#ifndef QT_NO_LOCALSERVER
#include "qlocalserver.h"
diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h
index 0eecab206b..ea074db90e 100644
--- a/src/network/socket/qlocalsocket.h
+++ b/src/network/socket/qlocalsocket.h
@@ -40,6 +40,7 @@
#ifndef QLOCALSOCKET_H
#define QLOCALSOCKET_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qiodevice.h>
#include <QtNetwork/qabstractsocket.h>
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index 56f8b590f1..560d74328e 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
+
#ifndef QT_NO_LOCALSOCKET
#include "qlocalsocket.h"
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 9ba9d5317e..f2bc3cec94 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -111,7 +111,7 @@
\value WantAll this is a catch-all value to indicate the caller is
interested in all the available information
- \sa readDatagram()
+ \sa readDatagram(), QNetworkDatagram
*/
#include "qnativesocketengine_p.h"
@@ -174,6 +174,12 @@ QT_BEGIN_NAMESPACE
" socket other than "#type""); \
return (returnValue); \
} } while (0)
+#define Q_CHECK_TYPES(function, type1, type2, returnValue) do { \
+ if (d->socketType != (type1) && d->socketType != (type2)) { \
+ qWarning(#function" was called by a" \
+ " socket other than "#type1" or "#type2); \
+ return (returnValue); \
+ } } while (0)
#define Q_TR(a) QT_TRANSLATE_NOOP(QNativeSocketEngine, a)
/*! \internal
@@ -417,6 +423,7 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
QString typeStr = QLatin1String("UnknownSocketType");
if (socketType == QAbstractSocket::TcpSocket) typeStr = QLatin1String("TcpSocket");
else if (socketType == QAbstractSocket::UdpSocket) typeStr = QLatin1String("UdpSocket");
+ else if (socketType == QAbstractSocket::SctpSocket) typeStr = QLatin1String("SctpSocket");
QString protocolStr = QLatin1String("UnknownProtocol");
if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = QLatin1String("IPv4Protocol");
else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = QLatin1String("IPv6Protocol");
@@ -659,7 +666,12 @@ bool QNativeSocketEngine::listen()
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::listen(), false);
Q_CHECK_STATE(QNativeSocketEngine::listen(), QAbstractSocket::BoundState, false);
+#ifndef QT_NO_SCTP
+ Q_CHECK_TYPES(QNativeSocketEngine::listen(), QAbstractSocket::TcpSocket,
+ QAbstractSocket::SctpSocket, false);
+#else
Q_CHECK_TYPE(QNativeSocketEngine::listen(), QAbstractSocket::TcpSocket, false);
+#endif
// We're using a backlog of 50. Most modern kernels support TCP
// syncookies by default, and if they do, the backlog is ignored.
@@ -680,7 +692,12 @@ int QNativeSocketEngine::accept()
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::accept(), -1);
Q_CHECK_STATE(QNativeSocketEngine::accept(), QAbstractSocket::ListeningState, -1);
+#ifndef QT_NO_SCTP
+ Q_CHECK_TYPES(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket,
+ QAbstractSocket::SctpSocket, -1);
+#else
Q_CHECK_TYPE(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket, -1);
+#endif
return d->nativeAccept();
}
@@ -793,6 +810,7 @@ qint64 QNativeSocketEngine::pendingDatagramSize() const
return d->nativePendingDatagramSize();
}
+#endif // QT_NO_UDPSOCKET
/*!
Reads up to \a maxSize bytes of a datagram from the socket,
@@ -800,9 +818,10 @@ qint64 QNativeSocketEngine::pendingDatagramSize() const
address, port, and other IP header fields are stored in \a header
according to the request in \a options.
- To avoid unnecessarily loss of data, call pendingDatagramSize() to
- determine the size of the pending message before reading it. If \a
- maxSize is too small, the rest of the datagram will be lost.
+ For UDP sockets, to avoid unnecessarily loss of data, call
+ pendingDatagramSize() to determine the size of the pending message
+ before reading it. If \a maxSize is too small, the rest of the
+ datagram will be lost.
Returns -1 if an error occurred.
@@ -813,13 +832,14 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxSize, QIpPacketHe
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::readDatagram(), -1);
- Q_CHECK_TYPE(QNativeSocketEngine::readDatagram(), QAbstractSocket::UdpSocket, -1);
+ Q_CHECK_STATES(QNativeSocketEngine::readDatagram(), QAbstractSocket::BoundState,
+ QAbstractSocket::ConnectedState, -1);
return d->nativeReceiveDatagram(data, maxSize, header, options);
}
/*!
- Writes a UDP datagram of size \a size bytes to the socket from
+ Writes a datagram of size \a size bytes to the socket from
\a data to the destination contained in \a header, and returns the
number of bytes written, or -1 if an error occurred. If \a header
contains other settings like hop limit or source address, this function
@@ -844,11 +864,11 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size, const Q
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::writeDatagram(), -1);
- Q_CHECK_TYPE(QNativeSocketEngine::writeDatagram(), QAbstractSocket::UdpSocket, -1);
+ Q_CHECK_STATES(QNativeSocketEngine::writeDatagram(), QAbstractSocket::BoundState,
+ QAbstractSocket::ConnectedState, -1);
return d->nativeSendDatagram(data, size, header);
}
-#endif // QT_NO_UDPSOCKET
/*!
Writes a block of \a size bytes from \a data to the socket.
@@ -881,7 +901,11 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxSize)
qint64 readBytes = d->nativeRead(data, maxSize);
// Handle remote close
- if (readBytes == 0 && d->socketType == QAbstractSocket::TcpSocket) {
+ if (readBytes == 0 && (d->socketType == QAbstractSocket::TcpSocket
+#ifndef QT_NO_SCTP
+ || d->socketType == QAbstractSocket::SctpSocket
+#endif
+ )) {
d->setError(QAbstractSocket::RemoteHostClosedError,
QNativeSocketEnginePrivate::RemoteHostClosedErrorString);
close();
@@ -1007,26 +1031,28 @@ bool QNativeSocketEngine::waitForWrite(int msecs, bool *timedOut)
// select(writable) is successful. In this case we should not
// issue a second call to WSAConnect()
#if defined (Q_OS_WIN)
- if (ret > 0) {
- setState(QAbstractSocket::ConnectedState);
- d_func()->fetchConnectionParameters();
- return true;
- } else {
- int value = 0;
- int valueSize = sizeof(value);
- if (::getsockopt(d->socketDescriptor, SOL_SOCKET, SO_ERROR, (char *) &value, &valueSize) == 0) {
- if (value == WSAECONNREFUSED) {
- d->setError(QAbstractSocket::ConnectionRefusedError, QNativeSocketEnginePrivate::ConnectionRefusedErrorString);
- d->socketState = QAbstractSocket::UnconnectedState;
- return false;
- } else if (value == WSAETIMEDOUT) {
- d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::ConnectionTimeOutErrorString);
- d->socketState = QAbstractSocket::UnconnectedState;
- return false;
- } else if (value == WSAEHOSTUNREACH) {
- d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::HostUnreachableErrorString);
- d->socketState = QAbstractSocket::UnconnectedState;
- return false;
+ if (state() == QAbstractSocket::ConnectingState) {
+ if (ret > 0) {
+ setState(QAbstractSocket::ConnectedState);
+ d_func()->fetchConnectionParameters();
+ return true;
+ } else {
+ int value = 0;
+ int valueSize = sizeof(value);
+ if (::getsockopt(d->socketDescriptor, SOL_SOCKET, SO_ERROR, (char *) &value, &valueSize) == 0) {
+ if (value == WSAECONNREFUSED) {
+ d->setError(QAbstractSocket::ConnectionRefusedError, QNativeSocketEnginePrivate::ConnectionRefusedErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ return false;
+ } else if (value == WSAETIMEDOUT) {
+ d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::ConnectionTimeOutErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ return false;
+ } else if (value == WSAEHOSTUNREACH) {
+ d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::HostUnreachableErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ return false;
+ }
}
}
}
@@ -1060,26 +1086,28 @@ bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWri
// select(writable) is successful. In this case we should not
// issue a second call to WSAConnect()
#if defined (Q_OS_WIN)
- if (checkWrite && ((readyToWrite && *readyToWrite) || !readyToWrite) && ret > 0) {
- setState(QAbstractSocket::ConnectedState);
- d_func()->fetchConnectionParameters();
- return true;
- } else {
- int value = 0;
- int valueSize = sizeof(value);
- if (::getsockopt(d->socketDescriptor, SOL_SOCKET, SO_ERROR, (char *) &value, &valueSize) == 0) {
- if (value == WSAECONNREFUSED) {
- d->setError(QAbstractSocket::ConnectionRefusedError, QNativeSocketEnginePrivate::ConnectionRefusedErrorString);
- d->socketState = QAbstractSocket::UnconnectedState;
- return false;
- } else if (value == WSAETIMEDOUT) {
- d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::ConnectionTimeOutErrorString);
- d->socketState = QAbstractSocket::UnconnectedState;
- return false;
- } else if (value == WSAEHOSTUNREACH) {
- d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::HostUnreachableErrorString);
- d->socketState = QAbstractSocket::UnconnectedState;
- return false;
+ if (state() == QAbstractSocket::ConnectingState) {
+ if (checkWrite && ((readyToWrite && *readyToWrite) || !readyToWrite) && ret > 0) {
+ setState(QAbstractSocket::ConnectedState);
+ d_func()->fetchConnectionParameters();
+ return true;
+ } else {
+ int value = 0;
+ int valueSize = sizeof(value);
+ if (::getsockopt(d->socketDescriptor, SOL_SOCKET, SO_ERROR, (char *) &value, &valueSize) == 0) {
+ if (value == WSAECONNREFUSED) {
+ d->setError(QAbstractSocket::ConnectionRefusedError, QNativeSocketEnginePrivate::ConnectionRefusedErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ return false;
+ } else if (value == WSAETIMEDOUT) {
+ d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::ConnectionTimeOutErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ return false;
+ } else if (value == WSAEHOSTUNREACH) {
+ d->setError(QAbstractSocket::NetworkError, QNativeSocketEnginePrivate::HostUnreachableErrorString);
+ d->socketState = QAbstractSocket::UnconnectedState;
+ return false;
+ }
}
}
}
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index 19e9e1d9b7..46c7ae5c55 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -45,12 +45,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtNetwork/qhostaddress.h"
#include "QtNetwork/qnetworkinterface.h"
#include "private/qabstractsocketengine_p.h"
@@ -66,21 +68,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 +97,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;
@@ -157,13 +157,13 @@ public:
bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
#endif
- qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0,
- PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE;
- qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
#endif // QT_NO_UDPSOCKET
+ qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0,
+ PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE;
+ qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
qint64 bytesToWrite() const Q_DECL_OVERRIDE;
qint64 receiveBufferSize() const;
@@ -210,7 +210,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_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 2d50cc1f8d..d1efc21e09 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -68,6 +68,11 @@
#endif
#include <netinet/tcp.h>
+#ifndef QT_NO_SCTP
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/sctp.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -142,6 +147,7 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,
switch (opt) {
case QNativeSocketEngine::NonBlockingSocketOption: // fcntl, not setsockopt
case QNativeSocketEngine::BindExclusively: // not handled on Unix
+ case QNativeSocketEngine::MaxStreamsSocketOption:
Q_UNREACHABLE();
case QNativeSocketEngine::BroadcastSocketOption:
@@ -229,13 +235,28 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,
bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType,
QAbstractSocket::NetworkLayerProtocol &socketProtocol)
{
- int protocol = (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) ? AF_INET6 : AF_INET;
+#ifndef QT_NO_SCTP
+ int protocol = (socketType == QAbstractSocket::SctpSocket) ? IPPROTO_SCTP : 0;
+#else
+ if (socketType == QAbstractSocket::SctpSocket) {
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ ProtocolUnsupportedErrorString);
+#if defined (QNATIVESOCKETENGINE_DEBUG)
+ qDebug("QNativeSocketEnginePrivate::createNewSocket(%d, %d): unsupported protocol",
+ socketType, socketProtocol);
+#endif
+ return false;
+ }
+ int protocol = 0;
+#endif // QT_NO_SCTP
+ int domain = (socketProtocol == QAbstractSocket::IPv6Protocol
+ || socketProtocol == QAbstractSocket::AnyIPProtocol) ? AF_INET6 : AF_INET;
int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM;
- int socket = qt_safe_socket(protocol, type, 0, O_NONBLOCK);
+ int socket = qt_safe_socket(domain, type, protocol, O_NONBLOCK);
if (socket < 0 && socketProtocol == QAbstractSocket::AnyIPProtocol && errno == EAFNOSUPPORT) {
- protocol = AF_INET;
- socket = qt_safe_socket(protocol, type, 0, O_NONBLOCK);
+ domain = AF_INET;
+ socket = qt_safe_socket(domain, type, protocol, O_NONBLOCK);
socketProtocol = QAbstractSocket::IPv4Protocol;
}
@@ -291,10 +312,26 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
if (!q->isValid())
return -1;
- // handle non-getsockopt cases first
- if (opt == QNativeSocketEngine::BindExclusively || opt == QNativeSocketEngine::NonBlockingSocketOption
- || opt == QNativeSocketEngine::BroadcastSocketOption)
+ // handle non-getsockopt and specific cases first
+ switch (opt) {
+ case QNativeSocketEngine::BindExclusively:
+ case QNativeSocketEngine::NonBlockingSocketOption:
+ case QNativeSocketEngine::BroadcastSocketOption:
+ return -1;
+ case QNativeSocketEngine::MaxStreamsSocketOption: {
+#ifndef QT_NO_SCTP
+ sctp_initmsg sctpInitMsg;
+ QT_SOCKOPTLEN_T sctpInitMsgSize = sizeof(sctpInitMsg);
+ if (::getsockopt(socketDescriptor, SOL_SCTP, SCTP_INITMSG, &sctpInitMsg,
+ &sctpInitMsgSize) == 0)
+ return int(qMin(sctpInitMsg.sinit_num_ostreams, sctpInitMsg.sinit_max_instreams));
+#endif
return -1;
+ }
+
+ default:
+ break;
+ }
int n, level;
int v = -1;
@@ -317,7 +354,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
if (!q->isValid())
return false;
- // handle non-setsockopt cases first
+ // handle non-setsockopt and specific cases first
switch (opt) {
case QNativeSocketEngine::NonBlockingSocketOption: {
// Make the socket nonblocking.
@@ -351,6 +388,20 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
case QNativeSocketEngine::BindExclusively:
return true;
+ case QNativeSocketEngine::MaxStreamsSocketOption: {
+#ifndef QT_NO_SCTP
+ sctp_initmsg sctpInitMsg;
+ QT_SOCKOPTLEN_T sctpInitMsgSize = sizeof(sctpInitMsg);
+ if (::getsockopt(socketDescriptor, SOL_SCTP, SCTP_INITMSG, &sctpInitMsg,
+ &sctpInitMsgSize) == 0) {
+ sctpInitMsg.sinit_num_ostreams = sctpInitMsg.sinit_max_instreams = uint16_t(v);
+ return ::setsockopt(socketDescriptor, SOL_SCTP, SCTP_INITMSG, &sctpInitMsg,
+ sctpInitMsgSize) == 0;
+ }
+#endif
+ return false;
+ }
+
default:
break;
}
@@ -830,6 +881,9 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
#if !defined(IP_PKTINFO) && defined(IP_RECVIF) && defined(Q_OS_BSD4)
+ CMSG_SPACE(sizeof(sockaddr_dl))
#endif
+#ifndef QT_NO_SCTP
+ + CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))
+#endif
+ sizeof(quintptr) - 1) / sizeof(quintptr)];
struct msghdr msg;
@@ -848,7 +902,8 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
msg.msg_name = &aa;
msg.msg_namelen = sizeof(aa);
}
- if (options & (QAbstractSocketEngine::WantDatagramHopLimit | QAbstractSocketEngine::WantDatagramDestination)) {
+ if (options & (QAbstractSocketEngine::WantDatagramHopLimit | QAbstractSocketEngine::WantDatagramDestination
+ | QAbstractSocketEngine::WantStreamNumber)) {
msg.msg_control = cbuf;
msg.msg_controllen = sizeof(cbuf);
}
@@ -859,13 +914,27 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
} while (recvResult == -1 && errno == EINTR);
if (recvResult == -1) {
- setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString);
+ switch (errno) {
+#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
+#endif
+ case EAGAIN:
+ // No datagram was available for reading
+ recvResult = -2;
+ break;
+ case ECONNREFUSED:
+ setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString);
+ break;
+ default:
+ setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString);
+ }
if (header)
header->clear();
} else if (options != QAbstractSocketEngine::WantNone) {
Q_ASSERT(header);
qt_socket_getPortAndAddress(&aa, &header->senderPort, &header->senderAddress);
header->destinationPort = localPort;
+ header->endOfRecord = (msg.msg_flags & MSG_EOR) != 0;
// parse the ancillary data
struct cmsghdr *cmsgptr;
@@ -912,6 +981,15 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
|| (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_TTL))) {
header->hopLimit = *reinterpret_cast<int *>(CMSG_DATA(cmsgptr));
}
+
+#ifndef QT_NO_SCTP
+ if (cmsgptr->cmsg_level == IPPROTO_SCTP && cmsgptr->cmsg_type == SCTP_SNDRCV
+ && cmsgptr->cmsg_len >= CMSG_LEN(sizeof(sctp_sndrcvinfo))) {
+ sctp_sndrcvinfo *rcvInfo = reinterpret_cast<sctp_sndrcvinfo *>(CMSG_DATA(cmsgptr));
+
+ header->streamNumber = int(rcvInfo->sinfo_stream);
+ }
+#endif
}
}
@@ -924,13 +1002,17 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
? header->senderPort : 0, (qint64) recvResult);
#endif
- return qint64(maxSize ? recvResult : recvResult == -1 ? -1 : 0);
+ return qint64((maxSize || recvResult < 0) ? recvResult : Q_INT64_C(0));
}
qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 len, const QIpPacketHeader &header)
{
// we use quintptr to force the alignment
- quintptr cbuf[(CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int)) + sizeof(quintptr) - 1) / sizeof(quintptr)];
+ quintptr cbuf[(CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int))
+#ifndef QT_NO_SCTP
+ + CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))
+#endif
+ + sizeof(quintptr) - 1) / sizeof(quintptr)];
struct cmsghdr *cmsgptr = reinterpret_cast<struct cmsghdr *>(cbuf);
struct msghdr msg;
@@ -943,10 +1025,13 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
vec.iov_len = len;
msg.msg_iov = &vec;
msg.msg_iovlen = 1;
- msg.msg_name = &aa.a;
msg.msg_control = &cbuf;
- setPortAndAddress(header.destinationPort, header.destinationAddress, &aa, &msg.msg_namelen);
+ if (header.destinationPort != 0) {
+ msg.msg_name = &aa.a;
+ setPortAndAddress(header.destinationPort, header.destinationAddress,
+ &aa, &msg.msg_namelen);
+ }
if (msg.msg_namelen == sizeof(aa.a6)) {
if (header.hopLimit != -1) {
@@ -1001,15 +1086,37 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
#endif
}
+#ifndef QT_NO_SCTP
+ if (header.streamNumber != -1) {
+ struct sctp_sndrcvinfo *data = reinterpret_cast<sctp_sndrcvinfo *>(CMSG_DATA(cmsgptr));
+ memset(data, 0, sizeof(*data));
+ msg.msg_controllen += CMSG_SPACE(sizeof(sctp_sndrcvinfo));
+ cmsgptr->cmsg_len = CMSG_LEN(sizeof(sctp_sndrcvinfo));
+ cmsgptr->cmsg_level = IPPROTO_SCTP;
+ cmsgptr->cmsg_type = SCTP_SNDRCV;
+ data->sinfo_stream = uint16_t(header.streamNumber);
+ cmsgptr = reinterpret_cast<cmsghdr *>(reinterpret_cast<char *>(cmsgptr) + CMSG_SPACE(sizeof(*data)));
+ }
+#endif
+
if (msg.msg_controllen == 0)
msg.msg_control = 0;
ssize_t sentBytes = qt_safe_sendmsg(socketDescriptor, &msg, 0);
if (sentBytes < 0) {
switch (errno) {
+#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
+ case EWOULDBLOCK:
+#endif
+ case EAGAIN:
+ sentBytes = -2;
+ break;
case EMSGSIZE:
setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString);
break;
+ case ECONNRESET:
+ setError(QAbstractSocket::RemoteHostClosedError, RemoteHostClosedErrorString);
+ break;
default:
setError(QAbstractSocket::NetworkError, SendDatagramErrorString);
}
@@ -1082,21 +1189,51 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
#endif
// Determine the remote address
- if (!::getpeername(socketDescriptor, &sa.a, &sockAddrSize)) {
+ bool connected = ::getpeername(socketDescriptor, &sa.a, &sockAddrSize) == 0;
+ if (connected) {
qt_socket_getPortAndAddress(&sa, &peerPort, &peerAddress);
inboundStreamCount = outboundStreamCount = 1;
}
- // Determine the socket type (UDP/TCP)
+ // Determine the socket type (UDP/TCP/SCTP)
int value = 0;
QT_SOCKOPTLEN_T valueSize = sizeof(int);
if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_TYPE, &value, &valueSize) == 0) {
- if (value == SOCK_STREAM)
- socketType = QAbstractSocket::TcpSocket;
- else if (value == SOCK_DGRAM)
- socketType = QAbstractSocket::UdpSocket;
- else
- socketType = QAbstractSocket::UnknownSocketType;
+ if (value == SOCK_STREAM) {
+#ifndef QT_NO_SCTP
+ if (option(QNativeSocketEngine::MaxStreamsSocketOption) != -1) {
+ socketType = QAbstractSocket::SctpSocket;
+ if (connected) {
+ sctp_status sctpStatus;
+ QT_SOCKOPTLEN_T sctpStatusSize = sizeof(sctpStatus);
+ sctp_event_subscribe sctpEvents;
+
+ memset(&sctpEvents, 0, sizeof(sctpEvents));
+ sctpEvents.sctp_data_io_event = 1;
+ if (::getsockopt(socketDescriptor, SOL_SCTP, SCTP_STATUS, &sctpStatus,
+ &sctpStatusSize) == 0 &&
+ ::setsockopt(socketDescriptor, SOL_SCTP, SCTP_EVENTS, &sctpEvents,
+ sizeof(sctpEvents)) == 0) {
+ inboundStreamCount = int(sctpStatus.sstat_instrms);
+ outboundStreamCount = int(sctpStatus.sstat_outstrms);
+ } else {
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ InvalidSocketErrorString);
+ return false;
+ }
+ }
+ } else {
+ socketType = QAbstractSocket::TcpSocket;
+ }
+#else
+ socketType = QAbstractSocket::TcpSocket;
+#endif
+ } else {
+ if (value == SOCK_DGRAM)
+ socketType = QAbstractSocket::UdpSocket;
+ else
+ socketType = QAbstractSocket::UnknownSocketType;
+ }
}
#if defined (QNATIVESOCKETENGINE_DEBUG)
QString socketProtocolStr = QStringLiteral("UnknownProtocol");
@@ -1106,6 +1243,7 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
QString socketTypeStr = QStringLiteral("UnknownSocketType");
if (socketType == QAbstractSocket::TcpSocket) socketTypeStr = QStringLiteral("TcpSocket");
else if (socketType == QAbstractSocket::UdpSocket) socketTypeStr = QStringLiteral("UdpSocket");
+ else if (socketType == QAbstractSocket::SctpSocket) socketTypeStr = QStringLiteral("SctpSocket");
qDebug("QNativeSocketEnginePrivate::fetchConnectionParameters() local == %s:%i,"
" peer == %s:%i, socket == %s - %s, inboundStreamCount == %i, outboundStreamCount == %i",
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 5ffe7b11b8..5a9641a9fe 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -214,6 +214,7 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,
switch (opt) {
case QNativeSocketEngine::NonBlockingSocketOption: // WSAIoctl
case QNativeSocketEngine::TypeOfServiceOption: // not supported
+ case QNativeSocketEngine::MaxStreamsSocketOption:
Q_UNREACHABLE();
case QNativeSocketEngine::ReceiveBufferSocketOption:
@@ -325,6 +326,14 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
return -1;
}
*/
+
+ //### SCTP not implemented
+ if (socketType == QAbstractSocket::SctpSocket) {
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ ProtocolUnsupportedErrorString);
+ return false;
+ }
+
QSysInfo::WinVersion osver = QSysInfo::windowsVersion();
//Windows XP and 2003 support IPv6 but not dual stack sockets
@@ -387,7 +396,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 +422,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) {
@@ -453,6 +460,7 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
break;
}
case QNativeSocketEngine::TypeOfServiceOption:
+ case QNativeSocketEngine::MaxStreamsSocketOption:
return -1;
default:
@@ -503,6 +511,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
break;
}
case QNativeSocketEngine::TypeOfServiceOption:
+ case QNativeSocketEngine::MaxStreamsSocketOption:
return false;
default:
@@ -703,7 +712,7 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
if (errorDetected)
break;
- // fall through
+ Q_FALLTHROUGH();
}
case WSAEINPROGRESS:
setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString);
@@ -1091,7 +1100,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 +1126,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 +1137,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 +1181,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 +1188,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 +1307,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 +1469,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 +1582,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/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 9817d4c57d..6b71912838 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -632,6 +632,7 @@ qint64 QNativeSocketEngine::write(const char *data, qint64 len)
qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHeader *header,
PacketHeaderOptions)
{
+#ifndef QT_NO_UDPSOCKET
Q_D(QNativeSocketEngine);
if (d->socketType != QAbstractSocket::UdpSocket || d->pendingDatagrams.isEmpty()) {
if (header)
@@ -654,10 +655,17 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea
}
memcpy(data, readOrigin, qMin(maxlen, qint64(datagram.data.length())));
return readOrigin.length();
+#else
+ Q_UNUSED(data)
+ Q_UNUSED(maxlen)
+ Q_UNUSED(header)
+ return -1;
+#endif // QT_NO_UDPSOCKET
}
qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QIpPacketHeader &header)
{
+#ifndef QT_NO_UDPSOCKET
Q_D(QNativeSocketEngine);
if (d->socketType != QAbstractSocket::UdpSocket)
return -1;
@@ -684,6 +692,12 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QI
Q_ASSERT_SUCCEEDED(hr);
return writeIOStream(stream, data, len);
+#else
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+ Q_UNUSED(header)
+ return -1;
+#endif // QT_NO_UDPSOCKET
}
bool QNativeSocketEngine::hasPendingDatagrams() const
@@ -1088,6 +1102,7 @@ int QNativeSocketEnginePrivate::option(QAbstractSocketEngine::SocketOption opt)
case QAbstractSocketEngine::MulticastTtlOption:
case QAbstractSocketEngine::MulticastLoopbackOption:
case QAbstractSocketEngine::TypeOfServiceOption:
+ case QAbstractSocketEngine::MaxStreamsSocketOption:
default:
return -1;
}
@@ -1146,6 +1161,7 @@ bool QNativeSocketEnginePrivate::setOption(QAbstractSocketEngine::SocketOption o
case QAbstractSocketEngine::MulticastTtlOption:
case QAbstractSocketEngine::MulticastLoopbackOption:
case QAbstractSocketEngine::TypeOfServiceOption:
+ case QAbstractSocketEngine::MaxStreamsSocketOption:
default:
return false;
}
@@ -1290,10 +1306,12 @@ HRESULT QNativeSocketEnginePrivate::handleConnectOpFinished(IAsyncAction *action
if (socketType != QAbstractSocket::TcpSocket)
return S_OK;
+#ifndef QT_NO_SSL
// Delay the reader so that the SSL socket can upgrade
if (sslSocket)
QObject::connect(qobject_cast<QSslSocket *>(sslSocket), &QSslSocket::encrypted, q, &QNativeSocketEngine::establishRead);
else
+#endif
q->establishRead();
return S_OK;
}
diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h
index 5b76c2d223..ef219e61df 100644
--- a/src/network/socket/qnativesocketengine_winrt_p.h
+++ b/src/network/socket/qnativesocketengine_winrt_p.h
@@ -50,6 +50,8 @@
//
// We mean it.
//
+
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/QEventLoop>
#include <QtCore/QBuffer>
#include <QtCore/QMutex>
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h
index 8d2a4ae852..46fbc9757a 100644
--- a/src/network/socket/qnet_unix_p.h
+++ b/src/network/socket/qnet_unix_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "private/qcore_unix_p.h"
#include <sys/types.h>
diff --git a/src/network/socket/qsctpserver.cpp b/src/network/socket/qsctpserver.cpp
new file mode 100644
index 0000000000..24f18e1ee8
--- /dev/null
+++ b/src/network/socket/qsctpserver.cpp
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** 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$
+**
+****************************************************************************/
+
+//#define QSCTPSERVER_DEBUG
+
+/*!
+ \class QSctpServer
+ \since 5.8
+
+ \brief The QSctpServer class provides an SCTP-based server.
+
+ \ingroup network
+ \inmodule QtNetwork
+
+ SCTP (Stream Control Transmission Protocol) is a transport layer
+ protocol serving in a similar role as the popular protocols TCP
+ and UDP. Like UDP, SCTP is message-oriented, but it ensures reliable,
+ in-sequence transport of messages with congestion control like
+ TCP. See the QSctpSocket documentation for more protocol details.
+
+ QSctpServer is a convenience subclass of QTcpServer that allows
+ you to accept incoming SCTP socket connections either in TCP
+ emulation or in datagram mode.
+
+ The most common way to use QSctpServer is to construct an object
+ and set the maximum number of channels that the server is
+ prepared to support, by calling setMaxChannelCount(). You can set
+ the TCP emulation mode by passing a negative argument in this
+ call. Also, a special value of 0 (the default) indicates to use
+ the peer's value as the actual number of channels. The new incoming
+ connection inherits this number from the server socket descriptor
+ and adjusts it according to the remote endpoint settings.
+
+ In TCP emulation mode, accepted clients use a single continuous
+ byte stream for data transmission, and QSctpServer acts like a
+ plain QTcpServer. Call nextPendingConnection() to accept the
+ pending connection as a connected QTcpSocket. The function returns
+ a pointer to a QTcpSocket in QAbstractSocket::ConnectedState that
+ you can use for communicating with the client. This mode gives
+ access only to basic SCTP protocol features. The socket transmits SCTP
+ packets over IP at system level and interacts through the
+ QTcpSocket interface with the application.
+
+ In contrast, datagram mode is message-oriented and provides a
+ complete simultaneous transmission of multiple data streams
+ between endpoints. Call nextPendingDatagramConnection() to accept
+ the pending datagram-mode connection as a connected QSctpSocket.
+
+ \note This feature is not supported on the Windows platform.
+
+ \sa QTcpServer, QSctpSocket, QAbstractSocket
+*/
+
+#include "qsctpserver.h"
+#include "qsctpserver_p.h"
+
+#include "qsctpsocket.h"
+#include "qabstractsocketengine_p.h"
+
+#ifdef QSCTPSERVER_DEBUG
+#include <qdebug.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*! \internal
+*/
+QSctpServerPrivate::QSctpServerPrivate()
+ : maxChannelCount(0)
+{
+}
+
+/*! \internal
+*/
+QSctpServerPrivate::~QSctpServerPrivate()
+{
+}
+
+/*! \internal
+*/
+void QSctpServerPrivate::configureCreatedSocket()
+{
+ QTcpServerPrivate::configureCreatedSocket();
+ if (socketEngine)
+ socketEngine->setOption(QAbstractSocketEngine::MaxStreamsSocketOption,
+ maxChannelCount == -1 ? 1 : maxChannelCount);
+}
+
+/*!
+ Constructs a QSctpServer object.
+
+ Sets the datagram operation mode. The \a parent argument is passed
+ to QObject's constructor.
+
+ \sa setMaxChannelCount(), listen(), setSocketDescriptor()
+*/
+QSctpServer::QSctpServer(QObject *parent)
+ : QTcpServer(QAbstractSocket::SctpSocket, *new QSctpServerPrivate, parent)
+{
+#if defined(QSCTPSERVER_DEBUG)
+ qDebug("QSctpServer::QSctpServer()");
+#endif
+}
+
+/*!
+ Destroys the QSctpServer object. If the server is listening for
+ connections, the socket is automatically closed.
+
+ \sa close()
+*/
+QSctpServer::~QSctpServer()
+{
+#if defined(QSCTPSERVER_DEBUG)
+ qDebug("QSctpServer::~QSctpServer()");
+#endif
+}
+
+/*!
+ Sets the maximum number of channels that the server is prepared to
+ support in datagram mode, to \a count. If \a count is 0, endpoint
+ maximum number of channels value would be used. Negative \a count
+ sets a TCP emulation mode.
+
+ Call this method only when QSctpServer is in UnconnectedState.
+
+ \sa maxChannelCount(), QSctpSocket
+*/
+void QSctpServer::setMaxChannelCount(int count)
+{
+ Q_D(QSctpServer);
+ if (d->state != QAbstractSocket::UnconnectedState) {
+ qWarning("QSctpServer::setMaxChannelCount() is only allowed in UnconnectedState");
+ return;
+ }
+#if defined(QSCTPSERVER_DEBUG)
+ qDebug("QSctpServer::setMaxChannelCount(%i)", count);
+#endif
+ d->maxChannelCount = count;
+}
+
+/*!
+ Returns the maximum number of channels that the accepted sockets are
+ able to support.
+
+ A value of 0 (the default) means that the number of connection
+ channels would be set by the remote endpoint.
+
+ Returns -1, if QSctpServer running in TCP emulation mode.
+
+ \sa setMaxChannelCount()
+*/
+int QSctpServer::maxChannelCount() const
+{
+ return d_func()->maxChannelCount;
+}
+
+/*! \reimp
+*/
+void QSctpServer::incomingConnection(qintptr socketDescriptor)
+{
+#if defined (QSCTPSERVER_DEBUG)
+ qDebug("QSctpServer::incomingConnection(%i)", socketDescriptor);
+#endif
+
+ QSctpSocket *socket = new QSctpSocket(this);
+ socket->setMaxChannelCount(d_func()->maxChannelCount);
+ socket->setSocketDescriptor(socketDescriptor);
+ addPendingConnection(socket);
+}
+
+/*!
+ Returns the next pending datagram-mode connection as a connected
+ QSctpSocket object.
+
+ Datagram-mode connection provides a message-oriented, multi-stream
+ communication.
+
+ The socket is created as a child of the server, which means that
+ it is automatically deleted when the QSctpServer object is
+ destroyed. It is still a good idea to delete the object
+ explicitly when you are done with it, to avoid wasting memory.
+
+ This function returns null if there are no pending datagram-mode
+ connections.
+
+ \note The returned QSctpSocket object cannot be used from another
+ thread. If you want to use an incoming connection from another
+ thread, you need to override incomingConnection().
+
+ \sa hasPendingConnections(), nextPendingConnection(), QSctpSocket
+*/
+QSctpSocket *QSctpServer::nextPendingDatagramConnection()
+{
+ Q_D(QSctpServer);
+
+ QMutableListIterator<QTcpSocket *> i(d->pendingConnections);
+ while (i.hasNext()) {
+ QSctpSocket *socket = qobject_cast<QSctpSocket *>(i.next());
+ Q_ASSERT(socket);
+
+ if (socket->inDatagramMode()) {
+ i.remove();
+ Q_ASSERT(d->socketEngine);
+ d->socketEngine->setReadNotificationEnabled(true);
+ return socket;
+ }
+ }
+
+ return nullptr;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qsctpserver.cpp"
diff --git a/src/network/socket/qsctpserver.h b/src/network/socket/qsctpserver.h
new file mode 100644
index 0000000000..fb017a924d
--- /dev/null
+++ b/src/network/socket/qsctpserver.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** 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 QSCTPSERVER_H
+#define QSCTPSERVER_H
+
+#include <QtNetwork/qtcpserver.h>
+
+QT_BEGIN_NAMESPACE
+
+
+#ifndef QT_NO_SCTP
+
+class QSctpServerPrivate;
+class QSctpSocket;
+
+class Q_NETWORK_EXPORT QSctpServer : public QTcpServer
+{
+ Q_OBJECT
+public:
+ explicit QSctpServer(QObject *parent = nullptr);
+ virtual ~QSctpServer();
+
+ void setMaxChannelCount(int count);
+ int maxChannelCount() const;
+
+ QSctpSocket *nextPendingDatagramConnection();
+
+protected:
+ void incomingConnection(qintptr handle) Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QSctpServer)
+ Q_DECLARE_PRIVATE(QSctpServer)
+};
+
+#endif // QT_NO_SCTP
+
+QT_END_NAMESPACE
+
+#endif // QSCTPSERVER_H
diff --git a/src/network/socket/qsctpserver_p.h b/src/network/socket/qsctpserver_p.h
new file mode 100644
index 0000000000..32760caffe
--- /dev/null
+++ b/src/network/socket/qsctpserver_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** 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 QSCTPSERVER_P_H
+#define QSCTPSERVER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the QLibrary class. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qtcpserver_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_SCTP
+
+class QSctpServerPrivate : public QTcpServerPrivate
+{
+ Q_DECLARE_PUBLIC(QSctpServer)
+public:
+ QSctpServerPrivate();
+ virtual ~QSctpServerPrivate();
+
+ int maxChannelCount;
+
+ void configureCreatedSocket() Q_DECL_OVERRIDE;
+};
+
+#endif // QT_NO_SCTP
+
+QT_END_NAMESPACE
+
+#endif // QSCTPSERVER_P_H
diff --git a/src/network/socket/qsctpsocket.cpp b/src/network/socket/qsctpsocket.cpp
new file mode 100644
index 0000000000..cb07e80299
--- /dev/null
+++ b/src/network/socket/qsctpsocket.cpp
@@ -0,0 +1,547 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** 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$
+**
+****************************************************************************/
+
+//#define QSCTPSOCKET_DEBUG
+
+/*!
+ \class QSctpSocket
+ \since 5.8
+
+ \brief The QSctpSocket class provides an SCTP socket.
+
+ \ingroup network
+ \inmodule QtNetwork
+
+ SCTP (Stream Control Transmission Protocol) is a transport layer
+ protocol serving in a similar role as the popular protocols TCP
+ and UDP. Like UDP, SCTP is message-oriented, but it ensures reliable,
+ in-sequence transport of messages with congestion control like
+ TCP.
+
+ SCTP is connection-oriented protocol, which provides the complete
+ simultaneous transmission of multiple data streams between
+ endpoints. This multi-streaming allows data to be delivered by
+ independent channels, so that if there is data loss in one stream,
+ delivery will not be affected for the other streams.
+
+ Being message-oriented, SCTP transports a sequence of messages,
+ rather than transporting an unbroken stream of bytes as does TCP.
+ Like in UDP, in SCTP a sender sends a message in one operation,
+ and that exact message is passed to the receiving application
+ process in one operation. But unlike UDP, the delivery is
+ guaranteed.
+
+ It also supports multi-homing, meaning that a connected endpoint
+ can have alternate IP addresses associated with it in order to
+ route around network failure or changing conditions.
+
+ QSctpSocket is a convenience subclass of QTcpSocket that allows
+ you to emulate TCP data stream over SCTP or establish an SCTP
+ connection for reliable datagram service.
+
+ QSctpSocket can operate in one of two possible modes:
+
+ \list
+ \li Continuous byte stream (TCP emulation).
+ \li Multi-streamed datagram mode.
+ \endlist
+
+ To set a continuous byte stream mode, instantiate QSctpSocket and
+ call setMaxChannelCount() with a negative value. This gives the
+ ability to use QSctpSocket as a regular buffered QTcpSocket. You
+ can call connectToHost() to initiate connection with endpoint,
+ write() to transmit and read() to receive data from the peer, but
+ you cannot distinguish message boundaries.
+
+ By default, QSctpSocket operates in datagram mode. Before
+ connecting, call setMaxChannelCount() to set the maximum number of
+ channels that the application is prepared to support. This number
+ is a parameter negotiated with the remote endpoint and its value
+ can be bounded by the operating system. The default value of 0
+ indicates to use the peer's value. If both endpoints have default
+ values, then number of connection channels is system-dependent.
+ After establishing a connection, you can fetch the actual number
+ of channels by calling readChannelCount() and writeChannelCount().
+
+ \snippet code/src_network_socket_qsctpsocket.cpp 0
+
+ In datagram mode, QSctpSocket performs the buffering of datagrams
+ independently for each channel. You can queue a datagram to the
+ buffer of the current channel by calling writeDatagram() and read
+ a pending datagram by calling readDatagram() respectively.
+
+ Using the standard QIODevice functions read(), readLine(), write(),
+ etc. is allowed in datagram mode with the same limitations as in
+ continuous byte stream mode.
+
+ \note This feature is not supported on the Windows platform.
+
+ \sa QSctpServer, QTcpSocket, QAbstractSocket
+*/
+
+#include "qsctpsocket.h"
+#include "qsctpsocket_p.h"
+
+#include "qabstractsocketengine_p.h"
+#include "private/qbytearray_p.h"
+
+#ifdef QSCTPSOCKET_DEBUG
+#include <qdebug.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*! \internal
+*/
+QSctpSocketPrivate::QSctpSocketPrivate()
+ : maxChannelCount(0)
+{
+}
+
+/*! \internal
+*/
+QSctpSocketPrivate::~QSctpSocketPrivate()
+{
+}
+
+/*! \internal
+*/
+bool QSctpSocketPrivate::canReadNotification()
+{
+ Q_Q(QSctpSocket);
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::canReadNotification()");
+#endif
+
+ // Handle TCP emulation mode in the base implementation.
+ if (!q->inDatagramMode())
+ return QTcpSocketPrivate::canReadNotification();
+
+ const int savedCurrentChannel = currentReadChannel;
+ bool currentChannelRead = false;
+ do {
+ int datagramSize = incomingDatagram.size();
+ QIpPacketHeader header;
+
+ do {
+ // Determine the size of the pending datagram.
+ qint64 bytesToRead = socketEngine->bytesAvailable();
+ if (bytesToRead == 0) {
+ // As a corner case, if we can't determine the size of the pending datagram,
+ // try to read 4K of data from the socket. Subsequent ::recvmsg call either
+ // fails or returns the actual length of the datagram.
+ bytesToRead = 4096;
+ }
+
+ Q_ASSERT((datagramSize + int(bytesToRead)) < MaxByteArraySize);
+ incomingDatagram.resize(datagramSize + int(bytesToRead));
+
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::canReadNotification() about to read %lli bytes",
+ bytesToRead);
+#endif
+ qint64 readBytes = socketEngine->readDatagram(
+ incomingDatagram.data() + datagramSize, bytesToRead, &header,
+ QAbstractSocketEngine::WantAll);
+ if (readBytes <= 0) {
+ if (readBytes == -2) { // no data available for reading
+ incomingDatagram.resize(datagramSize);
+ return currentChannelRead;
+ }
+
+ socketEngine->close();
+ if (readBytes == 0) {
+ setErrorAndEmit(QAbstractSocket::RemoteHostClosedError,
+ QSctpSocket::tr("The remote host closed the connection"));
+ } else {
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::canReadNotification() read failed: %s",
+ socketEngine->errorString().toLatin1().constData());
+#endif
+ setErrorAndEmit(socketEngine->error(), socketEngine->errorString());
+ }
+
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::canReadNotification() disconnecting socket");
+#endif
+ q->disconnectFromHost();
+ return currentChannelRead;
+ }
+ datagramSize += int(readBytes); // update datagram size
+ } while (!header.endOfRecord);
+
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::canReadNotification() got datagram from channel %i, size = %i",
+ header.streamNumber, datagramSize);
+#endif
+
+ // Drop the datagram, if opened only for writing
+ if (!q->isReadable()) {
+ incomingDatagram.clear();
+ continue;
+ }
+
+ // Store datagram in the channel buffer
+ Q_ASSERT(header.streamNumber < readBuffers.size());
+ incomingDatagram.resize(datagramSize);
+ readBuffers[header.streamNumber].setChunkSize(0); // set packet mode on channel buffer
+ readBuffers[header.streamNumber].append(incomingDatagram);
+ incomingDatagram = QByteArray();
+
+ if (readHeaders.size() != readBuffers.size())
+ readHeaders.resize(readBuffers.size());
+ readHeaders[header.streamNumber].push_back(header);
+
+ // Emit notifications.
+ if (header.streamNumber == savedCurrentChannel)
+ currentChannelRead = true;
+ emitReadyRead(header.streamNumber);
+
+ } while (state == QAbstractSocket::ConnectedState);
+
+ return currentChannelRead;
+}
+
+/*! \internal
+*/
+bool QSctpSocketPrivate::writeToSocket()
+{
+ Q_Q(QSctpSocket);
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::writeToSocket()");
+#endif
+
+ // Handle TCP emulation mode in the base implementation.
+ if (!q->inDatagramMode())
+ return QTcpSocketPrivate::writeToSocket();
+
+ if (!socketEngine)
+ return false;
+
+ QIpPacketHeader defaultHeader;
+ const int savedCurrentChannel = currentWriteChannel;
+ bool currentChannelWritten = false;
+ bool transmitting;
+ do {
+ transmitting = false;
+
+ for (int channel = 0; channel < writeBuffers.size(); ++channel) {
+ QRingBuffer &channelBuffer = writeBuffers[channel];
+
+ if (channelBuffer.isEmpty())
+ continue;
+
+ const bool hasHeader = (channel < writeHeaders.size())
+ && !writeHeaders[channel].empty();
+ QIpPacketHeader &header = hasHeader ? writeHeaders[channel].front() : defaultHeader;
+ header.streamNumber = channel;
+ qint64 sent = socketEngine->writeDatagram(channelBuffer.readPointer(),
+ channelBuffer.nextDataBlockSize(),
+ header);
+ if (sent < 0) {
+ if (sent == -2) // temporary error in writeDatagram
+ return currentChannelWritten;
+
+ socketEngine->close();
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::writeToSocket() write error, aborting. %s",
+ socketEngine->errorString().toLatin1().constData());
+#endif
+ setErrorAndEmit(socketEngine->error(), socketEngine->errorString());
+ // An unexpected error so close the socket.
+ q->disconnectFromHost();
+ return currentChannelWritten;
+ }
+ Q_ASSERT(sent == channelBuffer.nextDataBlockSize());
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::writeToSocket() sent datagram of size %lli to channel %i",
+ sent, channel);
+#endif
+ transmitting = true;
+
+ // Remove datagram from the buffer
+ channelBuffer.read();
+ if (hasHeader)
+ writeHeaders[channel].pop_front();
+
+ // Emit notifications.
+ if (channel == savedCurrentChannel)
+ currentChannelWritten = true;
+ emitBytesWritten(sent, channel);
+
+ // If we were closed as a result of the bytesWritten() signal, return.
+ if (state == QAbstractSocket::UnconnectedState) {
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocketPrivate::writeToSocket() socket is closing - returning");
+#endif
+ return currentChannelWritten;
+ }
+ }
+ } while (transmitting);
+
+ // At this point socket is either in Connected or Closing state,
+ // write buffers are empty.
+ if (state == QAbstractSocket::ClosingState)
+ q->disconnectFromHost();
+ else
+ socketEngine->setWriteNotificationEnabled(false);
+
+ return currentChannelWritten;
+}
+
+/*! \internal
+*/
+void QSctpSocketPrivate::configureCreatedSocket()
+{
+ if (socketEngine)
+ socketEngine->setOption(QAbstractSocketEngine::MaxStreamsSocketOption,
+ maxChannelCount < 0 ? 1 : maxChannelCount);
+}
+
+/*!
+ Creates a QSctpSocket object in state \c UnconnectedState.
+
+ Sets the datagram operation mode. The \a parent argument is passed
+ to QObject's constructor.
+
+ \sa socketType(), setMaxChannelCount()
+*/
+QSctpSocket::QSctpSocket(QObject *parent)
+ : QTcpSocket(SctpSocket, *new QSctpSocketPrivate, parent)
+{
+#if defined(QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocket::QSctpSocket()");
+#endif
+ d_func()->isBuffered = true;
+}
+
+/*!
+ Destroys the socket, closing the connection if necessary.
+
+ \sa close()
+*/
+QSctpSocket::~QSctpSocket()
+{
+#if defined(QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocket::~QSctpSocket()");
+#endif
+}
+
+/*! \reimp
+*/
+qint64 QSctpSocket::readData(char *data, qint64 maxSize)
+{
+ Q_D(QSctpSocket);
+
+ // Cleanup headers, if the user calls the standard QIODevice functions
+ if (d->currentReadChannel < d->readHeaders.size())
+ d->readHeaders[d->currentReadChannel].clear();
+
+ return QTcpSocket::readData(data, maxSize);
+}
+
+/*! \reimp
+*/
+qint64 QSctpSocket::readLineData(char *data, qint64 maxlen)
+{
+ Q_D(QSctpSocket);
+
+ // Cleanup headers, if the user calls the standard QIODevice functions
+ if (d->currentReadChannel < d->readHeaders.size())
+ d->readHeaders[d->currentReadChannel].clear();
+
+ return QTcpSocket::readLineData(data, maxlen);
+}
+
+/*! \reimp
+*/
+void QSctpSocket::close()
+{
+ QTcpSocket::close();
+ d_func()->readHeaders.clear();
+}
+
+/*! \reimp
+*/
+void QSctpSocket::disconnectFromHost()
+{
+ Q_D(QSctpSocket);
+
+ QTcpSocket::disconnectFromHost();
+ if (d->state == QAbstractSocket::UnconnectedState) {
+ d->incomingDatagram.clear();
+ d->writeHeaders.clear();
+ }
+}
+
+/*!
+ Sets the maximum number of channels that the application is
+ prepared to support in datagram mode, to \a count. If \a count
+ is 0, endpoint's value for maximum number of channels is used.
+ Negative \a count sets a continuous byte stream mode.
+
+ Call this method only when QSctpSocket is in UnconnectedState.
+
+ \sa maxChannelCount(), readChannelCount(), writeChannelCount()
+*/
+void QSctpSocket::setMaxChannelCount(int count)
+{
+ Q_D(QSctpSocket);
+ if (d->state != QAbstractSocket::UnconnectedState) {
+ qWarning("QSctpSocket::setMaxChannelCount() is only allowed in UnconnectedState");
+ return;
+ }
+#if defined(QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocket::setMaxChannelCount(%i)", count);
+#endif
+ d->maxChannelCount = qMax(count, -1);
+}
+
+/*!
+ Returns the maximum number of channels that QSctpSocket is able to
+ support.
+
+ A value of 0 (the default) means that the number of connection
+ channels would be set by the remote endpoint.
+
+ Returns -1 if QSctpSocket is running in continuous byte stream
+ mode.
+
+ \sa setMaxChannelCount(), readChannelCount(), writeChannelCount()
+*/
+int QSctpSocket::maxChannelCount() const
+{
+ return d_func()->maxChannelCount;
+}
+
+/*!
+ Returns \c true if the socket is running in datagram mode.
+
+ \sa setMaxChannelCount()
+*/
+bool QSctpSocket::inDatagramMode() const
+{
+ Q_D(const QSctpSocket);
+ return d->maxChannelCount != -1 && d->isBuffered;
+}
+
+/*!
+ Reads a datagram from the buffer of the current read channel, and
+ returns it as a QNetworkDatagram object, along with the sender's
+ host address and port. If possible, this function will also try to
+ determine the datagram's destination address, port, and the number
+ of hop counts at reception time.
+
+ On failure, returns a QNetworkDatagram that reports \l
+ {QNetworkDatagram::isValid()}{not valid}.
+
+ \sa writeDatagram(), inDatagramMode(), currentReadChannel()
+*/
+QNetworkDatagram QSctpSocket::readDatagram()
+{
+ Q_D(QSctpSocket);
+
+ if (!isReadable() || !inDatagramMode()) {
+ qWarning("QSctpSocket::readDatagram(): operation is not permitted");
+ return QNetworkDatagram();
+ }
+
+ if (d->currentReadChannel >= d->readHeaders.size()
+ || d->readHeaders[d->currentReadChannel].size() == 0) {
+ Q_ASSERT(d->buffer.isEmpty());
+ return QNetworkDatagram();
+ }
+
+ QNetworkDatagram result(*new QNetworkDatagramPrivate(d->buffer.read(),
+ d->readHeaders[d->currentReadChannel].front()));
+ d->readHeaders[d->currentReadChannel].pop_front();
+
+#if defined (QSCTPSOCKET_DEBUG)
+ qDebug("QSctpSocket::readDatagram() returning datagram (%p, %i, \"%s\", %i)",
+ result.d->data.constData(),
+ result.d->data.size(),
+ result.senderAddress().toString().toLatin1().constData(),
+ result.senderPort());
+#endif
+
+ return result;
+}
+
+/*!
+ Writes a \a datagram to the buffer of the current write channel.
+ Returns true on success; otherwise returns false.
+
+ \sa readDatagram(), inDatagramMode(), currentWriteChannel()
+*/
+bool QSctpSocket::writeDatagram(const QNetworkDatagram &datagram)
+{
+ Q_D(QSctpSocket);
+
+ if (!isWritable() || d->state != QAbstractSocket::ConnectedState || !d->socketEngine
+ || !d->socketEngine->isValid() || !inDatagramMode()) {
+ qWarning("QSctpSocket::writeDatagram(): operation is not permitted");
+ return false;
+ }
+
+ if (datagram.d->data.isEmpty()) {
+ qWarning("QSctpSocket::writeDatagram() is called with empty datagram");
+ return false;
+ }
+
+
+#if defined QSCTPSOCKET_DEBUG
+ qDebug("QSctpSocket::writeDatagram(%p, %i, \"%s\", %i)",
+ datagram.d->data.constData(),
+ datagram.d->data.size(),
+ datagram.destinationAddress().toString().toLatin1().constData(),
+ datagram.destinationPort());
+#endif
+
+ if (d->writeHeaders.size() != d->writeBuffers.size())
+ d->writeHeaders.resize(d->writeBuffers.size());
+ Q_ASSERT(d->currentWriteChannel < d->writeHeaders.size());
+ d->writeHeaders[d->currentWriteChannel].push_back(datagram.d->header);
+ d->writeBuffer.setChunkSize(0); // set packet mode on channel buffer
+ d->writeBuffer.append(datagram.d->data);
+
+ d->socketEngine->setWriteNotificationEnabled(true);
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/socket/qsctpsocket.h b/src/network/socket/qsctpsocket.h
new file mode 100644
index 0000000000..aaa4e1ecca
--- /dev/null
+++ b/src/network/socket/qsctpsocket.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** 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 QSCTPSOCKET_H
+#define QSCTPSOCKET_H
+
+#include <QtNetwork/qtcpsocket.h>
+#include <QtNetwork/qnetworkdatagram.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_SCTP
+
+class QSctpSocketPrivate;
+
+class Q_NETWORK_EXPORT QSctpSocket : public QTcpSocket
+{
+ Q_OBJECT
+public:
+ explicit QSctpSocket(QObject *parent = nullptr);
+ virtual ~QSctpSocket();
+
+ void close() Q_DECL_OVERRIDE;
+ void disconnectFromHost() Q_DECL_OVERRIDE;
+
+ void setMaxChannelCount(int count);
+ int maxChannelCount() const;
+ bool inDatagramMode() const;
+
+ QNetworkDatagram readDatagram();
+ bool writeDatagram(const QNetworkDatagram &datagram);
+
+protected:
+ qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
+ qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QSctpSocket)
+ Q_DECLARE_PRIVATE(QSctpSocket)
+};
+
+#endif // QT_NO_SCTP
+
+QT_END_NAMESPACE
+
+#endif // QSCTPSOCKET_H
diff --git a/src/network/socket/qsctpsocket_p.h b/src/network/socket/qsctpsocket_p.h
new file mode 100644
index 0000000000..f38095330f
--- /dev/null
+++ b/src/network/socket/qsctpsocket_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** 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 QSCTPSOCKET_P_H
+#define QSCTPSOCKET_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the QLibrary class. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtNetwork/qsctpsocket.h>
+#include <private/qtcpsocket_p.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qvector.h>
+#include <private/qnetworkdatagram_p.h>
+
+#include <deque>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_SCTP
+
+class QSctpSocketPrivate : public QTcpSocketPrivate
+{
+ Q_DECLARE_PUBLIC(QSctpSocket)
+public:
+ QSctpSocketPrivate();
+ virtual ~QSctpSocketPrivate();
+
+ bool canReadNotification() Q_DECL_OVERRIDE;
+ bool writeToSocket() Q_DECL_OVERRIDE;
+
+ QByteArray incomingDatagram;
+ int maxChannelCount;
+
+ typedef std::deque<QIpPacketHeader> IpHeaderList;
+ QVector<IpHeaderList> readHeaders;
+ QVector<IpHeaderList> writeHeaders;
+
+ void configureCreatedSocket() Q_DECL_OVERRIDE;
+};
+
+#endif // QT_NO_SCTP
+
+QT_END_NAMESPACE
+
+#endif // QSCTPSOCKET_P_H
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index a57a1dca2c..a1a8e4649d 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) { \
@@ -622,7 +618,7 @@ void QSocks5SocketEnginePrivate::setErrorState(Socks5State state, const QString
QSocks5SocketEngine::tr("Connection to proxy timed out"));
break;
}
- /* fall through */
+ Q_FALLTHROUGH();
default:
q->setError(controlSocketError, data->controlSocket->errorString());
break;
@@ -1209,7 +1205,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketReadNotification()
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
qWarning("QSocks5SocketEnginePrivate::_q_controlSocketReadNotification: "
"Unexpectedly received data while in state=%d and mode=%d",
@@ -1609,8 +1605,31 @@ bool QSocks5SocketEngine::setMulticastInterface(const QNetworkInterface &)
}
#endif // QT_NO_NETWORKINTERFACE
+bool QSocks5SocketEngine::hasPendingDatagrams() const
+{
+ Q_D(const QSocks5SocketEngine);
+ Q_INIT_CHECK(false);
+
+ d->checkForDatagrams();
+
+ return !d->udpData->pendingDatagrams.isEmpty();
+}
+
+qint64 QSocks5SocketEngine::pendingDatagramSize() const
+{
+ Q_D(const QSocks5SocketEngine);
+
+ d->checkForDatagrams();
+
+ if (!d->udpData->pendingDatagrams.isEmpty())
+ return d->udpData->pendingDatagrams.head().data.size();
+ return 0;
+}
+#endif // QT_NO_UDPSOCKET
+
qint64 QSocks5SocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHeader *header, PacketHeaderOptions)
{
+#ifndef QT_NO_UDPSOCKET
Q_D(QSocks5SocketEngine);
d->checkForDatagrams();
@@ -1624,10 +1643,17 @@ qint64 QSocks5SocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea
header->senderAddress = datagram.address;
header->senderPort = datagram.port;
return copyLen;
+#else
+ Q_UNUSED(data)
+ Q_UNUSED(maxlen)
+ Q_UNUSED(header)
+ return -1;
+#endif // QT_NO_UDPSOCKET
}
qint64 QSocks5SocketEngine::writeDatagram(const char *data, qint64 len, const QIpPacketHeader &header)
{
+#ifndef QT_NO_UDPSOCKET
Q_D(QSocks5SocketEngine);
// it is possible to send with out first binding with udp, but socks5 requires a bind.
@@ -1664,29 +1690,13 @@ qint64 QSocks5SocketEngine::writeDatagram(const char *data, qint64 len, const QI
}
return len;
-}
-
-bool QSocks5SocketEngine::hasPendingDatagrams() const
-{
- Q_D(const QSocks5SocketEngine);
- Q_INIT_CHECK(false);
-
- d->checkForDatagrams();
-
- return !d->udpData->pendingDatagrams.isEmpty();
-}
-
-qint64 QSocks5SocketEngine::pendingDatagramSize() const
-{
- Q_D(const QSocks5SocketEngine);
-
- d->checkForDatagrams();
-
- if (!d->udpData->pendingDatagrams.isEmpty())
- return d->udpData->pendingDatagrams.head().data.size();
- return 0;
-}
+#else
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+ Q_UNUSED(header)
+ return -1;
#endif // QT_NO_UDPSOCKET
+}
qint64 QSocks5SocketEngine::bytesToWrite() const
{
diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h
index 30caa4b50c..864b163489 100644
--- a/src/network/socket/qsocks5socketengine_p.h
+++ b/src/network/socket/qsocks5socketengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qabstractsocketengine_p.h"
#include "qnetworkproxy.h"
@@ -99,13 +100,13 @@ public:
bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
#endif // QT_NO_NETWORKINTERFACE
- qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0,
- PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE;
- qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
#endif // QT_NO_UDPSOCKET
+ qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0,
+ PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE;
+ qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
qint64 bytesToWrite() const Q_DECL_OVERRIDE;
int option(SocketOption option) const Q_DECL_OVERRIDE;
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index de1dc29cfb..eddf789921 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -119,6 +119,7 @@ QT_BEGIN_NAMESPACE
*/
QTcpServerPrivate::QTcpServerPrivate()
: port(0)
+ , socketType(QAbstractSocket::UnknownSocketType)
, state(QAbstractSocket::UnconnectedState)
, socketEngine(0)
, serverSocketError(QAbstractSocket::UnknownSocketError)
@@ -148,13 +149,21 @@ QNetworkProxy QTcpServerPrivate::resolveProxy(const QHostAddress &address, quint
proxies << proxy;
} else {
// try the application settings instead
- QNetworkProxyQuery query(port, QString(), QNetworkProxyQuery::TcpServer);
+ QNetworkProxyQuery query(port, QString(),
+ socketType == QAbstractSocket::SctpSocket ?
+ QNetworkProxyQuery::SctpServer :
+ QNetworkProxyQuery::TcpServer);
proxies = QNetworkProxyFactory::proxyForQuery(query);
}
// return the first that we can use
for (const QNetworkProxy &p : qAsConst(proxies)) {
- if (p.capabilities() & QNetworkProxy::ListeningCapability)
+ if (socketType == QAbstractSocket::TcpSocket &&
+ (p.capabilities() & QNetworkProxy::ListeningCapability) != 0)
+ return p;
+
+ if (socketType == QAbstractSocket::SctpSocket &&
+ (p.capabilities() & QNetworkProxy::SctpListeningCapability) != 0)
return p;
}
@@ -228,9 +237,11 @@ void QTcpServerPrivate::readNotification()
QTcpServer::QTcpServer(QObject *parent)
: QObject(*new QTcpServerPrivate, parent)
{
+ Q_D(QTcpServer);
#if defined(QTCPSERVER_DEBUG)
qDebug("QTcpServer::QTcpServer(%p)", parent);
#endif
+ d->socketType = QAbstractSocket::TcpSocket;
}
/*!
@@ -251,13 +262,22 @@ QTcpServer::~QTcpServer()
}
/*! \internal
+
+ Constructs a new server object with socket of type \a socketType. The \a
+ parent argument is passed to QObject's constructor.
*/
-QTcpServer::QTcpServer(QTcpServerPrivate &dd, QObject *parent)
- : QObject(dd, parent)
+QTcpServer::QTcpServer(QAbstractSocket::SocketType socketType, QTcpServerPrivate &dd,
+ QObject *parent) : QObject(dd, parent)
{
+ Q_D(QTcpServer);
#if defined(QTCPSERVER_DEBUG)
- qDebug("QTcpServer::QTcpServer(QTcpServerPrivate == %p, parent == %p)", &dd, parent);
+ qDebug("QTcpServer::QTcpServer(%sSocket, QTcpServerPrivate == %p, parent == %p)",
+ socketType == QAbstractSocket::TcpSocket ? "Tcp"
+ : socketType == QAbstractSocket::UdpSocket ? "Udp"
+ : socketType == QAbstractSocket::SctpSocket ? "Sctp"
+ : "Unknown", &dd, parent);
#endif
+ d->socketType = socketType;
}
/*!
@@ -288,7 +308,7 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port)
#endif
delete d->socketEngine;
- d->socketEngine = QAbstractSocketEngine::createSocketEngine(QAbstractSocket::TcpSocket, proxy, this);
+ d->socketEngine = QAbstractSocketEngine::createSocketEngine(d->socketType, proxy, this);
if (!d->socketEngine) {
d->serverSocketError = QAbstractSocket::UnsupportedSocketOperationError;
d->serverSocketErrorString = tr("Operation on socket is not supported");
@@ -298,7 +318,7 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port)
//copy network session down to the socket engine (if it has been set)
d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
#endif
- if (!d->socketEngine->initialize(QAbstractSocket::TcpSocket, proto)) {
+ if (!d->socketEngine->initialize(d->socketType, proto)) {
d->serverSocketError = d->socketEngine->error();
d->serverSocketErrorString = d->socketEngine->errorString();
return false;
@@ -543,8 +563,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/qtcpserver.h b/src/network/socket/qtcpserver.h
index 90781564b4..192cbce54c 100644
--- a/src/network/socket/qtcpserver.h
+++ b/src/network/socket/qtcpserver.h
@@ -40,6 +40,7 @@
#ifndef QTCPSERVER_H
#define QTCPSERVER_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qobject.h>
#include <QtNetwork/qabstractsocket.h>
#include <QtNetwork/qhostaddress.h>
@@ -93,7 +94,8 @@ protected:
virtual void incomingConnection(qintptr handle);
void addPendingConnection(QTcpSocket* socket);
- QTcpServer(QTcpServerPrivate &dd, QObject *parent = Q_NULLPTR);
+ QTcpServer(QAbstractSocket::SocketType socketType, QTcpServerPrivate &dd,
+ QObject *parent = Q_NULLPTR);
Q_SIGNALS:
void newConnection();
diff --git a/src/network/socket/qtcpserver_p.h b/src/network/socket/qtcpserver_p.h
index b53f53b921..71dc4d985f 100644
--- a/src/network/socket/qtcpserver_p.h
+++ b/src/network/socket/qtcpserver_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtNetwork module of the Qt Toolkit.
@@ -44,13 +45,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include "QtNetwork/qtcpserver.h"
#include "private/qobject_p.h"
#include "private/qabstractsocketengine_p.h"
@@ -73,6 +75,7 @@ public:
quint16 port;
QHostAddress address;
+ QAbstractSocket::SocketType socketType;
QAbstractSocket::SocketState state;
QAbstractSocketEngine *socketEngine;
diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h
index b2c89dcad2..3c3e3b69fd 100644
--- a/src/network/socket/qtcpsocket.h
+++ b/src/network/socket/qtcpsocket.h
@@ -40,6 +40,7 @@
#ifndef QTCPSOCKET_H
#define QTCPSOCKET_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qabstractsocket.h>
#include <QtCore/qvariant.h>
diff --git a/src/network/socket/qtcpsocket_p.h b/src/network/socket/qtcpsocket_p.h
index dfa55a6109..ba1a0aa920 100644
--- a/src/network/socket/qtcpsocket_p.h
+++ b/src/network/socket/qtcpsocket_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtNetwork/qtcpsocket.h>
#include <private/qabstractsocket_p.h>
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index c406009069..37b385dfb5 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -55,10 +55,10 @@
datagrams.
The most common way to use this class is to bind to an address and port
- using bind(), then call writeDatagram() and readDatagram() to transfer
- data. If you want to use the standard QIODevice functions read(),
- readLine(), write(), etc., you must first connect the socket directly to a
- peer by calling connectToHost().
+ using bind(), then call writeDatagram() and readDatagram() /
+ receiveDatagram() to transfer data. If you want to use the standard
+ QIODevice functions read(), readLine(), write(), etc., you must first
+ connect the socket directly to a peer by calling connectToHost().
The socket emits the bytesWritten() signal every time a datagram
is written to the network. If you just want to send datagrams,
@@ -67,7 +67,7 @@
The readyRead() signal is emitted whenever datagrams arrive. In
that case, hasPendingDatagrams() returns \c true. Call
pendingDatagramSize() to obtain the size of the first pending
- datagram, and readDatagram() to read it.
+ datagram, and readDatagram() or receiveDatagram() to read it.
\note An incoming datagram should be read when you receive the readyRead()
signal, otherwise this signal will not be emitted for the next datagram.
@@ -94,11 +94,12 @@
\l{multicastreceiver}{Multicast Receiver} examples illustrate how
to use QUdpSocket in applications.
- \sa QTcpSocket
+ \sa QTcpSocket, QNetworkDatagram
*/
#include "qudpsocket.h"
#include "qhostaddress.h"
+#include "qnetworkdatagram.h"
#include "qnetworkinterface.h"
#include "qabstractsocket_p.h"
@@ -346,6 +347,12 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre
if (sent >= 0) {
emit bytesWritten(sent);
} else {
+ if (sent == -2) {
+ // Socket engine reports EAGAIN. Treat as a temporary error.
+ d->setErrorAndEmit(QAbstractSocket::TemporaryError,
+ tr("Unable to send a datagram"));
+ return -1;
+ }
d->setErrorAndEmit(d->socketEngine->error(), d->socketEngine->errorString());
}
return sent;
@@ -358,7 +365,101 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre
Sends the datagram \a datagram to the host address \a host and at
port \a port.
+
+ The function returns the number of bytes sent if it succeeded or -1 if it
+ encountered an error.
+*/
+
+/*!
+ \overload
+
+ Sends the datagram \a datagram to the host address and port numbers
+ contained in \a datagram, using the network interface and hop count limits
+ also set there. If the destination address and port numbers are unset, this
+ function will send to the address that was passed to connectToHost().
+
+ If the destination address is IPv6 with a non-empty
+ \l{QHostAddress::scopeId()}{scope id} but differs from the interface index
+ in \a datagram, it is undefined which interface the operating system will
+ choose to send on.
+
+ The function returns the number of bytes sent if it succeeded or -1 if it
+ encountered an error.
+
+ \warning Calling this function on a connected UDP socket may
+ result in an error and no packet being sent. If you are using a
+ connected socket, use write() to send datagrams.
+
+ \sa QNetworkDatagram::setDestination(), QNetworkDatagram::setHopLimit(), QNetworkDatagram::setInterfaceIndex()
+*/
+qint64 QUdpSocket::writeDatagram(const QNetworkDatagram &datagram)
+{
+ Q_D(QUdpSocket);
+#if defined QUDPSOCKET_DEBUG
+ qDebug("QUdpSocket::writeDatagram(%p, %i, \"%s\", %i)",
+ datagram.d->data.constData(),
+ datagram.d->data.size(),
+ datagram.destinationAddress().toString().toLatin1().constData(),
+ datagram.destinationPort());
+#endif
+ if (!d->doEnsureInitialized(QHostAddress::Any, 0, datagram.destinationAddress()))
+ return -1;
+ if (state() == UnconnectedState)
+ bind();
+
+ qint64 sent = d->socketEngine->writeDatagram(datagram.d->data,
+ datagram.d->data.size(),
+ datagram.d->header);
+ d->cachedSocketDescriptor = d->socketEngine->socketDescriptor();
+
+ if (sent >= 0) {
+ emit bytesWritten(sent);
+ } else {
+ d->setErrorAndEmit(d->socketEngine->error(), d->socketEngine->errorString());
+ }
+ return sent;
+}
+
+/*!
+ Receives a datagram no larger than \a maxSize bytes and returns it in the
+ QNetworkDatagram object, along with the sender's host address and port. If
+ possible, this function will also try to determine the datagram's
+ destination address, port, and the number of hop counts at reception time.
+
+ On failure, returns a QNetworkDatagram that reports \l
+ {QNetworkDatagram::isValid()}{not valid}.
+
+ If \a maxSize is too small, the rest of the datagram will be lost. If \a
+ maxSize is 0, the datagram will be discarded. If \a maxSize is -1 (the
+ default), this function will attempt to read the entire datagram.
+
+ \sa writeDatagram(), hasPendingDatagrams(), pendingDatagramSize()
*/
+QNetworkDatagram QUdpSocket::receiveDatagram(qint64 maxSize)
+{
+ Q_D(QUdpSocket);
+
+#if defined QUDPSOCKET_DEBUG
+ qDebug("QUdpSocket::receiveDatagram(%lld)", maxSize);
+#endif
+ QT_CHECK_BOUND("QUdpSocket::receiveDatagram()", QNetworkDatagram());
+
+ if (maxSize < 0)
+ maxSize = d->socketEngine->pendingDatagramSize();
+ if (maxSize < 0)
+ return QNetworkDatagram();
+
+ QNetworkDatagram result(QByteArray(maxSize, Qt::Uninitialized));
+ qint64 readBytes = d->socketEngine->readDatagram(result.d->data.data(), maxSize, &result.d->header,
+ QAbstractSocketEngine::WantAll);
+ d->hasPendingData = false;
+ d->socketEngine->setReadNotificationEnabled(true);
+ if (readBytes < 0)
+ d->setErrorAndEmit(d->socketEngine->error(), d->socketEngine->errorString());
+ else if (readBytes != result.d->data.size())
+ result.d->data.truncate(readBytes);
+ return result;
+}
/*!
Receives a datagram no larger than \a maxSize bytes and stores
@@ -398,11 +499,20 @@ qint64 QUdpSocket::readDatagram(char *data, qint64 maxSize, QHostAddress *addres
readBytes = d->socketEngine->readDatagram(data, maxSize);
}
- d_func()->socketEngine->setReadNotificationEnabled(true);
- if (readBytes < 0)
+ d->hasPendingData = false;
+ d->socketEngine->setReadNotificationEnabled(true);
+ if (readBytes < 0) {
+ if (readBytes == -2) {
+ // No pending datagram. Treat as a temporary error.
+ d->setErrorAndEmit(QAbstractSocket::TemporaryError,
+ tr("No datagram available for reading"));
+ return -1;
+ }
d->setErrorAndEmit(d->socketEngine->error(), d->socketEngine->errorString());
+ }
return readBytes;
}
+
#endif // QT_NO_UDPSOCKET
QT_END_NAMESPACE
diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h
index cf2f05c86d..6ef10e2edb 100644
--- a/src/network/socket/qudpsocket.h
+++ b/src/network/socket/qudpsocket.h
@@ -40,6 +40,7 @@
#ifndef QUDPSOCKET_H
#define QUDPSOCKET_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtNetwork/qabstractsocket.h>
#include <QtNetwork/qhostaddress.h>
@@ -48,6 +49,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_UDPSOCKET
+class QNetworkDatagram;
class QNetworkInterface;
class QUdpSocketPrivate;
@@ -72,7 +74,10 @@ public:
bool hasPendingDatagrams() const;
qint64 pendingDatagramSize() const;
+ QNetworkDatagram receiveDatagram(qint64 maxSize = -1);
qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *host = Q_NULLPTR, quint16 *port = Q_NULLPTR);
+
+ qint64 writeDatagram(const QNetworkDatagram &datagram);
qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &host, quint16 port);
inline qint64 writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port)
{ return writeDatagram(datagram.constData(), datagram.size(), host, port); }
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index f50a7b1229..793ea60b07 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -25,6 +25,18 @@ SOURCES += socket/qabstractsocketengine.cpp \
socket/qlocalsocket.cpp \
socket/qlocalserver.cpp
+# SCTP support.
+
+qtConfig(sctp) {
+ HEADERS += socket/qsctpserver.h \
+ socket/qsctpserver_p.h \
+ socket/qsctpsocket.h \
+ socket/qsctpsocket_p.h
+
+ SOURCES += socket/qsctpserver.cpp \
+ socket/qsctpsocket.cpp
+}
+
!winrt {
SOURCES += socket/qnativesocketengine.cpp
HEADERS += socket/qnativesocketengine_p.h
@@ -39,11 +51,15 @@ unix: {
unix:HEADERS += \
socket/qnet_unix_p.h
+# Suppress deprecation warnings with moc because MS headers have
+# invalid C/C++ code otherwise.
+msvc: QMAKE_MOC_OPTIONS += -D_WINSOCK_DEPRECATED_NO_WARNINGS
+
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 +70,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
@@ -73,6 +80,6 @@ integrity: {
DEFINES += QT_LOCALSOCKET_TCP
}
-contains(QT_CONFIG, system-proxies) {
+qtConfig(system-proxies) {
DEFINES += QT_USE_SYSTEM_PROXIES
}
diff --git a/src/network/ssl/qasn1element_p.h b/src/network/ssl/qasn1element_p.h
index c636351bf9..2c5019b4f7 100644
--- a/src/network/ssl/qasn1element_p.h
+++ b/src/network/ssl/qasn1element_p.h
@@ -45,13 +45,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qmap.h>
diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h
index 7742844246..c2a468c97c 100644
--- a/src/network/ssl/qssl.h
+++ b/src/network/ssl/qssl.h
@@ -41,7 +41,7 @@
#ifndef QSSL_H
#define QSSL_H
-#include <QtCore/qglobal.h>
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QFlags>
QT_BEGIN_NAMESPACE
diff --git a/src/network/ssl/qssl_p.h b/src/network/ssl/qssl_p.h
index 85eb59ae35..83ccdc7fc3 100644
--- a/src/network/ssl/qssl_p.h
+++ b/src/network/ssl/qssl_p.h
@@ -53,6 +53,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/QLoggingCategory>
QT_BEGIN_NAMESPACE
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 96ba68089d..ce78399e01 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -111,7 +111,7 @@
\value EmailAddress The email address associated with the certificate
*/
-#include <QtCore/qglobal.h>
+#include <QtNetwork/qtnetworkglobal.h>
#ifndef QT_NO_OPENSSL
#include "qsslsocket_openssl_symbols_p.h"
#endif
diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h
index 814c6a701d..8b051a5c88 100644
--- a/src/network/ssl/qsslcertificate.h
+++ b/src/network/ssl/qsslcertificate.h
@@ -45,6 +45,7 @@
#undef verify
#endif
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qcryptographichash.h>
diff --git a/src/network/ssl/qsslcertificate_p.h b/src/network/ssl/qsslcertificate_p.h
index 8b83f754e4..0397845f8d 100644
--- a/src/network/ssl/qsslcertificate_p.h
+++ b/src/network/ssl/qsslcertificate_p.h
@@ -41,15 +41,16 @@
#ifndef QSSLCERTIFICATE_OPENSSL_P_H
#define QSSLCERTIFICATE_OPENSSL_P_H
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qsslcertificate.h"
//
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/network/ssl/qsslcertificateextension.h b/src/network/ssl/qsslcertificateextension.h
index 795dd0ce80..2ce2112687 100644
--- a/src/network/ssl/qsslcertificateextension.h
+++ b/src/network/ssl/qsslcertificateextension.h
@@ -40,6 +40,7 @@
#ifndef QSSLCERTIFICATEEXTENSION_H
#define QSSLCERTIFICATEEXTENSION_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qstring.h>
diff --git a/src/network/ssl/qsslcertificateextension_p.h b/src/network/ssl/qsslcertificateextension_p.h
index a7ff53d4a3..373f92a5cf 100644
--- a/src/network/ssl/qsslcertificateextension_p.h
+++ b/src/network/ssl/qsslcertificateextension_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qsslcertificateextension.h"
QT_BEGIN_NAMESPACE
diff --git a/src/network/ssl/qsslcipher.h b/src/network/ssl/qsslcipher.h
index 8bb404ffa7..c6328e0169 100644
--- a/src/network/ssl/qsslcipher.h
+++ b/src/network/ssl/qsslcipher.h
@@ -41,6 +41,7 @@
#ifndef QSSLCIPHER_H
#define QSSLCIPHER_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qssl.h>
diff --git a/src/network/ssl/qsslcipher_p.h b/src/network/ssl/qsslcipher_p.h
index 1714617361..b8629f9f96 100644
--- a/src/network/ssl/qsslcipher_p.h
+++ b/src/network/ssl/qsslcipher_p.h
@@ -40,6 +40,7 @@
#ifndef QSSLCIPHER_P_H
#define QSSLCIPHER_P_H
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qsslcipher.h"
QT_BEGIN_NAMESPACE
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index c8040dec7f..75a880f115 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -53,6 +53,7 @@ const QSsl::SslOptions QSslConfigurationPrivate::defaultSslOptions = QSsl::SslOp
|QSsl::SslOptionDisableCompression
|QSsl::SslOptionDisableSessionPersistence;
+const char QSslConfiguration::ALPNProtocolHTTP2[] = "h2";
const char QSslConfiguration::NextProtocolSpdy3_0[] = "spdy/3";
const char QSslConfiguration::NextProtocolHttp1_1[] = "http/1.1";
@@ -119,7 +120,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 +211,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 +258,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 +266,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 +817,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 to \a hint. 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 to \a dhparams.
+
+ 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 +892,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 +915,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 +928,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..1c57bebd65 100644
--- a/src/network/ssl/qsslconfiguration.h
+++ b/src/network/ssl/qsslconfiguration.h
@@ -56,6 +56,7 @@
#ifndef QSSLCONFIGURATION_H
#define QSSLCONFIGURATION_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qshareddata.h>
#include <QtNetwork/qsslsocket.h>
#include <QtNetwork/qssl.h>
@@ -69,6 +70,7 @@ class QSslCertificate;
class QSslCipher;
class QSslKey;
class QSslEllipticCurve;
+class QSslDiffieHellmanParameters;
class QSslConfigurationPrivate;
class Q_NETWORK_EXPORT QSslConfiguration
@@ -141,6 +143,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);
@@ -160,6 +168,7 @@ public:
QByteArray nextNegotiatedProtocol() const;
NextProtocolNegotiationStatus nextProtocolNegotiationStatus() const;
+ static const char ALPNProtocolHTTP2[];
static const char NextProtocolSpdy3_0[];
static const char NextProtocolHttp1_1[];
diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h
index 364bba92ec..6adf2c9b54 100644
--- a/src/network/ssl/qsslconfiguration_p.h
+++ b/src/network/ssl/qsslconfiguration_p.h
@@ -67,12 +67,14 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qsslconfiguration.h"
#include "qlist.h"
#include "qsslcertificate.h"
#include "qsslcipher.h"
#include "qsslkey.h"
#include "qsslellipticcurve.h"
+#include "qssldiffiehellmanparameters.h"
QT_BEGIN_NAMESPACE
@@ -87,8 +89,10 @@ public:
allowRootCertOnDemandLoading(true),
peerSessionShared(false),
sslOptions(QSslConfigurationPrivate::defaultSslOptions),
+ dhParams(QSslDiffieHellmanParameters::defaultParameters()),
sslSessionTicketLifeTimeHint(-1),
ephemeralServerKey(),
+ preSharedKeyIdentityHint(),
nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone)
{ }
@@ -117,11 +121,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..c92d8fc3f8 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->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
+#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
+ if (!client)
+ q_SSL_CTX_use_psk_identity_hint(sslContext->ctx, sslContext->sslConfiguration.preSharedKeyIdentityHint().constData());
+#endif // OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(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/qsslcontext_openssl_p.h b/src/network/ssl/qsslcontext_openssl_p.h
index ef4dc6f815..06a31af5e5 100644
--- a/src/network/ssl/qsslcontext_openssl_p.h
+++ b/src/network/ssl/qsslcontext_openssl_p.h
@@ -53,6 +53,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/qvariant.h>
#include <QtNetwork/qsslcertificate.h>
#include <QtNetwork/qsslconfiguration.h>
diff --git a/src/network/ssl/qssldiffiehellmanparameters.cpp b/src/network/ssl/qssldiffiehellmanparameters.cpp
new file mode 100644
index 0000000000..d0fcb3189a
--- /dev/null
+++ b/src/network/ssl/qssldiffiehellmanparameters.cpp
@@ -0,0 +1,324 @@
+/****************************************************************************
+**
+** 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 fromEncoded(
+ 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)
+{
+ d->ref.ref();
+}
+
+/*!
+ Constructs a QSslDiffieHellmanParameters object using
+ the byte array \a encoded in either PEM or DER form as specified by \a encoding.
+
+ Use the isValid() method on the returned object to
+ check whether the Diffie-Hellman parameters were valid and
+ loaded correctly.
+
+ \sa isValid()
+ \sa QSslConfiguration
+*/
+QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat encoding)
+{
+ QSslDiffieHellmanParameters result;
+ switch (encoding) {
+ case QSsl::Der:
+ result.d->decodeDer(encoded);
+ break;
+ case QSsl::Pem:
+ result.d->decodePem(encoded);
+ break;
+ }
+ return result;
+}
+
+/*!
+ Constructs a QSslDiffieHellmanParameters object by
+ reading from \a device in either PEM or DER form as specified by \a encoding.
+
+ Use the isValid() method on the returned object
+ to check whether the Diffie-Hellman parameters were valid
+ and loaded correctly.
+
+ In particular, if \a device is \c nullptr or not open for reading, an invalid
+ object will be returned.
+
+ \sa isValid()
+ \sa QSslConfiguration
+*/
+QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(QIODevice *device, QSsl::EncodingFormat encoding)
+{
+ if (device)
+ return fromEncoded(device->readAll(), encoding);
+ else
+ return QSslDiffieHellmanParameters();
+}
+
+/*!
+ Constructs an identical copy of \a other.
+*/
+QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other)
+ : d(other.d)
+{
+ if (d)
+ d->ref.ref();
+}
+
+/*!
+ \fn QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other)
+
+ Move-constructs from \a other.
+
+ \note The moved-from object \a other is placed in a partially-formed state, in which
+ the only valid operations are destruction and assignment of a new value.
+*/
+
+/*!
+ Destroys the QSslDiffieHellmanParameters object.
+*/
+QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters()
+{
+ if (d && !d->ref.deref())
+ delete d;
+}
+
+/*!
+ 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)
+{
+ QSslDiffieHellmanParameters copy(other);
+ swap(copy);
+ return *this;
+}
+
+/*!
+ \fn QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(QSslDiffieHellmanParameters &&other)
+
+ Move-assigns \a other to this QSslDiffieHellmanParameters instance.
+
+ \note The moved-from object \a other is placed in a partially-formed state, in which
+ the only valid operations are destruction and assignment of a new value.
+*/
+
+/*!
+ \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 error()
+*/
+bool QSslDiffieHellmanParameters::isValid() const Q_DECL_NOTHROW
+{
+ return d->error == QSslDiffieHellmanParameters::NoError;
+}
+
+/*!
+ \enum QSslDiffieHellmanParameters::Error
+
+ Describes a QSslDiffieHellmanParameters error.
+
+ \value NoError No error occurred.
+
+ \value InvalidInputDataError The given input data could not be used to
+ construct a QSslDiffieHellmanParameters
+ object.
+
+ \value UnsafeParametersError 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();
+}
+
+/*!
+ \since 5.8
+ \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
+/*!
+ \since 5.8
+ \relates QSslDiffieHellmanParameters
+
+ Writes the set of Diffie-Hellman parameters in \a dhparam 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
+
+/*!
+ \since 5.8
+ \relates QSslDiffieHellmanParameters
+
+ 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..4533ea4ed2
--- /dev/null
+++ b/src/network/ssl/qssldiffiehellmanparameters.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** 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 QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other);
+ QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
+ Q_NETWORK_EXPORT ~QSslDiffieHellmanParameters();
+
+ Q_NETWORK_EXPORT QSslDiffieHellmanParameters &operator=(const QSslDiffieHellmanParameters &other);
+ QSslDiffieHellmanParameters &operator=(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW { swap(other); return *this; }
+
+ void swap(QSslDiffieHellmanParameters &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
+
+ Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem);
+ Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
+
+ Q_NETWORK_EXPORT bool isEmpty() const Q_DECL_NOTHROW;
+ Q_NETWORK_EXPORT bool isValid() const Q_DECL_NOTHROW;
+ Q_NETWORK_EXPORT Error error() const Q_DECL_NOTHROW;
+ Q_NETWORK_EXPORT QString errorString() const Q_DECL_NOTHROW;
+
+private:
+ 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/config.tests/x11/xsync/xsync.cpp b/src/network/ssl/qssldiffiehellmanparameters_dummy.cpp
index 48feefdb4a..220c017f4c 100644
--- a/config.tests/x11/xsync/xsync.cpp
+++ 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 config.tests of the Qt Toolkit.
+** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,18 +37,21 @@
**
****************************************************************************/
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-extern "C" {
-#include <X11/extensions/sync.h>
+
+#include "qssldiffiehellmanparameters.h"
+#include "qssldiffiehellmanparameters_p.h"
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qbytearray.h>
+
+QT_BEGIN_NAMESPACE
+
+void QSslDiffieHellmanParametersPrivate::decodeDer(const QByteArray &)
+{
}
-int main(int, char **)
+void QSslDiffieHellmanParametersPrivate::decodePem(const QByteArray &)
{
- XSyncValue value;
- (void*)&XSyncIntToValue;
- (void*)&XSyncCreateCounter;
- int a, b;
- Status ret = XSyncInitialize(NULL, &a, &b);
- return ret;
}
+
+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/network/ssl/qssldiffiehellmanparameters_p.h b/src/network/ssl/qssldiffiehellmanparameters_p.h
new file mode 100644
index 0000000000..06ecf292ff
--- /dev/null
+++ b/src/network/ssl/qssldiffiehellmanparameters_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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_P_H
+#define QSSLDIFFIEHELLMANPARAMETERS_P_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 <QtNetwork/private/qtnetworkglobal_p.h>
+#include <QSharedData>
+
+#include "qsslkey.h"
+#include "qssldiffiehellmanparameters.h"
+#include "qsslsocket_p.h" // includes wincrypt.h
+
+QT_BEGIN_NAMESPACE
+
+class QSslDiffieHellmanParametersPrivate : public QSharedData
+{
+public:
+ QSslDiffieHellmanParametersPrivate() : error(QSslDiffieHellmanParameters::NoError) {};
+
+ void decodeDer(const QByteArray &der);
+ void decodePem(const QByteArray &pem);
+
+ QSslDiffieHellmanParameters::Error error;
+ QByteArray derData;
+};
+
+QT_END_NAMESPACE
+
+#endif // QSSLDIFFIEHELLMANPARAMETERS_P_H
diff --git a/src/network/ssl/qsslellipticcurve.h b/src/network/ssl/qsslellipticcurve.h
index 6ee66d1ec1..0e7cc60e31 100644
--- a/src/network/ssl/qsslellipticcurve.h
+++ b/src/network/ssl/qsslellipticcurve.h
@@ -40,7 +40,7 @@
#ifndef QSSLELLIPTICCURVE_H
#define QSSLELLIPTICCURVE_H
-#include <QtCore/QtGlobal>
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QString>
#include <QtCore/QMetaType>
#if QT_DEPRECATED_SINCE(5, 6)
diff --git a/src/network/ssl/qsslerror.h b/src/network/ssl/qsslerror.h
index 82db2e58e4..d7c959423d 100644
--- a/src/network/ssl/qsslerror.h
+++ b/src/network/ssl/qsslerror.h
@@ -41,6 +41,7 @@
#ifndef QSSLERROR_H
#define QSSLERROR_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qvariant.h>
#include <QtNetwork/qsslcertificate.h>
diff --git a/src/network/ssl/qsslkey.h b/src/network/ssl/qsslkey.h
index 39c3659fb8..6de02b1e44 100644
--- a/src/network/ssl/qsslkey.h
+++ b/src/network/ssl/qsslkey.h
@@ -41,6 +41,7 @@
#ifndef QSSLKEY_H
#define QSSLKEY_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qsharedpointer.h>
diff --git a/src/network/ssl/qsslkey_p.cpp b/src/network/ssl/qsslkey_p.cpp
index 34f664093c..e66ec953a0 100644
--- a/src/network/ssl/qsslkey_p.cpp
+++ b/src/network/ssl/qsslkey_p.cpp
@@ -56,6 +56,9 @@
#include "qsslkey.h"
#include "qsslkey_p.h"
+#ifndef QT_NO_OPENSSL
+#include "qsslsocket_openssl_symbols_p.h"
+#endif
#include "qsslsocket.h"
#include "qsslsocket_p.h"
@@ -277,18 +280,23 @@ QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::Encoding
\a type specifies whether the key is public or private.
QSslKey will take ownership for this key and you must not
- free the key using the native library. The algorithm used
- when creating a key from a handle will always be QSsl::Opaque.
+ free the key using the native library.
*/
QSslKey::QSslKey(Qt::HANDLE handle, QSsl::KeyType type)
: d(new QSslKeyPrivate)
{
#ifndef QT_NO_OPENSSL
- d->opaque = reinterpret_cast<EVP_PKEY *>(handle);
+ EVP_PKEY *evpKey = reinterpret_cast<EVP_PKEY *>(handle);
+ if (!evpKey || !d->fromEVP_PKEY(evpKey)) {
+ d->opaque = evpKey;
+ d->algorithm = QSsl::Opaque;
+ } else {
+ q_EVP_PKEY_free(evpKey);
+ }
#else
d->opaque = handle;
-#endif
d->algorithm = QSsl::Opaque;
+#endif
d->type = type;
d->isNull = !d->opaque;
}
diff --git a/src/network/ssl/qsslkey_p.h b/src/network/ssl/qsslkey_p.h
index c17183a059..c93941c198 100644
--- a/src/network/ssl/qsslkey_p.h
+++ b/src/network/ssl/qsslkey_p.h
@@ -41,8 +41,6 @@
#ifndef QSSLKEY_OPENSSL_P_H
#define QSSLKEY_OPENSSL_P_H
-#include "qsslkey.h"
-
//
// W A R N I N G
// -------------
@@ -54,6 +52,8 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
+#include "qsslkey.h"
#include "qsslsocket_p.h" // includes wincrypt.h
#ifndef QT_NO_OPENSSL
diff --git a/src/network/ssl/qsslpresharedkeyauthenticator.h b/src/network/ssl/qsslpresharedkeyauthenticator.h
index f34a2cee75..a012ff489a 100644
--- a/src/network/ssl/qsslpresharedkeyauthenticator.h
+++ b/src/network/ssl/qsslpresharedkeyauthenticator.h
@@ -40,7 +40,7 @@
#ifndef QSSLPRESHAREDKEYAUTHENTICATOR_H
#define QSSLPRESHAREDKEYAUTHENTICATOR_H
-#include <QtCore/QtGlobal>
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/QString>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QMetaType>
diff --git a/src/network/ssl/qsslpresharedkeyauthenticator_p.h b/src/network/ssl/qsslpresharedkeyauthenticator_p.h
index b9aa6eb28c..e5566c3b3c 100644
--- a/src/network/ssl/qsslpresharedkeyauthenticator_p.h
+++ b/src/network/ssl/qsslpresharedkeyauthenticator_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QSharedData>
QT_BEGIN_NAMESPACE
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index fc60f48d93..29e1f32815 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -837,15 +837,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();
}
/*!
@@ -924,6 +916,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();
@@ -2623,6 +2617,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..1b29cd4637 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -41,6 +41,7 @@
#ifndef QSSLSOCKET_H
#define QSSLSOCKET_H
+#include <QtNetwork/qtnetworkglobal.h>
#include <QtCore/qlist.h>
#include <QtCore/qregexp.h>
#ifndef QT_NO_SSL
@@ -116,7 +117,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 7442bbf1d5..0548aa3909 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 only used on macOS. (see the SSLSetDiffieHellmanParams call below)
static const uint8_t dhparam[] =
"\x30\x82\x01\x08\x02\x82\x01\x01\x00\x97\xea\xd0\x46\xf7\xae\xa7\x76\x80"
"\x9c\x74\x56\x98\xd8\x56\x97\x2b\x20\x6c\x77\xe2\x82\xbb\xc8\x84\xbe\xe7"
@@ -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/watchOS. (defined in MacErrors.h on macOS)
+#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_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h
index 09b6f392cd..9e1d18981e 100644
--- a/src/network/ssl/qsslsocket_mac_p.h
+++ b/src/network/ssl/qsslsocket_mac_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <QtCore/qstring.h>
#include <QtCore/qglobal.h>
#include <QtCore/qlist.h>
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index b3820aea97..aca7507d13 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) {
@@ -1278,6 +1277,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)
@@ -1579,7 +1603,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..b2adb3e547 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -59,13 +59,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include "qsslsocket_p.h"
#ifdef Q_OS_WIN
@@ -143,6 +144,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..88fed69d3a 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)
@@ -202,17 +206,20 @@ DEFINEFUNC(int, OBJ_obj2nid, const ASN1_OBJECT *a, a, return NID_undef, return)
DEFINEFUNC6(void *, PEM_ASN1_read_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return)
DEFINEFUNC6(void *, PEM_ASN1_write_bio, d2i_of_void *a, a, const char *b, b, BIO *c, c, void **d, d, pem_password_cb *e, e, void *f, f, return 0, return)
#else
+DEFINEFUNC4(EVP_PKEY *, PEM_read_bio_PrivateKey, BIO *a, a, EVP_PKEY **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
DEFINEFUNC4(DSA *, PEM_read_bio_DSAPrivateKey, BIO *a, a, DSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
DEFINEFUNC4(RSA *, PEM_read_bio_RSAPrivateKey, BIO *a, a, RSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
#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
DEFINEFUNC7(int, PEM_write_bio_ECPrivateKey, BIO *a, a, EC_KEY *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)
#endif
#endif
+DEFINEFUNC4(EVP_PKEY *, PEM_read_bio_PUBKEY, BIO *a, a, EVP_PKEY **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
DEFINEFUNC4(DSA *, PEM_read_bio_DSA_PUBKEY, BIO *a, a, DSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
DEFINEFUNC4(RSA *, PEM_read_bio_RSA_PUBKEY, BIO *a, a, RSA **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
#ifndef OPENSSL_NO_EC
@@ -300,6 +307,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 +427,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 +791,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)
@@ -811,17 +838,20 @@ bool q_resolveOpenSslSymbols()
#ifdef SSLEAY_MACROS // ### verify
RESOLVEFUNC(PEM_ASN1_read_bio)
#else
+ RESOLVEFUNC(PEM_read_bio_PrivateKey)
RESOLVEFUNC(PEM_read_bio_DSAPrivateKey)
RESOLVEFUNC(PEM_read_bio_RSAPrivateKey)
#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
RESOLVEFUNC(PEM_write_bio_ECPrivateKey)
#endif
#endif
+ RESOLVEFUNC(PEM_read_bio_PUBKEY)
RESOLVEFUNC(PEM_read_bio_DSA_PUBKEY)
RESOLVEFUNC(PEM_read_bio_RSA_PUBKEY)
#ifndef OPENSSL_NO_EC
@@ -889,6 +919,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
@@ -972,9 +1004,16 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(SSL_CTX_set_next_proto_select_cb)
RESOLVEFUNC(SSL_get0_next_proto_negotiated)
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+ RESOLVEFUNC(SSL_set_alpn_protos)
+ RESOLVEFUNC(SSL_CTX_set_alpn_select_cb)
+ RESOLVEFUNC(SSL_get0_alpn_selected)
+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ...
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 df17fd8a9c..b35a895d38 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -60,13 +60,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include "qsslsocket_openssl_p.h"
#include <QtCore/qglobal.h>
@@ -220,13 +221,28 @@ unsigned char * q_ASN1_STRING_data(ASN1_STRING *a);
int q_ASN1_STRING_length(ASN1_STRING *a);
int q_ASN1_STRING_to_UTF8(unsigned char **a, ASN1_STRING *b);
long q_BIO_ctrl(BIO *a, int b, long c, void *d);
-int q_BIO_free(BIO *a);
-BIO *q_BIO_new(BIO_METHOD *a);
+Q_AUTOTEST_EXPORT int q_BIO_free(BIO *a);
+Q_AUTOTEST_EXPORT BIO *q_BIO_new(BIO_METHOD *a);
BIO *q_BIO_new_mem_buf(void *a, int b);
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);
+Q_AUTOTEST_EXPORT BIO_METHOD *q_BIO_s_mem();
+Q_AUTOTEST_EXPORT 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);
@@ -279,11 +295,13 @@ void *q_PEM_ASN1_read_bio(d2i_of_void *a, const char *b, BIO *c, void **d, pem_p
void *f);
// ### ditto for write
#else
+Q_AUTOTEST_EXPORT EVP_PKEY *q_PEM_read_bio_PrivateKey(BIO *a, EVP_PKEY **b, pem_password_cb *c, void *d);
DSA *q_PEM_read_bio_DSAPrivateKey(BIO *a, DSA **b, pem_password_cb *c, void *d);
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,
@@ -293,6 +311,7 @@ int q_PEM_write_bio_ECPrivateKey(BIO *a, EC_KEY *b, const EVP_CIPHER *c, unsigne
int e, pem_password_cb *f, void *g);
#endif
#endif
+Q_AUTOTEST_EXPORT EVP_PKEY *q_PEM_read_bio_PUBKEY(BIO *a, EVP_PKEY **b, pem_password_cb *c, void *d);
DSA *q_PEM_read_bio_DSA_PUBKEY(BIO *a, DSA **b, pem_password_cb *c, void *d);
RSA *q_PEM_read_bio_RSA_PUBKEY(BIO *a, RSA **b, pem_password_cb *c, void *d);
#ifndef OPENSSL_NO_EC
@@ -376,6 +395,9 @@ void *q_SSL_get_ex_data(const SSL *ssl, int idx);
#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(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_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#ifndef OPENSSL_NO_SSL2
@@ -472,6 +494,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 +542,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 +585,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..cec61d07c1 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -47,13 +47,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtNetwork/private/qtnetworkglobal_p.h>
#include <private/qtcpsocket_p.h>
#include "qsslkey.h"
#include "qsslconfiguration_p.h"
@@ -89,11 +90,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 +190,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/qsslsocket_winrt_p.h b/src/network/ssl/qsslsocket_winrt_p.h
index 3946a0e60b..1043aeee11 100644
--- a/src/network/ssl/qsslsocket_winrt_p.h
+++ b/src/network/ssl/qsslsocket_winrt_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtNetwork/private/qtnetworkglobal_p.h>
#include "qsslsocket_p.h"
#include <wrl.h>
diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
index c70664ef9b..8139af50af 100644
--- a/src/network/ssl/ssl.pri
+++ b/src/network/ssl/ssl.pri
@@ -1,5 +1,5 @@
# OpenSSL support; compile in QSslSocket.
-contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
+qtConfig(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,52 +38,55 @@ 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 \
ssl/qsslellipticcurve_dummy.cpp
}
- contains(QT_CONFIG, securetransport) {
+ qtConfig(securetransport) {
HEADERS += ssl/qsslsocket_mac_p.h
SOURCES += ssl/qsslcertificate_qt.cpp \
+ ssl/qssldiffiehellmanparameters_dummy.cpp \
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
+ qtConfig(openssl)|qtConfig(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/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index 465265da27..95401d10c1 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 2386ef5d19..25de6ad670 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -9,8 +9,8 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf
-contains(QT_CONFIG, opengl):CONFIG += opengl
-contains(QT_CONFIG, opengles2):CONFIG += opengles2
+qtConfig(opengl): CONFIG += opengl
+qtConfig(opengles2): CONFIG += opengles2
HEADERS += qgl.h \
qgl_p.h \
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 6b0501e8d0..5aa807b12c 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/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h
index 61ae10fa70..d3af1fdbaa 100644
--- a/src/opengl/qglframebufferobject_p.h
+++ b/src/opengl/qglframebufferobject_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h
index c2040589e3..6416e41773 100644
--- a/src/opengl/qglpixelbuffer_p.h
+++ b/src/opengl/qglpixelbuffer_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/openglextensions/openglextensions.pro b/src/openglextensions/openglextensions.pro
index 04a871114b..42ba4152d5 100644
--- a/src/openglextensions/openglextensions.pro
+++ b/src/openglextensions/openglextensions.pro
@@ -1,8 +1,8 @@
TARGET = QtOpenGLExtensions
CONFIG += static
-contains(QT_CONFIG, opengl):CONFIG += opengl
-contains(QT_CONFIG, opengles2):CONFIG += opengles2
+qtConfig(opengl): CONFIG += opengl
+qtConfig(opengles2): CONFIG += opengles2
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
diff --git a/src/platformsupport/accessibility/accessibility.pri b/src/platformsupport/accessibility/accessibility.pri
index fb56edbf1a..924f6a512f 100644
--- a/src/platformsupport/accessibility/accessibility.pri
+++ b/src/platformsupport/accessibility/accessibility.pri
@@ -1,4 +1,4 @@
-contains(QT_CONFIG, accessibility) {
+qtConfig(accessibility) {
INCLUDEPATH += $$PWD
HEADERS += \
diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm
index a4c5c7f61e..85add35879 100644
--- a/src/platformsupport/cglconvenience/cglconvenience.mm
+++ b/src/platformsupport/cglconvenience/cglconvenience.mm
@@ -81,22 +81,15 @@ void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format)
else if (format.swapBehavior() == QSurfaceFormat::TripleBuffer)
attrs.append(NSOpenGLPFATripleBuffer);
-#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 f2b9afa2b5..d48da8da15 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
@@ -520,11 +520,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/dbusmenu/qdbusmenuadaptor.cpp b/src/platformsupport/dbusmenu/qdbusmenuadaptor.cpp
index f6a5144e2b..354b9c3a2e 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuadaptor.cpp
+++ b/src/platformsupport/dbusmenu/qdbusmenuadaptor.cpp
@@ -105,7 +105,7 @@ QList<int> QDBusMenuAdaptor::AboutToShowGroup(const QList<int> &ids, QList<int>
qCDebug(qLcMenu) << ids;
Q_UNUSED(idErrors)
idErrors.clear();
- Q_FOREACH (int id, ids)
+ for (int id : ids)
AboutToShow(id);
return QList<int>(); // updatesNeeded
}
@@ -134,7 +134,7 @@ void QDBusMenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant
QList<int> QDBusMenuAdaptor::EventGroup(const QDBusMenuEventList &events)
{
- Q_FOREACH (const QDBusMenuEvent &ev, events)
+ for (const QDBusMenuEvent &ev : events)
Event(ev.m_id, ev.m_eventId, ev.m_data, ev.m_timestamp);
return QList<int>(); // idErrors
}
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp b/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
index 546483fcec..82a13d2fa0 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
+++ b/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
@@ -113,7 +113,8 @@ uint QDBusMenuLayoutItem::populate(int id, int depth, const QStringList &propert
void QDBusMenuLayoutItem::populate(const QDBusPlatformMenu *menu, int depth, const QStringList &propertyNames)
{
- Q_FOREACH (QDBusPlatformMenuItem *item, menu->items()) {
+ const auto items = menu->items();
+ for (QDBusPlatformMenuItem *item : items) {
QDBusMenuLayoutItem child;
child.populate(item, depth - 1, propertyNames);
m_children << child;
@@ -136,7 +137,7 @@ const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuLayoutItem &i
arg.beginStructure();
arg << item.m_id << item.m_properties;
arg.beginArray(qMetaTypeId<QDBusVariant>());
- foreach (const QDBusMenuLayoutItem& child, item.m_children)
+ for (const QDBusMenuLayoutItem &child : item.m_children)
arg << QDBusVariant(QVariant::fromValue<QDBusMenuLayoutItem>(child));
arg.endArray();
arg.endStructure();
@@ -190,11 +191,13 @@ QDBusMenuItem::QDBusMenuItem(const QDBusPlatformMenuItem *item)
m_properties.insert(QLatin1String("toggle-type"), toggleType);
m_properties.insert(QLatin1String("toggle-state"), item->isChecked() ? 1 : 0);
}
+#ifndef QT_NO_SHORTCUT
const QKeySequence &scut = item->shortcut();
if (!scut.isEmpty()) {
QDBusMenuShortcut shortcut = convertKeySequence(scut);
m_properties.insert(QLatin1String("shortcut"), QVariant::fromValue(shortcut));
}
+#endif
const QIcon &icon = item->icon();
if (!icon.name().isEmpty()) {
m_properties.insert(QLatin1String("icon-name"), icon.name());
@@ -211,9 +214,9 @@ QDBusMenuItemList QDBusMenuItem::items(const QList<int> &ids, const QStringList
{
Q_UNUSED(propertyNames)
QDBusMenuItemList ret;
- QList<const QDBusPlatformMenuItem *> items = QDBusPlatformMenuItem::byIds(ids);
+ const QList<const QDBusPlatformMenuItem *> items = QDBusPlatformMenuItem::byIds(ids);
ret.reserve(items.size());
- Q_FOREACH (const QDBusPlatformMenuItem *item, items)
+ for (const QDBusPlatformMenuItem *item : items)
ret << QDBusMenuItem(item);
return ret;
}
@@ -230,6 +233,7 @@ QString QDBusMenuItem::convertMnemonic(const QString &label)
return ret;
}
+#ifndef QT_NO_SHORTCUT
QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence)
{
QDBusMenuShortcut shortcut;
@@ -258,6 +262,7 @@ QDBusMenuShortcut QDBusMenuItem::convertKeySequence(const QKeySequence &sequence
}
return shortcut;
}
+#endif
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuEvent &ev)
{
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h b/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
index 1de71b69e4..fd6727d3be 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
+++ b/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
@@ -74,7 +74,9 @@ public:
static QDBusMenuItemList items(const QList<int> &ids, const QStringList &propertyNames);
static QString convertMnemonic(const QString &label);
+#ifndef QT_NO_SHORTCUT
static QDBusMenuShortcut convertKeySequence(const QKeySequence &sequence);
+#endif
static void registerDBusTypes();
int m_id;
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
index 446c3dfa83..15440a03cd 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
@@ -134,10 +134,12 @@ void QDBusPlatformMenuItem::setHasExclusiveGroup(bool hasExclusiveGroup)
m_hasExclusiveGroup = hasExclusiveGroup;
}
+#ifndef QT_NO_SHORTCUT
void QDBusPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
{
m_shortcut = shortcut;
}
+#endif
void QDBusPlatformMenuItem::trigger()
{
@@ -156,7 +158,7 @@ QDBusPlatformMenuItem *QDBusPlatformMenuItem::byId(int id)
QList<const QDBusPlatformMenuItem *> QDBusPlatformMenuItem::byIds(const QList<int> &ids)
{
QList<const QDBusPlatformMenuItem *> ret;
- Q_FOREACH (int id, ids) {
+ for (int id : ids) {
if (menuItemsByID.contains(id))
ret << menuItemsByID[id];
}
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h b/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h
index f641ff5d8e..38c27e8051 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h
+++ b/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h
@@ -99,8 +99,10 @@ public:
void setChecked(bool isChecked) Q_DECL_OVERRIDE;
bool hasExclusiveGroup() const { return m_hasExclusiveGroup; }
void setHasExclusiveGroup(bool hasExclusiveGroup) Q_DECL_OVERRIDE;
+#ifndef QT_NO_SHORTCUT
QKeySequence shortcut() const { return m_shortcut; }
void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE;
+#endif
void setIconSize(int size) Q_DECL_OVERRIDE { Q_UNUSED(size); }
void setNativeContents(WId item) Q_DECL_OVERRIDE { Q_UNUSED(item); }
diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/dbustray/qdbustrayicon.cpp
index 1d8e430f3e..0369eaf144 100644
--- a/src/platformsupport/dbustray/qdbustrayicon.cpp
+++ b/src/platformsupport/dbustray/qdbustrayicon.cpp
@@ -37,9 +37,10 @@
**
****************************************************************************/
+#include "qdbustrayicon_p.h"
+
#ifndef QT_NO_SYSTEMTRAYICON
-#include "qdbustrayicon_p.h"
#include "qdbusmenuconnection_p.h"
#include "qstatusnotifieritemadaptor_p.h"
#include "qdbusmenuadaptor_p.h"
@@ -302,4 +303,3 @@ bool QDBusTrayIcon::isSystemTrayAvailable() const
QT_END_NAMESPACE
#endif //QT_NO_SYSTEMTRAYICON
-
diff --git a/src/platformsupport/dbustray/qdbustrayicon_p.h b/src/platformsupport/dbustray/qdbustrayicon_p.h
index fa2299866a..a383ef86fc 100644
--- a/src/platformsupport/dbustray/qdbustrayicon_p.h
+++ b/src/platformsupport/dbustray/qdbustrayicon_p.h
@@ -52,6 +52,8 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_SYSTEMTRAYICON
#include <QIcon>
@@ -162,6 +164,6 @@ private:
};
QT_END_NAMESPACE
-#endif // QT_NO_SYSTEMTRAYICON
+#endif // QT_NO_SYSTEMTRAYICON
#endif // QDBUSTRAYICON_H
diff --git a/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp b/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
index 402cdab92c..d3c5454f01 100644
--- a/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
+++ b/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
@@ -48,9 +48,10 @@
QMetaObject::invokeMethod().
*/
+#include "qstatusnotifieritemadaptor_p.h"
+
#ifndef QT_NO_SYSTEMTRAYICON
-#include "qstatusnotifieritemadaptor_p.h"
#include "qdbustrayicon_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h b/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
index deab9e74b5..776e1b23ef 100644
--- a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
+++ b/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
@@ -62,6 +62,8 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_SYSTEMTRAYICON
#include <QtCore/QObject>
diff --git a/src/platformsupport/devicediscovery/devicediscovery.pri b/src/platformsupport/devicediscovery/devicediscovery.pri
index 9829ae88ba..f4e9103130 100644
--- a/src/platformsupport/devicediscovery/devicediscovery.pri
+++ b/src/platformsupport/devicediscovery/devicediscovery.pri
@@ -1,11 +1,10 @@
HEADERS += $$PWD/qdevicediscovery_p.h
-contains(QT_CONFIG, libudev) {
+qtConfig(libudev) {
SOURCES += $$PWD/qdevicediscovery_udev.cpp
HEADERS += $$PWD/qdevicediscovery_udev_p.h
- INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-} else: contains(QT_CONFIG, evdev) {
+ QMAKE_USE_PRIVATE += libudev
+} else: qtConfig(evdev) {
SOURCES += $$PWD/qdevicediscovery_static.cpp
HEADERS += $$PWD/qdevicediscovery_static_p.h
} else {
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
index 135ffa2494..5c72dbe7e2 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
@@ -101,7 +101,8 @@ QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
// check for input devices
if (m_types & Device_InputMask) {
dir.setPath(QString::fromLatin1(QT_EVDEV_DEVICE_PATH));
- foreach (const QString &deviceFile, dir.entryList()) {
+ const auto deviceFiles = dir.entryList();
+ for (const QString &deviceFile : deviceFiles) {
QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
@@ -111,7 +112,8 @@ QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
// check for drm devices
if (m_types & Device_VideoMask) {
dir.setPath(QString::fromLatin1(QT_DRM_DEVICE_PATH));
- foreach (const QString &deviceFile, dir.entryList()) {
+ const auto deviceFiles = dir.entryList();
+ for (const QString &deviceFile : deviceFiles) {
QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
@@ -133,7 +135,7 @@ bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device)
qCDebug(lcDD) << "doing static device discovery for " << device;
- if ((m_types & Device_DRM) && device.contains(QString::fromLatin1(QT_DRM_DEVICE_PREFIX))) {
+ if ((m_types & Device_DRM) && device.contains(QLatin1String(QT_DRM_DEVICE_PREFIX))) {
QT_CLOSE(fd);
return true;
}
diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri
index 1cacaf4a4c..4a93d997fb 100644
--- a/src/platformsupport/eglconvenience/eglconvenience.pri
+++ b/src/platformsupport/eglconvenience/eglconvenience.pri
@@ -1,4 +1,4 @@
-contains(QT_CONFIG,egl) {
+qtConfig(egl) {
HEADERS += \
$$PWD/qeglconvenience_p.h \
$$PWD/qeglstreamconvenience_p.h \
@@ -8,7 +8,7 @@ contains(QT_CONFIG,egl) {
$$PWD/qeglconvenience.cpp \
$$PWD/qeglstreamconvenience.cpp
- contains(QT_CONFIG,opengl) {
+ qtConfig(opengl) {
HEADERS += $$PWD/qeglplatformcontext_p.h \
$$PWD/qeglpbuffer_p.h
@@ -19,7 +19,7 @@ contains(QT_CONFIG,egl) {
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
- contains(QT_CONFIG,xlib) {
+ qtConfig(xlib) {
HEADERS += \
$$PWD/qxlibeglintegration_p.h
SOURCES += \
diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
index f535afbc55..a4c8245280 100644
--- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
@@ -140,6 +140,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay
#define EGL_DRM_PLANE_EXT 0x3235
#endif
+#ifndef EGL_PLATFORM_X11_KHR
+#define EGL_PLATFORM_X11_KHR 0x31D5
+#endif
+
QT_BEGIN_NAMESPACE
class QEGLStreamConvenience
diff --git a/src/platformsupport/eventdispatchers/eventdispatchers.pri b/src/platformsupport/eventdispatchers/eventdispatchers.pri
index a0b37cae1a..fb0f3b3827 100644
--- a/src/platformsupport/eventdispatchers/eventdispatchers.pri
+++ b/src/platformsupport/eventdispatchers/eventdispatchers.pri
@@ -14,9 +14,8 @@ HEADERS +=\
$$PWD/qwindowsguieventdispatcher_p.h
}
-contains(QT_CONFIG, glib) {
+qtConfig(glib) {
SOURCES +=$$PWD/qeventdispatcher_glib.cpp
HEADERS +=$$PWD/qeventdispatcher_glib_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE += $$QT_LIBS_GLIB
+ QMAKE_USE_PRIVATE += glib
}
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
index 7d57b97276..6d148753bf 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
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/eventdispatchers/qwindowsguieventdispatcher_p.h b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
index 5682fc72ef..9a23b5c0bd 100644
--- a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
+++ b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
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..216f2722a4 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -138,15 +138,16 @@ void QFbScreen::lower(QFbWindow *window)
QWindow *QFbScreen::topWindow() const
{
- foreach (QFbWindow *fbw, mWindowStack)
+ for (QFbWindow *fbw : mWindowStack) {
if (fbw->window()->type() == Qt::Window || fbw->window()->type() == Qt::Dialog)
return fbw->window();
+ }
return 0;
}
QWindow *QFbScreen::topLevelAt(const QPoint & p) const
{
- foreach (QFbWindow *fbw, mWindowStack) {
+ for (QFbWindow *fbw : mWindowStack) {
if (fbw->geometry().contains(p, false) && fbw->window()->isVisible())
return fbw->window();
}
@@ -206,15 +207,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 +253,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/fbconvenience/qfbvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp
index 4c4a01a82e..102bc91647 100644
--- a/src/platformsupport/fbconvenience/qfbvthandler.cpp
+++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp
@@ -39,8 +39,9 @@
#include "qfbvthandler_p.h"
#include <QtCore/QSocketNotifier>
+#include <QtCore/private/qglobal_p.h>
-#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (!defined(QT_NO_EVDEV) || !defined(QT_NO_LIBINPUT))
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (QT_CONFIG(evdev) || QT_CONFIG(libinput))
#define VTH_ENABLED
@@ -171,7 +172,7 @@ void QFbVtHandler::handleSignal()
char sigNo;
if (QT_READ(m_sigFd[1], &sigNo, sizeof(sigNo)) == sizeof(sigNo)) {
switch (sigNo) {
- case SIGINT: // fallthrough
+ case SIGINT:
case SIGTERM:
handleInt();
break;
diff --git a/src/platformsupport/fbconvenience/qfbvthandler_p.h b/src/platformsupport/fbconvenience/qfbvthandler_p.h
index e05a9d3ffc..17d07317b2 100644
--- a/src/platformsupport/fbconvenience/qfbvthandler_p.h
+++ b/src/platformsupport/fbconvenience/qfbvthandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QObject>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri
index d70b3b6a1a..575c93fe20 100644
--- a/src/platformsupport/fontdatabases/basic/basic.pri
+++ b/src/platformsupport/fontdatabases/basic/basic.pri
@@ -1,5 +1,3 @@
-DEFINES += QT_NO_FONTCONFIG
-
HEADERS += \
$$PWD/qbasicfontdatabase_p.h \
$$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h
@@ -8,6 +6,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/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
index 4b9d4690f3..60ddc9fa23 100644
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
@@ -77,7 +77,8 @@ void QBasicFontDatabase::populateFontDatabase()
<< QLatin1String("*.pfb")
<< QLatin1String("*.otf");
- foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) {
+ const auto fis = dir.entryInfoList(nameFilters, QDir::Files);
+ for (const QFileInfo &fi : fis) {
const QByteArray file = QFile::encodeName(fi.absoluteFilePath());
QBasicFontDatabase::addTTFile(QByteArray(), file);
}
diff --git a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
index bd7294b818..63097c33c1 100644
--- a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
+++ b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
@@ -2,5 +2,5 @@ HEADERS += $$PWD/qfontconfigdatabase_p.h \
$$PWD/qfontenginemultifontconfig_p.h
SOURCES += $$PWD/qfontconfigdatabase.cpp \
$$PWD/qfontenginemultifontconfig.cpp
-DEFINES -= QT_NO_FONTCONFIG
+
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_FONTCONFIG
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 591259ad70..d92b87c6da 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -510,7 +510,7 @@ static void populateFromPattern(FcPattern *pattern)
void QFontconfigDatabase::populateFontDatabase()
{
- FcInitReinitialize();
+ FcInit();
FcFontSet *fonts;
{
@@ -574,6 +574,12 @@ void QFontconfigDatabase::populateFontDatabase()
// QApplication::setFont(font);
}
+void QFontconfigDatabase::invalidate()
+{
+ // Clear app fonts.
+ FcConfigAppFontClear(0);
+}
+
QFontEngineMulti *QFontconfigDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script)
{
return new QFontEngineMultiFontConfig(fontEngine, script);
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
index 197a442d5b..244558b910 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
@@ -62,6 +62,7 @@ class QFontconfigDatabase : public QBasicFontDatabase
{
public:
void populateFontDatabase() Q_DECL_OVERRIDE;
+ void invalidate() Q_DECL_OVERRIDE;
QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) Q_DECL_OVERRIDE;
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE;
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE;
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp
index ad5908dcc7..7574f9f9e6 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp
@@ -50,7 +50,7 @@ QFontEngineMultiFontConfig::QFontEngineMultiFontConfig(QFontEngine *fe, int scri
QFontEngineMultiFontConfig::~QFontEngineMultiFontConfig()
{
- Q_FOREACH (FcPattern *pattern, cachedMatchPatterns) {
+ for (FcPattern *pattern : qAsConst(cachedMatchPatterns)) {
if (pattern)
FcPatternDestroy(pattern);
}
diff --git a/src/platformsupport/fontdatabases/fontdatabases.pri b/src/platformsupport/fontdatabases/fontdatabases.pri
index 12b06d64cc..f8e51f2a6d 100644
--- a/src/platformsupport/fontdatabases/fontdatabases.pri
+++ b/src/platformsupport/fontdatabases/fontdatabases.pri
@@ -1,16 +1,15 @@
-!win32|contains(QT_CONFIG, freetype):!mac {
- include($$PWD/basic/basic.pri)
-}
-
-unix:!mac {
- CONFIG += qpa/genericunixfontdatabase
- include($$PWD/genericunix/genericunix.pri)
- contains(QT_CONFIG,fontconfig) {
- include($$PWD/fontconfig/fontconfig.pri)
+darwin:!if(watchos:CONFIG(simulator, simulator|device)) {
+ include($$PWD/mac/coretext.pri)
+} else {
+ !win32|qtConfig(freetype) {
+ include($$PWD/basic/basic.pri)
}
-}
-mac {
- include($$PWD/mac/coretext.pri)
+ unix {
+ CONFIG += qpa/genericunixfontdatabase
+ include($$PWD/genericunix/genericunix.pri)
+ contains(QT_CONFIG,fontconfig) {
+ include($$PWD/fontconfig/fontconfig.pri)
+ }
+ }
}
-
diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri
index ebb64d15b4..4d19a59226 100644
--- a/src/platformsupport/fontdatabases/mac/coretext.pri
+++ b/src/platformsupport/fontdatabases/mac/coretext.pri
@@ -1,15 +1,14 @@
HEADERS += $$PWD/qcoretextfontdatabase_p.h $$PWD/qfontengine_coretext_p.h
OBJECTIVE_SOURCES += $$PWD/qfontengine_coretext.mm $$PWD/qcoretextfontdatabase.mm
-contains(QT_CONFIG, freetype) {
+qtConfig(freetype) {
include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
HEADERS += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h
SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp
- CONFIG += opentype
}
-ios: \
- # On iOS CoreText and CoreGraphics are stand-alone frameworks
+uikit: \
+ # On iOS/tvOS/watchOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \
# On Mac OS they are part of the ApplicationServices umbrella framework,
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 5be7e3aadc..16d65caf86 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
@@ -183,7 +183,7 @@ QCoreTextFontDatabase::QCoreTextFontDatabase(bool useFreeType)
QCoreTextFontDatabase::~QCoreTextFontDatabase()
{
- foreach (CTFontDescriptorRef ref, m_systemFontDescriptors)
+ for (CTFontDescriptorRef ref : qAsConst(m_systemFontDescriptors))
CFRelease(ref);
}
@@ -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
}
@@ -523,46 +523,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,
@@ -625,7 +616,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);
@@ -643,7 +633,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();
}
@@ -658,104 +648,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);
@@ -852,41 +779,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, Q_OS_WATCHOS
// OSX default case and iOS fallback case
CTFontUIFontType fontType = fontTypeFromTheme(f);
@@ -952,32 +877,16 @@ void QCoreTextFontDatabase::removeApplicationFonts()
if (m_applicationFonts.isEmpty())
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);
- }
+ for (const QVariant &font : qAsConst(m_applicationFonts)) {
+ 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 d11676ced7..0bc0416eec 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -51,7 +51,7 @@
#import <AppKit/AppKit.h>
#endif
-#if defined(Q_OS_IOS) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2)
+#if defined(QT_PLATFORM_UIKIT) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2)
#import <UIKit/UIKit.h>
#endif
@@ -78,7 +78,7 @@
#define kCTFontWeightBold NSFontWeightBold
#define kCTFontWeightHeavy NSFontWeightHeavy
#define kCTFontWeightBlack NSFontWeightBlack
-#elif defined(Q_OS_IOS)
+#elif defined(QT_PLATFORM_UIKIT)
#define kCTFontWeightUltraLight UIFontWeightUltraLight
#define kCTFontWeightThin UIFontWeightThin
#define kCTFontWeightLight UIFontWeightLight
@@ -172,7 +172,7 @@ QFontEngine::GlyphFormat QCoreTextFontEngine::defaultGlyphFormat = QFontEngine::
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef)
{
CGAffineTransform transform = CGAffineTransformIdentity;
- if (fontDef.stretch != 100)
+ if (fontDef.stretch && fontDef.stretch != 100)
transform = CGAffineTransformMakeScale(float(fontDef.stretch) / float(100), 1);
return transform;
}
@@ -256,6 +256,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*
@@ -375,6 +378,19 @@ QFixed QCoreTextFontEngine::ascent() const
? QFixed::fromReal(CTFontGetAscent(ctfont)).round()
: QFixed::fromReal(CTFontGetAscent(ctfont));
}
+
+QFixed QCoreTextFontEngine::capHeight() const
+{
+ QFixed c = QFixed::fromReal(CTFontGetCapHeight(ctfont));
+ if (c <= 0)
+ return calculatedCapHeight();
+
+ if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
+ c = c.round();
+
+ return c;
+}
+
QFixed QCoreTextFontEngine::descent() const
{
QFixed d = QFixed::fromReal(CTFontGetDescent(ctfont));
@@ -437,31 +453,25 @@ void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextIt
CGContextSetTextDrawingMode(ctx, kCGTextFill);
-
- QVarLengthArray<CGSize> advances(glyphs.size());
+ QVarLengthArray<CGPoint> cgPositions(glyphs.size());
QVarLengthArray<CGGlyph> cgGlyphs(glyphs.size());
-
- for (int i = 0; i < glyphs.size() - 1; ++i) {
- advances[i].width = (positions[i + 1].x - positions[i].x).toReal();
- advances[i].height = (positions[i + 1].y - positions[i].y).toReal();
+ const qreal firstX = positions[0].x.toReal();
+ const qreal firstY = positions[0].y.toReal();
+ for (int i = 0; i < glyphs.size(); ++i) {
+ cgPositions[i].x = positions[i].x.toReal() - firstX;
+ cgPositions[i].y = positions[i].y.toReal() - firstY;
cgGlyphs[i] = glyphs[i];
}
- advances[glyphs.size() - 1].width = 0;
- advances[glyphs.size() - 1].height = 0;
- cgGlyphs[glyphs.size() - 1] = glyphs[glyphs.size() - 1];
- CGContextSetFont(ctx, cgFont);
//NSLog(@"Font inDraw %@ ctfont %@", CGFontCopyFullName(cgFont), CTFontCopyFamilyName(ctfont));
CGContextSetTextPosition(ctx, positions[0].x.toReal(), positions[0].y.toReal());
-
- CGContextShowGlyphsWithAdvances(ctx, cgGlyphs.data(), advances.data(), glyphs.size());
+ CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx);
if (synthesisFlags & QFontEngine::SynthesizedBold) {
CGContextSetTextPosition(ctx, positions[0].x.toReal() + 0.5 * lineThickness().toReal(),
positions[0].y.toReal());
-
- CGContextShowGlyphsWithAdvances(ctx, cgGlyphs.data(), advances.data(), glyphs.size());
+ CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx);
}
CGContextSetTextMatrix(ctx, oldTextMatrix);
@@ -606,7 +616,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();
@@ -645,14 +655,13 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
CGContextSetTextMatrix(ctx, cgMatrix);
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
CGContextSetTextDrawingMode(ctx, kCGTextFill);
- CGContextSetFont(ctx, cgFont);
CGContextSetTextPosition(ctx, pos_x, pos_y);
- CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1);
+ CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
if (synthesisFlags & QFontEngine::SynthesizedBold) {
CGContextSetTextPosition(ctx, pos_x + 0.5 * lineThickness().toReal(), pos_y);
- CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1);
+ CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
}
} else {
// CGContextSetTextMatrix does not work with color glyphs, so we use
@@ -800,6 +809,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 22008162f7..d9ffbb5697 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>
@@ -78,6 +78,7 @@ public:
glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
@@ -92,6 +93,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;
@@ -126,6 +130,8 @@ private:
int synthesisFlags;
CGAffineTransform transform;
QFixed avgCharWidth;
+ QFixed underlineThickness;
+ QFixed underlinePos;
QFontEngine::FaceId face_id;
mutable bool kerningPairsLoaded;
};
diff --git a/src/platformsupport/glxconvenience/glxconvenience.pri b/src/platformsupport/glxconvenience/glxconvenience.pri
index cc5b198f6c..80e79ee663 100644
--- a/src/platformsupport/glxconvenience/glxconvenience.pri
+++ b/src/platformsupport/glxconvenience/glxconvenience.pri
@@ -1,6 +1,6 @@
-contains(QT_CONFIG, xlib) {
- contains(QT_CONFIG,opengl):!contains(QT_CONFIG,opengles2) {
- contains(QT_CONFIG, xrender): LIBS_PRIVATE += -lXrender
+qtConfig(xlib) {
+ qtConfig(opengl):!qtConfig(opengles2) {
+ qtConfig(xrender): QMAKE_USE_PRIVATE += xrender
LIBS_PRIVATE += $$QMAKE_LIBS_X11
HEADERS += $$PWD/qglxconvenience_p.h
SOURCES += $$PWD/qglxconvenience.cpp
diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp
index 3b1a87b8cd..ef26edc494 100644
--- a/src/platformsupport/graphics/qrasterbackingstore.cpp
+++ b/src/platformsupport/graphics/qrasterbackingstore.cpp
@@ -39,6 +39,7 @@
#include "qrasterbackingstore_p.h"
+#include <QtGui/qbackingstore.h>
#include <QtGui/qpainter.h>
QT_BEGIN_NAMESPACE
@@ -62,13 +63,20 @@ void QRasterBackingStore::resize(const QSize &size, const QRegion &staticContent
if (m_image.size() == effectiveBufferSize)
return;
- QImage::Format format = window()->format().hasAlpha() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
- m_image = QImage(effectiveBufferSize, format);
+ m_image = QImage(effectiveBufferSize, format());
m_image.setDevicePixelRatio(windowDevicePixelRatio);
- if (format == QImage::Format_ARGB32_Premultiplied)
+ if (m_image.format() == QImage::Format_ARGB32_Premultiplied)
m_image.fill(Qt::transparent);
}
+QImage::Format QRasterBackingStore::format() const
+{
+ if (window()->format().hasAlpha())
+ return QImage::Format_ARGB32_Premultiplied;
+ else
+ return QImage::Format_RGB32;
+}
+
QPaintDevice *QRasterBackingStore::paintDevice()
{
return &m_image;
@@ -89,7 +97,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;
@@ -97,13 +105,17 @@ bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy)
void QRasterBackingStore::beginPaint(const QRegion &region)
{
+ // Keep backing store device pixel ratio in sync with window
+ if (m_image.devicePixelRatio() != window()->devicePixelRatio())
+ resize(backingStore()->size(), backingStore()->staticContents());
+
if (!m_image.hasAlphaChannel())
return;
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/graphics/qrasterbackingstore_p.h b/src/platformsupport/graphics/qrasterbackingstore_p.h
index de96c99b5a..55976d2ceb 100644
--- a/src/platformsupport/graphics/qrasterbackingstore_p.h
+++ b/src/platformsupport/graphics/qrasterbackingstore_p.h
@@ -62,13 +62,16 @@ public:
QRasterBackingStore(QWindow *window);
~QRasterBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
- QImage toImage() const Q_DECL_OVERRIDE;
- void resize (const QSize &size, const QRegion &) Q_DECL_OVERRIDE;
+ void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE;
void beginPaint(const QRegion &region) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
+ QImage toImage() const Q_DECL_OVERRIDE;
+
protected:
+ virtual QImage::Format format() const;
+
QImage m_image;
};
diff --git a/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri b/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
index c058498ba0..445f230fa5 100644
--- a/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
+++ b/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
@@ -7,6 +7,5 @@ SOURCES += \
$$PWD/qevdevkeyboardhandler.cpp \
$$PWD/qevdevkeyboardmanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
index ffe9f82325..94ebae8f42 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp
@@ -84,10 +84,9 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Keyboard, this);
if (m_deviceDiscovery) {
// scan and add already connected keyboards
- QStringList devices = m_deviceDiscovery->scanConnectedDevices();
- foreach (const QString &device, devices) {
+ const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
+ for (const QString &device : devices)
addKeyboard(device);
- }
connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addKeyboard(QString)));
connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeKeyboard(QString)));
diff --git a/src/platformsupport/input/evdevmouse/evdevmouse.pri b/src/platformsupport/input/evdevmouse/evdevmouse.pri
index 7e7a9e1629..a8c9c663f3 100644
--- a/src/platformsupport/input/evdevmouse/evdevmouse.pri
+++ b/src/platformsupport/input/evdevmouse/evdevmouse.pri
@@ -6,7 +6,6 @@ SOURCES += \
$$PWD/qevdevmousehandler.cpp \
$$PWD/qevdevmousemanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index 129654c99b..2d96691b09 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -90,10 +90,9 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Mouse | QDeviceDiscovery::Device_Touchpad, this);
if (m_deviceDiscovery) {
// scan and add already connected keyboards
- QStringList devices = m_deviceDiscovery->scanConnectedDevices();
- foreach (const QString &device, devices) {
+ const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
+ for (const QString &device : devices)
addMouse(device);
- }
connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addMouse(QString)));
connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeMouse(QString)));
diff --git a/src/platformsupport/input/evdevtablet/evdevtablet.pri b/src/platformsupport/input/evdevtablet/evdevtablet.pri
index fb9489353c..ea1712ad2f 100644
--- a/src/platformsupport/input/evdevtablet/evdevtablet.pri
+++ b/src/platformsupport/input/evdevtablet/evdevtablet.pri
@@ -6,6 +6,5 @@ SOURCES += \
$$PWD/qevdevtablethandler.cpp \
$$PWD/qevdevtabletmanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
index 00a8c7a65d..89a60df98d 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp
@@ -85,8 +85,8 @@ QEvdevTabletManager::QEvdevTabletManager(const QString &key, const QString &spec
qCDebug(qLcEvdevTablet) << "evdevtablet: Using device discovery";
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Tablet, this);
if (m_deviceDiscovery) {
- QStringList devices = m_deviceDiscovery->scanConnectedDevices();
- foreach (const QString &device, devices)
+ const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
+ for (const QString &device : devices)
addDevice(device);
connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString)));
connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeDevice(QString)));
diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri
index c2edc13143..58fafcd8f9 100644
--- a/src/platformsupport/input/evdevtouch/evdevtouch.pri
+++ b/src/platformsupport/input/evdevtouch/evdevtouch.pri
@@ -6,12 +6,12 @@ SOURCES += \
$$PWD/qevdevtouchhandler.cpp \
$$PWD/qevdevtouchmanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+INCLUDEPATH += $$PWD/../shared
+
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
-contains(QT_CONFIG, mtdev) {
+qtConfig(mtdev) {
CONFIG += link_pkgconfig
PKGCONFIG_PRIVATE += mtdev
}
-
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 435f411f96..d53a317fc5 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qevdevtouchhandler_p.h"
+#include "qtouchoutputmapping_p.h"
#include <QStringList>
#include <QHash>
#include <QSocketNotifier>
@@ -49,7 +50,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <linux/input.h>
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
extern "C" {
#include <mtdev.h>
}
@@ -116,6 +117,7 @@ public:
int findClosestContact(const QHash<int, Contact> &contacts, int x, int y, int *dist);
void addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates);
void reportPoints();
+ void loadMultiScreenMappings();
int hw_range_x_min;
int hw_range_x_max;
@@ -124,10 +126,13 @@ public:
int hw_pressure_min;
int hw_pressure_max;
QString hw_name;
+ QString deviceNode;
bool m_forceToActiveWindow;
bool m_typeB;
QTransform m_rotate;
bool m_singleTouch;
+ QString m_screenName;
+ QPointer<QScreen> m_screen;
};
QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args)
@@ -145,7 +150,7 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co
#define LONG_BITS (sizeof(long) << 3)
#define NUM_LONGS(bits) (((bits) + LONG_BITS - 1) / LONG_BITS)
-#if defined(QT_NO_MTDEV)
+#if !QT_CONFIG(mtdev)
static inline bool testBit(long bit, const long *array)
{
return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1;
@@ -154,7 +159,7 @@ static inline bool testBit(long bit, const long *array)
QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const QString &spec, QObject *parent)
: QObject(parent), m_notify(Q_NULLPTR), m_fd(-1), d(Q_NULLPTR), m_device(Q_NULLPTR)
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
, m_mtdev(Q_NULLPTR)
#endif
{
@@ -198,7 +203,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
return;
}
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
m_mtdev = static_cast<mtdev *>(calloc(1, sizeof(mtdev)));
int mtdeverr = mtdev_open(m_mtdev, m_fd);
if (mtdeverr) {
@@ -210,7 +215,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
d = new QEvdevTouchScreenData(this, args);
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
const char *mtdevStr = "(mtdev)";
d->m_typeB = true;
#else
@@ -222,7 +227,9 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
}
#endif
- qCDebug(qLcEvdevTouch, "evdevtouch: %s: Protocol type %c %s (%s)", qPrintable(device),
+ d->deviceNode = device;
+
+ qCDebug(qLcEvdevTouch, "evdevtouch: %s: Protocol type %c %s (%s)", qPrintable(d->deviceNode),
d->m_typeB ? 'B' : 'A', mtdevStr, d->m_singleTouch ? "single" : "multi");
input_absinfo absInfo;
@@ -292,12 +299,20 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
if (inverty)
d->m_rotate *= QTransform::fromTranslate(0.5, 0.5).scale(1.0, -1.0).translate(-0.5, -0.5);
+ QTouchOutputMapping mapping;
+ if (mapping.load()) {
+ d->m_screenName = mapping.screenNameForDeviceNode(d->deviceNode);
+ if (!d->m_screenName.isEmpty())
+ qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen %s",
+ qPrintable(d->deviceNode), qPrintable(d->m_screenName));
+ }
+
registerTouchDevice();
}
QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
{
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
if (m_mtdev) {
mtdev_close(m_mtdev);
free(m_mtdev);
@@ -322,7 +337,7 @@ void QEvdevTouchScreenHandler::readData()
::input_event buffer[32];
int events = 0;
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
forever {
do {
events = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event));
@@ -647,8 +662,31 @@ void QEvdevTouchScreenData::reportPoints()
return;
winRect = QHighDpi::toNativePixels(win->geometry(), win);
} else {
- QScreen *primary = QGuiApplication::primaryScreen();
- winRect = QHighDpi::toNativePixels(primary->geometry(), primary);
+ // Now it becomes tricky. Traditionally we picked the primaryScreen()
+ // and were done with it. But then, enter multiple screens, and
+ // suddenly it was all broken.
+ //
+ // For now we only support the display configuration of the KMS/DRM
+ // backends of eglfs. See QTouchOutputMapping.
+ //
+ // The good news it that once winRect refers to the correct screen
+ // geometry in the full virtual desktop space, there is nothing else
+ // left to do since qguiapp will handle the rest.
+ QScreen *screen = QGuiApplication::primaryScreen();
+ if (!m_screenName.isEmpty()) {
+ if (!m_screen) {
+ const QList<QScreen *> screens = QGuiApplication::screens();
+ for (QScreen *s : screens) {
+ if (s->name() == m_screenName) {
+ m_screen = s;
+ break;
+ }
+ }
+ }
+ if (m_screen)
+ screen = m_screen;
+ }
+ winRect = QHighDpi::toNativePixels(screen->geometry(), screen);
}
const int hw_w = hw_range_x_max - hw_range_x_min;
@@ -679,10 +717,12 @@ void QEvdevTouchScreenData::reportPoints()
tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min);
}
+ // Let qguiapp pick the target window.
QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, q->touchDevice(), m_touchPoints);
}
+
QEvdevTouchScreenHandlerThread::QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent)
: QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(Q_NULLPTR), m_touchDeviceRegistered(false)
{
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
index a423bbd2ef..6554d4998c 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QObject>
#include <QString>
#include <QList>
@@ -58,7 +59,7 @@
#include <QtCore/private/qthread_p.h>
#include <qpa/qwindowsysteminterface.h>
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
struct mtdev;
#endif
@@ -88,7 +89,7 @@ private:
int m_fd;
QEvdevTouchScreenData *d;
QTouchDevice *m_device;
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
mtdev *m_mtdev;
#endif
};
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
index 2de0816ef5..d0c6c10224 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
@@ -85,8 +85,8 @@ QEvdevTouchManager::QEvdevTouchManager(const QString &key, const QString &specif
qCDebug(qLcEvdevTouch) << "evdevtouch: Using device discovery";
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Touchpad | QDeviceDiscovery::Device_Touchscreen, this);
if (m_deviceDiscovery) {
- QStringList devices = m_deviceDiscovery->scanConnectedDevices();
- foreach (const QString &device, devices)
+ const QStringList devices = m_deviceDiscovery->scanConnectedDevices();
+ for (const QString &device : devices)
addDevice(device);
connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addDevice(QString)));
connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeDevice(QString)));
diff --git a/src/platformsupport/input/input.pri b/src/platformsupport/input/input.pri
index 3b9593eb31..eb4d8a983d 100644
--- a/src/platformsupport/input/input.pri
+++ b/src/platformsupport/input/input.pri
@@ -1,14 +1,18 @@
-contains(QT_CONFIG, evdev) {
+qtConfig(evdev) {
include($$PWD/evdevmouse/evdevmouse.pri)
include($$PWD/evdevkeyboard/evdevkeyboard.pri)
include($$PWD/evdevtouch/evdevtouch.pri)
include($$PWD/evdevtablet/evdevtablet.pri)
}
-contains(QT_CONFIG, tslib) {
+qtConfig(tslib) {
include($$PWD/tslib/tslib.pri)
}
-contains(QT_CONFIG, libinput) {
+qtConfig(libinput) {
include($$PWD/libinput/libinput.pri)
}
+
+qtConfig(evdev)|qtConfig(libinput) {
+ include($$PWD/shared/shared.pri)
+}
diff --git a/src/platformsupport/input/libinput/libinput.pri b/src/platformsupport/input/libinput/libinput.pri
index 35d962ff3c..f922769a37 100644
--- a/src/platformsupport/input/libinput/libinput.pri
+++ b/src/platformsupport/input/libinput/libinput.pri
@@ -10,14 +10,11 @@ SOURCES += \
$$PWD/qlibinputkeyboard.cpp \
$$PWD/qlibinputtouch.cpp
-INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV $$QMAKE_INCDIR_LIBINPUT
-LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV $$QMAKE_LIBS_LIBINPUT
+QMAKE_USE_PRIVATE += libudev libinput
-contains(QT_CONFIG, xkbcommon-evdev) {
- INCLUDEPATH += $$QMAKE_INCDIR_XKBCOMMON_EVDEV
- LIBS_PRIVATE += $$QMAKE_LIBS_XKBCOMMON_EVDEV
-} else {
- DEFINES += QT_NO_XKBCOMMON_EVDEV
-}
+INCLUDEPATH += $$PWD/../shared
-DEFINES += QT_LIBINPUT_VERSION_MAJOR=$$QMAKE_LIBINPUT_VERSION_MAJOR QT_LIBINPUT_VERSION_MINOR=$$QMAKE_LIBINPUT_VERSION_MINOR
+qtConfig(xkbcommon-evdev): \
+ QMAKE_USE_PRIVATE += xkbcommon_evdev
+else: \
+ DEFINES += QT_NO_XKBCOMMON_EVDEV
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index d5a3a8b437..3b583ec99d 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -96,7 +96,7 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
void QLibInputPointer::processAxis(libinput_event_pointer *e)
{
-#if QT_LIBINPUT_VERSION_MAJOR == 0 && QT_LIBINPUT_VERSION_MINOR <= 7
+#if QT_LIBRARY_VERSION(libinput) < QT_VERSION_CHECK(0, 8, 0)
const double v = libinput_event_pointer_get_axis_value(e) * 120;
const Qt::Orientation ori = libinput_event_pointer_get_axis(e) == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL
? Qt::Vertical : Qt::Horizontal;
diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp
index 0a0e9daccb..42925a18e1 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch.cpp
+++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp
@@ -41,6 +41,7 @@
#include <libinput.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
+#include <QtGui/private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE
@@ -63,10 +64,14 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e
static inline QPointF getPos(libinput_event_touch *e)
{
- const QSize screenSize = QGuiApplication::primaryScreen()->geometry().size();
- const double x = libinput_event_touch_get_x_transformed(e, screenSize.width());
- const double y = libinput_event_touch_get_y_transformed(e, screenSize.height());
- return QPointF(x, y);
+ // TODO Map to correct screen using QTouchOutputMapping.
+ // Perhaps investigate libinput_device_get_output_name as well.
+ // For now just use the primary screen.
+ QScreen *screen = QGuiApplication::primaryScreen();
+ const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen);
+ const double x = libinput_event_touch_get_x_transformed(e, geom.width());
+ const double y = libinput_event_touch_get_y_transformed(e, geom.height());
+ return geom.topLeft() + QPointF(x, y);
}
void QLibInputTouch::registerDevice(libinput_device *dev)
diff --git a/src/platformsupport/input/shared/qtouchoutputmapping.cpp b/src/platformsupport/input/shared/qtouchoutputmapping.cpp
new file mode 100644
index 0000000000..0a1afd4739
--- /dev/null
+++ b/src/platformsupport/input/shared/qtouchoutputmapping.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtouchoutputmapping_p.h"
+#include <QFile>
+#include <QVariantMap>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonArray>
+
+QT_BEGIN_NAMESPACE
+
+bool QTouchOutputMapping::load()
+{
+ static QByteArray configFile = qgetenv("QT_QPA_EGLFS_KMS_CONFIG");
+ if (configFile.isEmpty())
+ return false;
+
+ QFile file(QString::fromUtf8(configFile));
+ if (!file.open(QFile::ReadOnly)) {
+ qWarning("touch input support: Failed to open %s", configFile.constData());
+ return false;
+ }
+
+ const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
+ if (!doc.isObject()) {
+ qWarning("touch input support: Failed to parse %s", configFile.constData());
+ return false;
+ }
+
+ // What we are interested is the virtualIndex and touchDevice properties for
+ // each element in the outputs array.
+ const QJsonArray outputs = doc.object().value(QLatin1String("outputs")).toArray();
+ for (int i = 0; i < outputs.size(); ++i) {
+ const QVariantMap output = outputs.at(i).toObject().toVariantMap();
+ if (!output.contains(QStringLiteral("touchDevice")))
+ continue;
+ if (!output.contains(QStringLiteral("name"))) {
+ qWarning("evdevtouch: Output %d specifies touchDevice but not name, this is wrong", i);
+ continue;
+ }
+ const QString &deviceNode = output.value(QStringLiteral("touchDevice")).toString();
+ const QString &screenName = output.value(QStringLiteral("name")).toString();
+ m_screenTable.insert(deviceNode, screenName);
+ }
+
+ return true;
+}
+
+QString QTouchOutputMapping::screenNameForDeviceNode(const QString &deviceNode)
+{
+ return m_screenTable.value(deviceNode);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qnativeimage_p.h b/src/platformsupport/input/shared/qtouchoutputmapping_p.h
index 2398a6e2ce..94d4dbc3b1 100644
--- a/src/gui/image/qnativeimage_p.h
+++ b/src/platformsupport/input/shared/qtouchoutputmapping_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 QtGui module of the Qt Toolkit.
+** This file is part of the plugins module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QNATIVEIMAGE_P_H
-#define QNATIVEIMAGE_P_H
+#ifndef QTOUCHOUTPUTMAPPING_P_H
+#define QTOUCHOUTPUTMAPPING_P_H
//
// W A R N I N G
@@ -51,34 +51,21 @@
// We mean it.
//
-#include "qimage.h"
-
+#include <QString>
+#include <QHash>
QT_BEGIN_NAMESPACE
-class QWindow;
-
-class QNativeImage
+class QTouchOutputMapping
{
public:
- QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWindow *window = 0);
- ~QNativeImage();
-
- inline int width() const;
- inline int height() const;
-
- QImage image;
-
- static QImage::Format systemFormat();
-
+ bool load();
+ QString screenNameForDeviceNode(const QString &deviceNode);
private:
- Q_DISABLE_COPY(QNativeImage)
+ QHash<QString, QString> m_screenTable;
};
-inline int QNativeImage::width() const { return image.width(); }
-inline int QNativeImage::height() const { return image.height(); }
-
QT_END_NAMESPACE
-#endif // QNATIVEIMAGE_P_H
+#endif // QTOUCHOUTPUTMAPPING_P_H
diff --git a/src/platformsupport/input/shared/shared.pri b/src/platformsupport/input/shared/shared.pri
new file mode 100644
index 0000000000..1443235244
--- /dev/null
+++ b/src/platformsupport/input/shared/shared.pri
@@ -0,0 +1,5 @@
+HEADERS += \
+ $$PWD/qtouchoutputmapping_p.h
+
+SOURCES += \
+ $$PWD/qtouchoutputmapping.cpp
diff --git a/src/platformsupport/input/tslib/tslib.pri b/src/platformsupport/input/tslib/tslib.pri
index c9fef1ca8f..9efd126e13 100644
--- a/src/platformsupport/input/tslib/tslib.pri
+++ b/src/platformsupport/input/tslib/tslib.pri
@@ -4,4 +4,4 @@ HEADERS += \
SOURCES += \
$$PWD/qtslib.cpp
-LIBS += -lts
+QMAKE_USE += tslib
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index 8366c56a09..f6c126a771 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -778,9 +778,8 @@ void AtSpiAdaptor::updateEventListeners()
QDBusReply<QSpiEventListenerArray> listenersReply = m_dbus->connection().call(m);
if (listenersReply.isValid()) {
const QSpiEventListenerArray evList = listenersReply.value();
- Q_FOREACH (const QSpiEventListener &ev, evList) {
+ for (const QSpiEventListener &ev : evList)
setBitFlag(ev.eventName);
- }
m_applicationAdaptor->sendEvents(!evList.isEmpty());
} else {
qAtspiDebug("Could not query active accessibility event listeners.");
@@ -1508,11 +1507,10 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface)
QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const
{
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
- QVector<RelationPair> relationInterfaces;
- relationInterfaces = interface->relations();
+ const QVector<RelationPair> relationInterfaces = interface->relations();
QSpiRelationArray relations;
- Q_FOREACH (const RelationPair &pair, relationInterfaces) {
+ for (const RelationPair &pair : relationInterfaces) {
// FIXME: this loop seems a bit strange... "related" always have one item when we check.
//And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi
QSpiObjectReferenceArray related;
@@ -1757,24 +1755,20 @@ QSpiActionArray AtSpiAdaptor::getActions(QAccessibleInterface *interface) const
QSpiActionArray actions;
const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
actions.reserve(actionNames.size());
- Q_FOREACH (const QString &actionName, actionNames) {
+ for (const QString &actionName : actionNames) {
QSpiAction action;
- QStringList keyBindings;
action.name = actionName;
if (actionInterface) {
action.description = actionInterface->localizedActionDescription(actionName);
- keyBindings = actionInterface->keyBindingsForAction(actionName);
+ const QStringList keyBindings = actionInterface->keyBindingsForAction(actionName);
+ if (!keyBindings.isEmpty())
+ action.keyBinding = keyBindings.front();
} else {
action.description = qAccessibleLocalizedActionDescription(actionName);
}
- if (keyBindings.length() > 0)
- action.keyBinding = keyBindings[0];
- else
- action.keyBinding = QString();
-
- actions << action;
+ actions.append(std::move(action));
}
return actions;
}
diff --git a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
index 1b65fb1cad..1f36b815cf 100644
--- a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
+++ b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
@@ -1,4 +1,4 @@
-contains(QT_CONFIG, accessibility-atspi-bridge) {
+qtConfig(accessibility-atspi-bridge) {
QT_FOR_PRIVATE += dbus
include(../../3rdparty/atspi2/atspi2.pri)
diff --git a/src/platformsupport/platformcompositor/platformcompositor.pri b/src/platformsupport/platformcompositor/platformcompositor.pri
index 923d7225da..1e908c9998 100644
--- a/src/platformsupport/platformcompositor/platformcompositor.pri
+++ b/src/platformsupport/platformcompositor/platformcompositor.pri
@@ -1,4 +1,4 @@
-contains(QT_CONFIG, opengl) {
+qtConfig(opengl) {
SOURCES += $$PWD/qopenglcompositor.cpp \
$$PWD/qopenglcompositorbackingstore.cpp
diff --git a/src/platformsupport/platformcompositor/qopenglcompositor.cpp b/src/platformsupport/platformcompositor/qopenglcompositor.cpp
index 610619a4e4..0f4946f81a 100644
--- a/src/platformsupport/platformcompositor/qopenglcompositor.cpp
+++ b/src/platformsupport/platformcompositor/qopenglcompositor.cpp
@@ -40,7 +40,6 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFramebufferObject>
#include <QtGui/QWindow>
-#include <QtGui/QMatrix4x4>
#include <qpa/qplatformbackingstore.h>
#include "qopenglcompositor_p.h"
@@ -78,7 +77,8 @@ static QOpenGLCompositor *compositor = 0;
QOpenGLCompositor::QOpenGLCompositor()
: m_context(0),
- m_targetWindow(0)
+ m_targetWindow(0),
+ m_rotation(0)
{
Q_ASSERT(!compositor);
m_updateTimer.setSingleShot(true);
@@ -93,10 +93,19 @@ QOpenGLCompositor::~QOpenGLCompositor()
compositor = 0;
}
-void QOpenGLCompositor::setTarget(QOpenGLContext *context, QWindow *targetWindow)
+void QOpenGLCompositor::setTarget(QOpenGLContext *context, QWindow *targetWindow,
+ const QRect &nativeTargetGeometry)
{
m_context = context;
m_targetWindow = targetWindow;
+ m_nativeTargetGeometry = nativeTargetGeometry;
+}
+
+void QOpenGLCompositor::setRotation(int degrees)
+{
+ m_rotation = degrees;
+ m_rotationMatrix.setToIdentity();
+ m_rotationMatrix.rotate(degrees, 0, 0, 1);
}
void QOpenGLCompositor::update()
@@ -109,7 +118,7 @@ QImage QOpenGLCompositor::grab()
{
Q_ASSERT(m_context && m_targetWindow);
m_context->makeCurrent(m_targetWindow);
- QScopedPointer<QOpenGLFramebufferObject> fbo(new QOpenGLFramebufferObject(m_targetWindow->geometry().size()));
+ QScopedPointer<QOpenGLFramebufferObject> fbo(new QOpenGLFramebufferObject(m_nativeTargetGeometry.size()));
renderAll(fbo.data());
return fbo->toImage();
}
@@ -127,9 +136,7 @@ void QOpenGLCompositor::renderAll(QOpenGLFramebufferObject *fbo)
fbo->bind();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
- const QRect targetWindowRect(QPoint(0, 0), m_targetWindow->geometry().size());
- glViewport(0, 0, targetWindowRect.width(), targetWindowRect.height());
+ glViewport(0, 0, m_nativeTargetGeometry.width(), m_nativeTargetGeometry.height());
if (!m_blitter.isCreated())
m_blitter.create();
@@ -181,7 +188,8 @@ static inline QRect toBottomLeftRect(const QRect &topLeftRect, int windowHeight)
topLeftRect.width(), topLeftRect.height());
}
-static void clippedBlit(const QPlatformTextureList *textures, int idx, const QRect &targetWindowRect, QOpenGLTextureBlitter *blitter)
+static void clippedBlit(const QPlatformTextureList *textures, int idx, const QRect &targetWindowRect,
+ QOpenGLTextureBlitter *blitter, QMatrix4x4 *rotationMatrix)
{
const QRect clipRect = textures->clipRect(idx);
if (clipRect.isEmpty())
@@ -191,7 +199,10 @@ static void clippedBlit(const QPlatformTextureList *textures, int idx, const QRe
const QRect clippedRectInWindow = rectInWindow & clipRect.translated(rectInWindow.topLeft());
const QRect srcRect = toBottomLeftRect(clipRect, rectInWindow.height());
- const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(clippedRectInWindow, targetWindowRect);
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(clippedRectInWindow, targetWindowRect);
+ if (rotationMatrix)
+ target = *rotationMatrix * target;
+
const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(srcRect, rectInWindow.size(),
QOpenGLTextureBlitter::OriginBottomLeft);
@@ -219,25 +230,29 @@ void QOpenGLCompositor::render(QOpenGLCompositorWindow *window)
if (textures->count() > 1 && i == textures->count() - 1) {
// Backingstore for a widget with QOpenGLWidget subwidgets
blend.set(true);
- const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect);
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect);
+ if (m_rotation)
+ target = m_rotationMatrix * target;
m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
} else if (textures->count() == 1) {
// A regular QWidget window
const bool translucent = window->sourceWindow()->requestedFormat().alphaBufferSize() > 0;
blend.set(translucent);
- const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect);
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect);
+ if (m_rotation)
+ target = m_rotationMatrix * target;
m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
} else if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
// Texture from an FBO belonging to a QOpenGLWidget
blend.set(false);
- clippedBlit(textures, i, targetWindowRect, &m_blitter);
+ clippedBlit(textures, i, targetWindowRect, &m_blitter, m_rotation ? &m_rotationMatrix : nullptr);
}
}
for (int i = 0; i < textures->count(); ++i) {
if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
blend.set(true);
- clippedBlit(textures, i, targetWindowRect, &m_blitter);
+ clippedBlit(textures, i, targetWindowRect, &m_blitter, m_rotation ? &m_rotationMatrix : nullptr);
}
}
diff --git a/src/platformsupport/platformcompositor/qopenglcompositor_p.h b/src/platformsupport/platformcompositor/qopenglcompositor_p.h
index 2c34fba409..dece41f676 100644
--- a/src/platformsupport/platformcompositor/qopenglcompositor_p.h
+++ b/src/platformsupport/platformcompositor/qopenglcompositor_p.h
@@ -52,7 +52,8 @@
//
#include <QtCore/QTimer>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/QOpenGLTextureBlitter>
+#include <QtGui/QMatrix4x4>
QT_BEGIN_NAMESPACE
@@ -78,7 +79,8 @@ public:
static QOpenGLCompositor *instance();
static void destroy();
- void setTarget(QOpenGLContext *context, QWindow *window);
+ void setTarget(QOpenGLContext *context, QWindow *window, const QRect &nativeTargetGeometry);
+ void setRotation(int degrees);
QOpenGLContext *context() const { return m_context; }
QWindow *targetWindow() const { return m_targetWindow; }
@@ -106,6 +108,9 @@ private:
QOpenGLContext *m_context;
QWindow *m_targetWindow;
+ QRect m_nativeTargetGeometry;
+ int m_rotation;
+ QMatrix4x4 m_rotationMatrix;
QTimer m_updateTimer;
QOpenGLTextureBlitter m_blitter;
QList<QOpenGLCompositorWindow *> m_windows;
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..19efa60f48 100644
--- a/src/platformsupport/platformsupport.pro
+++ b/src/platformsupport/platformsupport.pro
@@ -22,13 +22,13 @@ include(linuxaccessibility/linuxaccessibility.pri)
include(clipboard/clipboard.pri)
include(platformcompositor/platformcompositor.pri)
-# dbus convenience, but not for darwin: the platform
+# dbus convenience for unix except darwin: the platform
# plugins for these platforms do not use dbus and we
# don't want to create a false dependency.
-!darwin: contains(QT_CONFIG, dbus) {
+unix:!darwin:qtConfig(dbus) {
include(dbusmenu/dbusmenu.pri)
include(dbustray/dbustray.pri)
}
-ios: include(graphics/graphics.pri)
+darwin: include(graphics/graphics.pri)
load(qt_module)
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 9abcd04063..296c282a47 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -50,6 +50,7 @@
#include <QtCore/QFile>
#include <QtCore/QDebug>
#include <QtCore/QHash>
+#include <QtCore/QMimeDatabase>
#include <QtCore/QLoggingCategory>
#include <QtCore/QSettings>
#include <QtCore/QVariant>
@@ -231,6 +232,28 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const
return QPlatformTheme::themeHint(hint);
}
+// Helper functions for implementing QPlatformTheme::fileIcon() for XDG icon themes.
+static QList<QSize> availableXdgFileIconSizes()
+{
+ return QIcon::fromTheme(QStringLiteral("inode-directory")).availableSizes();
+}
+
+static QIcon xdgFileIcon(const QFileInfo &fileInfo)
+{
+ QMimeDatabase mimeDatabase;
+ QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileInfo);
+ if (!mimeType.isValid())
+ return QIcon();
+ const QString &iconName = mimeType.iconName();
+ if (!iconName.isEmpty()) {
+ const QIcon icon = QIcon::fromTheme(iconName);
+ if (!icon.isNull())
+ return icon;
+ }
+ const QString &genericIconName = mimeType.genericIconName();
+ return genericIconName.isEmpty() ? QIcon() : QIcon::fromTheme(genericIconName);
+}
+
#ifndef QT_NO_SETTINGS
class QKdeThemePrivate : public QPlatformThemePrivate
{
@@ -345,7 +368,7 @@ void QKdeThemePrivate::refresh()
QVariant QKdeThemePrivate::readKdeSetting(const QString &key, const QStringList &kdeDirs, int kdeVersion, QHash<QString, QSettings*> &kdeSettings)
{
- foreach (const QString &kdeDir, kdeDirs) {
+ for (const QString &kdeDir : kdeDirs) {
QSettings *settings = kdeSettings.value(kdeDir);
if (!settings) {
const QString kdeGlobalsPath = kdeGlobals(kdeDir, kdeVersion);
@@ -478,7 +501,7 @@ QStringList QKdeThemePrivate::kdeIconThemeSearchPaths(const QStringList &kdeDirs
{
QStringList paths = QGenericUnixTheme::xdgIconThemePaths();
const QString iconPath = QStringLiteral("/share/icons");
- foreach (const QString &candidate, kdeDirs) {
+ for (const QString &candidate : kdeDirs) {
const QFileInfo fi(candidate + iconPath);
if (fi.isDir())
paths.append(fi.absoluteFilePath());
@@ -506,6 +529,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(d->iconFallbackThemeName);
case QPlatformTheme::IconThemeSearchPaths:
return QVariant(d->kdeIconThemeSearchPaths(d->kdeDirs));
+ case QPlatformTheme::IconPixmapSizes:
+ return QVariant::fromValue(availableXdgFileIconSizes());
case QPlatformTheme::StyleNames:
return QVariant(d->styleNames);
case QPlatformTheme::KeyboardScheme:
@@ -520,6 +545,11 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QPlatformTheme::themeHint(hint);
}
+QIcon QKdeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions) const
+{
+ return xdgFileIcon(fileInfo);
+}
+
const QPalette *QKdeTheme::palette(Palette type) const
{
Q_D(const QKdeTheme);
@@ -657,6 +687,8 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(QStringLiteral("gnome"));
case QPlatformTheme::IconThemeSearchPaths:
return QVariant(QGenericUnixTheme::xdgIconThemePaths());
+ case QPlatformTheme::IconPixmapSizes:
+ return QVariant::fromValue(availableXdgFileIconSizes());
case QPlatformTheme::StyleNames: {
QStringList styleNames;
styleNames << QStringLiteral("fusion") << QStringLiteral("windows");
@@ -666,12 +698,19 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(int(GnomeKeyboardScheme));
case QPlatformTheme::PasswordMaskCharacter:
return QVariant(QChar(0x2022));
+ case QPlatformTheme::UiEffects:
+ return QVariant(int(HoverEffect));
default:
break;
}
return QPlatformTheme::themeHint(hint);
}
+QIcon QGnomeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions) const
+{
+ return xdgFileIcon(fileInfo);
+}
+
const QFont *QGnomeTheme::font(Font type) const
{
Q_D(const QGnomeTheme);
@@ -759,8 +798,8 @@ QStringList QGenericUnixTheme::themeNames()
<< "MATE"
<< "XFCE"
<< "LXDE";
- QList<QByteArray> desktopNames = desktopEnvironment.split(':');
- Q_FOREACH (const QByteArray &desktopName, desktopNames) {
+ const QList<QByteArray> desktopNames = desktopEnvironment.split(':');
+ for (const QByteArray &desktopName : desktopNames) {
if (desktopEnvironment == "KDE") {
#ifndef QT_NO_SETTINGS
result.push_back(QLatin1String(QKdeTheme::name));
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
index 952658e130..da13390662 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
@@ -107,6 +107,9 @@ public:
static QPlatformTheme *createKdeTheme();
QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions iconOptions = 0) const override;
+
const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
const QFont *font(Font type) const Q_DECL_OVERRIDE;
@@ -129,6 +132,8 @@ class QGnomeTheme : public QPlatformTheme
public:
QGnomeTheme();
QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions = 0) const override;
const QFont *font(Font type) const Q_DECL_OVERRIDE;
QString standardButtonText(int button) const Q_DECL_OVERRIDE;
diff --git a/src/platformsupport/themes/qabstractfileiconengine.cpp b/src/platformsupport/themes/qabstractfileiconengine.cpp
new file mode 100644
index 0000000000..192ed00510
--- /dev/null
+++ b/src/platformsupport/themes/qabstractfileiconengine.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qabstractfileiconengine_p.h"
+
+#include <qpixmapcache.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QAbstractFileIconEngine
+ \brief Helper base class for retrieving icons for files for usage by QFileIconProvider and related.
+
+ Reimplement availableSizes() and new virtual filePixmap() and return icons created
+ with this engine from QPlatformTheme::fileIcon().
+
+ Note: The class internally caches pixmaps for files by suffix (with the exception
+ of some files on Windows), but not for directories (since directory icons may have
+ overlay icons on Windows). You might want to cache pixmaps for directories
+ in your implementation.
+
+ \since 5.8
+ \internal
+ \sa QFileIconProvider::DontUseCustomDirectoryIcons, QPlatformTheme
+ \ingroup qpa
+*/
+QPixmap QAbstractFileIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
+ QIcon::State state)
+{
+ Q_UNUSED(mode);
+ Q_UNUSED(state);
+
+ if (!size.isValid())
+ return QPixmap();
+
+ QString key = cacheKey();
+ if (key.isEmpty())
+ return filePixmap(size, mode, state);
+
+ key += QLatin1Char('_') + QString::number(size.width());
+
+ QPixmap result;
+ if (!QPixmapCache::find(key, result)) {
+ result = filePixmap(size, mode, state);
+ if (!result.isNull())
+ QPixmapCache::insert(key, result);
+ }
+
+ return result;
+}
+
+QSize QAbstractFileIconEngine::actualSize(const QSize &size, QIcon::Mode mode,
+ QIcon::State state)
+{
+ const QList<QSize> &sizes = availableSizes(mode, state);
+ const int numberSizes = sizes.length();
+ if (numberSizes == 0)
+ return QSize();
+
+ // Find the smallest available size whose area is still larger than the input
+ // size. Otherwise, use the largest area available size. (We don't assume the
+ // platform theme sizes are sorted, hence the extra logic.)
+ const int sizeArea = size.width() * size.height();
+ QSize actualSize = sizes.first();
+ int actualArea = actualSize.width() * actualSize.height();
+ for (int i = 1; i < numberSizes; ++i) {
+ const QSize &s = sizes.at(i);
+ const int a = s.width() * s.height();
+ if ((sizeArea <= a && a < actualArea) || (actualArea < sizeArea && actualArea < a)) {
+ actualSize = s;
+ actualArea = a;
+ }
+ }
+
+ if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
+ actualSize.scale(size, Qt::KeepAspectRatio);
+
+ return actualSize;
+}
+
+/* Reimplement to return a cache key for the entry. An empty result indicates
+ * the icon should not be cached (for example, directory icons having custom icons). */
+QString QAbstractFileIconEngine::cacheKey() const
+{
+ if (!m_fileInfo.isFile() || m_fileInfo.isSymLink() || m_fileInfo.isExecutable())
+ return QString();
+
+ const QString &suffix = m_fileInfo.suffix();
+ return QLatin1String("qt_.")
+ + (suffix.isEmpty() ? m_fileInfo.fileName() : suffix); // handle "Makefile" ;)
+}
+
+QT_END_NAMESPACE
diff --git a/src/platformsupport/themes/qabstractfileiconengine_p.h b/src/platformsupport/themes/qabstractfileiconengine_p.h
new file mode 100644
index 0000000000..ce38cf262e
--- /dev/null
+++ b/src/platformsupport/themes/qabstractfileiconengine_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** 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 QABSTRACTFILEICONENGINE_P_H
+#define QABSTRACTFILEICONENGINE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qfileinfo.h>
+#include <private/qicon_p.h>
+#include <qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractFileIconEngine : public QPixmapIconEngine
+{
+public:
+ explicit QAbstractFileIconEngine(const QFileInfo &info, QPlatformTheme::IconOptions opts)
+ : QPixmapIconEngine(), m_fileInfo(info), m_options(opts) {}
+
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State) override;
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+
+ QFileInfo fileInfo() const { return m_fileInfo; }
+ QPlatformTheme::IconOptions options() const { return m_options; }
+
+ // Helper to convert a sequence of ints to a list of QSize
+ template <class It> static QList<QSize> toSizeList(It i1, It i2);
+
+protected:
+ virtual QPixmap filePixmap(const QSize &size, QIcon::Mode mode, QIcon::State) = 0;
+ virtual QString cacheKey() const;
+
+private:
+ const QFileInfo m_fileInfo;
+ const QPlatformTheme::IconOptions m_options;
+};
+
+template <class It>
+inline QList<QSize> QAbstractFileIconEngine::toSizeList(It i1, It i2)
+{
+ QList<QSize> result;
+ result.reserve(int(i2 - i1));
+ for ( ; i1 != i2; ++i1)
+ result.append(QSize(*i1, *i1));
+ return result;
+}
+
+QT_END_NAMESPACE
+
+#endif // QABSTRACTFILEICONENGINE_P_H
diff --git a/src/platformsupport/themes/themes.pri b/src/platformsupport/themes/themes.pri
index adee852626..552973431f 100644
--- a/src/platformsupport/themes/themes.pri
+++ b/src/platformsupport/themes/themes.pri
@@ -1,3 +1,9 @@
unix:!mac {
include($$PWD/genericunix/genericunix.pri)
}
+
+HEADERS += \
+ $$PWD/qabstractfileiconengine_p.h
+
+SOURCES += \
+ $$PWD/qabstractfileiconengine.cpp
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index cc590cc545..b362722b28 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += network-private
!android:linux*:qtHaveModule(dbus) {
SUBDIRS += generic
@@ -7,8 +8,8 @@ TEMPLATE = subdirs
#win32:SUBDIRS += nla
win32:SUBDIRS += generic
-win32:!wince:!winrt: SUBDIRS += nativewifi
-mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
+win32:!winrt: SUBDIRS += nativewifi
+darwin:qtConfig(corewlan): SUBDIRS += corewlan
mac:SUBDIRS += generic
android:SUBDIRS += android
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 51ee51a64a..eabae5a07b 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -93,9 +93,9 @@ void QConnmanEngine::initialize()
connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList)));
connect(connmanManager,SIGNAL(scanFinished(bool)),this,SLOT(finishedScan(bool)));
- foreach (const QString &servPath, connmanManager->getServices()) {
+ const auto servPaths = connmanManager->getServices();
+ for (const QString &servPath : servPaths)
addServiceConfiguration(servPath);
- }
Q_EMIT updateCompleted();
}
@@ -115,9 +115,8 @@ void QConnmanEngine::changedModem()
void QConnmanEngine::servicesReady(const QStringList &list)
{
QMutexLocker locker(&mutex);
- foreach (const QString &servPath, list) {
+ for (const QString &servPath : list)
addServiceConfiguration(servPath);
- }
Q_EMIT updateCompleted();
}
@@ -329,7 +328,8 @@ QNetworkSessionPrivate *QConnmanEngine::createSessionBackend()
QNetworkConfigurationPrivatePointer QConnmanEngine::defaultConfiguration()
{
const QMutexLocker locker(&mutex);
- Q_FOREACH (const QString &servPath, connmanManager->getServices()) {
+ const auto servPaths = connmanManager->getServices();
+ for (const QString &servPath : servPaths) {
if (connmanServiceInterfaces.contains(servPath)) {
if (accessPointConfigurations.contains(servPath))
return accessPointConfigurations.value(servPath);
@@ -461,7 +461,8 @@ QNetworkConfiguration::BearerType QConnmanEngine::ofonoTechToBearerType(const QS
bool QConnmanEngine::isRoamingAllowed(const QString &context)
{
- foreach (const QString &dcPath, ofonoContextManager->contexts()) {
+ const auto dcPaths = ofonoContextManager->contexts();
+ for (const QString &dcPath : dcPaths) {
if (dcPath.contains(context.section("_",-1))) {
return ofonoContextManager->roamingAllowed();
}
@@ -557,7 +558,8 @@ bool QConnmanEngine::requiresPolling() const
void QConnmanEngine::reEvaluateCellular()
{
- Q_FOREACH (const QString &servicePath, connmanManager->getServices()) {
+ const auto servicePaths = connmanManager->getServices();
+ for (const QString &servicePath : servicePaths) {
if (servicePath.contains("cellular") && accessPointConfigurations.contains(servicePath)) {
configurationChange(connmanServiceInterfaces.value(servicePath));
}
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
index 23c158ac34..c9ff17f801 100644
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 44cadc1b19..55eec57270 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -144,10 +144,9 @@ void QConnmanManagerInterface::servicesReply(QDBusPendingCallWatcher *call)
qDebug() << serv_reply.error().message();
} else {
servicesList.clear(); //connman list changes order
- ConnmanMap connmanobj;
- Q_FOREACH (connmanobj, serv_reply.value()) {
+ const ConnmanMapList connmanobjs = serv_reply.value();
+ for (const ConnmanMap &connmanobj : connmanobjs)
servicesList << connmanobj.objectPath.path();
- }
Q_EMIT servicesReady(servicesList);
}
call->deleteLater();
@@ -181,7 +180,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal)
void QConnmanManagerInterface::onServicesChanged(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed)
{
servicesList.clear(); //connman list changes order
- Q_FOREACH (const ConnmanMap &connmanobj, changed) {
+ for (const ConnmanMap &connmanobj : changed) {
const QString svcPath(connmanobj.objectPath.path());
servicesList << svcPath;
}
@@ -225,7 +224,8 @@ QStringList QConnmanManagerInterface::getTechnologies()
QDBusPendingReply<ConnmanMapList> reply = call(QLatin1String("GetTechnologies"));
reply.waitForFinished();
if (!reply.isError()) {
- Q_FOREACH (const ConnmanMap &map, reply.value()) {
+ const ConnmanMapList maps = reply.value();
+ for (const ConnmanMap &map : maps) {
if (!technologiesMap.contains(map.objectPath.path())) {
technologyAdded(map.objectPath, map.propertyMap);
}
@@ -241,9 +241,9 @@ QStringList QConnmanManagerInterface::getServices()
QDBusPendingReply<ConnmanMapList> reply = call(QLatin1String("GetServices"));
reply.waitForFinished();
if (!reply.isError()) {
- Q_FOREACH (const ConnmanMap &map, reply.value()) {
+ const ConnmanMapList maps = reply.value();
+ for (const ConnmanMap &map : maps)
servicesList << map.objectPath.path();
- }
}
}
return servicesList;
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index ab0257aecd..1dc09ebdd6 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -3,7 +3,7 @@ TARGET = qcorewlanbearer
QT = core-private network-private
LIBS += -framework Foundation -framework SystemConfiguration
-contains(QT_CONFIG, corewlan) {
+qtConfig(corewlan) {
LIBS += -framework CoreWLAN -framework Security
}
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 52e76219e6..7ce5f28f99 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -502,27 +502,27 @@ void QCoreWlanEngine::connectToId(const QString &id)
if(!err) {
for (CWNetwork *apNetwork in scanSet) {
- CFDataRef ssidData = (CFDataRef)[apNetwork ssidData];
+ NSData *ssidData = [apNetwork ssidData];
bool result = false;
SecIdentityRef identity = 0;
// Check first whether we require IEEE 802.1X authentication for the wanted SSID
- if (CWKeychainCopyEAPIdentity(ssidData, &identity) == errSecSuccess) {
- CFStringRef username = 0;
- CFStringRef password = 0;
- if (CWKeychainCopyEAPUsernameAndPassword(ssidData, &username, &password) == errSecSuccess) {
+ if (CWKeychainCopyWiFiEAPIdentity(kCWKeychainDomainSystem, ssidData, &identity) == errSecSuccess) {
+ NSString *username = nil;
+ NSString *password = nil;
+ if (CWKeychainFindWiFiEAPUsernameAndPassword(kCWKeychainDomainSystem, ssidData, &username, &password) == errSecSuccess) {
result = [wifiInterface associateToEnterpriseNetwork:apNetwork
identity:identity username:(NSString *)username password:(NSString *)password
error:&err];
- CFRelease(username);
- CFRelease(password);
+ [username release];
+ [password release];
}
CFRelease(identity);
} else {
- CFStringRef password = 0;
- if (CWKeychainCopyPassword(ssidData, &password) == errSecSuccess) {
+ NSString *password = nil;
+ if (CWKeychainFindWiFiPassword(kCWKeychainDomainSystem, ssidData, &password) == errSecSuccess) {
result = [wifiInterface associateToNetwork:apNetwork password:(NSString *)password error:&err];
- CFRelease(password);
+ [password release];
}
}
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/linux_common/qofonoservice_linux.cpp b/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
index b0f5f29f6c..adf7feef2e 100644
--- a/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
+++ b/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
@@ -103,9 +103,9 @@ QStringList QOfonoManagerInterface::getModems()
QDBusPendingReply<PathPropertiesList> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetModems"), argumentList);
reply.waitForFinished();
if (!reply.isError()) {
- foreach (const ObjectPathProperties &modem, reply.value()) {
+ const auto modems = reply.value();
+ for (const ObjectPathProperties &modem : modems)
modemList << modem.path.path();
- }
}
}
@@ -114,8 +114,8 @@ QStringList QOfonoManagerInterface::getModems()
QString QOfonoManagerInterface::currentModem()
{
- QStringList modems = getModems();
- foreach (const QString &modem, modems) {
+ const QStringList modems = getModems();
+ for (const QString &modem : modems) {
QOfonoModemInterface device(modem);
if (device.isPowered() && device.isOnline()
&& device.interfaces().contains(QStringLiteral("org.ofono.NetworkRegistration")))
@@ -266,9 +266,9 @@ QStringList QOfonoDataConnectionManagerInterface::contexts()
QDBusPendingReply<PathPropertiesList > reply = call(QLatin1String("GetContexts"));
reply.waitForFinished();
if (!reply.isError()) {
- foreach (const ObjectPathProperties &context, reply.value()) {
+ const auto contexts = reply.value();
+ for (const ObjectPathProperties &context : contexts)
contextList << context.path.path();
- }
}
}
return contextList;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 59a6d107dc..543e66491d 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -127,7 +127,8 @@ void QNetworkManagerEngine::setupConfigurations()
{
QMutexLocker locker(&mutex);
// Get active connections.
- foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
+ const auto acPaths = managerInterface->activeConnections();
+ for (const QDBusObjectPath &acPath : acPaths) {
if (activeConnectionsList.contains(acPath.path()))
continue;
@@ -144,8 +145,10 @@ void QNetworkManagerEngine::setupConfigurations()
connectionInterfaces.insert(activeConnection->connection().path(),device.networkInterface());
}
}
+
// Get connections.
- foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
+ const auto settingsPaths = systemSettings->listConnections();
+ for (const QDBusObjectPath &settingsPath : settingsPaths) {
locker.unlock();
if (!hasIdentifier(settingsPath.path()))
newConnection(settingsPath, systemSettings); //add system connection configs
@@ -189,21 +192,13 @@ void QNetworkManagerEngine::connectToId(const QString &id)
if (isConnectionActive(settingsPath))
return;
- QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
- while (i.hasNext()) {
- i.next();
- if (i.value()->deviceType() == DEVICE_TYPE_ETHERNET &&
- connectionType == DEVICE_TYPE_ETHERNET) {
- dbusDevicePath = i.key();
- break;
- } else if (i.value()->deviceType() == DEVICE_TYPE_WIFI &&
- connectionType == DEVICE_TYPE_WIFI) {
- dbusDevicePath = i.key();
- break;
- } else if (i.value()->deviceType() == DEVICE_TYPE_MODEM &&
- connectionType == DEVICE_TYPE_MODEM) {
- dbusDevicePath = i.key();
- break;
+ for (auto i = interfaceDevices.cbegin(), end = interfaceDevices.cend(); i != end; ++i) {
+ const auto type = i.value()->deviceType();
+ if (type == DEVICE_TYPE_ETHERNET || type == DEVICE_TYPE_WIFI || type == DEVICE_TYPE_MODEM) {
+ if (type == connectionType) {
+ dbusDevicePath = i.key();
+ break;
+ }
}
}
@@ -230,9 +225,7 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id)
return;
}
- QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
- while (i.hasNext()) {
- i.next();
+ for (auto i = activeConnectionsList.cbegin(), end = activeConnectionsList.cend(); i != end; ++i) {
if (id == i.value()->connection().path() && accessPointConfigurations.contains(id)) {
managerInterface->deactivateConnection(QDBusObjectPath(i.key()));
break;
@@ -243,11 +236,8 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id)
void QNetworkManagerEngine::requestUpdate()
{
if (managerInterface && managerInterface->wirelessEnabled()) {
- QHashIterator<QString, QNetworkManagerInterfaceDeviceWireless *> i(wirelessDevices);
- while (i.hasNext()) {
- i.next();
- i.value()->requestScan();
- }
+ for (auto *wirelessDevice : qAsConst(wirelessDevices))
+ wirelessDevice->requestScan();
}
QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
}
@@ -255,20 +245,17 @@ void QNetworkManagerEngine::requestUpdate()
void QNetworkManagerEngine::interfacePropertiesChanged(const QMap<QString, QVariant> &properties)
{
QMutexLocker locker(&mutex);
- QMapIterator<QString, QVariant> i(properties);
- while (i.hasNext()) {
- i.next();
+ for (auto i = properties.cbegin(), end = properties.cend(); i != end; ++i) {
if (i.key() == QLatin1String("ActiveConnections")) {
// Active connections changed, update configurations.
- QList<QDBusObjectPath> activeConnections =
- qdbus_cast<QList<QDBusObjectPath> >(i.value().value<QDBusArgument>());
+ const auto activeConnections = qdbus_cast<QList<QDBusObjectPath> >(i.value().value<QDBusArgument>());
QStringList identifiers = accessPointConfigurations.keys();
QStringList priorActiveConnections = activeConnectionsList.keys();
- foreach (const QDBusObjectPath &acPath, activeConnections) {
+ for (const QDBusObjectPath &acPath : activeConnections) {
priorActiveConnections.removeOne(acPath.path());
QNetworkManagerConnectionActive *activeConnection =
activeConnectionsList.value(acPath.path());
@@ -399,7 +386,8 @@ void QNetworkManagerEngine::wiredCarrierChanged(bool carrier)
if (!deviceWired)
return;
QMutexLocker locker(&mutex);
- foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
+ const auto settingsPaths = systemSettings->listConnections();
+ for (const QDBusObjectPath &settingsPath : settingsPaths) {
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
if (connection->getType() == DEVICE_TYPE_ETHERNET
@@ -477,12 +465,9 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
cpPriv->state |= QNetworkConfiguration::Active;
if (deviceType == DEVICE_TYPE_ETHERNET) {
- QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
- while (i.hasNext()) {
- i.next();
- if (i.value()->deviceType() == deviceType) {
- QNetworkManagerInterfaceDeviceWired *wiredDevice
- = wiredDevices.value(i.value()->path());
+ for (const auto *interfaceDevice : interfaceDevices) {
+ if (interfaceDevice->deviceType() == deviceType) {
+ auto *wiredDevice = wiredDevices.value(interfaceDevice->path());
if (wiredDevice && wiredDevice->carrier()) {
cpPriv->state |= QNetworkConfiguration::Discovered;
}
@@ -496,14 +481,13 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
emit configurationAdded(ptr);
}
-bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath)
+bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) const
{
- QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
- while (i.hasNext()) {
- i.next();
- if (i.value()->connection().path() == settingsPath) {
- if (i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATING
- || i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
+ for (QNetworkManagerConnectionActive *activeConnection : activeConnectionsList) {
+ if (activeConnection->connection().path() == settingsPath) {
+ const auto state = activeConnection->state();
+ if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING
+ || state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
return true;
} else {
break;
@@ -560,7 +544,8 @@ void QNetworkManagerEngine::updateConnection()
QNetworkConfigurationPrivate *cpPriv = parseConnection(settingsPath, connection->getSettings());
// Check if connection is active.
- foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
+ const auto acPaths = managerInterface->activeConnections();
+ for (const QDBusObjectPath &acPath : acPaths) {
QNetworkManagerConnectionActive activeConnection(acPath.path());
if (activeConnection.connection().path() == settingsPath &&
@@ -636,7 +621,8 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
if (connectionType == QLatin1String("802-3-ethernet")) {
cpPriv->bearerType = QNetworkConfiguration::BearerEthernet;
- foreach (const QDBusObjectPath &devicePath, managerInterface->getDevices()) {
+ const auto devicePaths = managerInterface->getDevices();
+ for (const QDBusObjectPath &devicePath : devicePaths) {
QNetworkManagerInterfaceDevice device(devicePath.path(),this);
if (device.deviceType() == DEVICE_TYPE_ETHERNET) {
QNetworkManagerInterfaceDeviceWired *wiredDevice = wiredDevices.value(device.path());
@@ -678,9 +664,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
if (ofonoManager && ofonoManager->isValid()) {
const QString contextPart = connectionPath.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
+ for (auto i = ofonoContextManagers.cbegin(), end = ofonoContextManagers.cend(); i != end; ++i) {
const QString path = i.key() + QLatin1Char('/') +contextPart;
if (isActiveContext(path)) {
cpPriv->state |= QNetworkConfiguration::Active;
@@ -693,14 +677,12 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
return cpPriv;
}
-bool QNetworkManagerEngine::isActiveContext(const QString &contextPath)
+bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) const
{
if (ofonoManager && ofonoManager->isValid()) {
const QString contextPart = contextPath.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
- PathPropertiesList list = i.value()->contextsWithProperties();
+ for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) {
+ const PathPropertiesList list = iface->contextsWithProperties();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).path.path().contains(contextPart)) {
return list.at(i).properties.value(QStringLiteral("Active")).toBool();
@@ -734,9 +716,7 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i
if (!ptr->isValid)
return QNetworkSession::Invalid;
- foreach (const QString &acPath, activeConnectionsList.keys()) {
- QNetworkManagerConnectionActive *activeConnection = activeConnectionsList.value(acPath);
-
+ for (QNetworkManagerConnectionActive *activeConnection : activeConnectionsList) {
const QString identifier = activeConnection->connection().path();
if (id == identifier) {
@@ -842,10 +822,7 @@ QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend()
QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration()
{
- QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
- while (i.hasNext()) {
- i.next();
- QNetworkManagerConnectionActive *activeConnection = i.value();
+ for (QNetworkManagerConnectionActive *activeConnection : qAsConst(activeConnectionsList)) {
if ((activeConnection->defaultRoute() || activeConnection->default6Route())) {
return accessPointConfigurations.value(activeConnection->connection().path());
}
@@ -854,12 +831,10 @@ QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration(
return QNetworkConfigurationPrivatePointer();
}
-QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id)
+QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) const
{
QString contextPart = id.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
+ for (auto i = ofonoContextManagers.begin(), end = ofonoContextManagers.end(); i != end; ++i) {
QString contextPath = i.key() + QLatin1Char('/') +contextPart;
if (i.value()->contexts().contains(contextPath)) {
@@ -885,13 +860,11 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const
return QNetworkConfiguration::BearerUnknown;
}
-QString QNetworkManagerEngine::contextName(const QString &path)
+QString QNetworkManagerEngine::contextName(const QString &path) const
{
QString contextPart = path.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
- PathPropertiesList list = i.value()->contextsWithProperties();
+ for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) {
+ const PathPropertiesList list = iface->contextsWithProperties();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).path.path().contains(contextPart)) {
return list.at(i).properties.value(QStringLiteral("Name")).toString();
@@ -944,7 +917,8 @@ void QNetworkManagerEngine::ofonoRegistered(const QString &)
}
ofonoManager = new QOfonoManagerInterface(this);
if (ofonoManager && ofonoManager->isValid()) {
- Q_FOREACH (const QString &modem, ofonoManager->getModems()) {
+ const auto modems = ofonoManager->getModems();
+ for (const QString &modem : modems) {
QOfonoDataConnectionManagerInterface *ofonoContextManager
= new QOfonoDataConnectionManagerInterface(modem,this);
ofonoContextManagers.insert(modem, ofonoContextManager);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index 2de570b1ba..74fe24b5ab 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -44,9 +44,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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.
//
@@ -74,26 +74,26 @@ public:
bool networkManagerAvailable() const;
- QString getInterfaceFromId(const QString &id);
- bool hasIdentifier(const QString &id);
+ QString getInterfaceFromId(const QString &id) override;
+ bool hasIdentifier(const QString &id) override;
- void connectToId(const QString &id);
- void disconnectFromId(const QString &id);
+ void connectToId(const QString &id) override;
+ void disconnectFromId(const QString &id) override;
Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
- QNetworkSession::State sessionStateForId(const QString &id);
+ QNetworkSession::State sessionStateForId(const QString &id) override;
- quint64 bytesWritten(const QString &id);
- quint64 bytesReceived(const QString &id);
- quint64 startTime(const QString &id);
+ quint64 bytesWritten(const QString &id) override;
+ quint64 bytesReceived(const QString &id) override;
+ quint64 startTime(const QString &id) override;
- QNetworkConfigurationManager::Capabilities capabilities() const;
+ QNetworkConfigurationManager::Capabilities capabilities() const override;
- QNetworkSessionPrivate *createSessionBackend();
+ QNetworkSessionPrivate *createSessionBackend() override;
- QNetworkConfigurationPrivatePointer defaultConfiguration();
+ QNetworkConfigurationPrivatePointer defaultConfiguration() override;
private Q_SLOTS:
void interfacePropertiesChanged(const QMap<QString, QVariant> &properties);
@@ -133,14 +133,14 @@ private:
QOfonoManagerInterface *ofonoManager;
QHash <QString, QOfonoDataConnectionManagerInterface *> ofonoContextManagers;
- QNetworkConfiguration::BearerType currentBearerType(const QString &id);
- QString contextName(const QString &path);
+ QNetworkConfiguration::BearerType currentBearerType(const QString &id) const;
+ QString contextName(const QString &path) const;
- bool isConnectionActive(const QString &settingsPath);
+ bool isConnectionActive(const QString &settingsPath) const;
QDBusServiceWatcher *ofonoWatcher;
QDBusServiceWatcher *nmWatcher;
- bool isActiveContext(const QString &contextPath);
+ bool isActiveContext(const QString &contextPath) const;
bool nmAvailable;
void setupConfigurations();
};
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index c8f00118bb..3e77580015 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -230,9 +230,7 @@ QString QNetworkManagerInterface::version() const
void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("State")) {
@@ -327,11 +325,8 @@ quint32 QNetworkManagerInterfaceAccessPoint::strength() const
void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i)
propertyMap.insert(i.key(),i.value());
- }
}
QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent)
@@ -419,9 +414,7 @@ QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const
void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
if (i.key() == QLatin1String("AvailableConnections")) { //Device
const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
QDBusObjectPath path;
@@ -519,9 +512,7 @@ QStringList QNetworkManagerInterfaceDeviceWired::availableConnections()
void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("Carrier"))
Q_EMIT carrierChanged(i.value().toBool());
@@ -635,9 +626,7 @@ void QNetworkManagerInterfaceDeviceWireless::requestScan()
void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("ActiveAccessPoint")) //DeviceWireless
Q_EMIT propertiesChanged(map);
@@ -700,11 +689,8 @@ QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceD
void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i)
propertyMap.insert(i.key(),i.value());
- }
Q_EMIT propertiesChanged(map);
}
@@ -1013,9 +999,7 @@ bool QNetworkManagerConnectionActive::default6Route() const
void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("State")) {
quint32 state = i.value().toUInt();
diff --git a/src/plugins/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/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index a692d3c63f..5ce51670f7 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -54,7 +54,8 @@ static QBearerEngineImpl *getEngineFromId(const QString &id)
{
QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- foreach (QBearerEngine *engine, priv->engines()) {
+ const auto engines = priv->engines();
+ for (QBearerEngine *engine : engines) {
QBearerEngineImpl *engineImpl = qobject_cast<QBearerEngineImpl *>(engine);
if (engineImpl && engineImpl->hasIdentifier(id))
return engineImpl;
@@ -111,10 +112,10 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
case QNetworkConfiguration::ServiceNetwork:
serviceConfig = publicConfig;
// Defer setting engine and signals until open().
- // fall through
+ Q_FALLTHROUGH();
case QNetworkConfiguration::UserChoice:
// Defer setting serviceConfig and activeConfig until open().
- // fall through
+ Q_FALLTHROUGH();
default:
engine = 0;
}
@@ -285,7 +286,7 @@ quint64 QNetworkSessionPrivateImpl::bytesReceived() const
quint64 QNetworkSessionPrivateImpl::activeTime() const
{
if (state == QNetworkSession::Connected && startTime != Q_UINT64_C(0))
- return QDateTime::currentDateTimeUtc().toTime_t() - startTime;
+ return QDateTime::currentSecsSinceEpoch() - startTime;
return Q_UINT64_C(0);
}
@@ -306,7 +307,8 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork()
{
QNetworkSession::State oldState = state;
- foreach (const QNetworkConfiguration &config, serviceConfig.children()) {
+ const auto configs = serviceConfig.children();
+ for (const QNetworkConfiguration &config : configs) {
if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active)
continue;
diff --git a/src/plugins/generic/bsdkeyboard/bsdkeyboard.json b/src/plugins/generic/bsdkeyboard/bsdkeyboard.json
new file mode 100644
index 0000000000..46a8127c46
--- /dev/null
+++ b/src/plugins/generic/bsdkeyboard/bsdkeyboard.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "BsdKeyboard" ]
+}
diff --git a/src/plugins/generic/bsdkeyboard/bsdkeyboard.pro b/src/plugins/generic/bsdkeyboard/bsdkeyboard.pro
new file mode 100644
index 0000000000..c14c38c839
--- /dev/null
+++ b/src/plugins/generic/bsdkeyboard/bsdkeyboard.pro
@@ -0,0 +1,16 @@
+TARGET = qbsdkeyboardplugin
+
+PLUGIN_TYPE = generic
+PLUGIN_EXTENDS = -
+PLUGIN_CLASS_NAME = QBsdKeyboardPlugin
+load(qt_plugin)
+
+QT += core gui-private
+
+HEADERS = qbsdkeyboard.h
+SOURCES = main.cpp \
+ qbsdkeyboard.cpp
+
+OTHER_FILES += \
+ qbsdkeyboard.json
+
diff --git a/src/plugins/generic/bsdkeyboard/main.cpp b/src/plugins/generic/bsdkeyboard/main.cpp
new file mode 100644
index 0000000000..f48af0ae28
--- /dev/null
+++ b/src/plugins/generic/bsdkeyboard/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qgenericplugin.h>
+#include "qbsdkeyboard.h"
+
+QT_BEGIN_NAMESPACE
+
+class QBsdKeyboardPlugin : public QGenericPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "bsdkeyboard.json")
+
+public:
+ QObject *create(const QString &key, const QString &specification) override;
+};
+
+QObject *QBsdKeyboardPlugin::create(const QString &key,
+ const QString &specification)
+{
+ if (!key.compare(QLatin1String("BsdKeyboard"), Qt::CaseInsensitive))
+ return new QBsdKeyboardHandler(key, specification);
+
+ return nullptr;
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp
new file mode 100644
index 0000000000..6f34d066c6
--- /dev/null
+++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.cpp
@@ -0,0 +1,408 @@
+/****************************************************************************
+**
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbsdkeyboard.h"
+
+#include <QByteArray>
+#include <QFile>
+#include <QGuiApplication>
+#include <QPoint>
+#include <QSocketNotifier>
+#include <QString>
+#include <QStringList>
+
+#include <QtCore/qglobal.h>
+#include <qpa/qwindowsysteminterface.h>
+#include <private/qcore_unix_p.h>
+#include <private/qguiapplication_p.h>
+#include <private/qinputdevicemanager_p_p.h>
+
+#include <qdebug.h>
+#include <cstdio>
+
+#include <cerrno>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <termios.h>
+#include <sys/kbio.h>
+
+// #define QT_BSD_KEYBOARD_DEBUG
+
+#ifdef QT_BSD_KEYBOARD_DEBUG
+#include <qdebug.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+enum {
+ Bsd_KeyCodeMask = 0x7f,
+ Bsd_KeyPressedMask = 0x80
+};
+
+#include "qbsdkeyboard_defaultmap.h"
+
+QBsdKeyboardHandler::QBsdKeyboardHandler(const QString &key, const QString &specification)
+{
+ Q_UNUSED(key);
+
+ setObjectName(QLatin1String("BSD Keyboard Handler"));
+
+ QByteArray device;
+ if (specification.startsWith("/dev/"))
+ device = QFile::encodeName(specification);
+
+ if (device.isEmpty()) {
+ device = QByteArrayLiteral("STDIN");
+ m_fd = fileno(stdin);
+ }
+ else {
+ m_fd = QT_OPEN(device.constData(), O_RDONLY);
+ if (!m_fd) {
+ qErrnoWarning(errno, "open(%s) failed", device.constData());
+ return;
+ }
+ m_shouldClose = true;
+ }
+
+ if (ioctl(m_fd, KDGKBMODE, &m_origKbdMode)) {
+ qErrnoWarning(errno, "ioctl(%s, KDGKBMODE) failed", device.constData());
+ revertTTYSettings();
+ return;
+ }
+
+ if (ioctl(m_fd, KDSKBMODE, K_CODE) < 0) {
+ qErrnoWarning(errno, "ioctl(%s, KDSKBMODE) failed", device.constData());
+ revertTTYSettings();
+ return;
+ }
+
+ termios kbdtty;
+ if (tcgetattr(m_fd, &kbdtty) == 0) {
+
+ m_kbdOrigTty.reset(new termios);
+ *m_kbdOrigTty = kbdtty;
+
+ kbdtty.c_iflag = IGNPAR | IGNBRK;
+ kbdtty.c_oflag = 0;
+ kbdtty.c_cflag = CREAD | CS8;
+ kbdtty.c_lflag = 0;
+ kbdtty.c_cc[VTIME] = 0;
+ kbdtty.c_cc[VMIN] = 0;
+ cfsetispeed(&kbdtty, 9600);
+ cfsetospeed(&kbdtty, 9600);
+ if (tcsetattr(m_fd, TCSANOW, &kbdtty) < 0) {
+ qErrnoWarning(errno, "tcsetattr(%s) failed", device.constData());
+
+ // TTY is still at old settings so we can
+ // dispose of original termios data
+ m_kbdOrigTty.reset();
+
+ revertTTYSettings();
+ return;
+ }
+ } else {
+ qErrnoWarning(errno, "tcgetattr(%s) failed", device.constData());
+ revertTTYSettings();
+ return;
+ }
+
+ if (fcntl(m_fd, F_SETFL, O_NONBLOCK)) {
+ qErrnoWarning(errno, "fcntl(%s, F_SETFL, O_NONBLOCK) failed", device.constData());
+ revertTTYSettings();
+ return;
+ }
+
+ resetKeymap();
+
+ m_notifier.reset(new QSocketNotifier(m_fd, QSocketNotifier::Read, this));
+ connect(m_notifier.data(), &QSocketNotifier::activated, this, &QBsdKeyboardHandler::readKeyboardData);
+ QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
+ QInputDeviceManager::DeviceTypeKeyboard, 1);
+}
+
+QBsdKeyboardHandler::~QBsdKeyboardHandler()
+{
+ revertTTYSettings();
+}
+
+void QBsdKeyboardHandler::revertTTYSettings()
+{
+ if (m_fd >= 0) {
+ if (m_kbdOrigTty) {
+ tcsetattr(m_fd, TCSANOW, m_kbdOrigTty.data());
+ m_kbdOrigTty.reset();
+ }
+
+ if (m_origKbdMode != Bsd_NoKeyMode) {
+ ioctl(m_fd, KDSKBMODE, m_origKbdMode);
+ m_origKbdMode = Bsd_NoKeyMode;
+ }
+
+ if (m_shouldClose)
+ close(m_fd);
+ m_fd = -1;
+ }
+}
+
+void QBsdKeyboardHandler::readKeyboardData()
+{
+
+ for (;;) {
+ uint8_t buffer[32];
+ int bytesRead = qt_safe_read(m_fd, buffer, sizeof(buffer));
+
+ if (!bytesRead) {
+ qWarning("Got EOF from the input device.");
+ return;
+ } else if (bytesRead < 0) {
+ if (errno != EINTR && errno != EAGAIN)
+ qWarning("Could not read from input device: %s", strerror(errno));
+ return;
+ }
+
+ for (int i = 0; i < bytesRead; ++i) {
+ const quint16 code = buffer[i] & Bsd_KeyCodeMask;
+ const bool pressed = (buffer[i] & Bsd_KeyPressedMask) ? false : true;
+
+ processKeycode(code, pressed, false);
+ }
+ }
+}
+
+void QBsdKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtcode,
+ Qt::KeyboardModifiers modifiers, bool isPress,
+ bool autoRepeat)
+{
+ const QString text = (unicode != 0xffff ) ? QString(unicode) : QString();
+ const QEvent::Type eventType = isPress ? QEvent::KeyPress : QEvent::KeyRelease;
+
+ QWindowSystemInterface::handleExtendedKeyEvent(0, eventType, qtcode, modifiers, nativecode, 0,
+ int(modifiers), text, autoRepeat);
+}
+
+void QBsdKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat)
+{
+ const bool first_press = pressed && !autorepeat;
+
+ const QBsdKeyboardMap::Mapping *map_plain = nullptr;
+ const QBsdKeyboardMap::Mapping *map_withmod = nullptr;
+
+ quint8 modifiers = m_modifiers;
+
+ // get a specific and plain mapping for the keycode and the current modifiers
+ for (const QBsdKeyboardMap::Mapping &m : m_keymap) {
+ if (m.keycode == keycode) {
+ if (m.modifiers == 0)
+ map_plain = &m;
+
+ quint8 testmods = m_modifiers;
+ if (m_capsLock && (m.flags & QBsdKeyboardMap::IsLetter))
+ testmods ^= QBsdKeyboardMap::ModShift;
+ if (m.modifiers == testmods)
+ map_withmod = &m;
+ }
+ }
+
+ if (m_capsLock && map_withmod && (map_withmod->flags & QBsdKeyboardMap::IsLetter))
+ modifiers ^= QBsdKeyboardMap::ModShift;
+
+#ifdef QT_BSD_KEYBOARD_DEBUG
+ qWarning("Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d", \
+ keycode, modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0);
+#endif
+
+ const QBsdKeyboardMap::Mapping *it = map_withmod ? map_withmod : map_plain;
+
+ if (!it) {
+#ifdef QT_BSD_KEYBOARD_DEBUG
+ // we couldn't even find a plain mapping
+ qWarning("Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode, modifiers);
+#endif
+ return;
+ }
+
+ bool skip = false;
+ quint16 unicode = it->unicode;
+ quint32 qtcode = it->qtcode;
+
+ if ((it->flags & QBsdKeyboardMap::IsModifier) && it->special) {
+ // this is a modifier, i.e. Shift, Alt, ...
+ if (pressed)
+ m_modifiers |= quint8(it->special);
+ else
+ m_modifiers &= ~quint8(it->special);
+ } else if (qtcode >= Qt::Key_CapsLock && qtcode <= Qt::Key_ScrollLock) {
+ // (Caps|Num|Scroll)Lock
+ if (first_press) {
+ switch (qtcode) {
+ case Qt::Key_CapsLock:
+ m_capsLock = !m_capsLock;
+ switchLed(LED_CAP, m_capsLock);
+ break;
+ case Qt::Key_NumLock:
+ m_numLock = !m_numLock;
+ switchLed(LED_NUM, m_numLock);
+ break;
+ case Qt::Key_ScrollLock:
+ m_scrollLock = !m_scrollLock;
+ switchLed(LED_SCR, m_scrollLock);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (!skip) {
+ // a normal key was pressed
+ const int modmask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier
+ | Qt::MetaModifier | Qt::KeypadModifier;
+
+ // we couldn't find a specific mapping for the current modifiers,
+ // or that mapping didn't have special modifiers:
+ // so just report the plain mapping with additional modifiers.
+ if ((it == map_plain && it != map_withmod) ||
+ (map_withmod && !(map_withmod->qtcode & modmask))) {
+ qtcode |= QBsdKeyboardHandler::toQtModifiers(modifiers);
+ }
+
+#ifdef QT_BSD_KEYBOARD_DEBUG
+ qWarning("Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask));
+#endif
+ //If NumLockOff and keypad key pressed remap event sent
+ if (!m_numLock &&
+ (qtcode & Qt::KeypadModifier)) {
+ unicode = 0xffff;
+ const int oldMask = (qtcode & modmask);
+ switch (qtcode & ~modmask) {
+ case Qt::Key_7: //7 --> Home
+ qtcode = Qt::Key_Home;
+ break;
+ case Qt::Key_8: //8 --> Up
+ qtcode = Qt::Key_Up;
+ break;
+ case Qt::Key_9: //9 --> PgUp
+ qtcode = Qt::Key_PageUp;
+ break;
+ case Qt::Key_4: //4 --> Left
+ qtcode = Qt::Key_Left;
+ break;
+ case Qt::Key_5: //5 --> Clear
+ qtcode = Qt::Key_Clear;
+ break;
+ case Qt::Key_6: //6 --> right
+ qtcode = Qt::Key_Right;
+ break;
+ case Qt::Key_1: //1 --> End
+ qtcode = Qt::Key_End;
+ break;
+ case Qt::Key_2: //2 --> Down
+ qtcode = Qt::Key_Down;
+ break;
+ case Qt::Key_3: //3 --> PgDn
+ qtcode = Qt::Key_PageDown;
+ break;
+ case Qt::Key_0: //0 --> Ins
+ qtcode = Qt::Key_Insert;
+ break;
+ case Qt::Key_Period: //. --> Del
+ qtcode = Qt::Key_Delete;
+ break;
+ }
+ qtcode |= oldMask;
+ }
+
+ // send the result to the server
+ processKeyEvent(keycode, unicode, qtcode & ~modmask,
+ Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat);
+ }
+}
+
+void QBsdKeyboardHandler::switchLed(int led, bool state)
+{
+#ifdef QT_BSD_KEYBOARD_DEBUG
+ qWarning() << "switchLed" << led << state;
+#endif
+ int leds = 0;
+ if (ioctl(m_fd, KDGETLED, &leds) < 0) {
+ qWarning("switchLed: Failed to query led states.");
+ return;
+ }
+
+ if (state)
+ leds |= led;
+ else
+ leds &= ~led;
+
+ if (ioctl(m_fd, KDSETLED, leds) < 0)
+ qWarning("switchLed: Failed to set led states.");
+}
+
+void QBsdKeyboardHandler::resetKeymap()
+{
+#ifdef QT_BSD_KEYBOARD_DEBUG
+ qWarning() << "Unload current keymap and restore built-in";
+#endif
+
+ m_keymap.clear();
+
+ const size_t mappingSize = sizeof(keymapDefault) / sizeof(keymapDefault[0]);
+ m_keymap.resize(mappingSize);
+ std::copy_n( &keymapDefault[0], mappingSize, m_keymap.begin() );
+
+ // reset state, so we could switch keymaps at runtime
+ m_modifiers = 0;
+ m_capsLock = false;
+ m_numLock = false;
+ m_scrollLock = false;
+
+ //Set locks according to keyboard leds
+ int leds = 0;
+ if (ioctl(m_fd, KDGETLED, &leds) < 0) {
+ qWarning("Failed to query led states. Settings numlock & capslock off");
+ switchLed(LED_NUM, false);
+ switchLed(LED_CAP, false);
+ switchLed(LED_SCR, false);
+ } else {
+ if ((leds & LED_CAP) > 0)
+ m_capsLock = true;
+ if ((leds & LED_NUM) > 0)
+ m_numLock = true;
+ if ((leds & LED_SCR) > 0)
+ m_scrollLock = true;
+#ifdef QT_BSD_KEYBOARD_DEBUG
+ qWarning("numlock=%d , capslock=%d, scrolllock=%d",m_numLock, m_capsLock, m_scrollLock);
+#endif
+ }
+}
diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h
new file mode 100644
index 0000000000..1a7cbc1f9a
--- /dev/null
+++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBSDKEYBOARD_H
+#define QBSDKEYBOARD_H
+
+#include <qobject.h>
+#include <QDataStream>
+#include <QVector>
+
+QT_BEGIN_NAMESPACE
+
+class QSocketNotifier;
+
+struct termios;
+
+enum {
+ Bsd_NoKeyMode = -1
+};
+
+namespace QBsdKeyboardMap {
+ const quint32 FileMagic = 0x514d4150; // 'QMAP'
+
+ struct Mapping {
+ quint16 keycode;
+ quint16 unicode;
+ quint32 qtcode;
+ quint8 modifiers;
+ quint8 flags;
+ quint16 special;
+
+ };
+
+ enum Flags {
+ NoFlags = 0x00,
+ IsLetter = 0x01,
+ IsModifier = 0x02
+ };
+
+ enum Modifiers {
+ ModPlain = 0x00,
+ ModShift = 0x01,
+ ModAltGr = 0x02,
+ ModControl = 0x04,
+ ModAlt = 0x08,
+ ModShiftL = 0x10,
+ ModShiftR = 0x20,
+ ModCtrlL = 0x40,
+ ModCtrlR = 0x80
+ // ModCapsShift = 0x100, // not supported!
+ };
+}
+
+inline QDataStream &operator>>(QDataStream &ds, QBsdKeyboardMap::Mapping &m)
+{
+ return ds >> m.keycode >> m.unicode >> m.qtcode >> m.modifiers >> m.flags >> m.special;
+}
+
+class QBsdKeyboardHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+ QBsdKeyboardHandler(const QString &key, const QString &specification);
+ ~QBsdKeyboardHandler() override;
+
+ static Qt::KeyboardModifiers toQtModifiers(quint8 mod)
+ {
+ Qt::KeyboardModifiers qtmod = Qt::NoModifier;
+
+ if (mod & (QBsdKeyboardMap::ModShift | QBsdKeyboardMap::ModShiftL | QBsdKeyboardMap::ModShiftR))
+ qtmod |= Qt::ShiftModifier;
+ if (mod & (QBsdKeyboardMap::ModControl | QBsdKeyboardMap::ModCtrlL | QBsdKeyboardMap::ModCtrlR))
+ qtmod |= Qt::ControlModifier;
+ if (mod & QBsdKeyboardMap::ModAlt)
+ qtmod |= Qt::AltModifier;
+
+ return qtmod;
+ }
+
+protected:
+ void switchLed(int led, bool state);
+ void processKeycode(quint16 keycode, bool pressed, bool autorepeat);
+ void processKeyEvent(int nativecode, int unicode, int qtcode,
+ Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat);
+ void revertTTYSettings();
+ void resetKeymap();
+ void readKeyboardData();
+
+private:
+ QScopedPointer<QSocketNotifier> m_notifier;
+ QScopedPointer<termios> m_kbdOrigTty;
+ int m_origKbdMode = Bsd_NoKeyMode;
+ int m_fd = -1;
+ bool m_shouldClose = false;
+ QString m_spec;
+
+ // keymap handling
+ quint8 m_modifiers = 0;
+ bool m_capsLock = false;
+ bool m_numLock = false;
+ bool m_scrollLock = false;
+
+ QVector<QBsdKeyboardMap::Mapping> m_keymap;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBSDKEYBOARD_H
diff --git a/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h b/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h
new file mode 100644
index 0000000000..45cf5944bc
--- /dev/null
+++ b/src/plugins/generic/bsdkeyboard/qbsdkeyboard_defaultmap.h
@@ -0,0 +1,622 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBSDKEYBOARD_DEFAULTMAP_P_H
+#define QBSDKEYBOARD_DEFAULTMAP_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 "qnamespace.h"
+
+// no QT_BEGIN_NAMESPACE, since we include it internally...
+using namespace QBsdKeyboardMap;
+
+#define QCTRL(x) ((x) | Qt::ControlModifier)
+#define QALT(x) ((x) | Qt::AltModifier)
+#define QKEYPAD(x) ((x) | Qt::KeypadModifier)
+
+const QBsdKeyboardMap::Mapping keymapDefault[] = {
+ { 1, 0xffff, Qt::Key_Escape, ModPlain, NoFlags, 0x0000 },
+ { 2, 0x0031, Qt::Key_1, ModPlain, NoFlags, 0x0000 },
+ { 2, 0x0021, Qt::Key_Exclam, ModShift, NoFlags, 0x0000 },
+ { 3, 0x0032, Qt::Key_2, ModPlain, NoFlags, 0x0000 },
+ { 3, 0x0040, Qt::Key_At, ModShift, NoFlags, 0x0000 },
+ { 3, 0x0040, Qt::Key_At, ModAltGr, NoFlags, 0x0000 },
+ { 4, 0x0033, Qt::Key_3, ModPlain, NoFlags, 0x0000 },
+ { 4, 0x0023, Qt::Key_NumberSign, ModShift, NoFlags, 0x0000 },
+ { 4, 0xffff, Qt::Key_Escape, ModControl, NoFlags, 0x0000 },
+ { 5, 0x0034, Qt::Key_4, ModPlain, NoFlags, 0x0000 },
+ { 5, 0x0024, Qt::Key_Dollar, ModShift, NoFlags, 0x0000 },
+ { 5, 0x0024, Qt::Key_Dollar, ModAltGr, NoFlags, 0x0000 },
+ { 5, 0x005c, QCTRL(Qt::Key_Backslash), ModControl, NoFlags, 0x0000 },
+ { 6, 0x0035, Qt::Key_5, ModPlain, NoFlags, 0x0000 },
+ { 6, 0x0025, Qt::Key_Percent, ModShift, NoFlags, 0x0000 },
+ { 6, 0x005d, QCTRL(Qt::Key_BracketRight), ModControl, NoFlags, 0x0000 },
+ { 7, 0x0036, Qt::Key_6, ModPlain, NoFlags, 0x0000 },
+ { 7, 0x005e, Qt::Key_AsciiCircum, ModShift, NoFlags, 0x0000 },
+ { 7, 0x005e, QCTRL(Qt::Key_AsciiCircum), ModControl, NoFlags, 0x0000 },
+ { 8, 0x0037, Qt::Key_7, ModPlain, NoFlags, 0x0000 },
+ { 8, 0x0026, Qt::Key_Ampersand, ModShift, NoFlags, 0x0000 },
+ { 8, 0x007b, Qt::Key_BraceLeft, ModAltGr, NoFlags, 0x0000 },
+ { 8, 0x005f, QCTRL(Qt::Key_Underscore), ModControl, NoFlags, 0x0000 },
+ { 9, 0x0038, Qt::Key_8, ModPlain, NoFlags, 0x0000 },
+ { 9, 0x002a, Qt::Key_Asterisk, ModShift, NoFlags, 0x0000 },
+ { 9, 0x005b, Qt::Key_BracketLeft, ModAltGr, NoFlags, 0x0000 },
+ { 9, 0xffff, Qt::Key_Backspace, ModControl, NoFlags, 0x0000 },
+ { 10, 0x0039, Qt::Key_9, ModPlain, NoFlags, 0x0000 },
+ { 10, 0x0028, Qt::Key_ParenLeft, ModShift, NoFlags, 0x0000 },
+ { 10, 0x005d, Qt::Key_BracketRight, ModAltGr, NoFlags, 0x0000 },
+ { 11, 0x0030, Qt::Key_0, ModPlain, NoFlags, 0x0000 },
+ { 11, 0x0029, Qt::Key_ParenRight, ModShift, NoFlags, 0x0000 },
+ { 11, 0x007d, Qt::Key_BraceRight, ModAltGr, NoFlags, 0x0000 },
+ { 12, 0x002d, Qt::Key_Minus, ModPlain, NoFlags, 0x0000 },
+ { 12, 0x005f, Qt::Key_Underscore, ModShift, NoFlags, 0x0000 },
+ { 12, 0x005c, Qt::Key_Backslash, ModAltGr, NoFlags, 0x0000 },
+ { 12, 0x005f, QCTRL(Qt::Key_Underscore), ModControl, NoFlags, 0x0000 },
+ { 12, 0x005f, QCTRL(Qt::Key_Underscore), ModShift | ModControl, NoFlags, 0x0000 },
+ { 13, 0x003d, Qt::Key_Equal, ModPlain, NoFlags, 0x0000 },
+ { 13, 0x002b, Qt::Key_Plus, ModShift, NoFlags, 0x0000 },
+ { 14, 0xffff, Qt::Key_Backspace, ModPlain, NoFlags, 0x0000 },
+ { 15, 0xffff, Qt::Key_Tab, ModPlain, NoFlags, 0x0000 },
+ { 16, 0x0071, Qt::Key_Q, ModPlain, IsLetter, 0x0000 },
+ { 16, 0x0051, Qt::Key_Q, ModShift, IsLetter, 0x0000 },
+ { 16, 0x0071, Qt::Key_Q, ModAltGr, IsLetter, 0x0000 },
+ { 16, 0x0051, Qt::Key_Q, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(Qt::Key_Q), ModControl, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(Qt::Key_Q), ModShift | ModControl, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(Qt::Key_Q), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(Qt::Key_Q), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 16, 0x0071, QALT(Qt::Key_Q), ModAlt, IsLetter, 0x0000 },
+ { 16, 0x0071, QALT(Qt::Key_Q), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 16, 0x0071, QALT(Qt::Key_Q), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 16, 0x0071, QALT(Qt::Key_Q), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(QALT(Qt::Key_Q)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(QALT(Qt::Key_Q)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(QALT(Qt::Key_Q)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 16, 0x0071, QCTRL(QALT(Qt::Key_Q)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, Qt::Key_W, ModPlain, IsLetter, 0x0000 },
+ { 17, 0x0057, Qt::Key_W, ModShift, IsLetter, 0x0000 },
+ { 17, 0x0077, Qt::Key_W, ModAltGr, IsLetter, 0x0000 },
+ { 17, 0x0057, Qt::Key_W, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(Qt::Key_W), ModControl, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(Qt::Key_W), ModShift | ModControl, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(Qt::Key_W), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(Qt::Key_W), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 17, 0x0077, QALT(Qt::Key_W), ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, QALT(Qt::Key_W), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, QALT(Qt::Key_W), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, QALT(Qt::Key_W), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(QALT(Qt::Key_W)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(QALT(Qt::Key_W)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(QALT(Qt::Key_W)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 17, 0x0077, QCTRL(QALT(Qt::Key_W)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, Qt::Key_E, ModPlain, IsLetter, 0x0000 },
+ { 18, 0x0045, Qt::Key_E, ModShift, IsLetter, 0x0000 },
+ { 18, 0x0065, Qt::Key_E, ModAltGr, IsLetter, 0x0000 },
+ { 18, 0x0045, Qt::Key_E, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(Qt::Key_E), ModControl, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(Qt::Key_E), ModShift | ModControl, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(Qt::Key_E), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(Qt::Key_E), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 18, 0x0065, QALT(Qt::Key_E), ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, QALT(Qt::Key_E), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, QALT(Qt::Key_E), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, QALT(Qt::Key_E), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(QALT(Qt::Key_E)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(QALT(Qt::Key_E)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(QALT(Qt::Key_E)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 18, 0x0065, QCTRL(QALT(Qt::Key_E)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, Qt::Key_R, ModPlain, IsLetter, 0x0000 },
+ { 19, 0x0052, Qt::Key_R, ModShift, IsLetter, 0x0000 },
+ { 19, 0x0072, Qt::Key_R, ModAltGr, IsLetter, 0x0000 },
+ { 19, 0x0052, Qt::Key_R, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(Qt::Key_R), ModControl, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(Qt::Key_R), ModShift | ModControl, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(Qt::Key_R), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(Qt::Key_R), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 19, 0x0072, QALT(Qt::Key_R), ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, QALT(Qt::Key_R), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, QALT(Qt::Key_R), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, QALT(Qt::Key_R), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(QALT(Qt::Key_R)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(QALT(Qt::Key_R)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(QALT(Qt::Key_R)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 19, 0x0072, QCTRL(QALT(Qt::Key_R)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, Qt::Key_T, ModPlain, IsLetter, 0x0000 },
+ { 20, 0x0054, Qt::Key_T, ModShift, IsLetter, 0x0000 },
+ { 20, 0x0074, Qt::Key_T, ModAltGr, IsLetter, 0x0000 },
+ { 20, 0x0054, Qt::Key_T, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(Qt::Key_T), ModControl, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(Qt::Key_T), ModShift | ModControl, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(Qt::Key_T), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(Qt::Key_T), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 20, 0x0074, QALT(Qt::Key_T), ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, QALT(Qt::Key_T), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, QALT(Qt::Key_T), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, QALT(Qt::Key_T), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(QALT(Qt::Key_T)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(QALT(Qt::Key_T)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(QALT(Qt::Key_T)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 20, 0x0074, QCTRL(QALT(Qt::Key_T)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, Qt::Key_Y, ModPlain, IsLetter, 0x0000 },
+ { 21, 0x0059, Qt::Key_Y, ModShift, IsLetter, 0x0000 },
+ { 21, 0x0079, Qt::Key_Y, ModAltGr, IsLetter, 0x0000 },
+ { 21, 0x0059, Qt::Key_Y, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(Qt::Key_Y), ModControl, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(Qt::Key_Y), ModShift | ModControl, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(Qt::Key_Y), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(Qt::Key_Y), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 21, 0x0079, QALT(Qt::Key_Y), ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, QALT(Qt::Key_Y), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, QALT(Qt::Key_Y), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, QALT(Qt::Key_Y), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(QALT(Qt::Key_Y)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(QALT(Qt::Key_Y)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(QALT(Qt::Key_Y)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 21, 0x0079, QCTRL(QALT(Qt::Key_Y)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, Qt::Key_U, ModPlain, IsLetter, 0x0000 },
+ { 22, 0x0055, Qt::Key_U, ModShift, IsLetter, 0x0000 },
+ { 22, 0x0075, Qt::Key_U, ModAltGr, IsLetter, 0x0000 },
+ { 22, 0x0055, Qt::Key_U, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(Qt::Key_U), ModControl, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(Qt::Key_U), ModShift | ModControl, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(Qt::Key_U), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(Qt::Key_U), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 22, 0x0075, QALT(Qt::Key_U), ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, QALT(Qt::Key_U), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, QALT(Qt::Key_U), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, QALT(Qt::Key_U), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(QALT(Qt::Key_U)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(QALT(Qt::Key_U)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(QALT(Qt::Key_U)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 22, 0x0075, QCTRL(QALT(Qt::Key_U)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, Qt::Key_I, ModPlain, IsLetter, 0x0000 },
+ { 23, 0x0049, Qt::Key_I, ModShift, IsLetter, 0x0000 },
+ { 23, 0x0069, Qt::Key_I, ModAltGr, IsLetter, 0x0000 },
+ { 23, 0x0049, Qt::Key_I, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(Qt::Key_I), ModControl, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(Qt::Key_I), ModShift | ModControl, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(Qt::Key_I), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(Qt::Key_I), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 23, 0x0069, QALT(Qt::Key_I), ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, QALT(Qt::Key_I), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, QALT(Qt::Key_I), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, QALT(Qt::Key_I), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(QALT(Qt::Key_I)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(QALT(Qt::Key_I)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(QALT(Qt::Key_I)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 23, 0x0069, QCTRL(QALT(Qt::Key_I)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, Qt::Key_O, ModPlain, IsLetter, 0x0000 },
+ { 24, 0x004f, Qt::Key_O, ModShift, IsLetter, 0x0000 },
+ { 24, 0x006f, Qt::Key_O, ModAltGr, IsLetter, 0x0000 },
+ { 24, 0x004f, Qt::Key_O, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(Qt::Key_O), ModControl, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(Qt::Key_O), ModShift | ModControl, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(Qt::Key_O), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(Qt::Key_O), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 24, 0x006f, QALT(Qt::Key_O), ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, QALT(Qt::Key_O), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, QALT(Qt::Key_O), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, QALT(Qt::Key_O), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(QALT(Qt::Key_O)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(QALT(Qt::Key_O)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(QALT(Qt::Key_O)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 24, 0x006f, QCTRL(QALT(Qt::Key_O)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, Qt::Key_P, ModPlain, IsLetter, 0x0000 },
+ { 25, 0x0050, Qt::Key_P, ModShift, IsLetter, 0x0000 },
+ { 25, 0x0070, Qt::Key_P, ModAltGr, IsLetter, 0x0000 },
+ { 25, 0x0050, Qt::Key_P, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(Qt::Key_P), ModControl, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(Qt::Key_P), ModShift | ModControl, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(Qt::Key_P), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(Qt::Key_P), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 25, 0x0070, QALT(Qt::Key_P), ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, QALT(Qt::Key_P), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, QALT(Qt::Key_P), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, QALT(Qt::Key_P), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(QALT(Qt::Key_P)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(QALT(Qt::Key_P)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(QALT(Qt::Key_P)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 25, 0x0070, QCTRL(QALT(Qt::Key_P)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 26, 0x005b, Qt::Key_BracketLeft, ModPlain, NoFlags, 0x0000 },
+ { 26, 0x007b, Qt::Key_BraceLeft, ModShift, NoFlags, 0x0000 },
+ { 26, 0xffff, Qt::Key_Escape, ModControl, NoFlags, 0x0000 },
+ { 27, 0x005d, Qt::Key_BracketRight, ModPlain, NoFlags, 0x0000 },
+ { 27, 0x007d, Qt::Key_BraceRight, ModShift, NoFlags, 0x0000 },
+ { 27, 0x007e, Qt::Key_AsciiTilde, ModAltGr, NoFlags, 0x0000 },
+ { 27, 0x005d, QCTRL(Qt::Key_BracketRight), ModControl, NoFlags, 0x0000 },
+ { 28, 0xffff, Qt::Key_Return, ModPlain, NoFlags, 0x0000 },
+ { 28, 0x006d, QCTRL(QALT(Qt::Key_M)), ModAlt, NoFlags, 0x0000 },
+ { 29, 0xffff, Qt::Key_Control, ModPlain, IsModifier, ModControl },
+ { 30, 0x0061, Qt::Key_A, ModPlain, IsLetter, 0x0000 },
+ { 30, 0x0041, Qt::Key_A, ModShift, IsLetter, 0x0000 },
+ { 30, 0x0061, Qt::Key_A, ModAltGr, IsLetter, 0x0000 },
+ { 30, 0x0041, Qt::Key_A, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(Qt::Key_A), ModControl, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(Qt::Key_A), ModShift | ModControl, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(Qt::Key_A), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(Qt::Key_A), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 30, 0x0061, QALT(Qt::Key_A), ModAlt, IsLetter, 0x0000 },
+ { 30, 0x0061, QALT(Qt::Key_A), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 30, 0x0061, QALT(Qt::Key_A), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 30, 0x0061, QALT(Qt::Key_A), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(QALT(Qt::Key_A)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(QALT(Qt::Key_A)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(QALT(Qt::Key_A)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 30, 0x0061, QCTRL(QALT(Qt::Key_A)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, Qt::Key_S, ModPlain, IsLetter, 0x0000 },
+ { 31, 0x0053, Qt::Key_S, ModShift, IsLetter, 0x0000 },
+ { 31, 0x0073, Qt::Key_S, ModAltGr, IsLetter, 0x0000 },
+ { 31, 0x0053, Qt::Key_S, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(Qt::Key_S), ModControl, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(Qt::Key_S), ModShift | ModControl, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(Qt::Key_S), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(Qt::Key_S), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 31, 0x0073, QALT(Qt::Key_S), ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, QALT(Qt::Key_S), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, QALT(Qt::Key_S), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, QALT(Qt::Key_S), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(QALT(Qt::Key_S)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(QALT(Qt::Key_S)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(QALT(Qt::Key_S)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 31, 0x0073, QCTRL(QALT(Qt::Key_S)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, Qt::Key_D, ModPlain, IsLetter, 0x0000 },
+ { 32, 0x0044, Qt::Key_D, ModShift, IsLetter, 0x0000 },
+ { 32, 0x0064, Qt::Key_D, ModAltGr, IsLetter, 0x0000 },
+ { 32, 0x0044, Qt::Key_D, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(Qt::Key_D), ModControl, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(Qt::Key_D), ModShift | ModControl, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(Qt::Key_D), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(Qt::Key_D), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 32, 0x0064, QALT(Qt::Key_D), ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, QALT(Qt::Key_D), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, QALT(Qt::Key_D), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, QALT(Qt::Key_D), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(QALT(Qt::Key_D)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(QALT(Qt::Key_D)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(QALT(Qt::Key_D)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 32, 0x0064, QCTRL(QALT(Qt::Key_D)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, Qt::Key_F, ModPlain, IsLetter, 0x0000 },
+ { 33, 0x0046, Qt::Key_F, ModShift, IsLetter, 0x0000 },
+ { 33, 0x0066, Qt::Key_F, ModAltGr, IsLetter, 0x0000 },
+ { 33, 0x0046, Qt::Key_F, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(Qt::Key_F), ModControl, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(Qt::Key_F), ModShift | ModControl, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(Qt::Key_F), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(Qt::Key_F), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 33, 0x0066, QALT(Qt::Key_F), ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, QALT(Qt::Key_F), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, QALT(Qt::Key_F), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, QALT(Qt::Key_F), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(QALT(Qt::Key_F)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(QALT(Qt::Key_F)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(QALT(Qt::Key_F)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 33, 0x0066, QCTRL(QALT(Qt::Key_F)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, Qt::Key_G, ModPlain, IsLetter, 0x0000 },
+ { 34, 0x0047, Qt::Key_G, ModShift, IsLetter, 0x0000 },
+ { 34, 0x0067, Qt::Key_G, ModAltGr, IsLetter, 0x0000 },
+ { 34, 0x0047, Qt::Key_G, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(Qt::Key_G), ModControl, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(Qt::Key_G), ModShift | ModControl, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(Qt::Key_G), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(Qt::Key_G), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 34, 0x0067, QALT(Qt::Key_G), ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, QALT(Qt::Key_G), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, QALT(Qt::Key_G), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, QALT(Qt::Key_G), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(QALT(Qt::Key_G)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(QALT(Qt::Key_G)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(QALT(Qt::Key_G)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 34, 0x0067, QCTRL(QALT(Qt::Key_G)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, Qt::Key_H, ModPlain, IsLetter, 0x0000 },
+ { 35, 0x0048, Qt::Key_H, ModShift, IsLetter, 0x0000 },
+ { 35, 0x0068, Qt::Key_H, ModAltGr, IsLetter, 0x0000 },
+ { 35, 0x0048, Qt::Key_H, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(Qt::Key_H), ModControl, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(Qt::Key_H), ModShift | ModControl, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(Qt::Key_H), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(Qt::Key_H), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 35, 0x0068, QALT(Qt::Key_H), ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, QALT(Qt::Key_H), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, QALT(Qt::Key_H), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, QALT(Qt::Key_H), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(QALT(Qt::Key_H)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(QALT(Qt::Key_H)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(QALT(Qt::Key_H)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 35, 0x0068, QCTRL(QALT(Qt::Key_H)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, Qt::Key_J, ModPlain, IsLetter, 0x0000 },
+ { 36, 0x004a, Qt::Key_J, ModShift, IsLetter, 0x0000 },
+ { 36, 0x006a, Qt::Key_J, ModAltGr, IsLetter, 0x0000 },
+ { 36, 0x004a, Qt::Key_J, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(Qt::Key_J), ModControl, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(Qt::Key_J), ModShift | ModControl, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(Qt::Key_J), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(Qt::Key_J), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 36, 0x006a, QALT(Qt::Key_J), ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, QALT(Qt::Key_J), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, QALT(Qt::Key_J), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, QALT(Qt::Key_J), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(QALT(Qt::Key_J)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(QALT(Qt::Key_J)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(QALT(Qt::Key_J)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 36, 0x006a, QCTRL(QALT(Qt::Key_J)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, Qt::Key_K, ModPlain, IsLetter, 0x0000 },
+ { 37, 0x004b, Qt::Key_K, ModShift, IsLetter, 0x0000 },
+ { 37, 0x006b, Qt::Key_K, ModAltGr, IsLetter, 0x0000 },
+ { 37, 0x004b, Qt::Key_K, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(Qt::Key_K), ModControl, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(Qt::Key_K), ModShift | ModControl, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(Qt::Key_K), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(Qt::Key_K), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 37, 0x006b, QALT(Qt::Key_K), ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, QALT(Qt::Key_K), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, QALT(Qt::Key_K), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, QALT(Qt::Key_K), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(QALT(Qt::Key_K)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(QALT(Qt::Key_K)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(QALT(Qt::Key_K)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 37, 0x006b, QCTRL(QALT(Qt::Key_K)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, Qt::Key_L, ModPlain, IsLetter, 0x0000 },
+ { 38, 0x004c, Qt::Key_L, ModShift, IsLetter, 0x0000 },
+ { 38, 0x006c, Qt::Key_L, ModAltGr, IsLetter, 0x0000 },
+ { 38, 0x004c, Qt::Key_L, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(Qt::Key_L), ModControl, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(Qt::Key_L), ModShift | ModControl, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(Qt::Key_L), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(Qt::Key_L), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 38, 0x006c, QALT(Qt::Key_L), ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, QALT(Qt::Key_L), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, QALT(Qt::Key_L), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, QALT(Qt::Key_L), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(QALT(Qt::Key_L)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(QALT(Qt::Key_L)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(QALT(Qt::Key_L)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 38, 0x006c, QCTRL(QALT(Qt::Key_L)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 39, 0x003b, Qt::Key_Semicolon, ModPlain, NoFlags, 0x0000 },
+ { 39, 0x003a, Qt::Key_Colon, ModShift, NoFlags, 0x0000 },
+ { 40, 0x0027, Qt::Key_Apostrophe, ModPlain, NoFlags, 0x0000 },
+ { 40, 0x0022, Qt::Key_QuoteDbl, ModShift, NoFlags, 0x0000 },
+ { 40, 0x0067, QCTRL(Qt::Key_G), ModControl, NoFlags, 0x0000 },
+ { 41, 0x0060, Qt::Key_QuoteLeft, ModPlain, NoFlags, 0x0000 },
+ { 41, 0x007e, Qt::Key_AsciiTilde, ModShift, NoFlags, 0x0000 },
+ { 42, 0xffff, Qt::Key_Shift, ModPlain, IsModifier, ModShift },
+ { 43, 0x005c, Qt::Key_Backslash, ModPlain, NoFlags, 0x0000 },
+ { 43, 0x007c, Qt::Key_Bar, ModShift, NoFlags, 0x0000 },
+ { 43, 0x005c, QCTRL(Qt::Key_Backslash), ModControl, NoFlags, 0x0000 },
+ { 44, 0x007a, Qt::Key_Z, ModPlain, IsLetter, 0x0000 },
+ { 44, 0x005a, Qt::Key_Z, ModShift, IsLetter, 0x0000 },
+ { 44, 0x007a, Qt::Key_Z, ModAltGr, IsLetter, 0x0000 },
+ { 44, 0x005a, Qt::Key_Z, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(Qt::Key_Z), ModControl, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(Qt::Key_Z), ModShift | ModControl, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(Qt::Key_Z), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(Qt::Key_Z), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 44, 0x007a, QALT(Qt::Key_Z), ModAlt, IsLetter, 0x0000 },
+ { 44, 0x007a, QALT(Qt::Key_Z), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 44, 0x007a, QALT(Qt::Key_Z), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 44, 0x007a, QALT(Qt::Key_Z), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(QALT(Qt::Key_Z)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(QALT(Qt::Key_Z)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(QALT(Qt::Key_Z)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 44, 0x007a, QCTRL(QALT(Qt::Key_Z)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, Qt::Key_X, ModPlain, IsLetter, 0x0000 },
+ { 45, 0x0058, Qt::Key_X, ModShift, IsLetter, 0x0000 },
+ { 45, 0x0078, Qt::Key_X, ModAltGr, IsLetter, 0x0000 },
+ { 45, 0x0058, Qt::Key_X, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(Qt::Key_X), ModControl, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(Qt::Key_X), ModShift | ModControl, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(Qt::Key_X), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(Qt::Key_X), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 45, 0x0078, QALT(Qt::Key_X), ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, QALT(Qt::Key_X), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, QALT(Qt::Key_X), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, QALT(Qt::Key_X), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(QALT(Qt::Key_X)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(QALT(Qt::Key_X)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(QALT(Qt::Key_X)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 45, 0x0078, QCTRL(QALT(Qt::Key_X)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, Qt::Key_C, ModPlain, IsLetter, 0x0000 },
+ { 46, 0x0043, Qt::Key_C, ModShift, IsLetter, 0x0000 },
+ { 46, 0x0063, Qt::Key_C, ModAltGr, IsLetter, 0x0000 },
+ { 46, 0x0043, Qt::Key_C, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(Qt::Key_C), ModControl, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(Qt::Key_C), ModShift | ModControl, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(Qt::Key_C), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(Qt::Key_C), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 46, 0x0063, QALT(Qt::Key_C), ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, QALT(Qt::Key_C), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, QALT(Qt::Key_C), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, QALT(Qt::Key_C), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(QALT(Qt::Key_C)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(QALT(Qt::Key_C)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(QALT(Qt::Key_C)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 46, 0x0063, QCTRL(QALT(Qt::Key_C)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, Qt::Key_V, ModPlain, IsLetter, 0x0000 },
+ { 47, 0x0056, Qt::Key_V, ModShift, IsLetter, 0x0000 },
+ { 47, 0x0076, Qt::Key_V, ModAltGr, IsLetter, 0x0000 },
+ { 47, 0x0056, Qt::Key_V, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(Qt::Key_V), ModControl, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(Qt::Key_V), ModShift | ModControl, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(Qt::Key_V), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(Qt::Key_V), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 47, 0x0076, QALT(Qt::Key_V), ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, QALT(Qt::Key_V), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, QALT(Qt::Key_V), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, QALT(Qt::Key_V), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(QALT(Qt::Key_V)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(QALT(Qt::Key_V)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(QALT(Qt::Key_V)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 47, 0x0076, QCTRL(QALT(Qt::Key_V)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, Qt::Key_B, ModPlain, IsLetter, 0x0000 },
+ { 48, 0x0042, Qt::Key_B, ModShift, IsLetter, 0x0000 },
+ { 48, 0x0062, Qt::Key_B, ModAltGr, IsLetter, 0x0000 },
+ { 48, 0x0042, Qt::Key_B, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(Qt::Key_B), ModControl, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(Qt::Key_B), ModShift | ModControl, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(Qt::Key_B), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(Qt::Key_B), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 48, 0x0062, QALT(Qt::Key_B), ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, QALT(Qt::Key_B), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, QALT(Qt::Key_B), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, QALT(Qt::Key_B), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(QALT(Qt::Key_B)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(QALT(Qt::Key_B)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(QALT(Qt::Key_B)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 48, 0x0062, QCTRL(QALT(Qt::Key_B)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, Qt::Key_N, ModPlain, IsLetter, 0x0000 },
+ { 49, 0x004e, Qt::Key_N, ModShift, IsLetter, 0x0000 },
+ { 49, 0x006e, Qt::Key_N, ModAltGr, IsLetter, 0x0000 },
+ { 49, 0x004e, Qt::Key_N, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(Qt::Key_N), ModControl, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(Qt::Key_N), ModShift | ModControl, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(Qt::Key_N), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(Qt::Key_N), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 49, 0x006e, QALT(Qt::Key_N), ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, QALT(Qt::Key_N), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, QALT(Qt::Key_N), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, QALT(Qt::Key_N), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(QALT(Qt::Key_N)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(QALT(Qt::Key_N)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(QALT(Qt::Key_N)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 49, 0x006e, QCTRL(QALT(Qt::Key_N)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, Qt::Key_M, ModPlain, IsLetter, 0x0000 },
+ { 50, 0x004d, Qt::Key_M, ModShift, IsLetter, 0x0000 },
+ { 50, 0x006d, Qt::Key_M, ModAltGr, IsLetter, 0x0000 },
+ { 50, 0x004d, Qt::Key_M, ModShift | ModAltGr, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(Qt::Key_M), ModControl, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(Qt::Key_M), ModShift | ModControl, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(Qt::Key_M), ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(Qt::Key_M), ModShift | ModAltGr | ModControl, IsLetter, 0x0000 },
+ { 50, 0x006d, QALT(Qt::Key_M), ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, QALT(Qt::Key_M), ModShift | ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, QALT(Qt::Key_M), ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, QALT(Qt::Key_M), ModShift | ModAltGr | ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(QALT(Qt::Key_M)), ModControl | ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(QALT(Qt::Key_M)), ModShift | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(QALT(Qt::Key_M)), ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 50, 0x006d, QCTRL(QALT(Qt::Key_M)), ModShift | ModAltGr | ModControl | ModAlt, IsLetter, 0x0000 },
+ { 51, 0x002c, Qt::Key_Comma, ModPlain, NoFlags, 0x0000 },
+ { 51, 0x003c, Qt::Key_Less, ModShift, NoFlags, 0x0000 },
+ { 52, 0x002e, Qt::Key_Period, ModPlain, NoFlags, 0x0000 },
+ { 52, 0x003e, Qt::Key_Greater, ModShift, NoFlags, 0x0000 },
+ { 52, 0xffff, Qt::Key_Multi_key, ModAltGr, NoFlags, 0x0000 },
+ { 53, 0x002f, Qt::Key_Slash, ModPlain, NoFlags, 0x0000 },
+ { 53, 0x003f, Qt::Key_Question, ModShift, NoFlags, 0x0000 },
+ { 53, 0xffff, Qt::Key_Backspace, ModControl, NoFlags, 0x0000 },
+ { 54, 0xffff, Qt::Key_Shift, ModPlain, IsModifier, ModShift },
+ { 55, 0x002a, QKEYPAD(Qt::Key_Asterisk), ModPlain, NoFlags, 0x0000 },
+ { 56, 0xffff, Qt::Key_Alt, ModPlain, IsModifier, ModAlt },
+ { 57, 0x0020, Qt::Key_Space, ModPlain, NoFlags, 0x0000 },
+ { 58, 0xffff, Qt::Key_CapsLock, ModPlain, NoFlags, 0x0000 },
+ { 59, 0xffff, Qt::Key_F1, ModPlain, NoFlags, 0x0000 },
+ { 59, 0xffff, Qt::Key_F13, ModShift, NoFlags, 0x0000 },
+ { 59, 0xffff, Qt::Key_F25, ModControl, NoFlags, 0x0000 },
+ { 60, 0xffff, Qt::Key_F2, ModPlain, NoFlags, 0x0000 },
+ { 60, 0xffff, Qt::Key_F14, ModShift, NoFlags, 0x0000 },
+ { 60, 0xffff, Qt::Key_F26, ModControl, NoFlags, 0x0000 },
+ { 61, 0xffff, Qt::Key_F3, ModPlain, NoFlags, 0x0000 },
+ { 61, 0xffff, Qt::Key_F15, ModShift, NoFlags, 0x0000 },
+ { 61, 0xffff, Qt::Key_F27, ModControl, NoFlags, 0x0000 },
+ { 62, 0xffff, Qt::Key_F4, ModPlain, NoFlags, 0x0000 },
+ { 62, 0xffff, Qt::Key_F16, ModShift, NoFlags, 0x0000 },
+ { 62, 0xffff, Qt::Key_F28, ModControl, NoFlags, 0x0000 },
+ { 63, 0xffff, Qt::Key_F5, ModPlain, NoFlags, 0x0000 },
+ { 63, 0xffff, Qt::Key_F17, ModShift, NoFlags, 0x0000 },
+ { 63, 0xffff, Qt::Key_F29, ModControl, NoFlags, 0x0000 },
+ { 64, 0xffff, Qt::Key_F6, ModPlain, NoFlags, 0x0000 },
+ { 64, 0xffff, Qt::Key_F18, ModShift, NoFlags, 0x0000 },
+ { 64, 0xffff, Qt::Key_F30, ModControl, NoFlags, 0x0000 },
+ { 65, 0xffff, Qt::Key_F7, ModPlain, NoFlags, 0x0000 },
+ { 65, 0xffff, Qt::Key_F19, ModShift, NoFlags, 0x0000 },
+ { 65, 0xffff, Qt::Key_F31, ModControl, NoFlags, 0x0000 },
+ { 66, 0xffff, Qt::Key_F8, ModPlain, NoFlags, 0x0000 },
+ { 66, 0xffff, Qt::Key_F20, ModShift, NoFlags, 0x0000 },
+ { 66, 0xffff, Qt::Key_F32, ModControl, NoFlags, 0x0000 },
+ { 67, 0xffff, Qt::Key_F9, ModPlain, NoFlags, 0x0000 },
+ { 67, 0xffff, Qt::Key_F21, ModShift, NoFlags, 0x0000 },
+ { 67, 0xffff, Qt::Key_F33, ModControl, NoFlags, 0x0000 },
+ { 68, 0xffff, Qt::Key_F10, ModPlain, NoFlags, 0x0000 },
+ { 68, 0xffff, Qt::Key_F22, ModShift, NoFlags, 0x0000 },
+ { 68, 0xffff, Qt::Key_F34, ModControl, NoFlags, 0x0000 },
+ { 69, 0xffff, Qt::Key_NumLock, ModPlain, NoFlags, 0x0000 },
+ { 70, 0xffff, Qt::Key_ScrollLock, ModPlain, NoFlags, 0x0000 },
+ { 70, 0xffff, Qt::Key_ScrollLock, ModAlt, NoFlags, 0x0000 },
+ { 71, 0x0037, QKEYPAD(Qt::Key_7), ModPlain, NoFlags, 0x0000 },
+ { 72, 0x0038, QKEYPAD(Qt::Key_8), ModPlain, NoFlags, 0x0000 },
+ { 73, 0x0039, QKEYPAD(Qt::Key_9), ModPlain, NoFlags, 0x0000 },
+ { 74, 0x002d, QKEYPAD(Qt::Key_Minus), ModPlain, NoFlags, 0x0000 },
+ { 75, 0x0034, QKEYPAD(Qt::Key_4), ModPlain, NoFlags, 0x0000 },
+ { 76, 0x0035, QKEYPAD(Qt::Key_5), ModPlain, NoFlags, 0x0000 },
+ { 77, 0x0036, QKEYPAD(Qt::Key_6), ModPlain, NoFlags, 0x0000 },
+ { 78, 0x002b, QKEYPAD(Qt::Key_Plus), ModPlain, NoFlags, 0x0000 },
+ { 79, 0x0031, QKEYPAD(Qt::Key_1), ModPlain, NoFlags, 0x0000 },
+ { 80, 0x0032, QKEYPAD(Qt::Key_2), ModPlain, NoFlags, 0x0000 },
+ { 81, 0x0033, QKEYPAD(Qt::Key_3), ModPlain, NoFlags, 0x0000 },
+ { 82, 0x0030, QKEYPAD(Qt::Key_0), ModPlain, NoFlags, 0x0000 },
+ { 83, 0x002e, QKEYPAD(Qt::Key_Period), ModPlain, NoFlags, 0x0000 },
+ { 86, 0x003c, Qt::Key_Less, ModPlain, NoFlags, 0x0000 },
+ { 86, 0x003e, Qt::Key_Greater, ModShift, NoFlags, 0x0000 },
+ { 86, 0x007c, Qt::Key_Bar, ModAltGr, NoFlags, 0x0000 },
+ { 87, 0xffff, Qt::Key_F11, ModPlain, NoFlags, 0x0000 },
+ { 87, 0xffff, Qt::Key_F23, ModShift, NoFlags, 0x0000 },
+ { 87, 0xffff, Qt::Key_F35, ModControl, NoFlags, 0x0000 },
+ { 88, 0xffff, Qt::Key_F12, ModPlain, NoFlags, 0x0000 },
+ { 88, 0xffff, Qt::Key_F24, ModShift, NoFlags, 0x0000 },
+ { 89, 0xffff, QKEYPAD(Qt::Key_Enter), ModPlain, NoFlags, 0x0000 },
+ { 90, 0xffff, Qt::Key_Control, ModPlain, IsModifier, ModControl },
+ { 91, 0x002f, QKEYPAD(Qt::Key_Slash), ModPlain, NoFlags, 0x0000 },
+ { 92, 0x005c, QCTRL(Qt::Key_Backslash), ModPlain, NoFlags, 0x0000 },
+ { 93, 0xffff, Qt::Key_AltGr, ModPlain, IsModifier, ModAltGr },
+ { 94, 0xffff, Qt::Key_Home, ModPlain, NoFlags, 0x0000 },
+ { 95, 0xffff, Qt::Key_Up, ModPlain, NoFlags, 0x0000 },
+ { 96, 0xffff, Qt::Key_PageUp, ModPlain, NoFlags, 0x0000 },
+ { 97, 0xffff, Qt::Key_Left, ModPlain, NoFlags, 0x0000 },
+ { 98, 0xffff, Qt::Key_Right, ModPlain, NoFlags, 0x0000 },
+ { 99, 0xffff, Qt::Key_End, ModPlain, NoFlags, 0x0000 },
+ { 100, 0xffff, Qt::Key_Down, ModPlain, NoFlags, 0x0000 },
+ { 101, 0xffff, Qt::Key_PageDown, ModPlain, NoFlags, 0x0000 },
+ { 102, 0xffff, Qt::Key_Insert, ModPlain, NoFlags, 0x0000 },
+ { 103, 0xffff, Qt::Key_Delete, ModPlain, NoFlags, 0x0000 },
+};
+
+#endif // QBSDKEYBOARD_DEFAULTMAP_P_H
diff --git a/src/plugins/generic/bsdmouse/bsdmouse.json b/src/plugins/generic/bsdmouse/bsdmouse.json
new file mode 100644
index 0000000000..33974a62f2
--- /dev/null
+++ b/src/plugins/generic/bsdmouse/bsdmouse.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "BsdMouse" ]
+}
diff --git a/src/plugins/generic/bsdmouse/bsdmouse.pro b/src/plugins/generic/bsdmouse/bsdmouse.pro
new file mode 100644
index 0000000000..11949b95d5
--- /dev/null
+++ b/src/plugins/generic/bsdmouse/bsdmouse.pro
@@ -0,0 +1,16 @@
+TARGET = qbsdmouseplugin
+
+PLUGIN_TYPE = generic
+PLUGIN_EXTENDS = -
+PLUGIN_CLASS_NAME = QBsdMousePlugin
+load(qt_plugin)
+
+QT += core-private gui-private
+
+HEADERS = qbsdmouse.h
+SOURCES = main.cpp \
+ qbsdmouse.cpp
+
+OTHER_FILES += \
+ qbsdmouse.json
+
diff --git a/src/plugins/generic/bsdmouse/main.cpp b/src/plugins/generic/bsdmouse/main.cpp
new file mode 100644
index 0000000000..4abc7609c1
--- /dev/null
+++ b/src/plugins/generic/bsdmouse/main.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qgenericplugin.h>
+#include "qbsdmouse.h"
+
+QT_BEGIN_NAMESPACE
+
+class QBsdMousePlugin : public QGenericPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "bsdmouse.json")
+
+public:
+ QObject *create(const QString &key, const QString &specification) override;
+};
+
+QObject *QBsdMousePlugin::create(const QString &key, const QString &specification)
+{
+ if (!key.compare(QLatin1String("BsdMouse"), Qt::CaseInsensitive))
+ return new QBsdMouseHandler(key, specification);
+
+ return nullptr;
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/generic/bsdmouse/qbsdmouse.cpp b/src/plugins/generic/bsdmouse/qbsdmouse.cpp
new file mode 100644
index 0000000000..4875fd96bd
--- /dev/null
+++ b/src/plugins/generic/bsdmouse/qbsdmouse.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbsdmouse.h"
+
+#include <QSocketNotifier>
+#include <QStringList>
+#include <QPoint>
+#include <QGuiApplication>
+#include <qpa/qwindowsysteminterface.h>
+#include <private/qguiapplication_p.h>
+#include <private/qinputdevicemanager_p_p.h>
+
+#include <private/qcore_unix_p.h>
+#include <qdebug.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/mouse.h>
+#include <unistd.h>
+
+QT_BEGIN_NAMESPACE
+
+enum {
+ PsmLevelBasic = 0,
+ PsmLevelExtended = 1,
+ PsmLevelNative = 2
+};
+
+QBsdMouseHandler::QBsdMouseHandler(const QString &key, const QString &specification)
+{
+ Q_UNUSED(key);
+
+ setObjectName(QLatin1String("BSD Sysmouse Handler"));
+
+ QByteArray device;
+ if (specification.startsWith("/dev/"))
+ device = QFile::encodeName(specification);
+
+ if (device.isEmpty())
+ device = QByteArrayLiteral("/dev/sysmouse");
+
+ m_devFd = QT_OPEN(device.constData(), O_RDONLY);
+ if (m_devFd < 0) {
+ qErrnoWarning(errno, "open(%s) failed", device.constData());
+ return;
+ }
+
+ int level = 0;
+ if (ioctl(m_devFd, MOUSE_GETLEVEL, &level)) {
+ qErrnoWarning(errno, "ioctl(%s, MOUSE_GETLEVEL) failed", device.constData());
+ close(m_devFd);
+ m_devFd = -1;
+ return;
+ }
+
+ switch (level) {
+ case PsmLevelBasic:
+ m_packetSize = 5;
+ break;
+ case PsmLevelExtended:
+ m_packetSize = 8;
+ break;
+ default:
+ qWarning("Unsupported mouse device operation level: %d", level);
+ close(m_devFd);
+ m_devFd = -1;
+ return;
+ }
+
+ if (fcntl(m_devFd, F_SETFL, O_NONBLOCK)) {
+ qErrnoWarning(errno, "fcntl(%s, F_SETFL, O_NONBLOCK) failed", device.constData());
+ close(m_devFd);
+ m_devFd = -1;
+ return;
+ }
+
+ m_notifier.reset(new QSocketNotifier(m_devFd, QSocketNotifier::Read, this));
+ connect(m_notifier.data(), &QSocketNotifier::activated, this, &QBsdMouseHandler::readMouseData);
+ QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
+ QInputDeviceManager::DeviceTypePointer, 1);
+}
+
+QBsdMouseHandler::~QBsdMouseHandler()
+{
+ if (m_devFd != -1)
+ close(m_devFd);
+}
+
+void QBsdMouseHandler::readMouseData()
+{
+ if (m_devFd < 0)
+ return;
+
+ if (m_packetSize == 0)
+ return;
+
+ // packet format described in mouse(4)
+ qint8 packet[MOUSE_SYS_PACKETSIZE];
+ quint8 status = 0;
+ while (read(m_devFd, packet, m_packetSize) == m_packetSize) {
+ const qint16 relx = packet[1] + packet[3];
+ const qint16 rely = -(packet[2] + packet[4]);
+
+ m_x += relx;
+ m_y += rely;
+
+ status = packet[0] & MOUSE_SYS_STDBUTTONS;
+ }
+
+ // clamp to screen geometry
+ const QRect g = QGuiApplication::primaryScreen()->virtualGeometry();
+ if (m_x + m_xOffset < g.left())
+ m_x = g.left() - m_xOffset;
+ else if (m_x + m_xOffset > g.right())
+ m_x = g.right() - m_xOffset;
+
+ if (m_y + m_yOffset < g.top())
+ m_y = g.top() - m_yOffset;
+ else if (m_y + m_yOffset > g.bottom())
+ m_y = g.bottom() - m_yOffset;
+
+ const QPoint pos(m_x + m_xOffset, m_y + m_yOffset);
+ m_buttons = Qt::NoButton;
+ if (!(status & MOUSE_SYS_BUTTON1UP))
+ m_buttons |= Qt::LeftButton;
+ if (!(status & MOUSE_SYS_BUTTON2UP))
+ m_buttons |= Qt::MiddleButton;
+ if (!(status & MOUSE_SYS_BUTTON3UP))
+ m_buttons |= Qt::RightButton;
+
+ QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/generic/bsdmouse/qbsdmouse.h b/src/plugins/generic/bsdmouse/qbsdmouse.h
new file mode 100644
index 0000000000..9a4cb8dd82
--- /dev/null
+++ b/src/plugins/generic/bsdmouse/qbsdmouse.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBSDMOUSE_H
+#define QBSDMOUSE_H
+
+#include <QString>
+#include <QScopedPointer>
+#include <QSocketNotifier>
+
+#include <qobject.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSocketNotifier;
+
+class QBsdMouseHandler : public QObject
+{
+ Q_OBJECT
+public:
+ QBsdMouseHandler(const QString &key, const QString &specification);
+ ~QBsdMouseHandler() override;
+
+private:
+ void readMouseData();
+
+private:
+ QScopedPointer<QSocketNotifier> m_notifier;
+ int m_devFd = -1;
+ int m_packetSize = 0;
+ int m_x = 0;
+ int m_y = 0;
+ int m_xOffset = 0;
+ int m_yOffset = 0;
+ Qt::MouseButtons m_buttons = Qt::NoButton;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBSDMOUSE_H
diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro
index 0c1943b7dd..996e57d015 100644
--- a/src/plugins/generic/generic.pro
+++ b/src/plugins/generic/generic.pro
@@ -1,19 +1,22 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += gui-private network-private
-load(qfeatures)
-
-contains(QT_CONFIG, evdev) {
+qtConfig(evdev) {
SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet
}
-contains(QT_CONFIG, tslib) {
+qtConfig(tslib) {
SUBDIRS += tslib
}
-!contains(QT_DISABLED_FEATURES, udpsocket) {
+qtConfig(udpsocket) {
SUBDIRS += tuiotouch
}
-contains(QT_CONFIG, libinput) {
+qtConfig(libinput) {
SUBDIRS += libinput
}
+
+freebsd {
+ SUBDIRS += bsdkeyboard bsdmouse
+}
diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro
index 200d231cc8..d6a0eea3a0 100644
--- a/src/plugins/generic/tslib/tslib.pro
+++ b/src/plugins/generic/tslib/tslib.pro
@@ -4,7 +4,7 @@ SOURCES = main.cpp
QT += gui-private platformsupport-private
-LIBS += -lts
+QMAKE_USE += tslib
OTHER_FILES += tslib.json
diff --git a/src/plugins/generic/tuiotouch/qoscbundle.cpp b/src/plugins/generic/tuiotouch/qoscbundle.cpp
index 6ddca9b09d..b84ae39aca 100644
--- a/src/plugins/generic/tuiotouch/qoscbundle.cpp
+++ b/src/plugins/generic/tuiotouch/qoscbundle.cpp
@@ -38,17 +38,20 @@
**
****************************************************************************/
+#include "qoscbundle_p.h"
+#include "qtuio_p.h"
+
#include <QtEndian>
#include <QDebug>
#include <QLoggingCategory>
-#include "qoscbundle_p.h"
-#include "qtuio_p.h"
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcTuioBundle, "qt.qpa.tuio.bundle")
+QOscBundle::QOscBundle() {}
+
// TUIO packets are transmitted using the OSC protocol, located at:
// http://opensoundcontrol.org/specification
// Snippets of this specification have been pasted into the source as a means of
@@ -172,21 +175,5 @@ QOscBundle::QOscBundle(const QByteArray &data)
}
}
-
-bool QOscBundle::isValid() const
-{
- return m_isValid;
-}
-
-QList<QOscBundle> QOscBundle::bundles() const
-{
- return m_bundles;
-}
-
-QList<QOscMessage> QOscBundle::messages() const
-{
- return m_messages;
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/generic/tuiotouch/qoscbundle_p.h b/src/plugins/generic/tuiotouch/qoscbundle_p.h
index e95a202ae7..cb3ec4d251 100644
--- a/src/plugins/generic/tuiotouch/qoscbundle_p.h
+++ b/src/plugins/generic/tuiotouch/qoscbundle_p.h
@@ -43,25 +43,32 @@
#include "qoscmessage_p.h"
+#include <QtCore/QVector>
+
QT_BEGIN_NAMESPACE
+class QByteArray;
+
class QOscBundle
{
+ QOscBundle(); // for QVector, don't use
+ friend class QVector<QOscBundle>;
public:
- QOscBundle(const QByteArray &data);
+ explicit QOscBundle(const QByteArray &data);
- bool isValid() const;
- QList<QOscBundle> bundles() const;
- QList<QOscMessage> messages() const;
+ bool isValid() const { return m_isValid; }
+ QVector<QOscBundle> bundles() const { return m_bundles; }
+ QVector<QOscMessage> messages() const { return m_messages; }
private:
bool m_isValid;
bool m_immediate;
quint32 m_timeEpoch;
quint32 m_timePico;
- QList<QOscBundle> m_bundles;
- QList<QOscMessage> m_messages;
+ QVector<QOscBundle> m_bundles;
+ QVector<QOscMessage> m_messages;
};
+Q_DECLARE_TYPEINFO(QOscBundle, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
diff --git a/src/plugins/generic/tuiotouch/qoscmessage.cpp b/src/plugins/generic/tuiotouch/qoscmessage.cpp
index 6f82cd784b..b2004903bd 100644
--- a/src/plugins/generic/tuiotouch/qoscmessage.cpp
+++ b/src/plugins/generic/tuiotouch/qoscmessage.cpp
@@ -38,19 +38,19 @@
**
****************************************************************************/
-#include <QByteArray>
+#include "qoscmessage_p.h"
+#include "qtuio_p.h"
+
#include <QDebug>
#include <QtEndian>
-#include <QVariant>
#include <QLoggingCategory>
-#include "qoscmessage_p.h"
-#include "qtuio_p.h"
-
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcTuioMessage, "qt.qpa.tuio.message")
+QOscMessage::QOscMessage() {}
+
// TUIO packets are transmitted using the OSC protocol, located at:
// http://opensoundcontrol.org/specification
// Snippets of this specification have been pasted into the source as a means of
@@ -125,20 +125,5 @@ QOscMessage::QOscMessage(const QByteArray &data)
qCDebug(lcTuioMessage) << "Message with address pattern: " << addressPattern << " arguments: " << arguments;
}
-bool QOscMessage::isValid() const
-{
- return m_isValid;
-}
-
-QByteArray QOscMessage::addressPattern() const
-{
- return m_addressPattern;
-}
-
-QList<QVariant> QOscMessage::arguments() const
-{
- return m_arguments;
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/generic/tuiotouch/qoscmessage_p.h b/src/plugins/generic/tuiotouch/qoscmessage_p.h
index 788a03e504..76d40ceb18 100644
--- a/src/plugins/generic/tuiotouch/qoscmessage_p.h
+++ b/src/plugins/generic/tuiotouch/qoscmessage_p.h
@@ -41,22 +41,32 @@
#ifndef QOSCMESSAGE_P_H
#define QOSCMESSAGE_P_H
+#include <QtCore/QByteArray>
+#include <QtCore/QVariant>
+#include <QtCore/QVector>
+#include <QtCore/QList>
+
+
QT_BEGIN_NAMESPACE
class QOscMessage
{
+ QOscMessage(); // for QVector, don't use
+ friend class QVector<QOscMessage>;
public:
- QOscMessage(const QByteArray &data);
- bool isValid() const;
+ explicit QOscMessage(const QByteArray &data);
+
+ bool isValid() const { return m_isValid; }
- QByteArray addressPattern() const;
- QList<QVariant> arguments() const;
+ QByteArray addressPattern() const { return m_addressPattern; }
+ QList<QVariant> arguments() const { return m_arguments; }
private:
bool m_isValid;
QByteArray m_addressPattern;
QList<QVariant> m_arguments;
};
+Q_DECLARE_TYPEINFO(QOscMessage, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
diff --git a/src/plugins/generic/tuiotouch/qtuiocursor_p.h b/src/plugins/generic/tuiotouch/qtuiocursor_p.h
index 2ff762b836..46134e6f3f 100644
--- a/src/plugins/generic/tuiotouch/qtuiocursor_p.h
+++ b/src/plugins/generic/tuiotouch/qtuiocursor_p.h
@@ -102,6 +102,7 @@ private:
float m_acceleration;
Qt::TouchPointState m_state;
};
+Q_DECLARE_TYPEINFO(QTuioCursor, Q_MOVABLE_TYPE); // Q_PRIMITIVE_TYPE: not possible, m_state is = 1, not 0.
QT_END_NAMESPACE
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index 5d34e0ea38..26b88d6d78 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -38,23 +38,34 @@
**
****************************************************************************/
-#include <QLoggingCategory>
-#include <QRect>
-#include <QWindow>
-#include <QGuiApplication>
-#include <QTouchDevice>
-
-#include <qpa/qwindowsysteminterface.h>
+#include "qtuiohandler_p.h"
#include "qtuiocursor_p.h"
-#include "qtuiohandler_p.h"
+#include "qtuiotoken_p.h"
#include "qoscbundle_p.h"
+#include "qoscmessage_p.h"
+
+#include <qpa/qwindowsysteminterface.h>
+
+#include <QTouchDevice>
+#include <QWindow>
+#include <QGuiApplication>
+
+#include <QLoggingCategory>
+#include <QRect>
+#include <qmath.h>
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
{
@@ -143,7 +154,7 @@ void QTuioHandler::processPackets()
// messages. The FSEQ frame ID is incremented for each delivered bundle,
// while redundant bundles can be marked using the frame sequence ID
// -1."
- QList<QOscMessage> messages;
+ QVector<QOscMessage> messages;
QOscBundle bundle(datagram);
if (bundle.isValid()) {
@@ -157,29 +168,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;
}
}
@@ -327,11 +358,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);
@@ -341,12 +367,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);
@@ -356,5 +382,180 @@ 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();
+
+ // 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..b784190d53
--- /dev/null
+++ b/src/plugins/generic/tuiotouch/qtuiotoken_p.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** 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;
+};
+Q_DECLARE_TYPEINFO(QTuioToken, Q_MOVABLE_TYPE); // Q_PRIMITIVE_TYPE: not possible: m_id, m_classId == -1
+
+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..08f7036c92 100644
--- a/src/plugins/generic/tuiotouch/tuiotouch.pro
+++ b/src/plugins/generic/tuiotouch/tuiotouch.pro
@@ -15,11 +15,13 @@ HEADERS += \
qoscbundle_p.h \
qoscmessage_p.h \
qtuiohandler_p.h \
- qtuiocursor_p.h
+ qtuiocursor_p.h \
+ qtuiotoken_p.h
OTHER_FILES += \
tuiotouch.json
+DEFINES += QT_NO_FOREACH
PLUGIN_TYPE = generic
PLUGIN_EXTENDS = -
PLUGIN_CLASS_NAME = QTuioTouchPlugin
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 bae74bf9a1..bae74bf9a1 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..9d1c0c8fdf 100644
--- a/src/plugins/imageformats/imageformats.pro
+++ b/src/plugins/imageformats/imageformats.pro
@@ -1,5 +1,6 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += gui-private
-!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
+qtConfig(ico): SUBDIRS += ico
+qtConfig(jpeg): SUBDIRS += jpeg
+qtConfig(gif): SUBDIRS += gif
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index 526556179c..89476e62f5 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -1,13 +1,16 @@
TARGET = qjpeg
-QT += core-private
+QT += core-private gui-private
-QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)"
+SOURCES += main.cpp qjpeghandler.cpp
+HEADERS += main.h qjpeghandler_p.h
+
+qtConfig(system-jpeg) {
+ QMAKE_USE += libjpeg
+} 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..d89b8d398b 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -45,6 +45,7 @@
#include <qbuffer.h>
#include <qmath.h>
#include <private/qsimd_p.h>
+#include <private/qimage_p.h> // for qt_getImageText
#include <stdio.h> // jpeglib needs this to be pre-included
#include <setjmp.h>
@@ -491,30 +492,10 @@ inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device)
free_in_buffer = max_buf;
}
-
static inline void set_text(const QImage &image, j_compress_ptr cinfo, const QString &description)
{
- QMap<QString, QString> text;
- foreach (const QString &key, image.textKeys()) {
- if (!key.isEmpty())
- text.insert(key, image.text(key));
- }
- foreach (const QString &pair, description.split(QLatin1String("\n\n"))) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
- QString s = pair.simplified();
- if (!s.isEmpty())
- text.insert(QLatin1String("Description"), s);
- } else {
- QString key = pair.left(index);
- if (!key.simplified().isEmpty())
- text.insert(key, pair.mid(index + 2).simplified());
- }
- }
- if (text.isEmpty())
- return;
-
- for (QMap<QString, QString>::ConstIterator it = text.constBegin(); it != text.constEnd(); ++it) {
+ const QMap<QString, QString> text = qt_getImageText(image, description);
+ for (auto it = text.begin(), end = text.end(); it != end; ++it) {
QByteArray comment = it.key().toLatin1();
if (!comment.isEmpty())
comment += ": ";
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/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro
index 86bdd4729b..17284874f6 100644
--- a/src/plugins/platforminputcontexts/compose/compose.pro
+++ b/src/plugins/platforminputcontexts/compose/compose.pro
@@ -12,13 +12,10 @@ HEADERS += $$PWD/qcomposeplatforminputcontext.h \
$$PWD/generator/qtablegenerator.h \
# libxkbcommon
-contains(QT_CONFIG, xkbcommon-qt): {
- # dont't need x11 dependency for compose key plugin
- QT_CONFIG -= use-xkbcommon-x11support
+!qtConfig(xkbcommon-system) {
include(../../../3rdparty/xkbcommon.pri)
} else {
- LIBS += $$QMAKE_LIBS_XKBCOMMON
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+ QMAKE_USE += xkbcommon
}
OTHER_FILES += $$PWD/compose.json
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index 200d5789a8..736c66ebc0 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -101,11 +101,13 @@ QIBusPlatformInputContext::QIBusPlatformInputContext ()
QString socketPath = QIBusPlatformInputContextPrivate::getSocketPath();
QFile file(socketPath);
if (file.open(QFile::ReadOnly)) {
+#ifndef QT_NO_FILESYSTEMWATCHER
// If KDE session save is used or restart ibus-daemon,
// the applications could run before ibus-daemon runs.
// We watch the getSocketPath() to get the launching ibus-daemon.
m_socketWatcher.addPath(socketPath);
connect(&m_socketWatcher, SIGNAL(fileChanged(QString)), this, SLOT(socketChanged(QString)));
+#endif
}
m_timer.setSingleShot(true);
@@ -278,7 +280,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);
@@ -408,8 +410,10 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
&& window != NULL) {
const QPoint globalPos = window->screen()->handle()->cursor()->pos();
const QPoint pos = window->mapFromGlobal(globalPos);
+#ifndef QT_NO_CONTEXTMENU
QWindowSystemInterface::handleContextMenuEvent(window, false, pos,
globalPos, modifiers);
+#endif
}
#endif // QT_NO_CONTEXTMENU
QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers,
@@ -449,8 +453,10 @@ void QIBusPlatformInputContext::connectToBus()
d->initBus();
connectToContextSignals();
+#ifndef QT_NO_FILESYSTEMWATCHER
if (m_socketWatcher.files().size() == 0)
m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath());
+#endif
}
void QIBusPlatformInputContext::globalEngineChanged(const QString &engine_name)
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
index 4f2722480e..94fa5c3d60 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
@@ -110,7 +110,9 @@ public Q_SLOTS:
private:
QIBusPlatformInputContextPrivate *d;
bool m_eventFilterUseSynchronousMode;
+#ifndef QT_NO_FILESYSTEMWATCHER
QFileSystemWatcher m_socketWatcher;
+#endif
QTimer m_timer;
void connectToContextSignals();
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
index ac82fa3931..a2551f1320 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
@@ -73,10 +73,7 @@ void QIBusSerializable::serializeTo(QDBusArgument &argument) const
argument.beginMap(qMetaTypeId<QString>(), qMetaTypeId<QDBusVariant>());
- QHashIterator<QString, QDBusArgument> i(attachments);
- while (i.hasNext()) {
- i.next();
-
+ for (auto i = attachments.begin(), end = attachments.end(); i != end; ++i) {
argument.beginMapEntry();
argument << i.key();
diff --git a/src/plugins/platforminputcontexts/platforminputcontexts.pro b/src/plugins/platforminputcontexts/platforminputcontexts.pro
index faea54b874..ed6b1b8702 100644
--- a/src/plugins/platforminputcontexts/platforminputcontexts.pro
+++ b/src/plugins/platforminputcontexts/platforminputcontexts.pro
@@ -1,9 +1,10 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += gui-private
qtHaveModule(dbus) {
!mac:!win32:SUBDIRS += ibus
}
-contains(QT_CONFIG, xcb-plugin): SUBDIRS += compose
+qtConfig(xcb): SUBDIRS += compose
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index 5be128a0c5..5f05ab395e 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -1,7 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -120,6 +121,12 @@ namespace QtAndroidInput
return m_softwareKeyboardRect;
}
+ void updateHandles(int mode, QPoint cursor, QPoint anchor)
+ {
+ QJNIObjectPrivate::callStaticMethod<void>(applicationClass(), "updateHandles", "(IIIII)V",
+ mode, cursor.x(), cursor.y(), anchor.x(),
+ anchor.y());
+ }
static void mouseDown(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
{
@@ -168,6 +175,10 @@ namespace QtAndroidInput
static void longPress(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
{
+ QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
+ if (inputContext && qGuiApp)
+ QMetaObject::invokeMethod(inputContext, "longPress", Q_ARG(int, x), Q_ARG(int, y));
+
//### TODO: add proper API for Qt 5.2
static bool rightMouseFromLongPress = qEnvironmentVariableIntValue("QT_NECESSITAS_COMPATIBILITY_LONG_PRESS");
if (!rightMouseFromLongPress)
@@ -225,6 +236,12 @@ namespace QtAndroidInput
double(dw*size),
double(dh*size));
m_touchPoints.push_back(touchPoint);
+
+ if (state == Qt::TouchPointPressed) {
+ QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
+ if (inputContext && qGuiApp)
+ QMetaObject::invokeMethod(inputContext, "touchDown", Q_ARG(int, x), Q_ARG(int, y));
+ }
}
static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint /*action*/)
@@ -786,6 +803,18 @@ namespace QtAndroidInput
#endif
}
+ static void handleLocationChanged(JNIEnv */*env*/, jobject /*thiz*/, int id, int x, int y)
+ {
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << "@@@ handleLocationChanged" << id << x << y;
+#endif
+ QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
+ if (inputContext && qGuiApp)
+ QMetaObject::invokeMethod(inputContext, "handleLocationChanged",
+ Q_ARG(int, id), Q_ARG(int, x), Q_ARG(int, y));
+
+ }
+
static JNINativeMethod methods[] = {
{"touchBegin","(I)V",(void*)touchBegin},
{"touchAdd","(IIIZIIFF)V",(void*)touchAdd},
@@ -799,7 +828,8 @@ namespace QtAndroidInput
{"keyDown", "(IIIZ)V", (void *)keyDown},
{"keyUp", "(IIIZ)V", (void *)keyUp},
{"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged},
- {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged}
+ {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged},
+ {"handleLocationChanged", "(III)V", (void *)handleLocationChanged}
};
bool registerNatives(JNIEnv *env)
diff --git a/src/plugins/platforms/android/androidjniinput.h b/src/plugins/platforms/android/androidjniinput.h
index 682abde098..af18a96dc1 100644
--- a/src/plugins/platforms/android/androidjniinput.h
+++ b/src/plugins/platforms/android/androidjniinput.h
@@ -39,6 +39,7 @@
#ifndef ANDROIDJNIINPUT_H
#define ANDROIDJNIINPUT_H
+
#include <jni.h>
#include <QtCore/qglobal.h>
#include <QtCore/QRect>
@@ -56,6 +57,9 @@ namespace QtAndroidInput
void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd);
// Software keyboard support
+ // cursor/selection handles
+ void updateHandles(int handleCount, QPoint cursor = QPoint(), QPoint anchor = QPoint());
+
bool registerNatives(JNIEnv *env);
}
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index dc420775cf..06a9c8c488 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -2,6 +2,7 @@
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -342,9 +343,28 @@ static JNINativeMethod methods[] = {
{"updateCursorPosition", "()Z", (void *)updateCursorPosition}
};
+static QRect inputItemRectangle()
+{
+ QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle();
+ QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect();
+ QWindow *window = qGuiApp->focusWindow();
+ if (window)
+ rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size());
+ double pixelDensity = window
+ ? QHighDpiScaling::factor(window)
+ : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
+ if (pixelDensity != 1.0) {
+ rect.setX(rect.x() * pixelDensity);
+ rect.setY(rect.y() * pixelDensity);
+ rect.setWidth(rect.width() * pixelDensity);
+ rect.setHeight(rect.height() * pixelDensity);
+ }
+ return rect;
+}
QAndroidInputContext::QAndroidInputContext()
- : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false), m_batchEditNestingLevel(0), m_focusObject(0)
+ : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false),
+ m_cursorHandleShown(CursorHandleNotShown), m_batchEditNestingLevel(0), m_focusObject(0)
{
jclass clazz = QJNIEnvironmentPrivate::findClass(QtNativeInputConnectionClassName);
if (Q_UNLIKELY(!clazz)) {
@@ -415,6 +435,9 @@ QAndroidInputContext::QAndroidInputContext()
qRegisterMetaType<QInputMethodEvent *>("QInputMethodEvent*");
qRegisterMetaType<QInputMethodQueryEvent *>("QInputMethodQueryEvent*");
m_androidInputContext = this;
+
+ QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged,
+ this, &QAndroidInputContext::updateSelectionHandles);
}
QAndroidInputContext::~QAndroidInputContext()
@@ -452,6 +475,7 @@ void QAndroidInputContext::reset()
{
clear();
m_batchEditNestingLevel = 0;
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown;
if (qGuiApp->focusObject()) {
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe(Qt::ImEnabled);
if (!query.isNull() && query->value(Qt::ImEnabled).toBool()) {
@@ -500,6 +524,119 @@ void QAndroidInputContext::updateCursorPosition()
}
}
+void QAndroidInputContext::updateSelectionHandles()
+{
+ auto im = qGuiApp->inputMethod();
+ if (!m_focusObject || (m_cursorHandleShown == CursorHandleNotShown)) {
+ // Hide the handles
+ QtAndroidInput::updateHandles(0);
+ return;
+ }
+ QWindow *window = qGuiApp->focusWindow();
+ double pixelDensity = window
+ ? QHighDpiScaling::factor(window)
+ : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition | Qt::ImEnabled);
+ QCoreApplication::sendEvent(m_focusObject, &query);
+ int cpos = query.value(Qt::ImCursorPosition).toInt();
+ int anchor = query.value(Qt::ImAnchorPosition).toInt();
+
+ if (cpos == anchor || im->anchorRectangle().isNull()) {
+ if (!query.value(Qt::ImEnabled).toBool()) {
+ QtAndroidInput::updateHandles(0);
+ return;
+ }
+
+ auto curRect = im->cursorRectangle();
+ QPoint cursorPoint(curRect.center().x(), curRect.bottom());
+ QPoint editMenuPoint(curRect.center().x(), curRect.top());
+ QtAndroidInput::updateHandles(m_cursorHandleShown, cursorPoint * pixelDensity,
+ editMenuPoint * pixelDensity);
+ return;
+ }
+
+ auto leftRect = im->cursorRectangle();
+ auto rightRect = im->anchorRectangle();
+ if (cpos > anchor)
+ std::swap(leftRect, rightRect);
+
+ QPoint leftPoint(leftRect.bottomLeft().toPoint() * pixelDensity);
+ QPoint righPoint(rightRect.bottomRight().toPoint() * pixelDensity);
+ QtAndroidInput::updateHandles(CursorHandleShowSelection, leftPoint, righPoint);
+
+ if (m_cursorHandleShown == CursorHandleShowPopup) {
+ // make sure the popup does not reappear when the selection menu closes
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown;
+ }
+}
+
+/*
+ Called from Java when a cursor/selection handle was dragged to a new position
+
+ handleId of 1 means the cursor handle, 2 means the left handle, 3 means the right handle
+ */
+void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y)
+{
+ auto im = qGuiApp->inputMethod();
+ auto leftRect = im->cursorRectangle();
+ // The handle is down of the cursor, but we want the position in the middle.
+ QWindow *window = qGuiApp->focusWindow();
+ double pixelDensity = window
+ ? QHighDpiScaling::factor(window)
+ : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
+ QPoint point(x / pixelDensity, y / pixelDensity);
+ y -= leftRect.width() / 2;
+ if (handleId == 1) {
+ setSelectionOnFocusObject(point, point);
+ return;
+ }
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition);
+ QCoreApplication::sendEvent(m_focusObject, &query);
+ int cpos = query.value(Qt::ImCursorPosition).toInt();
+ int anchor = query.value(Qt::ImAnchorPosition).toInt();
+
+ auto rightRect = im->anchorRectangle();
+ if (cpos > anchor)
+ std::swap(leftRect, rightRect);
+
+ if (handleId == 2) {
+ QPoint rightPoint(rightRect.center().toPoint());
+ setSelectionOnFocusObject(point, rightPoint);
+ } else if (handleId == 3) {
+ QPoint leftPoint(leftRect.center().toPoint());
+ setSelectionOnFocusObject(leftPoint, point);
+ }
+}
+
+void QAndroidInputContext::touchDown(int x, int y)
+{
+ if (m_focusObject && inputItemRectangle().contains(x, y) && !m_cursorHandleShown) {
+ // If the user touch the input rectangle, we can show the cursor handle
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleShowNormal;
+ updateSelectionHandles();
+ }
+}
+
+void QAndroidInputContext::longPress(int x, int y)
+{
+ if (m_focusObject && inputItemRectangle().contains(x, y)) {
+ // Show the paste menu if there is something to paste.
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleShowPopup;
+ updateSelectionHandles();
+ }
+}
+
+void QAndroidInputContext::keyDown()
+{
+ if (m_cursorHandleShown) {
+ // When the user enter text on the keyboard, we hide the cursor handle
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown;
+ updateSelectionHandles();
+ }
+}
+
void QAndroidInputContext::update(Qt::InputMethodQueries queries)
{
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe(queries);
@@ -543,22 +680,11 @@ void QAndroidInputContext::showInputPanel()
m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateCursorPosition()));
else
m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition()));
- QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle();
- QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect();
- QWindow *window = qGuiApp->focusWindow();
- if (window)
- rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size());
- double pixelDensity = window ? QHighDpiScaling::factor(window)
- : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
-
- QtAndroidInput::showSoftwareKeyboard(rect.left() * pixelDensity,
- rect.top() * pixelDensity,
- rect.width() * pixelDensity,
- rect.height() * pixelDensity,
+ QRect rect = inputItemRectangle();
+ QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(),
query->value(Qt::ImHints).toUInt(),
- query->value(Qt::ImEnterKeyType).toUInt()
- );
+ query->value(Qt::ImEnterKeyType).toUInt());
}
void QAndroidInputContext::showInputPanelLater(Qt::ApplicationState state)
@@ -601,6 +727,7 @@ void QAndroidInputContext::setFocusObject(QObject *object)
reset();
}
QPlatformInputContext::setFocusObject(object);
+ updateSelectionHandles();
}
jboolean QAndroidInputContext::beginBatchEdit()
@@ -645,7 +772,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 +818,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 +975,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);
@@ -859,6 +985,8 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur
QInputMethodEvent event(m_composingText, attributes);
sendInputMethodEventThreadSafe(&event);
+ QMetaObject::invokeMethod(this, "keyDown");
+
updateCursorPosition();
return JNI_TRUE;
@@ -921,7 +1049,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 +1083,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 +1098,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);
@@ -981,20 +1108,21 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end)
jboolean QAndroidInputContext::selectAll()
{
-#warning TODO
- return JNI_FALSE;
+ sendShortcut(QKeySequence::SelectAll);
+ return JNI_TRUE;
}
jboolean QAndroidInputContext::cut()
{
-#warning TODO
- return JNI_FALSE;
+ m_cursorHandleShown = CursorHandleNotShown;
+ sendShortcut(QKeySequence::Cut);
+ return JNI_TRUE;
}
jboolean QAndroidInputContext::copy()
{
-#warning TODO
- return JNI_FALSE;
+ sendShortcut(QKeySequence::Copy);
+ return JNI_TRUE;
}
jboolean QAndroidInputContext::copyURL()
@@ -1005,10 +1133,21 @@ jboolean QAndroidInputContext::copyURL()
jboolean QAndroidInputContext::paste()
{
-#warning TODO
- return JNI_FALSE;
+ m_cursorHandleShown = CursorHandleNotShown;
+ sendShortcut(QKeySequence::Paste);
+ return JNI_TRUE;
}
+void QAndroidInputContext::sendShortcut(const QKeySequence &sequence)
+{
+ for (int i = 0; i < sequence.count(); ++i) {
+ const int keys = sequence[i];
+ Qt::Key key = Qt::Key(keys & ~Qt::KeyboardModifierMask);
+ Qt::KeyboardModifiers mod = Qt::KeyboardModifiers(keys & Qt::KeyboardModifierMask);
+ QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyPress, key, mod));
+ QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyRelease, key, mod));
+ }
+}
Q_INVOKABLE QVariant QAndroidInputContext::queryFocusObjectUnsafe(Qt::InputMethodQuery query, QVariant argument)
{
diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h
index 5ab85dcab0..8a33ff71cc 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.h
+++ b/src/plugins/platforms/android/qandroidinputcontext.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -94,6 +95,7 @@ public:
bool isComposing() const;
void clear();
void setFocusObject(QObject *object);
+ void sendShortcut(const QKeySequence &);
//---------------//
jboolean beginBatchEdit();
@@ -117,6 +119,11 @@ public:
public slots:
void updateCursorPosition();
+ void updateSelectionHandles();
+ void handleLocationChanged(int handleId, int x, int y);
+ void touchDown(int x, int y);
+ void longPress(int x, int y);
+ void keyDown();
private slots:
void showInputPanelLater(Qt::ApplicationState);
@@ -138,6 +145,13 @@ private:
int m_composingCursor;
QMetaObject::Connection m_updateCursorPosConnection;
bool m_blockUpdateSelection;
+ enum CursorHandleShowMode {
+ CursorHandleNotShown,
+ CursorHandleShowNormal = 1,
+ CursorHandleShowSelection = 2,
+ CursorHandleShowPopup = 3
+ };
+ CursorHandleShowMode m_cursorHandleShown;
int m_batchEditNestingLevel;
QObject *m_focusObject;
};
diff --git a/src/plugins/platforms/android/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/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index f8d0b9c8ba..c4387c5d88 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -486,7 +486,7 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
if (ret > 0)
return ret;
- // fall through
+ Q_FALLTHROUGH();
}
default:
return QPlatformTheme::themeHint(hint);
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..9c25076c9c
--- /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 QT_CONFIG(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.take());
+}
+
+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()
+{
+#if QT_CONFIG(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/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 02d8b16110..d9d3cb1627 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -71,7 +71,7 @@ HEADERS += qcocoaintegration.h \
messages.h \
qcocoamimetypes.h
-contains(QT_CONFIG, opengl.*) {
+qtConfig(opengl.*) {
OBJECTIVE_SOURCES += qcocoaglcontext.mm
HEADERS += qcocoaglcontext.h
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.h b/src/plugins/platforms/cocoa/qcocoaapplication.h
index e92bef4011..7bd3c8c76c 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.h
@@ -95,7 +95,6 @@
@interface NSApplication (QT_MANGLE_NAMESPACE(QApplicationIntegration))
- (void)QT_MANGLE_NAMESPACE(qt_setDockMenu):(NSMenu *)newMenu;
-- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader);
- (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel;
- (void)QT_MANGLE_NAMESPACE(qt_sendPostedMessage):(NSEvent *)event;
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm
index c496134606..c5ae4bc2bf 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>
@@ -88,11 +88,6 @@ QT_USE_NAMESPACE
[[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] setDockMenu:newMenu];
}
-- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)
-{
- return [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] menuLoader];
-}
-
- (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel
{
Q_UNUSED(fontPanel);
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
index 68a028ed8a..59c71017e3 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h
@@ -95,14 +95,11 @@
@interface QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) : NSObject <NSApplicationDelegate> {
bool startedQuit;
NSMenu *dockMenu;
- QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader;
NSObject <NSApplicationDelegate> *reflectionDelegate;
bool inLaunch;
}
+ (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate;
- (void)setDockMenu:(NSMenu *)newMenu;
-- (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader;
-- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate;
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
- (void) removeAppleEventHandlers;
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index d18df35b80..4874fcf807 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -122,7 +122,6 @@ QT_END_NAMESPACE
{
sharedCocoaApplicationDelegate = nil;
[dockMenu release];
- [qtMenuLoader release];
if (reflectionDelegate) {
[[NSApplication sharedApplication] setDelegate:reflectionDelegate];
[reflectionDelegate release];
@@ -169,24 +168,12 @@ QT_END_NAMESPACE
return [[dockMenu retain] autorelease];
}
-- (void)setMenuLoader:(QCocoaMenuLoader *)menuLoader
-{
- [menuLoader retain];
- [qtMenuLoader release];
- qtMenuLoader = menuLoader;
-}
-
-- (QCocoaMenuLoader *)menuLoader
-{
- return [[qtMenuLoader retain] autorelease];
-}
-
- (BOOL) canQuit
{
[[NSApp mainMenu] cancelTracking];
bool handle_quit = true;
- NSMenuItem *quitMenuItem = [[[QCocoaApplicationDelegate sharedDelegate] menuLoader] quitMenuItem];
+ NSMenuItem *quitMenuItem = [[QT_MANGLE_NAMESPACE(QCocoaMenuLoader) sharedMenuLoader] quitMenuItem];
if (!QGuiApplicationPrivate::instance()->modalWindowList.isEmpty()
&& [quitMenuItem isEnabled]) {
int visible = 0;
@@ -447,10 +434,4 @@ QT_END_NAMESPACE
[NSApp terminate:self];
}
-- (void)qtDispatcherToQAction:(id)sender
-{
- Q_UNUSED(sender);
- [qtMenuLoader qtDispatcherToQPAMenuItem:sender];
-}
-
@end
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index fa05626d18..562be2be8f 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -40,36 +40,20 @@
#ifndef QBACKINGSTORE_COCOA_H
#define QBACKINGSTORE_COCOA_H
-#include <AppKit/AppKit.h>
-
-#include "qcocoawindow.h"
-#include "qnsview.h"
-
-#include <qpa/qplatformbackingstore.h>
+#include <QtPlatformSupport/private/qrasterbackingstore_p.h>
QT_BEGIN_NAMESPACE
-class QCocoaBackingStore : public QPlatformBackingStore
+class QCocoaBackingStore : public QRasterBackingStore
{
public:
QCocoaBackingStore(QWindow *window);
~QCocoaBackingStore();
- 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;
- qreal getBackingStoreDevicePixelRatio();
+ void flush(QWindow *, const QRegion &, const QPoint &) Q_DECL_OVERRIDE;
private:
- QImage m_qImage;
- QSize m_requestedSize;
+ QImage::Format format() const Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index b060d6a082..af5418315c 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -38,13 +38,13 @@
****************************************************************************/
#include "qcocoabackingstore.h"
-#include <QtGui/QPainter>
-#include "qcocoahelpers.h"
+
+#include "qcocoawindow.h"
QT_BEGIN_NAMESPACE
QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
- : QPlatformBackingStore(window)
+ : QRasterBackingStore(window)
{
}
@@ -54,71 +54,21 @@ QCocoaBackingStore::~QCocoaBackingStore()
[cocoaWindow->m_qtView clearBackingStore:this];
}
-QPaintDevice *QCocoaBackingStore::paintDevice()
-{
- QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
- int windowDevicePixelRatio = int(cocoaWindow->devicePixelRatio());
-
- // Receate the backing store buffer if the effective buffer size has changed,
- // either due to a window resize or devicePixelRatio change.
- QSize effectiveBufferSize = m_requestedSize * windowDevicePixelRatio;
- if (m_qImage.size() != effectiveBufferSize) {
- QImage::Format format = (window()->format().hasAlpha() || cocoaWindow->m_drawContentBorderGradient)
- ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
- m_qImage = QImage(effectiveBufferSize, format);
- m_qImage.setDevicePixelRatio(windowDevicePixelRatio);
- if (format == QImage::Format_ARGB32_Premultiplied)
- m_qImage.fill(Qt::transparent);
- }
- return &m_qImage;
-}
-
-void QCocoaBackingStore::flush(QWindow *win, const QRegion &region, const QPoint &offset)
+QImage::Format QCocoaBackingStore::format() const
{
- if (!m_qImage.isNull()) {
- if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(win->handle()))
- [cocoaWindow->m_qtView flushBackingStore:this region:region offset:offset];
- }
-}
+ if (static_cast<QCocoaWindow *>(window()->handle())->m_drawContentBorderGradient)
+ return QImage::Format_ARGB32_Premultiplied;
-QImage QCocoaBackingStore::toImage() const
-{
- return m_qImage;
+ return QRasterBackingStore::format();
}
-void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
+void QCocoaBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
- m_requestedSize = size;
-}
+ if (m_image.isNull())
+ return;
-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);
- qt_scrollRectInImage(m_qImage, qrect, qpoint);
- }
- return true;
-}
-
-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);
- }
-}
-
-qreal QCocoaBackingStore::getBackingStoreDevicePixelRatio()
-{
- return m_qImage.devicePixelRatio();
+ if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle()))
+ [cocoaWindow->m_qtView flushBackingStore:this region:region offset:offset];
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaclipboard.h b/src/plugins/platforms/cocoa/qcocoaclipboard.h
index 52fec61f39..cab2cfaa91 100644
--- a/src/plugins/platforms/cocoa/qcocoaclipboard.h
+++ b/src/plugins/platforms/cocoa/qcocoaclipboard.h
@@ -41,6 +41,9 @@
#define QCOCOACLIPBOARD_H
#include <qpa/qplatformclipboard.h>
+
+#ifndef QT_NO_CLIPBOARD
+
#include "qmacclipboard.h"
#include <QtCore/QScopedPointer>
@@ -71,4 +74,6 @@ private:
QT_END_NAMESPACE
-#endif
+#endif // QT_NO_CLIPBOARD
+
+#endif // QCOCOACLIPBOARD_H
diff --git a/src/plugins/platforms/cocoa/qcocoaclipboard.mm b/src/plugins/platforms/cocoa/qcocoaclipboard.mm
index 7209c93a94..b4745900dc 100644
--- a/src/plugins/platforms/cocoa/qcocoaclipboard.mm
+++ b/src/plugins/platforms/cocoa/qcocoaclipboard.mm
@@ -39,6 +39,8 @@
#include "qcocoaclipboard.h"
+#ifndef QT_NO_CLIPBOARD
+
QT_BEGIN_NAMESPACE
QCocoaClipboard::QCocoaClipboard()
@@ -105,3 +107,5 @@ void QCocoaClipboard::handleApplicationStateChanged(Qt::ApplicationState state)
#include "moc_qcocoaclipboard.cpp"
QT_END_NAMESPACE
+
+#endif // QT_NO_CLIPBOARD
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 0319d4ca6d..cc8436dcfe 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) {
@@ -481,6 +481,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/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index 0433084436..8e523dfbbf 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -40,6 +40,7 @@
#include "qcocoacursor.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
+#include <QtGui/private/qcoregraphics_p.h>
#include <QtGui/QBitmap>
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index bb8d12e3ce..7d11023b78 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -43,6 +43,7 @@
#ifndef QT_NO_WIDGETS
#include <QtWidgets/qwidget.h>
#endif
+#include <QtGui/private/qcoregraphics_p.h>
QT_BEGIN_NAMESPACE
@@ -131,7 +132,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..536a2d2d58 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -69,29 +69,6 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
{ return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); }
-NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);
-NSImage *qt_mac_create_nsimage(const QPixmap &pm);
-NSImage *qt_mac_create_nsimage(const QIcon &icon);
-CGImageRef qt_mac_toCGImage(const QImage &qImage);
-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);
-
-QBrush qt_mac_toQBrush(CGColorRef color);
-QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
-
-// Creates a mutable shape, it's the caller's responsibility to release.
-HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region);
-
-OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
-
NSDragOperation qt_mac_mapDropAction(Qt::DropAction action);
NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions);
Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions);
@@ -99,9 +76,6 @@ Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions);
// Misc
void qt_mac_transformProccessToForegroundApplication();
-CGColorSpaceRef qt_mac_genericColorSpace();
-CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget);
-CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
QString qt_mac_applicationName();
int qt_mac_flipYCoordinate(int y);
@@ -114,10 +88,6 @@ NSRect qt_mac_flipRect(const QRect &rect);
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);
-bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret);
-bool qt_mac_execute_apple_script(const char *script, AEDesc *ret);
-bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret);
-
// strip out '&' characters, and convert "&&" to a single '&', in menu
// text - since menu text is sometimes decorated with these for Windows
// accelerators.
@@ -151,8 +121,6 @@ public:
}
};
-CGContextRef qt_mac_cg_context(QPaintDevice *pdev);
-
template<typename T>
T qt_mac_resolveOption(const T &fallback, const QByteArray &environment)
{
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 606b2e7032..0c7c30579e 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -47,6 +47,7 @@
#include <qpa/qplatformscreen.h>
#include <private/qguiapplication_p.h>
#include <private/qwindow_p.h>
+#include <QtGui/private/qcoregraphics_p.h>
#ifndef QT_NO_WIDGETS
#include <QtWidgets/QWidget>
@@ -56,25 +57,6 @@
#include <Carbon/Carbon.h>
-@interface NSGraphicsContext (QtAdditions)
-
-+ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState;
-
-@end
-
-@implementation NSGraphicsContext (QtAdditions)
-
-+ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState
-{
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_NA)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10)
- return [self graphicsContextWithCGContext:graphicsPort flipped:initialFlippedState];
-#endif
- return [self graphicsContextWithGraphicsPort:graphicsPort flipped:initialFlippedState];
-}
-
-@end
-
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaCocoaWindow, "qt.qpa.cocoa.window");
@@ -101,291 +83,6 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list)
return result;
}
-static void qt_mac_deleteImage(void *image, const void *, size_t)
-{
- delete static_cast<QImage *>(image);
-}
-
-// Creates a CGDataProvider with the data from the given image.
-// The data provider retains a copy of the image.
-CGDataProviderRef qt_mac_CGDataProvider(const QImage &image)
-{
- return CGDataProviderCreateWithData(new QImage(image), image.bits(),
- image.byteCount(), qt_mac_deleteImage);
-}
-
-CGImageRef qt_mac_toCGImage(const QImage &inImage)
-{
- if (inImage.isNull())
- return 0;
-
- QImage image = inImage;
-
- uint cgflags = kCGImageAlphaNone;
- switch (image.format()) {
- case QImage::Format_ARGB32:
- cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
- break;
- case QImage::Format_RGB32:
- cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
- break;
- case QImage::Format_RGB888:
- cgflags = kCGImageAlphaNone | kCGBitmapByteOrder32Big;
- break;
- case QImage::Format_RGBA8888_Premultiplied:
- cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big;
- break;
- case QImage::Format_RGBA8888:
- cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big;
- break;
- case QImage::Format_RGBX8888:
- cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
- break;
- default:
- // Everything not recognized explicitly is converted to ARGB32_Premultiplied.
- image = inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
- // no break;
- case QImage::Format_ARGB32_Premultiplied:
- cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
- break;
- }
-
- QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
- return CGImageCreate(image.width(), image.height(), 8, 32,
- image.bytesPerLine(),
- qt_mac_genericColorSpace(),
- cgflags, dataProvider, 0, false, kCGRenderingIntentDefault);
-}
-
-CGImageRef qt_mac_toCGImageMask(const QImage &image)
-{
- QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
- return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(),
- image.bytesPerLine(), dataProvider, NULL, false);
-}
-
-NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
-{
- NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
- return newImage;
-}
-
-NSImage *qt_mac_create_nsimage(const QPixmap &pm)
-{
- if (pm.isNull())
- return 0;
- QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_toCGImage(image);
- NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
- CGImageRelease(cgImage);
- return nsImage;
-}
-
-NSImage *qt_mac_create_nsimage(const QIcon &icon)
-{
- if (icon.isNull())
- return nil;
-
- NSImage *nsImage = [[NSImage alloc] init];
- foreach (QSize size, icon.availableSizes()) {
- QPixmap pm = icon.pixmap(size);
- QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_toCGImage(image);
- NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- [nsImage addRepresentation:imageRep];
- [imageRep release];
- CGImageRelease(cgImage);
- }
- return nsImage;
-}
-
-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;
- }
- }
- 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;
- NSString *colorSpace = [color colorSpaceName];
- if (colorSpace == NSDeviceCMYKColorSpace) {
- CGFloat cyan, magenta, yellow, black, alpha;
- [color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
- qtColor.setCmykF(cyan, magenta, yellow, black, alpha);
- } else {
- NSColor *tmpColor;
- tmpColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
- CGFloat red, green, blue, alpha;
- [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha];
- qtColor.setRgbF(red, green, blue, alpha);
- }
- return qtColor;
-}
-
-QColor qt_mac_toQColor(CGColorRef color)
-{
- QColor qtColor;
- CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(color));
- const CGFloat *components = CGColorGetComponents(color);
- if (model == kCGColorSpaceModelRGB) {
- qtColor.setRgbF(components[0], components[1], components[2], components[3]);
- } else if (model == kCGColorSpaceModelCMYK) {
- qtColor.setCmykF(components[0], components[1], components[2], components[3]);
- } else if (model == kCGColorSpaceModelMonochrome) {
- qtColor.setRgbF(components[0], components[0], components[0], components[1]);
- } else {
- // Colorspace we can't deal with.
- qWarning("Qt: qt_mac_toQColor: cannot convert from colorspace model: %d", model);
- Q_ASSERT(false);
- }
- return qtColor;
-}
-
-QBrush qt_mac_toQBrush(CGColorRef color)
-{
- QBrush qtBrush;
- CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(color));
- if (model == kCGColorSpaceModelPattern) {
- // Colorspace we can't deal with; the color is drawn directly using a callback.
- qWarning("Qt: qt_mac_toQBrush: cannot convert from colorspace model: %d", model);
- Q_ASSERT(false);
- } else {
- qtBrush.setStyle(Qt::SolidPattern);
- qtBrush.setColor(qt_mac_toQColor(color));
- }
- return qtBrush;
-}
-
-static bool qt_mac_isSystemColorOrInstance(const NSColor *color, NSString *colorNameComponent, NSString *className)
-{
- // We specifically do not want isKindOfClass: here
- if ([color.className isEqualToString:className]) // NSPatternColorSpace
- return true;
- if ([color.catalogNameComponent isEqualToString:@"System"] &&
- [color.colorNameComponent isEqualToString:colorNameComponent] &&
- [color.colorSpaceName isEqualToString:NSNamedColorSpace])
- return true;
- return false;
-}
-
-QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
-{
- QBrush qtBrush;
-
- // QTBUG-49773: This calls NSDrawMenuItemBackground to render a 1 by n gradient; could use HITheme
- if ([color.className isEqualToString:@"NSMenuItemHighlightColor"]) {
- qWarning("Qt: qt_mac_toQBrush: cannot convert from NSMenuItemHighlightColor");
- return qtBrush;
- }
-
- // Not a catalog color or a manifestation of System.windowBackgroundColor;
- // only retrieved from NSWindow.backgroundColor directly
- if ([color.className isEqualToString:@"NSMetalPatternColor"]) {
- // NSTexturedBackgroundWindowMask, could theoretically handle this without private API by
- // creating a window with the appropriate properties and then calling NSWindow.backgroundColor.patternImage,
- // which returns a texture sized 1 by (window height, including frame), backed by a CGPattern
- // which follows the window key state... probably need to allow QBrush to store a function pointer
- // like CGPattern does
- qWarning("Qt: qt_mac_toQBrush: cannot convert from NSMetalPatternColor");
- return qtBrush;
- }
-
- // No public API to get these colors/stops;
- // both accurately obtained through runtime object inspection on OS X 10.11
- // (the NSColor object has NSGradient i-vars for both color groups)
- if (qt_mac_isSystemColorOrInstance(color, @"_sourceListBackgroundColor", @"NSSourceListBackgroundColor")) {
- QLinearGradient gradient;
- if (colorGroup == QPalette::Active) {
- gradient.setColorAt(0, QColor(233, 237, 242));
- gradient.setColorAt(0.5, QColor(225, 229, 235));
- gradient.setColorAt(1, QColor(209, 216, 224));
- } else {
- gradient.setColorAt(0, QColor(248, 248, 248));
- gradient.setColorAt(0.5, QColor(240, 240, 240));
- gradient.setColorAt(1, QColor(235, 235, 235));
- }
- return QBrush(gradient);
- }
-
- // A couple colors are special... they are actually instances of NSGradientPatternColor, which
- // override set/setFill/setStroke to instead initialize an internal color
- // ([NSColor colorWithCalibratedWhite:0.909804 alpha:1.000000]) while still returning the
- // ruled lines pattern image (from OS X 10.4) to the user from -[NSColor patternImage]
- // (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);
- return qtBrush;
- }
-
- if (NSColor *patternColor = [color colorUsingColorSpaceName:NSPatternColorSpace]) {
- NSImage *patternImage = patternColor.patternImage;
- const QSizeF sz(patternImage.size.width, patternImage.size.height);
- qtBrush.setTexture(qt_mac_toQPixmap(patternImage, sz)); // QTBUG-49774
- } else {
- qtBrush.setStyle(Qt::SolidPattern);
- qtBrush.setColor(qt_mac_toQColor(color));
- }
- return qtBrush;
-}
-
struct dndenum_mapper
{
NSDragOperation mac_code;
@@ -495,97 +192,6 @@ void qt_mac_transformProccessToForegroundApplication()
[[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyRegular];
}
}
-static CGColorSpaceRef m_genericColorSpace = 0;
-static QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash;
-static bool m_postRoutineRegistered = false;
-
-CGColorSpaceRef qt_mac_genericColorSpace()
-{
-#if 0
- if (!m_genericColorSpace) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- } else
- {
- m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
- }
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
- }
- }
- return m_genericColorSpace;
-#else
- // Just return the main display colorspace for the moment.
- return qt_mac_displayColorSpace(0);
-#endif
-}
-
-/*
- Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc.
- to support multiple displays correctly.
-*/
-CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
-{
- CGColorSpaceRef colorSpace;
-
- CGDirectDisplayID displayID;
- if (widget == 0) {
- displayID = CGMainDisplayID();
- } else {
- displayID = CGMainDisplayID();
- /*
- ### get correct display
- const QRect &qrect = widget->window()->geometry();
- CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
- CGDisplayCount throwAway;
- CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
- if (dErr != kCGErrorSuccess)
- return macDisplayColorSpace(0); // fall back on main display
- */
- }
- if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
- return colorSpace;
-
- colorSpace = CGDisplayCopyColorSpace(displayID);
- if (colorSpace == 0)
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- m_displayColorSpaceHash.insert(displayID, colorSpace);
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- void qt_mac_cleanUpMacColorSpaces();
- qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
- }
- return colorSpace;
-}
-
-void qt_mac_cleanUpMacColorSpaces()
-{
- if (m_genericColorSpace) {
- CFRelease(m_genericColorSpace);
- m_genericColorSpace = 0;
- }
- QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
- while (it != m_displayColorSpaceHash.constEnd()) {
- if (it.value())
- CFRelease(it.value());
- ++it;
- }
- m_displayColorSpaceHash.clear();
-}
-
-CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
-{
-#ifdef QT_NO_WIDGETS
- Q_UNUSED(paintDevice)
- return qt_mac_displayColorSpace(0);
-#else
- bool isWidget = (paintDevice->devType() == QInternal::Widget);
- return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice): 0);
-#endif
-
-}
QString qt_mac_applicationName()
{
@@ -650,28 +256,6 @@ NSRect qt_mac_flipRect(const QRect &rect)
return NSMakeRect(rect.x(), flippedY, rect.width(), rect.height());
}
-OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
-{
- // Verbatim copy if HIViewDrawCGImage (as shown on Carbon-Dev)
- OSStatus err = noErr;
-
- require_action(inContext != NULL, InvalidContext, err = paramErr);
- require_action(inBounds != NULL, InvalidBounds, err = paramErr);
- require_action(inImage != NULL, InvalidImage, err = paramErr);
-
- CGContextSaveGState( inContext );
- CGContextTranslateCTM (inContext, 0, inBounds->origin.y + CGRectGetMaxY(*inBounds));
- CGContextScaleCTM(inContext, 1, -1);
-
- CGContextDrawImage(inContext, *inBounds, inImage);
-
- CGContextRestoreGState(inContext);
-InvalidImage:
-InvalidBounds:
-InvalidContext:
- return err;
-}
-
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
{
if (buttonNum == 0)
@@ -687,146 +271,9 @@ Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
return Qt::NoButton;
}
-bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret) {
- OSStatus err;
- AEDesc scriptTextDesc;
- ComponentInstance theComponent = 0;
- OSAID scriptID = kOSANullScript, resultID = kOSANullScript;
-
- // set up locals to a known state
- AECreateDesc(typeNull, 0, 0, &scriptTextDesc);
- scriptID = kOSANullScript;
- resultID = kOSANullScript;
-
- // open the scripting component
- theComponent = OpenDefaultComponent(kOSAComponentType, typeAppleScript);
- if (!theComponent) {
- err = paramErr;
- goto bail;
- }
-
- // put the script text into an aedesc
- err = AECreateDesc(typeUTF8Text, script, script_len, &scriptTextDesc);
- if (err != noErr)
- goto bail;
-
- // compile the script
- err = OSACompile(theComponent, &scriptTextDesc, kOSAModeNull, &scriptID);
- if (err != noErr)
- goto bail;
-
- // run the script
- err = OSAExecute(theComponent, scriptID, kOSANullScript, kOSAModeNull, &resultID);
-
- // collect the results - if any
- if (ret) {
- AECreateDesc(typeNull, 0, 0, ret);
- if (err == errOSAScriptError)
- OSAScriptError(theComponent, kOSAErrorMessage, typeChar, ret);
- else if (err == noErr && resultID != kOSANullScript)
- OSADisplay(theComponent, resultID, typeChar, kOSAModeNull, ret);
- }
-bail:
- AEDisposeDesc(&scriptTextDesc);
- if (scriptID != kOSANullScript)
- OSADispose(theComponent, scriptID);
- if (resultID != kOSANullScript)
- OSADispose(theComponent, resultID);
- if (theComponent)
- CloseComponent(theComponent);
- return err == noErr;
-}
-
-bool qt_mac_execute_apple_script(const char *script, AEDesc *ret)
-{
- return qt_mac_execute_apple_script(script, qstrlen(script), ret);
-}
-
-bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret)
-{
- const QByteArray l = script.toUtf8(); return qt_mac_execute_apple_script(l.constData(), l.size(), ret);
-}
-
QString qt_mac_removeAmpersandEscapes(QString s)
{
return QPlatformTheme::removeMnemonics(s).trimmed();
}
-/*! \internal
-
- Returns the CoreGraphics CGContextRef of the paint device. 0 is
- returned if it can't be obtained. It is the caller's responsibility to
- CGContextRelease the context when finished using it.
-
- \warning This function is only available on \macos.
- \warning This function is duplicated in qmacstyle_mac.mm
- */
-CGContextRef qt_mac_cg_context(QPaintDevice *pdev)
-{
- // In Qt 5, QWidget and QPixmap (and QImage) paint devices are all QImages under the hood.
- QImage *image = 0;
- if (pdev->devType() == QInternal::Image) {
- image = static_cast<QImage *>(pdev);
- } else if (pdev->devType() == QInternal::Pixmap) {
-
- const QPixmap *pm = static_cast<const QPixmap*>(pdev);
- QPlatformPixmap *data = const_cast<QPixmap *>(pm)->data_ptr().data();
- if (data && data->classId() == QPlatformPixmap::RasterClass) {
- image = data->buffer();
- } else {
- qDebug("qt_mac_cg_context: Unsupported pixmap class");
- }
- } else if (pdev->devType() == QInternal::Widget) {
- // TODO test: image = static_cast<QImage *>(static_cast<const QWidget *>(pdev)->backingStore()->paintDevice());
- qDebug("qt_mac_cg_context: not implemented: Widget class");
- }
-
- if (!image)
- return 0; // Context type not supported.
-
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev);
- uint flags = kCGImageAlphaPremultipliedFirst;
- flags |= kCGBitmapByteOrder32Host;
- CGContextRef ret = 0;
- ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
- CGContextTranslateCTM(ret, 0, image->height());
- CGContextScaleCTM(ret, 1, -1);
- return ret;
-}
-
-QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
-{
- const NSSize pixmapSize = NSMakeSize(size.width(), size.height());
- QPixmap pixmap(pixmapSize.width, pixmapSize.height);
- pixmap.fill(Qt::transparent);
- [image setSize:pixmapSize];
- const NSRect iconRect = NSMakeRect(0, 0, pixmapSize.width, pixmapSize.height);
- QMacCGContext ctx(&pixmap);
- if (!ctx)
- return QPixmap();
- NSGraphicsContext *gc = [NSGraphicsContext qt_graphicsContextWithCGContext:ctx flipped:YES];
- if (!gc)
- return QPixmap();
- [NSGraphicsContext saveGraphicsState];
- [NSGraphicsContext setCurrentContext:gc];
- [image drawInRect:iconRect fromRect:iconRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
- [NSGraphicsContext restoreGraphicsState];
- return pixmap;
-}
-
-QImage qt_mac_toQImage(CGImageRef image)
-{
- const size_t w = CGImageGetWidth(image),
- h = CGImageGetHeight(image);
- QImage ret(w, h, QImage::Format_ARGB32_Premultiplied);
- ret.fill(Qt::transparent);
- CGRect rect = CGRectMake(0, 0, w, h);
- CGContextRef ctx = qt_mac_cg_context(&ret);
- qt_mac_drawCGImage(ctx, &rect, image);
- CGContextRelease(ctx);
- return ret;
-}
-
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 9b0b5959a4..85ea2d8ba9 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -130,7 +130,9 @@ public:
#ifndef QT_NO_ACCESSIBILITY
QCocoaAccessibility *accessibility() const Q_DECL_OVERRIDE;
#endif
+#ifndef QT_NO_CLIPBOARD
QCocoaClipboard *clipboard() const Q_DECL_OVERRIDE;
+#endif
QCocoaDrag *drag() const Q_DECL_OVERRIDE;
QStringList themeNames() const Q_DECL_OVERRIDE;
@@ -169,7 +171,9 @@ private:
#endif
QScopedPointer<QPlatformTheme> mPlatformTheme;
QList<QCocoaScreen *> mScreens;
+#ifndef QT_NO_CLIPBOARD
QCocoaClipboard *mCocoaClipboard;
+#endif
QScopedPointer<QCocoaDrag> mCocoaDrag;
QScopedPointer<QCocoaNativeInterface> mNativeInterface;
QScopedPointer<QCocoaServices> mServices;
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index e481cede17..92fffb4d15 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -58,6 +58,8 @@
#include <qpa/qplatforminputcontextfactory_p.h>
#include <QtCore/qcoreapplication.h>
+#include <QtGui/private/qcoregraphics_p.h>
+
#include <IOKit/graphics/IOGraphicsLib.h>
static void initResources()
@@ -199,8 +201,6 @@ QWindow *QCocoaScreen::topLevelAt(const QPoint &point) const
return window;
}
-extern CGContextRef qt_mac_cg_context(const QPaintDevice *pdev);
-
QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height) const
{
// TODO window should be handled
@@ -251,9 +251,8 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
QPixmap pix(w, h);
pix.fill(Qt::transparent);
CGRect rect = CGRectMake(0, 0, w, h);
- CGContextRef ctx = qt_mac_cg_context(&pix);
+ QMacCGContext ctx(&pix);
qt_mac_drawCGImage(ctx, &rect, image);
- CGContextRelease(ctx);
QPainter painter(&windowPixmap);
painter.drawPixmap(0, 0, pix);
@@ -283,7 +282,9 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
#ifndef QT_NO_ACCESSIBILITY
, mAccessibility(new QCocoaAccessibility)
#endif
+#ifndef QT_NO_CLIPBOARD
, mCocoaClipboard(new QCocoaClipboard)
+#endif
, mCocoaDrag(new QCocoaDrag)
, mNativeInterface(new QCocoaNativeInterface)
, mServices(new QCocoaServices)
@@ -329,10 +330,8 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
[cocoaApplication setDelegate:newDelegate];
// Load the application menu. This menu contains Preferences, Hide, Quit.
- QCocoaMenuLoader *qtMenuLoader = [[QCocoaMenuLoader alloc] init];
- qt_mac_loadMenuNib(qtMenuLoader);
+ QCocoaMenuLoader *qtMenuLoader = [QCocoaMenuLoader sharedMenuLoader];
[cocoaApplication setMenu:[qtMenuLoader menu]];
- [newDelegate setMenuLoader:qtMenuLoader];
}
// The presentation options such as whether or not the dock and/or menu bar is
@@ -366,11 +365,13 @@ QCocoaIntegration::~QCocoaIntegration()
[[NSApplication sharedApplication] setDelegate: 0];
}
+#ifndef QT_NO_CLIPBOARD
// Delete the clipboard integration and destroy mime type converters.
// Deleting the clipboard integration flushes promised pastes using
// the mime converters - the ordering here is important.
delete mCocoaClipboard;
QMacInternalPasteboardMime::destroyMimeTypes();
+#endif
// Delete screens in reverse order to avoid crash in case of multiple screens
while (!mScreens.isEmpty()) {
@@ -531,10 +532,12 @@ QCocoaAccessibility *QCocoaIntegration::accessibility() const
}
#endif
+#ifndef QT_NO_CLIPBOARD
QCocoaClipboard *QCocoaIntegration::clipboard() const
{
return mCocoaClipboard;
}
+#endif
QCocoaDrag *QCocoaIntegration::drag() const
{
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/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 40d593cf0f..4260b17772 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -74,11 +74,6 @@ NSString *qt_mac_removePrivateUnicode(NSString* string)
return string;
}
-static inline QCocoaMenuLoader *getMenuLoader()
-{
- return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
-}
-
QT_END_NAMESPACE
@interface QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) : NSObject <NSMenuDelegate> {
@@ -414,7 +409,7 @@ void QCocoaMenu::syncMenuItem(QPlatformMenuItem *menuItem)
}
bool wasMerged = cocoaItem->isMerged();
- NSMenu *oldMenu = wasMerged ? [getMenuLoader() applicationMenu] : m_nativeMenu;
+ NSMenu *oldMenu = wasMerged ? [[QCocoaMenuLoader sharedMenuLoader] applicationMenu] : m_nativeMenu;
NSMenuItem *oldItem = [oldMenu itemWithTag:(NSInteger) cocoaItem];
if (cocoaItem->sync() != oldItem) {
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index 1c50c3b032..26af0d3f63 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -52,11 +52,6 @@ QT_BEGIN_NAMESPACE
static QList<QCocoaMenuBar*> static_menubars;
-static inline QCocoaMenuLoader *getMenuLoader()
-{
- return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
-}
-
QCocoaMenuBar::QCocoaMenuBar() :
m_window(0)
{
@@ -330,7 +325,7 @@ void QCocoaMenuBar::updateMenuBarImmediately()
menu->propagateEnabledState(!disableForModal);
}
- QCocoaMenuLoader *loader = getMenuLoader();
+ QCocoaMenuLoader *loader = [QCocoaMenuLoader sharedMenuLoader];
[loader ensureAppMenuInMenu:mb->nsMenu()];
NSMutableSet *mergedItems = [[NSMutableSet setWithCapacity:0] retain];
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h
index d63f21f598..23f788687c 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h
@@ -90,7 +90,9 @@ public:
void setIsSeparator(bool isSeparator) Q_DECL_OVERRIDE;
void setFont(const QFont &font) Q_DECL_OVERRIDE;
void setRole(MenuRole role) Q_DECL_OVERRIDE;
+#ifndef QT_NO_SHORTCUT
void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE;
+#endif
void setCheckable(bool checkable) Q_DECL_OVERRIDE { Q_UNUSED(checkable) }
void setChecked(bool isChecked) Q_DECL_OVERRIDE;
void setEnabled(bool isEnabled) Q_DECL_OVERRIDE;
@@ -124,7 +126,9 @@ private:
QFont m_font;
MenuRole m_role;
MenuRole m_detectedRole;
+#ifndef QT_NO_SHORTCUT
QKeySequence m_shortcut;
+#endif
quintptr m_tag;
int m_iconSize;
bool m_textSynced:1;
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 3979d7169a..ea094c86ee 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -48,17 +48,12 @@
#include "qt_mac_p.h"
#include "qcocoaapplication.h" // for custom application category
#include "qcocoamenuloader.h"
+#include <QtGui/private/qcoregraphics_p.h>
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
-static inline QCocoaMenuLoader *getMenuLoader()
-{
- return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
-}
-
-
static quint32 constructModifierMask(quint32 accel_key)
{
quint32 ret = 0;
@@ -74,6 +69,7 @@ static quint32 constructModifierMask(quint32 accel_key)
return ret;
}
+#ifndef QT_NO_SHORTCUT
// return an autoreleased string given a QKeySequence (currently only looks at the first one).
NSString *keySequenceToKeyEqivalent(const QKeySequence &accel)
{
@@ -92,6 +88,7 @@ NSUInteger keySequenceModifierMask(const QKeySequence &accel)
{
return constructModifierMask(accel[0]);
}
+#endif
QCocoaMenuItem::QCocoaMenuItem() :
m_native(NULL),
@@ -189,10 +186,12 @@ void QCocoaMenuItem::setRole(MenuRole role)
m_role = role;
}
+#ifndef QT_NO_SHORTCUT
void QCocoaMenuItem::setShortcut(const QKeySequence& shortcut)
{
m_shortcut = shortcut;
}
+#endif
void QCocoaMenuItem::setChecked(bool isChecked)
{
@@ -234,7 +233,7 @@ NSMenuItem *QCocoaMenuItem::sync()
if ((m_role != NoRole && !m_textSynced) || m_merged) {
NSMenuItem *mergeItem = nil;
- QCocoaMenuLoader *loader = getMenuLoader();
+ QCocoaMenuLoader *loader = [QCocoaMenuLoader sharedMenuLoader];
switch (m_role) {
case ApplicationSpecificRole:
mergeItem = [loader appSpecificMenuItem:reinterpret_cast<NSInteger>(this)];
@@ -320,11 +319,13 @@ NSMenuItem *QCocoaMenuItem::sync()
[m_native setView:m_itemView];
QString text = mergeText();
+#ifndef QT_NO_SHORTCUT
QKeySequence accel = mergeAccel();
// Show multiple key sequences as part of the menu text.
if (accel.count() > 1)
text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")");
+#endif
QString finalString = QPlatformTheme::removeMnemonics(text);
bool useAttributedTitle = false;
@@ -346,10 +347,13 @@ NSMenuItem *QCocoaMenuItem::sync()
[m_native setTitle: QCFString::toNSString(finalString)];
}
+#ifndef QT_NO_SHORTCUT
if (accel.count() == 1) {
[m_native setKeyEquivalent:keySequenceToKeyEqivalent(accel)];
[m_native setKeyEquivalentModifierMask:keySequenceModifierMask(accel)];
- } else {
+ } else
+#endif
+ {
[m_native setKeyEquivalent:@""];
[m_native setKeyEquivalentModifierMask:NSCommandKeyMask];
}
@@ -372,7 +376,7 @@ QT_END_NAMESPACE
QString QCocoaMenuItem::mergeText()
{
- QCocoaMenuLoader *loader = getMenuLoader();
+ QCocoaMenuLoader *loader = [QCocoaMenuLoader sharedMenuLoader];
if (m_native == [loader aboutMenuItem]) {
return qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName());
} else if (m_native== [loader aboutQtMenuItem]) {
@@ -390,9 +394,10 @@ QString QCocoaMenuItem::mergeText()
return m_text;
}
+#ifndef QT_NO_SHORTCUT
QKeySequence QCocoaMenuItem::mergeAccel()
{
- QCocoaMenuLoader *loader = getMenuLoader();
+ QCocoaMenuLoader *loader = [QCocoaMenuLoader sharedMenuLoader];
if (m_native == [loader preferencesMenuItem])
return QKeySequence(QKeySequence::Preferences);
else if (m_native == [loader quitMenuItem])
@@ -402,6 +407,7 @@ QKeySequence QCocoaMenuItem::mergeAccel()
return m_shortcut;
}
+#endif
void QCocoaMenuItem::syncMerged()
{
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.h b/src/plugins/platforms/cocoa/qcocoamenuloader.h
index 6f58b2f24c..95f347646c 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.h
@@ -68,6 +68,8 @@
NSMenuItem *hideAllOthersItem;
NSMenuItem *showAllItem;
}
++ (instancetype)sharedMenuLoader;
+- (instancetype)init;
- (void)ensureAppMenuInMenu:(NSMenu *)menu;
- (void)removeActionsFromAppMenu;
- (NSMenu *)applicationMenu;
@@ -92,10 +94,4 @@
QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuLoader);
-QT_BEGIN_NAMESPACE
-
-void qt_mac_loadMenuNib(QCocoaMenuLoader *qtMenuLoader);
-
-QT_END_NAMESPACE
-
#endif // QCOCOAMENULOADER_P_H
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index e440a9080c..22e90f8dc8 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -55,86 +55,127 @@
QT_FORWARD_DECLARE_CLASS(QCFString)
QT_FORWARD_DECLARE_CLASS(QString)
+@implementation QCocoaMenuLoader
-QT_BEGIN_NAMESPACE
-
-/*
- Loads and instantiates the main app menu from the menu nib file(s).
-
- The main app menu contains the Quit, Hide About, Preferences entries, and
- The reason for having the nib file is that those can not be created
- programmatically. To ease deployment the nib files are stored in Qt resources
- and written to QDir::temp() before loading. (Earlier Qt versions used
- to require having the nib file in the Qt GUI framework.)
-*/
-void qt_mac_loadMenuNib(QCocoaMenuLoader *qtMenuLoader)
++ (instancetype)sharedMenuLoader
{
- // Create qt_menu.nib dir in temp.
- QDir temp = QDir::temp();
- temp.mkdir("qt_menu.nib");
- QString nibDir = temp.canonicalPath() + QLatin1String("/") + QLatin1String("qt_menu.nib/");
- if (!QDir(nibDir).exists()) {
- qWarning("qt_mac_loadMenuNib: could not create nib directory in temp");
- return;
- }
-
- // Copy nib files from resources to temp.
- QDir nibResource(":/qt-project.org/mac/qt_menu.nib/");
- if (!nibResource.exists()) {
- qWarning("qt_mac_loadMenuNib: could not load nib from resources");
- return;
- }
- foreach (const QFileInfo &file, nibResource.entryInfoList()) {
- QFileInfo destinationFile(nibDir + QLatin1String("/") + file.fileName());
- if (destinationFile.exists() && destinationFile.size() != file.size())
- QFile::remove(destinationFile.absoluteFilePath());
+ static QCocoaMenuLoader *shared = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ shared = [[self alloc] init];
+ });
+ return shared;
+}
- QFile::copy(file.absoluteFilePath(), destinationFile.absoluteFilePath());
+- (instancetype)init
+{
+ if ((self = [super init])) {
+ NSString *appName = qt_mac_applicationName().toNSString();
+
+ // Menubar as menu. Title as set in the NIB file
+ theMenu = [[NSMenu alloc] initWithTitle:@"Main Menu"];
+
+ // Application menu. Since 10.6, the first menu
+ // is always identified as the application menu.
+ NSMenuItem *appItem = [[[NSMenuItem alloc] init] autorelease];
+ appItem.title = appName;
+ [theMenu addItem:appItem];
+ appMenu = [[NSMenu alloc] initWithTitle:appName];
+ appItem.submenu = appMenu;
+
+ // About Application
+ aboutItem = [[NSMenuItem alloc] initWithTitle:[@"About " stringByAppendingString:appName]
+ action:@selector(orderFrontStandardAboutPanel:)
+ keyEquivalent:@""];
+ aboutItem.target = self;
+ // Disable until a QAction is associated
+ aboutItem.enabled = NO;
+ aboutItem.hidden = YES;
+ [appMenu addItem:aboutItem];
+
+ // About Qt (shameless self-promotion)
+ aboutQtItem = [[NSMenuItem alloc] init];
+ aboutQtItem.title = @"About Qt";
+ // Disable until a QAction is associated
+ aboutQtItem.enabled = NO;
+ aboutQtItem.hidden = YES;
+ [appMenu addItem:aboutQtItem];
+
+ [appMenu addItem:[NSMenuItem separatorItem]];
+
+ // Preferences
+ preferencesItem = [[NSMenuItem alloc] initWithTitle:@"Preferences…"
+ action:@selector(qtDispatcherToQPAMenuItem:)
+ keyEquivalent:@","];
+ preferencesItem.target = self;
+ // Disable until a QAction is associated
+ preferencesItem.enabled = NO;
+ preferencesItem.hidden = YES;
+ [appMenu addItem:preferencesItem];
+
+ [appMenu addItem:[NSMenuItem separatorItem]];
+
+ // Services item and menu
+ servicesItem = [[NSMenuItem alloc] init];
+ servicesItem.title = @"Services";
+ NSMenu *servicesMenu = [[[NSMenu alloc] initWithTitle:@"Services"] autorelease];
+ servicesItem.submenu = servicesMenu;
+ [NSApplication sharedApplication].servicesMenu = servicesMenu;
+ [appMenu addItem:servicesItem];
+
+ [appMenu addItem:[NSMenuItem separatorItem]];
+
+ // Hide Application
+ hideItem = [[NSMenuItem alloc] initWithTitle:[@"Hide " stringByAppendingString:appName]
+ action:@selector(hide:)
+ keyEquivalent:@"h"];
+ hideItem.target = self;
+ [appMenu addItem:hideItem];
+
+ // Hide Others
+ hideAllOthersItem = [[NSMenuItem alloc] initWithTitle:@"Hide Others"
+ action:@selector(hideOtherApplications:)
+ keyEquivalent:@"h"];
+ hideAllOthersItem.target = self;
+ hideAllOthersItem.keyEquivalentModifierMask = NSCommandKeyMask | NSAlternateKeyMask;
+ [appMenu addItem:hideAllOthersItem];
+
+ // Show All
+ showAllItem = [[NSMenuItem alloc] initWithTitle:@"Show All"
+ action:@selector(unhideAllApplications:)
+ keyEquivalent:@""];
+ showAllItem.target = self;
+ [appMenu addItem:showAllItem];
+
+ [appMenu addItem:[NSMenuItem separatorItem]];
+
+ // Quit Application
+ quitItem = [[NSMenuItem alloc] initWithTitle:[@"Quit " stringByAppendingString:appName]
+ action:@selector(terminate:)
+ keyEquivalent:@"q"];
+ quitItem.target = self;
+ [appMenu addItem:quitItem];
}
- // Load and instantiate nib file from temp
- NSURL *nibUrl = [NSURL fileURLWithPath : QCFString::toNSString(nibDir)];
- NSNib *nib = [[NSNib alloc] initWithContentsOfURL : nibUrl];
- [nib autorelease];
- if(!nib) {
- qWarning("qt_mac_loadMenuNib: could not load nib from temp");
- return;
- }
- bool ok = [nib instantiateNibWithOwner : qtMenuLoader topLevelObjects : nil];
- if (!ok) {
- qWarning("qt_mac_loadMenuNib: could not instantiate nib");
- }
+ return self;
}
-QT_END_NAMESPACE
+- (void)dealloc
+{
+ [theMenu release];
+ [appMenu release];
+ [aboutItem release];
+ [aboutQtItem release];
+ [preferencesItem release];
+ [servicesItem release];
+ [hideItem release];
+ [hideAllOthersItem release];
+ [showAllItem release];
+ [quitItem release];
-@implementation QCocoaMenuLoader
+ [lastAppSpecificItem release];
-- (void)awakeFromNib
-{
- servicesItem = [[appMenu itemWithTitle:@"Services"] retain];
- hideAllOthersItem = [[appMenu itemWithTitle:@"Hide Others"] retain];
- showAllItem = [[appMenu itemWithTitle:@"Show All"] retain];
-
- // Get the names in the nib to match the app name set by Qt.
- const NSString *appName = qt_mac_applicationName().toNSString();
- [quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
- withString:const_cast<NSString *>(appName)]];
- [hideItem setTitle:[[hideItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
- withString:const_cast<NSString *>(appName)]];
- [aboutItem setTitle:[[aboutItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
- withString:const_cast<NSString *>(appName)]];
- // Disable the items that don't do anything. If someone associates a QAction with them
- // They should get synced back in.
- [preferencesItem setEnabled:NO];
- [preferencesItem setHidden:YES];
-
- // should set this in the NIB
- [preferencesItem setTarget: self];
- [preferencesItem setAction: @selector(qtDispatcherToQPAMenuItem:)];
-
- [aboutItem setEnabled:NO];
- [aboutItem setHidden:YES];
+ [super dealloc];
}
- (void)ensureAppMenuInMenu:(NSMenu *)menu
@@ -179,18 +220,6 @@ QT_END_NAMESPACE
[item setTag:0];
}
-- (void)dealloc
-{
- [servicesItem release];
- [hideAllOthersItem release];
- [showAllItem release];
-
- [lastAppSpecificItem release];
- [theMenu release];
- [appMenu release];
- [super dealloc];
-}
-
- (NSMenu *)menu
{
return [[theMenu retain] autorelease];
diff --git a/src/plugins/platforms/cocoa/qcocoamimetypes.mm b/src/plugins/platforms/cocoa/qcocoamimetypes.mm
index e7a3aab845..c109eb7bf4 100644
--- a/src/plugins/platforms/cocoa/qcocoamimetypes.mm
+++ b/src/plugins/platforms/cocoa/qcocoamimetypes.mm
@@ -40,6 +40,7 @@
#include "qcocoamimetypes.h"
#include <QtPlatformSupport/private/qmacmime_p.h>
#include "qcocoahelpers.h"
+#include <QtGui/private/qcoregraphics_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 8562246817..3ff37a8463 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -64,6 +64,8 @@
#include <qpa/qplatformprintersupport.h>
#endif
+#include <QtGui/private/qcoregraphics_p.h>
+
#include <QtPlatformHeaders/qcocoawindowfunctions.h>
#include <AppKit/AppKit.h>
diff --git a/src/plugins/platforms/cocoa/qcocoaresources.qrc b/src/plugins/platforms/cocoa/qcocoaresources.qrc
index 9e0640db7d..4255bfba9d 100644
--- a/src/plugins/platforms/cocoa/qcocoaresources.qrc
+++ b/src/plugins/platforms/cocoa/qcocoaresources.qrc
@@ -9,9 +9,4 @@
<qresource prefix="/qt-project.org/mac/style">
<file>images/leopard-unified-toolbar-on.png</file>
</qresource>
-<qresource prefix="/qt-project.org/mac/">
-<file>qt_menu.nib/classes.nib</file>
-<file>qt_menu.nib/info.nib</file>
-<file>qt_menu.nib/keyedobjects.nib</file>
-</qresource>
</RCC>
diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
index be5fa61b8b..9ddad7fc7a 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm
@@ -43,6 +43,7 @@
#include <QtCore/private/qcore_mac_p.h>
#include <QtGui/qfont.h>
+#include <QtGui/private/qcoregraphics_p.h>
#include <Carbon/Carbon.h>
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 0cbdc5d9c8..9a543e893e 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -75,6 +75,9 @@
#define QT_MAC_SYSTEMTRAY_USE_GROWL
#include "qcocoasystemtrayicon.h"
+
+#ifndef QT_NO_SYSTEMTRAYICON
+
#include <qtemporaryfile.h>
#include <qimagewriter.h>
#include <qdebug.h>
@@ -83,6 +86,7 @@
#include "qt_mac_p.h"
#include "qcocoahelpers.h"
+#include <QtGui/private/qcoregraphics_p.h>
#import <AppKit/AppKit.h>
@@ -91,11 +95,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 +110,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 +140,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 +286,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 +433,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 +444,6 @@ QT_END_NAMESPACE
Q_UNUSED(notification);
emit systray->messageClicked();
}
-#endif
@end
@@ -536,3 +468,5 @@ private:
return qmenu;
}
@end
+
+#endif // QT_NO_SYSTEMTRAYICON
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h
index 282e527b0b..d47e620fbb 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.h
+++ b/src/plugins/platforms/cocoa/qcocoatheme.h
@@ -70,9 +70,7 @@ public:
const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const Q_DECL_OVERRIDE;
- QPixmap fileIconPixmap(const QFileInfo &fileInfo,
- const QSizeF &size,
- QPlatformTheme::IconOptions options = 0) const Q_DECL_OVERRIDE;
+ QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions options = 0) const override;
QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
QString standardButtonText(int button) const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 831f1cfcf4..d0879ed457 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -56,8 +56,10 @@
#include <QtCore/qfileinfo.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qcoregraphics_p.h>
#include <QtGui/qpainter.h>
#include <QtPlatformSupport/private/qcoretextfontdatabase_p.h>
+#include <QtPlatformSupport/private/qabstractfileiconengine_p.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
@@ -136,8 +138,10 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const
QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const
{
switch (dialogType) {
+#ifndef QT_NO_FILEDIALOG
case QPlatformTheme::FileDialog:
return new QCocoaFileDialogHelper();
+#endif
#ifndef QT_NO_COLORDIALOG
case QPlatformTheme::ColorDialog:
return new QCocoaColorDialogHelper();
@@ -194,7 +198,7 @@ QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
CGRect rect = CGRectMake(0, 0, width, height);
- CGContextRef ctx = qt_mac_cg_context(&ret);
+ QMacCGContext ctx(&ret);
CGAffineTransform old_xform = CGContextGetCTM(ctx);
CGContextConcatCTM(ctx, CGAffineTransformInvert(old_xform));
CGContextConcatCTM(ctx, CGAffineTransformIdentity);
@@ -202,7 +206,6 @@ QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
::RGBColor b;
b.blue = b.green = b.red = 255*255;
PlotIconRefInContext(ctx, &rect, kAlignNone, kTransformNone, &b, kPlotIconRefNormalFlags, icon);
- CGContextRelease(ctx);
return ret;
}
@@ -274,16 +277,42 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
return QPlatformTheme::standardPixmap(sp, size);
}
-QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions) const
+class QCocoaFileIconEngine : public QAbstractFileIconEngine
{
- Q_UNUSED(iconOptions);
- QMacAutoReleasePool pool;
+public:
+ explicit QCocoaFileIconEngine(const QFileInfo &info,
+ QPlatformTheme::IconOptions opts) :
+ QAbstractFileIconEngine(info, opts) {}
+
+ static QList<QSize> availableIconSizes()
+ {
+ const qreal devicePixelRatio = qGuiApp->devicePixelRatio();
+ const int sizes[] = {
+ qRound(16 * devicePixelRatio), qRound(32 * devicePixelRatio),
+ qRound(64 * devicePixelRatio), qRound(128 * devicePixelRatio),
+ qRound(256 * devicePixelRatio)
+ };
+ return QAbstractFileIconEngine::toSizeList(sizes, sizes + sizeof(sizes) / sizeof(sizes[0]));
+ }
+
+ QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) const override
+ { return QCocoaFileIconEngine::availableIconSizes(); }
+
+protected:
+ QPixmap filePixmap(const QSize &size, QIcon::Mode, QIcon::State) override
+ {
+ QMacAutoReleasePool pool;
- NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo.canonicalFilePath())];
- if (!iconImage)
- return QPixmap();
- return qt_mac_toQPixmap(iconImage, size);
+ NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo().canonicalFilePath())];
+ if (!iconImage)
+ return QPixmap();
+ return qt_mac_toQPixmap(iconImage, size);
+ }
+};
+
+QIcon QCocoaTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const
+{
+ return QIcon(new QCocoaFileIconEngine(fileInfo, iconOptions));
}
QVariant QCocoaTheme::themeHint(ThemeHint hint) const
@@ -298,17 +327,12 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
case TabFocusBehavior:
return QVariant([[NSApplication sharedApplication] isFullKeyboardAccessEnabled] ?
int(Qt::TabFocusAllControls) : int(Qt::TabFocusTextControls | Qt::TabFocusListControls));
- case IconPixmapSizes: {
- qreal devicePixelRatio = qGuiApp->devicePixelRatio();
- QList<int> sizes;
- sizes << 16 * devicePixelRatio
- << 32 * devicePixelRatio
- << 64 * devicePixelRatio
- << 128 * devicePixelRatio;
- return QVariant::fromValue(sizes);
- }
+ case IconPixmapSizes:
+ return QVariant::fromValue(QCocoaFileIconEngine::availableIconSizes());
case QPlatformTheme::PasswordMaskCharacter:
return QVariant(QChar(kBulletUnicode));
+ case QPlatformTheme::UiEffects:
+ return QVariant(int(HoverEffect));
default:
break;
}
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index d9e94735ac..b016004b23 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -219,6 +219,7 @@ public:
void windowDidResize();
void windowDidEndLiveResize();
bool windowShouldClose();
+ void windowWillClose();
bool windowIsPopupType(Qt::WindowType type = Qt::Widget) const;
void setSynchedWindowStateFromWindow();
@@ -275,6 +276,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..b2fd0580bc 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -52,6 +52,7 @@
#include <private/qwindow_p.h>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformscreen.h>
+#include <QtGui/private/qcoregraphics_p.h>
#include <AppKit/AppKit.h>
@@ -78,6 +79,14 @@ static bool isMouseEvent(NSEvent *ev)
}
}
+static void qt_closePopups()
+{
+ while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) {
+ QWindowSystemInterface::handleCloseEvent(popup->window());
+ QWindowSystemInterface::flushWindowSystemEvents();
+ }
+}
+
@implementation QNSWindowHelper
@synthesize window = _window;
@@ -505,7 +514,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 +661,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
@@ -1023,9 +1032,7 @@ void QCocoaWindow::raise()
}
static bool raiseProcess = qt_mac_resolveOption(true, "QT_MAC_SET_RAISE_PROCESS");
if (raiseProcess) {
- ProcessSerialNumber psn;
- GetCurrentProcess(&psn);
- SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
+ [NSApp activateIgnoringOtherApps:YES];
}
}
}
@@ -1107,11 +1114,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();
@@ -1223,10 +1229,7 @@ void QCocoaWindow::setEmbeddedInForeignView(bool embedded)
void QCocoaWindow::windowWillMove()
{
// Close any open popups on window move
- while (QCocoaWindow *popup = QCocoaIntegration::instance()->popPopupWindow()) {
- QWindowSystemInterface::handleCloseEvent(popup->window());
- QWindowSystemInterface::flushWindowSystemEvents();
- }
+ qt_closePopups();
}
void QCocoaWindow::windowDidMove()
@@ -1270,6 +1273,13 @@ bool QCocoaWindow::windowShouldClose()
return accepted;
}
+void QCocoaWindow::windowWillClose()
+{
+ // Close any open popups on window closing.
+ if (window() && !windowIsPopupType(window()->type()))
+ qt_closePopups();
+}
+
void QCocoaWindow::setSynchedWindowStateFromWindow()
{
if (QWindow *w = window())
@@ -1532,6 +1542,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..963b29ebbb 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;
@@ -102,6 +101,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)setMaskRegion:(const QRegion *)region;
- (void)invalidateWindowShadowIfNeeded;
- (void)drawRect:(NSRect)dirtyRect;
+- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect;
- (void)updateGeometry;
- (void)notifyWindowStateChanged:(Qt::WindowState)newState;
- (void)windowNotification : (NSNotification *) windowNotification;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index d29272a88f..8d3b970158 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"
@@ -54,6 +52,7 @@
#include <QtCore/QDebug>
#include <QtCore/qsysinfo.h>
#include <private/qguiapplication_p.h>
+#include <private/qcoregraphics_p.h>
#include "qcocoabackingstore.h"
#ifndef QT_NO_OPENGL
#include "qcocoaglcontext.h"
@@ -72,9 +71,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 +130,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 +283,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 +323,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 +340,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 +412,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 +426,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 +439,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,8 +495,8 @@ QT_WARNING_POP
qCDebug(lcQpaCocoaWindow) << "[QNSView flushBackingStore:]" << m_window << region.rectCount() << region.boundingRect() << offset;
m_backingStore = backingStore;
- m_backingStoreOffset = offset * m_backingStore->getBackingStoreDevicePixelRatio();
- foreach (QRect rect, region.rects())
+ m_backingStoreOffset = offset * m_backingStore->paintDevice()->devicePixelRatio();
+ for (const QRect &rect : region)
[self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
@@ -587,7 +557,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) {
@@ -599,6 +569,18 @@ QT_WARNING_POP
if (m_platformWindow->m_drawContentBorderGradient)
NSDrawWindowBackground(dirtyRect);
+ if (m_backingStore)
+ [self drawBackingStoreUsingCoreGraphics:dirtyRect];
+
+ [self invalidateWindowShadowIfNeeded];
+}
+
+// Draws the backing store content to the QNSView using Core Graphics.
+// This function assumes that the QNSView is in a configuration that
+// supports Core Graphics, such as "classic" mode or layer mode with
+// the default layer.
+- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect
+{
if (!m_backingStore)
return;
@@ -607,7 +589,7 @@ QT_WARNING_POP
// The backing store source rect will be larger on retina displays.
// Scale dirtyRect by the device pixel ratio:
- const qreal devicePixelRatio = m_backingStore->getBackingStoreDevicePixelRatio();
+ const qreal devicePixelRatio = m_backingStore->paintDevice()->devicePixelRatio();
CGRect dirtyBackingRect = CGRectMake(dirtyRect.origin.x * devicePixelRatio,
dirtyRect.origin.y * devicePixelRatio,
dirtyRect.size.width * devicePixelRatio,
@@ -653,8 +635,6 @@ QT_WARNING_POP
CGImageRelease(cleanImg);
CGImageRelease(subMask);
CGImageRelease(bsCGImage);
-
- [self invalidateWindowShadowIfNeeded];
}
- (BOOL) isFlipped
@@ -1396,7 +1376,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;
@@ -1409,7 +1388,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint);
zoomIn = !zoomIn;
}
-#endif
- (void)rotateWithEvent:(NSEvent *)event
{
@@ -1525,16 +1503,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/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h
index ac1e8d62eb..46e8d40efb 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.h
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h
@@ -57,6 +57,7 @@
- (void)windowWillMove:(NSNotification *)notification;
- (BOOL)windowShouldClose:(NSNotification *)notification;
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
+- (void)windowWillClose:(NSNotification *)notification;
@end
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index faa53b06ef..b96a9491e8 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -115,4 +115,11 @@
return YES;
}
+- (void)windowWillClose:(NSNotification *)notification
+{
+ Q_UNUSED(notification);
+ if (m_cocoaWindow)
+ m_cocoaWindow->windowWillClose();
+}
+
@end
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 395c25c915..7e241e3ae6 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -63,6 +63,7 @@
#include <private/qpainter_p.h>
#include <private/qpainterpath_p.h>
#include <private/qtextengine_p.h>
+#include <private/qcoregraphics_p.h>
#include "qcocoahelpers.h"
@@ -74,87 +75,6 @@ QT_BEGIN_NAMESPACE
QCoreGraphicsPaintEngine utility functions
*****************************************************************************/
-static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
-{
- CGAffineTransform old_xform = CGAffineTransformIdentity;
- if (orig_xform) { //setup xforms
- old_xform = CGContextGetCTM(hd);
- CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform));
- CGContextConcatCTM(hd, *orig_xform);
- }
-
- //do the clipping
- CGContextBeginPath(hd);
- 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];
- CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height());
- CGContextAddRect(hd, mac_r);
- }
- }
- CGContextClip(hd);
-
- if (orig_xform) {//reset xforms
- CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
- CGContextConcatCTM(hd, old_xform);
- }
-}
-
-// Implemented for qt_mac_p.h
-QMacCGContext::QMacCGContext(QPainter *p)
-{
- QPaintEngine *pe = p->paintEngine();
-#ifndef QT_NO_PRINTER
- if (pe->type() == QPaintEngine::MacPrinter)
- pe = static_cast<QMacPrintEngine*>(pe)->paintEngine();
-#endif
- pe->syncState();
- context = 0;
- if (pe->type() == QPaintEngine::CoreGraphics)
- context = static_cast<QCoreGraphicsPaintEngine*>(pe)->handle();
-
- int devType = p->device()->devType();
- if (pe->type() == QPaintEngine::Raster
- && (devType == QInternal::Widget || devType == QInternal::Pixmap || devType == QInternal::Image)) {
-
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice());
- uint flags = kCGImageAlphaPremultipliedFirst;
-#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- flags |= kCGBitmapByteOrder32Host;
-#endif
- const QImage *image = (const QImage *) pe->paintDevice();
-
- context = CGBitmapContextCreate((void *) image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
-
- CGContextTranslateCTM(context, 0, image->height());
- CGContextScaleCTM(context, 1, -1);
-
- if (devType == QInternal::Widget) {
- QRegion clip = p->paintEngine()->systemClip();
- QTransform native = p->deviceTransform();
-
- if (p->hasClipping()) {
- QRegion r = p->clipRegion();
- r.translate(native.dx(), native.dy());
- if (clip.isEmpty())
- clip = r;
- else
- clip &= r;
- }
- qt_mac_clip_cg(context, clip, 0);
-
- CGContextTranslateCTM(context, native.dx(), native.dy());
- }
- } else {
- CGContextRetain(context);
- }
-}
-
void qt_mac_cgimage_data_free(void *, const void *memoryToFree, size_t)
{
free(const_cast<void *>(memoryToFree));
@@ -456,7 +376,7 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
const QColor c0(0, 0, 0, 0), c1(255, 255, 255, 255);
QPixmap pm(w*QMACPATTERN_MASK_MULTIPLIER, h*QMACPATTERN_MASK_MULTIPLIER);
pm.fill(c0);
- CGContextRef pm_ctx = qt_mac_cg_context(&pm);
+ QMacCGContext pm_ctx(&pm);
CGContextSetFillColorWithColor(c, cgColorForQColor(c1, pat->pdev));
CGRect rect = CGRectMake(0, 0, w, h);
for (int x = 0; x < QMACPATTERN_MASK_MULTIPLIER; ++x) {
@@ -546,7 +466,8 @@ QCoreGraphicsPaintEngine::begin(QPaintDevice *pdev)
d->cosmeticPenSize = 1;
d->current.clipEnabled = false;
d->pixelSize = QPoint(1,1);
- d->hd = qt_mac_cg_context(pdev);
+ QMacCGContext ctx(pdev);
+ d->hd = CGContextRetain(ctx);
if (d->hd) {
d->saveGraphicsState();
d->orig_xform = CGContextGetCTM(d->hd);
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index 3d0c91c36c..0b5b06c44f 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -200,7 +200,7 @@ int QMacPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const
val = (int)resolution.vRes;
break;
}
- //otherwise fall through
+ Q_FALLTHROUGH();
}
case QPaintDevice::PdmDpiY:
val = (int)d->resolution.vRes;
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac_p.h b/src/plugins/platforms/cocoa/qprintengine_mac_p.h
index e3cad3fd57..ee98275b63 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac_p.h
+++ b/src/plugins/platforms/cocoa/qprintengine_mac_p.h
@@ -149,6 +149,9 @@ public:
PMPageFormat format() const { return static_cast<PMPageFormat>([printInfo PMPageFormat]); }
PMPrintSession session() const { return static_cast<PMPrintSession>([printInfo PMPrintSession]); }
PMPrintSettings settings() const { return static_cast<PMPrintSettings>([printInfo PMPrintSettings]); }
+
+ QPaintEngine *aggregateEngine() Q_DECL_OVERRIDE { return paintEngine; }
+ Qt::HANDLE nativeHandle() Q_DECL_OVERRIDE { return q_func()->handle(); }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qt_mac_p.h b/src/plugins/platforms/cocoa/qt_mac_p.h
index 03eae1b2e7..ce17919e8c 100644
--- a/src/plugins/platforms/cocoa/qt_mac_p.h
+++ b/src/plugins/platforms/cocoa/qt_mac_p.h
@@ -90,60 +90,6 @@ public:
}
};
-class Q_WIDGETS_EXPORT QMacWindowChangeEvent
-{
-private:
- static QList<QMacWindowChangeEvent*> *change_events;
-public:
- QMacWindowChangeEvent() {
- }
- virtual ~QMacWindowChangeEvent() {
- }
- static inline void exec(bool ) {
- }
-protected:
- virtual void windowChanged() = 0;
- virtual void flushWindowChanged() = 0;
-};
-
-class QMacCGContext
-{
- CGContextRef context;
-public:
- QMacCGContext(QPainter *p); //qpaintengine_mac.mm
- inline QMacCGContext() { context = 0; }
- inline QMacCGContext(QPaintDevice *pdev) {
- extern CGContextRef qt_mac_cg_context(QPaintDevice *);
- context = qt_mac_cg_context(pdev);
- }
- inline QMacCGContext(CGContextRef cg, bool takeOwnership=false) {
- context = cg;
- if(!takeOwnership)
- CGContextRetain(context);
- }
- inline QMacCGContext(const QMacCGContext &copy) : context(0) { *this = copy; }
- inline ~QMacCGContext() {
- if(context)
- CGContextRelease(context);
- }
- inline bool isNull() const { return context; }
- inline operator CGContextRef() { return context; }
- inline QMacCGContext &operator=(const QMacCGContext &copy) {
- if(context)
- CGContextRelease(context);
- context = copy.context;
- CGContextRetain(context);
- return *this;
- }
- inline QMacCGContext &operator=(CGContextRef cg) {
- if(context)
- CGContextRelease(context);
- context = cg;
- CGContextRetain(context); //we do not take ownership
- return *this;
- }
-};
-
class QMacInternalPasteboardMime;
class QMimeData;
diff --git a/src/plugins/platforms/cocoa/qt_menu.nib/classes.nib b/src/plugins/platforms/cocoa/qt_menu.nib/classes.nib
deleted file mode 100644
index 78941153c2..0000000000
--- a/src/plugins/platforms/cocoa/qt_menu.nib/classes.nib
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBClasses</key>
- <array>
- <dict>
- <key>ACTIONS</key>
- <dict>
- <key>hide</key>
- <string>id</string>
- <key>hideOtherApplications</key>
- <string>id</string>
- <key>orderFrontStandardAboutPanel</key>
- <string>id</string>
- <key>qtDispatcherToQPAMenuItem</key>
- <string>id</string>
- <key>terminate</key>
- <string>id</string>
- <key>unhideAllApplications</key>
- <string>id</string>
- </dict>
- <key>CLASS</key>
- <string>QCocoaMenuLoader</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>OUTLETS</key>
- <dict>
- <key>aboutItem</key>
- <string>NSMenuItem</string>
- <key>aboutQtItem</key>
- <string>NSMenuItem</string>
- <key>appMenu</key>
- <string>NSMenu</string>
- <key>hideItem</key>
- <string>NSMenuItem</string>
- <key>preferencesItem</key>
- <string>NSMenuItem</string>
- <key>quitItem</key>
- <string>NSMenuItem</string>
- <key>theMenu</key>
- <string>NSMenu</string>
- </dict>
- <key>SUPERCLASS</key>
- <string>NSResponder</string>
- </dict>
- <dict>
- <key>CLASS</key>
- <string>FirstResponder</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>NSObject</string>
- </dict>
- </array>
- <key>IBVersion</key>
- <string>1</string>
-</dict>
-</plist>
diff --git a/src/plugins/platforms/cocoa/qt_menu.nib/info.nib b/src/plugins/platforms/cocoa/qt_menu.nib/info.nib
deleted file mode 100644
index 02e5cca562..0000000000
--- a/src/plugins/platforms/cocoa/qt_menu.nib/info.nib
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBFramework Version</key>
- <string>672</string>
- <key>IBOldestOS</key>
- <integer>5</integer>
- <key>IBOpenObjects</key>
- <array>
- <integer>57</integer>
- </array>
- <key>IBSystem Version</key>
- <string>9L31a</string>
- <key>targetFramework</key>
- <string>IBCocoaFramework</string>
-</dict>
-</plist>
diff --git a/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib b/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib
deleted file mode 100644
index 67207ca628..0000000000
--- a/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib
+++ /dev/null
Binary files differ
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/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
index 730d5de450..0ea2fcfa74 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
@@ -563,7 +563,7 @@ public:
if (newPen.widthF() <= 1.0)
props.startCap = props.endCap = props.dashCap = D2D1_CAP_STYLE_FLAT;
- // fall through
+ Q_FALLTHROUGH();
default:
props.dashStyle = D2D1_DASH_STYLE_CUSTOM;
break;
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/directfb.pro b/src/plugins/platforms/directfb/directfb.pro
index 5c81e0283a..de0344ff5c 100644
--- a/src/plugins/platforms/directfb/directfb.pro
+++ b/src/plugins/platforms/directfb/directfb.pro
@@ -2,8 +2,7 @@ TARGET = qdirectfb
QT += core-private gui-private platformsupport-private
-LIBS += $$QMAKE_LIBS_DIRECTFB
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DIRECTFB
+QMAKE_USE += directfb
SOURCES = main.cpp \
qdirectfbintegration.cpp \
@@ -25,7 +24,7 @@ HEADERS = qdirectfbintegration.h \
qdirectfbeglhooks.h
# ### port the GL context
-contains(QT_CONFIG, directfb_egl) {
+qtConfig(directfb_egl) {
HEADERS += qdirectfb_egl.h
SOURCES += qdirectfb_egl.cpp
DEFINES += DIRECTFB_GL_EGL
diff --git a/src/plugins/platforms/directfb/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..0ea65bd1ff
--- /dev/null
+++ b/src/plugins/platforms/eglfs/api/api.pri
@@ -0,0 +1,21 @@
+
+SOURCES += $$PWD/qeglfswindow.cpp \
+ $$PWD/qeglfsscreen.cpp \
+ $$PWD/qeglfscursor.cpp \
+ $$PWD/qeglfshooks.cpp \
+ $$PWD/qeglfsdeviceintegration.cpp \
+ $$PWD/qeglfsintegration.cpp \
+ $$PWD/qeglfscontext.cpp \
+ $$PWD/qeglfsoffscreenwindow.cpp
+
+HEADERS += $$PWD/qeglfswindow_p.h \
+ $$PWD/qeglfsscreen_p.h \
+ $$PWD/qeglfscursor_p.h \
+ $$PWD/qeglfshooks_p.h \
+ $$PWD/qeglfsdeviceintegration_p.h \
+ $$PWD/qeglfsintegration_p.h \
+ $$PWD/qeglfscontext_p.h \
+ $$PWD/qeglfsoffscreenwindow_p.h \
+ $$PWD/qeglfsglobal_p.h
+
+INCLUDEPATH += $$PWD
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp
index 6acb362bf0..1a33215295 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp
@@ -37,15 +37,15 @@
**
****************************************************************************/
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include <QtGui/QSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglpbuffer_p.h>
-#include "qeglfscontext.h"
-#include "qeglfswindow.h"
-#include "qeglfshooks.h"
-#include "qeglfscursor.h"
+#include "qeglfscontext_p.h"
+#include "qeglfswindow_p.h"
+#include "qeglfshooks_p.h"
+#include "qeglfscursor_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
index 91c5a7910b..65af3a7cee 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
@@ -40,7 +40,18 @@
#ifndef QEGLFSCONTEXT_H
#define QEGLFSCONTEXT_H
-#include "qeglfsglobal.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_p.h"
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <QtCore/QVariant>
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
index 6c8c35b1dc..1b3446c4ac 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
@@ -37,9 +37,9 @@
**
****************************************************************************/
-#include "qeglfscursor.h"
-#include "qeglfsintegration.h"
-#include "qeglfsscreen.h"
+#include "qeglfscursor_p.h"
+#include "qeglfsintegration_p.h"
+#include "qeglfsscreen_p.h"
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/QOpenGLContext>
@@ -59,12 +59,11 @@
QT_BEGIN_NAMESPACE
QEglFSCursor::QEglFSCursor(QPlatformScreen *screen)
- : m_visible(true),
- m_screen(static_cast<QEglFSScreen *>(screen)),
- m_program(0),
- m_textureEntry(0),
- m_deviceListener(0),
- m_updateRequested(false)
+ : m_visible(true),
+ m_screen(static_cast<QEglFSScreen *>(screen)),
+ m_activeScreen(nullptr),
+ m_deviceListener(0),
+ m_updateRequested(false)
{
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
if (!hideCursorVal.isEmpty())
@@ -72,6 +71,10 @@ QEglFSCursor::QEglFSCursor(QPlatformScreen *screen)
if (!m_visible)
return;
+ int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION");
+ if (rotation)
+ m_rotationMatrix.rotate(rotation, 0, 0, 1);
+
// Try to load the cursor atlas. If this fails, m_visible is set to false and
// paintOnScreen() and setCurrentCursor() become no-ops.
initCursorAtlas();
@@ -112,15 +115,14 @@ void QEglFSCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::Device
void QEglFSCursor::resetResources()
{
- if (QOpenGLContext::currentContext()) {
- delete m_program;
- glDeleteTextures(1, &m_cursor.customCursorTexture);
- glDeleteTextures(1, &m_cursorAtlas.texture);
+ if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) {
+ GraphicsContextData &gfx(m_gfx[ctx]);
+ delete gfx.program;
+ glDeleteTextures(1, &gfx.customCursorTexture);
+ glDeleteTextures(1, &gfx.atlasTexture);
+ gfx = GraphicsContextData();
}
- m_program = 0;
- m_cursor.customCursorTexture = 0;
m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull();
- m_cursorAtlas.texture = 0;
}
void QEglFSCursor::createShaderPrograms()
@@ -129,9 +131,10 @@ void QEglFSCursor::createShaderPrograms()
"attribute highp vec2 vertexCoordEntry;\n"
"attribute highp vec2 textureCoordEntry;\n"
"varying highp vec2 textureCoord;\n"
+ "uniform highp mat4 mat;\n"
"void main() {\n"
" textureCoord = textureCoordEntry;\n"
- " gl_Position = vec4(vertexCoordEntry, 1.0, 1.0);\n"
+ " gl_Position = mat * vec4(vertexCoordEntry, 1.0, 1.0);\n"
"}\n";
static const char *textureFragmentProgram =
@@ -141,14 +144,16 @@ void QEglFSCursor::createShaderPrograms()
" gl_FragColor = texture2D(texture, textureCoord).bgra;\n"
"}\n";
- m_program = new QOpenGLShaderProgram;
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
- m_program->bindAttributeLocation("vertexCoordEntry", 0);
- m_program->bindAttributeLocation("textureCoordEntry", 1);
- m_program->link();
+ GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]);
+ gfx.program = new QOpenGLShaderProgram;
+ gfx.program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
+ gfx.program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
+ gfx.program->bindAttributeLocation("vertexCoordEntry", 0);
+ gfx.program->bindAttributeLocation("textureCoordEntry", 1);
+ gfx.program->link();
- m_textureEntry = m_program->uniformLocation("texture");
+ gfx.textureEntry = gfx.program->uniformLocation("texture");
+ gfx.matEntry = gfx.program->uniformLocation("mat");
}
void QEglFSCursor::createCursorTexture(uint *texture, const QImage &image)
@@ -208,7 +213,7 @@ void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window)
Q_UNUSED(window);
const QRect oldCursorRect = cursorRect();
if (setCurrentCursor(cursor))
- update(oldCursorRect | cursorRect());
+ update(oldCursorRect | cursorRect(), false);
}
bool QEglFSCursor::setCurrentCursor(QCursor *cursor)
@@ -232,16 +237,17 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor)
hs * (m_cursor.shape / m_cursorAtlas.cursorsPerRow),
ws, hs);
m_cursor.hotSpot = m_cursorAtlas.hotSpots[m_cursor.shape];
- m_cursor.texture = m_cursorAtlas.texture;
+ m_cursor.useCustomCursor = false;
m_cursor.size = QSize(m_cursorAtlas.cursorWidth, m_cursorAtlas.cursorHeight);
} else {
QImage image = cursor->pixmap().toImage();
m_cursor.textureRect = QRectF(0, 0, 1, 1);
m_cursor.hotSpot = cursor->hotSpot();
- m_cursor.texture = 0; // will get updated in the next render()
+ m_cursor.useCustomCursor = false; // will get updated in the next render()
m_cursor.size = image.size();
m_cursor.customCursorImage = image;
m_cursor.customCursorPending = true;
+ m_cursor.customCursorKey = m_cursor.customCursorImage.cacheKey();
}
return true;
@@ -251,17 +257,20 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor)
class CursorUpdateEvent : public QEvent
{
public:
- CursorUpdateEvent(const QPoint &pos, const QRegion &rgn)
+ CursorUpdateEvent(const QPoint &pos, const QRect &rect, bool allScreens)
: QEvent(QEvent::Type(QEvent::User + 1)),
m_pos(pos),
- m_region(rgn)
+ m_rect(rect),
+ m_allScreens(allScreens)
{ }
QPoint pos() const { return m_pos; }
- QRegion region() const { return m_region; }
+ QRegion rect() const { return m_rect; }
+ bool allScreens() const { return m_allScreens; }
private:
QPoint m_pos;
- QRegion m_region;
+ QRect m_rect;
+ bool m_allScreens;
};
bool QEglFSCursor::event(QEvent *e)
@@ -269,21 +278,30 @@ bool QEglFSCursor::event(QEvent *e)
if (e->type() == QEvent::User + 1) {
CursorUpdateEvent *ev = static_cast<CursorUpdateEvent *>(e);
m_updateRequested = false;
- QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(ev->pos()), ev->region());
- QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
+ if (!ev->allScreens()) {
+ QWindow *w = m_screen->topLevelAt(ev->pos()); // works for the entire virtual desktop, no need to loop
+ if (w) {
+ QWindowSystemInterface::handleExposeEvent(w, ev->rect());
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
+ }
+ } else {
+ for (QWindow *w : qGuiApp->topLevelWindows())
+ QWindowSystemInterface::handleExposeEvent(w, w->geometry());
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
+ }
return true;
}
return QPlatformCursor::event(e);
}
-void QEglFSCursor::update(const QRegion &rgn)
+void QEglFSCursor::update(const QRect &rect, bool allScreens)
{
if (!m_updateRequested) {
// Must not flush the window system events directly from here since we are likely to
// be a called directly from QGuiApplication's processMouseEvents. Flushing events
// could cause reentering by dispatching more queued mouse events.
m_updateRequested = true;
- QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rgn));
+ QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rect, allScreens));
}
}
@@ -302,8 +320,9 @@ void QEglFSCursor::setPos(const QPoint &pos)
QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
const QRect oldCursorRect = cursorRect();
m_cursor.pos = pos;
- update(oldCursorRect | cursorRect());
- m_screen->handleCursorMove(m_cursor.pos);
+ update(oldCursorRect | cursorRect(), false);
+ for (QPlatformScreen *screen : m_screen->virtualSiblings())
+ static_cast<QEglFSScreen *>(screen)->handleCursorMove(m_cursor.pos);
}
void QEglFSCursor::pointerEvent(const QMouseEvent &event)
@@ -312,8 +331,9 @@ void QEglFSCursor::pointerEvent(const QMouseEvent &event)
return;
const QRect oldCursorRect = cursorRect();
m_cursor.pos = event.screenPos().toPoint();
- update(oldCursorRect | cursorRect());
- m_screen->handleCursorMove(m_cursor.pos);
+ update(oldCursorRect | cursorRect(), false);
+ for (QPlatformScreen *screen : m_screen->virtualSiblings())
+ static_cast<QEglFSScreen *>(screen)->handleCursorMove(m_cursor.pos);
}
void QEglFSCursor::paintOnScreen()
@@ -321,15 +341,35 @@ void QEglFSCursor::paintOnScreen()
if (!m_visible)
return;
- const QRectF cr = cursorRect();
- const QRect screenRect(m_screen->geometry());
- const GLfloat x1 = 2 * (cr.left() / screenRect.width()) - 1;
- const GLfloat x2 = 2 * (cr.right() / screenRect.width()) - 1;
- const GLfloat y1 = 1 - (cr.top() / screenRect.height()) * 2;
- const GLfloat y2 = 1 - (cr.bottom() / screenRect.height()) * 2;
- QRectF r(QPointF(x1, y1), QPointF(x2, y2));
+ QRect cr = cursorRect(); // hotspot included
+
+ // Support virtual desktop too. Backends with multi-screen support (e.g. all
+ // variants of KMS/DRM) will enable this by default. In this case all
+ // screens are siblings of each other. When not enabled, the sibling list
+ // only contains m_screen itself.
+ for (QPlatformScreen *screen : m_screen->virtualSiblings()) {
+ if (screen->geometry().contains(cr.topLeft() + m_cursor.hotSpot)
+ && QOpenGLContext::currentContext()->screen() == screen->screen())
+ {
+ cr.translate(-screen->geometry().topLeft());
+ const QSize screenSize = screen->geometry().size();
+ const GLfloat x1 = 2 * (cr.left() / GLfloat(screenSize.width())) - 1;
+ const GLfloat x2 = 2 * (cr.right() / GLfloat(screenSize.width())) - 1;
+ const GLfloat y1 = 1 - (cr.top() / GLfloat(screenSize.height())) * 2;
+ const GLfloat y2 = 1 - (cr.bottom() / GLfloat(screenSize.height())) * 2;
+ QRectF r(QPointF(x1, y1), QPointF(x2, y2));
+
+ draw(r);
+
+ if (screen != m_activeScreen) {
+ m_activeScreen = screen;
+ // Do not want a leftover cursor on the screen the cursor just left.
+ update(cursorRect(), true);
+ }
- draw(r);
+ break;
+ }
+ }
}
// In order to prevent breaking code doing custom OpenGL rendering while
@@ -431,30 +471,33 @@ void QEglFSCursor::draw(const QRectF &r)
{
StateSaver stateSaver;
- if (!m_program) {
+ GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]);
+ if (!gfx.program) {
// one time initialization
initializeOpenGLFunctions();
createShaderPrograms();
- if (!m_cursorAtlas.texture) {
- createCursorTexture(&m_cursorAtlas.texture, m_cursorAtlas.image);
+ if (!gfx.atlasTexture) {
+ createCursorTexture(&gfx.atlasTexture, m_cursorAtlas.image);
if (m_cursor.shape != Qt::BitmapCursor)
- m_cursor.texture = m_cursorAtlas.texture;
+ m_cursor.useCustomCursor = false;
}
}
- if (m_cursor.shape == Qt::BitmapCursor && m_cursor.customCursorPending) {
+ if (m_cursor.shape == Qt::BitmapCursor && (m_cursor.customCursorPending || m_cursor.customCursorKey != gfx.customCursorKey)) {
// upload the custom cursor
- createCursorTexture(&m_cursor.customCursorTexture, m_cursor.customCursorImage);
- m_cursor.texture = m_cursor.customCursorTexture;
+ createCursorTexture(&gfx.customCursorTexture, m_cursor.customCursorImage);
+ m_cursor.useCustomCursor = true;
m_cursor.customCursorPending = false;
+ gfx.customCursorKey = m_cursor.customCursorKey;
}
- Q_ASSERT(m_cursor.texture);
+ GLuint cursorTexture = !m_cursor.useCustomCursor ? gfx.atlasTexture : gfx.customCursorTexture;
+ Q_ASSERT(cursorTexture);
- m_program->bind();
+ gfx.program->bind();
const GLfloat x1 = r.left();
const GLfloat x2 = r.right();
@@ -479,19 +522,20 @@ void QEglFSCursor::draw(const QRectF &r)
};
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_cursor.texture);
+ glBindTexture(GL_TEXTURE_2D, cursorTexture);
if (stateSaver.vaoHelper->isValid())
stateSaver.vaoHelper->glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
- m_program->enableAttributeArray(0);
- m_program->enableAttributeArray(1);
- m_program->setAttributeArray(0, cursorCoordinates, 2);
- m_program->setAttributeArray(1, textureCoordinates, 2);
+ gfx.program->enableAttributeArray(0);
+ gfx.program->enableAttributeArray(1);
+ gfx.program->setAttributeArray(0, cursorCoordinates, 2);
+ gfx.program->setAttributeArray(1, textureCoordinates, 2);
- m_program->setUniformValue(m_textureEntry, 0);
+ gfx.program->setUniformValue(gfx.textureEntry, 0);
+ gfx.program->setUniformValue(gfx.matEntry, m_rotationMatrix);
glDisable(GL_CULL_FACE);
glFrontFace(GL_CCW);
@@ -501,9 +545,9 @@ void QEglFSCursor::draw(const QRectF &r)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- m_program->disableAttributeArray(0);
- m_program->disableAttributeArray(1);
- m_program->release();
+ gfx.program->disableAttributeArray(0);
+ gfx.program->disableAttributeArray(1);
+ gfx.program->release();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
index bb30d53d6c..bf6dbc8a21 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
@@ -51,9 +51,10 @@
// We mean it.
//
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include <qpa/qplatformcursor.h>
#include <qpa/qplatformscreen.h>
+#include <QtGui/QMatrix4x4>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/private/qinputdevicemanager_p.h>
@@ -104,30 +105,29 @@ private:
bool setCurrentCursor(QCursor *cursor);
#endif
void draw(const QRectF &rect);
- void update(const QRegion &region);
+ void update(const QRect &rect, bool allScreens);
void createShaderPrograms();
void createCursorTexture(uint *texture, const QImage &image);
void initCursorAtlas();
// current cursor information
struct Cursor {
- Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0), customCursorPending(false) { }
- uint texture; // a texture from 'image' or the atlas
+ Cursor() : shape(Qt::BlankCursor), customCursorPending(false), customCursorKey(0), useCustomCursor(false) { }
Qt::CursorShape shape;
QRectF textureRect; // normalized rect inside texture
QSize size; // size of the cursor
QPoint hotSpot;
QImage customCursorImage;
QPoint pos; // current cursor position
- uint customCursorTexture;
bool customCursorPending;
+ qint64 customCursorKey;
+ bool useCustomCursor;
} m_cursor;
// cursor atlas information
struct CursorAtlas {
- CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { }
+ CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { }
int cursorsPerRow;
- uint texture;
int width, height; // width and height of the atlas
int cursorWidth, cursorHeight; // width and height of cursors inside the atlas
QList<QPoint> hotSpots;
@@ -136,10 +136,22 @@ private:
bool m_visible;
QEglFSScreen *m_screen;
- QOpenGLShaderProgram *m_program;
- int m_textureEntry;
+ QPlatformScreen *m_activeScreen;
QEglFSCursorDeviceListener *m_deviceListener;
bool m_updateRequested;
+ QMatrix4x4 m_rotationMatrix;
+
+ struct GraphicsContextData {
+ GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0),
+ customCursorTexture(0), atlasTexture(0), customCursorKey(0) { }
+ QOpenGLShaderProgram *program;
+ int textureEntry;
+ int matEntry;
+ uint customCursorTexture;
+ uint atlasTexture;
+ qint64 customCursorKey;
+ };
+ QHash<QOpenGLContext *, GraphicsContextData> m_gfx;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index fc41dc5643..9f05767366 100644
--- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -37,10 +37,13 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
-#include "qeglfsintegration.h"
-#include "qeglfscursor.h"
-#include "qeglfswindow.h"
+#include "qeglfsdeviceintegration_p.h"
+#include "qeglfsintegration_p.h"
+#include "qeglfscursor_p.h"
+#include "qeglfswindow_p.h"
+#include "qeglfsscreen_p.h"
+#include "qeglfshooks_p.h"
+
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QGuiApplication>
#include <private/qguiapplication_p.h>
@@ -64,14 +67,15 @@ 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))
+
#endif // QT_NO_LIBRARY
-QStringList QEGLDeviceIntegrationFactory::keys(const QString &pluginPath)
+QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
{
QStringList list;
#ifndef QT_NO_LIBRARY
@@ -95,19 +99,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 +122,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 +135,7 @@ QByteArray QEGLDeviceIntegration::fbDeviceName() const
#endif
}
-int QEGLDeviceIntegration::framebufferIndex() const
+int QEglFSDeviceIntegration::framebufferIndex() const
{
int fbIndex = 0;
#ifndef QT_NO_REGULAREXPRESSION
@@ -143,7 +147,7 @@ int QEGLDeviceIntegration::framebufferIndex() const
return fbIndex;
}
-void QEGLDeviceIntegration::platformInit()
+void QEglFSDeviceIntegration::platformInit()
{
#ifdef Q_OS_LINUX
QByteArray fbDev = fbDeviceName();
@@ -161,7 +165,7 @@ void QEGLDeviceIntegration::platformInit()
#endif
}
-void QEGLDeviceIntegration::platformDestroy()
+void QEglFSDeviceIntegration::platformDestroy()
{
#ifdef Q_OS_LINUX
if (framebuffer != -1)
@@ -169,27 +173,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 +202,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 +224,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 +273,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 +293,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);
+ return new QEglFSCursor(static_cast<QEglFSScreen *>(screen));
}
-void QEGLDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
+void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
{
Q_UNUSED(surface);
@@ -325,24 +329,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..4335554912 100644
--- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qeglfsglobal.h"
+#include "qeglfsglobal_p.h"
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h>
#include <QtCore/QString>
@@ -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_p.h
index 309655e86c..bad5095d21 100644
--- a/src/plugins/platforms/eglfs/qeglfsglobal.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h
@@ -40,7 +40,22 @@
#ifndef QEGLFSGLOBAL_H
#define QEGLFSGLOBAL_H
-#include <qglobal.h>
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+#include <QtPlatformSupport/private/qt_egl_p.h>
+
+QT_BEGIN_NAMESPACE
#ifdef QT_BUILD_EGL_DEVICE_LIB
#define Q_EGLFS_EXPORT Q_DECL_EXPORT
@@ -48,7 +63,6 @@
#define Q_EGLFS_EXPORT Q_DECL_IMPORT
#endif
-#include <QtPlatformSupport/private/qt_egl_p.h>
#undef Status
#undef None
#undef Bool
@@ -61,4 +75,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/api/qeglfshooks_p.h b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h
new file mode 100644
index 0000000000..4c3149c7c9
--- /dev/null
+++ b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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 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_p.h"
+#include "qeglfsdeviceintegration_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QEglFSHooks : public QEglFSDeviceIntegration
+{
+};
+
+Q_EGLFS_EXPORT QEglFSDeviceIntegration *qt_egl_device_integration();
+
+QT_END_NAMESPACE
+
+#endif // QEGLFSHOOKS_H
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
index 6f38a96f45..4974499e0a 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
@@ -51,12 +51,12 @@
#include <qpa/qplatforminputcontextfactory_p.h>
#include <private/qgenericunixthemes_p.h>
-#include "qeglfsintegration.h"
-#include "qeglfswindow.h"
-#include "qeglfshooks.h"
-#include "qeglfscontext.h"
-#include "qeglfsoffscreenwindow.h"
-#include "qeglfscursor.h"
+#include "qeglfsintegration_p.h"
+#include "qeglfswindow_p.h"
+#include "qeglfshooks_p.h"
+#include "qeglfscontext_p.h"
+#include "qeglfsoffscreenwindow_p.h"
+#include "qeglfscursor_p.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
@@ -70,17 +70,17 @@
#include <QtPlatformHeaders/QEGLNativeContext>
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
#include <QtPlatformSupport/private/qevdevtouchmanager_p.h>
#endif
-#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(tslib)
#include <QtPlatformSupport/private/qtslib_p.h>
#endif
@@ -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);
@@ -386,7 +386,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na
QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const
{
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
if (function == QEglFSFunctions::loadKeymapTypeIdentifier())
return QFunctionPointer(loadKeymapStatic);
#else
@@ -398,7 +398,7 @@ QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function)
void QEglFSIntegration::loadKeymapStatic(const QString &filename)
{
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
QEglFSIntegration *self = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration());
if (self->m_kbdMgr)
self->m_kbdMgr->loadKeymap(filename);
@@ -411,22 +411,22 @@ void QEglFSIntegration::loadKeymapStatic(const QString &filename)
void QEglFSIntegration::createInputHandlers()
{
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) {
new QLibInputHandler(QLatin1String("libinput"), QString());
return;
}
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
-#ifndef QT_NO_TSLIB
+#if QT_CONFIG(tslib)
const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB");
if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */);
else
-#endif // QT_NO_TSLIB
+#endif
new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this);
#endif
}
@@ -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/api/qeglfsintegration_p.h
index 678452a8db..1a3a44d441 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
@@ -40,7 +40,18 @@
#ifndef QEGLFSINTEGRATION_H
#define QEGLFSINTEGRATION_H
-#include "qeglfsglobal.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_p.h"
#include <QtCore/QVariant>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
@@ -92,8 +103,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/api/qeglfsoffscreenwindow.cpp
index 11b101970b..7de5379ae3 100644
--- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#include "qeglfsoffscreenwindow.h"
-#include "qeglfshooks.h"
+#include "qeglfsoffscreenwindow_p.h"
+#include "qeglfshooks_p.h"
#include <QtGui/QOffscreenSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h
index 673fa0d729..ec483c64e2 100644
--- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h
@@ -40,7 +40,18 @@
#ifndef QEGLFSOFFSCREENWINDOW_H
#define QEGLFSOFFSCREENWINDOW_H
-#include "qeglfsglobal.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_p.h"
#include <qpa/qplatformoffscreensurface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
index a1ab854db1..b0c32e5176 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
@@ -65,6 +65,31 @@ QEglFSScreen::~QEglFSScreen()
QRect QEglFSScreen::geometry() const
{
+ QRect r = rawGeometry();
+
+ static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION");
+ switch (rotation) {
+ case 0:
+ case 180:
+ case -180:
+ break;
+ case 90:
+ case -90: {
+ int h = r.height();
+ r.setHeight(r.width());
+ r.setWidth(h);
+ break;
+ }
+ default:
+ qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation);
+ break;
+ }
+
+ return r;
+}
+
+QRect QEglFSScreen::rawGeometry() const
+{
return QRect(QPoint(0, 0), qt_egl_device_integration()->screenSize());
}
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
index 57d68ca572..131e619e06 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
-#include "qeglfsglobal.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_p.h"
#include <QtCore/QPointer>
+#include <qpa/qplatformscreen.h>
+
QT_BEGIN_NAMESPACE
class QEglFSWindow;
@@ -55,6 +68,7 @@ public:
~QEglFSScreen();
QRect geometry() const Q_DECL_OVERRIDE;
+ virtual QRect rawGeometry() const;
int depth() const Q_DECL_OVERRIDE;
QImage::Format format() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
index 556d3942cd..5ce88e6bd8 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
@@ -141,7 +142,8 @@ void QEglFSWindow::create()
context->setScreen(window()->screen());
if (Q_UNLIKELY(!context->create()))
qFatal("EGLFS: Failed to create compositing context");
- compositor->setTarget(context, window());
+ compositor->setTarget(context, window(), screen->rawGeometry());
+ compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"));
// If there is a "root" window into which raster and QOpenGLWidget content is
// composited, all other contexts must share with its context.
if (!qt_gl_global_share_context()) {
@@ -186,9 +188,10 @@ 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);
+ const QSize surfaceSize = screen()->rawGeometry().size();
+ m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format);
m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL);
}
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
index d607c8bd62..6e752b8f79 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
-#include "qeglfsglobal.h"
-#include "qeglfsintegration.h"
-#include "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_p.h"
+#include "qeglfsintegration_p.h"
+#include "qeglfsscreen_p.h"
#include <qpa/qplatformwindow.h>
#include <QtPlatformSupport/private/qopenglcompositor_p.h>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
index 769c248d0d..d86a67b4f4 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
@@ -1,12 +1,13 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += gui-private
-contains(QT_CONFIG, egl_x11): SUBDIRS += eglfs_x11
-contains(QT_CONFIG, eglfs_gbm): SUBDIRS += eglfs_kms_support eglfs_kms
-contains(QT_CONFIG, eglfs_egldevice): SUBDIRS += eglfs_kms_support eglfs_kms_egldevice
-contains(QT_CONFIG, eglfs_brcm): SUBDIRS += eglfs_brcm
-contains(QT_CONFIG, eglfs_mali): SUBDIRS += eglfs_mali
-contains(QT_CONFIG, eglfs_viv): SUBDIRS += eglfs_viv
-contains(QT_CONFIG, eglfs_viv_wl): SUBDIRS += eglfs_viv_wl
+qtConfig(egl_x11): SUBDIRS += eglfs_x11
+qtConfig(eglfs_gbm): SUBDIRS += eglfs_kms_support eglfs_kms
+qtConfig(eglfs_egldevice): SUBDIRS += eglfs_kms_support eglfs_kms_egldevice
+qtConfig(eglfs_brcm): SUBDIRS += eglfs_brcm
+qtConfig(eglfs_mali): SUBDIRS += eglfs_mali
+qtConfig(eglfs_viv): SUBDIRS += eglfs_viv
+qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl
eglfs_kms_egldevice.depends = eglfs_kms_support
eglfs_kms.depends = eglfs_kms_support
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
index 2b710ac24c..7f1e7b9f59 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
@@ -1,8 +1,8 @@
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/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
LIBS += -lbcm_host
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 b1791240ab..10571dc978 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
@@ -4,20 +4,14 @@ 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
+INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
-CONFIG += link_pkgconfig
-!contains(QT_CONFIG, no-pkg-config) {
- PKGCONFIG += libdrm gbm
-} else {
- LIBS += -ldrm -lgbm
-}
-
+QMAKE_USE += gbm drm
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
index 278752bddf..3a220ec942 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
@@ -42,7 +42,7 @@
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmscreen.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
@@ -142,10 +142,10 @@ void QEglFSKmsGbmDevice::handleDrmEvent()
drmHandleEvent(fd(), &drmEvent);
}
-QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
+QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output)
{
static bool firstScreen = true;
- QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output, position);
+ QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output);
if (firstScreen && integration->hwCursor()) {
m_globalCursor = new QEglFSKmsGbmCursor(screen);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
index 6a45f9ffa0..7c0af84422 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
@@ -68,8 +68,7 @@ public:
virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position) Q_DECL_OVERRIDE;
+ QEglFSKmsOutput output) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QEglFSKmsGbmDevice)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/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/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index 7a17b60a5e..75ff3ac749 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -42,7 +42,7 @@
#include "qeglfskmsgbmscreen.h"
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmcursor.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
@@ -93,10 +93,9 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject(
}
QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration,
- QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position)
- : QEglFSKmsScreen(integration, device, output, position)
+ QEglFSKmsDevice *device,
+ QEglFSKmsOutput output)
+ : QEglFSKmsScreen(integration, device, output)
, m_gbm_surface(Q_NULLPTR)
, m_gbm_bo_current(Q_NULLPTR)
, m_gbm_bo_next(Q_NULLPTR)
@@ -130,8 +129,8 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface()
if (!m_gbm_surface) {
qCDebug(qLcEglfsKmsDebug) << "Creating window for screen" << name();
m_gbm_surface = gbm_surface_create(static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice(),
- geometry().width(),
- geometry().height(),
+ rawGeometry().width(),
+ rawGeometry().height(),
GBM_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
index 3381bbfdbb..d7ad348291 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
@@ -55,9 +55,8 @@ class QEglFSKmsGbmScreen : public QEglFSKmsScreen
{
public:
QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration,
- QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsDevice *device,
+ QEglFSKmsOutput output);
~QEglFSKmsGbmScreen();
QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
index e2263f6cbf..582982df76 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,19 +1,13 @@
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
+INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
-CONFIG += link_pkgconfig
-!contains(QT_CONFIG, no-pkg-config) {
- PKGCONFIG += libdrm
-} else {
- LIBS += -ldrm
-}
-
+QMAKE_USE += drm
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
index 743f714cf0..d30963ff96 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
@@ -40,11 +40,15 @@
#include "qeglfskmsegldevice.h"
#include "qeglfskmsegldevicescreen.h"
#include "qeglfskmsegldeviceintegration.h"
+#include "private/qeglfscursor_p.h"
#include <QtCore/private/qcore_unix_p.h>
+QT_BEGIN_NAMESPACE
+
QEglFSKmsEglDevice::QEglFSKmsEglDevice(QEglFSKmsIntegration *integration, const QString &path)
- : QEglFSKmsDevice(integration, path)
+ : QEglFSKmsDevice(integration, path),
+ m_globalCursor(nullptr)
{
}
@@ -52,6 +56,8 @@ bool QEglFSKmsEglDevice::open()
{
Q_ASSERT(fd() == -1);
+ qCDebug(qLcEglfsKmsDebug, "Opening DRM device %s", qPrintable(devicePath()));
+
int fd = drmOpen(devicePath().toLocal8Bit().constData(), Q_NULLPTR);
if (Q_UNLIKELY(fd < 0))
qFatal("Could not open DRM device");
@@ -63,6 +69,8 @@ bool QEglFSKmsEglDevice::open()
void QEglFSKmsEglDevice::close()
{
+ qCDebug(qLcEglfsKmsDebug, "Closing DRM device");
+
if (qt_safe_close(fd()) == -1)
qErrnoWarning("Could not close DRM device");
@@ -74,7 +82,26 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const
return static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice();
}
-QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
+QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device,
+ QEglFSKmsOutput output)
{
- return new QEglFSKmsEglDeviceScreen(integration, device, output, position);
+ QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output);
+
+ if (!m_globalCursor && !integration->separateScreens()) {
+ qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor");
+ m_globalCursor = new QEglFSCursor(screen);
+ }
+
+ return screen;
}
+
+void QEglFSKmsEglDevice::destroyGlobalCursor()
+{
+ if (m_globalCursor) {
+ qCDebug(qLcEglfsKmsDebug, "Destroying global mouse cursor");
+ delete m_globalCursor;
+ m_globalCursor = nullptr;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h
index b1c98f3fe6..8c8f79f70c 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h
@@ -42,6 +42,10 @@
#include <qeglfskmsdevice.h>
+QT_BEGIN_NAMESPACE
+
+class QPlatformCursor;
+
class QEglFSKmsEglDevice: public QEglFSKmsDevice
{
public:
@@ -54,8 +58,15 @@ public:
virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position) Q_DECL_OVERRIDE;
+ QEglFSKmsOutput output) Q_DECL_OVERRIDE;
+
+ QPlatformCursor *globalCursor() { return m_globalCursor; }
+ void destroyGlobalCursor();
+
+private:
+ QPlatformCursor *m_globalCursor;
};
+QT_END_NAMESPACE
+
#endif // QEGLFSKMSEGLDEVICE_H
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
index 838569d5c6..ddb2499751 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,8 @@
#include "qeglfskmsegldeviceintegration.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
-#include "qeglfswindow.h"
+#include "private/qeglfswindow_p.h"
+#include "private/qeglfscursor_p.h"
#include "qeglfskmsegldevice.h"
#include "qeglfskmsscreen.h"
#include <QLoggingCategory>
@@ -189,12 +190,12 @@ 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;
- const int w = cur_screen->geometry().width();
- const int h = cur_screen->geometry().height();
+ const int w = cur_screen->rawGeometry().width();
+ const int h = cur_screen->rawGeometry().height();
qCDebug(qLcEglfsKmsDebug, "Creating stream producer surface of size %dx%d", w, h);
const EGLint stream_producer_attribs[] = {
@@ -222,11 +223,6 @@ QEglFSWindow *QEglFSKmsEglDeviceIntegration::createWindow(QWindow *window) const
return eglWindow;
}
-bool QEglFSKmsEglDeviceIntegration::separateScreens() const
-{
- return true;
-}
-
QEglFSKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice(const QString &devicePath)
{
Q_UNUSED(devicePath)
@@ -263,4 +259,9 @@ bool QEglFSKmsEglDeviceIntegration::query_egl_device()
return true;
}
+QPlatformCursor *QEglFSKmsEglDeviceIntegration::createCursor(QPlatformScreen *screen) const
+{
+ return separateScreens() ? new QEglFSCursor(screen) : nullptr;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
index f04c42267a..375c388548 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
@@ -61,12 +61,11 @@ public:
bool supportsPBuffers() const Q_DECL_OVERRIDE;
QEglFSWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE;
- virtual bool separateScreens() const Q_DECL_OVERRIDE;
-
EGLDeviceEXT eglDevice() const { return m_egl_device; }
protected:
QEglFSKmsDevice *createDevice(const QString &devicePath) Q_DECL_OVERRIDE;
+ QPlatformCursor *createCursor(QPlatformScreen *screen) const Q_DECL_OVERRIDE;
private:
bool setup_kms();
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/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_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
index da1b577801..55d5941e5f 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
@@ -39,10 +39,30 @@
#include "qeglfskmsegldevicescreen.h"
#include "qeglfskmsegldevice.h"
+#include <QGuiApplication>
-QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
- : QEglFSKmsScreen(integration, device, output, position)
+QT_BEGIN_NAMESPACE
+
+QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output)
+ : QEglFSKmsScreen(integration, device, output)
+{
+}
+
+QEglFSKmsEglDeviceScreen::~QEglFSKmsEglDeviceScreen()
{
+ const int remainingScreenCount = qGuiApp->screens().count();
+ qCDebug(qLcEglfsKmsDebug, "Screen dtor. Remaining screens: %d", remainingScreenCount);
+ if (!remainingScreenCount && !m_integration->separateScreens())
+ static_cast<QEglFSKmsEglDevice *>(device())->destroyGlobalCursor();
+}
+
+QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const
+{
+ // The base class creates a cursor via integration->createCursor()
+ // in its ctor. With separateScreens just use that. Otherwise
+ // there's a virtual desktop and the device has a global cursor
+ // and the base class has no dedicated cursor at all.
+ return m_integration->separateScreens() ? QEglFSScreen::cursor() : static_cast<QEglFSKmsEglDevice *>(device())->globalCursor();
}
void QEglFSKmsEglDeviceScreen::waitForFlip()
@@ -76,3 +96,5 @@ void QEglFSKmsEglDeviceScreen::waitForFlip()
}
}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h
index 0cd46e9f9d..c57f52c6b7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h
@@ -42,15 +42,21 @@
#include <qeglfskmsscreen.h>
+QT_BEGIN_NAMESPACE
+
class QEglFSKmsEglDeviceScreen : public QEglFSKmsScreen
{
public:
QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsOutput output);
+ ~QEglFSKmsEglDeviceScreen();
+
+ QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
void waitForFlip() Q_DECL_OVERRIDE;
};
+QT_END_NAMESPACE
+
#endif // QEGLFSKMSEGLDEVICESCREEN_H
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
index 32f15f33fb..f88a7c847e 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,20 +2,14 @@ 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/../..
+INCLUDEPATH += $$PWD/../../api
# Avoid X11 header collision, use generic EGL native types
DEFINES += QT_EGL_NO_X11
-CONFIG += link_pkgconfig
-!contains(QT_CONFIG, no-pkg-config) {
- PKGCONFIG += libdrm
-} else {
- LIBS += -ldrm
-}
-
+QMAKE_USE += drm
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
index f4ffee569d..bf96a7d683 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
@@ -42,7 +42,7 @@
#include "qeglfskmsdevice.h"
#include "qeglfskmsscreen.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
@@ -159,7 +159,9 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode)
return true;
}
-QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos)
+QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources,
+ drmModeConnectorPtr connector,
+ VirtualDesktopInfo *vinfo)
{
const QByteArray connectorName = nameForConnector(connector);
@@ -173,8 +175,11 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
QSize configurationSize;
drmModeModeInfo configurationModeline;
- const QByteArray mode = m_integration->outputSettings().value(QString::fromUtf8(connectorName))
- .value(QStringLiteral("mode"), QStringLiteral("preferred")).toByteArray().toLower();
+ auto userConfig = m_integration->outputSettings();
+ auto userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName));
+ // default to the preferred mode unless overridden in the config
+ const QByteArray mode = userConnectorConfig.value(QStringLiteral("mode"), QStringLiteral("preferred"))
+ .toByteArray().toLower();
if (mode == "off") {
configuration = OutputConfigOff;
} else if (mode == "preferred") {
@@ -189,6 +194,16 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData());
configuration = OutputConfigPreferred;
}
+ if (vinfo) {
+ *vinfo = VirtualDesktopInfo();
+ vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
+ if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) {
+ const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray();
+ const QByteArrayList vposComp = vpos.split(',');
+ if (vposComp.count() == 2)
+ vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
+ }
+ }
const uint32_t crtc_id = resources->crtcs[crtc];
@@ -287,18 +302,26 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
qCDebug(qLcEglfsKmsDebug) << "Selected mode" << selected_mode << ":" << width << "x" << height
<< '@' << refresh << "hz for output" << connectorName;
}
+
+ // physical size from connector < config values < env vars
static const int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH");
static const int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT");
- QSizeF size(width, height);
- if (size.isEmpty()) {
- size.setWidth(connector->mmWidth);
- size.setHeight(connector->mmHeight);
+ QSizeF physSize(width, height);
+ if (physSize.isEmpty()) {
+ physSize = QSize(userConnectorConfig.value(QStringLiteral("physicalWidth")).toInt(),
+ userConnectorConfig.value(QStringLiteral("physicalHeight")).toInt());
+ if (physSize.isEmpty()) {
+ physSize.setWidth(connector->mmWidth);
+ physSize.setHeight(connector->mmHeight);
+ }
}
+ qCDebug(qLcEglfsKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName;
+
QEglFSKmsOutput output = {
QString::fromUtf8(connectorName),
connector->connector_id,
crtc_id,
- size,
+ physSize,
selected_mode,
false,
drmModeGetCrtc(m_dri_fd, crtc_id),
@@ -310,7 +333,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
m_crtc_allocator |= (1 << output.crtc_id);
m_connector_allocator |= (1 << output.connector_id);
- return createScreen(m_integration, this, output, pos);
+ return createScreen(m_integration, this, output);
}
drmModePropertyPtr QEglFSKmsDevice::connectorProperty(drmModeConnectorPtr connector, const QByteArray &name)
@@ -342,6 +365,28 @@ QEglFSKmsDevice::~QEglFSKmsDevice()
{
}
+struct OrderedScreen
+{
+ OrderedScreen() : screen(nullptr) { }
+ OrderedScreen(QEglFSKmsScreen *screen, const QEglFSKmsDevice::VirtualDesktopInfo &vinfo)
+ : screen(screen), vinfo(vinfo) { }
+ QEglFSKmsScreen *screen;
+ QEglFSKmsDevice::VirtualDesktopInfo vinfo;
+};
+
+QDebug operator<<(QDebug dbg, const OrderedScreen &s)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.vinfo.virtualIndex
+ << " / " << s.vinfo.virtualPos << ")";
+ return dbg;
+}
+
+static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b)
+{
+ return a.vinfo.virtualIndex < b.vinfo.virtualIndex;
+}
+
void QEglFSKmsDevice::createScreens()
{
drmModeResPtr resources = drmModeGetResources(m_dri_fd);
@@ -350,32 +395,53 @@ void QEglFSKmsDevice::createScreens()
return;
}
- QEglFSKmsScreen *primaryScreen = Q_NULLPTR;
- QList<QPlatformScreen *> siblings;
- QPoint pos(0, 0);
- QEglFSIntegration *integration = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration());
+ QVector<OrderedScreen> screens;
for (int i = 0; i < resources->count_connectors; i++) {
drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]);
if (!connector)
continue;
- QEglFSKmsScreen *screen = screenForConnector(resources, connector, pos);
- if (screen) {
- integration->addScreen(screen);
- pos.rx() += screen->geometry().width();
- siblings << screen;
-
- if (!primaryScreen)
- primaryScreen = screen;
- }
+ VirtualDesktopInfo vinfo;
+ QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &vinfo);
+ if (screen)
+ screens.append(OrderedScreen(screen, vinfo));
drmModeFreeConnector(connector);
}
drmModeFreeResources(resources);
+ // Use stable sort to preserve the original order for outputs with unspecified indices.
+ std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan);
+ qCDebug(qLcEglfsKmsDebug) << "Sorted screen list:" << screens;
+
+ QPoint pos(0, 0);
+ QList<QPlatformScreen *> siblings;
+ QEglFSIntegration *qpaIntegration = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration());
+
+ for (const OrderedScreen &orderedScreen : screens) {
+ QEglFSKmsScreen *s = orderedScreen.screen;
+ // set up a horizontal or vertical virtual desktop
+ if (orderedScreen.vinfo.virtualPos.isNull()) {
+ s->setVirtualPosition(pos);
+ if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical)
+ pos.ry() += s->geometry().height();
+ else
+ pos.rx() += s->geometry().width();
+ } else {
+ s->setVirtualPosition(orderedScreen.vinfo.virtualPos);
+ }
+ qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry();
+ // The order in qguiapp's screens list will match the order set by
+ // virtualIndex. This is not only handy but also required since for instance
+ // evdevtouch relies on it when performing touch device - screen mapping.
+ qpaIntegration->addScreen(s);
+ siblings << s;
+ }
+
if (!m_integration->separateScreens()) {
+ // enable the virtual desktop
Q_FOREACH (QPlatformScreen *screen, siblings)
static_cast<QEglFSKmsScreen *>(screen)->setVirtualSiblings(siblings);
}
@@ -391,9 +457,9 @@ QString QEglFSKmsDevice::devicePath() const
return m_path;
}
-QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
+QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output)
{
- return new QEglFSKmsScreen(integration, device, output, position);
+ return new QEglFSKmsScreen(integration, device, output);
}
void QEglFSKmsDevice::setFd(int fd)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
index 041c063695..3e7ac7e3f0 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
@@ -53,6 +53,12 @@ QT_BEGIN_NAMESPACE
class Q_EGLFS_EXPORT QEglFSKmsDevice
{
public:
+ struct VirtualDesktopInfo {
+ VirtualDesktopInfo() : virtualIndex(0) { }
+ int virtualIndex;
+ QPoint virtualPos;
+ };
+
QEglFSKmsDevice(QEglFSKmsIntegration *integration, const QString &path);
virtual ~QEglFSKmsDevice();
@@ -68,8 +74,7 @@ public:
protected:
virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsOutput output);
void setFd(int fd);
QEglFSKmsIntegration *m_integration;
@@ -80,7 +85,9 @@ protected:
quint32 m_connector_allocator;
int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector);
- QEglFSKmsScreen *screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos);
+ QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources,
+ drmModeConnectorPtr connector,
+ VirtualDesktopInfo *vinfo);
drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name);
static void pageFlipHandler(int fd,
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
index 07ea7d4439..6c30e8f930 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>
@@ -65,6 +65,7 @@ QEglFSKmsIntegration::QEglFSKmsIntegration()
, m_hwCursor(false)
, m_pbuffers(false)
, m_separateScreens(false)
+ , m_virtualDesktopLayout(VirtualDesktopLayoutHorizontal)
{}
void QEglFSKmsIntegration::platformInit()
@@ -149,6 +150,11 @@ bool QEglFSKmsIntegration::separateScreens() const
return m_separateScreens;
}
+QEglFSKmsIntegration::VirtualDesktopLayout QEglFSKmsIntegration::virtualDesktopLayout() const
+{
+ return m_virtualDesktopLayout;
+}
+
QMap<QString, QVariantMap> QEglFSKmsIntegration::outputSettings() const
{
return m_outputSettings;
@@ -169,15 +175,15 @@ void QEglFSKmsIntegration::loadConfig()
QFile file(QString::fromUtf8(json));
if (!file.open(QFile::ReadOnly)) {
- qCDebug(qLcEglfsKmsDebug) << "Could not open config file"
- << json << "for reading";
+ qCWarning(qLcEglfsKmsDebug) << "Could not open config file"
+ << json << "for reading";
return;
}
const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
if (!doc.isObject()) {
- qCDebug(qLcEglfsKmsDebug) << "Invalid config file" << json
- << "- no top-level JSON object";
+ qCWarning(qLcEglfsKmsDebug) << "Invalid config file" << json
+ << "- no top-level JSON object";
return;
}
@@ -188,6 +194,16 @@ void QEglFSKmsIntegration::loadConfig()
m_devicePath = object.value(QLatin1String("device")).toString();
m_separateScreens = object.value(QLatin1String("separateScreens")).toBool(m_separateScreens);
+ const QString vdOriString = object.value(QLatin1String("virtualDesktopLayout")).toString();
+ if (!vdOriString.isEmpty()) {
+ if (vdOriString == QLatin1String("horizontal"))
+ m_virtualDesktopLayout = VirtualDesktopLayoutHorizontal;
+ else if (vdOriString == QLatin1String("vertical"))
+ m_virtualDesktopLayout = VirtualDesktopLayoutVertical;
+ else
+ qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktopOrientation value" << vdOriString;
+ }
+
const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray();
for (int i = 0; i < outputs.size(); i++) {
const QVariantMap outputSettings = outputs.at(i).toObject().toVariantMap();
@@ -207,6 +223,7 @@ void QEglFSKmsIntegration::loadConfig()
<< "\thwcursor:" << m_hwCursor << "\n"
<< "\tpbuffers:" << m_pbuffers << "\n"
<< "\tseparateScreens:" << m_separateScreens << "\n"
+ << "\tvirtualDesktopLayout:" << m_virtualDesktopLayout << "\n"
<< "\toutputs:" << m_outputSettings;
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
index 34ac5385a5..ba49945715 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,9 +53,14 @@ 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:
+ enum VirtualDesktopLayout {
+ VirtualDesktopLayoutHorizontal,
+ VirtualDesktopLayoutVertical
+ };
+
QEglFSKmsIntegration();
void platformInit() Q_DECL_OVERRIDE;
@@ -70,6 +75,7 @@ public:
virtual bool hwCursor() const;
virtual bool separateScreens() const;
+ virtual VirtualDesktopLayout virtualDesktopLayout() const;
QMap<QString, QVariantMap> outputSettings() const;
QEglFSKmsDevice *device() const;
@@ -83,6 +89,7 @@ protected:
bool m_hwCursor;
bool m_pbuffers;
bool m_separateScreens;
+ VirtualDesktopLayout m_virtualDesktopLayout;
QString m_devicePath;
QMap<QString, QVariantMap> m_outputSettings;
};
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
index e6b256f6b2..e4b6c67f28 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
@@ -41,7 +41,7 @@
#include "qeglfskmsscreen.h"
#include "qeglfskmsdevice.h"
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
#include <QtCore/QLoggingCategory>
@@ -71,17 +71,15 @@ private:
QEglFSKmsScreen::QEglFSKmsScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position)
+ QEglFSKmsOutput output)
: QEglFSScreen(eglGetDisplay(device->nativeDisplay()))
, m_integration(integration)
, m_device(device)
, m_output(output)
- , m_pos(position)
, m_powerState(PowerStateOn)
, m_interruptHandler(new QEglFSKmsInterruptHandler(this))
{
- m_siblings << this;
+ m_siblings << this; // gets overridden by QEglFSKmsDevice later if !separateScreens
}
QEglFSKmsScreen::~QEglFSKmsScreen()
@@ -98,7 +96,14 @@ QEglFSKmsScreen::~QEglFSKmsScreen()
delete m_interruptHandler;
}
-QRect QEglFSKmsScreen::geometry() const
+void QEglFSKmsScreen::setVirtualPosition(const QPoint &pos)
+{
+ m_pos = pos;
+}
+
+// Reimplement rawGeometry(), not geometry(). The base class implementation of
+// geometry() calls rawGeometry() and may apply additional transforms.
+QRect QEglFSKmsScreen::rawGeometry() const
{
const int mode = m_output.mode;
return QRect(m_pos.x(), m_pos.y(),
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
index aa698e1b5d..2b6a0ffe6c 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>
@@ -74,11 +74,13 @@ class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen
public:
QEglFSKmsScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsOutput output);
~QEglFSKmsScreen();
- QRect geometry() const Q_DECL_OVERRIDE;
+ void setVirtualPosition(const QPoint &pos);
+
+ QRect rawGeometry() const Q_DECL_OVERRIDE;
+
int depth() const Q_DECL_OVERRIDE;
QImage::Format format() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
index 3e486bd1bd..e72f5bdd14 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
@@ -1,11 +1,11 @@
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, use generic EGL native types
DEFINES += QT_EGL_NO_X11
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
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..364812ec60 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
@@ -1,11 +1,10 @@
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/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
-LIBS += -lGAL
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
SOURCES += $$PWD/qeglfsvivmain.cpp \
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/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..ccdf20b417 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,11 +1,10 @@
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/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
-LIBS += -lGAL
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
SOURCES += $$PWD/qeglfsvivwlmain.cpp \
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_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 1948d73750..51a026e2cf 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
@@ -1,14 +1,14 @@
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, use generic EGL native types
DEFINES += QT_EGL_NO_X11
-INCLUDEPATH += $$PWD/../..
+INCLUDEPATH += $$PWD/../../api
CONFIG += egl
-LIBS += -lX11 -lX11-xcb -lxcb
+QMAKE_USE += xcb_xlib
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
SOURCES += $$PWD/qeglfsx11main.cpp \
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.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..d8adc13226 100644
--- a/src/plugins/platforms/eglfs/eglfs-plugin.pro
+++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro
@@ -1,11 +1,13 @@
TARGET = qeglfs
-QT += platformsupport-private eglfs_device_lib-private
+QT += platformsupport-private eglfsdeviceintegration-private
SOURCES += $$PWD/qeglfsmain.cpp
OTHER_FILES += $$PWD/eglfs.json
+INCLUDEPATH += $$PWD/api
+
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
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 974b85b1dd..15a825a7b0 100644
--- a/src/plugins/platforms/eglfs/eglfs_device_lib.pro
+++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
@@ -1,10 +1,12 @@
# The device integration plugin base class has to live in a shared library,
# placing it into a static lib like platformsupport is not sufficient since we
# have to keep the QObject magic like qobject_cast working.
-# Hence this header-less, private-only module.
+# Hence this private-only module.
+# By having _p headers, it also enables developing out-of-tree integration plugins.
-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
@@ -14,28 +16,10 @@ DEFINES += QT_EGL_NO_X11
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
-INCLUDEPATH += $$PWD
-
!isEmpty(EGLFS_PLATFORM_HOOKS_SOURCES) {
HEADERS += $$EGLFS_PLATFORM_HOOKS_HEADERS
SOURCES += $$EGLFS_PLATFORM_HOOKS_SOURCES
diff --git a/src/plugins/platforms/eglfs/qeglfsmain.cpp b/src/plugins/platforms/eglfs/qeglfsmain.cpp
index 50279ad110..2885d397c6 100644
--- a/src/plugins/platforms/eglfs/qeglfsmain.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsmain.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include <qpa/qplatformintegrationplugin.h>
-#include "qeglfsintegration.h"
+#include "qeglfsintegration_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/haiku/qhaikuclipboard.cpp b/src/plugins/platforms/haiku/qhaikuclipboard.cpp
index 0194a0415a..774da4432a 100644
--- a/src/plugins/platforms/haiku/qhaikuclipboard.cpp
+++ b/src/plugins/platforms/haiku/qhaikuclipboard.cpp
@@ -91,7 +91,7 @@ QMimeData *QHaikuClipboard::mimeData(QClipboard::Mode mode)
const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen);
if (dataLen && (status == B_OK)) {
- const QString format = QString::fromLatin1(name);
+ const QLatin1String format(name);
if (format == QLatin1String("text/plain")) {
m_systemMimeData->setText(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
} else if (format == QLatin1String("text/html")) {
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/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm
index fb0c9805f9..076e34c1a5 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.mm
+++ b/src/plugins/platforms/ios/qiosbackingstore.mm
@@ -49,6 +49,8 @@
#include <QtDebug>
+QT_BEGIN_NAMESPACE
+
class QIOSPaintDevice : public QOpenGLPaintDevice
{
public:
@@ -64,6 +66,33 @@ void QIOSPaintDevice::ensureActiveTarget()
m_backingStore->makeCurrent();
}
+/*!
+ \class QIOSBackingStore
+
+ \brief The QPlatformBackingStore on iOS.
+
+ QBackingStore enables the use of QPainter to paint on a QWindow, as opposed
+ to rendering to a QWindow through the use of OpenGL with QOpenGLContext.
+
+ Historically, the iOS port initially implemented the backing store by using
+ an QOpenGLPaintDevice as its paint device, triggering the use of the OpenGL
+ paint engine for QPainter based drawing. This was due to raster drawing
+ operations being too slow when not being NEON-optimized, and got the port
+ up and running quickly.
+
+ As of 3e892e4a97, released in Qt 5.7, the backing store now uses a QImage,
+ for its paint device, giving normal raster-based QPainter operations, and
+ enabling features such as antialiased drawing.
+
+ To account for regressions in performance, the old code path is still
+ available by setting the surface type of the QWindow to OpenGLSurface.
+ This surface type is normally used when rendering though QOpenGLContext,
+ but will in the case of QIOSBackingStore trigger the old OpenGL based
+ painter.
+
+ This fallback path is not too intrusive, as the QImage based path still
+ uses OpenGL to composite the image at flush() time using composeAndFlush.
+*/
QIOSBackingStore::QIOSBackingStore(QWindow *window)
: QRasterBackingStore(window)
, m_context(new QOpenGLContext)
diff --git a/src/plugins/platforms/ios/qiosclipboard.h b/src/plugins/platforms/ios/qiosclipboard.h
index b9ba4a2669..f3ccfcace0 100644
--- a/src/plugins/platforms/ios/qiosclipboard.h
+++ b/src/plugins/platforms/ios/qiosclipboard.h
@@ -40,10 +40,13 @@
#ifndef QIOSCLIPBOARD_H
#define QIOSCLIPBOARD_H
+#include <qpa/qplatformclipboard.h>
+
+#ifndef QT_NO_CLIPBOARD
+
#import <UIKit/UIKit.h>
#include <QMimeData>
-#include <qpa/qplatformclipboard.h>
@class QUIClipboard;
@@ -67,4 +70,6 @@ private:
QT_END_NAMESPACE
+#endif // QT_NO_CLIPBOARD
+
#endif // QIOSCLIPBOARD_H
diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm
index fb75cc793c..960c9f39db 100644
--- a/src/plugins/platforms/ios/qiosclipboard.mm
+++ b/src/plugins/platforms/ios/qiosclipboard.mm
@@ -39,6 +39,8 @@
#include "qiosclipboard.h"
+#ifndef QT_NO_CLIPBOARD
+
#include <QtPlatformSupport/private/qmacmime_p.h>
#include <QtCore/QMimeData>
#include <QtGui/QGuiApplication>
@@ -247,3 +249,5 @@ bool QIOSClipboard::ownsMode(QClipboard::Mode mode) const
}
QT_END_NAMESPACE
+
+#endif // QT_NO_CLIPBOARD
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index 50374dc951..2d5286e971 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -48,6 +48,8 @@
#import <OpenGLES/ES2/glext.h>
#import <QuartzCore/CAEAGLLayer.h>
+QT_BEGIN_NAMESPACE
+
Q_LOGGING_CATEGORY(lcQpaGLContext, "qt.qpa.glcontext");
QIOSContext::QIOSContext(QOpenGLContext *context)
@@ -314,3 +316,4 @@ bool QIOSContext::isSharing() const
#include "moc_qioscontext.cpp"
+QT_END_NAMESPACE
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/qiosfiledialog.h b/src/plugins/platforms/ios/qiosfiledialog.h
index 855bab0424..7fe24eaefe 100644
--- a/src/plugins/platforms/ios/qiosfiledialog.h
+++ b/src/plugins/platforms/ios/qiosfiledialog.h
@@ -43,10 +43,10 @@
#include <QtCore/qeventloop.h>
#include <qpa/qplatformdialoghelper.h>
-QT_BEGIN_NAMESPACE
-
Q_FORWARD_DECLARE_OBJC_CLASS(UIViewController);
+QT_BEGIN_NAMESPACE
+
class QIOSFileDialog : public QPlatformFileDialogHelper
{
public:
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..f74e3004cc 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);
@@ -77,6 +74,8 @@ QT_END_NAMESPACE
+ (id)currentFirstResponder;
@end
+QT_BEGIN_NAMESPACE
+
class FirstResponderCandidate : public QScopedValueRollback<UIResponder *>
{
public:
@@ -87,4 +86,6 @@ private:
static UIResponder *s_firstResponderCandidate;
};
+QT_END_NAMESPACE
+
#endif // QIOSGLOBAL_H
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index c2f3d6b9e1..1482ffc7af 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)
{
@@ -132,6 +114,8 @@ int infoPlistValue(NSString* key, int defaultValue)
return value ? [value intValue] : defaultValue;
}
+QT_END_NAMESPACE
+
// -------------------------------------------------------------------------
@interface QtFirstResponderEvent : UIEvent
@@ -182,6 +166,8 @@ int infoPlistValue(NSString* key, int defaultValue)
}
@end
+QT_BEGIN_NAMESPACE
+
FirstResponderCandidate::FirstResponderCandidate(UIResponder *responder)
: QScopedValueRollback<UIResponder *>(s_firstResponderCandidate, responder)
{
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h
index 2b0643f26e..9fdf021d07 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.h
+++ b/src/plugins/platforms/ios/qiosinputcontext.h
@@ -51,13 +51,13 @@ const char kImePlatformDataInputView[] = "inputView";
const char kImePlatformDataInputAccessoryView[] = "inputAccessoryView";
const char kImePlatformDataReturnKeyType[] = "returnKeyType";
-QT_BEGIN_NAMESPACE
-
@class QIOSLocaleListener;
@class QIOSKeyboardListener;
@class QIOSTextInputResponder;
@protocol KeyboardState;
+QT_BEGIN_NAMESPACE
+
struct KeyboardState
{
KeyboardState() :
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index ef93d68cf0..68088540c6 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -97,14 +97,14 @@ static QUIView *focusView()
@interface QIOSKeyboardListener : UIGestureRecognizer <UIGestureRecognizerDelegate> {
@private
- QIOSInputContext *m_context;
+ QT_PREPEND_NAMESPACE(QIOSInputContext) *m_context;
}
@property BOOL hasDeferredScrollToCursor;
@end
@implementation QIOSKeyboardListener
-- (id)initWithQIOSInputContext:(QIOSInputContext *)context
+- (id)initWithQIOSInputContext:(QT_PREPEND_NAMESPACE(QIOSInputContext) *)context
{
if (self = [super initWithTarget:self action:@selector(gestureStateChanged:)]) {
@@ -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;
@@ -289,6 +291,8 @@ static QUIView *focusView()
// -------------------------------------------------------------------------
+QT_BEGIN_NAMESPACE
+
Qt::InputMethodQueries ImeState::update(Qt::InputMethodQueries properties)
{
if (!properties)
@@ -377,6 +381,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 +419,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 +428,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 +437,7 @@ void QIOSInputContext::updateKeyboardState(NSNotification *notification)
emitAnimatingChanged();
if (m_keyboardState.keyboardRect != previousState.keyboardRect)
emitKeyboardRectChanged();
+#endif
}
bool QIOSInputContext::isInputPanelVisible() const
@@ -549,7 +557,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)
@@ -703,3 +715,5 @@ QLocale QIOSInputContext::locale() const
{
return QLocale(QString::fromNSString([[NSLocale currentLocale] objectForKey:NSLocaleIdentifier]));
}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h
index a50d9aa571..d9a43a683e 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
@@ -70,7 +72,9 @@ public:
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
+#ifndef QT_NO_CLIPBOARD
QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
+#endif
QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
QPlatformServices *services() const Q_DECL_OVERRIDE;
@@ -83,7 +87,9 @@ public:
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
QTouchDevice *touchDevice();
+#ifndef QT_NO_ACCESSIBILITY
QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE;
+#endif
// Called from Objective-C class QIOSScreenTracker, which can't be friended
void addScreen(QPlatformScreen *screen) { screenAdded(screen); }
@@ -102,14 +108,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 +127,3 @@ private:
QT_END_NAMESPACE
#endif
-
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index fa12d54b28..94dd643116 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)
+#if !defined(Q_OS_TVOS) && !defined(QT_NO_CLIPBOARD)
, 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;
+#if !defined(Q_OS_TVOS) && !defined(QT_NO_CLIPBOARD)
delete m_clipboard;
m_clipboard = 0;
+#endif
QMacInternalPasteboardMime::destroyMimeTypes();
delete m_inputContext;
@@ -215,10 +221,16 @@ QPlatformFontDatabase * QIOSIntegration::fontDatabase() const
return m_fontDatabase;
}
+#ifndef QT_NO_CLIPBOARD
QPlatformClipboard *QIOSIntegration::clipboard() const
{
+#ifndef Q_OS_TVOS
return m_clipboard;
+#else
+ return 0;
+#endif
}
+#endif
QPlatformInputContext *QIOSIntegration::inputContext() const
{
@@ -266,12 +278,14 @@ QTouchDevice *QIOSIntegration::touchDevice()
return m_touchDevice;
}
+#ifndef QT_NO_ACCESSIBILITY
QPlatformAccessibility *QIOSIntegration::accessibility() const
{
if (!m_accessibility)
m_accessibility = new QIOSPlatformAccessibility;
return m_accessibility;
}
+#endif
QPlatformNativeInterface *QIOSIntegration::nativeInterface() const
{
diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h
index dab5720d48..b7371a5f49 100644
--- a/src/plugins/platforms/ios/qiosmenu.h
+++ b/src/plugins/platforms/ios/qiosmenu.h
@@ -68,7 +68,9 @@ public:
void setRole(MenuRole role) Q_DECL_OVERRIDE;
void setCheckable(bool) Q_DECL_OVERRIDE {}
void setChecked(bool) Q_DECL_OVERRIDE {}
+#ifndef QT_NO_SHORTCUT
void setShortcut(const QKeySequence&) Q_DECL_OVERRIDE;
+#endif
void setEnabled(bool enabled) Q_DECL_OVERRIDE;
void setIconSize(int) Q_DECL_OVERRIDE {}
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 41594232ff..02deab59b5 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -304,10 +304,12 @@ void QIOSMenuItem::setRole(QPlatformMenuItem::MenuRole role)
m_role = role;
}
+#ifndef QT_NO_SHORTCUT
void QIOSMenuItem::setShortcut(const QKeySequence &sequence)
{
m_shortcut = sequence;
}
+#endif
void QIOSMenuItem::setEnabled(bool enabled)
{
@@ -550,6 +552,7 @@ QIOSMenuItemList QIOSMenu::filterFirstResponderActions(const QIOSMenuItemList &m
for (int i = 0; i < menuItems.count(); ++i) {
QIOSMenuItem *menuItem = menuItems.at(i);
+#ifndef QT_NO_SHORTCUT
QKeySequence shortcut = menuItem->m_shortcut;
if ((shortcut == QKeySequence::Cut && [responder canPerformAction:@selector(cut:) withSender:nil])
|| (shortcut == QKeySequence::Copy && [responder canPerformAction:@selector(copy:) withSender:nil])
@@ -563,6 +566,7 @@ QIOSMenuItemList QIOSMenu::filterFirstResponderActions(const QIOSMenuItemList &m
|| (shortcut == QKeySequence::Underline && [responder canPerformAction:@selector(toggleUnderline:) withSender:nil])) {
continue;
}
+#endif
filteredMenuItems.append(menuItem);
}
return filteredMenuItems;
@@ -573,7 +577,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/qiosmessagedialog.h b/src/plugins/platforms/ios/qiosmessagedialog.h
index 971c8d8b4d..e67e10a5e1 100644
--- a/src/plugins/platforms/ios/qiosmessagedialog.h
+++ b/src/plugins/platforms/ios/qiosmessagedialog.h
@@ -43,11 +43,11 @@
#include <QtCore/qeventloop.h>
#include <qpa/qplatformdialoghelper.h>
-QT_BEGIN_NAMESPACE
-
Q_FORWARD_DECLARE_OBJC_CLASS(UIAlertController);
Q_FORWARD_DECLARE_OBJC_CLASS(UIAlertAction);
+QT_BEGIN_NAMESPACE
+
class QIOSMessageDialog : public QPlatformMessageDialogHelper
{
public:
diff --git a/src/plugins/platforms/ios/qiosplatformaccessibility.h b/src/plugins/platforms/ios/qiosplatformaccessibility.h
index 2374457591..989eaa4fb8 100644
--- a/src/plugins/platforms/ios/qiosplatformaccessibility.h
+++ b/src/plugins/platforms/ios/qiosplatformaccessibility.h
@@ -42,6 +42,8 @@
#include <qpa/qplatformaccessibility.h>
+#ifndef QT_NO_ACCESSIBILITY
+
QT_BEGIN_NAMESPACE
class QIOSPlatformAccessibility: public QPlatformAccessibility
@@ -56,3 +58,5 @@ public:
QT_END_NAMESPACE
#endif
+
+#endif
diff --git a/src/plugins/platforms/ios/qiosplatformaccessibility.mm b/src/plugins/platforms/ios/qiosplatformaccessibility.mm
index 2ebe23c939..aef4216e03 100644
--- a/src/plugins/platforms/ios/qiosplatformaccessibility.mm
+++ b/src/plugins/platforms/ios/qiosplatformaccessibility.mm
@@ -39,6 +39,8 @@
#include "qiosplatformaccessibility.h"
+#ifndef QT_NO_ACCESSIBILITY
+
#include <QtGui/QtGui>
#include "qioswindow.h"
@@ -63,7 +65,7 @@ void invalidateCache(QAccessibleInterface *iface)
// when items get added or removed from the screen
foreach (QWindow *win, QGuiApplication::topLevelWindows()) {
if (win && win->handle()) {
- QIOSWindow *window = static_cast<QIOSWindow*>(win->handle());
+ QT_PREPEND_NAMESPACE(QIOSWindow) *window = static_cast<QT_PREPEND_NAMESPACE(QIOSWindow) *>(win->handle());
window->clearAccessibleCache();
}
}
@@ -85,3 +87,5 @@ void QIOSPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *even
break;
}
}
+
+#endif
diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h
index cc83e7f3d2..9fcce42825 100644
--- a/src/plugins/platforms/ios/qiosscreen.h
+++ b/src/plugins/platforms/ios/qiosscreen.h
@@ -68,6 +68,8 @@ public:
Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE;
void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE;
+ QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
+
UIScreen *uiScreen() const;
UIWindow *uiWindow() const;
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index d53f0df846..013061a6d2 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -47,6 +47,7 @@
#include "quiview.h"
#include <QtGui/private/qwindow_p.h>
+#include <private/qcoregraphics_p.h>
#include <sys/sysctl.h>
@@ -143,21 +144,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];
}
@@ -171,6 +176,8 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
// -------------------------------------------------------------------------
+QT_BEGIN_NAMESPACE
+
/*!
Returns the model identifier of the device.
@@ -256,9 +263,14 @@ 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();
+#ifdef Q_OS_TVOS
+ m_availableGeometry = m_geometry;
+#else
+ m_availableGeometry = QRectF::fromCGRect(m_uiScreen.applicationFrame).toRect();
+#endif
+#ifndef Q_OS_TVOS
if (m_uiScreen == [UIScreen mainScreen]) {
Qt::ScreenOrientation statusBarOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation));
@@ -286,6 +298,7 @@ void QIOSScreen::updateProperties()
m_availableGeometry = transform.mapRect(m_availableGeometry);
}
}
+#endif
if (m_geometry != previousGeometry) {
QRectF physicalGeometry;
@@ -298,7 +311,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());
}
@@ -393,7 +406,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;
@@ -406,6 +419,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;
@@ -430,6 +446,7 @@ Qt::ScreenOrientation QIOSScreen::orientation() const
}
return toQtScreenOrientation(deviceOrientation);
+#endif
}
void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
@@ -443,6 +460,38 @@ void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
}
}
+QPixmap QIOSScreen::grabWindow(WId window, int x, int y, int width, int height) const
+{
+ if (window && ![reinterpret_cast<id>(window) isKindOfClass:[UIView class]])
+ return QPixmap();
+
+ UIView *view = window ? reinterpret_cast<UIView *>(window) : m_uiWindow;
+
+ if (width < 0)
+ width = qMax(view.bounds.size.width - x, CGFloat(0));
+ if (height < 0)
+ height = qMax(view.bounds.size.height - y, CGFloat(0));
+
+ CGRect captureRect = [m_uiWindow convertRect:CGRectMake(x, y, width, height) fromView:view];
+ captureRect = CGRectIntersection(captureRect, m_uiWindow.bounds);
+
+ UIGraphicsBeginImageContextWithOptions(captureRect.size, NO, 0.0);
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ CGContextTranslateCTM(context, -captureRect.origin.x, -captureRect.origin.y);
+
+ // Draws the complete view hierarchy of m_uiWindow into the given rect, which
+ // needs to be the same aspect ratio as the m_uiWindow's size. Since we've
+ // translated the graphics context, and are potentially drawing into a smaller
+ // context than the full window, the resulting image will be a subsection of the
+ // full screen.
+ [m_uiWindow drawViewHierarchyInRect:m_uiWindow.bounds afterScreenUpdates:NO];
+
+ UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+
+ return QPixmap::fromImage(qt_mac_toQImage(screenshot.CGImage));
+}
+
UIScreen *QIOSScreen::uiScreen() const
{
return m_uiScreen;
diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm
index d930965bde..9d73a296fa 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];
@@ -500,12 +500,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
@@ -530,12 +530,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
@@ -552,7 +552,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;
@@ -860,8 +860,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
@@ -870,7 +870,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;
@@ -938,7 +938,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;
@@ -947,7 +947,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.h b/src/plugins/platforms/ios/qiostextresponder.h
index f7450df4c8..77be2cf2fe 100644
--- a/src/plugins/platforms/ios/qiostextresponder.h
+++ b/src/plugins/platforms/ios/qiostextresponder.h
@@ -42,19 +42,23 @@
#include <QtCore/qstring.h>
#include <QtGui/qevent.h>
+QT_BEGIN_NAMESPACE
+
class QIOSInputContext;
+QT_END_NAMESPACE
+
@interface QIOSTextInputResponder : UIResponder <UITextInputTraits, UIKeyInput, UITextInput>
{
@private
- QIOSInputContext *m_inputContext;
- QInputMethodQueryEvent *m_configuredImeState;
+ QT_PREPEND_NAMESPACE(QIOSInputContext) *m_inputContext;
+ QT_PREPEND_NAMESPACE(QInputMethodQueryEvent) *m_configuredImeState;
QString m_markedText;
BOOL m_inSendEventToFocusObject;
BOOL m_inSelectionChange;
}
-- (id)initWithInputContext:(QIOSInputContext *)context;
+- (id)initWithInputContext:(QT_PREPEND_NAMESPACE(QIOSInputContext) *)context;
- (BOOL)needsKeyboardReconfigure:(Qt::InputMethodQueries)updatedProperties;
- (void)notifyInputDelegate:(Qt::InputMethodQueries)updatedProperties;
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index 9a077323e7..3c95083e45 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -163,7 +163,7 @@
@implementation QIOSTextInputResponder
-- (id)initWithInputContext:(QIOSInputContext *)inputContext
+- (id)initWithInputContext:(QT_PREPEND_NAMESPACE(QIOSInputContext) *)inputContext
{
if (!(self = [self init]))
return self;
@@ -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:NSFontAttributeName];
}
+#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..f7b190ba22 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.h
+++ b/src/plugins/platforms/ios/qiosviewcontroller.h
@@ -38,20 +38,29 @@
****************************************************************************/
#import <UIKit/UIKit.h>
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
class QIOSScreen;
+QT_END_NAMESPACE
+
@interface QIOSViewController : UIViewController
-- (id)initWithQIOSScreen:(QIOSScreen *)screen;
+- (id)initWithQIOSScreen:(QT_PREPEND_NAMESPACE(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 fd88664d15..0478c5b8c8 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>
@@ -57,7 +58,7 @@
@interface QIOSViewController () {
@public
- QPointer<QIOSScreen> m_screen;
+ QPointer<QT_PREPEND_NAMESPACE(QIOSScreen)> m_screen;
BOOL m_updatingProperties;
QMetaObject::Connection m_focusWindowChangeConnection;
}
@@ -125,7 +126,7 @@
{
Q_UNUSED(subview);
- QIOSScreen *screen = self.qtViewController->m_screen;
+ QT_PREPEND_NAMESPACE(QIOSScreen) *screen = self.qtViewController->m_screen;
// The 'window' property of our view is not valid until the window
// has been shown, so we have to access it through the QIOSScreen.
@@ -232,38 +233,21 @@
@synthesize preferredStatusBarUpdateAnimation;
@synthesize preferredStatusBarStyle;
-- (id)initWithQIOSScreen:(QIOSScreen *)screen
+- (id)initWithQIOSScreen:(QT_PREPEND_NAMESPACE(QIOSScreen) *)screen
{
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];
@@ -288,6 +272,7 @@
{
[super viewDidLoad];
+#ifndef Q_OS_TVOS
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(willChangeStatusBarFrame:)
name:UIApplicationWillChangeStatusBarFrameNotification
@@ -296,6 +281,7 @@
[center addObserver:self selector:@selector(didChangeStatusBarOrientation:)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:[UIApplication sharedApplication]];
+#endif
}
- (void)viewDidUnload
@@ -308,10 +294,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:
@@ -322,15 +311,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
{
@@ -439,6 +419,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 ---------------
@@ -447,30 +428,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];
}
@@ -516,6 +483,7 @@
[UIViewController attemptRotationToDeviceOrientation];
}
}
+#endif
}
@end
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h
index afc2f0f89d..81fad420f6 100644
--- a/src/plugins/platforms/ios/qioswindow.h
+++ b/src/plugins/platforms/ios/qioswindow.h
@@ -48,10 +48,10 @@
class QIOSContext;
class QIOSWindow;
-QT_BEGIN_NAMESPACE
-
@class QUIView;
+QT_BEGIN_NAMESPACE
+
class QIOSWindow : public QObject, public QPlatformWindow
{
Q_OBJECT
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 8099d13147..8ff0dfbd5f 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -54,6 +54,8 @@
#include <QtDebug>
+QT_BEGIN_NAMESPACE
+
QIOSWindow::QIOSWindow(QWindow *window)
: QPlatformWindow(window)
, m_view([[QUIView alloc] initWithQIOSWindow:this])
@@ -211,7 +213,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/quiaccessibilityelement.h b/src/plugins/platforms/ios/quiaccessibilityelement.h
index 1a9ae2a1a7..03abf5407e 100644
--- a/src/plugins/platforms/ios/quiaccessibilityelement.h
+++ b/src/plugins/platforms/ios/quiaccessibilityelement.h
@@ -43,6 +43,8 @@
#import <UIKit/UIKit.h>
#import <QtGui/QtGui>
+#ifndef QT_NO_ACCESSIBILITY
+
@interface QMacAccessibilityElement : UIAccessibilityElement
{}
@@ -54,3 +56,4 @@
@end
#endif
+#endif
diff --git a/src/plugins/platforms/ios/quiaccessibilityelement.mm b/src/plugins/platforms/ios/quiaccessibilityelement.mm
index 39a879fc23..a26ba61b3c 100644
--- a/src/plugins/platforms/ios/quiaccessibilityelement.mm
+++ b/src/plugins/platforms/ios/quiaccessibilityelement.mm
@@ -39,6 +39,8 @@
#include "quiaccessibilityelement.h"
+#ifndef QT_NO_ACCESSIBILITY
+
#include "private/qaccessiblecache_p.h"
@implementation QMacAccessibilityElement
@@ -61,7 +63,7 @@
QAccessibleCache *cache = QAccessibleCache::instance();
- QMacAccessibilityElement *element = cache->elementForId(anId);
+ QT_MANGLE_NAMESPACE(QMacAccessibilityElement) *element = cache->elementForId(anId);
if (!element) {
Q_ASSERT(QAccessible::accessibleInterface(anId));
element = [[self alloc] initWithId:anId withAccessibilityContainer: view];
@@ -221,3 +223,5 @@
}
@end
+
+#endif
diff --git a/src/plugins/platforms/ios/quiview.h b/src/plugins/platforms/ios/quiview.h
index fdaae943d8..1500f0b41c 100644
--- a/src/plugins/platforms/ios/quiview.h
+++ b/src/plugins/platforms/ios/quiview.h
@@ -44,14 +44,18 @@
#include <qpa/qwindowsysteminterface.h>
+QT_BEGIN_NAMESPACE
+
class QIOSWindow;
+QT_END_NAMESPACE
+
@class QIOSViewController;
@interface QUIView : UIView
{
@public
- QIOSWindow *m_qioswindow;
+ QT_PREPEND_NAMESPACE(QIOSWindow) *m_qioswindow;
@private
QHash<UITouch *, QWindowSystemInterface::TouchPoint> m_activeTouches;
int m_nextTouchId;
@@ -60,7 +64,7 @@ class QIOSWindow;
NSMutableArray *m_accessibleElements;
};
-- (id)initWithQIOSWindow:(QIOSWindow *)window;
+- (id)initWithQIOSWindow:(QT_PREPEND_NAMESPACE(QIOSWindow) *)window;
- (void)sendUpdatedExposeEvent;
- (BOOL)isActiveWindow;
@end
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index 9c7acc9278..5c493617b1 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -44,10 +44,13 @@
#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>
+#include <qpa/qwindowsysteminterface_p.h>
@implementation QUIView
@@ -56,9 +59,9 @@
return [CAEAGLLayer class];
}
-- (id)initWithQIOSWindow:(QIOSWindow *)window
+- (id)initWithQIOSWindow:(QT_PREPEND_NAMESPACE(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 +81,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 +154,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 +189,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 +329,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));
@@ -438,16 +444,78 @@
QWindowSystemInterface::flushWindowSystemEvents();
}
+- (int)mapPressTypeToKey:(UIPress*)press
+{
+ switch (press.type) {
+ case UIPressTypeUpArrow: return Qt::Key_Up;
+ case UIPressTypeDownArrow: return Qt::Key_Down;
+ case UIPressTypeLeftArrow: return Qt::Key_Left;
+ case UIPressTypeRightArrow: return Qt::Key_Right;
+ case UIPressTypeSelect: return Qt::Key_Select;
+ case UIPressTypeMenu: return Qt::Key_Menu;
+ case UIPressTypePlayPause: return Qt::Key_MediaTogglePlayPause;
+ }
+ return Qt::Key_unknown;
+}
+
+- (bool)processPresses:(NSSet *)presses withType:(QEvent::Type)type {
+ // Presses on Menu button will generate a Menu key event. By default, not handling
+ // this event will cause the application to return to Headboard (tvOS launcher).
+ // When handling the event (for example, as a back button), both press and
+ // release events must be handled accordingly.
+
+ QScopedValueRollback<bool> syncRollback(QWindowSystemInterfacePrivate::synchronousWindowSystemEvents, true);
+
+ bool handled = false;
+ for (UIPress* press in presses) {
+ int key = [self mapPressTypeToKey:press];
+ if (key == Qt::Key_unknown)
+ continue;
+ if (QWindowSystemInterface::handleKeyEvent(m_qioswindow->window(), type, key, Qt::NoModifier))
+ handled = true;
+ }
+
+ return handled;
+}
+
+- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
+{
+ if (![self processPresses:presses withType:QEvent::KeyPress])
+ [super pressesBegan:presses withEvent:event];
+}
+
+- (void)pressesChanged:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
+{
+ if (![self processPresses:presses withType:QEvent::KeyPress])
+ [super pressesChanged:presses withEvent:event];
+}
+
+- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
+{
+ if (![self processPresses:presses withType:QEvent::KeyRelease])
+ [super pressesEnded:presses withEvent:event];
+}
+
- (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
@@ -457,7 +525,7 @@
- (QWindow *)qwindow
{
if ([self isKindOfClass:[QUIView class]]) {
- if (QIOSWindow *w = static_cast<QUIView *>(self)->m_qioswindow)
+ if (QT_PREPEND_NAMESPACE(QIOSWindow) *w = static_cast<QUIView *>(self)->m_qioswindow)
return w->window();
}
return nil;
@@ -484,5 +552,7 @@
@end
+#ifndef QT_NO_ACCESSIBILITY
// Include category as an alternative to using -ObjC (Apple QA1490)
#include "quiview_accessibility.mm"
+#endif
diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro
index b5de192346..db365ce739 100644
--- a/src/plugins/platforms/linuxfb/linuxfb.pro
+++ b/src/plugins/platforms/linuxfb/linuxfb.pro
@@ -1,5 +1,7 @@
TARGET = qlinuxfb
+DEFINES += QT_NO_FOREACH
+
QT += core-private gui-private platformsupport-private
SOURCES = main.cpp qlinuxfbintegration.cpp qlinuxfbscreen.cpp
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index 685f231756..707301487d 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -52,17 +52,17 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID)
#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
#include <QtPlatformSupport/private/qevdevtouchmanager_p.h>
#endif
-#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(tslib) && !defined(Q_OS_ANDROID)
#include <QtPlatformSupport/private/qtslib_p.h>
#endif
@@ -140,22 +140,22 @@ QPlatformServices *QLinuxFbIntegration::services() const
void QLinuxFbIntegration::createInputHandlers()
{
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) {
new QLibInputHandler(QLatin1String("libinput"), QString());
return;
}
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID)
new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this);
-#ifndef QT_NO_TSLIB
+#if QT_CONFIG(tslib)
const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString());
else
-#endif // QT_NO_TSLIB
+#endif
new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this);
#endif
}
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
index 1fd2b84e37..a2e09611b4 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
@@ -320,7 +320,7 @@ bool QLinuxFbScreen::initialize()
bool doSwitchToGraphicsMode = true;
// Parse arguments
- foreach (const QString &arg, mArgs) {
+ for (const QString &arg : qAsConst(mArgs)) {
QRegularExpressionMatch match;
if (arg == QLatin1String("nographicsmodeswitch"))
doSwitchToGraphicsMode = false;
@@ -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/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro
index 3aca27b555..d4627605bb 100644
--- a/src/plugins/platforms/minimal/minimal.pro
+++ b/src/plugins/platforms/minimal/minimal.pro
@@ -2,6 +2,8 @@ TARGET = qminimal
QT += core-private gui-private platformsupport-private
+DEFINES += QT_NO_FOREACH
+
SOURCES = main.cpp \
qminimalintegration.cpp \
qminimalbackingstore.cpp
@@ -11,7 +13,6 @@ HEADERS = qminimalintegration.h \
OTHER_FILES += minimal.json
CONFIG += qpa/genericunixfontdatabase
-win32|darwin: DEFINES += QT_NO_FONTCONFIG
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 7224f4114c..558089dfce 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -46,10 +46,10 @@
#if defined(Q_OS_WIN)
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
-#elif defined(QT_NO_FONTCONFIG)
-#include <qpa/qplatformfontdatabase.h>
-#else
+#elif QT_CONFIG(fontconfig)
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
+#else
+#include <qpa/qplatformfontdatabase.h>
#endif
#if !defined(Q_OS_WIN)
@@ -67,7 +67,7 @@ static const char debugBackingStoreEnvironmentVariable[] = "QT_DEBUG_BACKINGSTOR
static inline unsigned parseOptions(const QStringList &paramList)
{
unsigned options = 0;
- foreach (const QString &param, paramList) {
+ for (const QString &param : paramList) {
if (param == QLatin1String("enable_fonts"))
options |= QMinimalIntegration::EnableFonts;
}
@@ -118,7 +118,7 @@ public:
QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
{
if (m_options & EnableFonts) {
-#ifndef QT_NO_FONTCONFIG
+#if QT_CONFIG(fontconfig)
if (!m_fontDatabase)
m_fontDatabase = new QGenericUnixFontDatabase;
#else
diff --git a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp
index 465ad355b9..a4bb8864ab 100644
--- a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp
+++ b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp
@@ -43,7 +43,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLTexture>
#include <QtGui/QMatrix4x4>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/qopengltextureblitter.h>
#include <QtGui/qopenglfunctions.h>
QMirClientBackingStore::QMirClientBackingStore(QWindow* window)
@@ -76,7 +76,7 @@ void QMirClientBackingStore::flush(QWindow* window, const QRegion& region, const
mBlitter->create();
mBlitter->bind();
- mBlitter->setSwizzleRB(true);
+ mBlitter->setRedBlueSwizzle(true);
mBlitter->blit(mTexture->textureId(), QMatrix4x4(), QOpenGLTextureBlitter::OriginTopLeft);
mBlitter->release();
@@ -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/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro
index 999550a7e1..fbaa853c41 100644
--- a/src/plugins/platforms/offscreen/offscreen.pro
+++ b/src/plugins/platforms/offscreen/offscreen.pro
@@ -2,6 +2,8 @@ TARGET = qoffscreen
QT += core-private gui-private platformsupport-private
+DEFINES += QT_NO_FOREACH
+
SOURCES = main.cpp \
qoffscreenintegration.cpp \
qoffscreenwindow.cpp \
@@ -13,7 +15,7 @@ HEADERS = qoffscreenintegration.h \
OTHER_FILES += offscreen.json
-contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) {
+qtConfig(xlib):qtConfig(opengl):!qtConfig(opengles2) {
SOURCES += qoffscreenintegration_x11.cpp
HEADERS += qoffscreenintegration_x11.h
system(echo "Using X11 offscreen integration with GLX")
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
index ed1a81c2b3..85422071aa 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
@@ -59,9 +59,9 @@ public:
void setPos(const QPoint &pos) Q_DECL_OVERRIDE
{
m_pos = pos;
- QWindowList wl = QGuiApplication::topLevelWindows();
+ const QWindowList wl = QGuiApplication::topLevelWindows();
QWindow *containing = 0;
- foreach (QWindow *w, wl) {
+ for (QWindow *w : wl) {
if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(pos)) {
containing = w;
break;
@@ -104,9 +104,9 @@ QPixmap QOffscreenScreen::grabWindow(WId id, int x, int y, int width, int height
QOffscreenWindow *window = QOffscreenWindow::windowForWinId(id);
if (!window || window->window()->type() == Qt::Desktop) {
- QWindowList wl = QGuiApplication::topLevelWindows();
+ const QWindowList wl = QGuiApplication::topLevelWindows();
QWindow *containing = 0;
- foreach (QWindow *w, wl) {
+ for (QWindow *w : wl) {
if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(rect)) {
containing = w;
break;
@@ -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;
}
@@ -213,11 +212,10 @@ QOffscreenBackingStore *QOffscreenBackingStore::backingStoreForWinId(WId id)
void QOffscreenBackingStore::clearHash()
{
- QList<WId> ids = m_windowAreaHash.keys();
- foreach (WId id, ids) {
- QHash<WId, QOffscreenBackingStore *>::iterator it = m_backingStoreForWinIdHash.find(id);
- if (it.value() == this)
- m_backingStoreForWinIdHash.remove(id);
+ for (auto it = m_windowAreaHash.cbegin(), end = m_windowAreaHash.cend(); it != end; ++it) {
+ const auto it2 = qAsConst(m_backingStoreForWinIdHash).find(it.key());
+ if (it2.value() == this)
+ m_backingStoreForWinIdHash.erase(it2);
}
m_windowAreaHash.clear();
}
diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro
index 152e4f57d7..79f349f472 100644
--- a/src/plugins/platforms/openwfd/openwf.pro
+++ b/src/plugins/platforms/openwfd/openwf.pro
@@ -31,7 +31,8 @@ SOURCES += \
qopenwfdportmode.cpp \
qopenwfdwindow.cpp
-LIBS += -lWFD -lgbm -lGLESv2 -lEGL
+LIBS += -lWFD
+QMAKE_USE += gbm opengl_es2 egl
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
index a5b64636af..938e63d95a 100644
--- a/src/plugins/platforms/platforms.pro
+++ b/src/plugins/platforms/platforms.pro
@@ -1,24 +1,23 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += gui-private
android: SUBDIRS += android
!android: SUBDIRS += minimal
-!android:if(!win32|contains(QT_CONFIG, freetype)): SUBDIRS += offscreen
+!android:if(!win32|qtConfig(freetype)): SUBDIRS += offscreen
-contains(QT_CONFIG, xcb) {
+qtConfig(xcb) {
SUBDIRS += xcb
}
-mac {
- ios: SUBDIRS += ios
- else: SUBDIRS += cocoa
-}
+uikit:!watchos: SUBDIRS += ios
+osx: SUBDIRS += cocoa
win32:!winrt: SUBDIRS += windows
winrt: SUBDIRS += winrt
-contains(QT_CONFIG, direct2d) {
+qtConfig(direct2d) {
SUBDIRS += direct2d
}
@@ -26,21 +25,27 @@ qnx {
SUBDIRS += qnx
}
-contains(QT_CONFIG, eglfs) {
+qtConfig(eglfs) {
SUBDIRS += eglfs
SUBDIRS += minimalegl
}
-contains(QT_CONFIG, directfb) {
+qtConfig(directfb) {
SUBDIRS += directfb
}
-contains(QT_CONFIG, linuxfb): SUBDIRS += linuxfb
+qtConfig(linuxfb): SUBDIRS += linuxfb
+
+unix:!android:!darwin: SUBDIRS += vnc
+
+freebsd {
+ SUBDIRS += bsdfb
+}
haiku {
SUBDIRS += haiku
}
-contains(QT_CONFIG, mirclient): SUBDIRS += mirclient
+qtConfig(mirclient): SUBDIRS += mirclient
-contains(QT_CONFIG, integrityfb): SUBDIRS += integrity
+qtConfig(integrityfb): SUBDIRS += integrity
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index 5a0f4f5c98..e47731476f 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -75,14 +75,14 @@ CONFIG(qqnx_screeneventthread) {
LIBS += -lscreen
-contains(QT_CONFIG, opengles2) {
+qtConfig(opengles2) {
SOURCES += qqnxglcontext.cpp \
qqnxeglwindow.cpp
HEADERS += qqnxglcontext.h \
qqnxeglwindow.h
- LIBS += -lEGL
+ QMAKE_USE += egl
}
CONFIG(qqnx_pps) {
@@ -100,7 +100,7 @@ CONFIG(qqnx_pps) {
qqnxnavigatoreventnotifier.h \
qqnxvirtualkeyboardpps.h
- LIBS += -lpps
+ QMAKE_USE += pps
!contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard
CONFIG(qqnx_imf) {
@@ -116,7 +116,7 @@ CONFIG(qqnx_pps) {
lgmon {
DEFINES += QQNX_LGMON
SOURCES += qqnxlgmon.cpp
- LIBS += -llgmon
+ QMAKE_USE += lgmon
}
OTHER_FILES += qnx.json
diff --git a/src/plugins/platforms/qnx/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 e06d9a25c4..7229d7d2a8 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 3ac3d23c88..7f11de228e 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
@@ -215,10 +215,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..f8ae5121d1 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);
}
@@ -384,10 +385,8 @@ Qt::ScreenOrientation QQnxScreen::orientation() const
QWindow *QQnxScreen::topLevelAt(const QPoint &point) const
{
- QListIterator<QQnxWindow*> it(m_childWindows);
- it.toBack();
- while (it.hasPrevious()) {
- QWindow *win = it.previous()->window();
+ for (auto it = m_childWindows.rbegin(), end = m_childWindows.rend(); it != end; ++it) {
+ QWindow *win = (*it)->window();
if (win->geometry().contains(point))
return win;
}
@@ -404,7 +403,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 f7a87b6073..beda6e1a49 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/gui/image/qnativeimage.cpp b/src/plugins/platforms/vnc/main.cpp
index 38e67761b1..6ee8bf1ec6 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/plugins/platforms/vnc/main.cpp
@@ -37,36 +37,29 @@
**
****************************************************************************/
-#include <qdebug.h>
-#include "qnativeimage_p.h"
-#include <qpa/qplatformscreen.h>
-#include "private/qguiapplication_p.h"
-#include "qscreen.h"
-
-#include "private/qpaintengine_raster_p.h"
-
+#include <qpa/qplatformintegrationplugin.h>
+#include "qvncintegration.h"
+#include "qvnc_p.h"
QT_BEGIN_NAMESPACE
-
-QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *)
- : image(width, height, format)
+class QVncIntegrationPlugin : public QPlatformIntegrationPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "vnc.json")
+public:
+ QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+};
-}
-
-
-QNativeImage::~QNativeImage()
+QPlatformIntegration* QVncIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
-}
+ if (!system.compare(QLatin1String("vnc"), Qt::CaseInsensitive))
+ return new QVncIntegration(paramList);
-QImage::Format QNativeImage::systemFormat()
-{
- if (!QGuiApplication::primaryScreen())
- return QImage::Format_Invalid;
- return QGuiApplication::primaryScreen()->handle()->format();
+ return 0;
}
-
QT_END_NAMESPACE
+#include "main.moc"
+
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
new file mode 100644
index 0000000000..b3613cf18f
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -0,0 +1,680 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qvnc_p.h"
+#include "qvncscreen.h"
+#include "qvncclient.h"
+#include "QtNetwork/qtcpserver.h"
+#include "QtNetwork/qtcpsocket.h"
+#include <qthread.h>
+
+#include <QtGui/qguiapplication.h>
+#include <QtGui/QWindow>
+
+#ifdef Q_OS_WIN
+#include <Winsock2.h>
+#else
+#include <arpa/inet.h>
+#endif
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcVnc, "qt.qpa.vnc");
+
+QVncDirtyMap::QVncDirtyMap(QVncScreen *screen)
+ : screen(screen), bytesPerPixel(0), numDirty(0)
+{
+ bytesPerPixel = (screen->depth() + 7) / 8;
+ bufferWidth = screen->geometry().width();
+ bufferHeight = screen->geometry().height();
+ bufferStride = bufferWidth * bytesPerPixel;
+ buffer = new uchar[bufferHeight * bufferStride];
+
+ mapWidth = (bufferWidth + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE;
+ mapHeight = (bufferHeight + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE;
+ numTiles = mapWidth * mapHeight;
+ map = new uchar[numTiles];
+}
+
+QVncDirtyMap::~QVncDirtyMap()
+{
+ delete[] map;
+ delete[] buffer;
+}
+
+void QVncDirtyMap::reset()
+{
+ memset(map, 1, numTiles);
+ memset(buffer, 0, bufferHeight * bufferStride);
+ numDirty = numTiles;
+}
+
+inline bool QVncDirtyMap::dirty(int x, int y) const
+{
+ return map[y * mapWidth + x];
+}
+
+inline void QVncDirtyMap::setClean(int x, int y)
+{
+ map[y * mapWidth + x] = 0;
+ --numDirty;
+}
+
+template <class T>
+void QVncDirtyMapOptimized<T>::setDirty(int tileX, int tileY, bool force)
+{
+ static bool alwaysForce = qEnvironmentVariableIsSet("QT_VNC_NO_COMPAREBUFFER");
+ if (alwaysForce)
+ force = true;
+
+ bool changed = false;
+
+ if (!force) {
+ const int lstep = bufferStride;
+ const int startX = tileX * MAP_TILE_SIZE;
+ const int startY = tileY * MAP_TILE_SIZE;
+ const uchar *scrn = screen->image()->constBits()
+ + startY * lstep + startX * bytesPerPixel;
+ uchar *old = buffer + startY * bufferStride + startX * sizeof(T);
+
+ const int tileHeight = (startY + MAP_TILE_SIZE > bufferHeight ?
+ bufferHeight - startY : MAP_TILE_SIZE);
+ const int tileWidth = (startX + MAP_TILE_SIZE > bufferWidth ?
+ bufferWidth - startX : MAP_TILE_SIZE);
+ const bool doInlines = (tileWidth == MAP_TILE_SIZE);
+
+ int y = tileHeight;
+
+ if (doInlines) { // hw: memcmp/memcpy is inlined when using constants
+ while (y) {
+ if (memcmp(old, scrn, sizeof(T) * MAP_TILE_SIZE)) {
+ changed = true;
+ break;
+ }
+ scrn += lstep;
+ old += bufferStride;
+ --y;
+ }
+
+ while (y) {
+ memcpy(old, scrn, sizeof(T) * MAP_TILE_SIZE);
+ scrn += lstep;
+ old += bufferStride;
+ --y;
+ }
+ } else {
+ while (y) {
+ if (memcmp(old, scrn, sizeof(T) * tileWidth)) {
+ changed = true;
+ break;
+ }
+ scrn += lstep;
+ old += bufferStride;
+ --y;
+ }
+
+ while (y) {
+ memcpy(old, scrn, sizeof(T) * tileWidth);
+ scrn += lstep;
+ old += bufferStride;
+ --y;
+ }
+ }
+ }
+
+ const int mapIndex = tileY * mapWidth + tileX;
+ if ((force || changed) && !map[mapIndex]) {
+ map[mapIndex] = 1;
+ ++numDirty;
+ }
+}
+
+template class QVncDirtyMapOptimized<unsigned char>;
+template class QVncDirtyMapOptimized<unsigned short>;
+template class QVncDirtyMapOptimized<unsigned int>;
+
+static const struct {
+ int keysym;
+ int keycode;
+} keyMap[] = {
+ { 0xff08, Qt::Key_Backspace },
+ { 0xff09, Qt::Key_Tab },
+ { 0xff0d, Qt::Key_Return },
+ { 0xff1b, Qt::Key_Escape },
+ { 0xff63, Qt::Key_Insert },
+ { 0xffff, Qt::Key_Delete },
+ { 0xff50, Qt::Key_Home },
+ { 0xff57, Qt::Key_End },
+ { 0xff55, Qt::Key_PageUp },
+ { 0xff56, Qt::Key_PageDown },
+ { 0xff51, Qt::Key_Left },
+ { 0xff52, Qt::Key_Up },
+ { 0xff53, Qt::Key_Right },
+ { 0xff54, Qt::Key_Down },
+ { 0xffbe, Qt::Key_F1 },
+ { 0xffbf, Qt::Key_F2 },
+ { 0xffc0, Qt::Key_F3 },
+ { 0xffc1, Qt::Key_F4 },
+ { 0xffc2, Qt::Key_F5 },
+ { 0xffc3, Qt::Key_F6 },
+ { 0xffc4, Qt::Key_F7 },
+ { 0xffc5, Qt::Key_F8 },
+ { 0xffc6, Qt::Key_F9 },
+ { 0xffc7, Qt::Key_F10 },
+ { 0xffc8, Qt::Key_F11 },
+ { 0xffc9, Qt::Key_F12 },
+ { 0xffe1, Qt::Key_Shift },
+ { 0xffe2, Qt::Key_Shift },
+ { 0xffe3, Qt::Key_Control },
+ { 0xffe4, Qt::Key_Control },
+ { 0xffe7, Qt::Key_Meta },
+ { 0xffe8, Qt::Key_Meta },
+ { 0xffe9, Qt::Key_Alt },
+ { 0xffea, Qt::Key_Alt },
+
+ { 0xffb0, Qt::Key_0 },
+ { 0xffb1, Qt::Key_1 },
+ { 0xffb2, Qt::Key_2 },
+ { 0xffb3, Qt::Key_3 },
+ { 0xffb4, Qt::Key_4 },
+ { 0xffb5, Qt::Key_5 },
+ { 0xffb6, Qt::Key_6 },
+ { 0xffb7, Qt::Key_7 },
+ { 0xffb8, Qt::Key_8 },
+ { 0xffb9, Qt::Key_9 },
+
+ { 0xff8d, Qt::Key_Return },
+ { 0xffaa, Qt::Key_Asterisk },
+ { 0xffab, Qt::Key_Plus },
+ { 0xffad, Qt::Key_Minus },
+ { 0xffae, Qt::Key_Period },
+ { 0xffaf, Qt::Key_Slash },
+
+ { 0xff95, Qt::Key_Home },
+ { 0xff96, Qt::Key_Left },
+ { 0xff97, Qt::Key_Up },
+ { 0xff98, Qt::Key_Right },
+ { 0xff99, Qt::Key_Down },
+ { 0xff9a, Qt::Key_PageUp },
+ { 0xff9b, Qt::Key_PageDown },
+ { 0xff9c, Qt::Key_End },
+ { 0xff9e, Qt::Key_Insert },
+ { 0xff9f, Qt::Key_Delete },
+
+ { 0, 0 }
+};
+
+void QRfbRect::read(QTcpSocket *s)
+{
+ quint16 buf[4];
+ s->read((char*)buf, 8);
+ x = ntohs(buf[0]);
+ y = ntohs(buf[1]);
+ w = ntohs(buf[2]);
+ h = ntohs(buf[3]);
+}
+
+void QRfbRect::write(QTcpSocket *s) const
+{
+ quint16 buf[4];
+ buf[0] = htons(x);
+ buf[1] = htons(y);
+ buf[2] = htons(w);
+ buf[3] = htons(h);
+ s->write((char*)buf, 8);
+}
+
+void QRfbPixelFormat::read(QTcpSocket *s)
+{
+ char buf[16];
+ s->read(buf, 16);
+ bitsPerPixel = buf[0];
+ depth = buf[1];
+ bigEndian = buf[2];
+ trueColor = buf[3];
+
+ quint16 a = ntohs(*(quint16 *)(buf + 4));
+ redBits = 0;
+ while (a) { a >>= 1; redBits++; }
+
+ a = ntohs(*(quint16 *)(buf + 6));
+ greenBits = 0;
+ while (a) { a >>= 1; greenBits++; }
+
+ a = ntohs(*(quint16 *)(buf + 8));
+ blueBits = 0;
+ while (a) { a >>= 1; blueBits++; }
+
+ redShift = buf[10];
+ greenShift = buf[11];
+ blueShift = buf[12];
+}
+
+void QRfbPixelFormat::write(QTcpSocket *s)
+{
+ char buf[16];
+ buf[0] = bitsPerPixel;
+ buf[1] = depth;
+ buf[2] = bigEndian;
+ buf[3] = trueColor;
+
+ quint16 a = 0;
+ for (int i = 0; i < redBits; i++) a = (a << 1) | 1;
+ *(quint16 *)(buf + 4) = htons(a);
+
+ a = 0;
+ for (int i = 0; i < greenBits; i++) a = (a << 1) | 1;
+ *(quint16 *)(buf + 6) = htons(a);
+
+ a = 0;
+ for (int i = 0; i < blueBits; i++) a = (a << 1) | 1;
+ *(quint16 *)(buf + 8) = htons(a);
+
+ buf[10] = redShift;
+ buf[11] = greenShift;
+ buf[12] = blueShift;
+ s->write(buf, 16);
+}
+
+
+void QRfbServerInit::setName(const char *n)
+{
+ delete[] name;
+ name = new char [strlen(n) + 1];
+ strcpy(name, n);
+}
+
+void QRfbServerInit::read(QTcpSocket *s)
+{
+ s->read((char *)&width, 2);
+ width = ntohs(width);
+ s->read((char *)&height, 2);
+ height = ntohs(height);
+ format.read(s);
+
+ quint32 len;
+ s->read((char *)&len, 4);
+ len = ntohl(len);
+
+ name = new char [len + 1];
+ s->read(name, len);
+ name[len] = '\0';
+}
+
+void QRfbServerInit::write(QTcpSocket *s)
+{
+ quint16 t = htons(width);
+ s->write((char *)&t, 2);
+ t = htons(height);
+ s->write((char *)&t, 2);
+ format.write(s);
+ quint32 len = strlen(name);
+ len = htonl(len);
+ s->write((char *)&len, 4);
+ s->write(name, strlen(name));
+}
+
+bool QRfbSetEncodings::read(QTcpSocket *s)
+{
+ if (s->bytesAvailable() < 3)
+ return false;
+
+ char tmp;
+ s->read(&tmp, 1); // padding
+ s->read((char *)&count, 2);
+ count = ntohs(count);
+
+ return true;
+}
+
+bool QRfbFrameBufferUpdateRequest::read(QTcpSocket *s)
+{
+ if (s->bytesAvailable() < 9)
+ return false;
+
+ s->read(&incremental, 1);
+ rect.read(s);
+
+ return true;
+}
+
+bool QRfbKeyEvent::read(QTcpSocket *s)
+{
+ if (s->bytesAvailable() < 7)
+ return false;
+
+ s->read(&down, 1);
+ quint16 tmp;
+ s->read((char *)&tmp, 2); // padding
+
+ quint32 key;
+ s->read((char *)&key, 4);
+ key = ntohl(key);
+
+ unicode = 0;
+ keycode = 0;
+ int i = 0;
+ while (keyMap[i].keysym && !keycode) {
+ if (keyMap[i].keysym == (int)key)
+ keycode = keyMap[i].keycode;
+ i++;
+ }
+
+ if (keycode >= ' ' && keycode <= '~')
+ unicode = keycode;
+
+ if (!keycode) {
+ if (key <= 0xff) {
+ unicode = key;
+ if (key >= 'a' && key <= 'z')
+ keycode = Qt::Key_A + key - 'a';
+ else if (key >= ' ' && key <= '~')
+ keycode = Qt::Key_Space + key - ' ';
+ }
+ }
+
+ return true;
+}
+
+bool QRfbPointerEvent::read(QTcpSocket *s)
+{
+ if (s->bytesAvailable() < 5)
+ return false;
+
+ char buttonMask;
+ s->read(&buttonMask, 1);
+ buttons = Qt::NoButton;
+ if (buttonMask & 1)
+ buttons |= Qt::LeftButton;
+ if (buttonMask & 2)
+ buttons |= Qt::MidButton;
+ if (buttonMask & 4)
+ buttons |= Qt::RightButton;
+
+ quint16 tmp;
+ s->read((char *)&tmp, 2);
+ x = ntohs(tmp);
+ s->read((char *)&tmp, 2);
+ y = ntohs(tmp);
+
+ return true;
+}
+
+bool QRfbClientCutText::read(QTcpSocket *s)
+{
+ if (s->bytesAvailable() < 7)
+ return false;
+
+ char tmp[3];
+ s->read(tmp, 3); // padding
+ s->read((char *)&length, 4);
+ length = ntohl(length);
+
+ return true;
+}
+
+void QRfbRawEncoder::write()
+{
+// QVncDirtyMap *map = server->dirtyMap();
+ QTcpSocket *socket = client->clientSocket();
+
+ const int bytesPerPixel = client->clientBytesPerPixel();
+
+ // create a region from the dirty rects and send the region's merged rects.
+ // ### use the tile map again
+ QRegion rgn = client->dirtyRegion();
+ qCDebug(lcVnc) << "QRfbRawEncoder::write()" << rgn;
+// if (map) {
+// for (int y = 0; y < map->mapHeight; ++y) {
+// for (int x = 0; x < map->mapWidth; ++x) {
+// if (!map->dirty(x, y))
+// continue;
+// rgn += QRect(x * MAP_TILE_SIZE, y * MAP_TILE_SIZE,
+// MAP_TILE_SIZE, MAP_TILE_SIZE);
+// map->setClean(x, y);
+// }
+// }
+
+// rgn &= QRect(0, 0, server->screen()->geometry().width(),
+// server->screen()->geometry().height());
+// }
+ const QVector<QRect> rects = rgn.rects();
+
+ {
+ const char tmp[2] = { 0, 0 }; // msg type, padding
+ socket->write(tmp, sizeof(tmp));
+ }
+
+ {
+ const quint16 count = htons(rects.size());
+ socket->write((char *)&count, sizeof(count));
+ }
+
+ if (rects.size() <= 0)
+ return;
+
+ const QImage screenImage = client->server()->screenImage();
+
+ for (const QRect &tileRect: rects) {
+ const QRfbRect rect(tileRect.x(), tileRect.y(),
+ tileRect.width(), tileRect.height());
+ rect.write(socket);
+
+ const quint32 encoding = htonl(0); // raw encoding
+ socket->write((char *)&encoding, sizeof(encoding));
+
+ int linestep = screenImage.bytesPerLine();
+ const uchar *screendata = screenImage.scanLine(rect.y)
+ + rect.x * screenImage.depth() / 8;
+
+ if (client->doPixelConversion()) {
+ const int bufferSize = rect.w * rect.h * bytesPerPixel;
+ if (bufferSize > buffer.size())
+ buffer.resize(bufferSize);
+
+ // convert pixels
+ char *b = buffer.data();
+ const int bstep = rect.w * bytesPerPixel;
+ for (int i = 0; i < rect.h; ++i) {
+ client->convertPixels(b, (const char*)screendata, rect.w);
+ screendata += linestep;
+ b += bstep;
+ }
+ socket->write(buffer.constData(), bufferSize);
+ } else {
+ for (int i = 0; i < rect.h; ++i) {
+ socket->write((const char*)screendata, rect.w * bytesPerPixel);
+ screendata += linestep;
+ }
+ }
+ if (socket->state() == QAbstractSocket::UnconnectedState)
+ break;
+ }
+ socket->flush();
+}
+
+QVncClientCursor::QVncClientCursor()
+{
+ QWindow *w = QGuiApplication::focusWindow();
+ QCursor c = w ? w->cursor() : QCursor(Qt::ArrowCursor);
+ changeCursor(&c, 0);
+}
+
+QVncClientCursor::~QVncClientCursor()
+{
+}
+
+void QVncClientCursor::write(QVncClient *client) const
+{
+ QTcpSocket *socket = client->clientSocket();
+
+ // FramebufferUpdate header
+ {
+ const quint16 tmp[6] = { htons(0),
+ htons(1),
+ htons(hotspot.x()), htons(hotspot.y()),
+ htons(cursor.width()),
+ htons(cursor.height()) };
+ socket->write((char*)tmp, sizeof(tmp));
+
+ const quint32 encoding = htonl(-239);
+ socket->write((char*)(&encoding), sizeof(encoding));
+ }
+
+ if (cursor.isNull())
+ return;
+
+ // write pixels
+ Q_ASSERT(cursor.hasAlphaChannel());
+ const QImage img = cursor.convertToFormat(client->server()->screen()->format());
+ const int n = client->clientBytesPerPixel() * img.width();
+ char *buffer = new char[n];
+ for (int i = 0; i < img.height(); ++i) {
+ client->convertPixels(buffer, (const char*)img.scanLine(i), img.width());
+ socket->write(buffer, n);
+ }
+ delete[] buffer;
+
+ // write mask
+ const QImage bitmap = cursor.createAlphaMask().convertToFormat(QImage::Format_Mono);
+ Q_ASSERT(bitmap.depth() == 1);
+ Q_ASSERT(bitmap.size() == img.size());
+ const int width = (bitmap.width() + 7) / 8;
+ for (int i = 0; i < bitmap.height(); ++i)
+ socket->write((const char*)bitmap.scanLine(i), width);
+}
+
+#ifndef QT_NO_CURSOR
+void QVncClientCursor::changeCursor(QCursor *widgetCursor, QWindow *window)
+{
+ Q_UNUSED(window);
+ const Qt::CursorShape shape = widgetCursor ? widgetCursor->shape() : Qt::ArrowCursor;
+
+ if (shape == Qt::BitmapCursor) {
+ // application supplied cursor
+ hotspot = widgetCursor->hotSpot();
+ cursor = widgetCursor->pixmap().toImage();
+ } else {
+ // system cursor
+ QPlatformCursorImage platformImage(0, 0, 0, 0, 0, 0);
+ platformImage.set(shape);
+ cursor = *platformImage.image();
+ hotspot = platformImage.hotspot();
+ }
+ for (auto client : clients)
+ client->setDirtyCursor();
+}
+
+void QVncClientCursor::addClient(QVncClient *client)
+{
+ if (!clients.contains(client))
+ clients.append(client);
+}
+
+uint QVncClientCursor::removeClient(QVncClient *client)
+{
+ clients.removeOne(client);
+ return clients.count();
+}
+#endif
+
+QVncServer::QVncServer(QVncScreen *screen, quint16 port)
+ : qvnc_screen(screen)
+ , m_port(port)
+{
+ QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
+}
+
+void QVncServer::init()
+{
+ serverSocket = new QTcpServer(this);
+ if (!serverSocket->listen(QHostAddress::Any, m_port))
+ qWarning() << "QVncServer could not connect:" << serverSocket->errorString();
+ else
+ qWarning("QVncServer created on port %d", m_port);
+
+ connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection()));
+
+}
+
+QVncServer::~QVncServer()
+{
+ for (auto client : clients) {
+ delete client;
+ }
+}
+
+void QVncServer::setDirty()
+{
+ for (auto client : clients) {
+ client->setDirty(qvnc_screen->dirtyRegion);
+ }
+ qvnc_screen->clearDirty();
+}
+
+
+void QVncServer::newConnection()
+{
+ auto clientSocket = serverSocket->nextPendingConnection();
+ clients.append(new QVncClient(clientSocket, this));
+
+ dirtyMap()->reset();
+
+ qCDebug(lcVnc) << "new Connection from: " << clientSocket->localAddress();
+
+ qvnc_screen->setPowerState(QPlatformScreen::PowerStateOn);
+}
+
+void QVncServer::discardClient(QVncClient *client)
+{
+ clients.removeOne(client);
+ client->deleteLater();
+ if (clients.isEmpty()) {
+ qvnc_screen->disableClientCursor(client);
+ qvnc_screen->setPowerState(QPlatformScreen::PowerStateOff);
+ }
+}
+
+inline QImage QVncServer::screenImage() const
+{
+ return *qvnc_screen->image();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/vnc/qvnc_p.h b/src/plugins/platforms/vnc/qvnc_p.h
new file mode 100644
index 0000000000..1c44cd1569
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvnc_p.h
@@ -0,0 +1,417 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVNC_P_H
+#define QVNC_P_H
+
+#include "qvncscreen.h"
+
+#include <QtCore/QLoggingCategory>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qvarlengtharray.h>
+#include <qpa/qplatformcursor.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(lcVnc)
+
+class QTcpSocket;
+class QTcpServer;
+
+class QVncScreen;
+class QVncServer;
+class QVncClientCursor;
+class QVncClient;
+
+// This fits with the VNC hextile messages
+#define MAP_TILE_SIZE 16
+
+class QVncDirtyMap
+{
+public:
+ QVncDirtyMap(QVncScreen *screen);
+ virtual ~QVncDirtyMap();
+
+ void reset();
+ bool dirty(int x, int y) const;
+ virtual void setDirty(int x, int y, bool force = false) = 0;
+ void setClean(int x, int y);
+
+ QVncScreen *screen;
+ int bytesPerPixel;
+ int numDirty;
+ int mapWidth;
+ int mapHeight;
+
+protected:
+ uchar *map;
+ uchar *buffer;
+ int bufferWidth;
+ int bufferHeight;
+ int bufferStride;
+ int numTiles;
+};
+
+template <class T>
+class QVncDirtyMapOptimized : public QVncDirtyMap
+{
+public:
+ QVncDirtyMapOptimized(QVncScreen *screen) : QVncDirtyMap(screen) {}
+ ~QVncDirtyMapOptimized() {}
+
+ void setDirty(int x, int y, bool force = false);
+};
+
+
+class QRfbRect
+{
+public:
+ QRfbRect() {}
+ QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h) {
+ x = _x; y = _y; w = _w; h = _h;
+ }
+
+ void read(QTcpSocket *s);
+ void write(QTcpSocket *s) const;
+
+ quint16 x;
+ quint16 y;
+ quint16 w;
+ quint16 h;
+};
+
+class QRfbPixelFormat
+{
+public:
+ static int size() { return 16; }
+
+ void read(QTcpSocket *s);
+ void write(QTcpSocket *s);
+
+ int bitsPerPixel;
+ int depth;
+ bool bigEndian;
+ bool trueColor;
+ int redBits;
+ int greenBits;
+ int blueBits;
+ int redShift;
+ int greenShift;
+ int blueShift;
+};
+
+class QRfbServerInit
+{
+public:
+ QRfbServerInit() { name = 0; }
+ ~QRfbServerInit() { delete[] name; }
+
+ int size() const { return QRfbPixelFormat::size() + 8 + strlen(name); }
+ void setName(const char *n);
+
+ void read(QTcpSocket *s);
+ void write(QTcpSocket *s);
+
+ quint16 width;
+ quint16 height;
+ QRfbPixelFormat format;
+ char *name;
+};
+
+class QRfbSetEncodings
+{
+public:
+ bool read(QTcpSocket *s);
+
+ quint16 count;
+};
+
+class QRfbFrameBufferUpdateRequest
+{
+public:
+ bool read(QTcpSocket *s);
+
+ char incremental;
+ QRfbRect rect;
+};
+
+class QRfbKeyEvent
+{
+public:
+ bool read(QTcpSocket *s);
+
+ char down;
+ int keycode;
+ int unicode;
+};
+
+class QRfbPointerEvent
+{
+public:
+ bool read(QTcpSocket *s);
+
+ Qt::MouseButtons buttons;
+ quint16 x;
+ quint16 y;
+};
+
+class QRfbClientCutText
+{
+public:
+ bool read(QTcpSocket *s);
+
+ quint32 length;
+};
+
+class QRfbEncoder
+{
+public:
+ QRfbEncoder(QVncClient *s) : client(s) {}
+ virtual ~QRfbEncoder() {}
+
+ virtual void write() = 0;
+
+protected:
+ QVncClient *client;
+};
+
+class QRfbRawEncoder : public QRfbEncoder
+{
+public:
+ QRfbRawEncoder(QVncClient *s) : QRfbEncoder(s) {}
+
+ void write();
+
+private:
+ QByteArray buffer;
+};
+
+template <class SRC> class QRfbHextileEncoder;
+
+template <class SRC>
+class QRfbSingleColorHextile
+{
+public:
+ QRfbSingleColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
+ bool read(const uchar *data, int width, int height, int stride);
+ void write(QTcpSocket *socket) const;
+
+private:
+ QRfbHextileEncoder<SRC> *encoder;
+};
+
+template <class SRC>
+class QRfbDualColorHextile
+{
+public:
+ QRfbDualColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
+ bool read(const uchar *data, int width, int height, int stride);
+ void write(QTcpSocket *socket) const;
+
+private:
+ struct Rect {
+ quint8 xy;
+ quint8 wh;
+ } Q_PACKED rects[8 * 16];
+
+ quint8 numRects;
+ QRfbHextileEncoder<SRC> *encoder;
+
+private:
+ inline int lastx() const { return rectx(numRects); }
+ inline int lasty() const { return recty(numRects); }
+ inline int rectx(int r) const { return rects[r].xy >> 4; }
+ inline int recty(int r) const { return rects[r].xy & 0x0f; }
+ inline int width(int r) const { return (rects[r].wh >> 4) + 1; }
+ inline int height(int r) const { return (rects[r].wh & 0x0f) + 1; }
+
+ inline void setX(int r, int x) {
+ rects[r].xy = (x << 4) | (rects[r].xy & 0x0f);
+ }
+ inline void setY(int r, int y) {
+ rects[r].xy = (rects[r].xy & 0xf0) | y;
+ }
+ inline void setWidth(int r, int width) {
+ rects[r].wh = ((width - 1) << 4) | (rects[r].wh & 0x0f);
+ }
+ inline void setHeight(int r, int height) {
+ rects[r].wh = (rects[r].wh & 0xf0) | (height - 1);
+ }
+
+ inline void setWidth(int width) { setWidth(numRects, width); }
+ inline void setHeight(int height) { setHeight(numRects, height); }
+ inline void setX(int x) { setX(numRects, x); }
+ inline void setY(int y) { setY(numRects, y); }
+ void next();
+};
+
+template <class SRC>
+class QRfbMultiColorHextile
+{
+public:
+ QRfbMultiColorHextile(QRfbHextileEncoder<SRC> *e) : encoder(e) {}
+ bool read(const uchar *data, int width, int height, int stride);
+ void write(QTcpSocket *socket) const;
+
+private:
+ inline quint8* rect(int r) {
+ return rects.data() + r * (bpp + 2);
+ }
+ inline const quint8* rect(int r) const {
+ return rects.constData() + r * (bpp + 2);
+ }
+ inline void setX(int r, int x) {
+ quint8 *ptr = rect(r) + bpp;
+ *ptr = (x << 4) | (*ptr & 0x0f);
+ }
+ inline void setY(int r, int y) {
+ quint8 *ptr = rect(r) + bpp;
+ *ptr = (*ptr & 0xf0) | y;
+ }
+ void setColor(SRC color);
+ inline int rectx(int r) const {
+ const quint8 *ptr = rect(r) + bpp;
+ return *ptr >> 4;
+ }
+ inline int recty(int r) const {
+ const quint8 *ptr = rect(r) + bpp;
+ return *ptr & 0x0f;
+ }
+ inline void setWidth(int r, int width) {
+ quint8 *ptr = rect(r) + bpp + 1;
+ *ptr = ((width - 1) << 4) | (*ptr & 0x0f);
+ }
+ inline void setHeight(int r, int height) {
+ quint8 *ptr = rect(r) + bpp + 1;
+ *ptr = (*ptr & 0xf0) | (height - 1);
+ }
+
+ bool beginRect();
+ void endRect();
+
+ static const int maxRectsSize = 16 * 16;
+ QVarLengthArray<quint8, maxRectsSize> rects;
+
+ quint8 bpp;
+ quint8 numRects;
+ QRfbHextileEncoder<SRC> *encoder;
+};
+
+template <class SRC>
+class QRfbHextileEncoder : public QRfbEncoder
+{
+public:
+ QRfbHextileEncoder(QVncServer *s);
+ void write();
+
+private:
+ enum SubEncoding {
+ Raw = 1,
+ BackgroundSpecified = 2,
+ ForegroundSpecified = 4,
+ AnySubrects = 8,
+ SubrectsColoured = 16
+ };
+
+ QByteArray buffer;
+ QRfbSingleColorHextile<SRC> singleColorHextile;
+ QRfbDualColorHextile<SRC> dualColorHextile;
+ QRfbMultiColorHextile<SRC> multiColorHextile;
+
+ SRC bg;
+ SRC fg;
+ bool newBg;
+ bool newFg;
+
+ friend class QRfbSingleColorHextile<SRC>;
+ friend class QRfbDualColorHextile<SRC>;
+ friend class QRfbMultiColorHextile<SRC>;
+};
+
+class QVncClientCursor : public QPlatformCursor
+{
+public:
+ QVncClientCursor();
+ ~QVncClientCursor();
+
+ void write(QVncClient *client) const;
+
+ void changeCursor(QCursor *widgetCursor, QWindow *window);
+
+ void addClient(QVncClient *client);
+ uint removeClient(QVncClient *client);
+
+ QImage cursor;
+ QPoint hotspot;
+ QVector<QVncClient *> clients;
+};
+
+
+class QVncServer : public QObject
+{
+ Q_OBJECT
+public:
+ QVncServer(QVncScreen *screen, quint16 port = 5900);
+ ~QVncServer();
+
+ enum ServerMsg { FramebufferUpdate = 0,
+ SetColourMapEntries = 1 };
+
+ void setDirty();
+
+
+ inline QVncScreen* screen() const { return qvnc_screen; }
+ inline QVncDirtyMap* dirtyMap() const { return qvnc_screen->dirty; }
+ QImage screenImage() const;
+ void discardClient(QVncClient *client);
+
+private slots:
+ void newConnection();
+ void init();
+
+private:
+ QTcpServer *serverSocket;
+ QVector<QVncClient*> clients;
+ QVncScreen *qvnc_screen;
+ quint16 m_port;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/platforms/vnc/qvncclient.cpp b/src/plugins/platforms/vnc/qvncclient.cpp
new file mode 100644
index 0000000000..dae3e83f37
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvncclient.cpp
@@ -0,0 +1,662 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvncclient.h"
+#include "qvnc_p.h"
+
+#include <QtNetwork/QTcpSocket>
+#include <QtCore/QCoreApplication>
+
+#include <qpa/qwindowsysteminterface.h>
+#include <QtGui/qguiapplication.h>
+
+#ifdef Q_OS_WIN
+#include <Winsock2.h>
+#else
+#include <arpa/inet.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QVncClient::QVncClient(QTcpSocket *clientSocket, QVncServer *server)
+ : QObject(server)
+ , m_server(server)
+ , m_clientSocket(clientSocket)
+ , m_encoder(nullptr)
+ , m_msgType(0)
+ , m_handleMsg(false)
+ , m_encodingsPending(0)
+ , m_cutTextPending(0)
+ , m_supportHextile(false)
+ , m_wantUpdate(false)
+ , m_keymod(0)
+ , m_dirtyCursor(false)
+ , m_updatePending(false)
+ , m_protocolVersion(V3_3)
+{
+ connect(m_clientSocket,SIGNAL(readyRead()),this,SLOT(readClient()));
+ connect(m_clientSocket,SIGNAL(disconnected()),this,SLOT(discardClient()));
+
+ // send protocol version
+ const char *proto = "RFB 003.003\n";
+ m_clientSocket->write(proto, 12);
+ m_state = Protocol;
+}
+
+QVncClient::~QVncClient()
+{
+ delete m_encoder;
+}
+
+QTcpSocket *QVncClient::clientSocket() const
+{
+ return m_clientSocket;
+}
+
+void QVncClient::setDirty(const QRegion &region)
+{
+ m_dirtyRegion += region;
+ if (m_state == Connected &&
+ ((m_server->dirtyMap()->numDirty > 0) || m_dirtyCursor)) {
+ scheduleUpdate();
+ }
+}
+
+void QVncClient::convertPixels(char *dst, const char *src, int count) const
+{
+ const int screendepth = m_server->screen()->depth();
+
+ // cutoffs
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ if (!m_swapBytes)
+#endif
+ if (m_sameEndian) {
+ if (screendepth == m_pixelFormat.bitsPerPixel) { // memcpy cutoffs
+
+ switch (screendepth) {
+ case 32:
+ memcpy(dst, src, count * sizeof(quint32));
+ return;
+ case 16:
+ if (m_pixelFormat.redBits == 5
+ && m_pixelFormat.greenBits == 6
+ && m_pixelFormat.blueBits == 5)
+ {
+ memcpy(dst, src, count * sizeof(quint16));
+ return;
+ }
+ }
+ }
+ }
+
+ const int bytesPerPixel = (m_pixelFormat.bitsPerPixel + 7) / 8;
+
+ for (int i = 0; i < count; ++i) {
+ int r, g, b;
+
+ switch (screendepth) {
+ case 8: {
+ QRgb rgb = m_server->screen()->image()->colorTable()[int(*src)];
+ r = qRed(rgb);
+ g = qGreen(rgb);
+ b = qBlue(rgb);
+ src++;
+ break;
+ }
+ case 16: {
+ quint16 p = *reinterpret_cast<const quint16*>(src);
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ if (swapBytes)
+ p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8);
+#endif
+ r = (p >> 11) & 0x1f;
+ g = (p >> 5) & 0x3f;
+ b = p & 0x1f;
+ r <<= 3;
+ g <<= 2;
+ b <<= 3;
+ src += sizeof(quint16);
+ break;
+ }
+ case 32: {
+ quint32 p = *reinterpret_cast<const quint32*>(src);
+ r = (p >> 16) & 0xff;
+ g = (p >> 8) & 0xff;
+ b = p & 0xff;
+ src += sizeof(quint32);
+ break;
+ }
+ default: {
+ r = g = b = 0;
+ qWarning("QVNCServer: don't support %dbpp display", screendepth);
+ return;
+ }
+ }
+
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ if (m_swapBytes)
+ qSwap(r, b);
+#endif
+
+ r >>= (8 - m_pixelFormat.redBits);
+ g >>= (8 - m_pixelFormat.greenBits);
+ b >>= (8 - m_pixelFormat.blueBits);
+
+ int pixel = (r << m_pixelFormat.redShift) |
+ (g << m_pixelFormat.greenShift) |
+ (b << m_pixelFormat.blueShift);
+
+ if (m_sameEndian || m_pixelFormat.bitsPerPixel == 8) {
+ memcpy(dst, &pixel, bytesPerPixel);
+ dst += bytesPerPixel;
+ continue;
+ }
+
+
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
+ switch (m_pixelFormat.bitsPerPixel) {
+ case 16:
+ pixel = (((pixel & 0x0000ff00) << 8) |
+ ((pixel & 0x000000ff) << 24));
+ break;
+ case 32:
+ pixel = (((pixel & 0xff000000) >> 24) |
+ ((pixel & 0x00ff0000) >> 8) |
+ ((pixel & 0x0000ff00) << 8) |
+ ((pixel & 0x000000ff) << 24));
+ break;
+ default:
+ qWarning("Cannot handle %d bpp client", m_pixelFormat.bitsPerPixel);
+ }
+ } else { // QSysInfo::ByteOrder == QSysInfo::LittleEndian
+ switch (m_pixelFormat.bitsPerPixel) {
+ case 16:
+ pixel = (((pixel & 0xff000000) >> 8) |
+ ((pixel & 0x00ff0000) << 8));
+ break;
+ case 32:
+ pixel = (((pixel & 0xff000000) >> 24) |
+ ((pixel & 0x00ff0000) >> 8) |
+ ((pixel & 0x0000ff00) << 8) |
+ ((pixel & 0x000000ff) << 24));
+ break;
+ default:
+ qWarning("Cannot handle %d bpp client",
+ m_pixelFormat.bitsPerPixel);
+ break;
+ }
+ }
+ memcpy(dst, &pixel, bytesPerPixel);
+ dst += bytesPerPixel;
+ }
+}
+
+void QVncClient::readClient()
+{
+ qCDebug(lcVnc) << "readClient" << m_state;
+ switch (m_state) {
+ case Disconnected:
+
+ break;
+ case Protocol:
+ if (m_clientSocket->bytesAvailable() >= 12) {
+ char proto[13];
+ m_clientSocket->read(proto, 12);
+ proto[12] = '\0';
+ qCDebug(lcVnc, "Client protocol version %s", proto);
+ if (!strcmp(proto, "RFB 003.008\n")) {
+ m_protocolVersion = V3_8;
+ } else if (!strcmp(proto, "RFB 003.007\n")) {
+ m_protocolVersion = V3_7;
+ } else {
+ m_protocolVersion = V3_3;
+ }
+
+ if (m_protocolVersion == V3_3) {
+ // No authentication
+ quint32 auth = htonl(1);
+ m_clientSocket->write((char *) &auth, sizeof(auth));
+ m_state = Init;
+ }
+ }
+ break;
+ case Authentication:
+
+ break;
+ case Init:
+ if (m_clientSocket->bytesAvailable() >= 1) {
+ quint8 shared;
+ m_clientSocket->read((char *) &shared, 1);
+
+ // Server Init msg
+ QRfbServerInit sim;
+ QRfbPixelFormat &format = sim.format;
+ switch (m_server->screen()->depth()) {
+ case 32:
+ format.bitsPerPixel = 32;
+ format.depth = 32;
+ format.bigEndian = 0;
+ format.trueColor = true;
+ format.redBits = 8;
+ format.greenBits = 8;
+ format.blueBits = 8;
+ format.redShift = 16;
+ format.greenShift = 8;
+ format.blueShift = 0;
+ break;
+
+ case 24:
+ format.bitsPerPixel = 24;
+ format.depth = 24;
+ format.bigEndian = 0;
+ format.trueColor = true;
+ format.redBits = 8;
+ format.greenBits = 8;
+ format.blueBits = 8;
+ format.redShift = 16;
+ format.greenShift = 8;
+ format.blueShift = 0;
+ break;
+
+ case 18:
+ format.bitsPerPixel = 24;
+ format.depth = 18;
+ format.bigEndian = 0;
+ format.trueColor = true;
+ format.redBits = 6;
+ format.greenBits = 6;
+ format.blueBits = 6;
+ format.redShift = 12;
+ format.greenShift = 6;
+ format.blueShift = 0;
+ break;
+
+ case 16:
+ format.bitsPerPixel = 16;
+ format.depth = 16;
+ format.bigEndian = 0;
+ format.trueColor = true;
+ format.redBits = 5;
+ format.greenBits = 6;
+ format.blueBits = 5;
+ format.redShift = 11;
+ format.greenShift = 5;
+ format.blueShift = 0;
+ break;
+
+ case 15:
+ format.bitsPerPixel = 16;
+ format.depth = 15;
+ format.bigEndian = 0;
+ format.trueColor = true;
+ format.redBits = 5;
+ format.greenBits = 5;
+ format.blueBits = 5;
+ format.redShift = 10;
+ format.greenShift = 5;
+ format.blueShift = 0;
+ break;
+
+ case 12:
+ format.bitsPerPixel = 16;
+ format.depth = 12;
+ format.bigEndian = 0;
+ format.trueColor = true;
+ format.redBits = 4;
+ format.greenBits = 4;
+ format.blueBits = 4;
+ format.redShift = 8;
+ format.greenShift = 4;
+ format.blueShift = 0;
+ break;
+
+ case 8:
+ case 4:
+ format.bitsPerPixel = 8;
+ format.depth = 8;
+ format.bigEndian = 0;
+ format.trueColor = false;
+ format.redBits = 0;
+ format.greenBits = 0;
+ format.blueBits = 0;
+ format.redShift = 0;
+ format.greenShift = 0;
+ format.blueShift = 0;
+ break;
+
+ default:
+ qWarning("QVNC cannot drive depth %d", m_server->screen()->depth());
+ discardClient();
+ return;
+ }
+ sim.width = m_server->screen()->geometry().width();
+ sim.height = m_server->screen()->geometry().height();
+ sim.setName("Qt for Embedded Linux VNC Server");
+ sim.write(m_clientSocket);
+ m_state = Connected;
+ }
+ break;
+
+ case Connected:
+ do {
+ if (!m_handleMsg) {
+ m_clientSocket->read((char *)&m_msgType, 1);
+ m_handleMsg = true;
+ }
+ if (m_handleMsg) {
+ switch (m_msgType ) {
+ case SetPixelFormat:
+ setPixelFormat();
+ break;
+ case FixColourMapEntries:
+ qWarning("Not supported: FixColourMapEntries");
+ m_handleMsg = false;
+ break;
+ case SetEncodings:
+ setEncodings();
+ break;
+ case FramebufferUpdateRequest:
+ frameBufferUpdateRequest();
+ break;
+ case KeyEvent:
+ keyEvent();
+ break;
+ case PointerEvent:
+ pointerEvent();
+ break;
+ case ClientCutText:
+ clientCutText();
+ break;
+ default:
+ qWarning("Unknown message type: %d", (int)m_msgType);
+ m_handleMsg = false;
+ }
+ }
+ } while (!m_handleMsg && m_clientSocket->bytesAvailable());
+ break;
+ default:
+ break;
+ }
+}
+
+void QVncClient::discardClient()
+{
+ m_state = Disconnected;
+ m_server->discardClient(this);
+}
+
+void QVncClient::checkUpdate()
+{
+ if (!m_wantUpdate)
+ return;
+
+ if (m_dirtyCursor) {
+ m_server->screen()->clientCursor->write(this);
+ m_dirtyCursor = false;
+ m_wantUpdate = false;
+ return;
+ }
+
+ if (!m_dirtyRegion.isEmpty()) {
+ if (m_encoder)
+ m_encoder->write();
+ m_wantUpdate = false;
+ m_dirtyRegion = QRegion();
+ }
+}
+
+void QVncClient::scheduleUpdate()
+{
+ if (!m_updatePending) {
+ m_updatePending = true;
+ QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
+ }
+}
+
+bool QVncClient::event(QEvent *event)
+{
+ if (event->type() == QEvent::UpdateRequest) {
+ m_updatePending = false;
+ checkUpdate();
+ return true;
+ }
+ return QObject::event(event);
+}
+
+void QVncClient::setPixelFormat()
+{
+ if (m_clientSocket->bytesAvailable() >= 19) {
+ char buf[3];
+ m_clientSocket->read(buf, 3); // just padding
+ m_pixelFormat.read(m_clientSocket);
+ qCDebug(lcVnc, "Want format: %d %d %d %d %d %d %d %d %d %d",
+ int(m_pixelFormat.bitsPerPixel),
+ int(m_pixelFormat.depth),
+ int(m_pixelFormat.bigEndian),
+ int(m_pixelFormat.trueColor),
+ int(m_pixelFormat.redBits),
+ int(m_pixelFormat.greenBits),
+ int(m_pixelFormat.blueBits),
+ int(m_pixelFormat.redShift),
+ int(m_pixelFormat.greenShift),
+ int(m_pixelFormat.blueShift));
+ if (!m_pixelFormat.trueColor) {
+ qWarning("Can only handle true color clients");
+ discardClient();
+ }
+ m_handleMsg = false;
+ m_sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!m_pixelFormat.bigEndian;
+ m_needConversion = pixelConversionNeeded();
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ m_swapBytes = qvnc_screen->swapBytes();
+#endif
+ }
+}
+
+void QVncClient::setEncodings()
+{
+ QRfbSetEncodings enc;
+
+ if (!m_encodingsPending && enc.read(m_clientSocket)) {
+ m_encodingsPending = enc.count;
+ if (!m_encodingsPending)
+ m_handleMsg = false;
+ }
+
+ if (m_encoder) {
+ delete m_encoder;
+ m_encoder = nullptr;
+ }
+
+ enum Encodings {
+ Raw = 0,
+ CopyRect = 1,
+ RRE = 2,
+ CoRRE = 4,
+ Hextile = 5,
+ ZRLE = 16,
+ Cursor = -239,
+ DesktopSize = -223
+ };
+
+ if (m_encodingsPending && (unsigned)m_clientSocket->bytesAvailable() >=
+ m_encodingsPending * sizeof(quint32)) {
+ for (int i = 0; i < m_encodingsPending; ++i) {
+ qint32 enc;
+ m_clientSocket->read((char *)&enc, sizeof(qint32));
+ enc = ntohl(enc);
+ qCDebug(lcVnc, "QVncServer::setEncodings: %d", enc);
+ switch (enc) {
+ case Raw:
+ if (!m_encoder) {
+ m_encoder = new QRfbRawEncoder(this);
+ qCDebug(lcVnc, "QVncServer::setEncodings: using raw");
+ }
+ break;
+ case CopyRect:
+ m_supportCopyRect = true;
+ break;
+ case RRE:
+ m_supportRRE = true;
+ break;
+ case CoRRE:
+ m_supportCoRRE = true;
+ break;
+ case Hextile:
+ m_supportHextile = true;
+ if (m_encoder)
+ break;
+ break;
+ case ZRLE:
+ m_supportZRLE = true;
+ break;
+ case Cursor:
+ m_supportCursor = true;
+ m_server->screen()->enableClientCursor(this);
+ break;
+ case DesktopSize:
+ m_supportDesktopSize = true;
+ break;
+ default:
+ break;
+ }
+ }
+ m_handleMsg = false;
+ m_encodingsPending = 0;
+ }
+
+ if (!m_encoder) {
+ m_encoder = new QRfbRawEncoder(this);
+ qCDebug(lcVnc, "QVncServer::setEncodings: fallback using raw");
+ }
+}
+
+void QVncClient::frameBufferUpdateRequest()
+{
+ qCDebug(lcVnc) << "FramebufferUpdateRequest";
+ QRfbFrameBufferUpdateRequest ev;
+
+ if (ev.read(m_clientSocket)) {
+ if (!ev.incremental) {
+ QRect r(ev.rect.x, ev.rect.y, ev.rect.w, ev.rect.h);
+ r.translate(m_server->screen()->geometry().topLeft());
+ setDirty(r);
+ }
+ m_wantUpdate = true;
+ checkUpdate();
+ m_handleMsg = false;
+ }
+}
+
+void QVncClient::pointerEvent()
+{
+ QRfbPointerEvent ev;
+ if (ev.read(m_clientSocket)) {
+ const QPoint pos = m_server->screen()->geometry().topLeft() + QPoint(ev.x, ev.y);
+ QWindowSystemInterface::handleMouseEvent(0, pos, pos, ev.buttons, QGuiApplication::keyboardModifiers());
+ m_handleMsg = false;
+ }
+}
+
+void QVncClient::keyEvent()
+{
+ QRfbKeyEvent ev;
+
+ if (ev.read(m_clientSocket)) {
+ if (ev.keycode == Qt::Key_Shift)
+ m_keymod = ev.down ? m_keymod | Qt::ShiftModifier :
+ m_keymod & ~Qt::ShiftModifier;
+ else if (ev.keycode == Qt::Key_Control)
+ m_keymod = ev.down ? m_keymod | Qt::ControlModifier :
+ m_keymod & ~Qt::ControlModifier;
+ else if (ev.keycode == Qt::Key_Alt)
+ m_keymod = ev.down ? m_keymod | Qt::AltModifier :
+ m_keymod & ~Qt::AltModifier;
+ if (ev.unicode || ev.keycode)
+ QWindowSystemInterface::handleKeyEvent(0, ev.down ? QEvent::KeyPress : QEvent::KeyRelease, ev.keycode, m_keymod, QString(ev.unicode));
+ m_handleMsg = false;
+ }
+}
+
+void QVncClient::clientCutText()
+{
+ QRfbClientCutText ev;
+
+ if (m_cutTextPending == 0 && ev.read(m_clientSocket)) {
+ m_cutTextPending = ev.length;
+ if (!m_cutTextPending)
+ m_handleMsg = false;
+ }
+
+ if (m_cutTextPending && m_clientSocket->bytesAvailable() >= m_cutTextPending) {
+ char *text = new char [m_cutTextPending+1];
+ m_clientSocket->read(text, m_cutTextPending);
+ delete [] text;
+ m_cutTextPending = 0;
+ m_handleMsg = false;
+ }
+}
+
+bool QVncClient::pixelConversionNeeded() const
+{
+ if (!m_sameEndian)
+ return true;
+
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ if (qvnc_screen->swapBytes())
+ return true;
+#endif
+
+ const int screendepth = m_server->screen()->depth();
+ if (screendepth != m_pixelFormat.bitsPerPixel)
+ return true;
+
+ switch (screendepth) {
+ case 32:
+ case 24:
+ return false;
+ case 16:
+ return (m_pixelFormat.redBits == 5
+ && m_pixelFormat.greenBits == 6
+ && m_pixelFormat.blueBits == 5);
+ }
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/vnc/qvncclient.h b/src/plugins/platforms/vnc/qvncclient.h
new file mode 100644
index 0000000000..a7a6b6b361
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvncclient.h
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVNCCLIENT_H
+#define QVNCCLIENT_H
+
+#include <QObject>
+
+#include "qvnc_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QTcpSocket;
+class QVncServer;
+
+class QVncClient : public QObject
+{
+ Q_OBJECT
+public:
+ enum ClientMsg {
+ SetPixelFormat = 0,
+ FixColourMapEntries = 1,
+ SetEncodings = 2,
+ FramebufferUpdateRequest = 3,
+ KeyEvent = 4,
+ PointerEvent = 5,
+ ClientCutText = 6
+ };
+
+ explicit QVncClient(QTcpSocket *clientSocket, QVncServer *server);
+ ~QVncClient();
+ QTcpSocket *clientSocket() const;
+ QVncServer *server() const { return m_server; }
+
+ void setDirty(const QRegion &region);
+ void setDirtyCursor() { m_dirtyCursor = true; scheduleUpdate(); }
+ QRegion dirtyRegion() const { return m_dirtyRegion; }
+ inline bool isConnected() const { return m_state == Connected; }
+
+ inline int clientBytesPerPixel() const {
+ return m_pixelFormat.bitsPerPixel / 8;
+ }
+
+ void convertPixels(char *dst, const char *src, int count) const;
+ inline bool doPixelConversion() const { return m_needConversion; }
+
+signals:
+
+private slots:
+ void readClient();
+ void discardClient();
+ void checkUpdate();
+ void scheduleUpdate();
+
+protected:
+ bool event(QEvent *event) override;
+
+private:
+ enum ClientState {
+ Disconnected,
+ Protocol,
+ Authentication,
+ Init,
+ Connected
+ };
+ enum ProtocolVersion {
+ V3_3,
+ V3_7,
+ V3_8
+ };
+
+ void setPixelFormat();
+ void setEncodings();
+ void frameBufferUpdateRequest();
+ void pointerEvent();
+ void keyEvent();
+ void clientCutText();
+ bool pixelConversionNeeded() const;
+
+ QVncServer *m_server;
+ QTcpSocket *m_clientSocket;
+ QRfbEncoder *m_encoder;
+
+ // Client State
+ ClientState m_state;
+ quint8 m_msgType;
+ bool m_handleMsg;
+ QRfbPixelFormat m_pixelFormat;
+ bool m_sameEndian;
+ bool m_needConversion;
+ int m_encodingsPending;
+ int m_cutTextPending;
+ uint m_supportCopyRect : 1;
+ uint m_supportRRE : 1;
+ uint m_supportCoRRE : 1;
+ uint m_supportHextile : 1;
+ uint m_supportZRLE : 1;
+ uint m_supportCursor : 1;
+ uint m_supportDesktopSize : 1;
+ bool m_wantUpdate;
+ Qt::KeyboardModifiers m_keymod;
+ bool m_dirtyCursor;
+ bool m_updatePending;
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ bool m_swapBytes;
+#endif
+ QRegion m_dirtyRegion;
+ ProtocolVersion m_protocolVersion;
+};
+
+QT_END_NAMESPACE
+
+#endif // QVNCCLIENT_H
diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp
new file mode 100644
index 0000000000..3227478ebe
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvncintegration.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the FOO module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvncintegration.h"
+#include "qvncscreen.h"
+#include "qvnc_p.h"
+
+#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
+#include <QtPlatformSupport/private/qgenericunixservices_p.h>
+#include <QtPlatformSupport/private/qgenericunixeventdispatcher_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/qplatforminputcontextfactory_p.h>
+#include <private/qinputdevicemanager_p_p.h>
+#if QT_CONFIG(libinput)
+#include <QtPlatformSupport/private/qlibinputhandler_p.h>
+#endif
+
+#include <QtCore/QRegularExpression>
+
+QT_BEGIN_NAMESPACE
+
+QVncIntegration::QVncIntegration(const QStringList &paramList)
+ : m_fontDb(new QGenericUnixFontDatabase),
+ m_services(new QGenericUnixServices)
+{
+ QRegularExpression portRx(QLatin1String("port=(\\d+)"));
+ quint16 port = 5900;
+ for (const QString &arg : paramList) {
+ QRegularExpressionMatch match;
+ if (arg.contains(portRx, &match))
+ port = match.captured(1).toInt();
+ }
+
+ m_primaryScreen = new QVncScreen(paramList);
+ m_server = new QVncServer(m_primaryScreen, port);
+ m_primaryScreen->vncServer = m_server;
+}
+
+QVncIntegration::~QVncIntegration()
+{
+ delete m_server;
+ destroyScreen(m_primaryScreen);
+}
+
+void QVncIntegration::initialize()
+{
+ if (m_primaryScreen->initialize())
+ screenAdded(m_primaryScreen);
+ else
+ qWarning("vnc: Failed to initialize screen");
+
+ m_inputContext = QPlatformInputContextFactory::create();
+
+ m_nativeInterface.reset(new QPlatformNativeInterface);
+
+ // we always have exactly one mouse and keyboard
+ QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
+ QInputDeviceManager::DeviceTypePointer, 1);
+ QInputDeviceManagerPrivate::get(QGuiApplicationPrivate::inputDeviceManager())->setDeviceCount(
+ QInputDeviceManager::DeviceTypeKeyboard, 1);
+
+}
+
+bool QVncIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ case WindowManagement: return false;
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
+QPlatformBackingStore *QVncIntegration::createPlatformBackingStore(QWindow *window) const
+{
+ return new QFbBackingStore(window);
+}
+
+QPlatformWindow *QVncIntegration::createPlatformWindow(QWindow *window) const
+{
+ return new QFbWindow(window);
+}
+
+QAbstractEventDispatcher *QVncIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
+QList<QPlatformScreen *> QVncIntegration::screens() const
+{
+ QList<QPlatformScreen *> list;
+ list.append(m_primaryScreen);
+ return list;
+}
+
+QPlatformFontDatabase *QVncIntegration::fontDatabase() const
+{
+ return m_fontDb.data();
+}
+
+QPlatformServices *QVncIntegration::services() const
+{
+ return m_services.data();
+}
+
+QPlatformNativeInterface *QVncIntegration::nativeInterface() const
+{
+ return m_nativeInterface.data();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h
new file mode 100644
index 0000000000..293ff54376
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvncintegration.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVNCINTEGRATION_H
+#define QVNCINTEGRATION_H
+
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformnativeinterface.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractEventDispatcher;
+class QVncScreen;
+class QVncServer;
+
+class QVncIntegration : public QPlatformIntegration, public QPlatformNativeInterface
+{
+public:
+ QVncIntegration(const QStringList &paramList);
+ ~QVncIntegration();
+
+ void initialize() Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+
+ QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+
+ QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+
+ QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
+ QPlatformServices *services() const Q_DECL_OVERRIDE;
+ QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; }
+
+ QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
+
+ QList<QPlatformScreen *> screens() const;
+
+private:
+ mutable QVncServer *m_server;
+ QVncScreen *m_primaryScreen;
+ QPlatformInputContext *m_inputContext;
+ QScopedPointer<QPlatformFontDatabase> m_fontDb;
+ QScopedPointer<QPlatformServices> m_services;
+ QScopedPointer<QPlatformNativeInterface> m_nativeInterface;
+};
+
+QT_END_NAMESPACE
+
+#endif // QVNCINTEGRATION_H
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
new file mode 100644
index 0000000000..6d117c62bf
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvncscreen.cpp
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvncscreen.h"
+#include "qvnc_p.h"
+#include <QtPlatformSupport/private/qfbwindow_p.h>
+#include <QtPlatformSupport/private/qfbcursor_p.h>
+
+#include <QtGui/QPainter>
+#include <QtCore/QRegularExpression>
+
+
+QT_BEGIN_NAMESPACE
+
+
+QVncScreen::QVncScreen(const QStringList &args)
+ : mArgs(args)
+{
+ initialize();
+}
+
+QVncScreen::~QVncScreen()
+{
+ if (clientCursor)
+ delete clientCursor;
+}
+
+bool QVncScreen::initialize()
+{
+ QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)"));
+ QRegularExpression mmSizeRx(QLatin1String("mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)"));
+ QRegularExpression depthRx(QLatin1String("depth=(\\d+)"));
+
+ mGeometry = QRect(0, 0, 1024, 768);
+ mFormat = QImage::Format_ARGB32_Premultiplied;
+ mDepth = 32;
+ mPhysicalSize = QSizeF(mGeometry.width()/96.*25.4, mGeometry.height()/96.*25.4);
+
+ for (const QString &arg : mArgs) {
+ QRegularExpressionMatch match;
+ if (arg.contains(mmSizeRx, &match)) {
+ mPhysicalSize = QSizeF(match.captured("width").toDouble(), match.captured("height").toDouble());
+ } else if (arg.contains(sizeRx, &match)) {
+ mGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt()));
+ } else if (arg.contains(depthRx, &match)) {
+ mDepth = match.captured(1).toInt();
+ }
+ }
+
+ QFbScreen::initializeCompositor();
+
+ switch (depth()) {
+ case 32:
+ dirty = new QVncDirtyMapOptimized<quint32>(this);
+ break;
+ case 16:
+ dirty = new QVncDirtyMapOptimized<quint16>(this);
+ break;
+ case 8:
+ dirty = new QVncDirtyMapOptimized<quint8>(this);
+ break;
+ default:
+ qWarning("QVNCScreen::initDevice: No support for screen depth %d",
+ depth());
+ dirty = 0;
+ return false;
+ }
+
+ setPowerState(PowerStateOff);
+
+ return true;
+}
+
+QRegion QVncScreen::doRedraw()
+{
+ QRegion touched = QFbScreen::doRedraw();
+
+ if (touched.isEmpty())
+ return touched;
+ dirtyRegion += touched;
+
+ vncServer->setDirty();
+ return touched;
+}
+
+void QVncScreen::enableClientCursor(QVncClient *client)
+{
+ delete mCursor;
+ mCursor = nullptr;
+ if (!clientCursor)
+ clientCursor = new QVncClientCursor();
+ clientCursor->addClient(client);
+}
+
+void QVncScreen::disableClientCursor(QVncClient *client)
+{
+ uint clientCount = clientCursor->removeClient(client);
+ if (clientCount == 0) {
+ delete clientCursor;
+ clientCursor = nullptr;
+ }
+
+ mCursor = new QFbCursor(this);
+}
+
+QPlatformCursor *QVncScreen::cursor() const
+{
+ return mCursor ? static_cast<QPlatformCursor *>(mCursor) : static_cast<QPlatformCursor *>(clientCursor);
+}
+
+// grabWindow() grabs "from the screen" not from the backingstores.
+// In linuxfb's case it will also include the mouse cursor.
+QPixmap QVncScreen::grabWindow(WId wid, int x, int y, int width, int height) const
+{
+ if (!wid) {
+ if (width < 0)
+ width = mScreenImage->width() - x;
+ if (height < 0)
+ height = mScreenImage->height() - y;
+ return QPixmap::fromImage(*mScreenImage).copy(x, y, width, height);
+ }
+
+ 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(*mScreenImage).copy(rect);
+ }
+
+ return QPixmap();
+}
+
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+bool QVNCScreen::swapBytes() const
+{
+ if (depth() != 16)
+ return false;
+
+ if (screen())
+ return screen()->frameBufferLittleEndian();
+ return frameBufferLittleEndian();
+}
+#endif
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/platforms/vnc/qvncscreen.h b/src/plugins/platforms/vnc/qvncscreen.h
new file mode 100644
index 0000000000..e3c6651781
--- /dev/null
+++ b/src/plugins/platforms/vnc/qvncscreen.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVncScreen_H
+#define QVncScreen_H
+
+#include <QtPlatformSupport/private/qfbscreen_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QPainter;
+class QFbCursor;
+class QTcpSocket;
+class QVncServer;
+class QVncDirtyMap;
+class QVncClientCursor;
+class QVncClient;
+
+class QVncScreen : public QFbScreen
+{
+ Q_OBJECT
+public:
+ QVncScreen(const QStringList &args);
+ ~QVncScreen();
+
+ bool initialize();
+
+ QPixmap grabWindow(WId wid, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
+
+ QRegion doRedraw() Q_DECL_OVERRIDE;
+ QImage *image() const { return mScreenImage; }
+
+ void enableClientCursor(QVncClient *client);
+ void disableClientCursor(QVncClient *client);
+ QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
+
+ void clearDirty() { dirtyRegion = QRegion(); }
+
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ bool swapBytes() const
+#endif
+
+ QStringList mArgs;
+
+ qreal dpiX = 96;
+ qreal dpiY = 96;
+ QVncDirtyMap *dirty = 0;
+ QRegion dirtyRegion;
+ int refreshRate = 30;
+ QVncServer *vncServer = 0;
+ QVncClientCursor *clientCursor = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QVncScreen_H
+
diff --git a/src/plugins/platforms/vnc/vnc.json b/src/plugins/platforms/vnc/vnc.json
new file mode 100644
index 0000000000..6a16b08ca8
--- /dev/null
+++ b/src/plugins/platforms/vnc/vnc.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "vnc" ]
+}
diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro
new file mode 100644
index 0000000000..1817e15201
--- /dev/null
+++ b/src/plugins/platforms/vnc/vnc.pro
@@ -0,0 +1,27 @@
+TARGET = qvnc
+
+PLUGIN_TYPE = platforms
+PLUGIN_CLASS_NAME = QVncIntegrationPlugin
+!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
+load(qt_plugin)
+
+QT += core-private gui-private platformsupport-private network
+
+DEFINES += QT_NO_FOREACH
+
+SOURCES = \
+ main.cpp \
+ qvncintegration.cpp \
+ qvncscreen.cpp \
+ qvnc.cpp \
+ qvncclient.cpp
+
+HEADERS = \
+ qvncintegration.h \
+ qvncscreen.h \
+ qvnc_p.h \
+ qvncclient.h
+
+CONFIG += qpa/genericunixfontdatabase
+
+OTHER_FILES += vnc.json
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 1dbac78fca..d4cdf3ef3c 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -52,7 +52,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
@@ -77,9 +77,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <windowsx.h>
-#ifndef Q_OS_WINCE
-# include <comdef.h>
-#endif
+#include <comdef.h>
QT_BEGIN_NAMESPACE
@@ -100,45 +98,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));
@@ -161,13 +143,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),
@@ -178,20 +155,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");
}
@@ -209,38 +177,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)
@@ -259,11 +195,8 @@ void QWindowsShcoreDLL::init()
}
QWindowsUser32DLL QWindowsContext::user32dll;
-QWindowsShell32DLL QWindowsContext::shell32dll;
QWindowsShcoreDLL QWindowsContext::shcoredll;
-#endif // !Q_OS_WINCE
-
QWindowsContext *QWindowsContext::m_instance = 0;
/*!
@@ -292,7 +225,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;
@@ -307,18 +240,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);
}
@@ -339,7 +268,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
@@ -347,7 +276,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();
@@ -372,12 +301,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);
@@ -390,7 +317,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
@@ -400,19 +327,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);
@@ -429,9 +353,6 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA
qErrnoWarning("SetProcessDPIAware() failed");
}
}
-#else // !Q_OS_WINCE
- Q_UNUSED(dpiAwareness)
-#endif
}
QWindowsContext *QWindowsContext::instance()
@@ -563,19 +484,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));
@@ -591,22 +507,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));
@@ -724,28 +628,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
@@ -761,7 +651,6 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c
return true;
}
}
-#endif // !Q_OS_WINCE
*hwnd = child;
return true;
}
@@ -788,7 +677,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;
@@ -814,7 +703,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).
@@ -833,7 +721,6 @@ static inline QString errorMessageFromComError(const _com_error &comError)
return QString::asprintf("IDispatch error #%u", uint(wCode));
return QString::asprintf("Unknown error 0x0%x", uint(comError.Error()));
}
-#endif // !Q_OS_WINCE
/*!
\brief Common COM error strings.
@@ -901,12 +788,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;
}
@@ -942,9 +827,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.
@@ -987,7 +870,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);
@@ -1028,11 +911,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;
@@ -1064,13 +945,14 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
switch (et) {
case QtWindows::KeyboardLayoutChangeEvent:
if (QWindowsInputContext *wic = windowsInputContext())
- wic->handleInputLanguageChanged(wParam, lParam); // fallthrough intended.
+ wic->handleInputLanguageChanged(wParam, lParam);
+ Q_FALLTHROUGH();
case QtWindows::KeyDownEvent:
case QtWindows::KeyEvent:
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);
@@ -1081,7 +963,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
@@ -1091,30 +972,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);
@@ -1122,13 +991,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);
@@ -1161,7 +1030,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);
@@ -1184,7 +1052,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return true;
}
break;
-#endif
#ifndef QT_NO_CONTEXTMENU
case QtWindows::ContextMenu:
return handleContextMenuEvent(platformWindow->window(), msg);
@@ -1195,7 +1062,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
@@ -1235,7 +1102,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 817728dca2..8f1358de6c 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;
}
@@ -1051,13 +751,11 @@ void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory)
QString QWindowsNativeFileDialogBase::directory() const
{
QString result;
-#ifndef Q_OS_WINCE
IShellItem *item = 0;
if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item) {
result = QWindowsNativeFileDialogBase::itemPath(item);
item->Release();
}
-#endif
return result;
}
@@ -1109,7 +807,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.
@@ -1162,7 +860,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *i
return result;
}
-#else // !Q_OS_WINCE && __IShellLibrary_INTERFACE_DEFINED__
+#else // __IShellLibrary_INTERFACE_DEFINED__
QList<QUrl> QWindowsNativeFileDialogBase::libraryItemFolders(IShellItem *)
{
@@ -1174,7 +872,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *)
return QString();
}
-#endif // Q_OS_WINCE || !__IShellLibrary_INTERFACE_DEFINED__
+#endif // !__IShellLibrary_INTERFACE_DEFINED__
QString QWindowsNativeFileDialogBase::itemPath(IShellItem *item)
{
@@ -1420,14 +1118,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)
@@ -1730,8 +1426,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.
@@ -2055,8 +1749,6 @@ QString QWindowsXpFileDialogHelper::selectedNameFilter() const
return m_data.selectedNameFilter();
}
-#endif // Q_OS_WINCE
-
/*!
\class QWindowsNativeColorDialog
\brief Native Windows color dialog.
@@ -2184,7 +1876,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) {
@@ -2203,28 +1894,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();
@@ -2238,9 +1921,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 4261c01ac8..a4738dc100 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 bc237bc88c..4f022141cf 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -43,7 +43,7 @@
#include "qwindowsintegration.h"
#include "qwindowsfontengine.h"
#include "qwindowsfontenginedirectwrite.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtGui/QFont>
#include <QtGui/QGuiApplication>
@@ -58,10 +58,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>
@@ -759,116 +755,170 @@ static inline quint16 getUShort(const unsigned char *p)
return val;
}
-static QString getEnglishName(const uchar *table, quint32 bytes)
+namespace {
+
+struct FontNames {
+ QString name; // e.g. "DejaVu Sans Condensed"
+ QString style; // e.g. "Italic"
+ QString preferredName; // e.g. "DejaVu Sans"
+ QString preferredStyle; // e.g. "Condensed Italic"
+};
+
+static QString readName(bool unicode, const uchar *string, int length)
{
- QString i18n_name;
- enum {
- NameRecordSize = 12,
- FamilyId = 1,
- MS_LangIdEnglish = 0x009
- };
+ QString out;
+ if (unicode) {
+ // utf16
+
+ length /= 2;
+ out.resize(length);
+ QChar *uc = out.data();
+ for (int i = 0; i < length; ++i)
+ uc[i] = getUShort(string + 2*i);
+ } else {
+ // Apple Roman
+
+ out.resize(length);
+ QChar *uc = out.data();
+ for (int i = 0; i < length; ++i)
+ uc[i] = QLatin1Char(char(string[i]));
+ }
+ return out;
+}
+
+enum FieldTypeValue {
+ FamilyId = 1,
+ StyleId = 2,
+ PreferredFamilyId = 16,
+ PreferredStyleId = 17,
+};
+
+enum PlatformFieldValue {
+ PlatformId_Unicode = 0,
+ PlatformId_Apple = 1,
+ PlatformId_Microsoft = 3
+};
+
+static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes)
+{
+ FontNames out;
+ const int NameRecordSize = 12;
+ const int MS_LangIdEnglish = 0x009;
// get the name table
quint16 count;
quint16 string_offset;
const unsigned char *names;
- int microsoft_id = -1;
- int apple_id = -1;
- int unicode_id = -1;
+ if (bytes < 8)
+ return out;
if (getUShort(table) != 0)
- goto error;
+ return out;
count = getUShort(table+2);
string_offset = getUShort(table+4);
names = table + 6;
if (string_offset >= bytes || 6 + count*NameRecordSize > string_offset)
- goto error;
+ return out;
+
+ enum PlatformIdType {
+ NotFound = 0,
+ Unicode = 1,
+ Apple = 2,
+ Microsoft = 3
+ };
+
+ PlatformIdType idStatus[4] = { NotFound, NotFound, NotFound, NotFound };
+ int ids[4] = { -1, -1, -1, -1 };
for (int i = 0; i < count; ++i) {
- // search for the correct name entry
+ // search for the correct name entries
quint16 platform_id = getUShort(names + i*NameRecordSize);
quint16 encoding_id = getUShort(names + 2 + i*NameRecordSize);
quint16 language_id = getUShort(names + 4 + i*NameRecordSize);
quint16 name_id = getUShort(names + 6 + i*NameRecordSize);
- if (name_id != FamilyId)
- continue;
+ PlatformIdType *idType = nullptr;
+ int *id = nullptr;
- enum {
- PlatformId_Unicode = 0,
- PlatformId_Apple = 1,
- PlatformId_Microsoft = 3
- };
+ switch (name_id) {
+ case FamilyId:
+ idType = &idStatus[0];
+ id = &ids[0];
+ break;
+ case StyleId:
+ idType = &idStatus[1];
+ id = &ids[1];
+ break;
+ case PreferredFamilyId:
+ idType = &idStatus[2];
+ id = &ids[2];
+ break;
+ case PreferredStyleId:
+ idType = &idStatus[3];
+ id = &ids[3];
+ break;
+ default:
+ continue;
+ }
quint16 length = getUShort(names + 8 + i*NameRecordSize);
quint16 offset = getUShort(names + 10 + i*NameRecordSize);
- if (DWORD(string_offset + offset + length) >= bytes)
+ if (DWORD(string_offset + offset + length) > bytes)
continue;
if ((platform_id == PlatformId_Microsoft
&& (encoding_id == 0 || encoding_id == 1))
&& (language_id & 0x3ff) == MS_LangIdEnglish
- && microsoft_id == -1)
- microsoft_id = i;
+ && *idType < Microsoft) {
+ *id = i;
+ *idType = Microsoft;
+ }
// not sure if encoding id 4 for Unicode is utf16 or ucs4...
- else if (platform_id == PlatformId_Unicode && encoding_id < 4 && unicode_id == -1)
- unicode_id = i;
- else if (platform_id == PlatformId_Apple && encoding_id == 0 && language_id == 0)
- apple_id = i;
- }
- {
- bool unicode = false;
- int id = -1;
- if (microsoft_id != -1) {
- id = microsoft_id;
- unicode = true;
- } else if (apple_id != -1) {
- id = apple_id;
- unicode = false;
- } else if (unicode_id != -1) {
- id = unicode_id;
- unicode = true;
+ else if (platform_id == PlatformId_Unicode && encoding_id < 4 && *idType < Unicode) {
+ *id = i;
+ *idType = Unicode;
}
- if (id != -1) {
- quint16 length = getUShort(names + 8 + id*NameRecordSize);
- quint16 offset = getUShort(names + 10 + id*NameRecordSize);
- if (unicode) {
- // utf16
-
- length /= 2;
- i18n_name.resize(length);
- QChar *uc = const_cast<QChar *>(i18n_name.unicode());
- const unsigned char *string = table + string_offset + offset;
- for (int i = 0; i < length; ++i)
- uc[i] = getUShort(string + 2*i);
- } else {
- // Apple Roman
-
- i18n_name.resize(length);
- QChar *uc = const_cast<QChar *>(i18n_name.unicode());
- const unsigned char *string = table + string_offset + offset;
- for (int i = 0; i < length; ++i)
- uc[i] = QLatin1Char(char(string[i]));
- }
+ else if (platform_id == PlatformId_Apple && encoding_id == 0 && language_id == 0 && *idType < Apple) {
+ *id = i;
+ *idType = Apple;
}
}
-error:
- //qDebug("got i18n name of '%s' for font '%s'", i18n_name.latin1(), familyName.toLocal8Bit().data());
- return i18n_name;
+
+ QString strings[4];
+ for (int i = 0; i < 4; ++i) {
+ if (idStatus[i] == NotFound)
+ continue;
+ int id = ids[i];
+ quint16 length = getUShort(names + 8 + id * NameRecordSize);
+ quint16 offset = getUShort(names + 10 + id * NameRecordSize);
+ const unsigned char *string = table + string_offset + offset;
+ strings[i] = readName(idStatus[i] != Apple, string, length);
+ }
+
+ out.name = strings[0];
+ out.style = strings[1];
+ out.preferredName = strings[2];
+ out.preferredStyle = strings[3];
+ return out;
}
-QString getEnglishName(const QString &familyName)
+} // namespace
+
+QString getEnglishName(const QString &familyName, bool includeStyle = false)
{
QString i18n_name;
+ QString faceName = familyName;
+ faceName.truncate(LF_FACESIZE - 1);
HDC hdc = GetDC( 0 );
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
- memcpy(lf.lfFaceName, familyName.utf16(), qMin(familyName.length(), LF_FACESIZE - 1) * sizeof(wchar_t));
+ faceName.toWCharArray(lf.lfFaceName);
+ lf.lfFaceName[faceName.size()] = 0;
lf.lfCharSet = DEFAULT_CHARSET;
HFONT hfont = CreateFontIndirect(&lf);
@@ -896,7 +946,12 @@ QString getEnglishName(const QString &familyName)
if ( bytes == GDI_ERROR )
goto error;
- i18n_name = getEnglishName(table, bytes);
+ {
+ const FontNames names = getCanonicalFontNames(table, bytes);
+ i18n_name = names.name;
+ if (includeStyle)
+ i18n_name += QLatin1Char(' ') + names.style;
+ }
error:
delete [] table;
SelectObject( hdc, oldobj );
@@ -907,7 +962,7 @@ error:
return i18n_name;
}
-static bool addFontToDatabase(const QString &familyName, uchar charSet,
+static bool addFontToDatabase(const QString &familyName, const QString &styleName, uchar charSet,
const TEXTMETRIC *textmetric,
const FONTSIGNATURE *signature,
int type,
@@ -960,17 +1015,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.
@@ -986,16 +1030,16 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
writingSystems.setSupported(ws);
}
- QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
+ QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight,
style, stretch, antialias, scalable, size, fixed, writingSystems, 0);
// add fonts windows can generate for us:
- if (weight <= QFont::DemiBold)
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
style, stretch, antialias, scalable, size, fixed, writingSystems, 0);
- if (style != QFont::StyleItalic)
+ if (style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, weight,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0);
- if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(familyName, QString(), foundryName, QFont::Bold,
QFont::StyleItalic, stretch, antialias, scalable, size, fixed, writingSystems, 0);
@@ -1010,6 +1054,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
{
const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
+ const QString styleName = QString::fromWCharArray(f->elfStyle);
const uchar charSet = f->elfLogFont.lfCharSet;
const bool registerAlias = bool(lParam);
@@ -1019,7 +1064,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
const FONTSIGNATURE *signature = Q_NULLPTR;
if (type & TRUETYPE_FONTTYPE)
signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
- addFontToDatabase(familyName, charSet, textmetric, signature, type, registerAlias);
+ addFontToDatabase(familyName, styleName, charSet, textmetric, signature, type, registerAlias);
// keep on enumerating
return 1;
@@ -1130,9 +1175,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)
@@ -1146,9 +1190,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()
@@ -1215,6 +1257,7 @@ QT_WARNING_POP
request.pixelSize = pixelSize;
request.styleStrategy = QFont::PreferMatch;
request.hintingPreference = hintingPreference;
+ request.stretch = QFont::Unstretched;
fontEngine = QWindowsFontDatabase::createEngine(request,
QWindowsContext::instance()->defaultDPI(),
@@ -1379,7 +1422,7 @@ static void getFontTable(const uchar *fileBegin, const uchar *data, quint32 tag,
}
static void getFamiliesAndSignatures(const QByteArray &fontData,
- QStringList *families,
+ QList<FontNames> *families,
QVector<FONTSIGNATURE> *signatures)
{
const uchar *data = reinterpret_cast<const uchar *>(fontData.constData());
@@ -1395,11 +1438,11 @@ static void getFamiliesAndSignatures(const QByteArray &fontData,
getFontTable(data, font, MAKE_TAG('n', 'a', 'm', 'e'), &table, &length);
if (!table)
continue;
- QString name = getEnglishName(table, length);
- if (name.isEmpty())
+ FontNames names = getCanonicalFontNames(table, length);
+ if (names.name.isEmpty())
continue;
- families->append(name);
+ families->append(qMove(names));
if (signatures) {
FONTSIGNATURE signature;
@@ -1426,12 +1469,13 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
WinApplicationFont font;
font.fileName = fileName;
QVector<FONTSIGNATURE> signatures;
- QStringList families;
+ QList<FontNames> families;
+ QStringList familyNames;
if (!fontData.isEmpty()) {
getFamiliesAndSignatures(fontData, &families, &signatures);
if (families.isEmpty())
- return families;
+ return familyNames;
DWORD dummy = 0;
font.handle =
@@ -1442,7 +1486,9 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
// Memory fonts won't show up in enumeration, so do add them the hard way.
for (int j = 0; j < families.count(); ++j) {
- const QString familyName = families.at(j);
+ const QString familyName = families.at(j).name;
+ const QString styleName = families.at(j).style;
+ familyNames << familyName;
HDC hdc = GetDC(0);
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
@@ -1454,7 +1500,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
TEXTMETRIC textMetrics;
GetTextMetrics(hdc, &textMetrics);
- addFontToDatabase(familyName, lf.lfCharSet, &textMetrics, &signatures.at(j),
+ addFontToDatabase(familyName, styleName, lf.lfCharSet, &textMetrics, &signatures.at(j),
TRUETYPE_FONTTYPE, true);
SelectObject(hdc, oldobj);
@@ -1464,13 +1510,13 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
} else {
QFile f(fileName);
if (!f.open(QIODevice::ReadOnly))
- return families;
+ return QStringList();
QByteArray data = f.readAll();
f.close();
getFamiliesAndSignatures(data, &families, 0);
if (families.isEmpty())
- return families;
+ return QStringList();
if (AddFontResourceExW((wchar_t*)fileName.utf16(), FR_PRIVATE, 0) == 0)
return QStringList();
@@ -1478,13 +1524,16 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
font.handle = 0;
// Fonts based on files are added via populate, as they will show up in font enumeration.
- for (int j = 0; j < families.count(); ++j)
- populateFamily(families.at(j), true);
+ for (int j = 0; j < families.count(); ++j) {
+ const QString familyName = families.at(j).name;
+ familyNames << familyName;
+ populateFamily(familyName, true);
+ }
}
m_applicationFonts << font;
- return families;
+ return familyNames;
}
void QWindowsFontDatabase::removeApplicationFonts()
@@ -1610,14 +1659,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;
@@ -1626,10 +1673,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..f7c8dbdf23 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
@@ -106,9 +102,7 @@ static FontFile * createFontFile(const QString &fileName, int index)
}
extern bool localizedName(const QString &name);
-extern QString getEnglishName(const QString &familyName);
-
-#ifndef Q_OS_WINCE
+extern QString getEnglishName(const QString &familyName, bool includeStyle = false);
namespace {
struct FontKey
@@ -128,7 +122,11 @@ static FontKeys &fontKeys()
QSettings::NativeFormat);
const QStringList allKeys = fontRegistry.allKeys();
const QString trueType = QStringLiteral("(TrueType)");
+#ifndef QT_NO_REGULAREXPRESSION
const QRegularExpression sizeListMatch(QStringLiteral("\\s(\\d+,)+\\d+"));
+#else
+ const QRegExp sizeListMatch(QLatin1String("\\s(\\d+,)+\\d+"));
+#endif
Q_ASSERT(sizeListMatch.isValid());
const int size = allKeys.size();
result.reserve(size);
@@ -165,224 +163,8 @@ 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 &styleName,
const QString &fullName,
uchar charSet,
const TEXTMETRIC *textmetric,
@@ -453,10 +235,19 @@ static bool addFontToDatabase(const QString &faceName,
}
int index = 0;
-#ifndef Q_OS_WINCE
- const FontKey *key = findFontKey(faceName, &index);
+ const FontKey *key = findFontKey(fullName, &index);
if (!key) {
- key = findFontKey(fullName, &index);
+ // On non-English locales, the styles of the font may be localized in enumeration, but
+ // not in the registry.
+ QLocale systemLocale = QLocale::system();
+ if (systemLocale.language() != QLocale::C
+ && systemLocale.language() != QLocale::English
+ && styleName != QLatin1String("Italic")
+ && styleName != QLatin1String("Bold")) {
+ key = findFontKey(getEnglishName(fullName, true), &index);
+ }
+ if (!key)
+ key = findFontKey(faceName, &index);
if (!key && !registerAlias && englishName.isEmpty() && localizedName(faceName))
englishName = getEnglishName(faceName);
if (!key && !englishName.isEmpty())
@@ -465,33 +256,25 @@ 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,
+ QPlatformFontDatabase::registerFont(faceName, styleName, foundryName, weight, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
// add fonts windows can generate for us:
- if (weight <= QFont::DemiBold)
+ if (weight <= QFont::DemiBold && styleName.isEmpty())
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
- if (style != QFont::StyleItalic)
+ if (style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
- if (weight <= QFont::DemiBold && style != QFont::StyleItalic)
+ if (weight <= QFont::DemiBold && style != QFont::StyleItalic && styleName.isEmpty())
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, QFont::Bold, QFont::StyleItalic, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
@@ -501,29 +284,12 @@ 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)
{
const ENUMLOGFONTEX *f = reinterpret_cast<const ENUMLOGFONTEX *>(logFont);
const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
+ const QString styleName = QString::fromWCharArray(f->elfStyle);
const QString fullName = QString::fromWCharArray(f->elfFullName);
const uchar charSet = f->elfLogFont.lfCharSet;
@@ -533,7 +299,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
const FONTSIGNATURE *signature = Q_NULLPTR;
if (type & TRUETYPE_FONTTYPE)
signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
- addFontToDatabase(faceName, fullName, charSet, textmetric, signature, type, false);
+ addFontToDatabase(faceName, styleName, fullName, charSet, textmetric, signature, type, false);
// keep on enumerating
return 1;
@@ -576,8 +342,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 +397,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 +414,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..f5d1ed9fad 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
@@ -196,6 +192,7 @@ void QWindowsFontEngine::getCMap()
lineWidth = otm->otmsUnderscoreSize;
fsType = otm->otmfsType;
free(otm);
+
} else {
unitsPerEm = tm.tmHeight;
}
@@ -205,9 +202,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 +219,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 +322,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 +365,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 +451,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 +504,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 +524,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
@@ -587,6 +541,62 @@ QFixed QWindowsFontEngine::leading() const
return tm.tmExternalLeading;
}
+namespace {
+# pragma pack(1)
+
+ struct OS2Table
+ {
+ quint16 version;
+ qint16 avgCharWidth;
+ quint16 weightClass;
+ quint16 widthClass;
+ quint16 type;
+ qint16 subscriptXSize;
+ qint16 subscriptYSize;
+ qint16 subscriptXOffset;
+ qint16 subscriptYOffset;
+ qint16 superscriptXSize;
+ qint16 superscriptYSize;
+ qint16 superscriptXOffset;
+ qint16 superscriptYOffset;
+ qint16 strikeOutSize;
+ qint16 strikeOutPosition;
+ qint16 familyClass;
+ quint8 panose[10];
+ quint32 unicodeRanges[4];
+ quint8 vendorID[4];
+ quint16 selection;
+ quint16 firstCharIndex;
+ quint16 lastCharIndex;
+ qint16 typoAscender;
+ qint16 typoDescender;
+ qint16 typoLineGap;
+ quint16 winAscent;
+ quint16 winDescent;
+ quint32 codepageRanges[2];
+ qint16 height;
+ qint16 capHeight;
+ quint16 defaultChar;
+ quint16 breakChar;
+ quint16 maxContext;
+ };
+
+# pragma pack()
+}
+
+QFixed QWindowsFontEngine::capHeight() const
+{
+ const QByteArray tableData = getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
+ if (size_t(tableData.size()) >= sizeof(OS2Table)) {
+ const OS2Table *table = reinterpret_cast<const OS2Table *>(tableData.constData());
+ if (qFromBigEndian<quint16>(table->version) >= 2) {
+ qint16 capHeight = qFromBigEndian<qint16>(table->capHeight);
+ if (capHeight > 0)
+ return QFixed(capHeight) / designToDevice;
+ }
+ }
+ return calculatedCapHeight();
+}
QFixed QWindowsFontEngine::xHeight() const
{
@@ -636,22 +646,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 +674,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 +729,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 +755,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 +769,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 +787,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 +1010,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 +1052,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 +1073,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..b63d8fd282 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
@@ -103,6 +103,7 @@ public:
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed averageCharWidth() const Q_DECL_OVERRIDE;
qreal maxCharWidth() const Q_DECL_OVERRIDE;
qreal minLeftBearing() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index 0fdd4615f6..66cc08f9fa 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -46,6 +46,7 @@
#include <QtCore/QSettings>
#include <QtCore/QtEndian>
#include <QtCore/QVarLengthArray>
+#include <QtCore/QFile>
#include <private/qstringiterator_p.h>
#include <QtCore/private/qsystemlibrary_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -210,6 +211,7 @@ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *di
, m_lineThickness(-1)
, m_unitsPerEm(-1)
, m_ascent(-1)
+ , m_capHeight(-1)
, m_descent(-1)
, m_xHeight(-1)
, m_lineGap(-1)
@@ -242,6 +244,82 @@ QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite()
}
}
+#ifndef Q_CC_MINGW
+typedef IDWriteLocalFontFileLoader QIdWriteLocalFontFileLoader;
+
+static UUID uuidIdWriteLocalFontFileLoader()
+{
+ return __uuidof(IDWriteLocalFontFileLoader);
+}
+#else // !Q_CC_MINGW
+DECLARE_INTERFACE_(QIdWriteLocalFontFileLoader, IDWriteFontFileLoader)
+{
+ STDMETHOD(GetFilePathLengthFromKey)(THIS_ void const *, UINT32, UINT32*) PURE;
+ STDMETHOD(GetFilePathFromKey)(THIS_ void const *, UINT32, WCHAR *, UINT32) PURE;
+ STDMETHOD(GetLastWriteTimeFromKey)(THIS_ void const *, UINT32, FILETIME *) PURE;
+};
+
+static UUID uuidIdWriteLocalFontFileLoader()
+{
+ static const UUID result = { 0xb2d9f3ec, 0xc9fe, 0x4a11, {0xa2, 0xec, 0xd8, 0x62, 0x8, 0xf7, 0xc0, 0xa2}};
+ return result;
+}
+#endif // Q_CC_MINGW
+
+QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fontFile)
+{
+ IDWriteFontFileLoader *loader = Q_NULLPTR;
+
+ HRESULT hr = fontFile->GetLoader(&loader);
+ if (FAILED(hr)) {
+ qErrnoWarning("%s: GetLoader failed", __FUNCTION__);
+ return QString();
+ }
+
+ QIdWriteLocalFontFileLoader *localLoader = Q_NULLPTR;
+ hr = loader->QueryInterface(uuidIdWriteLocalFontFileLoader(),
+ reinterpret_cast<void **>(&localLoader));
+
+ const void *fontFileReferenceKey = Q_NULLPTR;
+ UINT32 fontFileReferenceKeySize = 0;
+ if (SUCCEEDED(hr)) {
+ hr = fontFile->GetReferenceKey(&fontFileReferenceKey,
+ &fontFileReferenceKeySize);
+ if (FAILED(hr))
+ qErrnoWarning(hr, "%s: GetReferenceKey failed", __FUNCTION__);
+ }
+
+ UINT32 filePathLength = 0;
+ if (SUCCEEDED(hr)) {
+ hr = localLoader->GetFilePathLengthFromKey(fontFileReferenceKey,
+ fontFileReferenceKeySize,
+ &filePathLength);
+ if (FAILED(hr))
+ qErrnoWarning(hr, "GetFilePathLength failed", __FUNCTION__);
+ }
+
+ QString ret;
+ if (SUCCEEDED(hr) && filePathLength > 0) {
+ QVarLengthArray<wchar_t> filePath(filePathLength + 1);
+
+ hr = localLoader->GetFilePathFromKey(fontFileReferenceKey,
+ fontFileReferenceKeySize,
+ filePath.data(),
+ filePathLength + 1);
+ if (FAILED(hr))
+ qErrnoWarning(hr, "%s: GetFilePathFromKey failed", __FUNCTION__);
+ else
+ ret = QString::fromWCharArray(filePath.data());
+ }
+
+ if (localLoader != Q_NULLPTR)
+ localLoader->Release();
+
+ if (loader != Q_NULLPTR)
+ loader->Release();
+ return ret;
+}
+
void QWindowsFontEngineDirectWrite::collectMetrics()
{
DWRITE_FONT_METRICS metrics;
@@ -251,10 +329,18 @@ void QWindowsFontEngineDirectWrite::collectMetrics()
m_lineThickness = DESIGN_TO_LOGICAL(metrics.underlineThickness);
m_ascent = DESIGN_TO_LOGICAL(metrics.ascent);
+ m_capHeight = DESIGN_TO_LOGICAL(metrics.capHeight);
m_descent = DESIGN_TO_LOGICAL(metrics.descent);
m_xHeight = DESIGN_TO_LOGICAL(metrics.xHeight);
m_lineGap = DESIGN_TO_LOGICAL(metrics.lineGap);
m_underlinePosition = DESIGN_TO_LOGICAL(metrics.underlinePosition);
+
+ IDWriteFontFile *fontFile = Q_NULLPTR;
+ UINT32 numberOfFiles = 1;
+ if (SUCCEEDED(m_directWriteFontFace->GetFiles(&numberOfFiles, &fontFile))) {
+ m_faceId.filename = QFile::encodeName(filenameFromFontFile(fontFile));
+ fontFile->Release();
+ }
}
QFixed QWindowsFontEngineDirectWrite::underlinePosition() const
@@ -356,6 +442,11 @@ bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGly
return true;
}
+QFontEngine::FaceId QWindowsFontEngineDirectWrite::faceId() const
+{
+ return m_faceId;
+}
+
void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags) const
{
QVarLengthArray<UINT16> glyphIndices(glyphs->numGlyphs);
@@ -369,7 +460,7 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn
glyphIndices.size(),
glyphMetrics.data());
if (SUCCEEDED(hr)) {
- qreal stretch = fontDef.stretch / 100.0;
+ qreal stretch = fontDef.stretch != QFont::AnyStretch ? fontDef.stretch / 100.0 : 1.0;
for (int i = 0; i < glyphs->numGlyphs; ++i)
glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth * stretch);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
@@ -469,6 +560,16 @@ QFixed QWindowsFontEngineDirectWrite::ascent() const
: m_ascent;
}
+QFixed QWindowsFontEngineDirectWrite::capHeight() const
+{
+ if (m_capHeight <= 0)
+ return calculatedCapHeight();
+
+ return fontDef.styleStrategy & QFont::ForceIntegerMetrics
+ ? m_capHeight.round()
+ : m_capHeight;
+}
+
QFixed QWindowsFontEngineDirectWrite::descent() const
{
return fontDef.styleStrategy & QFont::ForceIntegerMetrics
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
index 37e511ce3e..e4a82c6a6e 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h
@@ -49,6 +49,7 @@
struct IDWriteFont;
struct IDWriteFontFace;
+struct IDWriteFontFile;
struct IDWriteFactory;
struct IDWriteBitmapRenderTarget;
struct IDWriteGdiInterop;
@@ -87,10 +88,12 @@ public:
const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
qreal maxCharWidth() const Q_DECL_OVERRIDE;
+ FaceId faceId() const Q_DECL_OVERRIDE;
bool supportsSubPixelPositions() const Q_DECL_OVERRIDE;
@@ -114,6 +117,7 @@ private:
QImage imageForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform);
void collectMetrics();
void renderGlyphRun(QImage *destination, float r, float g, float b, float a, IDWriteGlyphRunAnalysis *glyphAnalysis, const QRect &boundingRect);
+ static QString filenameFromFontFile(IDWriteFontFile *fontFile);
const QSharedPointer<QWindowsFontEngineData> m_fontEngineData;
@@ -124,6 +128,7 @@ private:
QFixed m_underlinePosition;
int m_unitsPerEm;
QFixed m_ascent;
+ QFixed m_capHeight;
QFixed m_descent;
QFixed m_xHeight;
QFixed m_lineGap;
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 0a2d30319e..c1eb664324 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;
-PROC QWindowsOpengl32DLL::resolve(const char *name)
+FARPROC QWindowsOpengl32DLL::resolve(const char *name)
{
-#ifndef Q_OS_WINCE
- PROC proc = m_lib ? ::GetProcAddress(m_lib, name) : 0;
-#else
- PROC proc = m_lib ? ::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 2944ab7192..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);
- PROC 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 b6d2c16f89..b9a63c7a89 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
@@ -219,9 +212,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;
@@ -483,46 +474,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;
@@ -610,7 +571,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 0c03274799..4258f908e7 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -106,7 +106,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 ae3c477399..79b5bbae41 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -553,34 +553,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)
{
@@ -781,7 +753,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)
@@ -806,7 +777,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,
@@ -1188,7 +1158,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));
@@ -1202,7 +1171,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);
}
@@ -1232,7 +1200,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();
@@ -1245,7 +1212,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 1e32ddabcc..2657644780 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 b86972996c..30d438a127 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 b92387d397..3f6230172e 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)) {
@@ -489,7 +516,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;
@@ -565,109 +591,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 c24e0ba0ae..5283d6b260 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();
@@ -281,7 +261,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()
@@ -302,7 +282,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;
@@ -429,7 +409,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 d8058fcd06..7f9c9bd205 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() && !url.hasFragment() && !url.hasQuery()
? QDir::toNativeSeparators(url.toLocalFile())
: url.toString(QUrl::FullyEncoded);
@@ -70,10 +67,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 ff4cfe63cb..841464391d 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>
@@ -73,6 +68,7 @@
#include <QtGui/QPainter>
#include <QtGui/QPixmapCache>
#include <qpa/qwindowsysteminterface.h>
+#include <QtPlatformSupport/private/qabstractfileiconengine_p.h>
#include <private/qhighdpiscaling_p.h>
#include <private/qsystemlibrary_p.h>
@@ -128,7 +124,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 +165,6 @@ static bool shGetFileInfoBackground(QWindowsThreadPoolRunner &r,
}
return result;
}
-#endif // !QT_NO_WINCE_SHELLSDK
// from QStyle::standardPalette
static inline QPalette standardPalette()
@@ -281,14 +275,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 +303,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);
@@ -330,6 +315,7 @@ const char *QWindowsTheme::name = "windows";
QWindowsTheme *QWindowsTheme::m_instance = 0;
QWindowsTheme::QWindowsTheme()
+ : m_threadPoolRunner(new QWindowsThreadPoolRunner)
{
m_instance = this;
std::fill(m_fonts, m_fonts + NFonts, static_cast<QFont *>(0));
@@ -364,7 +350,7 @@ static inline QStringList styleNames()
static inline int uiEffects()
{
- int result = 0;
+ int result = QPlatformTheme::HoverEffect;
if (booleanSystemParametersInfo(SPI_GETUIEFFECTS, false))
result |= QPlatformTheme::GeneralUiEffect;
if (booleanSystemParametersInfo(SPI_GETMENUANIMATION, false))
@@ -389,12 +375,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:
@@ -402,7 +386,7 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
case UiEffects:
return QVariant(uiEffects());
case IconPixmapSizes:
- return m_fileIconSizes;
+ return QVariant::fromValue(m_fileIconSizes);
case DialogSnapToDefaultButton:
return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false));
case ContextMenuOnMouseRelease:
@@ -445,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;
@@ -474,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
}
enum FileIconSize {
@@ -512,15 +494,14 @@ void QWindowsTheme::refreshIconPixmapSizes()
fileIconSizes[ExtraLargeFileIcon] =
fileIconSizes[LargeFileIcon] + fileIconSizes[LargeFileIcon] / 2;
fileIconSizes[JumboFileIcon] = 8 * fileIconSizes[LargeFileIcon]; // empirical, has not been observed to work
- QList<int> sizes;
- sizes << fileIconSizes[SmallFileIcon] << fileIconSizes[LargeFileIcon];
+
#ifdef USE_IIMAGELIST
- sizes << fileIconSizes[ExtraLargeFileIcon]; // sHIL_EXTRALARGE
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
- sizes << fileIconSizes[JumboFileIcon]; // SHIL_JUMBO
+ int *availEnd = fileIconSizes + JumboFileIcon + 1;
+#else
+ int *availEnd = fileIconSizes + LargeFileIcon + 1;
#endif // USE_IIMAGELIST
- qCDebug(lcQpaWindows) << __FUNCTION__ << sizes;
- m_fileIconSizes = QVariant::fromValue(sizes);
+ m_fileIconSizes = QAbstractFileIconEngine::toSizeList(fileIconSizes, availEnd);
+ qCDebug(lcQpaWindows) << __FUNCTION__ << m_fileIconSizes;
}
// Defined in qpixmap_win.cpp
@@ -528,12 +509,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));
@@ -549,7 +525,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) {
@@ -575,14 +551,14 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
break;
case FileLinkIcon:
stockFlags = SHGSI_LINKOVERLAY;
- // Fall through
+ Q_FALLTHROUGH();
case FileIcon:
stockId = SIID_DOCNOASSOC;
resourceId = 1;
break;
case DirLinkIcon:
stockFlags = SHGSI_LINKOVERLAY;
- // Fall through
+ Q_FALLTHROUGH();
case DirClosedIcon:
case DirIcon:
stockId = SIID_FOLDER;
@@ -596,7 +572,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
break;
case DirLinkOpenIcon:
stockFlags = SHGSI_LINKOVERLAY;
- // Fall through
+ Q_FALLTHROUGH();
case DirOpenIcon:
stockId = SIID_FOLDEROPEN;
resourceId = 5;
@@ -612,7 +588,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;
@@ -632,29 +607,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);
@@ -729,14 +697,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;
@@ -753,8 +715,46 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info)
return result;
}
-QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions) const
+class QWindowsFileIconEngine : public QAbstractFileIconEngine
+{
+public:
+ explicit QWindowsFileIconEngine(const QFileInfo &info,
+ QPlatformTheme::IconOptions opts,
+ const QSharedPointer<QWindowsThreadPoolRunner> &runner) :
+ QAbstractFileIconEngine(info, opts), m_threadPoolRunner(runner) {}
+
+ QList<QSize> availableSizes(QIcon::Mode = QIcon::Normal, QIcon::State = QIcon::Off) const override
+ { return QWindowsTheme::instance()->availableFileIconSizes(); }
+
+protected:
+ QString cacheKey() const override;
+ QPixmap filePixmap(const QSize &size, QIcon::Mode mode, QIcon::State) override;
+
+private:
+ const QSharedPointer<QWindowsThreadPoolRunner> m_threadPoolRunner;
+};
+
+QString QWindowsFileIconEngine::cacheKey() const
+{
+ // Cache directories unless custom or drives, which have custom icons depending on type
+ if ((options() & QPlatformTheme::DontUseCustomDirectoryIcons) && fileInfo().isDir() && !fileInfo().isRoot())
+ return QStringLiteral("qt_/directory/");
+ if (!fileInfo().isFile())
+ return QString();
+ // Return "" for .exe, .lnk and .ico extensions.
+ // It is faster to just look at the file extensions;
+ // avoiding slow QFileInfo::isExecutable() (QTBUG-13182)
+ const QString &suffix = fileInfo().suffix();
+ if (!suffix.compare(QLatin1String("exe"), Qt::CaseInsensitive)
+ || !suffix.compare(QLatin1String("lnk"), Qt::CaseInsensitive)
+ || !suffix.compare(QLatin1String("ico"), Qt::CaseInsensitive)) {
+ return QString();
+ }
+ return QLatin1String("qt_.")
+ + (suffix.isEmpty() ? fileInfo().fileName() : suffix.toUpper()); // handle "Makefile" ;)
+}
+
+QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon::State)
{
/* We don't use the variable, but by storing it statically, we
* ensure CoInitialize is only called once. */
@@ -764,10 +764,10 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
static QCache<QString, FakePointer<int> > dirIconEntryCache(1000);
static QMutex mx;
static int defaultFolderIIcon = -1;
- const bool useDefaultFolderIcon = iconOptions & QPlatformTheme::DontUseCustomDirectoryIcons;
+ const bool useDefaultFolderIcon = options() & QPlatformTheme::DontUseCustomDirectoryIcons;
QPixmap pixmap;
- const QString filePath = QDir::toNativeSeparators(fileInfo.filePath());
+ const QString filePath = QDir::toNativeSeparators(fileInfo().filePath());
const int width = int(size.width());
const int iconSize = width > fileIconSizes[SmallFileIcon] ? SHGFI_LARGEICON : SHGFI_SMALLICON;
const int requestedImageListSize =
@@ -778,7 +778,7 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
#else
0;
#endif // !USE_IIMAGELIST
- bool cacheableDirIcon = fileInfo.isDir() && !fileInfo.isRoot();
+ bool cacheableDirIcon = fileInfo().isDir() && !fileInfo().isRoot();
if (cacheableDirIcon) {
QMutexLocker locker(&mx);
int iIcon = (useDefaultFolderIcon && defaultFolderIIcon >= 0) ? defaultFolderIIcon
@@ -794,22 +794,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,
+ ? shGetFileInfoBackground(*m_threadPoolRunner.data(), L"dummy", FILE_ATTRIBUTE_DIRECTORY,
&info, flags | SHGFI_USEFILEATTRIBUTES)
- : shGetFileInfoBackground(m_threadPoolRunner, reinterpret_cast<const wchar_t *>(filePath.utf16()), 0,
+ : shGetFileInfoBackground(*m_threadPoolRunner.data(), 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) {
@@ -848,9 +839,12 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
DestroyIcon(info.hIcon);
}
- if (!pixmap.isNull())
- return pixmap;
- return QPlatformTheme::fileIconPixmap(fileInfo, size);
+ return pixmap;
+}
+
+QIcon QWindowsTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const
+{
+ return QIcon(new QWindowsFileIconEngine(fileInfo, iconOptions, m_threadPoolRunner));
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowstheme.h b/src/plugins/platforms/windows/qwindowstheme.h
index fa1fb4d998..0384899efa 100644
--- a/src/plugins/platforms/windows/qwindowstheme.h
+++ b/src/plugins/platforms/windows/qwindowstheme.h
@@ -43,6 +43,7 @@
#include "qwindowsthreadpoolrunner.h"
#include <qpa/qplatformtheme.h>
+#include <QtCore/QSharedPointer>
#include <QtCore/QVariant>
QT_BEGIN_NAMESPACE
@@ -66,12 +67,14 @@ public:
{ return m_fonts[type]; }
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const Q_DECL_OVERRIDE;
- QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions = 0) const Q_DECL_OVERRIDE;
+
+ QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = 0) const override;
void windowsThemeChanged(QWindow *window);
void displayChanged() { refreshIconPixmapSizes(); }
+ QList<QSize> availableFileIconSizes() const { return m_fileIconSizes; }
+
static const char *name;
private:
@@ -85,8 +88,8 @@ private:
static QWindowsTheme *m_instance;
QPalette *m_palettes[NPalettes];
QFont *m_fonts[NFonts];
- mutable QWindowsThreadPoolRunner m_threadPoolRunner;
- QVariant m_fileIconSizes;
+ const QSharedPointer<QWindowsThreadPoolRunner> m_threadPoolRunner;
+ QList<QSize> m_fileIconSizes;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 434d0ad953..7289f8de6d 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);
}
@@ -1667,6 +1569,12 @@ void QWindowsWindow::releaseDC()
}
}
+static inline bool dwmIsCompositionEnabled()
+{
+ BOOL dWmCompositionEnabled = FALSE;
+ return SUCCEEDED(DwmIsCompositionEnabled(&dWmCompositionEnabled)) && dWmCompositionEnabled == TRUE;
+}
+
bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
WPARAM, LPARAM)
{
@@ -1680,8 +1588,7 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
BeginPaint(hwnd, &ps);
// Observed painting problems with Aero style disabled (QTBUG-7865).
- // 5.8: Consider making it dependent on !DwmIsCompositionEnabled().
- if (testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered))
+ if (Q_UNLIKELY(testFlag(OpenGLSurface) && testFlag(OpenGLDoubleBuffered) && !dwmIsCompositionEnabled()))
SelectClipRgn(ps.hdc, NULL);
// If the a window is obscured by another window (such as a child window)
@@ -1823,18 +1730,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 +1741,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 +1860,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 +1879,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 +1936,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 +1971,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 +1987,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 +2072,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 +2142,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 +2208,6 @@ void QWindowsWindow::setCursor(const CursorHandlePtr &c)
#endif
}
-#ifndef Q_OS_WINCE
void QWindowsWindow::setAlertState(bool enabled)
{
if (isAlertState() == enabled)
@@ -2370,7 +2246,6 @@ void QWindowsWindow::stopAlertWindow()
info.uCount = 0;
FlashWindowEx(&info);
}
-#endif // !Q_OS_WINCE
bool QWindowsWindow::isEnabled() const
{
@@ -2486,7 +2361,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 +2373,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..6929f7365f 100644
--- a/src/plugins/platforms/windows/windows.pri
+++ b/src/plugins/platforms/windows/windows.pri
@@ -1,19 +1,16 @@
# 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
+qtConfig(opengl):!qtConfig(opengles2):!qtConfig(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
-contains(QT_CONFIG, directwrite) {
- contains(QT_CONFIG, directwrite2): \
+qtConfig(directwrite) {
+ qtConfig(directwrite2): \
DEFINES *= QT_USE_DIRECTWRITE2
SOURCES += $$PWD/qwindowsfontenginedirectwrite.cpp
@@ -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 \
@@ -70,18 +65,18 @@ HEADERS += \
INCLUDEPATH += $$PWD
-contains(QT_CONFIG,opengl): HEADERS += $$PWD/qwindowsopenglcontext.h
+qtConfig(opengl): HEADERS += $$PWD/qwindowsopenglcontext.h
-contains(QT_CONFIG, opengles2) {
+qtConfig(opengles2) {
SOURCES += $$PWD/qwindowseglcontext.cpp
HEADERS += $$PWD/qwindowseglcontext.h
-} else: contains(QT_CONFIG,opengl) {
+} else: qtConfig(opengl) {
SOURCES += $$PWD/qwindowsglcontext.cpp
HEADERS += $$PWD/qwindowsglcontext.h
}
# Dynamic GL needs both WGL and EGL
-contains(QT_CONFIG,dynamicgl) {
+qtConfig(dynamicgl) {
SOURCES += $$PWD/qwindowseglcontext.cpp
HEADERS += $$PWD/qwindowseglcontext.h
}
@@ -101,40 +96,32 @@ 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
+
+RESOURCES += $$PWD/openglblacklists.qrc
-!wince: 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
+qtConfig(freetype) {
+ HEADERS += $$PWD/qwindowsfontdatabase_ft.h
+ SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp
+ qtConfig(system-freetype) {
+ include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri)
+ } else {
+ include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
+ }
}
-contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri)
+qtConfig(accessibility): include($$PWD/accessible/accessible.pri)
DEFINES *= LIBEGL_NAME=$${LIBEGL_NAME}
DEFINES *= LIBGLESV2_NAME=$${LIBGLESV2_NAME}
diff --git a/src/plugins/platforms/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/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
index 3f476556ee..63e5b0cf27 100644
--- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
+++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
@@ -39,6 +39,7 @@
#include "qwinrtinputcontext.h"
#include "qwinrtscreen.h"
+#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
#include <private/qeventdispatcher_winrt_p.h>
@@ -59,7 +60,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods")
-inline QRectF getInputPaneRect(IInputPane *pane, qreal scaleFactor)
+inline QRectF getInputPaneRect(ComPtr<IInputPane> pane, qreal scaleFactor)
{
Rect rect;
pane->get_OccludedRect(&rect);
@@ -85,28 +86,33 @@ QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen)
{
qCDebug(lcQpaInputMethods) << __FUNCTION__ << screen;
- IInputPaneStatics *statics;
- if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(),
- &statics))) {
- qWarning("failed to retrieve input pane statics.");
- return;
- }
+ QEventDispatcherWinRT::runOnXamlThread([this]() {
+ ComPtr<IInputPaneStatics> statics;
+ if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(),
+ &statics))) {
+ qWarning("failed to retrieve input pane statics.");
+ return S_OK;
+ }
+
+ ComPtr<IInputPane> inputPane;
+ statics->GetForCurrentView(&inputPane);
+ if (inputPane) {
+ EventRegistrationToken showToken, hideToken;
+ inputPane->add_Showing(Callback<InputPaneVisibilityHandler>(
+ this, &QWinRTInputContext::onShowing).Get(), &showToken);
+ inputPane->add_Hiding(Callback<InputPaneVisibilityHandler>(
+ this, &QWinRTInputContext::onHiding).Get(), &hideToken);
+
+ m_keyboardRect = getInputPaneRect(inputPane, m_screen->scaleFactor());
+ m_isInputPanelVisible = !m_keyboardRect.isEmpty();
+ } else {
+ qWarning("failed to retrieve InputPane.");
+ }
+ return S_OK;
+ });
- IInputPane *inputPane;
- statics->GetForCurrentView(&inputPane);
- statics->Release();
- if (inputPane) {
- EventRegistrationToken showToken, hideToken;
- inputPane->add_Showing(Callback<InputPaneVisibilityHandler>(
- this, &QWinRTInputContext::onShowing).Get(), &showToken);
- inputPane->add_Hiding(Callback<InputPaneVisibilityHandler>(
- this, &QWinRTInputContext::onHiding).Get(), &hideToken);
-
- m_keyboardRect = getInputPaneRect(inputPane, m_screen->scaleFactor());
- m_isInputPanelVisible = !m_keyboardRect.isEmpty();
- } else {
- qWarning("failed to retrieve InputPane.");
- }
+ connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged,
+ this, &QWinRTInputContext::updateScreenCursorRect);
}
QRectF QWinRTInputContext::keyboardRect() const
@@ -119,6 +125,11 @@ bool QWinRTInputContext::isInputPanelVisible() const
return m_isInputPanelVisible;
}
+void QWinRTInputContext::updateScreenCursorRect()
+{
+ m_screen->setCursorRect(QGuiApplication::inputMethod()->cursorRectangle());
+}
+
HRESULT QWinRTInputContext::onShowing(IInputPane *pane, IInputPaneVisibilityEventArgs *)
{
qCDebug(lcQpaInputMethods) << __FUNCTION__ << pane;
@@ -141,6 +152,7 @@ HRESULT QWinRTInputContext::handleVisibilityChange(IInputPane *pane)
const QRectF keyboardRect = getInputPaneRect(pane, m_screen->scaleFactor());
if (m_keyboardRect != keyboardRect) {
m_keyboardRect = keyboardRect;
+ m_screen->setKeyboardRect(m_keyboardRect);
emitKeyboardRectChanged();
}
return S_OK;
diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.h b/src/plugins/platforms/winrt/qwinrtinputcontext.h
index 5e416bb99f..9d5c4187e2 100644
--- a/src/plugins/platforms/winrt/qwinrtinputcontext.h
+++ b/src/plugins/platforms/winrt/qwinrtinputcontext.h
@@ -79,6 +79,9 @@ public:
void hideInputPanel();
#endif
+private slots:
+ void updateScreenCursorRect();
+
private:
HRESULT onShowing(ABI::Windows::UI::ViewManagement::IInputPane *,
ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *);
@@ -89,6 +92,7 @@ private:
QWinRTScreen *m_screen;
QRectF m_keyboardRect;
+ QRectF m_cursorRect;
bool m_isInputPanelVisible;
};
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp
index 42b7f7e909..32edf2b1a2 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.cpp
+++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp
@@ -197,9 +197,9 @@ QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate)
QEventDispatcherWinRT::runOnXamlThread([d]() {
d->mainScreen = new QWinRTScreen;
- d->inputContext.reset(new QWinRTInputContext(d->mainScreen));
return S_OK;
});
+ d->inputContext.reset(new QWinRTInputContext(d->mainScreen));
screenAdded(d->mainScreen);
d->platformServices = new QWinRTServices;
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index c120de9d8f..e8e869c04f 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -753,12 +753,66 @@ void QWinRTScreen::initialize()
onVisibilityChanged(nullptr, nullptr);
}
+void QWinRTScreen::setCursorRect(const QRectF &cursorRect)
+{
+ mCursorRect = cursorRect;
+}
+
+void QWinRTScreen::setKeyboardRect(const QRectF &keyboardRect)
+{
+ Q_D(QWinRTScreen);
+ QRectF visibleRectF;
+ HRESULT hr;
+ Rect windowSize;
+
+ hr = d->coreWindow->get_Bounds(&windowSize);
+ if (FAILED(hr)) {
+ qErrnoWarning(hr, "Failed to get window bounds");
+ return;
+ }
+ d->logicalRect = QRectF(windowSize.X, windowSize.Y, windowSize.Width, windowSize.Height);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
+ Rect visibleRect;
+ hr = d->view2->get_VisibleBounds(&visibleRect);
+ if (FAILED(hr)) {
+ qErrnoWarning(hr, "Failed to get window visible bounds");
+ return;
+ }
+ visibleRectF = QRectF(visibleRect.X, visibleRect.Y, visibleRect.Width, visibleRect.Height);
+#else
+ visibleRectF = d->logicalRect;
+#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
+ // if keyboard is snapped to the bottom of the screen and would cover the cursor the content is
+ // moved up to make it visible
+ if (keyboardRect.intersects(mCursorRect)
+ && qFuzzyCompare(geometry().height(), keyboardRect.y() + keyboardRect.height())) {
+ visibleRectF.moveTop(visibleRectF.top() - keyboardRect.height() / d->scaleFactor);
+ }
+ d->visibleRect = visibleRectF;
+
+ qCDebug(lcQpaWindows) << __FUNCTION__ << d->visibleRect;
+ QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
+ QPlatformScreen::resizeMaximizedWindows();
+ handleExpose();
+}
+
QWindow *QWinRTScreen::topWindow() const
{
Q_D(const QWinRTScreen);
return d->visibleWindows.isEmpty() ? 0 : d->visibleWindows.first();
}
+QWindow *QWinRTScreen::windowAt(const QPoint &pos)
+{
+ Q_D(const QWinRTScreen);
+ for (auto w : qAsConst(d->visibleWindows)) {
+ if (w->geometry().contains(pos))
+ return w;
+ }
+ qCDebug(lcQpaWindows) << __FUNCTION__ << ": No window found at:" << pos;
+ return nullptr;
+}
+
void QWinRTScreen::addWindow(QWindow *window)
{
Q_D(QWinRTScreen);
@@ -767,8 +821,12 @@ void QWinRTScreen::addWindow(QWindow *window)
return;
d->visibleWindows.prepend(window);
- updateWindowTitle(window->title());
- QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason);
+ const Qt::WindowType type = window->type();
+ if (type != Qt::Popup && type != Qt::ToolTip && type != Qt::Tool) {
+ updateWindowTitle(window->title());
+ QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason);
+ }
+
handleExpose();
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
@@ -785,7 +843,9 @@ void QWinRTScreen::removeWindow(QWindow *window)
const bool wasTopWindow = window == topWindow();
if (!d->visibleWindows.removeAll(window))
return;
- if (wasTopWindow)
+
+ const Qt::WindowType type = window->type();
+ if (wasTopWindow && type != Qt::Popup && type != Qt::ToolTip && type != Qt::Tool)
QWindowSystemInterface::handleWindowActivated(Q_NULLPTR, Qt::OtherFocusReason);
handleExpose();
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
@@ -1001,9 +1061,12 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
pointerPoint->get_Position(&point);
QPointF pos(point.X * d->scaleFactor, point.Y * d->scaleFactor);
QPointF localPos = pos;
- if (topWindow()) {
- const QPointF globalPosDelta = pos - pos.toPoint();
- localPos = topWindow()->mapFromGlobal(pos.toPoint()) + globalPosDelta;
+
+ const QPoint posPoint = pos.toPoint();
+ QWindow *targetWindow = windowAt(posPoint);
+ if (targetWindow) {
+ const QPointF globalPosDelta = pos - posPoint;
+ localPos = targetWindow->mapFromGlobal(posPoint) + globalPosDelta;
}
VirtualKeyModifiers modifiers;
@@ -1038,7 +1101,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
boolean isHorizontal;
properties->get_IsHorizontalMouseWheel(&isHorizontal);
QPoint angleDelta(isHorizontal ? delta : 0, isHorizontal ? 0 : delta);
- QWindowSystemInterface::handleWheelEvent(topWindow(), localPos, pos, QPoint(), angleDelta, mods);
+ QWindowSystemInterface::handleWheelEvent(targetWindow, localPos, pos, QPoint(), angleDelta, mods);
break;
}
@@ -1064,7 +1127,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
if (isPressed)
buttons |= Qt::XButton2;
- QWindowSystemInterface::handleMouseEvent(topWindow(), localPos, pos, buttons, mods);
+ QWindowSystemInterface::handleMouseEvent(targetWindow, localPos, pos, buttons, mods);
break;
}
@@ -1122,7 +1185,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
it.value().normalPosition = QPointF(point.X/d->logicalRect.width(), point.Y/d->logicalRect.height());
it.value().pressure = pressure;
- QWindowSystemInterface::handleTouchEvent(topWindow(), d->touchDevice, d->touchPoints.values(), mods);
+ QWindowSystemInterface::handleTouchEvent(targetWindow, d->touchDevice, d->touchPoints.values(), mods);
// Fall-through for pen to generate tablet event
if (pointerDeviceType != PointerDeviceType_Pen)
@@ -1141,7 +1204,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
float rotation;
properties->get_Twist(&rotation);
- QWindowSystemInterface::handleTabletEvent(topWindow(), isPressed, pos, pos, 0,
+ QWindowSystemInterface::handleTabletEvent(targetWindow, isPressed, pos, pos, 0,
pointerType, pressure, xTilt, yTilt,
0, rotation, 0, id, mods);
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h
index 0e753b748b..e489e208d5 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.h
+++ b/src/plugins/platforms/winrt/qwinrtscreen.h
@@ -104,6 +104,7 @@ public:
Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE;
QWindow *topWindow() const;
+ QWindow *windowAt(const QPoint &pos);
void addWindow(QWindow *window);
void removeWindow(QWindow *window);
void raise(QWindow *window);
@@ -116,6 +117,9 @@ public:
void initialize();
+ void setCursorRect(const QRectF &cursorRect);
+ void setKeyboardRect(const QRectF &keyboardRect);
+
private:
void handleExpose();
@@ -140,6 +144,7 @@ private:
#endif
QScopedPointer<QWinRTScreenPrivate> d_ptr;
+ QRectF mCursorRect;
Q_DECLARE_PRIVATE(QWinRTScreen)
};
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro
index 9de0476810..b8f878ffe8 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro
@@ -1,9 +1,10 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += gui-private
-contains(QT_CONFIG, egl): contains(QT_CONFIG, egl_x11): contains(QT_CONFIG, opengl) {
+qtConfig(egl):qtConfig(egl_x11):qtConfig(opengl) {
SUBDIRS += xcb_egl
}
-contains(QT_CONFIG, xcb-xlib): contains(QT_CONFIG, opengl): !contains(QT_CONFIG, opengles2) {
+qtConfig(xcb-xlib):qtConfig(opengl):!qtConfig(opengles2) {
SUBDIRS += xcb_glx
}
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
index 68cb91ff3d..a3813ef993 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
@@ -6,35 +6,31 @@ INCLUDEPATH += $$PWD/../
load(qt_build_paths)
# needed by Xcursor ...
-contains(QT_CONFIG, xcb-xlib) {
+qtConfig(xcb-xlib) {
DEFINES += XCB_USE_XLIB
- contains(QT_CONFIG, xinput2) {
+ qtConfig(xinput2) {
DEFINES += XCB_USE_XINPUT2
}
}
-# to support custom cursors with depth > 1
-contains(QT_CONFIG, xcb-render) {
- DEFINES += XCB_USE_RENDER
-}
-
# build with session management support
-contains(QT_CONFIG, xcb-sm) {
+qtConfig(xcb-sm) {
DEFINES += XCB_USE_SM
}
-DEFINES += $$QMAKE_DEFINES_XCB
-LIBS += $$QMAKE_LIBS_XCB
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
-
CONFIG += qpa/genericunixfontdatabase
-contains(QT_CONFIG, xcb-qt) {
+!qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb)
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
- LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ QMAKE_USE += xcb
} else {
- LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms
- !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
+ qtConfig(xkb): QMAKE_USE += xcb_xkb
+ # to support custom cursors with depth > 1
+ qtConfig(xcb-render) {
+ DEFINES += XCB_USE_RENDER
+ }
+ QMAKE_USE += xcb_syslibs
}
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
index 079f0466dc..00f64e3c40 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
@@ -42,6 +42,7 @@
#include "qxcbeglcontext.h"
#include <QtGui/QOffscreenSurface>
+#include <QtPlatformSupport/private/qeglstreamconvenience_p.h>
#include "qxcbeglnativeinterfacehandler.h"
@@ -63,7 +64,18 @@ QXcbEglIntegration::~QXcbEglIntegration()
bool QXcbEglIntegration::initialize(QXcbConnection *connection)
{
m_connection = connection;
- m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display()));
+
+ const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+
+ if (extensions && strstr(extensions, "EGL_EXT_platform_x11")) {
+ QEGLStreamConvenience streamFuncs;
+ m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_X11_KHR,
+ xlib_display(),
+ nullptr);
+ }
+
+ if (!m_egl_display)
+ m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display()));
EGLint major, minor;
bool success = eglInitialize(m_egl_display, &major, &minor);
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
index 6d52332bad..6b3f9b171a 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
@@ -4,7 +4,9 @@ include(../gl_integrations_plugin_base.pri)
CONFIG += egl
-contains(QT_CONFIG, xcb-xlib): DEFINES += XCB_USE_XLIB
+qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB
+
+DEFINES += QT_NO_FOREACH
HEADERS += \
qxcbeglcontext.h \
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
index 67fd68765a..d82a1f2d17 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
@@ -4,13 +4,13 @@ include(../gl_integrations_plugin_base.pri)
#should be removed from the sources
DEFINES += XCB_USE_GLX XCB_USE_XLIB
+DEFINES += QT_NO_FOREACH
-LIBS += -lxcb
-
-contains(QT_CONFIG, xcb-glx) {
+qtConfig(xcb-glx) {
DEFINES += XCB_HAS_XCB_GLX
- LIBS += -lxcb-glx
+ QMAKE_USE += xcb_glx
}
+QMAKE_USE += xcb
LIBS += $$QMAKE_LIBS_DYNLOAD
diff --git a/src/plugins/platforms/xcb/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 05107932f9..d577d46b96 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -600,7 +600,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
xcb_extension_t *extensions[] = {
&xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id,
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
&xcb_xkb_id,
#endif
#ifdef XCB_USE_RENDER
@@ -1070,7 +1070,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s)
}
}
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
namespace {
typedef union {
/* All XKB events share these fields. */
@@ -1256,7 +1256,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
s->handleScreenChange(change_event);
}
handled = true;
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
} else if (response_type == xkb_first_event) { // https://bugs.freedesktop.org/show_bug.cgi?id=51295
_xkb_event *xkb_event = reinterpret_cast<_xkb_event *>(event);
if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()) {
@@ -1723,11 +1723,13 @@ void QXcbConnection::processXcbEvents()
compressEvent(event, i, eventqueue))
continue;
+#ifndef QT_NO_CLIPBOARD
bool accepted = false;
if (clipboard()->processIncr())
clipboard()->incrTransactionPeeker(event, accepted);
if (accepted)
continue;
+#endif
auto isWaitingFor = [=](PeekFunc peekFunc) {
// These callbacks return true if the event is what they were
@@ -1777,24 +1779,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"
@@ -2196,7 +2180,7 @@ void QXcbConnection::initializeXShape()
void QXcbConnection::initializeXKB()
{
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id);
if (!reply || !reply->present) {
qWarning("Qt: XKEYBOARD extension not present on the X server.");
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index ebea8d5460..f6ba828a15 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -43,6 +43,7 @@
#include <xcb/xcb.h>
#include <xcb/randr.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include "qxcbexport.h"
#include <QHash>
#include <QList>
@@ -53,10 +54,11 @@
#include <QVarLengthArray>
#include <qpa/qwindowsysteminterface.h>
#include <QtCore/QLoggingCategory>
+#include <QtCore/private/qglobal_p.h>
// This is needed to make Qt compile together with XKB. xkb.h is using a variable
// which is called 'explicit', this is a reserved keyword in c++
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
#define explicit dont_use_cxx_explicit
#include <xcb/xkb.h>
#undef explicit
@@ -448,7 +450,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);
@@ -582,6 +583,8 @@ private:
};
QHash<int, ValuatorClassInfo> valuatorInfo;
};
+ friend class QTypeInfo<TabletData>;
+ friend class QTypeInfo<TabletData::ValuatorClassInfo>;
bool xi2HandleTabletEvent(const void *event, TabletData *tabletData);
void xi2ReportTabletEvent(const void *event, TabletData *tabletData);
QVector<TabletData> m_tabletData;
@@ -684,6 +687,12 @@ private:
friend class QXcbEventReader;
};
+#ifdef XCB_USE_XINPUT2
+#ifndef QT_NO_TABLETEVENT
+Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE);
+Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE);
+#endif
+#endif
#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display()))
#define CREATE_VISUALINFO_FROM_DEFAULT_VISUALID(object) ((XVisualInfo *)(object->connection()->createVisualInfoForDefaultVisualId()))
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index f2824b6d65..1147fc82b2 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -697,7 +697,7 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
if (m_xiGrab) {
// XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2)
// http://lists.x.org/archives/xorg-devel/2014-July/043059.html
-#ifndef LIBXI_MAJOR
+#ifndef XCB_USE_XINPUT2
static bool allowTouchWarningShown = false;
if (!allowTouchWarningShown) {
allowTouchWarningShown = true;
@@ -705,13 +705,16 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
" Minimum libXi version required is 1.7.4."
" Expect issues with touch behavior.");
}
-#elif LIBXI_MAJOR == 1 && (LIBXI_MINOR < 7 || (LIBXI_MINOR == 7 && LIBXI_PATCH < 4))
+#elif QT_LIBRARY_VERSION(xinput2) < QT_VERSION_CHECK(1, 7, 4)
static bool allowTouchWarningShown = false;
if (!allowTouchWarningShown) {
allowTouchWarningShown = true;
qWarning("Skipping XIAllowTouchEvents() due to not having libXi >= 1.7.4."
" libXi version at build time was %d.%d.%d."
- " Expect issues with touch behavior.", LIBXI_MAJOR, LIBXI_MINOR, LIBXI_PATCH);
+ " Expect issues with touch behavior.",
+ QT_LIBRARY_VERSION_MAJOR(xinput2),
+ QT_LIBRARY_VERSION_MINOR(xinput2),
+ QT_LIBRARY_VERSION_PATCH(xinput2));
}
#else
XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid,
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index dd0c557de6..4915bb1b11 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -194,8 +194,10 @@ void QXcbDrag::startDrag()
init();
+#ifndef QT_NO_CLIPBOARD
xcb_set_selection_owner(xcb_connection(), connection()->clipboard()->owner(),
atom(QXcbAtom::XdndSelection), connection()->time());
+#endif
QStringList fmts = QXcbMime::formatsHelper(drag()->mimeData());
for (int i = 0; i < fmts.size(); ++i) {
@@ -205,10 +207,12 @@ void QXcbDrag::startDrag()
drag_types.append(atoms.at(j));
}
}
+#ifndef QT_NO_CLIPBOARD
if (drag_types.size() > 3)
xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(),
atom(QXcbAtom::XdndTypelist),
XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData());
+#endif
setUseCompositing(current_virtual_desktop->compositingActive());
setScreen(current_virtual_desktop->screens().constFirst()->screen());
@@ -447,7 +451,11 @@ void QXcbDrag::move(const QPoint &globalPos)
enter.window = target;
enter.format = 32;
enter.type = atom(QXcbAtom::XdndEnter);
+#ifndef QT_NO_CLIPBOARD
enter.data.data32[0] = connection()->clipboard()->owner();
+#else
+ enter.data.data32[0] = 0;
+#endif
enter.data.data32[1] = flags;
enter.data.data32[2] = drag_types.size()>0 ? drag_types.at(0) : 0;
enter.data.data32[3] = drag_types.size()>1 ? drag_types.at(1) : 0;
@@ -476,7 +484,11 @@ void QXcbDrag::move(const QPoint &globalPos)
move.window = target;
move.format = 32;
move.type = atom(QXcbAtom::XdndPosition);
+#ifndef QT_NO_CLIPBOARD
move.data.data32[0] = connection()->clipboard()->owner();
+#else
+ move.data.data32[0] = 0;
+#endif
move.data.data32[1] = 0; // flags
move.data.data32[2] = (globalPos.x() << 16) + globalPos.y();
move.data.data32[3] = connection()->time();
@@ -505,7 +517,11 @@ void QXcbDrag::drop(const QPoint &globalPos)
drop.window = current_target;
drop.format = 32;
drop.type = atom(QXcbAtom::XdndDrop);
+#ifndef QT_NO_CLIPBOARD
drop.data.data32[0] = connection()->clipboard()->owner();
+#else
+ drop.data.data32[0] = 0;
+#endif
drop.data.data32[1] = 0; // flags
drop.data.data32[2] = connection()->time();
@@ -791,9 +807,11 @@ void QXcbDrag::handle_xdnd_position(QPlatformWindow *w, const xcb_client_message
// reset
target_time = XCB_CURRENT_TIME;
+#ifndef QT_NO_CLIPBOARD
if (xdnd_dragsource == connection()->clipboard()->owner())
handle_xdnd_status(&response);
else
+#endif
Q_XCB_CALL(xcb_send_event(xcb_connection(), false, current_proxy_target,
XCB_EVENT_MASK_NO_EVENT, (const char *)&response));
}
@@ -859,7 +877,11 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event)
void QXcbDrag::handleStatus(const xcb_client_message_event_t *event)
{
- if (event->window != connection()->clipboard()->owner() || !drag())
+ if (
+#ifndef QT_NO_CLIPBOARD
+ event->window != connection()->clipboard()->owner() ||
+#endif
+ !drag())
return;
xcb_client_message_event_t *lastEvent = const_cast<xcb_client_message_event_t *>(event);
@@ -914,7 +936,11 @@ void QXcbDrag::send_leave()
leave.window = current_target;
leave.format = 32;
leave.type = atom(QXcbAtom::XdndLeave);
+#ifndef QT_NO_CLIPBOARD
leave.data.data32[0] = connection()->clipboard()->owner();
+#else
+ leave.data.data32[0] = 0;
+#endif
leave.data.data32[1] = 0; // flags
leave.data.data32[2] = 0; // x, y
leave.data.data32[3] = 0; // w, h
@@ -1006,8 +1032,10 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
void QXcbDrag::handleFinished(const xcb_client_message_event_t *event)
{
DEBUG("xdndHandleFinished");
+#ifndef QT_NO_CLIPBOARD
if (event->window != connection()->clipboard()->owner())
return;
+#endif
const unsigned long *l = (const unsigned long *)event->data.data32;
@@ -1287,11 +1315,13 @@ QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type r
if (a == XCB_NONE)
return result;
+#ifndef QT_NO_CLIPBOARD
if (c->clipboard()->getSelectionOwner(drag->atom(QXcbAtom::XdndSelection)) == XCB_NONE)
return result; // should never happen?
xcb_atom_t xdnd_selection = c->atom(QXcbAtom::XdndSelection);
result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime());
+#endif
return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding);
}
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index f65dbda05d..cb6e95cc9a 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -159,6 +159,7 @@ private:
QPointer<QDrag> drag;
QTime time;
};
+ friend class QTypeInfo<Transaction>;
QVector<Transaction> transactions;
int transaction_expiry_timer;
@@ -167,6 +168,7 @@ private:
int findTransactionByTime(xcb_timestamp_t timestamp);
xcb_window_t findRealWindow(const QPoint & pos, xcb_window_t w, int md, bool ignoreNonXdndAwareWindows);
};
+Q_DECLARE_TYPEINFO(QXcbDrag::Transaction, Q_MOVABLE_TYPE);
#endif // QT_NO_DRAGANDDROP
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 4e4bfad1d6..a5aff7f11f 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -711,7 +711,7 @@ void QXcbKeyboard::updateKeymap()
xkb_keymap = 0;
struct xkb_state *new_state = 0;
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
if (connection()->hasXKB()) {
xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0);
if (xkb_keymap) {
@@ -753,7 +753,7 @@ void QXcbKeyboard::updateKeymap()
checkForLatinLayout();
}
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state)
{
if (m_config && connection()->hasXKB()) {
@@ -1144,7 +1144,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)
, m_hasLatinLayout(false)
{
memset(&xkb_names, 0, sizeof(xkb_names));
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
core_device_id = 0;
if (connection->hasXKB()) {
updateVModMapping();
@@ -1158,7 +1158,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)
#endif
m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
updateModifiers();
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
}
#endif
updateKeymap();
@@ -1177,7 +1177,7 @@ QXcbKeyboard::~QXcbKeyboard()
void QXcbKeyboard::updateVModMapping()
{
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
xcb_xkb_get_names_cookie_t names_cookie;
xcb_xkb_get_names_reply_t *name_reply;
xcb_xkb_get_names_value_list_t names_list;
@@ -1246,7 +1246,7 @@ void QXcbKeyboard::updateVModMapping()
void QXcbKeyboard::updateVModToRModMapping()
{
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
xcb_xkb_get_map_cookie_t map_cookie;
xcb_xkb_get_map_reply_t *map_reply;
xcb_xkb_get_map_map_t map;
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index 18f1aa5732..dfd2926435 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -45,7 +45,7 @@
#include <xcb/xcb_keysyms.h>
#include <xkbcommon/xkbcommon.h>
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
#include <xkbcommon/xkbcommon-x11.h>
#endif
@@ -77,7 +77,7 @@ public:
#ifdef XCB_USE_XINPUT22
void updateXKBStateFromXI(void *modInfo, void *groupInfo);
#endif
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
// when XKEYBOARD is present on the X server
int coreDeviceId() const { return core_device_id; }
void updateXKBState(xcb_xkb_state_notify_event_t *state);
@@ -138,7 +138,7 @@ private:
xkb_mod_index_t mod5;
};
_xkb_mods xkb_mods;
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
// when XKEYBOARD is present on the X server
_mod_masks vmod_masks;
int core_device_id;
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index f7244739a5..f71c5464d0 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -121,9 +121,7 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa
// so QXcbConnection::atomName() has to be used.
if (atomName == QLatin1String("text/uri-list")
&& connection->atomName(a) == "text/x-moz-url") {
- const QByteArray uri = data->split('\n').first();
- QString mozUri = QString::fromLatin1(uri, uri.size());
- mozUri += QLatin1Char('\n');
+ const QString mozUri = QLatin1String(data->split('\n').constFirst()) + QLatin1Char('\n');
*data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()),
mozUri.length() * 2);
} else if (atomName == QLatin1String("application/x-color"))
@@ -175,7 +173,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
// qDebug() << "mimeConvertDataToFormat" << format << atomName << data;
if (!encoding.isEmpty()
- && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) {
+ && atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) {
#ifndef QT_NO_TEXTCODEC
if (requestedType == QVariant::String) {
@@ -212,7 +210,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
if (format == QLatin1String("text/uri-list")) {
const QStringList urls = str.split(QLatin1Char('\n'));
QList<QVariant> list;
- foreach (const QString &s, urls) {
+ for (const QString &s : urls) {
const QUrl url(s.trimmed());
if (url.isValid())
list.append(url);
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index a3e8da7df8..189ec53050 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -85,7 +85,6 @@ static int resourceType(const QByteArray &key)
QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"),
QByteArrayLiteral("rootwindow"),
QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingenabled"),
- QByteArrayLiteral("nofonthinting"),
QByteArrayLiteral("atspibus"),
QByteArrayLiteral("compositingenabled")
};
@@ -242,9 +241,6 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr
case GetTimestamp:
result = getTimestamp(xcbScreen);
break;
- case NoFontHinting:
- result = xcbScreen->noFontHinting() ? this : 0; //qboolptr...
- break;
case RootWindow:
result = reinterpret_cast<void *>(xcbScreen->root());
break;
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index ba19cd869c..8728b6e937 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -73,7 +73,6 @@ public:
RootWindow,
ScreenSubpixelType,
ScreenAntialiasingEnabled,
- NoFontHinting,
AtspiBus,
CompositingEnabled
};
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index dc6846b20b..a9675935f4 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -61,8 +61,7 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
, m_number(number)
, m_xSettings(Q_NULLPTR)
{
- QByteArray cmAtomName("_NET_WM_CM_S");
- cmAtomName += QByteArray::number(m_number);
+ const QByteArray cmAtomName = "_NET_WM_CM_S" + QByteArray::number(m_number);
m_net_wm_cm_atom = connection->internAtom(cmAtomName.constData());
m_compositingActive = connection->getSelectionOwner(m_net_wm_cm_atom);
@@ -188,7 +187,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe
, m_forcedDpi(-1)
, m_pixelDensity(1)
, m_hintStyle(QFontEngine::HintStyle(-1))
- , m_noFontHinting(false)
, m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1))
, m_antialiasingEnabled(-1)
{
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 8716af29b5..0d32c3d624 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -172,7 +172,6 @@ public:
void readXResources();
QFontEngine::HintStyle hintStyle() const { return m_hintStyle; }
- bool noFontHinting() const { return m_noFontHinting; }
QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; }
int antialiasingEnabled() const { return m_antialiasingEnabled; }
@@ -208,7 +207,6 @@ private:
int m_forcedDpi;
int m_pixelDensity;
QFontEngine::HintStyle m_hintStyle;
- bool m_noFontHinting;
QFontEngine::SubpixelAntialiasingType m_subpixelType;
int m_antialiasingEnabled;
};
diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp
index 802e4cfe08..8744fcba3e 100644
--- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp
+++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp
@@ -40,6 +40,8 @@
#include "qxcbsessionmanager.h"
+#ifndef QT_NO_SESSIONMANAGER
+
#include <qguiapplication.h>
#include <qdatetime.h>
#include <qfileinfo.h>
@@ -491,3 +493,5 @@ void QXcbSessionManager::exitEventLoop()
}
#include "qxcbsessionmanager.moc"
+
+#endif
diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.h b/src/plugins/platforms/xcb/qxcbsessionmanager.h
index cba0ab91ad..a184282034 100644
--- a/src/plugins/platforms/xcb/qxcbsessionmanager.h
+++ b/src/plugins/platforms/xcb/qxcbsessionmanager.h
@@ -52,6 +52,8 @@
#include <qpa/qplatformsessionmanager.h>
+#ifndef QT_NO_SESSIONMANAGER
+
QT_BEGIN_NAMESPACE
class QEventLoop;
@@ -89,4 +91,6 @@ private:
QT_END_NAMESPACE
+#endif //QT_NO_SESSIONMANAGER
+
#endif //QXCBSESSIONMANAGER_H
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 8b13a90d74..c81858c408 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -119,6 +119,8 @@ enum {
QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(xcb_rectangle_t, Q_PRIMITIVE_TYPE);
+
#undef FocusIn
enum QX11EmbedFocusInDetail {
@@ -256,6 +258,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
free_prop = true;
}
+#ifndef QT_NO_TEXTCODEC
static const QTextCodec* mapper = QTextCodec::codecForLocale();
int errCode = 0;
if (mapper) {
@@ -279,6 +282,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
tp.nitems = qcs.length();
free_prop = false;
}
+#endif
return &tp;
}
#endif // XCB_USE_XLIB
@@ -2839,9 +2843,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-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro
index 75684a769b..d7f150f276 100644
--- a/src/plugins/platforms/xcb/xcb-plugin.pro
+++ b/src/plugins/platforms/xcb/xcb-plugin.pro
@@ -2,6 +2,8 @@ TARGET = qxcb
QT += core-private gui-private platformsupport-private xcb_qpa_lib-private
+DEFINES += QT_NO_FOREACH
+
SOURCES = \
qxcbmain.cpp
OTHER_FILES += xcb.json README
diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro
index 5915a59c0b..0d27645a60 100644
--- a/src/plugins/platforms/xcb/xcb.pro
+++ b/src/plugins/platforms/xcb/xcb.pro
@@ -1,7 +1,8 @@
TEMPLATE = subdirs
CONFIG += ordered
+QT_FOR_CONFIG += gui-private
-contains(QT_CONFIG, xcb-qt):SUBDIRS+=xcb-static
+!qtConfig(system-xcb): SUBDIRS += xcb-static
SUBDIRS += xcb_qpa_lib.pro
SUBDIRS += xcb-plugin.pro
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index 9ca8872cb2..ec0fa68871 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -1,5 +1,6 @@
TARGET = QtXcbQpa
CONFIG += no_module_headers internal_module
+DEFINES += QT_NO_FOREACH
QT += core-private gui-private platformsupport-private
@@ -42,67 +43,58 @@ load(qt_build_paths)
DEFINES += QT_BUILD_XCB_PLUGIN
# needed by Xcursor ...
-contains(QT_CONFIG, xcb-xlib) {
+qtConfig(xcb-xlib) {
DEFINES += XCB_USE_XLIB
- LIBS += -lX11 -lX11-xcb
+ QMAKE_USE += xcb_xlib
- contains(QT_CONFIG, xinput2) {
+ qtConfig(xinput2) {
DEFINES += XCB_USE_XINPUT2
SOURCES += qxcbconnection_xi2.cpp
- LIBS += -lXi
- !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
- DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
- LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
- LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
- }
+ QMAKE_USE += xinput2
}
}
-# to support custom cursors with depth > 1
-contains(QT_CONFIG, xcb-render) {
- DEFINES += XCB_USE_RENDER
- LIBS += -lxcb-render -lxcb-render-util
-}
-
# build with session management support
-contains(QT_CONFIG, xcb-sm) {
+qtConfig(xcb-sm) {
DEFINES += XCB_USE_SM
- LIBS += -lSM -lICE
+ QMAKE_USE += x11sm
SOURCES += qxcbsessionmanager.cpp
HEADERS += qxcbsessionmanager.h
}
include(gl_integrations/gl_integrations.pri)
-DEFINES += $$QMAKE_DEFINES_XCB
-LIBS += $$QMAKE_LIBS_XCB
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
-QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
-
CONFIG += qpa/genericunixfontdatabase
-contains(QT_CONFIG, dbus-linked) {
+qtConfig(dbus-linked): \
QT += dbus
- LIBS += $$QT_LIBS_DBUS
-}
-contains(QT_CONFIG, xcb-qt) {
+!qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
XCB_DIR = ../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
- LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ QMAKE_USE += xcb
} else {
- LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms -lxcb-xinerama
- !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
+ LIBS += -lxcb-xinerama ### there is no configure test for this!
+ qtConfig(xkb): QMAKE_USE += xcb_xkb
+ # to support custom cursors with depth > 1
+ qtConfig(xcb-render) {
+ DEFINES += XCB_USE_RENDER
+ QMAKE_USE += xcb_render
+ }
+ QMAKE_USE += xcb_syslibs
}
# libxkbcommon
-contains(QT_CONFIG, xkbcommon-qt) {
- QT_CONFIG += use-xkbcommon-x11support
- include(../../../3rdparty/xkbcommon.pri)
+!qtConfig(xkbcommon-system) {
+ qtConfig(xkb) {
+ include(../../../3rdparty/xkbcommon-x11.pri)
+ } else {
+ include(../../../3rdparty/xkbcommon.pri)
+ }
} else {
- LIBS += $$QMAKE_LIBS_XKBCOMMON
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+ QMAKE_USE += xkbcommon
}
load(qt_module)
diff --git a/src/plugins/platformthemes/gtk3/gtk3.pro b/src/plugins/platformthemes/gtk3/gtk3.pro
index cd19e73ed8..12364b0b57 100644
--- a/src/plugins/platformthemes/gtk3/gtk3.pro
+++ b/src/plugins/platformthemes/gtk3/gtk3.pro
@@ -8,14 +8,15 @@ load(qt_plugin)
QT += core-private gui-private platformsupport-private
CONFIG += X11
-QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTK3
-LIBS += $$QT_LIBS_QGTK3
+QMAKE_USE += gtk3
HEADERS += \
qgtk3dialoghelpers.h \
+ qgtk3menu.h \
qgtk3theme.h
SOURCES += \
main.cpp \
qgtk3dialoghelpers.cpp \
+ qgtk3menu.cpp \
qgtk3theme.cpp
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
index c2a116b03c..42d3c1f193 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
@@ -416,6 +416,9 @@ void QGtk3FileDialogHelper::applyOptions()
const bool confirmOverwrite = !opts->testOption(QFileDialogOptions::DontConfirmOverwrite);
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(gtkDialog), confirmOverwrite);
+ const bool readOnly = opts->testOption(QFileDialogOptions::ReadOnly);
+ gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(gtkDialog), !readOnly);
+
const QStringList nameFilters = opts->nameFilters();
if (!nameFilters.isEmpty())
setNameFilters(nameFilters);
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
new file mode 100644
index 0000000000..52757587b4
--- /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/platformthemes/platformthemes.pro b/src/plugins/platformthemes/platformthemes.pro
index f5f54068a2..0e2812bed3 100644
--- a/src/plugins/platformthemes/platformthemes.pro
+++ b/src/plugins/platformthemes/platformthemes.pro
@@ -1,3 +1,4 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += widgets-private
-contains(QT_CONFIG, gtk3): SUBDIRS += gtk3
+qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 0f4207c636..941c25361f 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,14 +1,13 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += network
-load(qfeatures)
SUBDIRS *= sqldrivers
-qtHaveModule(network):!contains(QT_DISABLED_FEATURES, bearermanagement): SUBDIRS += bearer
+qtHaveModule(network):qtConfig(bearermanagement): SUBDIRS += bearer
qtHaveModule(gui) {
SUBDIRS *= platforms platforminputcontexts platformthemes
- !contains(QT_DISABLED_FEATURES, imageformatplugin): SUBDIRS *= imageformats
- !android:!contains(QT_DISABLED_FEATURES, library): SUBDIRS *= generic
+ qtConfig(imageformatplugin): SUBDIRS *= imageformats
+ !android:qtConfig(library): SUBDIRS *= generic
}
-!winrt:!wince*:qtHaveModule(widgets):!contains(QT_DISABLED_FEATURES, printer) {
+!winrt:!wince:qtHaveModule(printsupport): \
SUBDIRS += printsupport
-}
diff --git a/src/plugins/printsupport/cups/cups.pro b/src/plugins/printsupport/cups/cups.pro
index 757408e7f7..58bc11606b 100644
--- a/src/plugins/printsupport/cups/cups.pro
+++ b/src/plugins/printsupport/cups/cups.pro
@@ -3,7 +3,7 @@ MODULE = cupsprintersupport
QT += core-private gui-private printsupport printsupport-private
-LIBS_PRIVATE += -lcups
+QMAKE_USE_PRIVATE += cups
INCLUDEPATH += ../../../printsupport/kernel
diff --git a/src/plugins/printsupport/printsupport.pro b/src/plugins/printsupport/printsupport.pro
index bd6681f53c..05cf1bc0b2 100644
--- a/src/plugins/printsupport/printsupport.pro
+++ b/src/plugins/printsupport/printsupport.pro
@@ -1,8 +1,6 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += printsupport-private
osx: SUBDIRS += cocoa
win32: SUBDIRS += windows
-unix:!mac:contains(QT_CONFIG, cups) {
- load(qfeatures)
- !contains(QT_DISABLED_FEATURES, cups): SUBDIRS += cups
-}
+unix:!darwin:qtConfig(cups): SUBDIRS += cups
diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro
index 2365c5bc0e..eef65fac66 100644
--- a/src/plugins/sqldrivers/db2/db2.pro
+++ b/src/plugins/sqldrivers/db2/db2.pro
@@ -1,8 +1,11 @@
TARGET = qsqldb2
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_db2_p.h
+SOURCES += $$PWD/qsql_db2.cpp $$PWD/main.cpp
+
+QMAKE_USE += db2
+
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..9408f464e0 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
@@ -1665,7 +1665,8 @@ QString QDB2Driver::formatValue(const QSqlField &field, bool trimStrings) const
}
case QVariant::ByteArray: {
QByteArray ba = field.value().toByteArray();
- QString res = QString::fromLatin1("BLOB(X'");
+ QString res;
+ res += QLatin1String("BLOB(X'");
static const char hexchars[] = "0123456789abcdef";
for (int i = 0; i < ba.size(); ++i) {
uchar s = (uchar) ba[i];
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..e5709207d1 100644
--- a/src/plugins/sqldrivers/ibase/ibase.pro
+++ b/src/plugins/sqldrivers/ibase/ibase.pro
@@ -1,8 +1,12 @@
TARGET = qsqlibase
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_ibase_p.h
+SOURCES += $$PWD/qsql_ibase.cpp $$PWD/main.cpp
+
+# FIXME: ignores libfb (unix)/fbclient (win32) - but that's for the test anyway
+QMAKE_USE += ibase
+
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..56dd5f598c 100644
--- a/src/plugins/sqldrivers/mysql/mysql.pro
+++ b/src/plugins/sqldrivers/mysql/mysql.pro
@@ -1,8 +1,11 @@
TARGET = qsqlmysql
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_mysql_p.h
+SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
+
+QMAKE_USE += mysql
+
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 f6b2e74986..eb2bddd0bd 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -1421,8 +1421,13 @@ bool QMYSQLDriver::open(const QString& db,
}
#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007
- // force the communication to be utf8
- mysql_set_character_set(d->mysql, "utf8");
+ if (mysql_get_client_version() >= 50503 && mysql_get_server_version(d->mysql) >= 50503) {
+ // force the communication to be utf8mb4 (only utf8mb4 supports 4-byte characters)
+ mysql_set_character_set(d->mysql, "utf8mb4");
+ } else {
+ // force the communication to be utf8
+ mysql_set_character_set(d->mysql, "utf8");
+ }
#endif
#ifndef QT_NO_TEXTCODEC
d->tc = codec(d->mysql);
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..e6ef71f20f 100644
--- a/src/plugins/sqldrivers/oci/oci.pro
+++ b/src/plugins/sqldrivers/oci/oci.pro
@@ -1,8 +1,13 @@
TARGET = qsqloci
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_oci_p.h
+SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp
+
+QMAKE_USE += oci
+
+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..17844f27d2 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -1,8 +1,12 @@
TARGET = qsqlodbc
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_odbc_p.h
+SOURCES += $$PWD/qsql_odbc.cpp $$PWD/main.cpp
+
+QMAKE_USE += odbc
+unix: DEFINES += UNICODE
+
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..c44a6319c3 100644
--- a/src/plugins/sqldrivers/psql/psql.pro
+++ b/src/plugins/sqldrivers/psql/psql.pro
@@ -1,8 +1,11 @@
TARGET = qsqlpsql
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_psql_p.h
+SOURCES += $$PWD/qsql_psql.cpp $$PWD/main.cpp
+
+QMAKE_USE += psql
+
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..968b71a27d 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -704,10 +704,10 @@ void QPSQLDriverPrivate::detectBackslashEscape()
hasBackslashEscape = true;
} else {
hasBackslashEscape = false;
- PGresult* result = exec(QLatin1Literal("SELECT '\\\\' x"));
+ PGresult* result = exec(QLatin1String("SELECT '\\\\' x"));
int status = PQresultStatus(result);
if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK)
- if (QString::fromLatin1(PQgetvalue(result, 0, 0)) == QLatin1Literal("\\"))
+ if (QString::fromLatin1(PQgetvalue(result, 0, 0)) == QLatin1String("\\"))
hasBackslashEscape = true;
PQclear(result);
}
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..30fb6019ce 100644
--- a/src/plugins/sqldrivers/sqldrivers.pro
+++ b/src/plugins/sqldrivers/sqldrivers.pro
@@ -1,11 +1,12 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += sql
-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
+qtConfig(sql-psql) : SUBDIRS += psql
+qtConfig(sql-mysql) : SUBDIRS += mysql
+qtConfig(sql-odbc) : SUBDIRS += odbc
+qtConfig(sql-tds) : SUBDIRS += tds
+qtConfig(sql-oci) : SUBDIRS += oci
+qtConfig(sql-db2) : SUBDIRS += db2
+qtConfig(sql-sqlite) : SUBDIRS += sqlite
+qtConfig(sql-sqlite2) : SUBDIRS += sqlite2
+qtConfig(sql-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..1066bf7f51 100644
--- a/src/plugins/sqldrivers/sqlite/sqlite.pro
+++ b/src/plugins/sqldrivers/sqlite/sqlite.pro
@@ -1,8 +1,17 @@
TARGET = qsqlite
-SOURCES = smain.cpp
+QT_FOR_CONFIG += sql-private
+
+HEADERS += $$PWD/qsql_sqlite_p.h
+SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp
+
+qtConfig(system-sqlite) {
+ QMAKE_USE += sqlite
+} else {
+ include($$PWD/../../../3rdparty/sqlite.pri)
+}
+
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..721facb5b8 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
+
+QMAKE_USE += sqlite2
+
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..940fd05c74 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/plugins/sqldrivers/tds/qsql_tds.cpp
@@ -163,7 +163,7 @@ class QTDSResult : public QSqlCachedResult
public:
explicit QTDSResult(const QTDSDriver* db);
~QTDSResult();
- QVariant handle() const;
+ QVariant handle() const Q_DECL_OVERRIDE;
protected:
void cleanup();
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..67bc0f5c48 100644
--- a/src/plugins/sqldrivers/tds/tds.pro
+++ b/src/plugins/sqldrivers/tds/tds.pro
@@ -1,8 +1,11 @@
TARGET = qsqltds
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_tds_p.h
+SOURCES += $$PWD/qsql_tds.cpp $$PWD/main.cpp
+
+QMAKE_USE += tds
+
OTHER_FILES += tds.json
-include(../../../sql/drivers/tds/qsql_tds.pri)
PLUGIN_CLASS_NAME = QTDSDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json
new file mode 100644
index 0000000000..439f2dbdd8
--- /dev/null
+++ b/src/printsupport/configure.json
@@ -0,0 +1,72 @@
+{
+ "module": "printsupport",
+ "depends": [
+ "core",
+ "gui",
+ "widgets"
+ ],
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "options": {
+ "cups": "boolean"
+ }
+ },
+
+ "libraries": {
+ "cups": {
+ "label": "CUPS",
+ "test": "unix/cups",
+ "sources": [
+ "-lcups"
+ ]
+ }
+ },
+
+ "features": {
+ "cups": {
+ "label": "CUPS",
+ "purpose": "Provides support for the Common Unix Printing System.",
+ "section": "Painting",
+ "condition": "libs.cups",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "printer": {
+ "label": "QPrinter",
+ "purpose": "Provides a printer backend of QPainter.",
+ "section": "Painting",
+ "condition": "!config.android && !config.uikit && !config.winrt && features.picture && features.temporaryfile && features.pdf",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "printpreviewwidget": {
+ "label": "QPrintPreviewWidget",
+ "purpose": "Provides a widget for previewing page layouts for printer output.",
+ "section": "Widgets",
+ "condition": "features.graphicsview && features.printer && features.mainwindow",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "printdialog": {
+ "label": "QPrintDialog",
+ "purpose": "Provides a dialog widget for specifying printer configuration.",
+ "section": "Dialogs",
+ "condition": "features.printer && features.combobox && features.buttongroup && features.spinbox && features.treeview && features.tabwidget",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "printpreviewdialog": {
+ "label": "QPrintPreviewDialog",
+ "purpose": "Provides a dialog for previewing and configuring page layouts for printer output.",
+ "section": "Dialogs",
+ "condition": "features.printpreviewwidget && features.printdialog && features.toolbar",
+ "output": [ "publicFeature", "feature" ]
+ }
+ },
+
+ "summary": [
+ {
+ "section": "Qt PrintSupport",
+ "entries": [
+ "cups"
+ ]
+ }
+ ]
+}
diff --git a/src/printsupport/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h
index 8ce3687272..e8eee2ca9c 100644
--- a/src/printsupport/dialogs/qabstractprintdialog.h
+++ b/src/printsupport/dialogs/qabstractprintdialog.h
@@ -40,8 +40,8 @@
#ifndef QABSTRACTPRINTDIALOG_H
#define QABSTRACTPRINTDIALOG_H
-#include <QtWidgets/qdialog.h>
#include <QtPrintSupport/qtprintsupportglobal.h>
+#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
diff --git a/src/printsupport/dialogs/qabstractprintdialog_p.h b/src/printsupport/dialogs/qabstractprintdialog_p.h
index 977c720cd0..fe4e18cfc3 100644
--- a/src/printsupport/dialogs/qabstractprintdialog_p.h
+++ b/src/printsupport/dialogs/qabstractprintdialog_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include "private/qdialog_p.h"
#ifndef QT_NO_PRINTDIALOG
diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h
index fa8f6b7fad..124d215700 100644
--- a/src/printsupport/dialogs/qpagesetupdialog.h
+++ b/src/printsupport/dialogs/qpagesetupdialog.h
@@ -40,8 +40,8 @@
#ifndef QPAGESETUPDIALOG_H
#define QPAGESETUPDIALOG_H
-#include <QtWidgets/qdialog.h>
#include <QtPrintSupport/qtprintsupportglobal.h>
+#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
diff --git a/src/printsupport/dialogs/qpagesetupdialog_p.h b/src/printsupport/dialogs/qpagesetupdialog_p.h
index 4f803ae234..46e178fef9 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_p.h
+++ b/src/printsupport/dialogs/qpagesetupdialog_p.h
@@ -52,6 +52,7 @@
//
//
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include "private/qdialog_p.h"
#ifndef QT_NO_PRINTDIALOG
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
index c35ad761f4..3c9733dd83 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
@@ -51,7 +51,7 @@
//
//
-#include "qglobal.h"
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTDIALOG
diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h
index 36187b28d6..a1d79b2310 100644
--- a/src/printsupport/dialogs/qprintdialog.h
+++ b/src/printsupport/dialogs/qprintdialog.h
@@ -40,6 +40,7 @@
#ifndef QPRINTDIALOG_H
#define QPRINTDIALOG_H
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <QtPrintSupport/qabstractprintdialog.h>
QT_BEGIN_NAMESPACE
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 9b08ffe4df..4d8299b115 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qplatformdefs.h"
+#include <QtPrintSupport/qtprintsupportglobal.h>
#ifndef QT_NO_PRINTDIALOG
diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp
index 93d09bc745..2e954a508d 100644
--- a/src/printsupport/dialogs/qprintdialog_win.cpp
+++ b/src/printsupport/dialogs/qprintdialog_win.cpp
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <QtPrintSupport/qtprintsupportglobal.h>
+
#ifndef QT_NO_PRINTDIALOG
#include "qprintdialog.h"
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp
index 435f8869c4..c996e0d556 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.cpp
+++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp
@@ -334,7 +334,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
QString caption = QCoreApplication::translate("QPrintPreviewDialog", "Print Preview");
if (!printer->docName().isEmpty())
- caption += QString::fromLatin1(": ") + printer->docName();
+ caption += QLatin1String(": ") + printer->docName();
q->setWindowTitle(caption);
if (!printer->isValid()
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.h b/src/printsupport/dialogs/qprintpreviewdialog.h
index 0d2b3a523c..903083167c 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.h
+++ b/src/printsupport/dialogs/qprintpreviewdialog.h
@@ -40,8 +40,8 @@
#ifndef QPRINTPREVIEWDIALOG_H
#define QPRINTPREVIEWDIALOG_H
-#include <QtWidgets/qdialog.h>
#include <QtPrintSupport/qtprintsupportglobal.h>
+#include <QtWidgets/qdialog.h>
#ifndef QT_NO_PRINTPREVIEWDIALOG
diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri
index cbbb14342a..22d12e4cc3 100644
--- a/src/printsupport/kernel/kernel.pri
+++ b/src/printsupport/kernel/kernel.pri
@@ -11,6 +11,7 @@ HEADERS += \
$$PWD/qplatformprintdevice.h \
$$PWD/qplatformprintplugin.h \
$$PWD/qplatformprintersupport.h \
+ $$PWD/qtprintsupportglobal_p.h \
$$PWD/qtprintsupportglobal.h
SOURCES += \
@@ -32,7 +33,7 @@ win32 {
LIBS_PRIVATE += -lwinspool -lcomdlg32 -lgdi32 -luser32
}
-unix:!mac:contains(QT_CONFIG, cups): {
+unix:!darwin:qtConfig(cups) {
SOURCES += $$PWD/qcups.cpp
HEADERS += $$PWD/qcups_p.h
}
diff --git a/src/printsupport/kernel/qcups_p.h b/src/printsupport/kernel/qcups_p.h
index 6045ddbaa5..139b18c509 100644
--- a/src/printsupport/kernel/qcups_p.h
+++ b/src/printsupport/kernel/qcups_p.h
@@ -50,6 +50,8 @@
//
// We mean it.
//
+
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include "QtCore/qstring.h"
#include "QtCore/qstringlist.h"
#include "QtPrintSupport/qprinter.h"
diff --git a/src/printsupport/kernel/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp
index 939322cc07..cae5c2f522 100644
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <qglobal.h>
+#include <qtprintsupportglobal.h>
#ifndef QT_NO_PRINTER
#include <qdebug.h>
diff --git a/src/printsupport/kernel/qpaintengine_alpha_p.h b/src/printsupport/kernel/qpaintengine_alpha_p.h
index bc3dbfabbf..b5ba98bf88 100644
--- a/src/printsupport/kernel/qpaintengine_alpha_p.h
+++ b/src/printsupport/kernel/qpaintengine_alpha_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTER
#include "private/qpaintengine_p.h"
diff --git a/src/printsupport/kernel/qpaintengine_preview_p.h b/src/printsupport/kernel/qpaintengine_preview_p.h
index 6eb4daae7c..6277451bfa 100644
--- a/src/printsupport/kernel/qpaintengine_preview_p.h
+++ b/src/printsupport/kernel/qpaintengine_preview_p.h
@@ -52,6 +52,7 @@
//
//
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include <QtGui/qpaintengine.h>
#include <QtPrintSupport/qprintengine.h>
diff --git a/src/printsupport/kernel/qplatformprintdevice.h b/src/printsupport/kernel/qplatformprintdevice.h
index 6460d2f596..44a3a966f4 100644
--- a/src/printsupport/kernel/qplatformprintdevice.h
+++ b/src/printsupport/kernel/qplatformprintdevice.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <private/qprint_p.h>
#include <QtCore/qvector.h>
diff --git a/src/printsupport/kernel/qplatformprintersupport.h b/src/printsupport/kernel/qplatformprintersupport.h
index 779b7dd8a1..d3da4295a1 100644
--- a/src/printsupport/kernel/qplatformprintersupport.h
+++ b/src/printsupport/kernel/qplatformprintersupport.h
@@ -48,6 +48,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <QtPrintSupport/qprinter.h>
#include <QtCore/qstringlist.h>
diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp
index b50f43056b..9bc4b61829 100644
--- a/src/printsupport/kernel/qplatformprintplugin.cpp
+++ b/src/printsupport/kernel/qplatformprintplugin.cpp
@@ -43,6 +43,8 @@
#include "private/qfactoryloader_p.h"
#include <qcoreapplication.h>
+#ifndef QT_NO_PRINTER
+
QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
@@ -86,3 +88,5 @@ QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get()
}
QT_END_NAMESPACE
+
+#endif
diff --git a/src/printsupport/kernel/qplatformprintplugin.h b/src/printsupport/kernel/qplatformprintplugin.h
index 69cb55b4d9..30e8f7938a 100644
--- a/src/printsupport/kernel/qplatformprintplugin.h
+++ b/src/printsupport/kernel/qplatformprintplugin.h
@@ -49,9 +49,11 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
-#include <QtPrintSupport/qtprintsupportglobal.h>
+
+#ifndef QT_NO_PRINTER
QT_BEGIN_NAMESPACE
@@ -74,4 +76,6 @@ public:
QT_END_NAMESPACE
+#endif
+
#endif // QPLATFORMPRINTPLUGIN_H
diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h
index ed9e8e272b..47dfce3787 100644
--- a/src/printsupport/kernel/qprint_p.h
+++ b/src/printsupport/kernel/qprint_p.h
@@ -51,12 +51,13 @@
// We mean it.
//
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include <QtPrintSupport/qprinter.h>
#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 +245,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/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h
index b4173b50b1..1e0d3983e9 100644
--- a/src/printsupport/kernel/qprintdevice_p.h
+++ b/src/printsupport/kernel/qprintdevice_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include "private/qprint_p.h"
#include <QtCore/qsharedpointer.h>
diff --git a/src/printsupport/kernel/qprintengine.h b/src/printsupport/kernel/qprintengine.h
index bb8749c113..698f7548cf 100644
--- a/src/printsupport/kernel/qprintengine.h
+++ b/src/printsupport/kernel/qprintengine.h
@@ -40,6 +40,7 @@
#ifndef QPRINTENGINE_H
#define QPRINTENGINE_H
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <QtCore/qvariant.h>
#include <QtPrintSupport/qprinter.h>
diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp
index ed0422468d..278bb044e1 100644
--- a/src/printsupport/kernel/qprintengine_pdf.cpp
+++ b/src/printsupport/kernel/qprintengine_pdf.cpp
@@ -150,7 +150,7 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
else
d->m_pageLayout.setMode(QPageLayout::StandardMode);
break;
- case PPK_CopyCount: // fallthrough
+ case PPK_CopyCount:
case PPK_NumberOfCopies:
d->copies = value.toInt();
break;
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index dd2bf3a0a3..706a7c4b02 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -37,6 +37,8 @@
**
****************************************************************************/
+#include <QtPrintSupport/qtprintsupportglobal.h>
+
#ifndef QT_NO_PRINTER
#include "qprintengine_win_p.h"
@@ -1141,7 +1143,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
#endif // QT_DEBUG_METRICS
break;
- case PPK_CopyCount: // fallthrough
+ case PPK_CopyCount:
case PPK_NumberOfCopies:
if (!d->devMode)
break;
@@ -1719,7 +1721,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();
@@ -1731,7 +1732,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
@@ -1784,11 +1784,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/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h
index b436f5c9b0..196263df74 100644
--- a/src/printsupport/kernel/qprintengine_win_p.h
+++ b/src/printsupport/kernel/qprintengine_win_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTER
diff --git a/src/printsupport/kernel/qprinter.h b/src/printsupport/kernel/qprinter.h
index d5c63dbf2c..4650d5432a 100644
--- a/src/printsupport/kernel/qprinter.h
+++ b/src/printsupport/kernel/qprinter.h
@@ -40,11 +40,11 @@
#ifndef QPRINTER_H
#define QPRINTER_H
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qscopedpointer.h>
#include <QtGui/qpagedpaintdevice.h>
#include <QtGui/qpagelayout.h>
-#include <QtPrintSupport/qtprintsupportglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h
index d3b869077e..18dfad926c 100644
--- a/src/printsupport/kernel/qprinter_p.h
+++ b/src/printsupport/kernel/qprinter_p.h
@@ -52,7 +52,7 @@
//
-#include "QtCore/qglobal.h"
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTER
diff --git a/src/printsupport/kernel/qprinterinfo.h b/src/printsupport/kernel/qprinterinfo.h
index ed22efc503..8bac395ab3 100644
--- a/src/printsupport/kernel/qprinterinfo.h
+++ b/src/printsupport/kernel/qprinterinfo.h
@@ -40,6 +40,7 @@
#ifndef QPRINTERINFO_H
#define QPRINTERINFO_H
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <QtPrintSupport/qprinter.h>
#include <QtCore/QList>
diff --git a/src/printsupport/kernel/qprinterinfo_p.h b/src/printsupport/kernel/qprinterinfo_p.h
index 5d883d54db..727457a959 100644
--- a/src/printsupport/kernel/qprinterinfo_p.h
+++ b/src/printsupport/kernel/qprinterinfo_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#ifndef QT_NO_PRINTER
diff --git a/src/printsupport/kernel/qtprintsupportglobal.h b/src/printsupport/kernel/qtprintsupportglobal.h
index 3772cd23b4..67779af5a2 100644
--- a/src/printsupport/kernel/qtprintsupportglobal.h
+++ b/src/printsupport/kernel/qtprintsupportglobal.h
@@ -40,7 +40,8 @@
#ifndef QTPRINTSUPPORTGLOBAL_H
#define QTPRINTSUPPORTGLOBAL_H
-#include <QtCore/qglobal.h>
+#include <QtWidgets/qtwidgetsglobal.h>
+#include <QtPrintSupport/qtprintsupport-config.h>
QT_BEGIN_NAMESPACE
diff --git a/src/printsupport/kernel/qtprintsupportglobal_p.h b/src/printsupport/kernel/qtprintsupportglobal_p.h
new file mode 100644
index 0000000000..2f6b924ed0
--- /dev/null
+++ b/src/printsupport/kernel/qtprintsupportglobal_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtPrintSupport 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 QTPRINTSUPPORTGLOBAL_P_H
+#define QTPRINTSUPPORTGLOBAL_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 <QtPrintSupport/qtprintsupportglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
+
+#endif // QTPRINTSUPPORTGLOBAL_P_H
diff --git a/src/printsupport/widgets/qcupsjobwidget_p.h b/src/printsupport/widgets/qcupsjobwidget_p.h
index 26fc644f65..5320818f30 100644
--- a/src/printsupport/widgets/qcupsjobwidget_p.h
+++ b/src/printsupport/widgets/qcupsjobwidget_p.h
@@ -53,12 +53,13 @@
//
//
-#include <ui_qcupsjobwidget.h>
+#include <QtPrintSupport/private/qtprintsupportglobal_p.h>
#include <private/qcups_p.h>
-QT_BEGIN_NAMESPACE
-
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_CUPS)
+#include <ui_qcupsjobwidget.h>
+
+QT_BEGIN_NAMESPACE
class QString;
class QTime;
@@ -106,8 +107,8 @@ private:
Q_DISABLE_COPY(QCupsJobWidget)
};
-#endif // QT_NO_PRINTER / QT_NO_CUPS
-
QT_END_NAMESPACE
+#endif // QT_NO_PRINTER / QT_NO_CUPS
+
#endif // QCUPSJOBWIDGET_P_H
diff --git a/src/printsupport/widgets/qprintpreviewwidget.h b/src/printsupport/widgets/qprintpreviewwidget.h
index bc4dd59ea5..dec7092eb1 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.h
+++ b/src/printsupport/widgets/qprintpreviewwidget.h
@@ -40,6 +40,7 @@
#ifndef QPRINTPREVIEWWIDGET_H
#define QPRINTPREVIEWWIDGET_H
+#include <QtPrintSupport/qtprintsupportglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtPrintSupport/qprinter.h>
diff --git a/src/printsupport/widgets/widgets.pri b/src/printsupport/widgets/widgets.pri
index 8e5cb12a6d..8a98da1718 100644
--- a/src/printsupport/widgets/widgets.pri
+++ b/src/printsupport/widgets/widgets.pri
@@ -1,7 +1,7 @@
HEADERS += widgets/qprintpreviewwidget.h
SOURCES += widgets/qprintpreviewwidget.cpp
-unix:!mac:contains(QT_CONFIG, cups): {
+unix:!darwin:qtConfig(cups) {
HEADERS += widgets/qcupsjobwidget_p.h
SOURCES += widgets/qcupsjobwidget.cpp
FORMS += widgets/qcupsjobwidget.ui
diff --git a/src/sql/configure.json b/src/sql/configure.json
new file mode 100644
index 0000000000..5476d419ed
--- /dev/null
+++ b/src/sql/configure.json
@@ -0,0 +1,201 @@
+{
+ "module": "sql",
+ "depends": [
+ "core"
+ ],
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "assignments": {
+ "MYSQL_PATH": "mysql.prefix",
+ "PSQL_LIBS": "psql.libs",
+ "SYBASE": "tds.prefix",
+ "SYBASE_LIBS": "tds.libs"
+ },
+ "options": {
+ "mysql_config": "string",
+ "psql_config": "string",
+ "sqlite": { "type": "enum", "name": "system-sqlite", "values": { "qt": "no", "system": "yes" } },
+ "sql-db2": "boolean",
+ "sql-ibase": "boolean",
+ "sql-mysql": "boolean",
+ "sql-oci": "boolean",
+ "sql-odbc": "boolean",
+ "sql-psql": "boolean",
+ "sql-sqlite": "boolean",
+ "sql-sqlite2": "boolean",
+ "sql-tds": "boolean",
+ "plugin-sql-db2": { "type": "void", "name": "sql-db2" },
+ "plugin-sql-ibase": { "type": "void", "name": "sql-ibase" },
+ "plugin-sql-mysql": { "type": "void", "name": "sql-mysql" },
+ "plugin-sql-oci": { "type": "void", "name": "sql-oci" },
+ "plugin-sql-odbc": { "type": "void", "name": "sql-odbc" },
+ "plugin-sql-psql": { "type": "void", "name": "sql-psql" },
+ "plugin-sql-sqlite": { "type": "void", "name": "sql-sqlite" },
+ "plugin-sql-sqlite2": { "type": "void", "name": "sql-sqlite2" },
+ "plugin-sql-tds": { "type": "void", "name": "sql-tds" }
+ }
+ },
+
+ "libraries": {
+ "db2": {
+ "label": "DB2 (IBM)",
+ "test": "unix/db2",
+ "sources": [
+ { "libs": "-ldb2cli", "condition": "config.win32" },
+ { "libs": "-ldb2", "condition": "!config.win32" }
+ ]
+ },
+ "ibase": {
+ "label": "InterBase",
+ "test": "unix/ibase",
+ "sources": [
+ { "libs": "-lgds32_ms", "condition": "config.win32" },
+ { "libs": "-lgds", "condition": "!config.win32" }
+ ]
+ },
+ "mysql": {
+ "label": "MySQL",
+ "test": "unix/mysql",
+ "sources": [
+ { "type": "mysqlConfig", "query": "--libs_r" },
+ { "type": "mysqlConfig", "query": "--libs" },
+ { "libs": "-lmysqlclient_r", "condition": "!config.win32" },
+ { "libs": "-llibmysql", "condition": "config.win32" },
+ { "libs": "-lmysqlclient", "condition": "!config.win32" }
+ ]
+ },
+ "psql": {
+ "label": "PostgreSQL",
+ "test": "unix/psql",
+ "sources": [
+ { "type": "psqlConfig" },
+ { "type": "psqlEnv", "libs": "-llibpq -lws2_32 -ladvapi32", "condition": "config.win32" },
+ { "type": "psqlEnv", "libs": "-lpq", "condition": "!config.win32" }
+ ]
+ },
+ "tds": {
+ "label": "TDS (Sybase)",
+ "test": "unix/tds",
+ "sources": [
+ { "type": "sybaseEnv", "libs": "-lNTWDBLIB", "condition": "config.win32" },
+ { "type": "sybaseEnv", "libs": "-lsybdb", "condition": "!config.win32" }
+ ]
+ },
+ "oci": {
+ "label": "OCI (Oracle)",
+ "test": "unix/oci",
+ "sources": [
+ { "libs": "-loci", "condition": "config.win32" },
+ { "libs": "-lclntsh", "condition": "!config.win32" }
+ ]
+ },
+ "odbc": {
+ "label": "ODBC",
+ "test": "unix/odbc",
+ "sources": [
+ { "libs": "-lodbc32", "condition": "config.win32" },
+ { "libs": "-liodbc", "condition": "config.darwin" },
+ { "libs": "-lodbc", "condition": "!config.win32 && !config.darwin" }
+ ]
+ },
+ "sqlite2": {
+ "label": "SQLite (version 2)",
+ "test": "unix/sqlite2",
+ "sources": [
+ "-lsqlite"
+ ]
+ },
+ "sqlite3": {
+ "label": "SQLite (version 3)",
+ "export": "sqlite",
+ "test": "unix/sqlite",
+ "sources": [
+ { "type": "pkgConfig", "args": "sqlite3" },
+ { "libs": "-lsqlite3", "condition": "config.win32" },
+ { "libs": "-lsqlite3 -lz", "condition": "!config.win32" }
+ ]
+ }
+ },
+
+ "tests": {
+ },
+
+ "features": {
+ "sql-db2": {
+ "label": "DB2 (IBM)",
+ "condition": "libs.db2",
+ "output": [ "publicFeature" ]
+ },
+ "sql-ibase": {
+ "label": "InterBase",
+ "condition": "libs.ibase",
+ "output": [ "publicFeature" ]
+ },
+ "sql-mysql": {
+ "label": "MySql",
+ "condition": "libs.mysql",
+ "output": [ "publicFeature" ]
+ },
+ "use_libmysqlclient_r": {
+ "label": "MySql (threadsafe)",
+ "condition": "features.sql-mysql && (libs.mysql.source == 0 || libs.mysql.source == 2)",
+ "output": [ "privateConfig" ]
+ },
+ "sql-oci": {
+ "label": "OCI (Oracle)",
+ "condition": "libs.oci",
+ "output": [ "publicFeature" ]
+ },
+ "sql-odbc": {
+ "label": "ODBC",
+ "condition": "libs.odbc",
+ "output": [ "publicFeature" ]
+ },
+ "sql-psql": {
+ "label": "PostgreSQL",
+ "condition": "libs.psql",
+ "output": [ "publicFeature" ]
+ },
+ "sql-sqlite2": {
+ "label": "SQLite2",
+ "condition": "libs.sqlite2",
+ "output": [ "publicFeature" ]
+ },
+ "sql-sqlite": {
+ "label": "SQLite",
+ "output": [ "publicFeature" ]
+ },
+ "system-sqlite": {
+ "label": " Using system provided SQLite",
+ "autoDetect": false,
+ "condition": "features.sql-sqlite && libs.sqlite3",
+ "output": [ "privateFeature" ]
+ },
+ "sql-tds": {
+ "label": "TDS (Sybase)",
+ "condition": "libs.tds",
+ "output": [ "publicFeature" ]
+ }
+ },
+
+ "report": [
+ {
+ "type": "warning",
+ "condition": "config.win32 && !config.msvc && features.sql-oci",
+ "message": "Qt does not support compiling the Oracle database driver with
+MinGW, due to lack of such support from Oracle. Consider disabling the
+Oracle driver, as the current build will most likely fail."
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt Sql",
+ "entries": [
+ "sql-db2", "sql-ibase", "sql-mysql", "sql-oci", "sql-odbc", "sql-psql",
+ "sql-sqlite2", "sql-sqlite", "system-sqlite", "sql-tds"
+ ]
+ }
+ ]
+}
diff --git a/src/sql/configure.pri b/src/sql/configure.pri
new file mode 100644
index 0000000000..948808f4f7
--- /dev/null
+++ b/src/sql/configure.pri
@@ -0,0 +1,89 @@
+# custom tests
+
+defineReplace(filterLibraryPath) {
+ str = $${1}
+ for (l, QMAKE_DEFAULT_LIBDIRS): \
+ str -= "-L$$l"
+
+ return($$str)
+}
+
+defineTest(qtConfLibrary_psqlConfig) {
+ pg_config = $$config.input.psql_config
+ isEmpty(pg_config): \
+ pg_config = $$qtConfFindInPath("pg_config")
+ !win32:!isEmpty(pg_config) {
+ qtRunLoggedCommand("$$pg_config --libdir", libdir)|return(false)
+ qtRunLoggedCommand("$$pg_config --includedir", includedir)|return(false)
+ libdir -= $$QMAKE_DEFAULT_LIBDIRS
+ libs =
+ !isEmpty(libdir): libs += "-L$$libdir"
+ libs += "-lpq"
+ $${1}.libs = "$$val_escape(libs)"
+ includedir -= $$QMAKE_DEFAULT_INCDIRS
+ $${1}.includedir = "$$val_escape(includedir)"
+ !isEmpty(includedir): \
+ $${1}.cflags = "-I$$val_escape(includedir)"
+ export($${1}.libs)
+ export($${1}.includedir)
+ export($${1}.cflags)
+ return(true)
+ }
+ return(false)
+}
+
+defineTest(qtConfLibrary_psqlEnv) {
+ # Respect PSQL_LIBS if set
+ PSQL_LIBS = $$getenv(PSQL_LIBS)
+ !isEmpty(PSQL_LIBS) {
+ $${1}.libs = $$PSQL_LIBS
+ export($${1}.libs)
+ }
+ return(true)
+}
+
+defineTest(qtConfLibrary_mysqlConfig) {
+ mysql_config = $$config.input.mysql_config
+ isEmpty(mysql_config): \
+ mysql_config = $$qtConfFindInPath("mysql_config")
+ !isEmpty(mysql_config) {
+ qtRunLoggedCommand("$$mysql_config --version", version)|return(false)
+ version = $$split(version, '.')
+ version = $$first(version)
+ isEmpty(version)|lessThan(version, 4): return(false)]
+
+ # query is either --libs or --libs_r
+ query = $$eval($${1}.query)
+ qtRunLoggedCommand("$$mysql_config $$query", libs)|return(false)
+ qtRunLoggedCommand("$$mysql_config --include", includedir)|return(false)
+ eval(libs = $$libs)
+ libs = $$filterLibraryPath($$libs)
+ # -rdynamic should not be returned by mysql_config, but is on RHEL 6.6
+ libs -= -rdynamic
+ $${1}.libs = "$$val_escape(libs)"
+ eval(includedir = $$includedir)
+ includedir ~= s/^-I//g
+ includedir -= $$QMAKE_DEFAULT_INCDIRS
+ $${1}.includedir = "$$val_escape(includedir)"
+ !isEmpty(includedir): \
+ $${1}.cflags = "-I$$val_escape(includedir)"
+ export($${1}.libs)
+ export($${1}.includedir)
+ export($${1}.cflags)
+ return(true)
+ }
+ return(false)
+}
+
+defineTest(qtConfLibrary_sybaseEnv) {
+ libs =
+ sybase = $$getenv(SYBASE)
+ !isEmpty(sybase): \
+ libs += "-L$${sybase}/lib"
+ libs += $$getenv(SYBASE_LIBS)
+ !isEmpty(libs) {
+ $${1}.libs = "$$val_escape(libs)"
+ export($${1}.libs)
+ }
+ return(true)
+}
diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc
index 9d3a8fbfed..56d714becf 100644
--- a/src/sql/doc/src/qtsql.qdoc
+++ b/src/sql/doc/src/qtsql.qdoc
@@ -51,6 +51,19 @@
QT += sql
\endcode
+ \section1 Licenses and Attributions
+
+ Qt SQL is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt SQL potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtsql}
+
\section1 Related Information
These are links to the API reference materials and related pages.
diff --git a/src/sql/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/kernel.pri b/src/sql/kernel/kernel.pri
index dad3b46781..fd6ace8277 100644
--- a/src/sql/kernel/kernel.pri
+++ b/src/sql/kernel/kernel.pri
@@ -1,4 +1,5 @@
-HEADERS += kernel/qsql.h \
+HEADERS += kernel/qtsqlglobal.h \
+ kernel/qtsqlglobal_p.h \
kernel/qsqlquery.h \
kernel/qsqldatabase.h \
kernel/qsqlfield.h \
diff --git a/src/sql/kernel/qsqlcachedresult_p.h b/src/sql/kernel/qsqlcachedresult_p.h
index cad581d755..9bcfd49f1a 100644
--- a/src/sql/kernel/qsqlcachedresult_p.h
+++ b/src/sql/kernel/qsqlcachedresult_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtSql/private/qtsqlglobal_p.h>
#include "QtSql/qsqlresult.h"
#include "QtSql/private/qsqlresult_p.h"
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/kernel/qsqldatabase.h b/src/sql/kernel/qsqldatabase.h
index ad071a6954..0b4aca8cdd 100644
--- a/src/sql/kernel/qsqldatabase.h
+++ b/src/sql/kernel/qsqldatabase.h
@@ -40,8 +40,8 @@
#ifndef QSQLDATABASE_H
#define QSQLDATABASE_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qstring.h>
-#include <QtSql/qsql.h>
QT_BEGIN_NAMESPACE
diff --git a/src/sql/kernel/qsqldriver.h b/src/sql/kernel/qsqldriver.h
index 222b848d63..1296bd5d51 100644
--- a/src/sql/kernel/qsqldriver.h
+++ b/src/sql/kernel/qsqldriver.h
@@ -40,10 +40,10 @@
#ifndef QSQLDRIVER_H
#define QSQLDRIVER_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
-#include <QtSql/qsql.h>
QT_BEGIN_NAMESPACE
diff --git a/src/sql/kernel/qsqldriver_p.h b/src/sql/kernel/qsqldriver_p.h
index 3a01ae54ed..c8ec961124 100644
--- a/src/sql/kernel/qsqldriver_p.h
+++ b/src/sql/kernel/qsqldriver_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtSql/private/qtsqlglobal_p.h>
#include "private/qobject_p.h"
#include "qsqldriver.h"
#include "qsqlerror.h"
diff --git a/src/sql/kernel/qsqldriverplugin.h b/src/sql/kernel/qsqldriverplugin.h
index cfdf1f32ee..c0f4c00943 100644
--- a/src/sql/kernel/qsqldriverplugin.h
+++ b/src/sql/kernel/qsqldriverplugin.h
@@ -40,9 +40,9 @@
#ifndef QSQLDRIVERPLUGIN_H
#define QSQLDRIVERPLUGIN_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
-#include <QtSql/qsql.h>
QT_BEGIN_NAMESPACE
diff --git a/src/sql/kernel/qsqlerror.h b/src/sql/kernel/qsqlerror.h
index 0d241e9578..0ccd32159d 100644
--- a/src/sql/kernel/qsqlerror.h
+++ b/src/sql/kernel/qsqlerror.h
@@ -40,8 +40,8 @@
#ifndef QSQLERROR_H
#define QSQLERROR_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qstring.h>
-#include <QtSql/qsql.h>
QT_BEGIN_NAMESPACE
diff --git a/src/sql/kernel/qsqlfield.h b/src/sql/kernel/qsqlfield.h
index 3bf29a8db9..0d8c51f801 100644
--- a/src/sql/kernel/qsqlfield.h
+++ b/src/sql/kernel/qsqlfield.h
@@ -40,9 +40,9 @@
#ifndef QSQLFIELD_H
#define QSQLFIELD_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qvariant.h>
#include <QtCore/qstring.h>
-#include <QtSql/qsql.h>
QT_BEGIN_NAMESPACE
diff --git a/src/sql/kernel/qsqlindex.h b/src/sql/kernel/qsqlindex.h
index 83c5de2cec..b6fbdbbaaf 100644
--- a/src/sql/kernel/qsqlindex.h
+++ b/src/sql/kernel/qsqlindex.h
@@ -40,6 +40,7 @@
#ifndef QSQLINDEX_H
#define QSQLINDEX_H
+#include <QtSql/qtsqlglobal.h>
#include <QtSql/qsqlrecord.h>
#include <QtCore/qstring.h>
#include <QtCore/qvector.h>
diff --git a/src/sql/kernel/qsqlnulldriver_p.h b/src/sql/kernel/qsqlnulldriver_p.h
index 766323e697..92d8d30485 100644
--- a/src/sql/kernel/qsqlnulldriver_p.h
+++ b/src/sql/kernel/qsqlnulldriver_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtSql/private/qtsqlglobal_p.h>
#include "QtCore/qvariant.h"
#include "QtSql/qsqldriver.h"
#include "QtSql/qsqlerror.h"
diff --git a/src/sql/kernel/qsqlquery.h b/src/sql/kernel/qsqlquery.h
index 243e4a046e..cbbc25c4ec 100644
--- a/src/sql/kernel/qsqlquery.h
+++ b/src/sql/kernel/qsqlquery.h
@@ -40,7 +40,7 @@
#ifndef QSQLQUERY_H
#define QSQLQUERY_H
-#include <QtSql/qsql.h>
+#include <QtSql/qtsqlglobal.h>
#include <QtSql/qsqldatabase.h>
#include <QtCore/qstring.h>
diff --git a/src/sql/kernel/qsqlrecord.h b/src/sql/kernel/qsqlrecord.h
index 71c1b8a38f..94631bafd9 100644
--- a/src/sql/kernel/qsqlrecord.h
+++ b/src/sql/kernel/qsqlrecord.h
@@ -40,8 +40,8 @@
#ifndef QSQLRECORD_H
#define QSQLRECORD_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qstring.h>
-#include <QtSql/qsql.h>
QT_BEGIN_NAMESPACE
diff --git a/src/sql/kernel/qsqlresult.h b/src/sql/kernel/qsqlresult.h
index c6611c925f..d4192bfad2 100644
--- a/src/sql/kernel/qsqlresult.h
+++ b/src/sql/kernel/qsqlresult.h
@@ -40,9 +40,9 @@
#ifndef QSQLRESULT_H
#define QSQLRESULT_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
-#include <QtSql/qsql.h>
// for testing:
class tst_QSqlQuery;
diff --git a/src/sql/kernel/qsqlresult_p.h b/src/sql/kernel/qsqlresult_p.h
index 4fb2bcc1e1..7b312800c1 100644
--- a/src/sql/kernel/qsqlresult_p.h
+++ b/src/sql/kernel/qsqlresult_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtSql/private/qtsqlglobal_p.h>
#include <QtCore/qpointer.h>
#include "qsqlerror.h"
#include "qsqlresult.h"
diff --git a/src/sql/kernel/qsql.h b/src/sql/kernel/qtsqlglobal.h
index 02ebae7adc..d421adc84b 100644
--- a/src/sql/kernel/qsql.h
+++ b/src/sql/kernel/qtsqlglobal.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QSQL_H
-#define QSQL_H
+#ifndef QTSQLGLOBAL_H
+#define QTSQLGLOBAL_H
#include <QtCore/qglobal.h>
diff --git a/src/corelib/global/qconfig-dist.h b/src/sql/kernel/qtsqlglobal_p.h
index c9739db990..ab45f6cd38 100644
--- a/src/corelib/global/qconfig-dist.h
+++ b/src/sql/kernel/qtsqlglobal_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 QtSql module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,12 +37,21 @@
**
****************************************************************************/
+#ifndef QTSQLGLOBAL_P_H
+#define QTSQLGLOBAL_P_H
-/*
- Empty leaves all features enabled. See doc/html/emb-features.html for choices.
+//
+// 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.
+//
- 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 <QtSql/qtsqlglobal.h>
+#include <QtCore/private/qglobal_p.h>
+
+#endif // QTSQLGLOBAL_P_H
diff --git a/src/sql/models/qsqlquerymodel.h b/src/sql/models/qsqlquerymodel.h
index d7c41196e5..f786f71300 100644
--- a/src/sql/models/qsqlquerymodel.h
+++ b/src/sql/models/qsqlquerymodel.h
@@ -40,6 +40,7 @@
#ifndef QSQLQUERYMODEL_H
#define QSQLQUERYMODEL_H
+#include <QtSql/qtsqlglobal.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtSql/qsqldatabase.h>
diff --git a/src/sql/models/qsqlquerymodel_p.h b/src/sql/models/qsqlquerymodel_p.h
index 7b35ba5197..ffc34b9f95 100644
--- a/src/sql/models/qsqlquerymodel_p.h
+++ b/src/sql/models/qsqlquerymodel_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtSql/private/qtsqlglobal_p.h>
#include "private/qabstractitemmodel_p.h"
#include "QtSql/qsqlerror.h"
#include "QtSql/qsqlquery.h"
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h
index 94097a244d..e98bf28d3b 100644
--- a/src/sql/models/qsqlrelationaldelegate.h
+++ b/src/sql/models/qsqlrelationaldelegate.h
@@ -40,6 +40,8 @@
#ifndef QSQLRELATIONALDELEGATE_H
#define QSQLRELATIONALDELEGATE_H
+#include <QtSql/qtsqlglobal.h>
+
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qitemdelegate.h>
diff --git a/src/sql/models/qsqlrelationaltablemodel.h b/src/sql/models/qsqlrelationaltablemodel.h
index 66da87cb83..f8b08b089f 100644
--- a/src/sql/models/qsqlrelationaltablemodel.h
+++ b/src/sql/models/qsqlrelationaltablemodel.h
@@ -40,8 +40,11 @@
#ifndef QSQLRELATIONALTABLEMODEL_H
#define QSQLRELATIONALTABLEMODEL_H
+#include <QtSql/qtsqlglobal.h>
#include <QtSql/qsqltablemodel.h>
+#include <QtCore/qtypeinfo.h>
+
QT_BEGIN_NAMESPACE
@@ -52,17 +55,26 @@ public:
QSqlRelation(const QString &aTableName, const QString &indexCol,
const QString &displayCol)
: tName(aTableName), iColumn(indexCol), dColumn(displayCol) {}
+
+ void swap(QSqlRelation &other) Q_DECL_NOTHROW
+ {
+ qSwap(tName, other.tName);
+ qSwap(iColumn, other.iColumn);
+ qSwap(dColumn, other.dColumn);
+ }
+
inline QString tableName() const
{ return tName; }
inline QString indexColumn() const
{ return iColumn; }
inline QString displayColumn() const
{ return dColumn; }
- inline bool isValid() const
+ bool isValid() const Q_DECL_NOTHROW
{ return !(tName.isEmpty() || iColumn.isEmpty() || dColumn.isEmpty()); }
private:
QString tName, iColumn, dColumn;
};
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QSqlRelation)
class QSqlRelationalTableModelPrivate;
diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h
index d88f195c2b..6a62c6993d 100644
--- a/src/sql/models/qsqltablemodel.h
+++ b/src/sql/models/qsqltablemodel.h
@@ -40,6 +40,7 @@
#ifndef QSQLTABLEMODEL_H
#define QSQLTABLEMODEL_H
+#include <QtSql/qtsqlglobal.h>
#include <QtSql/qsqldatabase.h>
#include <QtSql/qsqlquerymodel.h>
diff --git a/src/sql/models/qsqltablemodel_p.h b/src/sql/models/qsqltablemodel_p.h
index b0ed38b26f..4a79d5db36 100644
--- a/src/sql/models/qsqltablemodel_p.h
+++ b/src/sql/models/qsqltablemodel_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtSql/private/qtsqlglobal_p.h>
#include "private/qsqlquerymodel_p.h"
#include "QtSql/qsqlindex.h"
#include "QtCore/qmap.h"
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 3d185408f8..541053eba5 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,50 +1,44 @@
TEMPLATE = subdirs
-load(qfeatures)
+QT_FOR_CONFIG += gui-private
+include($$OUT_PWD/corelib/qtcore-config.pri)
+include($$OUT_PWD/gui/qtgui-config.pri)
src_qtzlib.file = $$PWD/corelib/qtzlib.pro
src_qtzlib.target = sub-zlib
src_tools_bootstrap.subdir = tools/bootstrap
src_tools_bootstrap.target = sub-bootstrap
-src_tools_bootstrap.CONFIG = host_build
src_tools_moc.subdir = tools/moc
src_tools_moc.target = sub-moc
src_tools_moc.depends = src_tools_bootstrap
-src_tools_moc.CONFIG = host_build
src_tools_rcc.subdir = tools/rcc
src_tools_rcc.target = sub-rcc
src_tools_rcc.depends = src_tools_bootstrap
-src_tools_rcc.CONFIG = host_build
src_tools_qlalr.subdir = tools/qlalr
src_tools_qlalr.target = sub-qlalr
-src_tools_qlalr.CONFIG = host_build
force_bootstrap: src_tools_qlalr.depends = src_tools_bootstrap
else: src_tools_qlalr.depends = src_corelib
src_tools_uic.subdir = tools/uic
src_tools_uic.target = sub-uic
-src_tools_uic.CONFIG = host_build
force_bootstrap: src_tools_uic.depends = src_tools_bootstrap
else: src_tools_uic.depends = src_corelib
src_tools_bootstrap_dbus.subdir = tools/bootstrap-dbus
src_tools_bootstrap_dbus.target = sub-bootstrap_dbus
src_tools_bootstrap_dbus.depends = src_tools_bootstrap
-src_tools_bootstrap_dbus.CONFIG = host_build
src_tools_qdbusxml2cpp.subdir = tools/qdbusxml2cpp
src_tools_qdbusxml2cpp.target = sub-qdbusxml2cpp
-src_tools_qdbusxml2cpp.CONFIG = host_build
force_bootstrap: src_tools_qdbusxml2cpp.depends = src_tools_bootstrap_dbus
else: src_tools_qdbusxml2cpp.depends = src_dbus
src_tools_qdbuscpp2xml.subdir = tools/qdbuscpp2xml
src_tools_qdbuscpp2xml.target = sub-qdbuscpp2xml
-src_tools_qdbuscpp2xml.CONFIG = host_build
force_bootstrap: src_tools_qdbuscpp2xml.depends = src_tools_bootstrap_dbus
else: src_tools_qdbuscpp2xml.depends = src_dbus
@@ -132,15 +126,15 @@ src_plugins.depends = src_sql src_xml src_network
src_android.subdir = $$PWD/android
# this order is important
-contains(QT_CONFIG, zlib)|cross_compile {
+!qtConfig(system-zlib)|cross_compile {
SUBDIRS += src_qtzlib
- contains(QT_CONFIG, zlib) {
+ !qtConfig(system-zlib) {
src_3rdparty_libpng.depends += src_corelib
src_3rdparty_freetype.depends += src_corelib
}
}
SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc
-!contains(QT_DISABLED_FEATURES, regularexpression):pcre {
+qtConfig(regularexpression):pcre {
SUBDIRS += src_3rdparty_pcre
src_corelib.depends += src_3rdparty_pcre
}
@@ -148,44 +142,44 @@ SUBDIRS += src_corelib src_tools_qlalr
TOOLS = src_tools_moc src_tools_rcc src_tools_qlalr
win32:SUBDIRS += src_winmain
SUBDIRS += src_network src_sql src_xml src_testlib
-contains(QT_CONFIG, dbus) {
- force_bootstrap|contains(QT_CONFIG, private_tests): \
+qtConfig(dbus) {
+ force_bootstrap|qtConfig(private_tests): \
SUBDIRS += src_tools_bootstrap_dbus
SUBDIRS += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
TOOLS += src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
- contains(QT_CONFIG, accessibility-atspi-bridge): \
+ qtConfig(accessibility-atspi-bridge): \
src_platformsupport.depends += src_dbus src_tools_qdbusxml2cpp
src_plugins.depends += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
}
-contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent
-!contains(QT_CONFIG, no-gui) {
- contains(QT_CONFIG, harfbuzz) {
+qtConfig(concurrent): SUBDIRS += src_concurrent
+qtConfig(gui) {
+ qtConfig(harfbuzz):!qtConfig(system-harfbuzz) {
SUBDIRS += src_3rdparty_harfbuzzng
src_gui.depends += src_3rdparty_harfbuzzng
}
- win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
+ qtConfig(angle) {
SUBDIRS += src_angle
src_gui.depends += src_angle
}
- contains(QT_CONFIG, png) {
+ qtConfig(png) {
SUBDIRS += src_3rdparty_libpng
src_3rdparty_freetype.depends += src_3rdparty_libpng
src_gui.depends += src_3rdparty_libpng
}
- contains(QT_CONFIG, freetype) {
+ qtConfig(freetype):!qtConfig(system-freetype) {
SUBDIRS += src_3rdparty_freetype
src_platformsupport.depends += src_3rdparty_freetype
}
SUBDIRS += src_gui src_platformsupport src_platformheaders
- contains(QT_CONFIG, opengl(es2)?):SUBDIRS += src_openglextensions
+ qtConfig(opengl(es2)?): SUBDIRS += src_openglextensions
src_plugins.depends += src_gui src_platformsupport src_platformheaders
src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers
- !contains(QT_CONFIG, no-widgets) {
+ qtConfig(widgets) {
SUBDIRS += src_tools_uic src_widgets
TOOLS += src_tools_uic
src_plugins.depends += src_widgets
src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers
- contains(QT_CONFIG, opengl(es2)?) {
+ qtConfig(opengl(es2)?) {
SUBDIRS += src_opengl
src_plugins.depends += src_opengl
}
diff --git a/src/testlib/3rdparty/CALLGRIND_LICENSE.txt b/src/testlib/3rdparty/CALLGRIND_LICENSE.txt
new file mode 100644
index 0000000000..0a6a793422
--- /dev/null
+++ b/src/testlib/3rdparty/CALLGRIND_LICENSE.txt
@@ -0,0 +1,35 @@
+ This file is part of callgrind, a valgrind tool for cache simulation
+ and call tree tracing.
+
+ Copyright (C) 2003-2007 Josef Weidendorfer. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. The origin of this software must not be misrepresented; you must
+ not claim that you wrote the original software. If you use this
+ software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+ 3. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+
+ 4. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/testlib/3rdparty/CYCLE_LICENSE.txt b/src/testlib/3rdparty/CYCLE_LICENSE.txt
new file mode 100644
index 0000000000..c9b44cb8aa
--- /dev/null
+++ b/src/testlib/3rdparty/CYCLE_LICENSE.txt
@@ -0,0 +1,18 @@
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/testlib/3rdparty/LINUX_LICENSE.txt b/src/testlib/3rdparty/LINUX_LICENSE.txt
new file mode 100644
index 0000000000..c0ff68a2b2
--- /dev/null
+++ b/src/testlib/3rdparty/LINUX_LICENSE.txt
@@ -0,0 +1,351 @@
+
+ NOTE! This copyright does *not* cover user programs that use kernel
+ services by normal system calls - this is merely considered normal use
+ of the kernel, and does *not* fall under the heading of "derived work".
+ Also note that the GPL below is copyrighted by the Free Software
+ Foundation, but the instance of code that it refers to (the linux
+ kernel) is copyrighted by me and others who actually wrote it.
+
+ Linus Torvalds
+
+----------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/src/testlib/3rdparty/qt_attribution.json b/src/testlib/3rdparty/qt_attribution.json
new file mode 100644
index 0000000000..23d230cb5c
--- /dev/null
+++ b/src/testlib/3rdparty/qt_attribution.json
@@ -0,0 +1,42 @@
+[
+ {
+ "Id": "callgrind",
+ "Name": "Callgrind",
+ "QDocModule": "qttestlib",
+ "QtUsage": "Used on Linux ond MacOS in the Qt Test module.",
+
+ "Description": "callgrind_p.h is part of Valgrind: an instrumentation framework for building dynamic analysis tools.",
+ "Homepage": "http://valgrind.org/",
+ "License": "BSD 4-clause \"Original\" or \"Old\" License",
+ "LicenseId": "BSD-4-Clause",
+ "LicenseFile": "CALLGRIND_LICENSE.txt",
+ "Copyright": "Copyright (C) 2003-2007 Josef Weidendorfer. All rights reserved."
+ },
+ {
+ "Id": "cycle",
+ "Name": "Cycle",
+ "QDocModule": "qttestlib",
+ "QtUsage": "Used in the Qt Test module.",
+
+ "Description": "cycle_p.h allows to access the CPU's cycle counters.",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "CYCLE_LICENSE.txt",
+ "Copyright": "Copyright (c) 2003, 2006 Matteo Frigo
+Copyright (c) 2003, 2006 Massachusetts Institute of Technology"
+ },
+ {
+ "Id": "linuxperf",
+ "Name": "Linux Performance Events",
+ "QDocModule": "qttestlib",
+ "QtUsage": "Used on Linux and Android in the Qt Test module.",
+
+ "Description": "linux_perf_event_p.h allows access to the LInux kernel's performance events.",
+ "License": "GNU General Public License v2.0 only",
+ "LicenseId": "GPL-2.0",
+ "LicenseFile": "LINUX_LICENSE.txt",
+ "Copyright": "Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
+Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar
+Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra"
+ }
+]
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/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc
index b16ab7944a..36ebfee463 100644
--- a/src/testlib/doc/src/qttest-index.qdoc
+++ b/src/testlib/doc/src/qttest-index.qdoc
@@ -50,6 +50,19 @@
\li \l{Qt Test Tutorial}
\endlist
+ \section1 Licenses and Attributions
+
+ Qt Test is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt Test potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qttestlib}
+
\section1 Reference
These are links to the API reference materials.
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/qteamcitylogger.cpp b/src/testlib/qteamcitylogger.cpp
index 4773ea937f..1d700d8201 100644
--- a/src/testlib/qteamcitylogger.cpp
+++ b/src/testlib/qteamcitylogger.cpp
@@ -228,22 +228,22 @@ QString QTeamCityLogger::tcEscapedString(const QString &str) const
switch (ch.toLatin1()) {
case '\n':
- formattedString.append(QLatin1Literal("|n"));
+ formattedString.append(QLatin1String("|n"));
break;
case '\r':
- formattedString.append(QLatin1Literal("|r"));
+ formattedString.append(QLatin1String("|r"));
break;
case '|':
- formattedString.append(QLatin1Literal("||"));
+ formattedString.append(QLatin1String("||"));
break;
case '[':
- formattedString.append(QLatin1Literal("|["));
+ formattedString.append(QLatin1String("|["));
break;
case ']':
- formattedString.append(QLatin1Literal("|]"));
+ formattedString.append(QLatin1String("|]"));
break;
case '\'':
- formattedString.append(QLatin1Literal("|'"));
+ formattedString.append(QLatin1String("|'"));
break;
default:
formattedString.append(ch);
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index cf8dee4646..63e79c777f 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -212,6 +212,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..587930ca73 100644
--- a/src/testlib/qtestblacklist.cpp
+++ b/src/testlib/qtestblacklist.cpp
@@ -97,12 +97,18 @@ static QSet<QByteArray> keywords()
#ifdef Q_OS_OSX
<< "osx"
#endif
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
<< "windows"
#endif
#ifdef Q_OS_IOS
<< "ios"
#endif
+#ifdef Q_OS_TVOS
+ << "tvos"
+#endif
+#ifdef Q_OS_WATCHOS
+ << "watchos"
+#endif
#ifdef Q_OS_ANDROID
<< "android"
#endif
@@ -112,9 +118,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 f3aaa7c89d..1c13f8edc2 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -90,11 +90,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
@@ -114,6 +112,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()
{
@@ -121,6 +149,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];
@@ -1254,37 +1286,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();
@@ -1388,7 +1389,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) && !defined(Q_OS_WATCHOS)
// Let the signal handlers use an alternate stack
// This is necessary if SIGSEGV is to catch a stack overflow
# if defined(Q_CC_GNU) && defined(Q_OF_ELF)
@@ -1454,7 +1457,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
@@ -1592,7 +1595,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()
{
@@ -1687,7 +1690,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);
@@ -1697,7 +1700,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) {
@@ -2432,6 +2435,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..106fa7abd5 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -52,18 +52,18 @@
#include <string.h>
+#include <type_traits>
#ifndef QT_NO_EXCEPTIONS
# include <exception>
#endif // QT_NO_EXCEPTIONS
-
QT_BEGIN_NAMESPACE
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)
@@ -204,11 +204,11 @@ do {\
return;\
} while (0)
-#define QFETCH(type, name)\
- type name = *static_cast<type *>(QTest::qData(#name, ::qMetaTypeId<type >()))
+#define QFETCH(Type, name)\
+ Type name = *static_cast<Type *>(QTest::qData(#name, ::qMetaTypeId<typename std::remove_cv<Type >::type>()))
-#define QFETCH_GLOBAL(type, name)\
- type name = *static_cast<type *>(QTest::qGlobalData(#name, ::qMetaTypeId<type >()))
+#define QFETCH_GLOBAL(Type, name)\
+ Type name = *static_cast<Type *>(QTest::qGlobalData(#name, ::qMetaTypeId<typename std::remove_cv<Type >::type>()))
#define QTEST(actual, testElement)\
do {\
@@ -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..bee8a0ad93 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 QTouchDevice *QTest::createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen)
+ \since 5.8
+
+ Creates a dummy touch device of type \a devType 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/qtestmouse.h b/src/testlib/qtestmouse.h
index 632b801221..1143361323 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -115,14 +115,14 @@ namespace QTest
case MouseDClick:
qt_handleMouseEvent(w, pos, global, button, stateKey, ++lastMouseTimestamp);
qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
- // fall through
+ Q_FALLTHROUGH();
case MousePress:
case MouseClick:
qt_handleMouseEvent(w, pos, global, button, stateKey, ++lastMouseTimestamp);
lastMouseButton = button;
if (action == MousePress)
break;
- // fall through
+ Q_FALLTHROUGH();
case MouseRelease:
qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
lastMouseTimestamp += 500; // avoid double clicks being generated
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index 2c57bf0420..bda185bfee 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 b4ac077e86..3fe1aeea96 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..8a1e1fd6e3 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -6,6 +6,10 @@ CONFIG += minimal_syncqt internal_module force_bootstrap
MODULE_INCNAME = QtCore QtXml
MODULE_DEFINES = \
+ QT_VERSION_STR=$$shell_quote(\"$$QT_VERSION\") \
+ QT_VERSION_MAJOR=$$QT_MAJOR_VERSION \
+ QT_VERSION_MINOR=$$QT_MINOR_VERSION \
+ QT_VERSION_PATCH=$$QT_PATCH_VERSION \
QT_BOOTSTRAPPED \
QT_LITE_UNICODE \
QT_NO_CAST_TO_ASCII \
@@ -115,16 +119,17 @@ mac {
../../corelib/kernel/qcoreapplication_mac.cpp \
../../corelib/kernel/qcore_mac.cpp
OBJECTIVE_SOURCES += \
- ../../corelib/kernel/qcore_mac_objc.mm
+ ../../corelib/kernel/qcore_mac_objc.mm \
+ ../../corelib/kernel/qcore_foundation.mm
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 +139,7 @@ macx {
../../corelib/io/qstandardpaths_win.cpp
}
-contains(QT_CONFIG, zlib)|cross_compile {
+!qtConfig(system-zlib)|cross_compile {
include(../../3rdparty/zlib.pri)
} else {
CONFIG += no_core_dep
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 7de6fe632f..ccc6d795d7 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -878,9 +878,14 @@ void Generator::generateEnums(int index)
int i;
for (i = 0; i < cdef->enumList.count(); ++i) {
const EnumDef &e = cdef->enumList.at(i);
+ int flags = 0;
+ if (cdef->enumDeclarations.value(e.name))
+ flags |= EnumIsFlag;
+ if (e.isEnumClass)
+ flags |= EnumIsScoped;
fprintf(out, " %4d, 0x%.1x, %4d, %4d,\n",
stridx(e.name),
- cdef->enumDeclarations.value(e.name) ? 1 : 0,
+ flags,
e.values.count(),
index);
index += e.values.count() * 2;
diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp
index 4f1d16d2c5..07c59d155f 100644
--- a/src/tools/moc/keywords.cpp
+++ b/src/tools/moc/keywords.cpp
@@ -30,12 +30,12 @@
// DO NOT EDIT.
static const short keyword_trans[][128] = {
- {0,0,0,0,0,0,0,0,0,546,543,0,0,0,0,0,
+ {0,0,0,0,0,0,0,0,0,561,558,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 546,252,544,547,8,38,239,545,25,26,236,234,30,235,27,237,
+ 561,252,559,562,8,38,239,560,25,26,236,234,30,235,27,237,
22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,21,8,8,8,8,8,8,8,8,8,31,549,32,238,8,
+ 8,21,8,8,8,8,8,8,8,8,8,31,564,32,238,8,
0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13,
14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -116,7 +116,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,290,222,0,0,475,0,0,0,
+ 0,0,0,0,0,0,0,0,290,222,0,0,490,0,0,0,
0,0,0,0,55,0,0,330,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -155,7 +155,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,499,0,0,0,0,0,0,0,0,0,0,357,
+ 0,0,0,0,514,0,0,0,0,0,0,0,0,0,0,357,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -177,7 +177,7 @@ static const short keyword_trans[][128] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0,
- 552,552,552,552,552,552,552,552,552,552,0,0,0,0,0,0,
+ 567,567,567,567,567,567,567,567,567,567,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -336,7 +336,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,551,0,0,0,0,550,
+ 0,0,0,0,0,0,0,0,0,0,566,0,0,0,0,565,
0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -372,29 +372,29 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,472,0,0,0,300,0,0,0,0,0,0,0,0,0,0,
+ 0,487,0,0,0,300,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,453,402,392,397,364,0,462,0,0,0,0,0,358,
- 370,0,535,450,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,468,417,401,409,373,0,477,0,0,0,0,364,358,
+ 379,0,550,465,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,378,0,0,0,
- 0,0,371,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,387,0,0,0,
+ 0,0,380,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,489,0,0,0,0,0,372,
+ 0,0,0,0,0,0,0,0,0,504,0,0,0,0,0,381,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -402,32 +402,48 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,432,410,0,0,415,0,0,0,424,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,405,0,0,0,0,0,0,0,0,0,0,0,406,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,518,0,451,0,0,0,479,0,0,485,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,413,0,0,0,0,0,0,0,0,0,0,0,414,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,447,425,0,0,430,0,0,0,439,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,464,0,511,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,533,0,466,0,0,0,494,0,0,500,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 527,0,0,495,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,479,0,526,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 542,0,0,510,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
@@ -805,189 +821,204 @@ static const struct
{CHARACTER, 0, 84, 363, CHARACTER},
{Q_OBJECT_TOKEN, 0, 0, 0, CHARACTER},
{CHARACTER, 0, 65, 365, CHARACTER},
- {CHARACTER, 0, 68, 366, CHARACTER},
- {CHARACTER, 0, 71, 367, CHARACTER},
- {CHARACTER, 0, 69, 368, CHARACTER},
- {CHARACTER, 0, 84, 369, CHARACTER},
+ {CHARACTER, 0, 77, 366, CHARACTER},
+ {CHARACTER, 0, 69, 367, CHARACTER},
+ {CHARACTER, 0, 83, 368, CHARACTER},
+ {CHARACTER, 0, 80, 369, CHARACTER},
+ {CHARACTER, 0, 65, 370, CHARACTER},
+ {CHARACTER, 0, 67, 371, CHARACTER},
+ {CHARACTER, 0, 69, 372, CHARACTER},
+ {Q_NAMESPACE_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 65, 374, CHARACTER},
+ {CHARACTER, 0, 68, 375, CHARACTER},
+ {CHARACTER, 0, 71, 376, CHARACTER},
+ {CHARACTER, 0, 69, 377, CHARACTER},
+ {CHARACTER, 0, 84, 378, CHARACTER},
{Q_GADGET_TOKEN, 0, 0, 0, CHARACTER},
{CHARACTER, 44, 0, 0, CHARACTER},
{CHARACTER, 45, 0, 0, CHARACTER},
- {CHARACTER, 0, 80, 373, CHARACTER},
- {CHARACTER, 0, 69, 374, CHARACTER},
- {CHARACTER, 0, 82, 375, CHARACTER},
- {CHARACTER, 0, 84, 376, CHARACTER},
- {CHARACTER, 0, 89, 377, CHARACTER},
+ {CHARACTER, 0, 80, 382, CHARACTER},
+ {CHARACTER, 0, 69, 383, CHARACTER},
+ {CHARACTER, 0, 82, 384, CHARACTER},
+ {CHARACTER, 0, 84, 385, CHARACTER},
+ {CHARACTER, 0, 89, 386, CHARACTER},
{Q_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 85, 379, CHARACTER},
- {CHARACTER, 0, 71, 380, CHARACTER},
- {CHARACTER, 0, 73, 381, CHARACTER},
- {CHARACTER, 0, 78, 382, CHARACTER},
- {CHARACTER, 0, 95, 383, CHARACTER},
- {CHARACTER, 0, 77, 384, CHARACTER},
- {CHARACTER, 0, 69, 385, CHARACTER},
- {CHARACTER, 0, 84, 386, CHARACTER},
- {CHARACTER, 0, 65, 387, CHARACTER},
- {CHARACTER, 0, 68, 388, CHARACTER},
- {CHARACTER, 0, 65, 389, CHARACTER},
- {CHARACTER, 0, 84, 390, CHARACTER},
- {CHARACTER, 0, 65, 391, CHARACTER},
+ {CHARACTER, 0, 85, 388, CHARACTER},
+ {CHARACTER, 0, 71, 389, CHARACTER},
+ {CHARACTER, 0, 73, 390, CHARACTER},
+ {CHARACTER, 0, 78, 391, CHARACTER},
+ {CHARACTER, 0, 95, 392, CHARACTER},
+ {CHARACTER, 0, 77, 393, CHARACTER},
+ {CHARACTER, 0, 69, 394, CHARACTER},
+ {CHARACTER, 0, 84, 395, CHARACTER},
+ {CHARACTER, 0, 65, 396, CHARACTER},
+ {CHARACTER, 0, 68, 397, CHARACTER},
+ {CHARACTER, 0, 65, 398, CHARACTER},
+ {CHARACTER, 0, 84, 399, CHARACTER},
+ {CHARACTER, 0, 65, 400, CHARACTER},
{Q_PLUGIN_METADATA_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 393, CHARACTER},
- {CHARACTER, 0, 85, 394, CHARACTER},
- {CHARACTER, 0, 77, 395, CHARACTER},
- {Q_ENUM_TOKEN, 0, 83, 396, CHARACTER},
+ {CHARACTER, 0, 78, 402, CHARACTER},
+ {CHARACTER, 0, 85, 403, CHARACTER},
+ {CHARACTER, 0, 77, 404, CHARACTER},
+ {Q_ENUM_TOKEN, 46, 0, 0, CHARACTER},
{Q_ENUMS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 398, CHARACTER},
- {CHARACTER, 0, 65, 399, CHARACTER},
- {CHARACTER, 0, 71, 400, CHARACTER},
- {Q_FLAG_TOKEN, 0, 83, 401, CHARACTER},
+ {CHARACTER, 0, 78, 407, CHARACTER},
+ {CHARACTER, 0, 83, 408, CHARACTER},
+ {Q_ENUM_NS_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 76, 410, CHARACTER},
+ {CHARACTER, 0, 65, 411, CHARACTER},
+ {CHARACTER, 0, 71, 412, CHARACTER},
+ {Q_FLAG_TOKEN, 47, 0, 0, CHARACTER},
{Q_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 403, CHARACTER},
- {CHARACTER, 0, 67, 404, CHARACTER},
- {CHARACTER, 0, 76, 405, CHARACTER},
- {CHARACTER, 0, 65, 406, CHARACTER},
- {CHARACTER, 0, 82, 407, CHARACTER},
- {CHARACTER, 0, 69, 408, CHARACTER},
- {CHARACTER, 0, 95, 409, CHARACTER},
- {CHARACTER, 46, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 411, CHARACTER},
- {CHARACTER, 0, 65, 412, CHARACTER},
- {CHARACTER, 0, 71, 413, CHARACTER},
- {CHARACTER, 0, 83, 414, CHARACTER},
- {Q_DECLARE_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 416, CHARACTER},
- {CHARACTER, 0, 84, 417, CHARACTER},
+ {CHARACTER, 0, 78, 415, CHARACTER},
+ {CHARACTER, 0, 83, 416, CHARACTER},
+ {Q_FLAG_NS_TOKEN, 0, 0, 0, CHARACTER},
{CHARACTER, 0, 69, 418, CHARACTER},
- {CHARACTER, 0, 82, 419, CHARACTER},
- {CHARACTER, 0, 70, 420, CHARACTER},
+ {CHARACTER, 0, 67, 419, CHARACTER},
+ {CHARACTER, 0, 76, 420, CHARACTER},
{CHARACTER, 0, 65, 421, CHARACTER},
- {CHARACTER, 0, 67, 422, CHARACTER},
+ {CHARACTER, 0, 82, 422, CHARACTER},
{CHARACTER, 0, 69, 423, CHARACTER},
- {Q_DECLARE_INTERFACE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 425, CHARACTER},
- {CHARACTER, 0, 84, 426, CHARACTER},
+ {CHARACTER, 0, 95, 424, CHARACTER},
+ {CHARACTER, 48, 0, 0, CHARACTER},
+ {CHARACTER, 0, 76, 426, CHARACTER},
{CHARACTER, 0, 65, 427, CHARACTER},
- {CHARACTER, 0, 84, 428, CHARACTER},
- {CHARACTER, 0, 89, 429, CHARACTER},
- {CHARACTER, 0, 80, 430, CHARACTER},
- {CHARACTER, 0, 69, 431, CHARACTER},
+ {CHARACTER, 0, 71, 428, CHARACTER},
+ {CHARACTER, 0, 83, 429, CHARACTER},
+ {Q_DECLARE_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 78, 431, CHARACTER},
+ {CHARACTER, 0, 84, 432, CHARACTER},
+ {CHARACTER, 0, 69, 433, CHARACTER},
+ {CHARACTER, 0, 82, 434, CHARACTER},
+ {CHARACTER, 0, 70, 435, CHARACTER},
+ {CHARACTER, 0, 65, 436, CHARACTER},
+ {CHARACTER, 0, 67, 437, CHARACTER},
+ {CHARACTER, 0, 69, 438, CHARACTER},
+ {Q_DECLARE_INTERFACE_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 69, 440, CHARACTER},
+ {CHARACTER, 0, 84, 441, CHARACTER},
+ {CHARACTER, 0, 65, 442, CHARACTER},
+ {CHARACTER, 0, 84, 443, CHARACTER},
+ {CHARACTER, 0, 89, 444, CHARACTER},
+ {CHARACTER, 0, 80, 445, CHARACTER},
+ {CHARACTER, 0, 69, 446, CHARACTER},
{Q_DECLARE_METATYPE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 88, 433, CHARACTER},
- {CHARACTER, 0, 84, 434, CHARACTER},
- {CHARACTER, 0, 69, 435, CHARACTER},
- {CHARACTER, 0, 78, 436, CHARACTER},
- {CHARACTER, 0, 83, 437, CHARACTER},
- {CHARACTER, 0, 73, 438, CHARACTER},
- {CHARACTER, 0, 79, 439, CHARACTER},
- {CHARACTER, 0, 78, 440, CHARACTER},
- {CHARACTER, 0, 95, 441, CHARACTER},
- {CHARACTER, 0, 73, 442, CHARACTER},
- {CHARACTER, 0, 78, 443, CHARACTER},
- {CHARACTER, 0, 84, 444, CHARACTER},
- {CHARACTER, 0, 69, 445, CHARACTER},
- {CHARACTER, 0, 82, 446, CHARACTER},
- {CHARACTER, 0, 70, 447, CHARACTER},
- {CHARACTER, 0, 65, 448, CHARACTER},
- {CHARACTER, 0, 67, 449, CHARACTER},
- {CHARACTER, 0, 69, 423, CHARACTER},
- {CHARACTER, 47, 0, 0, CHARACTER},
- {CHARACTER, 0, 84, 452, CHARACTER},
- {CHARACTER, 0, 83, 401, CHARACTER},
- {CHARACTER, 0, 76, 454, CHARACTER},
- {CHARACTER, 0, 65, 455, CHARACTER},
- {CHARACTER, 0, 83, 456, CHARACTER},
- {CHARACTER, 0, 83, 457, CHARACTER},
- {CHARACTER, 0, 73, 458, CHARACTER},
- {CHARACTER, 0, 78, 459, CHARACTER},
- {CHARACTER, 0, 70, 460, CHARACTER},
- {CHARACTER, 0, 79, 461, CHARACTER},
- {Q_CLASSINFO_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 463, CHARACTER},
- {CHARACTER, 48, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 465, CHARACTER},
- {CHARACTER, 0, 82, 466, CHARACTER},
- {CHARACTER, 0, 70, 467, CHARACTER},
- {CHARACTER, 0, 65, 468, CHARACTER},
- {CHARACTER, 0, 67, 469, CHARACTER},
- {CHARACTER, 0, 69, 470, CHARACTER},
+ {CHARACTER, 0, 88, 448, CHARACTER},
+ {CHARACTER, 0, 84, 449, CHARACTER},
+ {CHARACTER, 0, 69, 450, CHARACTER},
+ {CHARACTER, 0, 78, 451, CHARACTER},
+ {CHARACTER, 0, 83, 452, CHARACTER},
+ {CHARACTER, 0, 73, 453, CHARACTER},
+ {CHARACTER, 0, 79, 454, CHARACTER},
+ {CHARACTER, 0, 78, 455, CHARACTER},
+ {CHARACTER, 0, 95, 456, CHARACTER},
+ {CHARACTER, 0, 73, 457, CHARACTER},
+ {CHARACTER, 0, 78, 458, CHARACTER},
+ {CHARACTER, 0, 84, 459, CHARACTER},
+ {CHARACTER, 0, 69, 460, CHARACTER},
+ {CHARACTER, 0, 82, 461, CHARACTER},
+ {CHARACTER, 0, 70, 462, CHARACTER},
+ {CHARACTER, 0, 65, 463, CHARACTER},
+ {CHARACTER, 0, 67, 464, CHARACTER},
+ {CHARACTER, 0, 69, 438, CHARACTER},
+ {CHARACTER, 49, 0, 0, CHARACTER},
+ {CHARACTER, 0, 84, 467, CHARACTER},
+ {CHARACTER, 0, 83, 413, CHARACTER},
+ {CHARACTER, 0, 76, 469, CHARACTER},
+ {CHARACTER, 0, 65, 470, CHARACTER},
{CHARACTER, 0, 83, 471, CHARACTER},
+ {CHARACTER, 0, 83, 472, CHARACTER},
+ {CHARACTER, 0, 73, 473, CHARACTER},
+ {CHARACTER, 0, 78, 474, CHARACTER},
+ {CHARACTER, 0, 70, 475, CHARACTER},
+ {CHARACTER, 0, 79, 476, CHARACTER},
+ {Q_CLASSINFO_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 78, 478, CHARACTER},
+ {CHARACTER, 50, 0, 0, CHARACTER},
+ {CHARACTER, 0, 69, 480, CHARACTER},
+ {CHARACTER, 0, 82, 481, CHARACTER},
+ {CHARACTER, 0, 70, 482, CHARACTER},
+ {CHARACTER, 0, 65, 483, CHARACTER},
+ {CHARACTER, 0, 67, 484, CHARACTER},
+ {CHARACTER, 0, 69, 485, CHARACTER},
+ {CHARACTER, 0, 83, 486, CHARACTER},
{Q_INTERFACES_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 108, 473, CHARACTER},
- {CHARACTER, 0, 115, 474, CHARACTER},
+ {CHARACTER, 0, 108, 488, CHARACTER},
+ {CHARACTER, 0, 115, 489, CHARACTER},
{SIGNALS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 476, CHARACTER},
- {CHARACTER, 0, 116, 477, CHARACTER},
- {CHARACTER, 0, 115, 478, CHARACTER},
+ {CHARACTER, 0, 111, 491, CHARACTER},
+ {CHARACTER, 0, 116, 492, CHARACTER},
+ {CHARACTER, 0, 115, 493, CHARACTER},
{SLOTS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 71, 480, CHARACTER},
- {CHARACTER, 0, 78, 481, CHARACTER},
- {CHARACTER, 0, 65, 482, CHARACTER},
- {CHARACTER, 0, 76, 483, CHARACTER},
- {Q_SIGNAL_TOKEN, 0, 83, 484, CHARACTER},
+ {CHARACTER, 0, 71, 495, CHARACTER},
+ {CHARACTER, 0, 78, 496, CHARACTER},
+ {CHARACTER, 0, 65, 497, CHARACTER},
+ {CHARACTER, 0, 76, 498, CHARACTER},
+ {Q_SIGNAL_TOKEN, 0, 83, 499, CHARACTER},
{Q_SIGNALS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 79, 486, CHARACTER},
- {CHARACTER, 0, 84, 487, CHARACTER},
- {Q_SLOT_TOKEN, 0, 83, 488, CHARACTER},
+ {CHARACTER, 0, 79, 501, CHARACTER},
+ {CHARACTER, 0, 84, 502, CHARACTER},
+ {Q_SLOT_TOKEN, 0, 83, 503, CHARACTER},
{Q_SLOTS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 86, 490, CHARACTER},
- {CHARACTER, 0, 65, 491, CHARACTER},
- {CHARACTER, 0, 84, 492, CHARACTER},
- {CHARACTER, 0, 69, 493, CHARACTER},
- {CHARACTER, 0, 95, 494, CHARACTER},
- {CHARACTER, 49, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 496, CHARACTER},
- {CHARACTER, 0, 79, 497, CHARACTER},
- {CHARACTER, 0, 84, 498, CHARACTER},
+ {CHARACTER, 0, 86, 505, CHARACTER},
+ {CHARACTER, 0, 65, 506, CHARACTER},
+ {CHARACTER, 0, 84, 507, CHARACTER},
+ {CHARACTER, 0, 69, 508, CHARACTER},
+ {CHARACTER, 0, 95, 509, CHARACTER},
+ {CHARACTER, 51, 0, 0, CHARACTER},
+ {CHARACTER, 0, 76, 511, CHARACTER},
+ {CHARACTER, 0, 79, 512, CHARACTER},
+ {CHARACTER, 0, 84, 513, CHARACTER},
{Q_PRIVATE_SLOT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 95, 500, CHARACTER},
- {CHARACTER, 0, 77, 501, CHARACTER},
- {CHARACTER, 0, 79, 502, CHARACTER},
- {CHARACTER, 0, 67, 503, CHARACTER},
- {CHARACTER, 0, 95, 504, CHARACTER},
- {CHARACTER, 0, 67, 505, CHARACTER},
- {CHARACTER, 0, 79, 506, CHARACTER},
- {CHARACTER, 0, 77, 507, CHARACTER},
- {CHARACTER, 0, 80, 508, CHARACTER},
- {CHARACTER, 0, 65, 509, CHARACTER},
- {CHARACTER, 0, 84, 510, CHARACTER},
+ {CHARACTER, 0, 95, 515, CHARACTER},
+ {CHARACTER, 0, 77, 516, CHARACTER},
+ {CHARACTER, 0, 79, 517, CHARACTER},
+ {CHARACTER, 0, 67, 518, CHARACTER},
+ {CHARACTER, 0, 95, 519, CHARACTER},
+ {CHARACTER, 0, 67, 520, CHARACTER},
+ {CHARACTER, 0, 79, 521, CHARACTER},
+ {CHARACTER, 0, 77, 522, CHARACTER},
+ {CHARACTER, 0, 80, 523, CHARACTER},
+ {CHARACTER, 0, 65, 524, CHARACTER},
+ {CHARACTER, 0, 84, 525, CHARACTER},
{Q_MOC_COMPAT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 79, 512, CHARACTER},
- {CHARACTER, 0, 75, 513, CHARACTER},
- {CHARACTER, 0, 65, 514, CHARACTER},
- {CHARACTER, 0, 66, 515, CHARACTER},
- {CHARACTER, 0, 76, 516, CHARACTER},
- {CHARACTER, 0, 69, 517, CHARACTER},
+ {CHARACTER, 0, 79, 527, CHARACTER},
+ {CHARACTER, 0, 75, 528, CHARACTER},
+ {CHARACTER, 0, 65, 529, CHARACTER},
+ {CHARACTER, 0, 66, 530, CHARACTER},
+ {CHARACTER, 0, 76, 531, CHARACTER},
+ {CHARACTER, 0, 69, 532, CHARACTER},
{Q_INVOKABLE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 82, 519, CHARACTER},
- {CHARACTER, 0, 73, 520, CHARACTER},
- {CHARACTER, 0, 80, 521, CHARACTER},
- {CHARACTER, 0, 84, 522, CHARACTER},
- {CHARACTER, 0, 65, 523, CHARACTER},
- {CHARACTER, 0, 66, 524, CHARACTER},
- {CHARACTER, 0, 76, 525, CHARACTER},
- {CHARACTER, 0, 69, 526, CHARACTER},
+ {CHARACTER, 0, 82, 534, CHARACTER},
+ {CHARACTER, 0, 73, 535, CHARACTER},
+ {CHARACTER, 0, 80, 536, CHARACTER},
+ {CHARACTER, 0, 84, 537, CHARACTER},
+ {CHARACTER, 0, 65, 538, CHARACTER},
+ {CHARACTER, 0, 66, 539, CHARACTER},
+ {CHARACTER, 0, 76, 540, CHARACTER},
+ {CHARACTER, 0, 69, 541, CHARACTER},
{Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 82, 528, CHARACTER},
- {CHARACTER, 0, 79, 529, CHARACTER},
- {CHARACTER, 0, 80, 530, CHARACTER},
- {CHARACTER, 0, 69, 531, CHARACTER},
- {CHARACTER, 0, 82, 532, CHARACTER},
- {CHARACTER, 0, 84, 533, CHARACTER},
- {CHARACTER, 0, 89, 534, CHARACTER},
+ {CHARACTER, 0, 82, 543, CHARACTER},
+ {CHARACTER, 0, 79, 544, CHARACTER},
+ {CHARACTER, 0, 80, 545, CHARACTER},
+ {CHARACTER, 0, 69, 546, CHARACTER},
+ {CHARACTER, 0, 82, 547, CHARACTER},
+ {CHARACTER, 0, 84, 548, CHARACTER},
+ {CHARACTER, 0, 89, 549, CHARACTER},
{Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 536, CHARACTER},
- {CHARACTER, 0, 86, 537, CHARACTER},
- {CHARACTER, 0, 73, 538, CHARACTER},
- {CHARACTER, 0, 83, 539, CHARACTER},
- {CHARACTER, 0, 73, 540, CHARACTER},
- {CHARACTER, 0, 79, 541, CHARACTER},
- {CHARACTER, 0, 78, 542, CHARACTER},
+ {CHARACTER, 0, 69, 551, CHARACTER},
+ {CHARACTER, 0, 86, 552, CHARACTER},
+ {CHARACTER, 0, 73, 553, CHARACTER},
+ {CHARACTER, 0, 83, 554, CHARACTER},
+ {CHARACTER, 0, 73, 555, CHARACTER},
+ {CHARACTER, 0, 79, 556, CHARACTER},
+ {CHARACTER, 0, 78, 557, CHARACTER},
{Q_REVISION_TOKEN, 0, 0, 0, CHARACTER},
{NEWLINE, 0, 0, 0, NOTOKEN},
{QUOTE, 0, 0, 0, NOTOKEN},
{SINGLEQUOTE, 0, 0, 0, NOTOKEN},
{WHITESPACE, 0, 0, 0, NOTOKEN},
- {HASH, 0, 35, 548, HASH},
+ {HASH, 0, 35, 563, HASH},
{PP_HASHHASH, 0, 0, 0, NOTOKEN},
{BACKSLASH, 0, 0, 0, NOTOKEN},
{CPP_COMMENT, 0, 0, 0, NOTOKEN},
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 0734a92d5a..55cf7ed872 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -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 tools applications of the Qt Toolkit.
@@ -200,20 +201,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,18 +228,26 @@ 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 compilerFlavorOption(QStringLiteral("compiler-flavor"));
+ compilerFlavorOption.setDescription(QStringLiteral("Set the compiler flavor: either \"msvc\" or \"unix\"."));
+ compilerFlavorOption.setValueName(QStringLiteral("flavor"));
+ parser.addOption(compilerFlavorOption);
+
QCommandLineOption noIncludeOption(QStringLiteral("i"));
noIncludeOption.setDescription(QStringLiteral("Do not generate an #include statement."));
parser.addOption(noIncludeOption);
@@ -242,11 +255,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"));
@@ -254,9 +269,15 @@ int runMoc(int argc, char **argv)
prependIncludeOption.setValueName(QStringLiteral("file"));
parser.addOption(prependIncludeOption);
+ QCommandLineOption includeOption(QStringLiteral("include"));
+ includeOption.setDescription(QStringLiteral("Parse <file> as an #include before the main source(s)."));
+ includeOption.setValueName(QStringLiteral("file"));
+ parser.addOption(includeOption);
+
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"));
@@ -313,9 +334,32 @@ int runMoc(int argc, char **argv)
if (parser.isSet(pathPrefixOption))
moc.includePath = QFile::encodeName(parser.value(pathPrefixOption));
}
+
const auto includePaths = parser.values(includePathOption);
for (const QString &path : includePaths)
pp.includes += Preprocessor::IncludePath(QFile::encodeName(path));
+ QString compilerFlavor = parser.value(compilerFlavorOption);
+ if (compilerFlavor.isEmpty() || compilerFlavor == QLatin1String("unix")) {
+ // traditional Unix compilers use both CPATH and CPLUS_INCLUDE_PATH
+ // $CPATH feeds to #include <...> and #include "...", whereas
+ // CPLUS_INCLUDE_PATH is equivalent to GCC's -isystem, so we parse later
+ const auto cpath = qgetenv("CPATH").split(QDir::listSeparator().toLatin1());
+ for (const QByteArray &p : cpath)
+ pp.includes += Preprocessor::IncludePath(p);
+ const auto cplus_include_path = qgetenv("CPLUS_INCLUDE_PATH").split(QDir::listSeparator().toLatin1());
+ for (const QByteArray &p : cplus_include_path)
+ pp.includes += Preprocessor::IncludePath(p);
+ } else if (compilerFlavor == QLatin1String("msvc")) {
+ // MSVC uses one environment variable: INCLUDE
+ const auto include = qgetenv("INCLUDE").split(QDir::listSeparator().toLatin1());
+ for (const QByteArray &p : include)
+ pp.includes += Preprocessor::IncludePath(p);
+ } else {
+ error(qPrintable(QLatin1String("Unknown compiler flavor '") + compilerFlavor +
+ QLatin1String("'; valid values are: msvc, unix.")));
+ parser.showHelp(1);
+ }
+
const auto macFrameworks = parser.values(macFrameworkOption);
for (const QString &path : macFrameworks) {
// minimalistic framework support for the mac
@@ -410,7 +454,31 @@ int runMoc(int argc, char **argv)
moc.includes = pp.includes;
// 1. preprocess
- moc.symbols = pp.preprocessed(moc.filename, &in);
+ const auto includeFiles = parser.values(includeOption);
+ for (const QString &includeName : includeFiles) {
+ QByteArray rawName = pp.resolveInclude(QFile::encodeName(includeName), moc.filename);
+ if (rawName.isEmpty()) {
+ fprintf(stderr, "Warning: Failed to resolve include \"%s\" for moc file %s\n",
+ includeName.toLocal8Bit().constData(),
+ moc.filename.isEmpty() ? "<standard input>" : moc.filename.constData());
+ } else {
+ QFile f(QFile::decodeName(rawName));
+ if (f.open(QIODevice::ReadOnly)) {
+ moc.symbols += Symbol(0, MOC_INCLUDE_BEGIN, rawName);
+ moc.symbols += pp.preprocessed(rawName, &f);
+ moc.symbols += Symbol(0, MOC_INCLUDE_END, rawName);
+ } else {
+ fprintf(stderr, "Warning: Cannot open %s included by moc file %s: %s\n",
+ rawName.constData(),
+ moc.filename.isEmpty() ? "<standard input>" : moc.filename.constData(),
+ f.errorString().toLocal8Bit().constData());
+ }
+ }
+ }
+ moc.symbols += pp.preprocessed(moc.filename, &in);
+
+ // We obviously do not support MS extensions
+ pp.macros.remove("_MSC_EXTENSIONS");
if (!pp.preprocessOnly) {
// 2. parse
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 87fb1318f9..3bd87e1f01 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -163,7 +163,7 @@ Type Moc::parseType()
case SIGNED:
case UNSIGNED:
hasSignedOrUnsigned = true;
- // fall through
+ Q_FALLTHROUGH();
case CONST:
case VOLATILE:
type.name += lexem();
@@ -538,7 +538,6 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
return true;
}
-
void Moc::parse()
{
QVector<NamespaceDef> namespaceList;
@@ -554,14 +553,76 @@ void Moc::parse()
until(SEMIC);
} else if (!test(SEMIC)) {
NamespaceDef def;
- def.name = lexem();
+ def.classname = lexem();
next(LBRACE);
def.begin = index - 1;
until(RBRACE);
def.end = index;
index = def.begin + 1;
+
+ const bool parseNamespace = currentFilenames.size() <= 1;
+ if (parseNamespace) {
+ for (int i = namespaceList.size() - 1; i >= 0; --i) {
+ if (inNamespace(&namespaceList.at(i))) {
+ def.qualified.prepend(namespaceList.at(i).classname + "::");
+ }
+ }
+ }
+ while (parseNamespace && inNamespace(&def) && hasNext()) {
+ switch (next()) {
+ case NAMESPACE:
+ if (test(IDENTIFIER)) {
+ if (test(EQ)) {
+ // namespace Foo = Bar::Baz;
+ until(SEMIC);
+ } else if (!test(SEMIC)) {
+ until(RBRACE);
+ }
+ }
+ break;
+ case Q_NAMESPACE_TOKEN:
+ def.hasQNamespace = true;
+ break;
+ case Q_ENUMS_TOKEN:
+ case Q_ENUM_NS_TOKEN:
+ parseEnumOrFlag(&def, false);
+ break;
+ case Q_ENUM_TOKEN:
+ error("Q_ENUM can't be used in a Q_NAMESPACE, use Q_ENUM_NS instead");
+ break;
+ case Q_FLAGS_TOKEN:
+ case Q_FLAG_NS_TOKEN:
+ parseEnumOrFlag(&def, true);
+ break;
+ case Q_FLAG_TOKEN:
+ error("Q_FLAG can't be used in a Q_NAMESPACE, use Q_FLAG_NS instead");
+ break;
+ case Q_DECLARE_FLAGS_TOKEN:
+ parseFlag(&def);
+ break;
+ case Q_CLASSINFO_TOKEN:
+ parseClassInfo(&def);
+ break;
+ case ENUM: {
+ EnumDef enumDef;
+ if (parseEnum(&enumDef))
+ def.enumList += enumDef;
+ } break;
+ case CLASS:
+ case STRUCT: {
+ ClassDef classdef;
+ if (!parseClassHead(&classdef))
+ continue;
+ while (inClass(&classdef) && hasNext())
+ next(); // consume all Q_XXXX macros from this class
+ } break;
+ default: break;
+ }
+ }
namespaceList += def;
index = rewind;
+ if (!def.hasQNamespace && (!def.classInfoList.isEmpty() || !def.enumDeclarations.isEmpty()))
+ error("Namespace declaration lacks Q_NAMESPACE macro.");
}
}
break;
@@ -618,7 +679,7 @@ void Moc::parse()
for (int i = namespaceList.size() - 1; i >= 0; --i)
if (inNamespace(&namespaceList.at(i)))
- def.qualified.prepend(namespaceList.at(i).name + "::");
+ def.qualified.prepend(namespaceList.at(i).classname + "::");
QHash<QByteArray, QByteArray> &classHash = def.hasQObject ? knownQObjectClasses : knownGadgets;
classHash.insert(def.classname, def.qualified);
@@ -634,7 +695,7 @@ void Moc::parse()
FunctionDef::Access access = FunctionDef::Private;
for (int i = namespaceList.size() - 1; i >= 0; --i)
if (inNamespace(&namespaceList.at(i)))
- def.qualified.prepend(namespaceList.at(i).name + "::");
+ def.qualified.prepend(namespaceList.at(i).classname + "::");
while (inClass(&def) && hasNext()) {
switch ((t = next())) {
case PRIVATE:
@@ -698,10 +759,16 @@ void Moc::parse()
case Q_ENUM_TOKEN:
parseEnumOrFlag(&def, false);
break;
+ case Q_ENUM_NS_TOKEN:
+ error("Q_ENUM_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_ENUM instead");
+ break;
case Q_FLAGS_TOKEN:
case Q_FLAG_TOKEN:
parseEnumOrFlag(&def, true);
break;
+ case Q_FLAG_NS_TOKEN:
+ error("Q_FLAG_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_FLAG instead");
+ break;
case Q_DECLARE_FLAGS_TOKEN:
parseFlag(&def);
break;
@@ -802,6 +869,28 @@ void Moc::parse()
classHash.insert(def.qualified, def.qualified);
}
}
+ for (const auto &n : qAsConst(namespaceList)) {
+ if (!n.hasQNamespace)
+ continue;
+ ClassDef def;
+ static_cast<BaseDef &>(def) = static_cast<BaseDef>(n);
+ def.qualified += def.classname;
+ def.hasQGadget = true;
+ auto it = std::find_if(classList.begin(), classList.end(), [&def](const ClassDef &val) {
+ return def.classname == val.classname && def.qualified == val.qualified;
+ });
+
+ if (it != classList.end()) {
+ it->classInfoList += def.classInfoList;
+ it->enumDeclarations.unite(def.enumDeclarations);
+ it->enumList += def.enumList;
+ it->flagAliases.unite(def.flagAliases);
+ } else {
+ knownGadgets.insert(def.classname, def.qualified);
+ knownGadgets.insert(def.qualified, def.qualified);
+ classList += def;
+ }
+ }
}
static bool any_type_contains(const QVector<PropertyDef> &properties, const QByteArray &pattern)
@@ -1248,7 +1337,7 @@ void Moc::parsePrivateProperty(ClassDef *def)
def->propertyList += propDef;
}
-void Moc::parseEnumOrFlag(ClassDef *def, bool isFlag)
+void Moc::parseEnumOrFlag(BaseDef *def, bool isFlag)
{
next(LPAREN);
QByteArray identifier;
@@ -1263,7 +1352,7 @@ void Moc::parseEnumOrFlag(ClassDef *def, bool isFlag)
next(RPAREN);
}
-void Moc::parseFlag(ClassDef *def)
+void Moc::parseFlag(BaseDef *def)
{
next(LPAREN);
QByteArray flagName, enumName;
@@ -1287,7 +1376,7 @@ void Moc::parseFlag(ClassDef *def)
next(RPAREN);
}
-void Moc::parseClassInfo(ClassDef *def)
+void Moc::parseClassInfo(BaseDef *def)
{
next(LPAREN);
ClassInfoDef infoDef;
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 843bdeb794..6040f944f3 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -144,12 +144,18 @@ struct ClassInfoDef
};
Q_DECLARE_TYPEINFO(ClassInfoDef, Q_MOVABLE_TYPE);
-struct ClassDef {
- ClassDef():
- hasQObject(false), hasQGadget(false), notifyableProperties(0)
- , revisionedMethods(0), revisionedProperties(0), begin(0), end(0){}
+struct BaseDef {
QByteArray classname;
QByteArray qualified;
+ QVector<ClassInfoDef> classInfoList;
+ QMap<QByteArray, bool> enumDeclarations;
+ QVector<EnumDef> enumList;
+ QMap<QByteArray, QByteArray> flagAliases;
+ int begin = 0;
+ int end = 0;
+};
+
+struct ClassDef : BaseDef {
QVector<QPair<QByteArray, FunctionDef::Access> > superclassList;
struct Interface
@@ -162,8 +168,8 @@ struct ClassDef {
};
QVector<QVector<Interface> >interfaceList;
- bool hasQObject;
- bool hasQGadget;
+ bool hasQObject = false;
+ bool hasQGadget = false;
struct PluginData {
QByteArray iid;
@@ -173,25 +179,17 @@ struct ClassDef {
QVector<FunctionDef> constructorList;
QVector<FunctionDef> signalList, slotList, methodList, publicList;
- int notifyableProperties;
+ int notifyableProperties = 0;
QVector<PropertyDef> propertyList;
- QVector<ClassInfoDef> classInfoList;
- QMap<QByteArray, bool> enumDeclarations;
- QVector<EnumDef> enumList;
- QMap<QByteArray, QByteArray> flagAliases;
- int revisionedMethods;
- int revisionedProperties;
+ int revisionedMethods = 0;
+ int revisionedProperties = 0;
- int begin;
- int end;
};
Q_DECLARE_TYPEINFO(ClassDef, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(ClassDef::Interface, Q_MOVABLE_TYPE);
-struct NamespaceDef {
- QByteArray name;
- int begin;
- int end;
+struct NamespaceDef : BaseDef {
+ bool hasQNamespace = false;
};
Q_DECLARE_TYPEINFO(NamespaceDef, Q_MOVABLE_TYPE);
@@ -240,9 +238,9 @@ public:
void parseProperty(ClassDef *def);
void parsePluginData(ClassDef *def);
void createPropertyDef(PropertyDef &def);
- void parseEnumOrFlag(ClassDef *def, bool isFlag);
- void parseFlag(ClassDef *def);
- void parseClassInfo(ClassDef *def);
+ void parseEnumOrFlag(BaseDef *def, bool isFlag);
+ void parseFlag(BaseDef *def);
+ void parseClassInfo(BaseDef *def);
void parseInterfaces(ClassDef *def);
void parseDeclareInterface();
void parseDeclareMetatype();
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 74c75eda5b..11bf8d7937 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -251,7 +251,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
}
token = FLOATING_LITERAL;
++data;
- // fall through
+ Q_FALLTHROUGH();
case FLOATING_LITERAL:
while (is_digit_char(*data))
++data;
@@ -321,7 +321,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
}
token = WHITESPACE; // one comment, one whitespace
- // fall through;
+ Q_FALLTHROUGH();
case WHITESPACE:
if (column == 1)
column = 0;
@@ -428,7 +428,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
}
token = PP_FLOATING_LITERAL;
++data;
- // fall through
+ Q_FALLTHROUGH();
case PP_FLOATING_LITERAL:
while (is_digit_char(*data))
++data;
@@ -482,7 +482,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
}
token = PP_WHITESPACE; // one comment, one whitespace
- // fall through;
+ Q_FALLTHROUGH();
case PP_WHITESPACE:
while (*data && (*data == ' ' || *data == '\t'))
++data;
@@ -696,12 +696,9 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
next = arg.at(0);
}
- if (!expansion.isEmpty() && expansion.constLast().token == s.token) {
- Symbol last = expansion.constLast();
- expansion.pop_back();
-
- if (last.token == STRING_LITERAL || s.token == STRING_LITERAL)
- that->error("Can't concatenate non identifier tokens");
+ if (!expansion.isEmpty() && expansion.constLast().token == s.token
+ && expansion.constLast().token != STRING_LITERAL) {
+ Symbol last = expansion.takeLast();
QByteArray lexem = last.lexem() + next.lexem();
expansion += Symbol(lineNum, last.token, lexem);
@@ -1008,6 +1005,36 @@ static void mergeStringLiterals(Symbols *_symbols)
}
}
+QByteArray Preprocessor::resolveInclude(const QByteArray &include, const QByteArray &relativeTo)
+{
+ // #### stringery
+ QFileInfo fi;
+ if (!relativeTo.isEmpty())
+ fi.setFile(QFileInfo(QString::fromLocal8Bit(relativeTo.constData())).dir(), QString::fromLocal8Bit(include.constData()));
+ for (int j = 0; j < Preprocessor::includes.size() && !fi.exists(); ++j) {
+ const IncludePath &p = Preprocessor::includes.at(j);
+ if (p.isFrameworkPath) {
+ const int slashPos = include.indexOf('/');
+ if (slashPos == -1)
+ continue;
+ fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"),
+ QString::fromLocal8Bit(include.mid(slashPos + 1).constData()));
+ } else {
+ fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData()));
+ }
+ // try again, maybe there's a file later in the include paths with the same name
+ // (186067)
+ if (fi.isDir()) {
+ fi = QFileInfo();
+ continue;
+ }
+ }
+
+ if (!fi.exists() || fi.isDir())
+ return QByteArray();
+ return fi.canonicalFilePath().toLocal8Bit();
+}
+
void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
{
currentFilenames.push(filename);
@@ -1028,32 +1055,9 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
continue;
until(PP_NEWLINE);
- // #### stringery
- QFileInfo fi;
- if (local)
- fi.setFile(QFileInfo(QString::fromLocal8Bit(filename.constData())).dir(), QString::fromLocal8Bit(include.constData()));
- for (int j = 0; j < Preprocessor::includes.size() && !fi.exists(); ++j) {
- const IncludePath &p = Preprocessor::includes.at(j);
- if (p.isFrameworkPath) {
- const int slashPos = include.indexOf('/');
- if (slashPos == -1)
- continue;
- fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"),
- QString::fromLocal8Bit(include.mid(slashPos + 1).constData()));
- } else {
- fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData()));
- }
- // try again, maybe there's a file later in the include paths with the same name
- // (186067)
- if (fi.isDir()) {
- fi = QFileInfo();
- continue;
- }
- }
-
- if (!fi.exists() || fi.isDir())
+ include = resolveInclude(include, local ? filename : QByteArray());
+ if (include.isNull())
continue;
- include = fi.canonicalFilePath().toLocal8Bit();
if (Preprocessor::preprocessedIncludes.contains(include))
continue;
@@ -1173,7 +1177,7 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
case PP_ELIF:
case PP_ELSE:
skipUntilEndif();
- // fall through
+ Q_FALLTHROUGH();
case PP_ENDIF:
until(PP_NEWLINE);
continue;
@@ -1208,6 +1212,7 @@ Symbols Preprocessor::preprocessed(const QByteArray &filename, QFile *file)
input = cleaned(input);
// phase 2: tokenize for the preprocessor
+ index = 0;
symbols = tokenize(input);
#if 0
diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h
index 9a49751eb0..a7eb1a19e1 100644
--- a/src/tools/moc/preprocessor.h
+++ b/src/tools/moc/preprocessor.h
@@ -62,6 +62,7 @@ public:
QList<QByteArray> frameworks;
QSet<QByteArray> preprocessedIncludes;
Macros macros;
+ QByteArray resolveInclude(const QByteArray &filename, const QByteArray &relativeTo);
Symbols preprocessed(const QByteArray &filename, QFile *device);
void parseDefineArguments(Macro *m);
diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h
index 3557da8aa8..db9d319b78 100644
--- a/src/tools/moc/token.h
+++ b/src/tools/moc/token.h
@@ -154,12 +154,15 @@ QT_BEGIN_NAMESPACE
F(RETURN) \
F(Q_OBJECT_TOKEN) \
F(Q_GADGET_TOKEN) \
+ F(Q_NAMESPACE_TOKEN) \
F(Q_PROPERTY_TOKEN) \
F(Q_PLUGIN_METADATA_TOKEN) \
F(Q_ENUMS_TOKEN) \
F(Q_ENUM_TOKEN) \
+ F(Q_ENUM_NS_TOKEN) \
F(Q_FLAGS_TOKEN) \
F(Q_FLAG_TOKEN) \
+ F(Q_FLAG_NS_TOKEN) \
F(Q_DECLARE_FLAGS_TOKEN) \
F(Q_DECLARE_INTERFACE_TOKEN) \
F(Q_DECLARE_METATYPE_TOKEN) \
diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp
index d0f76a4c45..df850c1bdc 100644
--- a/src/tools/moc/util/generate_keywords.cpp
+++ b/src/tools/moc/util/generate_keywords.cpp
@@ -213,13 +213,16 @@ static const Keyword keywords[] = {
{ "goto", "GOTO" },
{ "return", "RETURN" },
{ "Q_OBJECT", "Q_OBJECT_TOKEN" },
+ { "Q_NAMESPACE", "Q_NAMESPACE_TOKEN" },
{ "Q_GADGET", "Q_GADGET_TOKEN" },
{ "Q_PROPERTY", "Q_PROPERTY_TOKEN" },
{ "Q_PLUGIN_METADATA", "Q_PLUGIN_METADATA_TOKEN" },
{ "Q_ENUMS", "Q_ENUMS_TOKEN" },
{ "Q_ENUM", "Q_ENUM_TOKEN" },
+ { "Q_ENUM_NS", "Q_ENUM_NS_TOKEN" },
{ "Q_FLAGS", "Q_FLAGS_TOKEN" },
{ "Q_FLAG", "Q_FLAG_TOKEN" },
+ { "Q_FLAG_NS", "Q_FLAG_NS_TOKEN" },
{ "Q_DECLARE_FLAGS", "Q_DECLARE_FLAGS_TOKEN" },
{ "Q_DECLARE_INTERFACE", "Q_DECLARE_INTERFACE_TOKEN" },
{ "Q_DECLARE_METATYPE", "Q_DECLARE_METATYPE_TOKEN" },
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
index 083187555d..26e7b086d9 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp
@@ -335,28 +335,28 @@ static void parseCmdLine(QStringList &arguments)
switch (c) {
case 'P':
flags |= QDBusConnection::ExportNonScriptableProperties;
- // fall through
+ Q_FALLTHROUGH();
case 'p':
flags |= QDBusConnection::ExportScriptableProperties;
break;
case 'S':
flags |= QDBusConnection::ExportNonScriptableSignals;
- // fall through
+ Q_FALLTHROUGH();
case 's':
flags |= QDBusConnection::ExportScriptableSignals;
break;
case 'M':
flags |= QDBusConnection::ExportNonScriptableSlots;
- // fall through
+ Q_FALLTHROUGH();
case 'm':
flags |= QDBusConnection::ExportScriptableSlots;
break;
case 'A':
flags |= QDBusConnection::ExportNonScriptableContents;
- // fall through
+ Q_FALLTHROUGH();
case 'a':
flags |= QDBusConnection::ExportScriptableContents;
break;
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index e58f194b72..8dbb1bf350 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -32,6 +32,7 @@
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
+#include <qloggingcategory.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qtextstream.h>
@@ -1092,6 +1093,9 @@ int main(int argc, char **argv)
}
}
+ if (verbose)
+ QLoggingCategory::setFilterRules(QStringLiteral("dbus.parser.debug=true"));
+
QDBusIntrospection::Interfaces interfaces = readInput();
cleanInterfaces(interfaces);
diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp
index 81975a0f2a..0ccf4c1588 100644
--- a/src/tools/qlalr/lalr.cpp
+++ b/src/tools/qlalr/lalr.cpp
@@ -187,7 +187,7 @@ Grammar::Grammar ():
tk_end = intern ("$end");
terminals.insert (tk_end);
- spells.insert (tk_end, "end of file");
+ spells.insert (tk_end, QLatin1String("end of file"));
/*tk_error= terminals.insert (intern ("error"))*/;
}
diff --git a/src/tools/qlalr/lalr.h b/src/tools/qlalr/lalr.h
index 28c889e63f..b303b897d4 100644
--- a/src/tools/qlalr/lalr.h
+++ b/src/tools/qlalr/lalr.h
@@ -337,6 +337,7 @@ public:
Grammar ();
Name intern (const QString &id);
+ Name intern (const char *id) { return intern(QString::fromUtf8(id)); }
inline bool isTerminal (Name name) const
{ return terminals.find (name) != terminals.end (); }
diff --git a/src/tools/qlalr/main.cpp b/src/tools/qlalr/main.cpp
index e16d5f1e8d..c16bdcdf17 100644
--- a/src/tools/qlalr/main.cpp
+++ b/src/tools/qlalr/main.cpp
@@ -65,7 +65,7 @@ int main (int argc, char *argv[])
bool no_lines = false;
bool debug_info = true;
bool qt_copyright = false;
- QString file_name = 0;
+ QString file_name;
const QStringList args = app.arguments().mid(1);
for (const QString &arg : args) {
diff --git a/src/tools/qlalr/recognizer.cpp b/src/tools/qlalr/recognizer.cpp
index ca2551707e..69dad1a6c1 100644
--- a/src/tools/qlalr/recognizer.cpp
+++ b/src/tools/qlalr/recognizer.cpp
@@ -178,7 +178,8 @@ int Recognizer::nextToken()
text.clear ();
if (! _M_no_lines)
- text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n";
+ text += QLatin1String("\n#line ") + QString::number (_M_action_line)
+ + QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':'
forever
@@ -215,7 +216,8 @@ int Recognizer::nextToken()
text.clear ();
if (! _M_no_lines)
- text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n";
+ text += QLatin1String ("\n#line ") + QString::number (_M_action_line) +
+ QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':'
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 3156df3f30..18772d2816 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -705,9 +705,7 @@ static void resourceDataFileMapRecursion(const RCCFileInfo *m_root, const QStrin
const ChildConstIterator cend = m_root->m_children.constEnd();
for (ChildConstIterator it = m_root->m_children.constBegin(); it != cend; ++it) {
const RCCFileInfo *child = it.value();
- QString childName = path;
- childName += slash;
- childName += child->m_name;
+ const QString childName = path + slash + child->m_name;
if (child->m_flags & RCCFileInfo::Directory) {
resourceDataFileMapRecursion(child, childName, m);
} else {
diff --git a/src/tools/uic/cpp/cppextractimages.cpp b/src/tools/uic/cpp/cppextractimages.cpp
index 22abd54283..4d06d08dae 100644
--- a/src/tools/uic/cpp/cppextractimages.cpp
+++ b/src/tools/uic/cpp/cppextractimages.cpp
@@ -33,7 +33,6 @@
#include "utils.h"
#include "uic.h"
-#include <qdatastream.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qdir.h>
@@ -77,7 +76,9 @@ void ExtractImages::acceptUI(DomUI *node)
m_imagesDir = dir;
m_output = new QTextStream(&f);
+#ifndef QT_NO_TEXTCODEC
m_output->setCodec(QTextCodec::codecForName("UTF-8"));
+#endif
QTextStream &out = *m_output;
@@ -121,7 +122,9 @@ void ExtractImages::acceptImage(DomImage *image)
if (isXPM_GZ) {
QTextStream *imageOut = new QTextStream(&f);
+#ifndef QT_NO_TEXTCODEC
imageOut->setCodec(QTextCodec::codecForName("UTF-8"));
+#endif
CPP::WriteIconData::writeImage(*imageOut, QString(), m_option.limitXPM_LineLength, image);
delete imageOut;
diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp
index 4c9d2db6df..3aadc878e3 100644
--- a/src/tools/uic/cpp/cppwritedeclaration.cpp
+++ b/src/tools/uic/cpp/cppwritedeclaration.cpp
@@ -44,27 +44,16 @@ QT_BEGIN_NAMESPACE
namespace {
void openNameSpaces(const QStringList &namespaceList, QTextStream &output) {
- if (namespaceList.empty())
- return;
- const QStringList::const_iterator cend = namespaceList.constEnd();
- for (QStringList::const_iterator it = namespaceList.constBegin(); it != cend; ++it) {
- if (!it->isEmpty()) {
+ for (auto it = namespaceList.begin(), end = namespaceList.end(); it != end; ++it) {
+ if (!it->isEmpty())
output << "namespace " << *it << " {\n";
- }
}
}
void closeNameSpaces(const QStringList &namespaceList, QTextStream &output) {
- if (namespaceList.empty())
- return;
-
- QListIterator<QString> it(namespaceList);
- it.toBack();
- while (it.hasPrevious()) {
- const QString ns = it.previous();
- if (!ns.isEmpty()) {
- output << "} // namespace " << ns << "\n";
- }
+ for (auto it = namespaceList.rbegin(), end = namespaceList.rend(); it != end; ++it) {
+ if (!it->isEmpty())
+ output << "} // namespace " << *it << "\n";
}
}
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index dfc7ee3a61..d69eeebc5c 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -774,22 +774,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;
@@ -801,16 +801,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;
@@ -1717,9 +1717,7 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri
// new format
const QList<DomColorRole *> colorRoles = colorGroup->elementColorRole();
- QListIterator<DomColorRole *> itRole(colorRoles);
- while (itRole.hasNext()) {
- const DomColorRole *colorRole = itRole.next();
+ for (const DomColorRole *colorRole : colorRoles) {
if (colorRole->hasAttributeRole()) {
const QString brushName = writeBrushInitialization(colorRole->elementBrush());
m_output << m_indent << paletteName << ".setBrush(" << group
@@ -1796,9 +1794,7 @@ void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brush
}
const QList<DomGradientStop *> stops = gradient->elementGradientStop();
- QListIterator<DomGradientStop *> it(stops);
- while (it.hasNext()) {
- const DomGradientStop *stop = it.next();
+ for (const DomGradientStop *stop : stops) {
const DomColor *color = stop->elementColor();
m_output << m_indent << gradientName << ".setColorAt("
<< stop->attributePosition() << ", "
@@ -2027,7 +2023,7 @@ void WriteInitialization::addInitializer(Item *item,
const QString &name, int column, const QString &value, const QString &directive, bool translatable) const
{
if (!value.isEmpty())
- item->addSetter(QLatin1String("->set") + name.at(0).toUpper() + name.mid(1) +
+ item->addSetter(QLatin1String("->set") + name.at(0).toUpper() + name.midRef(1) +
QLatin1Char('(') + (column < 0 ? QString() : QString::number(column) +
QLatin1String(", ")) + value + QLatin1String(");"), directive, translatable);
}
diff --git a/src/tools/uic/databaseinfo.cpp b/src/tools/uic/databaseinfo.cpp
index e491d6b19a..73fcf06c54 100644
--- a/src/tools/uic/databaseinfo.cpp
+++ b/src/tools/uic/databaseinfo.cpp
@@ -45,7 +45,7 @@ void DatabaseInfo::acceptUI(DomUI *node)
TreeWalker::acceptUI(node);
- m_connections = unique(m_connections);
+ m_connections.removeDuplicates();
}
void DatabaseInfo::acceptWidget(DomWidget *node)
diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp
index 229e2a9c2f..e2399cd1fd 100644
--- a/src/tools/uic/main.cpp
+++ b/src/tools/uic/main.cpp
@@ -132,7 +132,9 @@ int runUic(int argc, char *argv[])
return 1;
}
out = new QTextStream(&f);
+#ifndef QT_NO_TEXTCODEC
out->setCodec(QTextCodec::codecForName("UTF-8"));
+#endif
}
bool rtn = driver.uic(inputFile, out);
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index 389214cbb2..fa775161e5 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -46,7 +46,6 @@
#include <qxmlstream.h>
#include <qfileinfo.h>
#include <qtextstream.h>
-#include <qdatetime.h>
QT_BEGIN_NAMESPACE
diff --git a/src/tools/uic/utils.h b/src/tools/uic/utils.h
index a6532eb534..7c5918cab9 100644
--- a/src/tools/uic/utils.h
+++ b/src/tools/uic/utils.h
@@ -132,14 +132,6 @@ inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &pro
return map;
}
-inline QStringList unique(const QStringList &lst)
-{
- QHash<QString, bool> h;
- for (int i=0; i<lst.size(); ++i)
- h.insert(lst.at(i), true);
- return h.keys();
-}
-
QT_END_NAMESPACE
#endif // UTILS_H
diff --git a/src/widgets/accessible/accessible.pri b/src/widgets/accessible/accessible.pri
index ac8205b1e3..e63ae28d30 100644
--- a/src/widgets/accessible/accessible.pri
+++ b/src/widgets/accessible/accessible.pri
@@ -1,6 +1,6 @@
# Qt accessibility module
-contains(QT_CONFIG, accessibility) {
+qtConfig(accessibility) {
HEADERS += \
accessible/qaccessiblewidget.h \
accessible/qaccessiblewidgetfactory_p.h \
diff --git a/src/widgets/accessible/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/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h
index 44549086ba..d43b06f4a4 100644
--- a/src/widgets/accessible/complexwidgets_p.h
+++ b/src/widgets/accessible/complexwidgets_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qpointer.h>
#include <QtWidgets/qaccessiblewidget.h>
#include <QtWidgets/qabstractitemview.h>
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index ebe8efc79e..796d13487b 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -81,13 +81,22 @@ QAccessibleTable::QAccessibleTable(QWidget *w)
{
Q_ASSERT(view());
+#ifndef QT_NO_TABLEVIEW
if (qobject_cast<const QTableView*>(view())) {
m_role = QAccessible::Table;
- } else if (qobject_cast<const QTreeView*>(view())) {
+ } else
+#endif
+#ifndef QT_NO_TREEVIEW
+ if (qobject_cast<const QTreeView*>(view())) {
m_role = QAccessible::Tree;
- } else if (qobject_cast<const QListView*>(view())) {
+ } else
+#endif
+#ifndef QT_NO_LISTVIEW
+ if (qobject_cast<const QListView*>(view())) {
m_role = QAccessible::List;
- } else {
+ } else
+#endif
+ {
// is this our best guess?
m_role = QAccessible::Table;
}
@@ -512,7 +521,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());
@@ -664,6 +673,8 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event)
}
}
+#ifndef QT_NO_TREEVIEW
+
// TREE VIEW
QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const
@@ -714,7 +725,6 @@ int QAccessibleTree::childCount() const
return (treeView->d_func()->viewItems.count() + hHeader)* view()->model()->columnCount();
}
-
QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const
{
if (logicalIndex < 0 || !view()->model() || !view()->model()->columnCount())
@@ -783,7 +793,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());
@@ -836,6 +846,8 @@ bool QAccessibleTree::selectRow(int row)
return true;
}
+#endif // QT_NO_TREEVIEW
+
// TABLE CELL
QAccessibleTableCell::QAccessibleTableCell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_)
@@ -912,12 +924,14 @@ int QAccessibleTableCell::columnIndex() const
int QAccessibleTableCell::rowIndex() const
{
+#ifndef QT_NO_TREEVIEW
if (role() == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
Q_ASSERT(treeView);
int row = treeView->d_func()->viewIndex(m_index);
return row;
}
+#endif
return m_index.row();
}
@@ -1046,6 +1060,7 @@ QAccessible::State QAccessibleTableCell::state() const
if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
st.extSelectable = true;
}
+#ifndef QT_NO_TREEVIEW
if (m_role == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
if (treeView->model()->hasChildren(m_index))
@@ -1053,6 +1068,7 @@ QAccessible::State QAccessibleTableCell::state() const
if (treeView->isExpanded(m_index))
st.expanded = true;
}
+#endif
return st;
}
diff --git a/src/widgets/accessible/itemviews_p.h b/src/widgets/accessible/itemviews_p.h
index 95a0032139..5b73444c67 100644
--- a/src/widgets/accessible/itemviews_p.h
+++ b/src/widgets/accessible/itemviews_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtCore/qpointer.h"
#include <QtGui/qaccessible.h>
#include <QtWidgets/qaccessiblewidget.h>
@@ -144,6 +145,7 @@ private:
QAccessible::Role m_role;
};
+#ifndef QT_NO_TREEVIEW
class QAccessibleTree :public QAccessibleTable
{
public:
@@ -171,6 +173,7 @@ private:
inline int logicalIndex(const QModelIndex &index) const;
};
+#endif
class QAccessibleTableCell: public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface
{
@@ -220,7 +223,9 @@ private:
void unselectCell();
friend class QAccessibleTable;
+#ifndef QT_NO_TREEVIEW
friend class QAccessibleTree;
+#endif
};
@@ -254,7 +259,9 @@ private:
Qt::Orientation orientation;
friend class QAccessibleTable;
+#ifndef QT_NO_TREEVIEW
friend class QAccessibleTree;
+#endif
};
// This is the corner button on the top left of a table.
diff --git a/src/widgets/accessible/qaccessiblemenu_p.h b/src/widgets/accessible/qaccessiblemenu_p.h
index 5a5a4a3222..52afeb5a04 100644
--- a/src/widgets/accessible/qaccessiblemenu_p.h
+++ b/src/widgets/accessible/qaccessiblemenu_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qaccessiblewidget.h>
#include <QtCore/qpointer.h>
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 5096c1ff37..840a990799 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -142,9 +142,11 @@ QString qt_accStripAmp(const QString &text)
QString qt_accHotKey(const QString &text)
{
+#ifndef QT_NO_SHORTCUT
int ampIndex = qt_accAmpIndex(text);
if (ampIndex != -1)
return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1);
+#endif
return QString();
}
diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h
index ebba30b2d5..e09c3ff489 100644
--- a/src/widgets/accessible/qaccessiblewidget.h
+++ b/src/widgets/accessible/qaccessiblewidget.h
@@ -40,6 +40,7 @@
#ifndef QACCESSIBLEWIDGET_H
#define QACCESSIBLEWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qaccessibleobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index 3bfef49965..dfc8c84836 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -139,9 +139,11 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget);
#endif
-#ifndef QT_NO_ITEMVIEWS
+#ifndef QT_NO_TREEVIEW
} else if (classname == QLatin1String("QTreeView")) {
iface = new QAccessibleTree(widget);
+#endif // QT_NO_TREEVIEW
+#ifndef QT_NO_ITEMVIEWS
} else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) {
iface = new QAccessibleTable(widget);
// ### This should be cleaned up. We return the parent for the scrollarea to hide it.
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory_p.h b/src/widgets/accessible/qaccessiblewidgetfactory_p.h
index 2571399060..5da609ddca 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory_p.h
+++ b/src/widgets/accessible/qaccessiblewidgetfactory_p.h
@@ -37,6 +37,7 @@
**
****************************************************************************/
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtGui/qaccessible.h>
#ifndef QACCESSIBLEWIDGETFACTORY_H
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 95888924fb..b814762168 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -830,7 +830,7 @@ QString QAccessibleTextWidget::attributes(int offset, int *startOffset, int *end
family = family.replace('=', QLatin1String("\\="));
family = family.replace(';', QLatin1String("\\;"));
family = family.replace('\"', QLatin1String("\\\""));
- attrs["font-family"] = QString::fromLatin1("\"%1\"").arg(family);
+ attrs["font-family"] = QLatin1Char('"') + family + QLatin1Char('"');
}
int fontSize = int(charFormatFont.pointSize());
diff --git a/src/widgets/accessible/qaccessiblewidgets_p.h b/src/widgets/accessible/qaccessiblewidgets_p.h
index 986f2b2789..052958d4c7 100644
--- a/src/widgets/accessible/qaccessiblewidgets_p.h
+++ b/src/widgets/accessible/qaccessiblewidgets_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qaccessiblewidget.h>
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/widgets/accessible/rangecontrols_p.h b/src/widgets/accessible/rangecontrols_p.h
index cd351fbb3c..28f613462d 100644
--- a/src/widgets/accessible/rangecontrols_p.h
+++ b/src/widgets/accessible/rangecontrols_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qaccessiblewidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index 51e8f72907..e6fda103fb 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -404,8 +404,10 @@ QAccessible::Role QAccessibleDisplay::role() const
} else if (qobject_cast<QProgressBar*>(object())) {
return QAccessible::ProgressBar;
#endif
+#ifndef QT_NO_STATUSBAR
} else if (qobject_cast<QStatusBar*>(object())) {
return QAccessible::StatusBar;
+#endif
}
return QAccessibleWidget::role();
}
@@ -428,8 +430,10 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
str = doc.toPlainText();
}
#endif
+#ifndef QT_NO_SHORTCUT
if (label->buddy())
str = qt_accStripAmp(str);
+#endif
#ifndef QT_NO_LCDNUMBER
} else if (qobject_cast<QLCDNumber*>(object())) {
QLCDNumber *l = qobject_cast<QLCDNumber*>(object());
@@ -438,8 +442,10 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
else
str = QString::number(l->intValue());
#endif
+#ifndef QT_NO_STATUSBAR
} else if (qobject_cast<QStatusBar*>(object())) {
return qobject_cast<QStatusBar*>(object())->currentMessage();
+#endif
}
}
break;
diff --git a/src/widgets/accessible/simplewidgets_p.h b/src/widgets/accessible/simplewidgets_p.h
index ec9cc893a5..8bd0af8261 100644
--- a/src/widgets/accessible/simplewidgets_p.h
+++ b/src/widgets/accessible/simplewidgets_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qcoreapplication.h>
#include <QtWidgets/qaccessiblewidget.h>
diff --git a/src/widgets/accessible/widgets.pro b/src/widgets/accessible/widgets.pro
index da8607c637..d04d0da3cc 100644
--- a/src/widgets/accessible/widgets.pro
+++ b/src/widgets/accessible/widgets.pro
@@ -2,7 +2,7 @@ TARGET = qtaccessiblewidgets
QT += core-private gui-private widgets-private
-QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)"
+QTDIR_build:REQUIRES += "qtConfig(accessibility)"
SOURCES += main.cpp \
simplewidgets.cpp \
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
new file mode 100644
index 0000000000..c1931d9d80
--- /dev/null
+++ b/src/widgets/configure.json
@@ -0,0 +1,567 @@
+{
+ "module": "widgets",
+ "depends": [
+ "core-private",
+ "gui"
+ ],
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "options": {
+ "android-style-assets": "boolean",
+ "gtk": { "type": "boolean", "name": "gtk3" },
+ "style-windows": "boolean",
+ "style-windowsxp": "boolean",
+ "style-windowsvista": "boolean",
+ "style-fusion": "boolean",
+ "style-mac": "boolean",
+ "style-android": "boolean"
+ }
+ },
+
+ "libraries": {
+ "gtk3": {
+ "label": "GTK+",
+ "sources": [
+ { "type": "pkgConfig", "args": "gtk+-3.0" }
+ ]
+ }
+ },
+
+ "tests": {
+ "uxtheme": {
+ "label": "uxtheme.h",
+ "type": "files",
+ "files": [ "uxtheme.h" ]
+ }
+ },
+
+ "features": {
+ "gtk3": {
+ "label": "GTK+",
+ "autoDetect": "!config.darwin",
+ "condition": "features.glib && libs.gtk3",
+ "output": [ "privateFeature" ]
+ },
+ "style-fusion": {
+ "label": "Fusion",
+ "output": [ "styles" ]
+ },
+ "style-mac": {
+ "label": "macOS",
+ "condition": "config.osx",
+ "output": [ "styles" ]
+ },
+ "style-windows": {
+ "label": "Windows",
+ "output": [ "styles" ]
+ },
+ "style-windowsxp": {
+ "label": "WindowsXP",
+ "condition": "features.style-windows && config.win32 && !config.winrt && tests.uxtheme",
+ "output": [ "styles" ]
+ },
+ "style-windowsvista": {
+ "label": "WindowsVista",
+ "condition": "features.style-windowsxp",
+ "output": [ "styles" ]
+ },
+ "style-android": {
+ "label": "Android",
+ "autoDetect": "config.android",
+ "output": [ "styles" ]
+ },
+ "style-stylesheet": {
+ "label": "QStyleSheetStyle",
+ "purpose": "Provides a widget style which is configurable via CSS.",
+ "section": "Styles",
+ "condition": "features.style-windows && features.properties && features.cssparser",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "android-style-assets": {
+ "label": "Android Style Assets",
+ "condition": "features.style-android",
+ "output": [ "privateConfig" ]
+ },
+ "effects": {
+ "label": "Effects",
+ "purpose": "Provides special widget effects (e.g. fading and scrolling).",
+ "section": "Kernel"
+ },
+ "filesystemmodel": {
+ "label": "QFileSystemModel",
+ "purpose": "Provides a data model for the local filesystem.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "itemviews": {
+ "label": "The Model/View Framework",
+ "purpose": "Provides the model/view architecture managing the relationship between data and the way it is presented to the user.",
+ "section": "ItemViews",
+ "condition": "features.itemmodel && features.rubberband && features.scrollarea",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "treewidget": {
+ "label": "QTreeWidget",
+ "purpose": "Provides views using tree models.",
+ "section": "Widgets",
+ "condition": "features.treeview",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "listwidget": {
+ "label": "QListWidget",
+ "purpose": "Provides item-based list widgets.",
+ "section": "Widgets",
+ "condition": "features.listview",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tablewidget": {
+ "label": "QTableWidget",
+ "purpose": "Provides item-based table views.",
+ "section": "Widgets",
+ "condition": "features.tableview",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "datetimeedit": {
+ "label": "QDateTimeEdit",
+ "purpose": "Supports editing dates and times.",
+ "section": "Widgets",
+ "condition": "features.calendarwidget && features.datestring",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "stackedwidget": {
+ "label": "QStackedWidget",
+ "purpose": "Provides stacked widgets.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "textbrowser": {
+ "label": "QTextBrowser",
+ "purpose": "Supports HTML document browsing.",
+ "section": "Widgets",
+ "condition": "features.textedit",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "splashscreen": {
+ "label": "QSplashScreen",
+ "purpose": "Supports splash screens that can be shown during application startup.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "splitter": {
+ "label": "QSplitter",
+ "purpose": "Provides user controlled splitter widgets.",
+ "section": "Widgets",
+ "condition": "features.rubberband",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "lcdnumber": {
+ "label": "QLCDNumber",
+ "purpose": "Provides LCD-like digits.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "menu": {
+ "label": "QMenu",
+ "purpose": "Provides popup-menus.",
+ "section": "Widgets",
+ "condition": "features.action",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "lineedit": {
+ "label": "QLineEdit",
+ "purpose": "Provides single-line edits.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "spinbox": {
+ "label": "QSpinBox",
+ "purpose": "Provides spin boxes handling integers and discrete sets of values.",
+ "section": "Widgets",
+ "condition": "features.spinwidget && features.lineedit && features.validator",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tabbar": {
+ "label": "QTabBar",
+ "purpose": "Provides tab bars, e.g., for use in tabbed dialogs.",
+ "section": "Widgets",
+ "condition": "features.toolbutton",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tabwidget": {
+ "label": "QTabWidget",
+ "purpose": "Supports stacking tabbed widgets.",
+ "section": "Widgets",
+ "condition": "features.tabbar && features.stackedwidget",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "combobox": {
+ "label": "QComboBox",
+ "purpose": "Provides drop-down boxes presenting a list of options to the user.",
+ "section": "Widgets",
+ "condition": "features.lineedit && features.standarditemmodel && features.listview",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "fontcombobox": {
+ "label": "QFontComboBox",
+ "purpose": "Provides a combobox that lets the user select a font family.",
+ "section": "Widgets",
+ "condition": "features.combobox && features.stringlistmodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "toolbutton": {
+ "label": "QToolButton",
+ "purpose": "Provides quick-access buttons to commands and options.",
+ "section": "Widgets",
+ "condition": "features.action",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "toolbar": {
+ "label": "QToolBar",
+ "purpose": "Provides movable panels containing a set of controls.",
+ "section": "Widgets",
+ "condition": "features.mainwindow",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "toolbox": {
+ "label": "QToolBox",
+ "purpose": "Provides columns of tabbed widget items.",
+ "section": "Widgets",
+ "condition": "features.toolbutton && features.scrollarea",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "groupbox": {
+ "label": "QGroupBox",
+ "purpose": "Provides widget grouping boxes with frames.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "buttongroup": {
+ "label": "QButtonGroup",
+ "purpose": "Supports organizing groups of button widgets.",
+ "section": "Widgets",
+ "condition": "features.groupbox",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "mainwindow": {
+ "label": "QMainWindow",
+ "purpose": "Provides main application windows.",
+ "section": "Widgets",
+ "condition": "features.menu && features.resizehandler && features.toolbutton",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "dockwidget": {
+ "label": "QDockwidget",
+ "purpose": "Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop.",
+ "section": "Widgets",
+ "condition": "features.rubberband && features.mainwindow",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "mdiarea": {
+ "label": "QMdiArea",
+ "purpose": "Provides an area in which MDI windows are displayed.",
+ "section": "Widgets",
+ "condition": "features.scrollarea",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "resizehandler": {
+ "label": "QWidgetResizeHandler",
+ "purpose": "Provides an internal resize handler for dock widgets.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "statusbar": {
+ "label": "QStatusBar",
+ "purpose": "Supports presentation of status information.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "menubar": {
+ "label": "QMenuBar",
+ "purpose": "Provides pull-down menu items.",
+ "section": "Widgets",
+ "condition": "features.menu && features.toolbutton",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "contextmenu": {
+ "label": "Context menus",
+ "purpose": "Adds pop-up menus on right mouse click to numerous widgets.",
+ "section": "Widgets",
+ "condition": "features.menu",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "progressbar": {
+ "label": "QProgressBar",
+ "purpose": "Supports presentation of operation progress.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "slider": {
+ "label": "QSlider",
+ "purpose": "Provides sliders controlling a bounded value.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "scrollbar": {
+ "label": "QScrollBar",
+ "purpose": "Provides scrollbars allowing the user access parts of a document that is larger than the widget used to display it.",
+ "section": "Widgets",
+ "condition": "features.slider",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "dial": {
+ "label": "QDial",
+ "purpose": "Provides a rounded range control, e.g., like a speedometer.",
+ "section": "Widgets",
+ "condition": "features.slider",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "scrollarea": {
+ "label": "QScrollArea",
+ "purpose": "Supports scrolling views onto widgets.",
+ "section": "Widgets",
+ "condition": "features.scrollbar",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "graphicsview": {
+ "label": "QGraphicsView",
+ "purpose": "Provides a canvas/sprite framework.",
+ "section": "Widgets",
+ "condition": "features.scrollarea",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "graphicseffect": {
+ "label": "QGraphicsEffect",
+ "purpose": "Provides various graphics effects.",
+ "section": "Widgets",
+ "condition": "features.graphicsview",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "spinbox": {
+ "label": "QSpinBox",
+ "purpose": "Provides spinbox control widgets.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "textedit": {
+ "label": "QTextEdit",
+ "purpose": "Supports rich text editing.",
+ "section": "Widgets",
+ "condition": "features.scrollarea && features.properties",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "syntaxhighlighter": {
+ "label": "QSyntaxHighlighter",
+ "purpose": "Supports custom syntax highlighting.",
+ "section": "Widgets",
+ "condition": "features.textedit",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "rubberband": {
+ "label": "QRubberBand",
+ "purpose": "Supports using rubberbands to indicate selections and boundaries.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tooltip": {
+ "label": "QToolTip",
+ "purpose": "Supports presentation of tooltips.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "statustip": {
+ "label": "Status Tip",
+ "purpose": "Supports status tip functionality and events.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "whatsthis": {
+ "label": "QWhatsThis",
+ "purpose": "Supports displaying \"What's this\" help.",
+ "section": "Widgets",
+ "condition": "features.toolbutton",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "sizegrip": {
+ "label": "QSizeGrip",
+ "purpose": "Provides corner-grips for resizing top-level windows.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "calendarwidget": {
+ "label": "QCalendarWidget",
+ "purpose": "Provides a monthly based calendar widget allowing the user to select a date.",
+ "section": "Widgets",
+ "condition": "features.tableview && features.menu && features.textdate && features.spinbox && features.toolbutton",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "keysequenceedit": {
+ "label": "QKeySequenceEdit",
+ "purpose": "Provides a widget for editing QKeySequences.",
+ "section": "Widgets",
+ "condition": "features.lineedit && features.shortcut",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "messagebox": {
+ "label": "QMessageBox",
+ "purpose": "Provides message boxes displaying informative messages and simple questions.",
+ "section": "Dialogs",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "colordialog": {
+ "label": "QColorDialog",
+ "purpose": "Provides a dialog widget for specifying colors.",
+ "section": "Dialogs",
+ "condition": "features.spinbox",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "filedialog": {
+ "label": "QFileDialog",
+ "purpose": "Provides a dialog widget for selecting files or directories.",
+ "section": "Dialogs",
+ "condition": "features.dirmodel && features.treeview && features.combobox && features.toolbutton && features.buttongroup && features.tooltip && features.splitter && features.stackedwidget && features.proxymodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "fontdialog": {
+ "label": "QFontDialog",
+ "purpose": "Provides a dialog widget for selecting fonts.",
+ "section": "Dialogs",
+ "condition": "features.stringlistmodel && features.combobox && features.validator && features.groupbox",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "progressdialog": {
+ "label": "QProgressDialog",
+ "purpose": "Provides feedback on the progress of a slow operation.",
+ "section": "Dialogs",
+ "condition": "features.progressbar",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "inputdialog": {
+ "label": "QInputDialog",
+ "purpose": "Provides a simple convenience dialog to get a single value from the user.",
+ "section": "Dialogs",
+ "condition": "features.combobox && features.spinbox && features.stackedwidget",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "errormessage": {
+ "label": "QErrorMessage",
+ "purpose": "Provides an error message display dialog.",
+ "section": "Dialogs",
+ "condition": "features.textedit",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "wizard": {
+ "label": "QWizard",
+ "purpose": "Provides a framework for multi-page click-through dialogs.",
+ "section": "Dialogs",
+ "condition": "features.properties",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "dirmodel": {
+ "label": "QDirModel",
+ "purpose": "Provides a data model for the local filesystem.",
+ "section": "ItemViews",
+ "condition": "features.itemviews && features.filesystemmodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "listview": {
+ "label": "QListView",
+ "purpose": "Provides a list or icon view onto a model.",
+ "section": "ItemViews",
+ "condition": "features.itemviews",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tableview": {
+ "label": "QTableView",
+ "purpose": "Provides a default model/view implementation of a table view.",
+ "section": "ItemViews",
+ "condition": "features.itemviews",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "treeview": {
+ "label": "QTreeView",
+ "purpose": "Provides a default model/view implementation of a tree view.",
+ "section": "ItemViews",
+ "condition": "features.itemviews",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "datawidgetmapper": {
+ "label": "QDataWidgetMapper",
+ "purpose": "Provides mapping between a section of a data model to widgets.",
+ "section": "ItemViews",
+ "condition": "features.itemviews && features.properties",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "columnview": {
+ "label": "QColumnView",
+ "purpose": "Provides a model/view implementation of a column view.",
+ "section": "ItemViews",
+ "condition": "features.listview",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "paint_debug": {
+ "label": "Painting Debug Utilities",
+ "purpose": "Enabled debugging painting with the environment variables QT_FLUSH_UPDATE and QT_FLUSH_PAINT.",
+ "section": "Painting",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "completer": {
+ "label": "QCompleter",
+ "purpose": "Provides completions based on an item model.",
+ "section": "Utilities",
+ "condition": "features.proxymodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "fscompleter": {
+ "label": "QFSCompleter",
+ "purpose": "Provides file name completion in QFileDialog.",
+ "section": "Utilities",
+ "condition": "features.filesystemmodel && features.completer",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "undocommand": {
+ "label": "QUndoCommand",
+ "purpose": "Applies (redo or) undo of a single change in a document.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "undostack": {
+ "label": "QUndoStack",
+ "purpose": "Provides the ability to (redo or) undo a list of changes in a document.",
+ "section": "Utilities",
+ "condition": "features.undocommand",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "undogroup": {
+ "label": "QUndoGroup",
+ "purpose": "Provides the ability to cluster QUndoCommands.",
+ "section": "Utilities",
+ "condition": "features.undostack",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "undoview": {
+ "label": "QUndoView",
+ "purpose": "Provides a widget which shows the contents of an undo stack.",
+ "section": "Utilities",
+ "condition": "features.undostack && features.listview",
+ "output": [ "publicFeature", "feature" ]
+ }
+ },
+
+ "report": [
+ ],
+
+ "summary": [
+ {
+ "section": "Qt Widgets",
+ "entries": [
+ "gtk3",
+ {
+ "message": "Styles",
+ "type": "featureList",
+ "args": "style-fusion style-mac style-windows style-windowsxp style-windowsvista style-android"
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/widgets/configure.pri b/src/widgets/configure.pri
new file mode 100644
index 0000000000..ddb3657700
--- /dev/null
+++ b/src/widgets/configure.pri
@@ -0,0 +1,8 @@
+# custom outputs
+
+defineTest(qtConfOutput_styles) {
+ !$${2}: return()
+
+ style = $$replace($${1}.feature, "style-", "")
+ qtConfOutputVar(append, "privatePro", "styles", $$style)
+}
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 9e7da2835b..39eacae596 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);
@@ -1933,10 +1927,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/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index b036570427..3b56f0b5d1 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -40,6 +40,7 @@
#ifndef QCOLORDIALOG_H
#define QCOLORDIALOG_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 8a26e1b2a7..e8883df527 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.
@@ -659,12 +634,14 @@ void QDialog::contextMenuEvent(QContextMenuEvent *e)
/*! \reimp */
void QDialog::keyPressEvent(QKeyEvent *e)
{
+#ifndef QT_NO_SHORTCUT
// Calls reject() if Escape is pressed. Simulates a button
// click for the default button if Enter is pressed. Move focus
// for the arrow keys. Ignore the rest.
if (e->matches(QKeySequence::Cancel)) {
reject();
} else
+#endif
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) {
case Qt::Key_Enter:
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index db5baf24f9..265790b0e5 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -40,6 +40,7 @@
#ifndef QDIALOG_H
#define QDIALOG_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
@@ -98,9 +99,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 +111,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..1c7c5f3c2a 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qwidget_p.h"
#include "QtCore/qeventloop.h"
#include "QtCore/qpointer.h"
@@ -99,10 +100,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/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 03d0dbf5c5..5ffa568c10 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -40,6 +40,7 @@
#ifndef QERRORMESSAGE_H
#define QERRORMESSAGE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index fc360d8381..879f085f11 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())
{
}
@@ -1752,7 +1744,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)
@@ -4016,7 +4008,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.h b/src/widgets/dialogs/qfiledialog.h
index f13cb98e96..4ade50793d 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -40,6 +40,7 @@
#ifndef QFILEDIALOG_H
#define QFILEDIALOG_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qdir.h>
#include <QtCore/qstring.h>
#include <QtCore/qurl.h>
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index f273a4fb37..afebad4457 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_FILEDIALOG
@@ -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/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index a6ae136c21..3186e9d015 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
+
#include <qthread.h>
#include <qmutex.h>
#include <qwaitcondition.h>
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 7fc51f4262..11b3659990 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.h b/src/widgets/dialogs/qfilesystemmodel.h
index 6d50d0b606..7d790124c8 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -40,6 +40,7 @@
#ifndef QFILESYSTEMMODEL_H
#define QFILESYSTEMMODEL_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qpair.h>
#include <QtCore/qdir.h>
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index af3406b699..92398d981f 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qfilesystemmodel.h"
#ifndef QT_NO_FILESYSTEMMODEL
@@ -95,7 +96,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 b62cd58db7..3a833e85c0 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/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index f76ce1b7f3..276f8f5e83 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -40,6 +40,7 @@
#ifndef QFONTDIALOG_H
#define QFONTDIALOG_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtWidgets/qdialog.h>
#include <QtGui/qfont.h>
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index d6a6e87ee2..033f5a2be8 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -52,6 +52,7 @@
//
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qdialog_p.h"
#include "qfontdatabase.h"
#include "qfontdialog.h"
diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h
index a3341999f7..c073fa1521 100644
--- a/src/widgets/dialogs/qfscompleter_p.h
+++ b/src/widgets/dialogs/qfscompleter_p.h
@@ -51,9 +51,12 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qcompleter.h"
#include <QtWidgets/qfilesystemmodel.h>
+
QT_BEGIN_NAMESPACE
+
#ifndef QT_NO_FSCOMPLETER
/*!
@@ -74,7 +77,10 @@ public:
QAbstractProxyModel *proxyModel;
QFileSystemModel *sourceModel;
};
+
#endif // QT_NO_FSCOMPLETER
+
QT_END_NAMESPACE
+
#endif // QFSCOMPLETOR_P_H
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 8adaf5a430..2fbea908cb 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -40,6 +40,7 @@
#ifndef QINPUTDIALOG_H
#define QINPUTDIALOG_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qdialog.h>
#include <QtCore/qstring.h>
#include <QtWidgets/qlineedit.h>
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 3d52cb206a..57b3f47863 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;
}
@@ -1431,7 +1379,7 @@ void QMessageBox::changeEvent(QEvent *ev)
d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this));
if (d->informativeLabel)
d->informativeLabel->setTextInteractionFlags(flags);
- // intentional fall through
+ Q_FALLTHROUGH();
}
case QEvent::FontChange:
case QEvent::ApplicationFontChange:
@@ -1442,6 +1390,7 @@ void QMessageBox::changeEvent(QEvent *ev)
d->label->setFont(f);
}
#endif
+ Q_FALLTHROUGH();
default:
break;
}
@@ -1525,20 +1474,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 +1531,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 +1844,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..c6a55964fe 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -40,6 +40,7 @@
#ifndef QMESSAGEBOX_H
#define QMESSAGEBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
@@ -142,10 +143,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/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index 888deac046..a5e333259f 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -40,6 +40,7 @@
#ifndef QPROGRESSDIALOG_H
#define QPROGRESSDIALOG_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 210c86be01..3e177e7e68 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <qlistwidget.h>
#include <qstandarditemmodel.h>
#include <qstyleditemdelegate.h>
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index fed35ef638..bcad069b50 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.h b/src/widgets/dialogs/qwizard.h
index a188833ef3..9ce68b6566 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -40,6 +40,7 @@
#ifndef QWIZARD_H
#define QWIZARD_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qdialog.h>
QT_BEGIN_NAMESPACE
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..288e7adaf5 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA
@@ -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/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index 07c826fc93..06ee78f2a0 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSEFFECT_H
#define QGRAPHICSEFFECT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h
index 3c8dc0338d..12bdbfe6fc 100644
--- a/src/widgets/effects/qgraphicseffect_p.h
+++ b/src/widgets/effects/qgraphicseffect_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgraphicseffect.h"
#include <QPixmapCache>
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index 0aeedaf827..b9af3ae916 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qnamespace.h>
#include <QtGui/qpixmap.h>
#include <QtWidgets/qgraphicseffect.h>
diff --git a/src/widgets/graphicsview/qgraph_p.h b/src/widgets/graphicsview/qgraph_p.h
index 14f7122d5c..b0bf3c91c9 100644
--- a/src/widgets/graphicsview/qgraph_p.h
+++ b/src/widgets/graphicsview/qgraph_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/QHash>
#include <QtCore/QQueue>
#include <QtCore/QString>
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h
index e824edfd0a..6d69957400 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSANCHORLAYOUT_H
#define QGRAPHICSANCHORLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qgraphicsitem.h>
#include <QtWidgets/qgraphicslayout.h>
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
index 7f50b3fda4..b6d8a12658 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QGraphicsWidget>
#include <private/qobject_p.h>
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h
index 0687511966..c7c2edd2a2 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSGRIDLAYOUT_H
#define QGRAPHICSGRIDLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qgraphicsitem.h>
#include <QtWidgets/qgraphicslayout.h>
diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
index 08e4af6f8c..a099dace6b 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtGui/private/qgridlayoutengine_p.h>
#ifndef QT_NO_GRAPHICSVIEW
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index df81d70742..5492862287 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.
@@ -9573,7 +9570,7 @@ public:
shape = qt_regionToPath(QRegion(mask).translated(offset.toPoint()));
break;
}
- // FALL THROUGH
+ Q_FALLTHROUGH();
}
case QGraphicsPixmapItem::BoundingRectShape:
shape.addRect(QRectF(offset.x(), offset.y(), pixmap.width(), pixmap.height()));
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index fa51739bb9..59656f5b0b 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -40,7 +40,7 @@
#ifndef QGRAPHICSITEM_H
#define QGRAPHICSITEM_H
-#include <QtCore/qglobal.h>
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
#include <QtCore/qrect.h>
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index e45e18c484..c88236d6e8 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgraphicsitem.h"
#include "qset.h"
#include "qpixmapcache.h"
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h
index 9c2a26e5d5..f02e0ac793 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.h
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSITEMANIMATION_H
#define QGRAPHICSITEMANIMATION_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#if !defined(QT_NO_GRAPHICSVIEW)
diff --git a/src/widgets/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h
index bf79f29f48..5b1c465414 100644
--- a/src/widgets/graphicsview/qgraphicslayout.h
+++ b/src/widgets/graphicsview/qgraphicslayout.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSLAYOUT_H
#define QGRAPHICSLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qgraphicslayoutitem.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h
index 043d2cf077..47d8611786 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.h
+++ b/src/widgets/graphicsview/qgraphicslayout_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#if !defined(QT_NO_GRAPHICSVIEW)
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h
index 639f04f1bd..02bda0ad8d 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSLAYOUTITEM_H
#define QGRAPHICSLAYOUTITEM_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qscopedpointer.h>
#include <QtWidgets/qsizepolicy.h>
#include <QtGui/qevent.h>
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem_p.h b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
index 355e2ab47d..96e7cc7fd9 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem_p.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/QSizeF>
#include <QtWidgets/QSizePolicy>
diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
index 7edc61ef12..9d3aa22548 100644
--- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
+++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtGui/private/qabstractlayoutstyleinfo_p.h>
#include <QtWidgets/qstyleoption.h>
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h
index c30f11b1b2..ebe8e903d9 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.h
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSLINEARLAYOUT_H
#define QGRAPHICSLINEARLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qgraphicsitem.h>
#include <QtWidgets/qgraphicslayout.h>
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h
index 7fbfba6dac..8112c65d63 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSPROXYWIDGET_H
#define QGRAPHICSPROXYWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qgraphicswidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
index 1e49bcb143..0797ba7066 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget_p.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgraphicsproxywidget.h"
#include "private/qgraphicswidget_p.h"
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 15edb15619..5b46eb35be 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4658,8 +4658,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;
@@ -5432,12 +5431,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/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index 5535295676..b1846303f7 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSSCENE_H
#define QGRAPHICSSCENE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
index 5b83817911..1ab9c10d6a 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qlist.h>
#if !defined(QT_NO_GRAPHICSVIEW)
diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h
index ed9dd99822..795676878b 100644
--- a/src/widgets/graphicsview/qgraphicsscene_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgraphicsscene.h"
#if !defined(QT_NO_GRAPHICSVIEW)
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
index faa847ff80..b195a4757c 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -51,7 +51,7 @@
#ifndef QGRAPHICSBSPTREEINDEX_H
#define QGRAPHICSBSPTREEINDEX_H
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#if !defined(QT_NO_GRAPHICSVIEW)
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h
index 3b4eaa828e..4d6cde1b87 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.h
+++ b/src/widgets/graphicsview/qgraphicssceneevent.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSSCENEEVENT_H
#define QGRAPHICSSCENEEVENT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qpoint.h>
#include <QtCore/qscopedpointer.h>
diff --git a/src/widgets/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h
index 79936aee66..2085acd532 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex_p.h
+++ b/src/widgets/graphicsview/qgraphicssceneindex_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgraphicsscene_p.h"
#include "qgraphicsscene.h"
#include <private/qobject_p.h>
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
index 7ad14d1e6e..47cba93fce 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#if !defined(QT_NO_GRAPHICSVIEW)
@@ -114,8 +114,8 @@ private:
int m_numSortedElements;
};
-#endif // QT_NO_GRAPHICSVIEW
-
QT_END_NAMESPACE
+#endif // QT_NO_GRAPHICSVIEW
+
#endif // QGRAPHICSSCENELINEARINDEX_H
diff --git a/src/widgets/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h
index 7d5004c7a0..6a76926725 100644
--- a/src/widgets/graphicsview/qgraphicstransform.h
+++ b/src/widgets/graphicsview/qgraphicstransform.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSTRANSFORM_H
#define QGRAPHICSTRANSFORM_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/QObject>
#include <QtGui/QVector3D>
#include <QtGui/QTransform>
diff --git a/src/widgets/graphicsview/qgraphicstransform_p.h b/src/widgets/graphicsview/qgraphicstransform_p.h
index 85ebdf87ba..39f7ab5487 100644
--- a/src/widgets/graphicsview/qgraphicstransform_p.h
+++ b/src/widgets/graphicsview/qgraphicstransform_p.h
@@ -51,8 +51,11 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qobject_p.h"
+
#ifndef QT_NO_GRAPHICSVIEW
+
QT_BEGIN_NAMESPACE
class QGraphicsItem;
@@ -73,6 +76,7 @@ public:
};
QT_END_NAMESPACE
+
#endif //QT_NO_GRAPHCISVIEW
#endif // QGRAPHICSTRANSFORM_P_H
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 442918169a..3f7d2d1cd1 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/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index 97152d3bca..327a75c374 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSVIEW_H
#define QGRAPHICSVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qmetatype.h>
#include <QtGui/qpainter.h>
#include <QtWidgets/qscrollarea.h>
diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h
index 7c4058b18b..9065650216 100644
--- a/src/widgets/graphicsview/qgraphicsview_p.h
+++ b/src/widgets/graphicsview/qgraphicsview_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgraphicsview.h"
#if !defined(QT_NO_GRAPHICSVIEW)
diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h
index e147c06fc9..5cb97db381 100644
--- a/src/widgets/graphicsview/qgraphicswidget.h
+++ b/src/widgets/graphicsview/qgraphicswidget.h
@@ -40,6 +40,7 @@
#ifndef QGRAPHICSWIDGET_H
#define QGRAPHICSWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qfont.h>
#include <QtWidgets/qgraphicslayoutitem.h>
#include <QtWidgets/qgraphicsitem.h>
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h
index 195704f915..18542c68e6 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.h
+++ b/src/widgets/graphicsview/qgraphicswidget_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <private/qobject_p.h>
#include "qgraphicsitem_p.h"
#include "qgraphicswidget.h"
diff --git a/src/widgets/graphicsview/qsimplex_p.h b/src/widgets/graphicsview/qsimplex_p.h
index 61af6fbc3d..634b2e0425 100644
--- a/src/widgets/graphicsview/qsimplex_p.h
+++ b/src/widgets/graphicsview/qsimplex_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qhash.h>
#include <QtCore/qpair.h>
#include <QtCore/qstring.h>
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 5e3b74f7b7..8cd2a957be 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -464,11 +464,13 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
if (editorHandlesKeyEvent(editor, keyEvent))
return false;
+#ifndef QT_NO_SHORTCUT
if (keyEvent->matches(QKeySequence::Cancel)) {
// don't commit data
emit q->closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
return true;
}
+#endif
switch (keyEvent->key()) {
case Qt::Key_Tab:
@@ -519,11 +521,13 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
emit q->closeEditor(editor, QAbstractItemDelegate::NoHint);
}
+#ifndef QT_NO_SHORTCUT
} else if (event->type() == QEvent::ShortcutOverride) {
if (static_cast<QKeyEvent*>(event)->matches(QKeySequence::Cancel)) {
event->accept();
return true;
}
+#endif
}
return false;
}
diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h
index 9fe72655ab..9f7a7716af 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.h
+++ b/src/widgets/itemviews/qabstractitemdelegate.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTITEMDELEGATE_H
#define QABSTRACTITEMDELEGATE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtWidgets/qstyleoption.h>
diff --git a/src/widgets/itemviews/qabstractitemdelegate_p.h b/src/widgets/itemviews/qabstractitemdelegate_p.h
index 958737dd01..0b03be63f0 100644
--- a/src/widgets/itemviews/qabstractitemdelegate_p.h
+++ b/src/widgets/itemviews/qabstractitemdelegate_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qabstractitemdelegate.h"
#include <private/qobject_p.h>
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 578f040f77..a4e24b80b1 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
@@ -2473,10 +2473,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
break;
#endif
default: {
+#ifndef QT_NO_SHORTCUT
if (event == QKeySequence::SelectAll && selectionMode() != NoSelection) {
selectAll();
break;
}
+#endif
#ifdef Q_OS_OSX
if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) {
emit activated(currentIndex());
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 4741833654..d6c5d58934 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTITEMVIEW_H
#define QABSTRACTITEMVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractscrollarea.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qitemselectionmodel.h>
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index fcbe25d735..f8ada6df08 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractscrollarea_p.h"
#include "private/qabstractitemmodel_p.h"
#include "QtWidgets/qapplication.h"
diff --git a/src/widgets/itemviews/qbsptree_p.h b/src/widgets/itemviews/qbsptree_p.h
index 4e57297296..5fd7a5c45f 100644
--- a/src/widgets/itemviews/qbsptree_p.h
+++ b/src/widgets/itemviews/qbsptree_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <qvector.h>
#include <qrect.h>
diff --git a/src/widgets/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h
index 1cf6acc405..7d5e2f5cd1 100644
--- a/src/widgets/itemviews/qcolumnview.h
+++ b/src/widgets/itemviews/qcolumnview.h
@@ -40,6 +40,7 @@
#ifndef QCOLUMNVIEW_H
#define QCOLUMNVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h
index 73d3e440d5..7eff0f66cd 100644
--- a/src/widgets/itemviews/qcolumnview_p.h
+++ b/src/widgets/itemviews/qcolumnview_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qcolumnview.h"
#ifndef QT_NO_QCOLUMNVIEW
diff --git a/src/widgets/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h
index 8c82486968..3447f9f824 100644
--- a/src/widgets/itemviews/qcolumnviewgrip_p.h
+++ b/src/widgets/itemviews/qcolumnviewgrip_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <private/qwidget_p.h>
#ifndef QT_NO_QCOLUMNVIEW
diff --git a/src/widgets/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h
index e7e4bc7210..4d244349ad 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.h
+++ b/src/widgets/itemviews/qdatawidgetmapper.h
@@ -40,6 +40,7 @@
#ifndef QDATAWIDGETMAPPER_H
#define QDATAWIDGETMAPPER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include "QtCore/qobject.h"
#ifndef QT_NO_DATAWIDGETMAPPER
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 1546037c2c..95e6a1840d 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.constFirst();
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/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h
index 7b4b859e0e..90a9809986 100644
--- a/src/widgets/itemviews/qdirmodel.h
+++ b/src/widgets/itemviews/qdirmodel.h
@@ -40,6 +40,7 @@
#ifndef QDIRMODEL_H
#define QDIRMODEL_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qdir.h>
#include <QtWidgets/qfileiconprovider.h>
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index 66c0ffcd58..8c3cf3859e 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -60,106 +60,6 @@
QT_BEGIN_NAMESPACE
-static bool isCacheable(const QFileInfo &fi);
-
-class QFileIconEngine : public QPixmapIconEngine
-{
-public:
- QFileIconEngine(const QFileInfo &info, QFileIconProvider::Options opts)
- : QPixmapIconEngine(), m_fileInfo(info), m_fipOpts(opts)
- { }
-
- QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE
- {
- Q_UNUSED(mode);
- Q_UNUSED(state);
- QPixmap pixmap;
-
- if (!size.isValid())
- return pixmap;
-
- const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
- if (!theme)
- return pixmap;
-
- const QString &keyBase = QLatin1String("qt_.") + m_fileInfo.suffix().toUpper();
-
- bool cacheable = isCacheable(m_fileInfo);
- if (cacheable) {
- QPixmapCache::find(keyBase + QString::number(size.width()), pixmap);
- if (!pixmap.isNull())
- return pixmap;
- }
-
- QPlatformTheme::IconOptions iconOptions;
- if (m_fipOpts & QFileIconProvider::DontUseCustomDirectoryIcons)
- iconOptions |= QPlatformTheme::DontUseCustomDirectoryIcons;
-
- pixmap = theme->fileIconPixmap(m_fileInfo, size, iconOptions);
- if (!pixmap.isNull()) {
- if (cacheable)
- QPixmapCache::insert(keyBase + QString::number(size.width()), pixmap);
- }
-
- return pixmap;
- }
-
- QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const Q_DECL_OVERRIDE
- {
- Q_UNUSED(mode);
- Q_UNUSED(state);
- static QList<QSize> sizes;
- static QPlatformTheme *theme = 0;
- if (!theme) {
- theme = QGuiApplicationPrivate::platformTheme();
- if (!theme)
- return sizes;
-
- QList<int> themeSizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >();
- if (themeSizes.isEmpty())
- return sizes;
-
- sizes.reserve(themeSizes.count());
- foreach (int size, themeSizes)
- sizes << QSize(size, size);
- }
- return sizes;
- }
-
- QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE
- {
- const QList<QSize> &sizes = availableSizes(mode, state);
- const int numberSizes = sizes.length();
- if (numberSizes == 0)
- return QSize();
-
- // Find the smallest available size whose area is still larger than the input
- // size. Otherwise, use the largest area available size. (We don't assume the
- // platform theme sizes are sorted, hence the extra logic.)
- const int sizeArea = size.width() * size.height();
- QSize actualSize = sizes.first();
- int actualArea = actualSize.width() * actualSize.height();
- for (int i = 1; i < numberSizes; ++i) {
- const QSize &s = sizes.at(i);
- const int a = s.width() * s.height();
- if ((sizeArea <= a && a < actualArea) || (actualArea < sizeArea && actualArea < a)) {
- actualSize = s;
- actualArea = a;
- }
- }
-
- if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
- actualSize.scale(size, Qt::KeepAspectRatio);
-
- return actualSize;
- }
-
-private:
- QFileInfo m_fileInfo;
- QFileIconProvider::Options m_fipOpts;
-};
-
-
/*!
\class QFileIconProvider
@@ -322,34 +222,17 @@ QIcon QFileIconProvider::icon(IconType type) const
return QIcon();
}
-static bool isCacheable(const QFileInfo &fi)
+static inline QPlatformTheme::IconOptions toThemeIconOptions(QFileIconProvider::Options options)
{
- if (!fi.isFile())
- return false;
-
-#ifdef Q_OS_WIN
- // On windows it's faster to just look at the file extensions. QTBUG-13182
- const QString fileExtension = fi.suffix();
- // Will return false for .exe, .lnk and .ico extensions
- return fileExtension.compare(QLatin1String("exe"), Qt::CaseInsensitive) &&
- fileExtension.compare(QLatin1String("lnk"), Qt::CaseInsensitive) &&
- fileExtension.compare(QLatin1String("ico"), Qt::CaseInsensitive);
-#else
- return !fi.isExecutable() && !fi.isSymLink();
-#endif
+ QPlatformTheme::IconOptions result;
+ if (options & QFileIconProvider::DontUseCustomDirectoryIcons)
+ result |= QPlatformTheme::DontUseCustomDirectoryIcons;
+ return result;
}
QIcon QFileIconProviderPrivate::getIcon(const QFileInfo &fi) const
{
- const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
- if (!theme)
- return QIcon();
-
- QList<int> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >();
- if (sizes.isEmpty())
- return QIcon();
-
- return QIcon(new QFileIconEngine(fi, options));
+ return QGuiApplicationPrivate::platformTheme()->fileIcon(fi, toThemeIconOptions(options));
}
/*!
@@ -365,7 +248,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/qfileiconprovider.h b/src/widgets/itemviews/qfileiconprovider.h
index e4c8c0d23e..732ca1ac8e 100644
--- a/src/widgets/itemviews/qfileiconprovider.h
+++ b/src/widgets/itemviews/qfileiconprovider.h
@@ -40,6 +40,7 @@
#ifndef QFILEICONPROVIDER_H
#define QFILEICONPROVIDER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qscopedpointer.h>
#include <QtGui/qicon.h>
diff --git a/src/widgets/itemviews/qfileiconprovider_p.h b/src/widgets/itemviews/qfileiconprovider_p.h
index 1cf7f947ad..4726b15816 100644
--- a/src/widgets/itemviews/qfileiconprovider_p.h
+++ b/src/widgets/itemviews/qfileiconprovider_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qfileiconprovider.h"
#include <QtCore/qstring.h>
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 1a0b417034..85bd3003e1 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -2563,7 +2563,7 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e)
int section = logicalIndexAt(pos);
updateSection(section);
}
- // fall through
+ Q_FALLTHROUGH();
case QHeaderViewPrivate::NoState:
if (d->clickableSections) {
int section = logicalIndexAt(pos);
@@ -2669,7 +2669,7 @@ bool QHeaderView::viewportEvent(QEvent *e)
case QEvent::FontChange:
case QEvent::StyleChange:
d->invalidateCachedSizeHint();
- // Fall through
+ Q_FALLTHROUGH();
case QEvent::Hide:
case QEvent::Show: {
QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget());
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index c2e3a1f05e..4be97c0c7e 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -40,6 +40,7 @@
#ifndef QHEADERVIEW_H
#define QHEADERVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index bbef2127a6..0356d79ff7 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractitemview_p.h"
#ifndef QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h
index e02da15f5e..3d98419c80 100644
--- a/src/widgets/itemviews/qitemdelegate.h
+++ b/src/widgets/itemviews/qitemdelegate.h
@@ -40,6 +40,7 @@
#ifndef QITEMDELEGATE_H
#define QITEMDELEGATE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemdelegate.h>
#include <QtCore/qstring.h>
#include <QtGui/qpixmap.h>
diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h
index b5f8fa2354..785d4d84ea 100644
--- a/src/widgets/itemviews/qitemeditorfactory.h
+++ b/src/widgets/itemviews/qitemeditorfactory.h
@@ -40,6 +40,7 @@
#ifndef QITEMEDITORFACTORY_H
#define QITEMEDITORFACTORY_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qhash.h>
diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h
index 3b080c3a44..91edcf65ba 100644
--- a/src/widgets/itemviews/qitemeditorfactory_p.h
+++ b/src/widgets/itemviews/qitemeditorfactory_p.h
@@ -52,7 +52,7 @@
//
-
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <qlineedit.h>
#ifndef QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index f44cf90616..e918e66d38 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -40,6 +40,7 @@
#ifndef QLISTVIEW_H
#define QLISTVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 90fb9e1407..42cb6b4eef 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractitemview_p.h"
#include "qrubberband.h"
#include "qbitarray.h"
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index 06e2469398..c70e0522b7 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -40,6 +40,7 @@
#ifndef QLISTWIDGET_H
#define QLISTWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qlistview.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index bb0c35db5f..eaddfc6e6e 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtWidgets/qabstractitemview.h>
#include <QtWidgets/qlistwidget.h>
diff --git a/src/widgets/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h
index bf011cdf10..d30e6e0e9c 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.h
+++ b/src/widgets/itemviews/qstyleditemdelegate.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEDITEMDELEGATE_H
#define QSTYLEDITEMDELEGATE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemdelegate.h>
#include <QtCore/qstring.h>
#include <QtGui/qpixmap.h>
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/qtableview.h b/src/widgets/itemviews/qtableview.h
index 5ab05b91bf..8c9ac379bc 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -40,6 +40,7 @@
#ifndef QTABLEVIEW_H
#define QTABLEVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index 617ecb1642..2ca158d657 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/QList>
#include <QtCore/QLinkedList>
#include <QtCore/QMap>
diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h
index 91249e47ee..5dde93f628 100644
--- a/src/widgets/itemviews/qtablewidget.h
+++ b/src/widgets/itemviews/qtablewidget.h
@@ -40,6 +40,7 @@
#ifndef QTABLEWIDGET_H
#define QTABLEWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qtableview.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h
index d3a2f02205..313577befe 100644
--- a/src/widgets/itemviews/qtablewidget_p.h
+++ b/src/widgets/itemviews/qtablewidget_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <qheaderview.h>
#include <qtablewidget.h>
#include <qabstractitemmodel.h>
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 4ce7da0229..cfe68d6b6a 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/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index d7166a3b33..3c7cbddfbb 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -40,6 +40,7 @@
#ifndef QTREEVIEW_H
#define QTREEVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
class tst_QTreeView;
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index a3619ce13b..56f3340966 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractitemview_p.h"
#include <QtCore/qvariantanimation.h>
#include <QtCore/qabstractitemmodel.h>
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 31d60c06d7..1338ce4585 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -1738,7 +1738,7 @@ void QTreeWidgetItem::setData(int column, int role, const QVariant &value)
}
}
}
- // Don't break, but fall through
+ Q_FALLTHROUGH();
default:
if (column < values.count()) {
bool found = false;
@@ -1788,7 +1788,7 @@ QVariant QTreeWidgetItem::data(int column, int role) const
// special case for check state in tristate
if (children.count() && (itemFlags & Qt::ItemIsAutoTristate))
return childrenCheckState(column);
- // fallthrough intended
+ Q_FALLTHROUGH();
default:
if (column >= 0 && column < values.size()) {
const QVector<QWidgetItemData> &column_values = values.at(column);
diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h
index e360d62c5f..36ba9985bd 100644
--- a/src/widgets/itemviews/qtreewidget.h
+++ b/src/widgets/itemviews/qtreewidget.h
@@ -40,6 +40,7 @@
#ifndef QTREEWIDGET_H
#define QTREEWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qtreeview.h>
#include <QtWidgets/qtreewidgetitemiterator.h>
#include <QtCore/qvariant.h>
diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h
index 7e7e8e9e35..7789693db4 100644
--- a/src/widgets/itemviews/qtreewidget_p.h
+++ b/src/widgets/itemviews/qtreewidget_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstractitemmodel.h>
#include <private/qabstractitemmodel_p.h>
#include <QtCore/qpair.h>
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h
index 2cdf03fd7a..db17a96abd 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.h
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.h
@@ -40,7 +40,7 @@
#ifndef QTREEWIDGETITEMITERATOR_H
#define QTREEWIDGETITEMITERATOR_H
-#include <QtCore/qglobal.h>
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/itemviews/qwidgetitemdata_p.h b/src/widgets/itemviews/qwidgetitemdata_p.h
index 6c100553ba..b7ed6ed862 100644
--- a/src/widgets/itemviews/qwidgetitemdata_p.h
+++ b/src/widgets/itemviews/qwidgetitemdata_p.h
@@ -40,6 +40,7 @@
#ifndef QWIDGETITEMDATA_P_H
#define QWIDGETITEMDATA_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qdatastream.h>
//
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 0060ad2d31..ad2180bbfd 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -5,8 +5,10 @@ PRECOMPILED_HEADER = kernel/qt_widgets_pch.h
KERNEL_P= kernel
HEADERS += \
- kernel/qaction.h \
- kernel/qaction_p.h \
+ kernel/qtwidgetsglobal.h \
+ kernel/qtwidgetsglobal_p.h \
+ kernel/qaction.h \
+ kernel/qaction_p.h \
kernel/qactiongroup.h \
kernel/qapplication.h \
kernel/qapplication_p.h \
@@ -78,7 +80,7 @@ wince {
kernel/qwidgetsfunctions_wince.cpp
}
-contains(QT_CONFIG, opengl) {
+qtConfig(opengl) {
HEADERS += kernel/qopenglwidget.h
SOURCES += kernel/qopenglwidget.cpp
}
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 81cf9ea754..e0700d877e 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
*/
static QString qt_strippedText(QString s)
{
- s.remove( QString::fromLatin1("...") );
+ s.remove(QStringLiteral("..."));
for (int i = 0; i < s.size(); ++i) {
if (s.at(i) == QLatin1Char('&'))
s.remove(i, 1);
@@ -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);
}
/*!
@@ -1315,8 +1304,10 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QAction *action)
d << " toolTip=" << action->toolTip();
if (action->isCheckable())
d << " checked=" << action->isChecked();
+#ifndef QT_NO_SHORTCUT
if (!action->shortcut().isEmpty())
d << " shortcut=" << action->shortcut();
+#endif
d << " menuRole=";
QtDebugUtils::formatQEnum(d, action->menuRole());
d << " visible=" << action->isVisible();
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index bd491c89ca..97948a2457 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -40,6 +40,7 @@
#ifndef QACTION_H
#define QACTION_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qkeysequence.h>
#include <QtCore/qstring.h>
#include <QtWidgets/qwidget.h>
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 84c6774141..8ee71a5ff0 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qaction.h"
#include "QtWidgets/qmenu.h"
#include "private/qgraphicswidget_p.h"
diff --git a/src/widgets/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h
index b9d82aeb8c..61c90b911d 100644
--- a/src/widgets/kernel/qactiongroup.h
+++ b/src/widgets/kernel/qactiongroup.h
@@ -40,6 +40,7 @@
#ifndef QACTIONGROUP_H
#define QACTIONGROUP_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qaction.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 1b77d74cd0..815ae7fe33 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
@@ -894,6 +868,7 @@ QApplication::~QApplication()
#endif
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// #fixme: Remove.
static HDC displayDC = 0; // display device context
@@ -906,6 +881,7 @@ Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display D
return displayDC;
}
#endif
+#endif
void qt_cleanup()
{
@@ -913,12 +889,14 @@ void qt_cleanup()
QColormap::cleanup();
QApplicationPrivate::active_window = 0; //### this should not be necessary
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
if (displayDC) {
ReleaseDC(0, displayDC);
displayDC = 0;
}
#endif
+#endif
}
/*!
@@ -1023,30 +1001,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
*/
/*!
- \property QApplication::autoMaximizeThreshold
- \since 4.4
- \brief defines a threshold for auto maximizing widgets
- \deprecated
- \b{The auto maximize threshold is only available as part of Qt for
- Windows CE.}
-
- This property defines a threshold for the size of a window as a percentage
- of the screen size. If the minimum size hint of a window exceeds the
- threshold, calling show() will cause the window to be maximized
- automatically.
-
- Setting the threshold to 100 or greater means that the widget will always
- be maximized. Alternatively, setting the threshold to 50 means that the
- widget will be maximized only if the vertical minimum size hint is at least
- 50% of the vertical screen size.
-
- Setting the threshold to -1 disables the feature.
-
- On Windows CE the default is -1 (i.e., it is disabled).
- On Windows Mobile the default is 40.
-*/
-
-/*!
\property QApplication::autoSipEnabled
\since 4.5
\brief toggles automatic SIP (software input panel) visibility
@@ -1061,19 +1015,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;
@@ -1127,15 +1068,17 @@ QStyle *QApplication::style()
if (!QApplicationPrivate::app_style) {
// Compile-time search for default style
//
- QString style;
+ QStyle *&app_style = QApplicationPrivate::app_style;
+
if (!QApplicationPrivate::styleOverride.isEmpty()) {
- style = QApplicationPrivate::styleOverride.toLower();
- } else {
- style = QApplicationPrivate::desktopStyleKey();
+ const QString style = QApplicationPrivate::styleOverride.toLower();
+ app_style = QStyleFactory::create(style);
+ if (!app_style)
+ qWarning("QApplication: invalid style override passed, ignoring it.");
}
+ if (!app_style)
+ app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey());
- QStyle *&app_style = QApplicationPrivate::app_style;
- app_style = QStyleFactory::create(style);
if (!app_style) {
const QStringList styles = QStyleFactory::keys();
for (const auto &style : styles) {
@@ -1314,17 +1257,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 +1327,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)
}
/*!
@@ -3637,7 +3581,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// We may get here if the widget is subscribed to a gesture,
// but has not accepted TouchBegin. Propagate touch events
// only if TouchBegin has been accepted.
- if (widget && widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent))
+ if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent))
res = d->notify_helper(widget, e);
break;
}
@@ -3777,7 +3721,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..be5ec2ad05 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -40,6 +40,7 @@
#ifndef QAPPLICATION_H
#define QAPPLICATION_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qpoint.h>
@@ -84,9 +85,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 +99,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 +195,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..dd0edc7c80 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qapplication.h"
#include "QtGui/qevent.h"
#include "QtGui/qfont.h"
@@ -90,11 +91,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 +124,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 +184,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/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index 6c548fbbca..9c7d0e593f 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -40,6 +40,7 @@
#ifndef QBOXLAYOUT_H
#define QBOXLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qlayout.h>
#ifdef QT_INCLUDE_COMPAT
#include <QtWidgets/qwidget.h>
diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
index 9fb6b293f7..64e1c568eb 100644
--- a/src/widgets/kernel/qdesktopwidget.h
+++ b/src/widgets/kernel/qdesktopwidget.h
@@ -40,6 +40,7 @@
#ifndef QDESKTOPWIDGET_H
#define QDESKTOPWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h
index a590024b7c..4846a868aa 100644
--- a/src/widgets/kernel/qdesktopwidget_p.h
+++ b/src/widgets/kernel/qdesktopwidget_p.h
@@ -51,6 +51,7 @@
#ifndef QDESKTOPWIDGET_P_H
#define QDESKTOPWIDGET_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QDesktopWidget"
#include "private/qwidget_p.h"
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 4500b5b25d..73e82c577c 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -66,6 +66,7 @@ public:
int rowCount() const { return m_storage.size() / NumColumns; }
void insertRow(int r, const T &value);
+ void removeRow(int r);
// Hmmpf.. Some things are faster that way.
const Storage &storage() const { return m_storage; }
@@ -85,6 +86,12 @@ void FixedColumnMatrix<T, NumColumns>::insertRow(int r, const T &value)
}
template <class T, int NumColumns>
+void FixedColumnMatrix<T, NumColumns>::removeRow(int r)
+{
+ m_storage.remove(r * NumColumns, NumColumns);
+}
+
+template <class T, int NumColumns>
void FixedColumnMatrix<T, NumColumns>::storageIndexToPosition(int idx, int *rowPtr, int *colPtr)
{
*rowPtr = idx / NumColumns;
@@ -157,6 +164,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);
@@ -919,6 +927,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;
@@ -1150,6 +1164,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()
@@ -1352,6 +1388,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
*/
@@ -1408,18 +1725,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..b4185374fd 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -40,6 +40,7 @@
#ifndef QFORMLAYOUT_H
#define QFORMLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/QLayout>
QT_BEGIN_NAMESPACE
@@ -80,6 +81,11 @@ public:
};
Q_ENUM(ItemRole)
+ struct TakeRowResult {
+ QLayoutItem *labelItem;
+ QLayoutItem *fieldItem;
+ };
+
explicit QFormLayout(QWidget *parent = Q_NULLPTR);
~QFormLayout();
@@ -114,6 +120,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 +167,8 @@ private:
void resetFormAlignment();
};
+Q_DECLARE_TYPEINFO(QFormLayout::TakeRowResult, Q_PRIMITIVE_TYPE);
+
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 57b59abf60..034d1d88c1 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -40,6 +40,7 @@
#ifndef QGESTURE_H
#define QGESTURE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qlist.h>
#include <QtCore/qdatetime.h>
diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h
index b438b81e31..636103c1e1 100644
--- a/src/widgets/kernel/qgesture_p.h
+++ b/src/widgets/kernel/qgesture_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qrect.h"
#include "qpoint.h"
#include "qgesture.h"
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/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h
index 9cd1f79418..ec51466a63 100644
--- a/src/widgets/kernel/qgesturemanager_p.h
+++ b/src/widgets/kernel/qgesturemanager_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qobject.h"
#include "qbasictimer.h"
#include "private/qwidget_p.h"
diff --git a/src/widgets/kernel/qgesturerecognizer.h b/src/widgets/kernel/qgesturerecognizer.h
index f44f763217..04e85c46cc 100644
--- a/src/widgets/kernel/qgesturerecognizer.h
+++ b/src/widgets/kernel/qgesturerecognizer.h
@@ -40,7 +40,7 @@
#ifndef QGESTURERECOGNIZER_H
#define QGESTURERECOGNIZER_H
-#include <QtCore/qglobal.h>
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qnamespace.h>
#ifndef QT_NO_GESTURES
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/qgridlayout.h b/src/widgets/kernel/qgridlayout.h
index fc6e70748f..51dd65d181 100644
--- a/src/widgets/kernel/qgridlayout.h
+++ b/src/widgets/kernel/qgridlayout.h
@@ -40,6 +40,7 @@
#ifndef QGRIDLAYOUT_H
#define QGRIDLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qlayout.h>
#ifdef QT_INCLUDE_COMPAT
#include <QtWidgets/qwidget.h>
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 7f30a78848..1a341d155b 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -809,7 +809,7 @@ static bool layoutDebug()
{
static int checked_env = -1;
if(checked_env == -1)
- checked_env = !!qgetenv("QT_LAYOUT_DEBUG").toInt();
+ checked_env = !!qEnvironmentVariableIntValue("QT_LAYOUT_DEBUG");
return checked_env;
}
@@ -944,12 +944,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/qlayout.h b/src/widgets/kernel/qlayout.h
index d76e12ca8c..2de12b4f99 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -40,6 +40,7 @@
#ifndef QLAYOUT_H
#define QLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtWidgets/qlayoutitem.h>
#include <QtWidgets/qsizepolicy.h>
diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h
index 0d70c74fe5..8a1b12a6be 100644
--- a/src/widgets/kernel/qlayout_p.h
+++ b/src/widgets/kernel/qlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qobject_p.h"
#include "qstyle.h"
#include "qsizepolicy.h"
diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h
index 0f7d3fdb90..812fa7cf3b 100644
--- a/src/widgets/kernel/qlayoutengine_p.h
+++ b/src/widgets/kernel/qlayoutengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qlayoutitem.h"
#include "QtWidgets/qstyle.h"
diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h
index b54a59084b..6f701b9f82 100644
--- a/src/widgets/kernel/qlayoutitem.h
+++ b/src/widgets/kernel/qlayoutitem.h
@@ -40,6 +40,7 @@
#ifndef QLAYOUTITEM_H
#define QLAYOUTITEM_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qsizepolicy.h>
#include <QtCore/qrect.h>
diff --git a/src/widgets/kernel/qmacgesturerecognizer_p.h b/src/widgets/kernel/qmacgesturerecognizer_p.h
index 844d4a6460..be3f3266ac 100644
--- a/src/widgets/kernel/qmacgesturerecognizer_p.h
+++ b/src/widgets/kernel/qmacgesturerecognizer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qtimer.h"
#include "qpoint.h"
#include "qgesturerecognizer.h"
diff --git a/src/widgets/kernel/qopenglwidget.h b/src/widgets/kernel/qopenglwidget.h
index acbbb24c40..b60d79bedb 100644
--- a/src/widgets/kernel/qopenglwidget.h
+++ b/src/widgets/kernel/qopenglwidget.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLWIDGET_H
#define QOPENGLWIDGET_H
-#include <QtCore/qglobal.h>
+#include <QtWidgets/qtwidgetsglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index bf162249d0..6eec5ff7e8 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -141,7 +141,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window)
{
bool visible = w->isVisible();
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true;
#endif
@@ -204,7 +204,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)
{
bool visible = w->isVisible();
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR)
if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w))
visible = true;
#endif
@@ -272,7 +272,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
QWidget *w = widgets.at(i);
#ifndef QT_NO_MENU
if (QMenu *menu = qobject_cast<QMenu *>(w)) {
-#ifdef Q_OS_MAC
+#ifdef Q_OS_DARWIN
// On Mac, menu item shortcuts are processed before reaching any window.
// That means that if a menu action shortcut has not been already processed
// (and reaches this point), then the menu item itself has been disabled.
@@ -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/qshortcut.h b/src/widgets/kernel/qshortcut.h
index c3ccbe3c08..22c667c9c1 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -40,6 +40,7 @@
#ifndef QSHORTCUT_H
#define QSHORTCUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtGui/qkeysequence.h>
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 7a1e22fdc2..63b578fbf3 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -40,6 +40,7 @@
#ifndef QSIZEPOLICY_H
#define QSIZEPOLICY_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h
index fb83fddc43..6f5eded1f0 100644
--- a/src/widgets/kernel/qstackedlayout.h
+++ b/src/widgets/kernel/qstackedlayout.h
@@ -40,6 +40,7 @@
#ifndef QSTACKEDLAYOUT_H
#define QSTACKEDLAYOUT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qlayout.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h
index abda1a3f6e..9b2cffaa9a 100644
--- a/src/widgets/kernel/qstandardgestures_p.h
+++ b/src/widgets/kernel/qstandardgestures_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qgesturerecognizer.h"
#include "private/qgesture_p.h"
diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h
index f58a8895eb..f30202d89e 100644
--- a/src/widgets/kernel/qt_widgets_pch.h
+++ b/src/widgets/kernel/qt_widgets_pch.h
@@ -47,7 +47,7 @@
// from corelib/global/qt_pch.h
#if defined __cplusplus
-#include <qglobal.h>
+#include <qtwidgetsglobal.h>
#ifdef Q_DEAD_CODE_FROM_QT4_WIN
diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h
index aad6e941c8..5e68eef0a7 100644
--- a/src/widgets/kernel/qtooltip.h
+++ b/src/widgets/kernel/qtooltip.h
@@ -40,6 +40,7 @@
#ifndef QTOOLTIP_H
#define QTOOLTIP_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/config.tests/x11/xrandr/xrandr.cpp b/src/widgets/kernel/qtwidgetsglobal.h
index 4fb8a1b94c..1c74f37618 100644
--- a/config.tests/x11/xrandr/xrandr.cpp
+++ b/src/widgets/kernel/qtwidgetsglobal.h
@@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the config.tests of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,16 +37,24 @@
**
****************************************************************************/
-#include <X11/Xlib.h>
-#include <X11/extensions/Xrandr.h>
+#ifndef QTWIDGETSGLOBAL_H
+#define QTWIDGETSGLOBAL_H
-#if RANDR_MAJOR != 1 || RANDR_MINOR < 1
-# error "Requried Xrandr version 1.1 not found."
+#include <QtGui/qtguiglobal.h>
+#include <QtWidgets/qtwidgets-config.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_WIDGETS_LIB)
+# define Q_WIDGETS_EXPORT Q_DECL_EXPORT
+# else
+# define Q_WIDGETS_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_WIDGETS_EXPORT
#endif
-int main(int, char **)
-{
- XRRScreenSize *size;
- size = 0;
- return 0;
-}
+QT_END_NAMESPACE
+
+#endif // QTGUIGLOBAL_H
diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/widgets/kernel/qtwidgetsglobal_p.h
index f2c620a966..22ba876022 100644
--- a/src/widgets/kernel/qwidgetsfunctions_wince.h
+++ b/src/widgets/kernel/qtwidgetsglobal_p.h
@@ -36,25 +36,23 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QWIDGETSFUNCTIONS_WCE_H
-#define QWIDGETSFUNCTIONS_WCE_H
-#include <QtCore/qglobal.h>
+#ifndef QTWIDGETSGLOBAL_P_H
+#define QTWIDGETSGLOBAL_P_H
-#ifdef Q_OS_WINCE
-#include <QtCore/qfunctions_wince.h>
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
-#ifdef QT_BUILD_GUI_LIB
-QT_BEGIN_NAMESPACE
-QT_END_NAMESPACE
-#endif
+#include <QtWidgets/qtwidgetsglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtWidgets/private/qtwidgets-config_p.h>
-
-//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
-
-#endif // Q_OS_WINCE
-#endif // QWIDGETSFUNCTIONS_WCE_H
+#endif // QTWIDGETSGLOBAL_P_H
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 66b622911a..32fe5f5e64 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -450,8 +450,8 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e)
QApplication::changeOverrideCursor((!sentEvent || !e.isAccepted())?
Qt::ForbiddenCursor:Qt::WhatsThisCursor);
#endif
+ Q_FALLTHROUGH();
}
- // fall through
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
if (leaveOnMouseRelease && e->type() == QEvent::MouseButtonRelease)
diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h
index 0889653e2c..746fd3ff22 100644
--- a/src/widgets/kernel/qwhatsthis.h
+++ b/src/widgets/kernel/qwhatsthis.h
@@ -40,6 +40,7 @@
#ifndef QWHATSTHIS_H
#define QWHATSTHIS_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qcursor.h>
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index b2973349e5..51e1ef9aaf 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1111,11 +1111,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
@@ -2412,9 +2408,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);
}
}
@@ -4560,7 +4555,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
) {
@@ -8563,13 +8558,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;
}
@@ -8850,7 +8841,7 @@ bool QWidget::event(QEvent *event)
case QEvent::KeyRelease:
keyReleaseEvent((QKeyEvent*)event);
- // fall through
+ Q_FALLTHROUGH();
case QEvent::ShortcutOverride:
break;
@@ -8969,7 +8960,7 @@ bool QWidget::event(QEvent *event)
0, this);
break;
}
- // fall through
+ Q_FALLTHROUGH();
#endif
default:
event->ignore();
@@ -9218,7 +9209,7 @@ bool QWidget::event(QEvent *event)
}
if (windowHandle() && !qstrncmp(propName, "_q_platform_", 12))
windowHandle()->setProperty(propName, property(propName));
- // fall through
+ Q_FALLTHROUGH();
}
#endif
default:
@@ -9466,10 +9457,13 @@ void QWidget::tabletEvent(QTabletEvent *event)
void QWidget::keyPressEvent(QKeyEvent *event)
{
+#ifndef QT_NO_SHORTCUT
if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) {
event->accept();
close();
- } else {
+ } else
+#endif
+ {
event->ignore();
}
}
@@ -9551,7 +9545,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();
@@ -10766,10 +10760,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;
}
@@ -10809,7 +10801,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()));
@@ -11220,13 +11212,13 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->enforceNativeChildren();
}
#endif
- // fall through
+ Q_FALLTHROUGH();
case Qt::WA_OpaquePaintEvent:
d->updateIsOpaque();
break;
case Qt::WA_NoSystemBackground:
d->updateIsOpaque();
- // fall through...
+ Q_FALLTHROUGH();
case Qt::WA_UpdatesDisabled:
d->updateSystemBackground();
break;
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index a810e0b089..bca89fe2c5 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -40,6 +40,7 @@
#ifndef QWIDGET_H
#define QWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qobject.h>
#include <QtCore/qmargins.h>
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 19b7238a70..3e57f9de41 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qwidget.h"
#include "private/qobject_p.h"
#include "QtCore/qrect.h"
diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h
index 4adb9b61ea..3da691a430 100644
--- a/src/widgets/kernel/qwidgetaction.h
+++ b/src/widgets/kernel/qwidgetaction.h
@@ -40,6 +40,7 @@
#ifndef QWIDGETACTION_H
#define QWIDGETACTION_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qaction.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h
index 20da855185..1fbcf236a1 100644
--- a/src/widgets/kernel/qwidgetaction_p.h
+++ b/src/widgets/kernel/qwidgetaction_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qaction_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index ac8902c9e6..81fbe49a43 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -176,7 +176,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);
@@ -303,7 +303,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);
}
@@ -372,7 +372,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()));
@@ -550,13 +550,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) {
@@ -649,12 +642,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);
@@ -791,7 +778,6 @@ void QWidgetBackingStore::updateLists(QWidget *cur)
QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel)
: tlw(topLevel),
dirtyOnScreenWidgets(0),
- fullUpdatePending(0),
updateRequestSent(0),
textureListWatcher(0),
perfFrames(0)
@@ -1170,7 +1156,6 @@ void QWidgetBackingStore::sync()
for (int i = 0; i < dirtyWidgets.size(); ++i)
resetWidget(dirtyWidgets.at(i));
dirtyWidgets.clear();
- fullUpdatePending = false;
}
return;
}
@@ -1187,7 +1172,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());
@@ -1283,7 +1268,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()) {
@@ -1349,9 +1333,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..16b36423a6 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QDebug>
#include <QtWidgets/qwidget.h>
#include <private/qwidget_p.h>
@@ -116,7 +117,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 +136,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/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h
index a0d79b2b72..edf2383596 100644
--- a/src/widgets/kernel/qwidgetwindow_p.h
+++ b/src/widgets/kernel/qwidgetwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtGui/qwindow.h>
#include <QtCore/private/qobject_p.h>
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index d7f4b1f989..bb25a3a986 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -97,11 +97,14 @@ public:
}
QWidget *p = q->parentWidget();
while (p) {
- if (
+ if (false
#ifndef QT_NO_MDIAREA
- qobject_cast<QMdiSubWindow *>(p) != 0 ||
+ || qobject_cast<QMdiSubWindow *>(p) != 0
#endif
- qobject_cast<QAbstractScrollArea *>(p) != 0) {
+#ifndef QT_NO_SCROLLAREA
+ || qobject_cast<QAbstractScrollArea *>(p) != 0
+#endif
+ ) {
q->winId();
usesNativeWidgets = true;
break;
diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h
index 557a56169e..1d838c8dd6 100644
--- a/src/widgets/kernel/qwindowcontainer_p.h
+++ b/src/widgets/kernel/qwindowcontainer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
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/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index 0af3ce8051..576c5beb5d 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
#ifndef QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index a9f7999355..72320a52dc 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
#ifndef QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index dc62f7909d..1e3f02acd8 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -40,6 +40,7 @@
#ifndef QKEYEVENTTRANSITION_H
#define QKEYEVENTTRANSITION_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index f9e9ba7a21..43185b140d 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -40,6 +40,7 @@
#ifndef QMOUSEEVENTTRANSITION_H
#define QMOUSEEVENTTRANSITION_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qandroidstyle_p.h b/src/widgets/styles/qandroidstyle_p.h
index 0c9d2469f0..4649d90852 100644
--- a/src/widgets/styles/qandroidstyle_p.h
+++ b/src/widgets/styles/qandroidstyle_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/QList>
#include <QtCore/QMargins>
#include <QtCore/QHash>
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index cf81f53ad0..140f0ad2f3 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);
}
}
@@ -4230,7 +4232,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
switch (sc) {
case SC_GroupBoxFrame:
- // FALL THROUGH
case SC_GroupBoxContents: {
int topMargin = 0;
int topHeight = 0;
@@ -4259,7 +4260,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
break;
}
case SC_GroupBoxCheckBox:
- // FALL THROUGH
case SC_GroupBoxLabel: {
QFontMetrics fontMetrics = groupBox->fontMetrics;
int h = fontMetrics.height();
@@ -4325,7 +4325,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
if (numSubControls == 1)
break;
offset += buttonWidth + 2;
- //FALL THROUGH
+ Q_FALLTHROUGH();
case SC_MdiNormalButton:
// No offset needed if
// 1) There's only one sub control
@@ -4393,6 +4393,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 +4852,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
@@ -4884,7 +4893,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_ProgressBar:
case CT_TabBarTab:
// just return the contentsSize for now
- // fall through intended
+ Q_FALLTHROUGH();
default:
break;
}
@@ -5902,14 +5911,14 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon);
QIcon retIcon;
- QList<int> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >();
- Q_FOREACH (int size, sizes) {
+ const QList<QSize> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<QSize> >();
+ for (const QSize &size : sizes) {
QPixmap mainIcon;
- const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size);
+ const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size.width());
if (standardIcon >= QStyle::SP_CustomBase) {
- mainIcon = theme->standardPixmap(sp, QSizeF(size, size));
+ mainIcon = theme->standardPixmap(sp, QSizeF(size));
} else if (QPixmapCache::find(cacheKey, mainIcon) == false) {
- mainIcon = theme->standardPixmap(sp, QSizeF(size, size));
+ mainIcon = theme->standardPixmap(sp, QSizeF(size));
QPixmapCache::insert(cacheKey, mainIcon);
}
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index 9eb1c548bd..ed880a150f 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -40,6 +40,7 @@
#ifndef QCOMMONSTYLE_H
#define QCOMMONSTYLE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qstyle.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h
index 031789fc5f..2ef7f30d21 100644
--- a/src/widgets/styles/qcommonstyle_p.h
+++ b/src/widgets/styles/qcommonstyle_p.h
@@ -40,6 +40,7 @@
#ifndef QCOMMONSTYLE_P_H
#define QCOMMONSTYLE_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qcommonstyle.h"
#include "qstyle_p.h"
#include "qstyleanimation_p.h"
diff --git a/src/widgets/styles/qcommonstylepixmaps_p.h b/src/widgets/styles/qcommonstylepixmaps_p.h
index 8842bc8b76..58b979465a 100644
--- a/src/widgets/styles/qcommonstylepixmaps_p.h
+++ b/src/widgets/styles/qcommonstylepixmaps_p.h
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_IMAGEFORMAT_XPM
diff --git a/src/widgets/styles/qdrawutil.h b/src/widgets/styles/qdrawutil.h
index adb4478bc9..121221dfc9 100644
--- a/src/widgets/styles/qdrawutil.h
+++ b/src/widgets/styles/qdrawutil.h
@@ -40,6 +40,7 @@
#ifndef QDRAWUTIL_H
#define QDRAWUTIL_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qstring.h> // char*->QString conversion
#include <QtCore/qmargins.h>
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/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index c836b9e193..126fb96e78 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qcommonstyle.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h
index e45055f2c2..8d1d27d244 100644
--- a/src/widgets/styles/qfusionstyle_p_p.h
+++ b/src/widgets/styles/qfusionstyle_p_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qcommonstyle.h"
#include "qcommonstyle_p.h"
#include <qpa/qplatformtheme.h>
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 9a07eaf851..1f17810fc9 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -96,6 +96,7 @@
#include <private/qstyleanimation_p.h>
#include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformtheme.h>
+#include <QtGui/private/qcoregraphics_p.h>
QT_USE_NAMESPACE
@@ -190,12 +191,14 @@ typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
static int closeButtonSize = 12;
+#ifndef QT_NO_TABBAR
static bool isVerticalTabs(const QTabBar::Shape shape) {
return (shape == QTabBar::RoundedEast
|| shape == QTabBar::TriangularEast
|| shape == QTabBar::RoundedWest
|| shape == QTabBar::TriangularWest);
}
+#endif
static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY)
{
@@ -247,6 +250,7 @@ void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected)
p->drawLine(min, max, max, min);
}
+#ifndef QT_NO_TABBAR
QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect)
{
if (isVerticalTabs(shape)) {
@@ -430,6 +434,7 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget *
p->setPen(borderBottom);
p->drawLine(tabRect.x(), height - 1, width, height - 1);
}
+#endif
static int getControlSize(const QStyleOption *option, const QWidget *widget)
{
@@ -445,13 +450,16 @@ static int getControlSize(const QStyleOption *option, const QWidget *widget)
}
+#ifndef QT_NO_TREEVIEW
static inline bool isTreeView(const QWidget *widget)
{
return (widget && widget->parentWidget() &&
(qobject_cast<const QTreeView *>(widget->parentWidget())
));
}
+#endif
+#ifndef QT_NO_TABBAR
static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape)
{
ThemeTabDirection ttd;
@@ -476,6 +484,7 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape)
}
return ttd;
}
+#endif
static QString qt_mac_removeMnemonics(const QString &original)
{
@@ -512,47 +521,6 @@ static QString qt_mac_removeMnemonics(const QString &original)
return returnText;
}
-static CGContextRef qt_mac_cg_context(const QPaintDevice *pdev);
-
-namespace {
-class QMacCGContext
-{
- CGContextRef context;
-public:
- QMacCGContext(QPainter *p);
- inline QMacCGContext() { context = 0; }
- inline QMacCGContext(const QPaintDevice *pdev) {
- context = qt_mac_cg_context(pdev);
- }
- inline QMacCGContext(CGContextRef cg, bool takeOwnership=false) {
- context = cg;
- if (!takeOwnership)
- CGContextRetain(context);
- }
- inline QMacCGContext(const QMacCGContext &copy) : context(0) { *this = copy; }
- inline ~QMacCGContext() {
- if (context)
- CGContextRelease(context);
- }
- inline bool isNull() const { return context; }
- inline operator CGContextRef() { return context; }
- inline QMacCGContext &operator=(const QMacCGContext &copy) {
- if (context)
- CGContextRelease(context);
- context = copy.context;
- CGContextRetain(context);
- return *this;
- }
- inline QMacCGContext &operator=(CGContextRef cg) {
- if (context)
- CGContextRelease(context);
- context = cg;
- CGContextRetain(context); //we do not take ownership
- return *this;
- }
-};
-} // anonymous namespace
-
OSStatus qt_mac_shape2QRegionHelper(int inMessage, HIShapeRef, const CGRect *inRect, void *inRefcon)
{
QRegion *region = static_cast<QRegion *>(inRefcon);
@@ -573,7 +541,6 @@ OSStatus qt_mac_shape2QRegionHelper(int inMessage, HIShapeRef, const CGRect *inR
return noErr;
}
-
/*!
\internal
Create's a mutable shape, it's the caller's responsibility to release.
@@ -587,7 +554,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);
}
@@ -603,86 +570,6 @@ QRegion qt_mac_fromHIShapeRef(HIShapeRef shape)
return returnRegion;
}
-CGColorSpaceRef m_genericColorSpace = 0;
-static QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash;
-bool m_postRoutineRegistered = false;
-
-static CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget);
-static CGColorSpaceRef qt_mac_genericColorSpace()
-{
-#if 0
- if (!m_genericColorSpace) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- } else
- {
- m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
- }
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
- }
- }
- return m_genericColorSpace;
-#else
- // Just return the main display colorspace for the moment.
- return qt_mac_displayColorSpace(0);
-#endif
-}
-
-static void qt_mac_cleanUpMacColorSpaces()
-{
- if (m_genericColorSpace) {
- CFRelease(m_genericColorSpace);
- m_genericColorSpace = 0;
- }
- QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
- while (it != m_displayColorSpaceHash.constEnd()) {
- if (it.value())
- CFRelease(it.value());
- ++it;
- }
- m_displayColorSpaceHash.clear();
-}
-
-/*
- Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc.
- to support multiple displays correctly.
-*/
-static CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
-{
- CGColorSpaceRef colorSpace;
-
- CGDirectDisplayID displayID;
- if (widget == 0) {
- displayID = CGMainDisplayID();
- } else {
- displayID = CGMainDisplayID();
- /*
- ### get correct display
- const QRect &qrect = widget->window()->geometry();
- CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
- CGDisplayCount throwAway;
- CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
- if (dErr != kCGErrorSuccess)
- return macDisplayColorSpace(0); // fall back on main display
- */
- }
- if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
- return colorSpace;
-
- colorSpace = CGDisplayCopyColorSpace(displayID);
- if (colorSpace == 0)
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- m_displayColorSpaceHash.insert(displayID, colorSpace);
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
- }
- return colorSpace;
-}
-
bool qt_macWindowIsTextured(const QWidget *window)
{
if (QWindow *w = window->windowHandle())
@@ -742,8 +629,10 @@ inline bool qt_mac_is_metal(const QWidget *w)
if (w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) { // If not created will fall through to the opaque check and be fine anyway.
return qt_macWindowIsTextured(w);
}
+#ifndef QT_NO_ACCESSIBILITY
if (w->d_func()->isOpaque)
break;
+#endif
}
return false;
}
@@ -778,22 +667,34 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ct = QStyle::CT_RadioButton;
else if (qobject_cast<const QCheckBox *>(widg))
ct = QStyle::CT_CheckBox;
+#ifndef QT_NO_COMBOBOX
else if (qobject_cast<const QComboBox *>(widg))
ct = QStyle::CT_ComboBox;
+#endif
+#ifndef QT_NO_TOOLBUTTON
else if (qobject_cast<const QToolButton *>(widg))
ct = QStyle::CT_ToolButton;
+#endif
else if (qobject_cast<const QSlider *>(widg))
ct = QStyle::CT_Slider;
+#ifndef QT_NO_PROGRESSBAR
else if (qobject_cast<const QProgressBar *>(widg))
ct = QStyle::CT_ProgressBar;
+#endif
+#ifndef QT_NO_LINEEDIT
else if (qobject_cast<const QLineEdit *>(widg))
ct = QStyle::CT_LineEdit;
+#endif
else if (qobject_cast<const QHeaderView *>(widg))
ct = QStyle::CT_HeaderSection;
+#ifndef QT_NO_MENUBAR
else if (qobject_cast<const QMenuBar *>(widg))
ct = QStyle::CT_MenuBar;
+#endif
+#ifndef QT_NO_SIZEGRIP
else if (qobject_cast<const QSizeGrip *>(widg))
ct = QStyle::CT_SizeGrip;
+#endif
else
return ret;
}
@@ -903,6 +804,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
if (sz == QAquaSizeSmall) {
int width = 0, height = 0;
if (szHint == QSize(-1, -1)) { //just 'guess'..
+#ifndef QT_NO_TOOLBUTTON
const QToolButton *bt = qobject_cast<const QToolButton *>(widg);
// If this conversion fails then the widget was not what it claimed to be.
if(bt) {
@@ -923,7 +825,9 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
width = qMax(height, text_height);
}
}
- } else {
+ } else
+#endif
+ {
// Let's return the size hint...
width = szHint.width();
height = szHint.height();
@@ -987,6 +891,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ret.setWidth(w);
break;
}
+#ifndef QT_NO_PROGRESSBAR
case QStyle::CT_ProgressBar: {
int finalValue = -1;
Qt::Orientation orient = Qt::Horizontal;
@@ -1005,6 +910,8 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ret.setWidth(finalValue);
break;
}
+#endif
+#ifndef QT_NO_COMBOBOX
case QStyle::CT_LineEdit:
if (!widg || !qobject_cast<QComboBox *>(widg->parentWidget())) {
//should I take into account the font dimentions of the lineedit? -Sam
@@ -1014,9 +921,12 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ret = QSize(-1, 19);
}
break;
+#endif
case QStyle::CT_HeaderSection:
+#ifndef QT_NO_TREEVIEW
if (isTreeView(widg))
ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight));
+#endif
break;
case QStyle::CT_MenuBar:
if (sz == QAquaSizeLarge) {
@@ -1400,7 +1310,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;
@@ -1424,6 +1334,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
// an extra check here before using the mini and small buttons.
int h = combo->rect.size().height();
if (combo->editable){
+#ifndef QT_NO_DATETIMEEDIT
if (qobject_cast<const QDateTimeEdit *>(widget)) {
// Except when, you know, we get a QDateTimeEdit with calendarPopup
// enabled. And then things get weird, basically because it's a
@@ -1440,7 +1351,9 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
bdi->kind = kThemeComboBoxSmall;
else
bdi->kind = kThemeComboBox;
- } else {
+ } else
+#endif
+ {
if (h < 21)
bdi->kind = kThemeComboBoxMini;
else if (h < 26)
@@ -1719,7 +1632,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;
@@ -2249,13 +2162,11 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
painter->setClipRegion(rgn);
- QCFType<CGContextRef> cg = qt_mac_cg_context(target);
+ QMacCGContext cg(target);
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());
@@ -2310,7 +2221,12 @@ void QMacStyle::polish(QWidget* w)
w->setAttribute(Qt::WA_SetPalette, false);
}
- if (qobject_cast<QMenu*>(w) || qobject_cast<QComboBoxPrivateContainer *>(w)) {
+#ifndef QT_NO_MENU
+ if (qobject_cast<QMenu*>(w)
+#ifndef QT_NO_COMBOBOX
+ || qobject_cast<QComboBoxPrivateContainer *>(w)
+#endif
+ ) {
w->setWindowOpacity(0.985);
if (!w->testAttribute(Qt::WA_SetPalette)) {
QPixmap px(64, 64);
@@ -2320,7 +2236,7 @@ void QMacStyle::polish(QWidget* w)
mtinfo.menuType = kThemeMenuTypePopUp;
// HIRect rect = CGRectMake(0, 0, px.width(), px.height());
// ###
- //HIThemeDrawMenuBackground(&rect, &mtinfo, QCFType<CGContextRef>(qt_mac_cg_context(&px)),
+ //HIThemeDrawMenuBackground(&rect, &mtinfo, QMacCGContext(&px)),
// kHIThemeOrientationNormal);
QPalette pal = w->palette();
QBrush background(px);
@@ -2330,7 +2246,9 @@ void QMacStyle::polish(QWidget* w)
w->setAttribute(Qt::WA_SetPalette, false);
}
}
+#endif
+#ifndef QT_NO_TABBAR
if (QTabBar *tb = qobject_cast<QTabBar*>(w)) {
if (tb->documentMode()) {
w->setAttribute(Qt::WA_Hover);
@@ -2340,6 +2258,7 @@ void QMacStyle::polish(QWidget* w)
w->setPalette(p);
}
}
+#endif
QCommonStyle::polish(w);
@@ -2358,19 +2277,26 @@ void QMacStyle::polish(QWidget* w)
void QMacStyle::unpolish(QWidget* w)
{
- if ((qobject_cast<QMenu*>(w) || qt_mac_is_metal(w)) && !w->testAttribute(Qt::WA_SetPalette)) {
+ if ((
+#ifndef QT_NO_MENU
+ qobject_cast<QMenu*>(w) ||
+#endif
+ qt_mac_is_metal(w)
+ ) && !w->testAttribute(Qt::WA_SetPalette)) {
QPalette pal = qApp->palette(w);
w->setPalette(pal);
w->setAttribute(Qt::WA_SetPalette, false);
w->setWindowOpacity(1.0);
}
+#ifndef QT_NO_COMBOBOX
if (QComboBox *combo = qobject_cast<QComboBox *>(w)) {
if (!combo->isEditable()) {
if (QWidget *widget = combo->findChild<QComboBoxPrivateContainer *>())
widget->setWindowOpacity(1.0);
}
}
+#endif
if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) {
rubber->setWindowOpacity(1.0);
@@ -2880,9 +2806,12 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = QEvent::MouseButtonRelease;
break;
case SH_TabBar_SelectMouseType:
+#ifndef QT_NO_TABBAR
if (const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
ret = opt2->documentMode ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease;
- } else {
+ } else
+#endif
+ {
ret = QEvent::MouseButtonRelease;
}
break;
@@ -2902,18 +2831,22 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = Qt::AlignRight;
break;
case SH_TabBar_Alignment: {
+#ifndef QT_NO_TABWIDGET
if (const QTabWidget *tab = qobject_cast<const QTabWidget*>(w)) {
if (tab->documentMode()) {
ret = Qt::AlignLeft;
break;
}
}
+#endif
+#ifndef QT_NO_TABBAR
if (const QTabBar *tab = qobject_cast<const QTabBar*>(w)) {
if (tab->documentMode()) {
ret = Qt::AlignLeft;
break;
}
}
+#endif
ret = Qt::AlignCenter;
} break;
case SH_UnderlineShortcut:
@@ -3043,9 +2976,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_FocusFrame_AboveWidget:
ret = true;
break;
+#ifndef QT_NO_WIZARD
case SH_WizardStyle:
ret = QWizard::MacStyle;
break;
+#endif
case SH_ItemView_ArrowKeysNavigateIntoChildren:
ret = false;
break;
@@ -3063,9 +2998,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
opt->rect.width(), opt->rect.height() - 8);
HIThemeMenuDrawInfo mdi;
mdi.version = 0;
+#ifndef QT_NO_MENU
if (w && qobject_cast<QMenu *>(w->parentWidget()))
mdi.menuType = kThemeMenuTypeHierarchical;
else
+#endif
mdi.menuType = kThemeMenuTypePopUp;
QCFType<HIShapeRef> shape;
HIThemeGetMenuBackgroundShape(&menuRect, &mdi, &shape);
@@ -3077,9 +3014,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_ItemView_PaintAlternatingRowColorsForEmptyArea:
ret = true;
break;
+#ifndef QT_NO_TABBAR
case SH_TabBar_CloseButtonPosition:
ret = QTabBar::LeftSide;
break;
+#endif
case SH_DockWidget_ButtonsHaveFrame:
ret = false;
break;
@@ -3248,6 +3187,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->drawPath(path);
p->restore();
break; }
+#ifndef QT_NO_TABBAR
case PE_FrameTabBarBase:
if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
@@ -3283,6 +3223,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->restore();
}
break;
+#endif
case PE_PanelTipLabel:
p->fillRect(opt->rect, opt->palette.brush(QPalette::ToolTipBase));
break;
@@ -3294,9 +3235,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
HIThemeGroupBoxDrawInfo gdi;
gdi.version = qt_mac_hitheme_version;
gdi.state = tds;
+#ifndef QT_NO_GROUPBOX
if (w && qobject_cast<QGroupBox *>(w->parentWidget()))
gdi.kind = kHIThemeGroupBoxKindSecondary;
else
+#endif
gdi.kind = kHIThemeGroupBoxKindPrimary;
HIRect hirect = qt_hirectForQRect(opt->rect);
HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal);
@@ -3530,6 +3473,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
// Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit).
// Focus frame is drawn outside the rectangle passed in the option-rect.
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
+#ifndef QT_NO_LINEEDIT
if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) {
int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin);
int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
@@ -3537,9 +3481,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin);
drawControl(CE_FocusFrame, &focusFrame, p, w);
}
+#endif
}
break;
+#ifndef QT_NO_TABWIDGET
case PE_FrameTabWidget:
if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
@@ -3554,6 +3500,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
}
break;
+#endif
case PE_PanelScrollAreaCorner: {
const QBrush brush(opt->palette.brush(QPalette::Base));
p->fillRect(opt->rect, brush);
@@ -3697,9 +3644,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
HIRect bounds = qt_hirectForQRect(ir);
bool noVerticalHeader = true;
+#ifndef QT_NO_TABLEVIEW
if (w)
if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget()))
noVerticalHeader = !table->verticalHeader()->isVisible();
+#endif
bool drawTopBorder = header->orientation == Qt::Horizontal;
bool drawLeftBorder = header->orientation == Qt::Vertical
@@ -4022,7 +3971,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,13 +4076,13 @@ 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);
}
break;
+#ifndef QT_NO_TABBAR
case CE_TabBarTabShape:
if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
@@ -4340,6 +4289,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
}
break;
+#endif
+#ifndef QT_NO_DOCKWIDGET
case CE_DockWidgetTitle:
if (const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(w)) {
bool floating = dockWidget->isFloating();
@@ -4415,6 +4366,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
}
break;
+#endif
case CE_FocusFrame: {
const int hMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, w);
const int vMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt, w);
@@ -4539,9 +4491,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// Always be normal or disabled to follow the Mac style.
int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize);
QSize iconSize(smallIconSize, smallIconSize);
+#ifndef QT_NO_COMBOBOX
if (const QComboBox *comboBox = qobject_cast<const QComboBox *>(w)) {
iconSize = comboBox->iconSize();
}
+#endif
QPixmap pixmap = mi->icon.pixmap(window, iconSize, mode);
int pixw = pixmap.width() / pixmap.devicePixelRatio();
int pixh = pixmap.height() / pixmap.devicePixelRatio();
@@ -4825,6 +4779,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
}
break;
+#ifndef QT_NO_TOOLBAR
case CE_ToolBar: {
const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt);
@@ -4833,6 +4788,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// the title bar. The following code fills the toolBar area with transparent pixels
// to make that gradient visible.
if (w) {
+#ifndef QT_NO_MAINWINDOW
if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) {
if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) {
@@ -4861,6 +4817,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
break;
}
}
+#endif
}
// draw background gradient
@@ -4891,6 +4848,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} break;
+#endif
default:
QCommonStyle::drawControl(ce, opt, p, w);
break;
@@ -4982,6 +4940,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
int(outRect.size.height));
break;
}
+#ifndef QT_NO_TABWIDGET
case SE_TabWidgetLeftCorner:
if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
@@ -5043,11 +5002,14 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
}
break;
+#endif
case SE_LineEditContents:
rect = QCommonStyle::subElementRect(sr, opt, widget);
+#ifndef QT_NO_COMBOBOX
if (widget && qobject_cast<const QComboBox*>(widget->parentWidget()))
rect.adjust(-1, -2, 0, 0);
else
+#endif
rect.adjust(-1, -1, 0, +1);
break;
case SE_CheckBoxLayoutItem:
@@ -5061,12 +5023,15 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
break;
case SE_ComboBoxLayoutItem:
+#ifndef QT_NO_TOOLBAR
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
// Do nothing, because QToolbar needs the entire widget rect.
// Otherwise it will be clipped. Equivalent to
// widget->setAttribute(Qt::WA_LayoutUsesWidgetRect), but without
// all the hassle.
- } else {
+ } else
+#endif
+ {
rect = opt->rect;
if (controlSize == QAquaSizeLarge) {
rect.adjust(+3, +2, -3, -4);
@@ -5184,6 +5149,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
rect.setBottom(rect.bottom() - 1);
break;
+#ifndef QT_NO_TABWIDGET
case SE_TabWidgetLayoutItem:
if (const QStyleOptionTabWidgetFrame *tabWidgetOpt =
qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
@@ -5197,6 +5163,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
rect.setTop(rect.top() + SIZE(6 /* AHIG */, 3 /* guess */, 2 /* AHIG */));
}
break;
+#endif
#ifndef QT_NO_DOCKWIDGET
case SE_DockWidgetCloseButton:
case SE_DockWidgetFloatButton:
@@ -5467,7 +5434,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
@@ -5703,6 +5670,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
}
}
break;
+#ifndef QT_NO_SPINBOX
case CC_SpinBox:
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QStyleOptionSpinBox newSB = *sb;
@@ -5773,6 +5741,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
}
}
break;
+#endif
case CC_ComboBox:
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)){
HIThemeButtonDrawInfo bdi;
@@ -5964,7 +5933,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();
@@ -6078,10 +6047,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
#endif
}
break;
+#ifndef QT_NO_DIAL
case CC_Dial:
if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt))
QStyleHelper::drawDial(dial, p);
break;
+#endif
default:
QCommonStyle::drawComplexControl(cc, opt, p, widget);
break;
@@ -6326,7 +6297,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:{
@@ -6459,6 +6430,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
}
}
break;
+#ifndef QT_NO_SPINBOX
case CC_SpinBox:
if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget);
@@ -6552,6 +6524,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
}
}
break;
+#endif
case CC_ToolButton:
ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
if (sc == SC_ToolButtonMenu
@@ -6577,7 +6550,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool useAquaGuideline = true;
switch (ct) {
-
+#ifndef QT_NO_SPINBOX
case CT_SpinBox:
if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
// Add button + frame widths
@@ -6586,6 +6559,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz += QSize(buttonWidth + 2*fw, 2*fw - 3);
}
break;
+#endif
case QStyle::CT_TabWidget:
// the size between the pane and the "contentsRect" (+4,+4)
// (the "contentsRect" is on the inside of the pane)
@@ -6621,7 +6595,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
* overlap is how much the pane should overlap the tab bar
*/
// then add the size between the stackwidget and the "contentsRect"
-
+#ifndef QT_NO_TABWIDGET
if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
QSize extra(0,0);
@@ -6635,8 +6609,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
sz+= extra;
}
-
+#endif
break;
+#ifndef QT_NO_TABBAR
case QStyle::CT_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget);
@@ -6704,6 +6679,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
}
break;
+#endif
case QStyle::CT_PushButton:
// By default, we fit the contents inside a normal rounded push button.
// Do this by add enough space around the contents so that rounded
@@ -6717,7 +6693,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case QStyle::CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
int maxpmw = mi->maxIconWidth;
+#ifndef QT_NO_COMBOBOX
const QComboBox *comboBox = qobject_cast<const QComboBox *>(widget);
+#endif
int w = sz.width(),
h = sz.height();
if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
@@ -6728,11 +6706,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
} else {
h = mi->fontMetrics.height() + 2;
if (!mi->icon.isNull()) {
+#ifndef QT_NO_COMBOBOX
if (comboBox) {
const QSize &iconSize = comboBox->iconSize();
h = qMax(h, iconSize.height() + 4);
maxpmw = qMax(maxpmw, iconSize.width());
- } else {
+ } else
+#endif
+ {
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
}
@@ -6746,6 +6727,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
w += maxpmw + 6;
// add space for a check. All items have place for a check too.
w += 20;
+#ifndef QT_NO_COMBOBOX
if (comboBox && comboBox->isVisible()) {
QStyleOptionComboBox cmb;
cmb.initFrom(comboBox);
@@ -6755,7 +6737,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
w = qMax(w, subControlRect(QStyle::CC_ComboBox, &cmb,
QStyle::SC_ComboBoxEditField,
comboBox).width());
- } else {
+ } else
+#endif
+ {
w += 12;
}
sz = QSize(w, h);
@@ -7082,158 +7066,6 @@ int QMacStyle::layoutSpacing(QSizePolicy::ControlType control1,
return_SIZE(10, 8, 6); // guess
}
-static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
-{
- CGAffineTransform old_xform = CGAffineTransformIdentity;
- if (orig_xform) { //setup xforms
- old_xform = CGContextGetCTM(hd);
- CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform));
- CGContextConcatCTM(hd, *orig_xform);
- }
-
- //do the clipping
- CGContextBeginPath(hd);
- if (rgn.isEmpty()) {
- CGContextAddRect(hd, CGRectMake(0, 0, 0, 0));
- } else {
- QCFType<HIMutableShapeRef> shape = qt_mac_toHIMutableShape(rgn);
- Q_ASSERT(!HIShapeIsEmpty(shape));
- HIShapeReplacePathInCGContext(shape, hd);
- }
- CGContextClip(hd);
-
- if (orig_xform) {//reset xforms
- CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
- CGContextConcatCTM(hd, old_xform);
- }
-}
-
-// move to QRegion?
-void qt_mac_scale_region(QRegion *region, qreal scaleFactor)
-{
- if (!region || !region->rectCount())
- return;
-
- QVector<QRect> scaledRects;
- scaledRects.reserve(region->rects().count());
-
- foreach (const QRect &rect, region->rects()) {
- scaledRects.append(QRect(rect.topLeft() * scaleFactor, rect.size() * scaleFactor));
- }
- region->setRects(&scaledRects[0], scaledRects.count());
-}
-
-static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
-
-namespace {
-QMacCGContext::QMacCGContext(QPainter *p)
-{
- QPaintEngine *pe = p->paintEngine();
- pe->syncState();
- context = 0;
-
- int devType = p->device()->devType();
- if (pe->type() == QPaintEngine::Raster
- && (devType == QInternal::Widget ||
- devType == QInternal::Pixmap ||
- devType == QInternal::Image)) {
-
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice());
- uint flags = kCGImageAlphaPremultipliedFirst;
- flags |= kCGBitmapByteOrder32Host;
-
- const QImage *image = (const QImage *) pe->paintDevice();
-
- context = CGBitmapContextCreate((void *) image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
-
- // Invert y axis.
- CGContextTranslateCTM(context, 0, image->height());
- CGContextScaleCTM(context, 1, -1);
-
- const qreal devicePixelRatio = image->devicePixelRatio();
-
- if (devType == QInternal::Widget) {
- // Set the clip rect which is an intersection of the system clip
- // and the painter clip. To make matters more interesting these
- // are in device pixels and device-independent pixels, respectively.
- QRegion clip = p->paintEngine()->systemClip(); // get system clip in device pixels
- QTransform native = p->deviceTransform(); // get device transform. dx/dy is in device pixels
-
- if (p->hasClipping()) {
- QRegion r = p->clipRegion(); // get painter clip, which is in device-independent pixels
- qt_mac_scale_region(&r, devicePixelRatio); // scale painter clip to device pixels
- r.translate(native.dx(), native.dy());
- if (clip.isEmpty())
- clip = r;
- else
- clip &= r;
- }
- qt_mac_clip_cg(context, clip, 0); // clip in device pixels
-
- // Scale the context so that painting happens in device-independet pixels.
- CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
- CGContextTranslateCTM(context, native.dx() / devicePixelRatio, native.dy() / devicePixelRatio);
- } else {
- // Scale to paint in device-independent pixels.
- CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
- }
- } else {
- qDebug() << "QMacCGContext:: Unsupported painter devtype type" << devType;
- }
-}
-
-} // anonymous namespace
-
-static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
-{
- bool isWidget = (paintDevice->devType() == QInternal::Widget);
- return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice) : 0);
-}
-
-/*! \internal
-
- Returns the CoreGraphics CGContextRef of the paint device. 0 is
- returned if it can't be obtained. It is the caller's responsibility to
- CGContextRelease the context when finished using it.
-
- \warning This function is only available on \macos.
- \warning This function is duplicated in the Cocoa platform plugin.
-*/
-
-CGContextRef qt_mac_cg_context(const QPaintDevice *pdev)
-{
- if (pdev->devType() == QInternal::Pixmap) {
- const QPixmap *pm = static_cast<const QPixmap*>(pdev);
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev);
- uint flags = kCGImageAlphaPremultipliedFirst;
- flags |= kCGBitmapByteOrder32Host;
- CGContextRef ret = 0;
-
- QPlatformPixmap *data = const_cast<QPixmap *>(pm)->data_ptr().data();
- if (data->classId() == QPlatformPixmap::RasterClass) {
- QImage *image = data->buffer();
- ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
- } else {
- qDebug("qt_mac_cg_context: Unsupported pixmap class");
- }
-
- CGContextTranslateCTM(ret, 0, pm->height());
- qreal devicePixelRatio = pdev->devicePixelRatioF();
- CGContextScaleCTM(ret, devicePixelRatio, devicePixelRatio);
- CGContextScaleCTM(ret, 1, -1);
- return ret;
- } else if (pdev->devType() == QInternal::Widget) {
- //CGContextRef ret = static_cast<CGContextRef>(static_cast<const QWidget *>(pdev)->macCGHandle());
- ///CGContextRetain(ret);
- //return ret;
- qDebug("qt_mac_cg_context: not implemented: Widget class");
- return 0;
- }
- return 0;
-}
-
/*
FontHash::FontHash()
{
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 7ff3d25952..fdc22794b4 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qcommonstyle.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 31ba8c3464..798f6ed90b 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -44,6 +44,7 @@
#include <Carbon/Carbon.h>
#undef check
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qmacstyle_mac_p.h"
#include "qcommonstyle_p.h"
#include <private/qapplication_p.h>
diff --git a/src/widgets/styles/qpixmapstyle_p.h b/src/widgets/styles/qpixmapstyle_p.h
index 4255cba2de..618d6d2f50 100644
--- a/src/widgets/styles/qpixmapstyle_p.h
+++ b/src/widgets/styles/qpixmapstyle_p.h
@@ -42,6 +42,7 @@
#ifndef QPIXMAPSTYLE_H
#define QPIXMAPSTYLE_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/QCommonStyle>
#include <QtWidgets/QTileRules>
diff --git a/src/widgets/styles/qpixmapstyle_p_p.h b/src/widgets/styles/qpixmapstyle_p_p.h
index 3400729c4c..481262d5c5 100644
--- a/src/widgets/styles/qpixmapstyle_p_p.h
+++ b/src/widgets/styles/qpixmapstyle_p_p.h
@@ -40,6 +40,7 @@
#ifndef QPIXMAPSTYLE_P_H
#define QPIXMAPSTYLE_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qpixmapstyle_p.h"
#include "qcommonstyle_p.h"
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/qproxystyle.h b/src/widgets/styles/qproxystyle.h
index d98155d249..20a0f12868 100644
--- a/src/widgets/styles/qproxystyle.h
+++ b/src/widgets/styles/qproxystyle.h
@@ -40,6 +40,7 @@
#ifndef QPROXYSTYLE_H
#define QPROXYSTYLE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/QCommonStyle>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qproxystyle_p.h b/src/widgets/styles/qproxystyle_p.h
index 3ec12d4634..2343a03e2a 100644
--- a/src/widgets/styles/qproxystyle_p.h
+++ b/src/widgets/styles/qproxystyle_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qcommonstyle.h"
#include "qcommonstyle_p.h"
#include "qproxystyle.h"
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 9714168afc..01d972af65 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..ce33dbed62 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -40,6 +40,7 @@
#ifndef QSTYLE_H
#define QSTYLE_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
#include <QtCore/qsize.h>
@@ -570,6 +571,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/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index ed802a450e..3b10eeea27 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEANIMATION_P_H
#define QSTYLEANIMATION_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qabstractanimation.h"
#include "qdatetime.h"
#include "qimage.h"
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/qstylefactory.h b/src/widgets/styles/qstylefactory.h
index c5393c3a66..50c3750b6c 100644
--- a/src/widgets/styles/qstylefactory.h
+++ b/src/widgets/styles/qstylefactory.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEFACTORY_H
#define QSTYLEFACTORY_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index f073f1cccb..583385ee8a 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -391,9 +391,11 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec
QColor backgroundColor(const QPalette &pal, const QWidget* widget)
{
+#ifndef QT_NO_SCROLLBAR
if (qobject_cast<const QScrollBar *>(widget) && widget->parent() &&
qobject_cast<const QAbstractScrollArea *>(widget->parent()->parent()))
return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base);
+#endif
return pal.color(QPalette::Base);
}
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index b00b873731..88eb05f1d7 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qpoint.h>
#include <QtCore/qstring.h>
#include <QtGui/qpolygon.h>
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 8f41f379bc..9679411402 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEOPTION_H
#define QSTYLEOPTION_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qvariant.h>
#include <QtWidgets/qabstractspinbox.h>
#include <QtGui/qicon.h>
diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h
index 27d4c43550..191360727e 100644
--- a/src/widgets/styles/qstylepainter.h
+++ b/src/widgets/styles/qstylepainter.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEPAINTER_H
#define QSTYLEPAINTER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qpainter.h>
#include <QtWidgets/qstyle.h>
#include <QtWidgets/qwidget.h>
diff --git a/src/widgets/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h
index 72dfa8b6ed..d44f57d208 100644
--- a/src/widgets/styles/qstyleplugin.h
+++ b/src/widgets/styles/qstyleplugin.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEPLUGIN_H
#define QSTYLEPLUGIN_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index e8e99a4386..b214dae154 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1102,7 +1102,7 @@ void QRenderRule::fixupBorder(int nativeWidth)
case BorderStyle_Native:
if (bd->borders[i] == 0)
bd->borders[i] = nativeWidth;
- // intentional fall through
+ Q_FALLTHROUGH();
default:
if (bd->colors[i].style() == Qt::NoBrush) // auto-acquire 'color'
bd->colors[i] = color;
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index 80bac0c789..55dd2df329 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -40,6 +40,7 @@
#ifndef QSTYLESHEETSTYLE_P_H
#define QSTYLESHEETSTYLE_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qwindowsstyle_p.h"
#ifndef QT_NO_STYLE_STYLESHEET
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 075cb3719f..e3bf28608c 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
@@ -91,26 +90,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
@@ -126,13 +106,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()
@@ -309,25 +282,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;
@@ -336,14 +299,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;
@@ -521,7 +479,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:
@@ -560,7 +518,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);
}
@@ -637,12 +595,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;
}
@@ -850,7 +808,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
p->setPen(opt->palette.dark().color());
else
p->setPen(opt->palette.text().color());
- } // Fall through!
+ }
+ Q_FALLTHROUGH();
case PE_IndicatorViewItemCheck:
if (!doRestore) {
p->save();
@@ -2425,7 +2384,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_ToolButton:
if (qstyleoption_cast<const QStyleOptionToolButton *>(opt))
return sz += QSize(7, 6);
- // Otherwise, fall through
+ Q_FALLTHROUGH();
default:
sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index f9d174d3c6..5d68bfeba0 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qcommonstyle.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h
index f034255837..0c23f4b4a8 100644
--- a/src/widgets/styles/qwindowsstyle_p_p.h
+++ b/src/widgets/styles/qwindowsstyle_p_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qwindowsstyle_p.h"
#include "qcommonstyle_p.h"
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 599dfdb8b5..bf5aad0187 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);
@@ -2319,14 +2305,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/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h
index 406051f227..0289f404dd 100644
--- a/src/widgets/styles/qwindowsvistastyle_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <private/qwindowsxpstyle_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index e207a27a66..4ca47fec2c 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qwindowsvistastyle_p.h"
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 9fb18f63e8..9d764d2a41 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.
@@ -567,8 +451,11 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h)
w = qMax(bufferW, w);
h = qMax(bufferH, h);
- if (!bufferDC)
- bufferDC = CreateCompatibleDC(qt_win_display_dc());
+ if (!bufferDC) {
+ HDC displayDC = GetDC(0);
+ bufferDC = CreateCompatibleDC(displayDC);
+ ReleaseDC(0, displayDC);
+ }
// Define the header
BITMAPINFO bmi;
@@ -614,8 +501,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 +513,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 +710,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 +791,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 +870,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 +910,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 +944,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 +956,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 +1015,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 +1174,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 +1301,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 +1488,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 +1554,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 +1567,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 +1597,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 +2384,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),
@@ -3166,10 +2983,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(),
@@ -3649,13 +3466,13 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
case SC_TitleBarContextHelpButton:
if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
offset += delta;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarMinButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarMinButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarNormalButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
@@ -3663,25 +3480,25 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
offset += delta;
else if (subControl == SC_TitleBarNormalButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarMaxButton:
if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarMaxButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarShadeButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarShadeButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarUnshadeButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (subControl == SC_TitleBarUnshadeButton)
break;
- //fall through
+ Q_FALLTHROUGH();
case SC_TitleBarCloseButton:
if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
offset += delta;
@@ -3760,7 +3577,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
if (numSubControls == 1)
break;
offset += buttonWidth;
- //FALL THROUGH
+ Q_FALLTHROUGH();
case SC_MdiNormalButton:
// No offset needed if
// 1) There's only one sub control
@@ -4202,7 +4019,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:
@@ -4227,35 +4044,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;
@@ -4263,7 +4080,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);
}
@@ -4271,7 +4088,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;
@@ -4283,9 +4100,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);
}
@@ -4294,7 +4111,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;
@@ -4302,7 +4119,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;
@@ -4310,7 +4127,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);
}
@@ -4319,7 +4136,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]);
@@ -4371,7 +4188,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);
}
}
@@ -4381,7 +4198,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);
}
@@ -4392,7 +4209,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.h b/src/widgets/styles/qwindowsxpstyle_p.h
index 61bb508511..088178cb5a 100644
--- a/src/widgets/styles/qwindowsxpstyle_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <private/qwindowsstyle_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 8ee4d1a641..7cbccdaf67 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -51,107 +51,19 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qwindowsxpstyle_p.h"
#include "qwindowsstyle_p_p.h"
#include <qmap.h>
#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 +73,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 +183,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 +232,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 +289,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 +301,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 +312,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..69e13fb6ec 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -33,17 +33,9 @@ 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
-}
-
-!macx:styles -= mac
+include($$OUT_PWD/qtwidgets-config.pri)
contains( styles, mac ) {
HEADERS += \
@@ -59,10 +51,6 @@ contains( styles, windowsvista ) {
HEADERS += styles/qwindowsvistastyle_p.h
HEADERS += styles/qwindowsvistastyle_p_p.h
SOURCES += styles/qwindowsvistastyle.cpp
- !contains( styles, windowsxp ) {
- message( windowsvista requires windowsxp )
- styles += windowsxp
- }
} else {
DEFINES += QT_NO_STYLE_WINDOWSVISTA
}
@@ -71,10 +59,6 @@ contains( styles, windowsxp ) {
HEADERS += styles/qwindowsxpstyle_p.h
HEADERS += styles/qwindowsxpstyle_p_p.h
SOURCES += styles/qwindowsxpstyle.cpp
- !contains( styles, windows ) {
- message( windowsxp requires windows )
- styles += windows
- }
} else {
DEFINES += QT_NO_STYLE_WINDOWSXP
}
@@ -95,22 +79,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/qcolormap.h b/src/widgets/util/qcolormap.h
index 0c752d4a22..8e652d8154 100644
--- a/src/widgets/util/qcolormap.h
+++ b/src/widgets/util/qcolormap.h
@@ -40,6 +40,7 @@
#ifndef QCOLORMAP_H
#define QCOLORMAP_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qatomic.h>
#include <QtGui/qrgb.h>
#include <QtCore/qvector.h>
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 2c7dbf63be..3006f0c9ce 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
)
@@ -1055,7 +1055,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);
@@ -1065,7 +1065,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);
@@ -1790,7 +1790,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
@@ -1830,7 +1830,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("\\\\"));
@@ -1841,7 +1841,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/qcompleter.h b/src/widgets/util/qcompleter.h
index 435639be99..33e6540264 100644
--- a/src/widgets/util/qcompleter.h
+++ b/src/widgets/util/qcompleter.h
@@ -40,6 +40,7 @@
#ifndef QCOMPLETER_H
#define QCOMPLETER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qpoint.h>
#include <QtCore/qstring.h>
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index 10dde975c0..c35f70b451 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qobject_p.h"
#ifndef QT_NO_COMPLETER
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 4f08664784..57db9ff7fc 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -551,11 +551,11 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
case QEvent::TouchBegin:
inputType = QScroller::InputPress;
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchEnd:
if (!inputType)
inputType = QScroller::InputRelease;
- // fallthrough
+ Q_FALLTHROUGH();
case QEvent::TouchUpdate:
if (!inputType)
inputType = QScroller::InputMove;
@@ -669,7 +669,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
event->accept();
}
}
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchBegin:
q->setHotSpot(globalPos);
result |= scrollerIsActive ? TriggerGesture : MayBeGesture;
@@ -681,7 +681,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
#endif
if (PressDelayHandler::instance()->isDelaying())
result |= ConsumeEventHint;
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchUpdate:
result |= scrollerIsActive ? TriggerGesture : Ignore;
break;
@@ -692,7 +692,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
case QEvent::MouseButtonRelease:
if (PressDelayHandler::instance()->released(event, scrollerWasDragging || scrollerWasScrolling, scrollerIsActive))
result |= ConsumeEventHint;
- // fall through
+ Q_FALLTHROUGH();
case QEvent::TouchEnd:
result |= scrollerIsActive ? FinishGesture : CancelGesture;
break;
diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h
index 1b82a314ee..fa70806ef7 100644
--- a/src/widgets/util/qflickgesture_p.h
+++ b/src/widgets/util/qflickgesture_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qevent.h"
#include "qgesturerecognizer.h"
#include "private/qgesture_p.h"
diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h
index 1e017a2410..561dcfaefc 100644
--- a/src/widgets/util/qscroller.h
+++ b/src/widgets/util/qscroller.h
@@ -40,6 +40,7 @@
#ifndef QSCROLLER_H
#define QSCROLLER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/QObject>
#include <QtCore/QPointF>
#include <QtWidgets/QScrollerProperties>
diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h
index 24ad841a91..4557e7cc33 100644
--- a/src/widgets/util/qscroller_p.h
+++ b/src/widgets/util/qscroller_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QObject>
#include <QPointer>
#include <QQueue>
diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h
index 67f3d0e15d..4fdc9bd32f 100644
--- a/src/widgets/util/qscrollerproperties.h
+++ b/src/widgets/util/qscrollerproperties.h
@@ -40,6 +40,7 @@
#ifndef QSCROLLERPROPERTIES_H
#define QSCROLLERPROPERTIES_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/QScopedPointer>
#include <QtCore/QMetaType>
#include <QtCore/QVariant>
diff --git a/src/widgets/util/qscrollerproperties_p.h b/src/widgets/util/qscrollerproperties_p.h
index d480d8d829..7965171321 100644
--- a/src/widgets/util/qscrollerproperties_p.h
+++ b/src/widgets/util/qscrollerproperties_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QPointF>
#include <QEasingCurve>
#include <qscrollerproperties.h>
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 74feb05d9b..2a418167f1 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;
@@ -753,9 +731,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
// The recursion depth is the same as menu depth, so should not
// be higher than 3 levels.
- QListIterator<QAction *> it(menu->actions());
- while (it.hasNext()) {
- QAction *action = it.next();
+ const auto actions = menu->actions();
+ for (QAction *action : actions) {
if (action->menu())
addPlatformMenu(action->menu());
}
diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
index 105e25f44e..fb238c92b0 100644
--- a/src/widgets/util/qsystemtrayicon.h
+++ b/src/widgets/util/qsystemtrayicon.h
@@ -40,6 +40,7 @@
#ifndef QSYSTEMTRAYICON_H
#define QSYSTEMTRAYICON_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#ifndef QT_NO_SYSTEMTRAYICON
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index 396a91eea6..79e824f4b7 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qsystemtrayicon.h"
#include "private/qobject_p.h"
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 7cbf979901..2da24e482b 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);
- }
}
}
@@ -416,6 +417,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/qundogroup.h b/src/widgets/util/qundogroup.h
index f4243d483e..4e2fdeed26 100644
--- a/src/widgets/util/qundogroup.h
+++ b/src/widgets/util/qundogroup.h
@@ -40,6 +40,7 @@
#ifndef QUNDOGROUP_H
#define QUNDOGROUP_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
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/qundostack.h b/src/widgets/util/qundostack.h
index fbd8f237ee..f4db78300b 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -40,6 +40,7 @@
#ifndef QUNDOSTACK_H
#define QUNDOSTACK_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h
index 9bfe527306..1bfe992426 100644
--- a/src/widgets/util/qundostack_p.h
+++ b/src/widgets/util/qundostack_p.h
@@ -40,6 +40,7 @@
#ifndef QUNDOSTACK_P_H
#define QUNDOSTACK_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <private/qobject_p.h>
#include <QtCore/qlist.h>
#include <QtCore/qstring.h>
diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h
index fab040ba0e..3ed9ea5989 100644
--- a/src/widgets/util/qundoview.h
+++ b/src/widgets/util/qundoview.h
@@ -40,6 +40,7 @@
#ifndef QUNDOVIEW_H
#define QUNDOVIEW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qlistview.h>
#include <QtCore/qstring.h>
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index 9f43dc42f0..cb19c1fc95 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -27,9 +27,9 @@ SOURCES += \
util/qundostack.cpp \
util/qundoview.cpp
-win32:!wince:!winrt {
+win32:!winrt {
SOURCES += util/qsystemtrayicon_win.cpp
-} else:contains(QT_CONFIG, xcb) {
+} else: qtConfig(xcb) {
SOURCES += util/qsystemtrayicon_x11.cpp
} else {
SOURCES += util/qsystemtrayicon_qpa.cpp
diff --git a/src/widgets/widgets.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/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 1a5b8db33c..c0bd8bce5a 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -1058,7 +1058,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
break;
case Qt::Key_Up:
next = false;
- // fall through
+ Q_FALLTHROUGH();
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Down: {
@@ -1100,6 +1100,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
break;
}
default:
+#ifndef QT_NO_SHORTCUT
if (e->matches(QKeySequence::Cancel) && d->down) {
setDown(false);
repaint(); //flush paint event before invoking potentially expensive operation
@@ -1107,6 +1108,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e)
d->emitReleased();
return;
}
+#endif
e->ignore();
}
}
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index bd18c394f2..7bf0e0b9d6 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTBUTTON_H
#define QABSTRACTBUTTON_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qicon.h>
#include <QtGui/qkeysequence.h>
#include <QtWidgets/qwidget.h>
diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h
index f65a0527fc..8f67c0d367 100644
--- a/src/widgets/widgets/qabstractbutton_p.h
+++ b/src/widgets/widgets/qabstractbutton_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qabstractbutton.h"
#include "QtCore/qbasictimer.h"
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/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index 9f8ea27408..476914b781 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTSCROLLAREA_H
#define QABSTRACTSCROLLAREA_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index 5239f72ec4..600c834c29 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qframe_p.h"
#include "qabstractscrollarea.h"
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index 4221ff40ef..e85d82edb8 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -933,7 +933,7 @@ void QAbstractSlider::changeEvent(QEvent *ev)
d->repeatActionTimer.stop();
setSliderDown(false);
}
- // fall through...
+ Q_FALLTHROUGH();
default:
QWidget::changeEvent(ev);
}
diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h
index 4f8d12fd49..86d6830f10 100644
--- a/src/widgets/widgets/qabstractslider.h
+++ b/src/widgets/widgets/qabstractslider.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTSLIDER_H
#define QABSTRACTSLIDER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h
index e78cf7a27c..600616061a 100644
--- a/src/widgets/widgets/qabstractslider_p.h
+++ b/src/widgets/widgets/qabstractslider_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtCore/qbasictimer.h"
#include "QtCore/qelapsedtimer.h"
#include "private/qwidget_p.h"
diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h
index 8d31c1f503..d93489e663 100644
--- a/src/widgets/widgets/qabstractspinbox.h
+++ b/src/widgets/widgets/qabstractspinbox.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTSPINBOX_H
#define QABSTRACTSPINBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtGui/qvalidator.h>
diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h
index a54659ecaa..47ca10a183 100644
--- a/src/widgets/widgets/qabstractspinbox_p.h
+++ b/src/widgets/widgets/qabstractspinbox_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qabstractspinbox.h"
#ifndef QT_NO_SPINBOX
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index 58da20540f..ff931b1ee0 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -40,6 +40,7 @@
#ifndef QBUTTONGROUP_H
#define QBUTTONGROUP_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h
index 95a72eb4fd..b94dd170b4 100644
--- a/src/widgets/widgets/qbuttongroup_p.h
+++ b/src/widgets/widgets/qbuttongroup_p.h
@@ -45,6 +45,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qbuttongroup.h>
#ifndef QT_NO_BUTTONGROUP
diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h
index ef473cba94..7780065117 100644
--- a/src/widgets/widgets/qcalendarwidget.h
+++ b/src/widgets/widgets/qcalendarwidget.h
@@ -40,6 +40,7 @@
#ifndef QCALENDARWIDGET_H
#define QCALENDARWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtCore/qdatetime.h>
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/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index 70aac38488..22f26b6667 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -40,6 +40,7 @@
#ifndef QCHECKBOX_H
#define QCHECKBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index af178ce8f5..693d5f9e93 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -676,7 +676,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)
case Qt::Key_Down:
if (!(keyEvent->modifiers() & Qt::AltModifier))
break;
- // fall through
+ Q_FALLTHROUGH();
case Qt::Key_F4:
combo->hidePopup();
return true;
@@ -3140,7 +3140,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
return;
} else if (e->modifiers() & Qt::ControlModifier)
break; // pass to line edit for auto completion
- // fall through
+ Q_FALLTHROUGH();
case Qt::Key_PageDown:
#ifdef QT_KEYPAD_NAVIGATION
if (QApplication::keypadNavigationEnabled())
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 095a06fe31..2da1ceb047 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -40,6 +40,7 @@
#ifndef QCOMBOBOX_H
#define QCOMBOBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qabstractitemdelegate.h>
#include <QtCore/qabstractitemmodel.h>
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index 3c92b09e9a..7ca077abf9 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qcombobox.h"
#ifndef QT_NO_COMBOBOX
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/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h
index c794b60506..4f81651ce4 100644
--- a/src/widgets/widgets/qcommandlinkbutton.h
+++ b/src/widgets/widgets/qcommandlinkbutton.h
@@ -40,6 +40,7 @@
#ifndef QCOMMANDLINKBUTTON_H
#define QCOMMANDLINKBUTTON_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qpushbutton.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index f050061dea..c261ce369b 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -40,6 +40,7 @@
#ifndef QDATETIMEEDIT_H
#define QDATETIMEEDIT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qvariant.h>
#include <QtWidgets/qabstractspinbox.h>
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index be7bc213a2..6889bda041 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qcombobox.h"
#include "QtWidgets/qcalendarwidget.h"
#include "QtWidgets/qspinbox.h"
diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h
index 7884d9fe27..3629ebf8f6 100644
--- a/src/widgets/widgets/qdial.h
+++ b/src/widgets/widgets/qdial.h
@@ -41,6 +41,7 @@
#ifndef QDIAL_H
#define QDIAL_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractslider.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 4ed326576c..657eda3c68 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/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
index dfec453c67..699547c32f 100644
--- a/src/widgets/widgets/qdialogbuttonbox.h
+++ b/src/widgets/widgets/qdialogbuttonbox.h
@@ -40,6 +40,7 @@
#ifndef QDIALOGBUTTONBOX_H
#define QDIALOGBUTTONBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 50be36ae93..a7e865ff05 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -1493,8 +1493,10 @@ bool QDockAreaLayoutInfo::hasFixedSize() const
return perp(o, minimumSize()) == perp(o, maximumSize());
}
-
-void QDockAreaLayoutInfo::apply(bool animate)
+/*! \internal
+ Applies the layout and returns the activated QDockWidget or nullptr.
+ */
+QDockWidget *QDockAreaLayoutInfo::apply(bool animate)
{
QWidgetAnimator &widgetAnimator = mainWindowLayout()->widgetAnimator;
@@ -1533,6 +1535,8 @@ void QDockAreaLayoutInfo::apply(bool animate)
}
#endif // QT_NO_TABBAR
+ QDockWidget *activated = nullptr;
+
for (int i = 0; i < item_list.size(); ++i) {
QDockAreaLayoutItem &item = item_list[i];
@@ -1561,6 +1565,7 @@ void QDockAreaLayoutInfo::apply(bool animate)
} else if (r.isValid()
&& (geo.right() < 0 || geo.bottom() < 0)) {
emit dw->visibilityChanged(true);
+ activated = dw;
}
}
}
@@ -1568,6 +1573,8 @@ void QDockAreaLayoutInfo::apply(bool animate)
if (*sep == 1)
updateSeparatorWidgets();
#endif //QT_NO_TABBAR
+
+ return activated;
}
static void paintSep(QPainter *p, QWidget *w, const QRect &r, Qt::Orientation o, bool mouse_over)
diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h
index bc9d418783..f22a3d2de2 100644
--- a/src/widgets/widgets/qdockarealayout_p.h
+++ b/src/widgets/widgets/qdockarealayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtCore/qrect.h"
#include "QtCore/qpair.h"
#include "QtCore/qlist.h"
@@ -174,7 +175,7 @@ public:
QList<int> indexOf(QWidget *widget) const;
QList<int> indexOfPlaceHolder(const QString &objectName) const;
- void apply(bool animate);
+ QDockWidget *apply(bool animate);
void paintSeparators(QPainter *p, QWidget *widget, const QRegion &clip,
const QPoint &mouse) const;
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index d664727d89..9e95d086bd 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);
@@ -1225,10 +1225,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/qdockwidget.h b/src/widgets/widgets/qdockwidget.h
index e0aaf54d0e..7b3f8d0ddb 100644
--- a/src/widgets/widgets/qdockwidget.h
+++ b/src/widgets/widgets/qdockwidget.h
@@ -40,6 +40,7 @@
#ifndef QDYNAMICDOCKWIDGET_H
#define QDYNAMICDOCKWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index 765747b101..94a3ad3b34 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qstyleoption.h"
#include "private/qwidget_p.h"
#include "QtWidgets/qboxlayout.h"
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index a2ba50695a..ecd85c2ca7 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();
@@ -202,10 +202,13 @@ bool QAlphaWidget::eventFilter(QObject *o, QEvent *e)
render();
break;
case QEvent::KeyPress: {
+#ifndef QT_NO_SHORTCUT
QKeyEvent *ke = (QKeyEvent*)e;
if (ke->matches(QKeySequence::Cancel)) {
showWidget = false;
- } else {
+ } else
+#endif
+ {
duration = 0;
}
render();
@@ -251,7 +254,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 +271,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 +287,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/qfocusframe.h b/src/widgets/widgets/qfocusframe.h
index a1b2032e05..a1fc6d345d 100644
--- a/src/widgets/widgets/qfocusframe.h
+++ b/src/widgets/widgets/qfocusframe.h
@@ -40,6 +40,7 @@
#ifndef QFOCUSFRAME_H
#define QFOCUSFRAME_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h
index 0db077cd87..c409d33fef 100644
--- a/src/widgets/widgets/qfontcombobox.h
+++ b/src/widgets/widgets/qfontcombobox.h
@@ -40,6 +40,7 @@
#ifndef QFONTCOMBOBOX_H
#define QFONTCOMBOBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qcombobox.h>
#include <QtGui/qfontdatabase.h>
diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h
index e38ec60d42..986915a28f 100644
--- a/src/widgets/widgets/qframe.h
+++ b/src/widgets/widgets/qframe.h
@@ -40,6 +40,7 @@
#ifndef QFRAME_H
#define QFRAME_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qframe_p.h b/src/widgets/widgets/qframe_p.h
index 54d2ba869d..e3c101e87c 100644
--- a/src/widgets/widgets/qframe_p.h
+++ b/src/widgets/widgets/qframe_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qwidget_p.h"
#include "qframe.h"
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/qgroupbox.h b/src/widgets/widgets/qgroupbox.h
index 0bff3aa6f9..a132d48e16 100644
--- a/src/widgets/widgets/qgroupbox.h
+++ b/src/widgets/widgets/qgroupbox.h
@@ -40,6 +40,7 @@
#ifndef QGROUPBOX_H
#define QGROUPBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
QT_BEGIN_NAMESPACE
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/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h
index 85a2177d32..81339a9852 100644
--- a/src/widgets/widgets/qkeysequenceedit.h
+++ b/src/widgets/widgets/qkeysequenceedit.h
@@ -41,6 +41,7 @@
#ifndef QKEYSEQUENCEEDIT_H
#define QKEYSEQUENCEEDIT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h
index a85530645c..67e60b4032 100644
--- a/src/widgets/widgets/qkeysequenceedit_p.h
+++ b/src/widgets/widgets/qkeysequenceedit_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qkeysequenceedit.h"
#include <private/qwidget_p.h>
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/qlabel.h b/src/widgets/widgets/qlabel.h
index 46a2ce8ee4..1f76937a63 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -40,6 +40,7 @@
#ifndef QLABEL_H
#define QLABEL_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h
index dce9ba7168..d13c05fc99 100644
--- a/src/widgets/widgets/qlabel_p.h
+++ b/src/widgets/widgets/qlabel_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qlabel.h"
#include "private/qtextdocumentlayout_p.h"
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index 543a7aee11..aa052ef5cb 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -188,8 +188,8 @@ static QString int2string(int num, int base, int ndigits, bool *oflow)
} while (n != 0);
len = ndigits - len;
if (len > 0)
- s.fill(QLatin1Char(' '), len);
- s += QString::fromLatin1(p);
+ s += QString(len, QLatin1Char(' '));
+ s += QLatin1String(p);
}
break;
}
@@ -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/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h
index 1169862193..33669fa900 100644
--- a/src/widgets/widgets/qlcdnumber.h
+++ b/src/widgets/widgets/qlcdnumber.h
@@ -40,6 +40,7 @@
#ifndef QLCDNUMBER_H
#define QLCDNUMBER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
QT_BEGIN_NAMESPACE
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/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 12fd998c45..1bdcfaf848 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -40,6 +40,7 @@
#ifndef QLINEEDIT_H
#define QLINEEDIT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
#include <QtGui/qtextcursor.h>
#include <QtCore/qstring.h>
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index a14cd66398..0a08aefab3 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_LINEEDIT
#include "private/qwidget_p.h"
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
index c53cc643cd..d926ef8569 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
@@ -40,6 +40,7 @@
#ifndef QCOCOAVIEWCONTAINER_H
#define QCOCOAVIEWCONTAINER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/QWidget>
Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 3145ab1553..725cc637d6 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.h b/src/widgets/widgets/qmacnativewidget_mac.h
index 559f15f287..84389f16df 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.h
+++ b/src/widgets/widgets/qmacnativewidget_mac.h
@@ -40,13 +40,13 @@
#ifndef QMACNATIVEWIDGET_H
#define QMACNATIVEWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/QWidget>
Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
QT_BEGIN_NAMESPACE
-class QMacNativeWidgetPrivate;
class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget
{
Q_OBJECT
@@ -59,9 +59,6 @@ public:
protected:
bool event(QEvent *ev);
-
-private:
- Q_DECLARE_PRIVATE(QMacNativeWidget)
};
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index a8f1a3745d..936bd35187 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/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 5f7cfec5af..2477510520 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -377,6 +377,18 @@ void QMainWindowPrivate::init()
\sa setToolButtonStyle()
*/
+#ifndef QT_NO_DOCKWIDGET
+/*!
+ \fn void QMainWindow::tabifiedDockWidgetActivated(QDockWidget *dockWidget)
+
+ This signal is emitted when the tabified dock widget is activated by
+ selecting the tab. The activated dock widget is passed in \a dockWidget.
+
+ \since 5.8
+ \sa tabifyDockWidget(), tabifiedDockWidgets()
+*/
+#endif
+
/*!
Constructs a QMainWindow with the given \a parent and the specified
widget \a flags.
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index aab1448b8f..9bd7eb1cd8 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -40,6 +40,7 @@
#ifndef QDYNAMICMAINWINDOW_H
#define QDYNAMICMAINWINDOW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qtabwidget.h>
@@ -195,6 +196,9 @@ public Q_SLOTS:
Q_SIGNALS:
void iconSizeChanged(const QSize &iconSize);
void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle);
+#ifndef QT_NO_DOCKWIDGET
+ void tabifiedDockWidgetActivated(QDockWidget *dockWidget);
+#endif
protected:
#ifndef QT_NO_CONTEXTMENU
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index b138c42ba2..939453473a 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -1698,7 +1698,11 @@ void QMainWindowLayout::tabChanged()
QDockAreaLayoutInfo *info = dockInfo(tb);
if (info == 0)
return;
- info->apply(false);
+
+ QDockWidget *activated = info->apply(false);
+
+ if (activated)
+ emit static_cast<QMainWindow *>(parentWidget())->tabifiedDockWidgetActivated(activated);
if (QWidget *w = centralWidget())
w->raise();
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 4f2e8078d3..c06122b9c7 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qmainwindow.h"
#ifndef QT_NO_MAINWINDOW
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/qmdiarea.h b/src/widgets/widgets/qmdiarea.h
index b093c4bb4b..44a40948af 100644
--- a/src/widgets/widgets/qmdiarea.h
+++ b/src/widgets/widgets/qmdiarea.h
@@ -40,6 +40,7 @@
#ifndef QMDIAREA_H
#define QMDIAREA_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractscrollarea.h>
#include <QtWidgets/qtabwidget.h>
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index dde7b1a7ce..353144a6ab 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qmdiarea.h"
#include "qmdisubwindow.h"
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/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h
index 54ef33befa..e2bb533ddf 100644
--- a/src/widgets/widgets/qmdisubwindow.h
+++ b/src/widgets/widgets/qmdisubwindow.h
@@ -40,6 +40,7 @@
#ifndef QMDISUBWINDOW_H
#define QMDISUBWINDOW_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 4faf421a92..46a8e99d0a 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qmdisubwindow.h"
#ifndef QT_NO_MDIAREA
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index eba17783ec..d957dda162 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1479,10 +1479,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);
}
@@ -2730,7 +2729,10 @@ QMenu::event(QEvent *e)
if (kev->key() == Qt::Key_Up || kev->key() == Qt::Key_Down
|| kev->key() == Qt::Key_Left || kev->key() == Qt::Key_Right
|| kev->key() == Qt::Key_Enter || kev->key() == Qt::Key_Return
- || kev->matches(QKeySequence::Cancel)) {
+#ifndef QT_NO_SHORTCUT
+ || kev->matches(QKeySequence::Cancel)
+#endif
+ ) {
e->accept();
return true;
}
@@ -2978,7 +2980,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
key_consumed = true;
break;
}
- //FALL THROUGH
+ Q_FALLTHROUGH();
case Qt::Key_Left: {
if (d->currentAction && !d->scroll) {
QAction *nextAction = 0;
@@ -3025,6 +3027,7 @@ void QMenu::keyPressEvent(QKeyEvent *e)
if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this))
break;
// for motif, fall through
+ Q_FALLTHROUGH();
#ifdef QT_KEYPAD_NAVIGATION
case Qt::Key_Select:
#endif
@@ -3057,7 +3060,11 @@ void QMenu::keyPressEvent(QKeyEvent *e)
key_consumed = false;
}
- if (!key_consumed && (e->matches(QKeySequence::Cancel)
+ if (!key_consumed && (
+ false
+#ifndef QT_NO_SHORTCUT
+ || e->matches(QKeySequence::Cancel)
+#endif
#ifdef QT_KEYPAD_NAVIGATION
|| e->key() == Qt::Key_Back
#endif
@@ -3271,7 +3278,9 @@ static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *i
item->setIcon(QIcon());
}
item->setVisible(action->isVisible());
+#ifndef QT_NO_SHORTCUT
item->setShortcut(action->shortcut());
+#endif
item->setCheckable(action->isCheckable());
item->setChecked(action->isChecked());
item->setHasExclusiveGroup(action->actionGroup() && action->actionGroup()->isExclusive());
@@ -3354,17 +3363,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..bcbd0a95c4 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -40,14 +40,12 @@
#ifndef QMENU_H
#define QMENU_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtCore/qstring.h>
#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 +83,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 +212,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 +250,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 82379c6509..fef1eb2cf4 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 56904f51d6..2b0dc482da 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qmenubar.h"
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qdatetime.h"
@@ -68,15 +69,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
{
@@ -285,19 +277,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);
@@ -457,31 +443,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;
};
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 8b5f370fc3..a77c0f9753 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
@@ -695,16 +691,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));
@@ -754,11 +740,6 @@ QMenuBar::~QMenuBar()
Q_D(QMenuBar);
delete d->platformMenuBar;
d->platformMenuBar = 0;
-
-#ifdef Q_OS_WINCE
- if (qt_wince_is_mobile())
- d->wceDestroyMenuBar();
-#endif
}
/*!
@@ -1124,11 +1105,13 @@ void QMenuBar::keyPressEvent(QKeyEvent *e)
key_consumed = false;
}
+#ifndef QT_NO_SHORTCUT
if (!key_consumed && e->matches(QKeySequence::Cancel)) {
d->setCurrentAction(0);
d->setKeyboardMode(false);
key_consumed = true;
}
+#endif
if(!key_consumed &&
(!e->modifiers() ||
@@ -1225,11 +1208,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;
@@ -1381,11 +1360,6 @@ void QMenuBarPrivate::handleReparent()
platformMenuBar->handleReparent(0);
}
}
-
-#ifdef Q_OS_WINCE
- if (qt_wince_is_mobile() && wce_menubar)
- wce_menubar->rebuild();
-#endif
}
/*!
@@ -1445,6 +1419,7 @@ bool QMenuBar::event(QEvent *e)
case QEvent::Show:
d->_q_updateLayout();
break;
+#ifndef QT_NO_SHORTCUT
case QEvent::ShortcutOverride: {
QKeyEvent *kev = static_cast<QKeyEvent*>(e);
//we only filter out escape if there is a current action
@@ -1454,8 +1429,7 @@ bool QMenuBar::event(QEvent *e)
}
}
break;
-
-
+#endif
#ifndef QT_NO_WHATSTHIS
case QEvent::QueryWhatsThis:
e->setAccepted(d->whatsThis.size());
@@ -1846,55 +1820,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..ec15155710 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -40,6 +40,7 @@
#ifndef QMENUBAR_H
#define QMENUBAR_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qmenu.h>
QT_BEGIN_NAMESPACE
@@ -95,13 +96,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 +135,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 bdff169451..f5409b9762 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qstyleoption.h"
#include <private/qmenu_p.h> // Mac needs what in this file!
#include <qpa/qplatformmenu.h>
@@ -66,17 +67,11 @@ public:
QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
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();
@@ -116,10 +111,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;
@@ -143,47 +134,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/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index 021308493a..432ec85a57 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -40,6 +40,7 @@
#ifndef QPLAINTEXTEDIT_H
#define QPLAINTEXTEDIT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qtextedit.h>
#include <QtWidgets/qabstractscrollarea.h>
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index f5a027be42..f0dd1c0ed4 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractscrollarea_p.h"
#include "QtGui/qtextdocumentfragment.h"
#include "QtWidgets/qscrollbar.h"
diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h
index 5ab702e9d0..2dbb7240c5 100644
--- a/src/widgets/widgets/qprogressbar.h
+++ b/src/widgets/widgets/qprogressbar.h
@@ -40,6 +40,7 @@
#ifndef QPROGRESSBAR_H
#define QPROGRESSBAR_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index a3bb06c063..bf10b9fb75 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
@@ -419,7 +415,7 @@ QSize QPushButton::sizeHint() const
QString s(text());
bool empty = s.isEmpty();
if (empty)
- s = QString::fromLatin1("XXXX");
+ s = QStringLiteral("XXXX");
QFontMetrics fm = fontMetrics();
QSize sz = fm.size(Qt::TextShowMnemonic, s);
if(!empty || !w)
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index 0afd99bccc..56d4d1de20 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -40,6 +40,7 @@
#ifndef QPUSHBUTTON_H
#define QPUSHBUTTON_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index 048f8aad2d..cd453a1339 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -40,6 +40,7 @@
#ifndef QPUSHBUTTON_P_H
#define QPUSHBUTTON_P_H
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractbutton_p.h"
//
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/qradiobutton.h b/src/widgets/widgets/qradiobutton.h
index 76f5c1aae4..2dcb0d0fdf 100644
--- a/src/widgets/widgets/qradiobutton.h
+++ b/src/widgets/widgets/qradiobutton.h
@@ -40,6 +40,7 @@
#ifndef QRADIOBUTTON_H
#define QRADIOBUTTON_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index 30ca96abef..217261bf75 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -40,6 +40,7 @@
#ifndef QRUBBERBAND_H
#define QRUBBERBAND_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index c530ed23ed..92ce287566 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -40,6 +40,7 @@
#ifndef QSCROLLAREA_H
#define QSCROLLAREA_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractscrollarea.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h
index c628d1485e..f7c0725dbe 100644
--- a/src/widgets/widgets/qscrollarea_p.h
+++ b/src/widgets/widgets/qscrollarea_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_SCROLLAREA
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/qscrollbar.h b/src/widgets/widgets/qscrollbar.h
index 4c4a374917..2b8a110c99 100644
--- a/src/widgets/widgets/qscrollbar.h
+++ b/src/widgets/widgets/qscrollbar.h
@@ -40,6 +40,7 @@
#ifndef QSCROLLBAR_H
#define QSCROLLBAR_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qabstractslider.h>
diff --git a/src/widgets/widgets/qscrollbar_p.h b/src/widgets/widgets/qscrollbar_p.h
index 97ea27afdb..e748edf6a9 100644
--- a/src/widgets/widgets/qscrollbar_p.h
+++ b/src/widgets/widgets/qscrollbar_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractslider_p.h"
#include "qstyle.h"
diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h
index a0e7de4fd8..831b146dd2 100644
--- a/src/widgets/widgets/qsizegrip.h
+++ b/src/widgets/widgets/qsizegrip.h
@@ -40,6 +40,7 @@
#ifndef QSIZEGRIP_H
#define QSIZEGRIP_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
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/qslider.h b/src/widgets/widgets/qslider.h
index 66b52c99bd..33b90ece06 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -40,6 +40,7 @@
#ifndef QSLIDER_H
#define QSLIDER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractslider.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index 3464aa86e6..2e77f0be7a 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -40,6 +40,7 @@
#ifndef QSPINBOX_H
#define QSPINBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractspinbox.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h
index 23588004a7..de58d86592 100644
--- a/src/widgets/widgets/qsplashscreen.h
+++ b/src/widgets/widgets/qsplashscreen.h
@@ -40,6 +40,7 @@
#ifndef QSPLASHSCREEN_H
#define QSPLASHSCREEN_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qpixmap.h>
#include <QtWidgets/qwidget.h>
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/qsplitter.h b/src/widgets/widgets/qsplitter.h
index a99bc1c78f..9cfde9fed3 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -40,6 +40,7 @@
#ifndef QSPLITTER_H
#define QSPLITTER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
#include <QtWidgets/qsizepolicy.h>
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index 8bd44fab2b..4422d9a8a4 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qframe_p.h"
#include "qrubberband.h"
diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h
index 266c59134b..36088ae033 100644
--- a/src/widgets/widgets/qstackedwidget.h
+++ b/src/widgets/widgets/qstackedwidget.h
@@ -40,6 +40,7 @@
#ifndef QSTACKEDWIDGET_H
#define QSTACKEDWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
QT_BEGIN_NAMESPACE
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/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index 45416e46b3..aaabb99a27 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -40,6 +40,7 @@
#ifndef QSTATUSBAR_H
#define QSTATUSBAR_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index e51f484f6f..b6a3ef7eb8 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -2547,6 +2547,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..71ca58c993 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -40,6 +40,7 @@
#ifndef QTABBAR_H
#define QTABBAR_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE
@@ -172,6 +173,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 a73c3e11e2..0e9dce84b3 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qtabbar.h"
#include "private/qwidget_p.h"
@@ -131,6 +132,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/qtabwidget.h b/src/widgets/widgets/qtabwidget.h
index c931fb9b83..59fcea223f 100644
--- a/src/widgets/widgets/qtabwidget.h
+++ b/src/widgets/widgets/qtabwidget.h
@@ -40,6 +40,7 @@
#ifndef QTABWIDGET_H
#define QTABWIDGET_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
#include <QtGui/qicon.h>
diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h
index 018c617f88..48b64d1216 100644
--- a/src/widgets/widgets/qtextbrowser.h
+++ b/src/widgets/widgets/qtextbrowser.h
@@ -40,6 +40,7 @@
#ifndef QTEXTBROWSER_H
#define QTEXTBROWSER_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qtextedit.h>
#include <QtCore/qurl.h>
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index 68ad54152b..3b523e3ed0 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -40,6 +40,7 @@
#ifndef QTEXTEDIT_H
#define QTEXTEDIT_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractscrollarea.h>
#include <QtGui/qtextdocument.h>
#include <QtGui/qtextoption.h>
diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h
index c2f41aca66..cca315ce30 100644
--- a/src/widgets/widgets/qtextedit_p.h
+++ b/src/widgets/widgets/qtextedit_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractscrollarea_p.h"
#include "QtGui/qtextdocumentfragment.h"
#include "QtWidgets/qscrollbar.h"
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index e7d3f841d5..61bc6d19cf 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..d361513bbf 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -40,6 +40,7 @@
#ifndef QDYNAMICTOOLBAR_H
#define QDYNAMICTOOLBAR_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qaction.h>
#include <QtWidgets/qwidget.h>
@@ -100,11 +101,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/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h
index 7782b56962..616f53f717 100644
--- a/src/widgets/widgets/qtoolbar_p.h
+++ b/src/widgets/widgets/qtoolbar_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qtoolbar.h"
#include "QtWidgets/qaction.h"
#include "private/qwidget_p.h"
diff --git a/src/widgets/widgets/qtoolbararealayout_p.h b/src/widgets/widgets/qtoolbararealayout_p.h
index a1ae68130c..901f04cf14 100644
--- a/src/widgets/widgets/qtoolbararealayout_p.h
+++ b/src/widgets/widgets/qtoolbararealayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QList>
#include <QSize>
#include <QRect>
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index ea159ce986..c4d803165c 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qtoolbutton.h"
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index 1f93f04a53..9a81c4e50e 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qlayout.h>
#include <private/qlayoutengine_p.h>
#include <QVector>
diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h
index 38e1f130f6..8c9cf9f46a 100644
--- a/src/widgets/widgets/qtoolbarseparator_p.h
+++ b/src/widgets/widgets/qtoolbarseparator_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qwidget.h"
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h
index 2e32668193..6556d8a202 100644
--- a/src/widgets/widgets/qtoolbox.h
+++ b/src/widgets/widgets/qtoolbox.h
@@ -40,6 +40,7 @@
#ifndef QTOOLBOX_H
#define QTOOLBOX_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qframe.h>
#include <QtGui/qicon.h>
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index 7b6114b5c1..95d159f12d 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -40,6 +40,7 @@
#ifndef QTOOLBUTTON_H
#define QTOOLBUTTON_H
+#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h
index 4f16f7b3e5..90be22c271 100644
--- a/src/widgets/widgets/qwidgetanimator_p.h
+++ b/src/widgets/widgets/qwidgetanimator_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// 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 <QtWidgets/private/qtwidgetsglobal_p.h>
#include <qobject.h>
#include <qhash.h>
#include <qpointer.h>
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/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index 5e52e29a51..db9039e302 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_LINEEDIT
#include "private/qwidget_p.h"
diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h
index b955d8b7c3..7bb7d6cd94 100644
--- a/src/widgets/widgets/qwidgetresizehandler_p.h
+++ b/src/widgets/widgets/qwidgetresizehandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtCore/qobject.h"
#include "QtCore/qpoint.h"
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index 89b96fa667..e1687f83a3 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtGui/qtextdocument.h>
#include <QtGui/qtextoption.h>
#include <QtGui/qtextcursor.h>
diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h
index fea72d98ff..35027ff82a 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtGui/qtextdocumentfragment.h"
#include "QtWidgets/qscrollbar.h"
#include "QtGui/qtextcursor.h"
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..4140ae48de 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -10,7 +10,7 @@ QT = core
DEFINES += QT_NO_FOREACH
-contains(QT_CONFIG, debug_and_release): CONFIG += build_all
+qtConfig(debug_and_release): CONFIG += build_all
win32-msvc*:QMAKE_CFLAGS_DEBUG -= -Zi
win32-msvc*:QMAKE_CXXFLAGS_DEBUG -= -Zi
@@ -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 =
diff --git a/src/xml/configure.json b/src/xml/configure.json
new file mode 100644
index 0000000000..345eb8544b
--- /dev/null
+++ b/src/xml/configure.json
@@ -0,0 +1,16 @@
+{
+ "module": "xml",
+ "depends": [
+ "core"
+ ],
+ "testDir": "../../config.tests",
+
+ "features": {
+ "dom": {
+ "label": "DOM",
+ "purpose": "Supports the Document Object Model.",
+ "section": "File I/O",
+ "output": [ "publicFeature", "feature" ]
+ }
+ }
+}
diff --git a/src/xml/qtxmlglobal.h b/src/xml/qtxmlglobal.h
index de5a8ab39d..ed5de8db87 100644
--- a/src/xml/qtxmlglobal.h
+++ b/src/xml/qtxmlglobal.h
@@ -41,6 +41,9 @@
#define QTXMLGLOBAL_H
#include <QtCore/qglobal.h>
+#ifndef QT_BOOTSTRAPPED
+# include <QtXml/qtxml-config.h>
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 4af664d2dd..ee60823003 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -116,7 +116,16 @@ class Q_XML_EXPORT QXmlAttributes
{
public:
QXmlAttributes();
- virtual ~QXmlAttributes();
+#ifdef Q_COMPILER_DEFAULT_MEMBERS
+ QXmlAttributes(const QXmlAttributes &) = default;
+ QXmlAttributes(QXmlAttributes &&) Q_DECL_NOTHROW = default;
+ QXmlAttributes &operator=(const QXmlAttributes &) = default;
+ QXmlAttributes &operator=(QXmlAttributes &&) Q_DECL_NOTHROW = default;
+#endif // default members
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ virtual // ### Qt 6: this value class don't need no virtual dtor
+#endif
+ ~QXmlAttributes();
int index(const QString& qName) const;
int index(QLatin1String qName) const;
diff --git a/sync.profile b/sync.profile
index bba0ff2b2f..4da3499667 100644
--- a/sync.profile
+++ b/sync.profile
@@ -18,8 +18,10 @@
"QtANGLE/EGL" => "!$basedir/src/3rdparty/angle/include/EGL",
"QtZlib" => "!>$basedir/src/corelib;$basedir/src/3rdparty/zlib",
"QtOpenGLExtensions" => "$basedir/src/openglextensions",
+ "QtEglFSDeviceIntegration" => "$basedir/src/plugins/platforms/eglfs",
);
%moduleheaders = ( # restrict the module headers to those found in relative path
+ "QtEglFSDeviceIntegration" => "api",
);
@allmoduleheadersprivate = (
);
@@ -47,6 +49,12 @@
"QtGui" => {
"QGenericPlugin" => "QtGui/QGenericPlugin",
"QGenericPluginFactory" => "QtGui/QGenericPluginFactory"
+ },
+ "QtSql" => {
+ "qsql.h" => "QtSql/qtsqlglobal.h"
+ },
+ "QtDBus" => {
+ "qdbusmacros.h" => "QtDbus/qtdbusglobal.h"
}
);
@@ -56,8 +64,8 @@ my @internal_zlib_headers = ( "crc32.h", "deflate.h", "gzguts.h", "inffast.h", "
my @zlib_headers = ( "zconf.h", "zlib.h" );
@ignore_headers = ( @internal_zlib_headers );
@ignore_for_include_check = ( "qsystemdetection.h", "qcompilerdetection.h", "qprocessordetection.h", @zlib_headers, @angle_headers);
-@ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h", @zlib_headers, @angle_headers);
-%inject_headers = ( "$basedir/src/corelib/global" => [ "qconfig.h", "qfeatures.h" ] );
+@ignore_for_qt_begin_namespace_check = ( "qt_windows.h", @zlib_headers, @angle_headers);
+%inject_headers = ( "$basedir/src/corelib/global" => [ "qconfig.h", "qconfig_p.h" ] );
# Module dependencies.
# Every module that is required to build this module should have one entry.
# Each of the module version specifiers can take one of the following values:
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index c40e3d1140..cadd97fb3a 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -19,7 +19,7 @@ SUBDIRS += \
installed_cmake.depends = cmake
-ios: SUBDIRS = corelib gui
+uikit: SUBDIRS = corelib gui
wince: SUBDIRS -= printsupport
cross_compile: SUBDIRS -= tools cmake installed_cmake
@@ -34,7 +34,7 @@ cross_compile: SUBDIRS -= tools cmake installed_cma
# Disable the QtDBus tests if we can't connect to the session bus
!cross_compile:qtHaveModule(dbus) {
!system("dbus-send --session --type=signal / local.AutotestCheck.Hello >/dev/null 2>&1") {
- contains(QT_CONFIG, dbus-linked): \
+ qtConfig(dbus-linked): \
error("QtDBus is enabled but session bus is not available. Please check the installation.")
else: \
warning("QtDBus is enabled with runtime support, but session bus is not available. Skipping QtDBus tests.")
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index 320e0095d3..a8d64f1cd9 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -62,8 +62,8 @@ private slots:
void tst_QParallelAnimationGroup::initTestCase()
{
qRegisterMetaType<QAbstractAnimation::State>("QAbstractAnimation::State");
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
- // give the mac/wince app start event queue time to clear
+#if defined(Q_OS_DARWIN)
+ // give the Darwin app start event queue time to clear
QTest::qWait(1000);
#endif
}
diff --git a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro
index 9f2e4f9c92..302d887fc7 100644
--- a/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro
+++ b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro
@@ -1,4 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = test
-
-!wince: SUBDIRS += echo
+SUBDIRS = test echo
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index 554f0dc68d..bdd862e316 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -332,7 +332,8 @@ void tst_QTextCodec::codecForLocale()
// find a codec that is not the codecForLocale()
QTextCodec *codec2 = 0;
- foreach (int mib, QTextCodec::availableMibs()) {
+ const auto availableMibs = QTextCodec::availableMibs();
+ for (int mib : availableMibs ) {
if (mib != codec->mibEnum()) {
codec2 = QTextCodec::codecForMib(mib);
if (codec2)
@@ -2148,7 +2149,7 @@ public:
void tst_QTextCodec::threadSafety()
{
QList<QByteArray> codecList = QTextCodec::availableCodecs();
- QList<int> mibList = QTextCodec::availableMibs();
+ const QVector<int> mibList = QTextCodec::availableMibs().toVector();
QThreadPool::globalInstance()->setMaxThreadCount(12);
QVector<QByteArray> res;
@@ -2167,7 +2168,7 @@ void tst_QTextCodec::threadSafety()
QThreadPool::globalInstance()->waitForDone();
QCOMPARE(res.toList(), codecList);
- QCOMPARE(res2.toList(), mibList);
+ QCOMPARE(res2, mibList);
}
void tst_QTextCodec::invalidNames()
@@ -2189,10 +2190,9 @@ void tst_QTextCodec::invalidNames()
void tst_QTextCodec::checkAliases_data()
{
QTest::addColumn<QByteArray>("codecName");
- QList<QByteArray> codecList = QTextCodec::availableCodecs();
- foreach (const QByteArray &a, codecList) {
+ const QList<QByteArray> codecList = QTextCodec::availableCodecs();
+ for (const QByteArray &a : codecList)
QTest::newRow( a.constData() ) << a;
- }
}
void tst_QTextCodec::checkAliases()
@@ -2203,7 +2203,8 @@ void tst_QTextCodec::checkAliases()
QCOMPARE(QTextCodec::codecForName(codecName), c);
QCOMPARE(QTextCodec::codecForName(c->name()), c);
- foreach(const QByteArray &a, c->aliases()) {
+ const auto aliases = c->aliases();
+ for (const QByteArray &a : aliases) {
QCOMPARE(QTextCodec::codecForName(a), c);
}
}
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
index 16265c6187..5666726a8c 100644
--- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
+++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp
@@ -29,7 +29,7 @@
#include <QtTest/QtTest>
#include <qtextcodec.h>
-#include <qsharedpointer.h>
+#include <QScopedPointer>
static const char utf8bom[] = "\xEF\xBB\xBF";
@@ -180,7 +180,7 @@ void tst_Utf8::charByChar()
{
// from utf16 to utf8 char by char:
- QSharedPointer<QTextEncoder> encoder = QSharedPointer<QTextEncoder>(codec->makeEncoder());
+ const QScopedPointer<QTextEncoder> encoder(codec->makeEncoder());
QByteArray encoded;
for (int i = 0; i < utf16.length(); ++i) {
@@ -194,7 +194,7 @@ void tst_Utf8::charByChar()
}
{
// from utf8 to utf16 char by char:
- QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ const QScopedPointer<QTextDecoder> decoder(codec->makeDecoder());
QString decoded;
for (int i = 0; i < utf8.length(); ++i) {
@@ -219,7 +219,7 @@ void tst_Utf8::invalidUtf8()
QFETCH(QByteArray, utf8);
QFETCH_GLOBAL(bool, useLocale);
- QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ const QScopedPointer<QTextDecoder> decoder(codec->makeDecoder());
decoder->toUnicode(utf8);
// Only enforce correctness on our UTF-8 decoder
@@ -280,7 +280,7 @@ void tst_Utf8::nonCharacters()
QFETCH(QString, utf16);
QFETCH_GLOBAL(bool, useLocale);
- QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
+ const QScopedPointer<QTextDecoder> decoder(codec->makeDecoder());
decoder->toUnicode(utf8);
// Only enforce correctness on our UTF-8 decoder
@@ -289,7 +289,7 @@ void tst_Utf8::nonCharacters()
else if (decoder->hasFailure())
qWarning("System codec reports failure when it shouldn't. Should report bug upstream.");
- QSharedPointer<QTextEncoder> encoder(codec->makeEncoder());
+ const QScopedPointer<QTextEncoder> encoder(codec->makeEncoder());
encoder->fromUnicode(utf16);
if (!useLocale)
QVERIFY(!encoder->hasFailure());
diff --git a/tests/auto/corelib/corelib.pro b/tests/auto/corelib/corelib.pro
index 4d88b04828..169579bd6b 100644
--- a/tests/auto/corelib/corelib.pro
+++ b/tests/auto/corelib/corelib.pro
@@ -3,7 +3,7 @@ TEMPLATE=subdirs
SUBDIRS = \
kernel
-!ios: SUBDIRS += \
+!uikit: SUBDIRS += \
animation \
codecs \
global \
diff --git a/tests/auto/corelib/global/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro
index 29dfb0684c..c3c11fa81b 100644
--- a/tests/auto/corelib/global/qflags/qflags.pro
+++ b/tests/auto/corelib/global/qflags/qflags.pro
@@ -2,5 +2,5 @@ CONFIG += testcase
TARGET = tst_qflags
QT = core testlib
SOURCES = tst_qflags.cpp
-contains(QT_CONFIG, c++11): CONFIG += c++11
-contains(QT_CONFIG, c++14): CONFIG += c++14
+qtConfig(c++11): CONFIG += c++11
+qtConfig(c++14): CONFIG += c++14
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index bb4d1f4bf2..9b92a4ff15 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -81,7 +81,7 @@ void tst_QGlobal::qIsNull()
void tst_QGlobal::for_each()
{
- QList<int> list;
+ QVector<int> list;
list << 0 << 1 << 2 << 3 << 4 << 5;
int counter = 0;
@@ -100,7 +100,7 @@ void tst_QGlobal::for_each()
// check whether we can pass a constructor as container argument
counter = 0;
- foreach (int i, QList<int>(list)) {
+ foreach (int i, QVector<int>(list)) {
QCOMPARE(i, counter++);
}
QCOMPARE(counter, list.count());
@@ -589,7 +589,7 @@ Q_DECLARE_METATYPE(stringpair)
void tst_QGlobal::qprintable()
{
- QFETCH(QList<stringpair>, localestrings);
+ QFETCH(QVector<stringpair>, localestrings);
QFETCH(int, utf8index);
QVERIFY(utf8index >= 0 && utf8index < localestrings.count());
@@ -600,21 +600,21 @@ void tst_QGlobal::qprintable()
QString string = QString::fromUtf8(utf8string);
- foreach (const stringpair &pair, localestrings) {
+ for (const stringpair &pair : qAsConst(localestrings)) {
QTextCodec *codec = QTextCodec::codecForName(pair.first);
if (!codec)
continue;
QTextCodec::setCodecForLocale(codec);
// test qPrintable()
QVERIFY(qstrcmp(qPrintable(string), pair.second) == 0);
- foreach (const stringpair &pair2, localestrings) {
+ for (const stringpair &pair2 : qAsConst(localestrings)) {
if (pair2.second == pair.second)
continue;
QVERIFY(qstrcmp(qPrintable(string), pair2.second) != 0);
}
// test qUtf8Printable()
QVERIFY(qstrcmp(qUtf8Printable(string), utf8string) == 0);
- foreach (const stringpair &pair2, localestrings) {
+ for (const stringpair &pair2 : qAsConst(localestrings)) {
if (qstrcmp(pair2.second, utf8string) == 0)
continue;
QVERIFY(qstrcmp(qUtf8Printable(string), pair2.second) != 0);
@@ -626,7 +626,7 @@ void tst_QGlobal::qprintable()
void tst_QGlobal::qprintable_data()
{
- QTest::addColumn<QList<stringpair> >("localestrings");
+ QTest::addColumn<QVector<stringpair> >("localestrings");
QTest::addColumn<int>("utf8index"); // index of utf8 string
// Unicode: HIRAGANA LETTER A, I, U, E, O (U+3442, U+3444, U+3446, U+3448, U+344a)
@@ -634,7 +634,7 @@ void tst_QGlobal::qprintable_data()
static const char *const eucjpstring = "\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa";
static const char *const sjisstring = "\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8";
- QList<stringpair> japanesestrings;
+ QVector<stringpair> japanesestrings;
japanesestrings << stringpair("UTF-8", utf8string)
<< stringpair("EUC-JP", eucjpstring)
<< stringpair("Shift_JIS", sjisstring);
diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro
index b5b75be3a6..93eee7307a 100644
--- a/tests/auto/corelib/global/qlogging/test/test.pro
+++ b/tests/auto/corelib/global/qlogging/test/test.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
CONFIG -= app_bundle debug_and_release_target
-contains(QT_CONFIG, c++11): CONFIG += c++11
-contains(QT_CONFIG, c++14): CONFIG += c++14
+qtConfig(c++11): CONFIG += c++11
+qtConfig(c++14): CONFIG += c++14
TARGET = ../tst_qlogging
QT = core testlib
SOURCES = ../tst_qlogging.cpp
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index ce227a6c8b..c2d7338042 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -30,7 +30,7 @@
#include <qdebug.h>
#include <qglobal.h>
#include <QtCore/QProcess>
-#include <QtTest/QtTest>
+#include <QtTest/QTest>
class tst_qmessagehandler : public QObject
{
@@ -841,7 +841,7 @@ void tst_qmessagehandler::qMessagePattern()
QVERIFY(!output.isEmpty());
QCOMPARE(!output.contains("QT_MESSAGE_PATTERN"), valid);
- foreach (const QByteArray &e, expected) {
+ for (const QByteArray &e : qAsConst(expected)) {
if (!output.contains(e)) {
qDebug() << output;
qDebug() << "expected: " << e;
diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro
index 2b0af4fa4c..214c706ca5 100644
--- a/tests/auto/corelib/global/qtendian/qtendian.pro
+++ b/tests/auto/corelib/global/qtendian/qtendian.pro
@@ -2,7 +2,3 @@ CONFIG += testcase
TARGET = tst_qtendian
QT = core testlib
SOURCES = tst_qtendian.cpp
-wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE
- QMAKE_CFLAGS_RELEASE -= -O2
- QMAKE_CXXFLAGS_RELEASE -= -O2
-}
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro
index 29717b3a1c..0542833456 100644
--- a/tests/auto/corelib/io/io.pro
+++ b/tests/auto/corelib/io/io.pro
@@ -35,7 +35,7 @@ SUBDIRS=\
qurlquery \
qwinoverlappedionotifier \
-!win32|wince* {
+!win32 {
SUBDIRS -=\
qwinoverlappedionotifier
}
@@ -49,14 +49,14 @@ SUBDIRS=\
qprocess \
qtextstream
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qabstractfileengine \
qfileinfo \
qipaddress \
qurlinternal \
qloggingregistry
-win32:!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+win32:!qtConfig(private_tests): SUBDIRS -= \
qfilesystementry
winrt: SUBDIRS -= \
diff --git a/tests/auto/corelib/io/largefile/largefile.pro b/tests/auto/corelib/io/largefile/largefile.pro
index caef116684..6c1bb8d7ea 100644
--- a/tests/auto/corelib/io/largefile/largefile.pro
+++ b/tests/auto/corelib/io/largefile/largefile.pro
@@ -2,5 +2,3 @@ CONFIG += testcase
TARGET = tst_largefile
QT = core testlib
SOURCES = tst_largefile.cpp
-
-wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp
index e448093062..a19a5ce58d 100644
--- a/tests/auto/corelib/io/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp
@@ -39,18 +39,12 @@
#include <cstdio>
#ifdef Q_OS_WIN
-
-#include <windows.h>
-
-#ifndef Q_OS_WINCE
-#include <io.h>
-#endif
-
-#ifndef FSCTL_SET_SPARSE
+# include <qt_windows.h>
+# include <io.h>
+# ifndef FSCTL_SET_SPARSE
// MinGW doesn't define this.
-#define FSCTL_SET_SPARSE (0x900C4)
-#endif
-
+# define FSCTL_SET_SPARSE (0x900C4)
+# endif
#endif // Q_OS_WIN
class tst_LargeFile
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
index 447cf2845e..5b03b35780 100644
--- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
@@ -35,8 +35,6 @@
#include <QtGui/QPainter>
#include <QtGui/QPen>
-#include "../../../qtest-config.h"
-
class tst_QDataStream : public QObject
{
Q_OBJECT
@@ -65,7 +63,7 @@ private slots:
void stream_QByteArray_data();
void stream_QByteArray();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void stream_QCursor_data();
void stream_QCursor();
#endif
@@ -88,10 +86,8 @@ private slots:
void stream_QPen_data();
void stream_QPen();
-#ifndef Q_OS_WINCE
void stream_QPixmap_data();
void stream_QPixmap();
-#endif
void stream_QPoint_data();
void stream_QPoint();
@@ -123,10 +119,8 @@ private slots:
void stream_qint64_data();
void stream_qint64();
-#ifndef Q_OS_WINCE
void stream_QIcon_data();
void stream_QIcon();
-#endif
void stream_QEasingCurve_data();
void stream_QEasingCurve();
@@ -193,7 +187,7 @@ private:
void writeQBrush(QDataStream *s);
void writeQColor(QDataStream *s);
void writeQByteArray(QDataStream *s);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void writeQCursor(QDataStream *s);
#endif
void writeQWaitCursor(QDataStream *s);
@@ -222,7 +216,7 @@ private:
void readQBrush(QDataStream *s);
void readQColor(QDataStream *s);
void readQByteArray(QDataStream *s);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void readQCursor(QDataStream *s);
#endif
void readQDate(QDataStream *s);
@@ -1023,7 +1017,7 @@ void tst_QDataStream::readQByteArray(QDataStream *s)
}
// ************************************
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
static QCursor qCursorData(int index)
{
switch (index) {
@@ -1042,21 +1036,21 @@ static QCursor qCursorData(int index)
}
#endif
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QDataStream::stream_QCursor_data()
{
stream_data(9);
}
#endif
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QDataStream::stream_QCursor()
{
STREAM_IMPL(QCursor);
}
#endif
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QDataStream::writeQCursor(QDataStream *s)
{
QCursor d5(qCursorData(dataIndex(QTest::currentDataTag())));
@@ -1064,7 +1058,7 @@ void tst_QDataStream::writeQCursor(QDataStream *s)
}
#endif
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QDataStream::readQCursor(QDataStream *s)
{
QCursor test(qCursorData(dataIndex(QTest::currentDataTag())));
@@ -1543,24 +1537,16 @@ void tst_QDataStream::readQPen(QDataStream *s)
// pixmap testing is currently limited to one pixmap only.
//
-#ifndef Q_OS_WINCE
-// Test depends on more memory than available on Qt/CE
void tst_QDataStream::stream_QPixmap_data()
{
stream_data(1);
}
-#endif
-#ifndef Q_OS_WINCE
-// Test depends on more memory than available on Qt/CE
void tst_QDataStream::stream_QPixmap()
{
STREAM_IMPL(QPixmap);
}
-#endif
-#ifndef Q_OS_WINCE
-// Test depends on more memory than available on Qt/CE
void tst_QDataStream::stream_QIcon_data()
{
stream_data(1);
@@ -1570,7 +1556,6 @@ void tst_QDataStream::stream_QIcon()
{
STREAM_IMPL(QIcon);
}
-#endif
void tst_QDataStream::writeQPixmap(QDataStream *s)
{
@@ -1845,7 +1830,7 @@ static QRegion qRegionData(int index)
case 4: return QRegion(100, -100, 2048, 4096, QRegion::Rectangle);
case 5: return QRegion(-100, 100, 4096, 2048, QRegion::Rectangle);
case 6: return QRegion(0, 0, 0, 0, QRegion::Ellipse);
-#if (!defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)) // all our Unix platforms use X regions.
+#if !defined(Q_OS_UNIX) // all our Unix platforms use X regions.
case 7: return QRegion(1, 2, 300, 400, QRegion::Ellipse);
case 8: return QRegion(100, 100, 1024, 768, QRegion::Ellipse);
case 9: return QRegion(-100, -100, 1024, 1024, QRegion::Ellipse);
@@ -2497,12 +2482,10 @@ void tst_QDataStream::status_charptr_QByteArray_data()
QTest::addColumn<int>("expectedStatus");
QTest::addColumn<QByteArray>("expectedString");
-#if !defined(Q_OS_WINCE)
QByteArray oneMbMinus1(1024 * 1024 - 1, '\0');
for (int i = 0; i < oneMbMinus1.size(); ++i)
oneMbMinus1[i] = 0x1 | (8 * ((uchar)i / 9));
QByteArray threeMbMinus1 = oneMbMinus1 + 'j' + oneMbMinus1 + 'k' + oneMbMinus1;
-#endif
// ok
QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QByteArray();
@@ -2511,14 +2494,12 @@ void tst_QDataStream::status_charptr_QByteArray_data()
QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x03jkl", 7) << (int) QDataStream::Ok << QByteArray("jkl");
QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x04jklm", 8) << (int) QDataStream::Ok << QByteArray("jklm");
QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x04jklmj", 8) << (int) QDataStream::Ok << QByteArray("jklm");
-#if !defined(Q_OS_WINCE)
QTest::newRow("size 1MB-1") << QByteArray("\x00\x0f\xff\xff", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << oneMbMinus1;
QTest::newRow("size 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "j";
QTest::newRow("size 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << oneMbMinus1 + "jk";
QTest::newRow("size 3MB-1") << QByteArray("\x00\x2f\xff\xff", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::Ok << threeMbMinus1;
QTest::newRow("size 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "j";
QTest::newRow("size 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("jkl") << (int) QDataStream::Ok << threeMbMinus1 + "jk";
-#endif
// past end
QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QByteArray();
@@ -2531,12 +2512,10 @@ void tst_QDataStream::status_charptr_QByteArray_data()
QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x02j", 5) << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x03jk", 6) << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x04jkl", 7) << (int) QDataStream::ReadPastEnd << QByteArray();
-#if !defined(Q_OS_WINCE)
QTest::newRow("badsize 1MB") << QByteArray("\x00\x10\x00\x00", 4) + oneMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x10\x00\x01", 4) + oneMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 3MB") << QByteArray("\x00\x30\x00\x00", 4) + threeMbMinus1 << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x30\x00\x01", 4) + threeMbMinus1 + QByteArray("j") << (int) QDataStream::ReadPastEnd << QByteArray();
-#endif
QTest::newRow("size -1") << QByteArray("\xff\xff\xff\xff", 4) << (int) QDataStream::ReadPastEnd << QByteArray();
QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QByteArray();
}
@@ -2601,7 +2580,6 @@ void tst_QDataStream::status_QString_data()
QTest::addColumn<int>("expectedStatus");
QTest::addColumn<QString>("expectedString");
-#if !defined(Q_OS_WINCE)
QString oneMbMinus1;
oneMbMinus1.resize(1024 * 1024 - 1);
for (int i = 0; i < oneMbMinus1.size(); ++i)
@@ -2610,7 +2588,6 @@ void tst_QDataStream::status_QString_data()
QByteArray threeMbMinus1Data = qstring2qbytearray(threeMbMinus1);
QByteArray oneMbMinus1Data = qstring2qbytearray(oneMbMinus1);
-#endif
// ok
QTest::newRow("size 0") << QByteArray("\x00\x00\x00\x00", 4) << (int) QDataStream::Ok << QString();
@@ -2619,14 +2596,12 @@ void tst_QDataStream::status_QString_data()
QTest::newRow("size 3") << QByteArray("\x00\x00\x00\x06\x00j\x00k\x00l", 10) << (int) QDataStream::Ok << QString("jkl");
QTest::newRow("size 4") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00m", 12) << (int) QDataStream::Ok << QString("jklm");
QTest::newRow("size 4j") << QByteArray("\x00\x00\x00\x08\x00j\x00k\x00l\x00mjj", 14) << (int) QDataStream::Ok << QString("jklm");
-#if !defined(Q_OS_WINCE)
QTest::newRow("size 1MB-1") << QByteArray("\x00\x1f\xff\xfe", 4) + oneMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << oneMbMinus1;
QTest::newRow("size 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "j";
QTest::newRow("size 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << oneMbMinus1 + "jk";
QTest::newRow("size 3MB-1") << QByteArray("\x00\x5f\xff\xfe", 4) + threeMbMinus1Data + QByteArray("jj") << (int) QDataStream::Ok << threeMbMinus1;
QTest::newRow("size 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "j";
QTest::newRow("size 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("\x00j\x00k\x00l", 6) << (int) QDataStream::Ok << threeMbMinus1 + "jk";
-#endif
// past end
QTest::newRow("empty") << QByteArray() << (int) QDataStream::ReadPastEnd << QString();
@@ -2639,14 +2614,12 @@ void tst_QDataStream::status_QString_data()
QTest::newRow("badsize 2") << QByteArray("\x00\x00\x00\x04jj", 6) << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 3") << QByteArray("\x00\x00\x00\x06jjkk", 8) << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 4") << QByteArray("\x00\x00\x00\x08jjkkll", 10) << (int) QDataStream::ReadPastEnd << QString();
-#if !defined(Q_OS_WINCE)
QTest::newRow("badsize 1MB") << QByteArray("\x00\x20\x00\x00", 4) + oneMbMinus1Data << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 1MB+1") << QByteArray("\x00\x20\x00\x02", 4) + oneMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 3MB") << QByteArray("\x00\x60\x00\x00", 4) + threeMbMinus1Data << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("badsize 3MB+1") << QByteArray("\x00\x60\x00\x02", 4) + threeMbMinus1Data + QByteArray("j") << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("size -2") << QByteArray("\xff\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString();
QTest::newRow("size MAX") << QByteArray("\x7f\xff\xff\xfe", 4) << (int) QDataStream::ReadPastEnd << QString();
-#endif
// corrupt data
QTest::newRow("corrupt1") << QByteArray("yyyy") << (int) QDataStream::ReadCorruptData << QString();
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 48b8db949f..294a53645e 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -35,7 +35,7 @@
#include <qregexp.h>
#include <qstringlist.h>
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if defined(Q_OS_WIN)
#include <QtCore/private/qfsfileengine_p.h>
#include "../../../network-settings.h"
#endif
@@ -163,9 +163,8 @@ private slots:
void operator_eq();
-#ifndef Q_OS_WINCE
void dotAndDotDot();
-#endif
+
void homePath();
void tempPath();
void rootPath();
@@ -317,7 +316,7 @@ void tst_QDir::setPath_data()
QTest::addColumn<QString>("dir2");
QTest::newRow("data0") << QString(".") << QString("..");
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if defined(Q_OS_WIN)
QTest::newRow("data1") << QString("c:/") << QDir::currentPath();
#endif
}
@@ -544,7 +543,7 @@ void tst_QDir::exists_data()
QTest::newRow("simple dir") << (m_dataPath + "/resources") << true;
QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << true;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
QTest::newRow("unc 1") << uncRoot << true;
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
@@ -556,7 +555,7 @@ void tst_QDir::exists_data()
QTest::newRow("unc 8") << uncRoot + "/asharethatshouldnotexist" << false;
QTest::newRow("unc 9") << "//ahostthatshouldnotexist" << false;
#endif
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
QTest::newRow("This drive should exist") << "C:/" << true;
// find a non-existing drive and check if it does not exist
#ifdef QT_BUILD_INTERNAL
@@ -597,7 +596,7 @@ void tst_QDir::isRelativePath_data()
QTest::addColumn<bool>("relative");
QTest::newRow("data0") << "../somedir" << true;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if defined(Q_OS_WIN)
QTest::newRow("data1") << "C:/sOmedir" << false;
#endif
QTest::newRow("data2") << "somedir" << true;
@@ -803,12 +802,6 @@ void tst_QDir::entryList()
QFile::remove(entrylistPath + "brokenlink.lnk");
QFile::remove(entrylistPath + "brokenlink");
- // WinCE does not have . and .. in the directory listing
-#if defined(Q_OS_WINCE)
- expected.removeAll(".");
- expected.removeAll("..");
-#endif
-
#ifndef Q_NO_SYMLINKS
#if defined(Q_OS_WIN)
// ### Sadly, this is a platform difference right now.
@@ -901,15 +894,10 @@ void tst_QDir::entryListSimple_data()
QTest::addColumn<int>("countMin");
QTest::newRow("data2") << "do_not_expect_this_path_to_exist/" << 0;
-#if defined(Q_OS_WINCE)
- QTest::newRow("simple dir") << (m_dataPath + "/resources") << 0;
- QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 0;
-#else
QTest::newRow("simple dir") << (m_dataPath + "/resources") << 2;
QTest::newRow("simple dir with slash") << (m_dataPath + "/resources/") << 2;
-#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
QTest::newRow("unc 1") << uncRoot << 2;
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << 2;
@@ -1000,15 +988,7 @@ void tst_QDir::canonicalPath_data()
QTest::newRow("nonexistant") << "testd" << QString();
QTest::newRow("rootPath") << QDir::rootPath() << QDir::rootPath();
-
-#ifdef Q_OS_MAC
- // On Mac OS X 10.5 and earlier, canonicalPath depends on cleanPath which
- // is itself very broken and fundamentally wrong on "/./" which, this would
- // exercise
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6)
-#endif
- QTest::newRow("rootPath + ./") << QDir::rootPath().append("./") << QDir::rootPath();
-
+ QTest::newRow("rootPath + ./") << QDir::rootPath().append("./") << QDir::rootPath();
QTest::newRow("rootPath + ../.. ") << QDir::rootPath().append("../..") << QDir::rootPath();
#if defined(Q_OS_WIN)
QTest::newRow("drive:\\") << QDir::toNativeSeparators(QDir::rootPath()) << QDir::rootPath();
@@ -1171,7 +1151,6 @@ tst_QDir::cleanPath_data()
QTest::newRow("data2") << "/" << "/";
QTest::newRow("data3") << QDir::cleanPath("../.") << "..";
QTest::newRow("data4") << QDir::cleanPath("../..") << "../..";
-#if !defined(Q_OS_WINCE)
#if defined(Q_OS_WIN)
QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:/a/bc";
QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << "d:/";
@@ -1179,17 +1158,14 @@ tst_QDir::cleanPath_data()
QTest::newRow("data5") << "d:\\a\\bc\\def\\.." << "d:\\a\\bc\\def\\..";
QTest::newRow("data6") << "d:\\a\\bc\\def\\../../.." << "..";
#endif
-#endif
QTest::newRow("data7") << ".//file1.txt" << "file1.txt";
QTest::newRow("data8") << "/foo/bar/..//file1.txt" << "/foo/file1.txt";
QTest::newRow("data9") << "//" << "/";
-#if !defined(Q_OS_WINCE)
#if defined Q_OS_WIN
QTest::newRow("data10") << "c:\\" << "c:/";
#else
QTest::newRow("data10") << "/:/" << "/:";
#endif
-#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QTest::newRow("data11") << "//foo//bar" << "//foo/bar";
#endif
@@ -1351,7 +1327,7 @@ void tst_QDir::absolutePath_data()
QTest::addColumn<QString>("expectedPath");
QTest::newRow("0") << "/machine/share/dir1" << "/machine/share/dir1";
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
QTest::newRow("1") << "\\machine\\share\\dir1" << "/machine/share/dir1";
QTest::newRow("2") << "//machine/share/dir1" << "//machine/share/dir1";
QTest::newRow("3") << "\\\\machine\\share\\dir1" << "//machine/share/dir1";
@@ -1400,7 +1376,7 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("same path 1") << "/tmp" << "/tmp" << ".";
QTest::newRow("same path 2") << "//tmp" << "/tmp/" << ".";
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if defined(Q_OS_WIN)
QTest::newRow("12") << "C:/foo/bar" << "ding" << "ding";
QTest::newRow("13") << "C:/foo/bar" << "C:/ding/dong" << "../../ding/dong";
QTest::newRow("14") << "C:/foo/bar" << "/ding/dong" << "../../ding/dong";
@@ -1576,7 +1552,6 @@ void tst_QDir::operator_eq()
dir1.setPath("..");
}
-#ifndef Q_OS_WINCE
// WinCE does not have . nor ..
void tst_QDir::dotAndDotDot()
{
@@ -1586,7 +1561,6 @@ void tst_QDir::dotAndDotDot()
entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
QCOMPARE(entryList, QStringList() << QString("dir") << QString("spaces"));
}
-#endif
void tst_QDir::homePath()
{
@@ -1830,16 +1804,9 @@ void tst_QDir::updateFileLists()
QDir dir(fs.absoluteFilePath(dirName));
-#if defined(Q_OS_WINCE)
- //no . and .. on these OS.
- QCOMPARE(dir.count(), uint(4));
- QCOMPARE(dir.entryList().size(), 4);
- QCOMPARE(dir.entryInfoList().size(), 4);
-#else
QCOMPARE(dir.count(), uint(6));
QCOMPARE(dir.entryList().size(), 6);
QCOMPARE(dir.entryInfoList().size(), 6);
-#endif
dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);
@@ -2020,13 +1987,7 @@ void tst_QDir::isRoot_data()
QTest::newRow(QString("./ appended " + test).toLatin1()) << test << false;
test = QDir(QDir::rootPath().append("./")).canonicalPath();
-#ifdef Q_OS_MAC
- // On Mac OS X 10.5 and earlier, canonicalPath depends on cleanPath which
- // is itself very broken and fundamentally wrong on "/./", which this would
- // exercise
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6)
-#endif
- QTest::newRow(QString("canonicalPath " + test).toLatin1()) << test << true;
+ QTest::newRow(QString("canonicalPath " + test).toLatin1()) << test << true;
#if defined(Q_OS_WIN)
test = QDir::rootPath().left(2);
diff --git a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro
index 5404e9058f..7c1f026bdb 100644
--- a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro
+++ b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro
@@ -6,5 +6,3 @@ RESOURCES += qdiriterator.qrc
TESTDATA += entrylist
contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA
-
-wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1
diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
index 0fbce74055..6450e9af7b 100644
--- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
@@ -41,7 +41,7 @@
#define Q_NO_SYMLINKS
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
# include "../../../network-settings.h"
#endif
@@ -103,7 +103,7 @@ private slots:
void longPath();
void dirorder();
void relativePaths();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
void uncPaths_data();
void uncPaths();
#endif
@@ -196,7 +196,7 @@ void tst_QDirIterator::initTestCase()
# endif
#endif
-#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN)
createDirectory("hiddenDirs_hiddenFiles");
createFile("hiddenDirs_hiddenFiles/normalFile");
createFile("hiddenDirs_hiddenFiles/.hiddenFile");
@@ -239,10 +239,8 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
<< QString(
-#if !defined(Q_OS_WINCE)
"entrylist/.,"
"entrylist/..,"
-#endif
"entrylist/file,"
#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
@@ -257,9 +255,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
<< QDir::Filters(QDir::AllEntries | QDir::NoDot) << QStringList("*")
<< QString(
-#if !defined(Q_OS_WINCE)
"entrylist/..,"
-#endif
"entrylist/file,"
#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
@@ -274,9 +270,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
<< QDir::Filters(QDir::AllEntries | QDir::NoDotDot) << QStringList("*")
<< QString(
-#if !defined(Q_OS_WINCE)
"entrylist/.,"
-#endif
"entrylist/file,"
#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
@@ -305,12 +299,10 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
<< QString("entrylist") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories | QDirIterator::FollowSymlinks)
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
<< QString(
-#if !defined(Q_OS_WINCE)
"entrylist/.,"
"entrylist/..,"
"entrylist/directory/.,"
"entrylist/directory/..,"
-#endif
"entrylist/file,"
#ifndef Q_NO_SYMLINKS
"entrylist/linktofile.lnk,"
@@ -345,11 +337,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
QTest::newRow("empty, default")
<< QString("empty") << QDirIterator::IteratorFlags(0)
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
-#if defined(Q_OS_WINCE)
- << QStringList();
-#else
<< QString("empty/.,empty/..").split(',');
-#endif
QTest::newRow("empty, QDir::NoDotAndDotDot")
<< QString("empty") << QDirIterator::IteratorFlags(0)
@@ -562,13 +550,6 @@ void tst_QDirIterator::longPath()
while (dir.exists(dirName) || dir.mkdir(dirName)) {
++n;
dirName.append('x');
-#if defined(Q_OS_WINCE) && defined(WINCE_BROKEN_ITERATE)
- // Some Windows CE devices/emulators are broken.
- // though one can create directories of length <= 217,
- // FindNextFile only reports entries until ~ 214.
- if (n >= 210)
- break;
-#endif
}
QDirIterator it(dir.absolutePath(), QDir::NoDotAndDotDot|QDir::Dirs, QDirIterator::Subdirectories);
@@ -606,7 +587,7 @@ void tst_QDirIterator::relativePaths()
}
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
void tst_QDirIterator::uncPaths_data()
{
QTest::addColumn<QString>("dirName");
diff --git a/tests/auto/corelib/io/qfile/qfile.pro b/tests/auto/corelib/io/qfile/qfile.pro
index 10c8d918f7..0735daedb3 100644
--- a/tests/auto/corelib/io/qfile/qfile.pro
+++ b/tests/auto/corelib/io/qfile/qfile.pro
@@ -1,7 +1,2 @@
TEMPLATE = subdirs
-wince* {
- SUBDIRS = test
-} else {
- SUBDIRS = test stdinprocess
-}
-
+SUBDIRS = test stdinprocess
diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro
index c9ba96cc1b..c0c4b9d5d2 100644
--- a/tests/auto/corelib/io/qfile/test/test.pro
+++ b/tests/auto/corelib/io/qfile/test/test.pro
@@ -6,7 +6,6 @@ else: DEFINES += QT_NO_NETWORK
TARGET = ../tst_qfile
SOURCES = ../tst_qfile.cpp
-wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp
RESOURCES += ../qfile.qrc ../rename-fallback.qrc ../copy-fallback.qrc
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index d6bc75317a..021d581aac 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -47,7 +47,7 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
QT_END_NAMESPACE
#endif
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_NETWORK)
+#if !defined(QT_NO_NETWORK)
#include <QHostInfo>
#endif
#include <QProcess>
@@ -66,8 +66,6 @@ QT_END_NAMESPACE
# include <sys/mount.h>
#elif defined(Q_OS_IRIX)
# include <sys/statfs.h>
-#elif defined(Q_OS_WINCE)
-# include <qplatformdefs.h>
#elif defined(Q_OS_VXWORKS)
# include <fcntl.h>
#if defined(_WRS_KERNEL)
@@ -85,7 +83,7 @@ QT_END_NAMESPACE
#include <stdio.h>
#include <errno.h>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
#include "../../../network-settings.h"
#endif
@@ -135,11 +133,9 @@ private slots:
void readAll_data();
void readAll();
void readAllBuffer();
-#if !defined(Q_OS_WINCE)
void readAllStdin();
void readLineStdin();
void readLineStdin_lineByLine();
-#endif
void text();
void missingEndOfLine();
void readBlock();
@@ -159,17 +155,19 @@ private slots:
void copyRemovesTemporaryFile() const;
void copyShouldntOverwrite();
void copyFallback();
+#ifndef Q_OS_WINRT
void link();
void linkToDir();
void absolutePathLinkToRelativePath();
void readBrokenLink();
+#endif
void readTextFile_data();
void readTextFile();
void readTextFile2();
void writeTextFile_data();
void writeTextFile();
/* void largeFileSupport(); */
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void largeUncFileSupport();
#endif
void flush();
@@ -225,10 +223,8 @@ private slots:
void mapWrittenFile_data();
void mapWrittenFile();
-#ifndef Q_OS_WINCE
void openStandardStreamsFileDescriptors();
void openStandardStreamsBufferedStreams();
-#endif
void resize_data();
void resize();
@@ -491,7 +487,7 @@ void tst_QFile::exists()
file.remove();
QVERIFY(!file.exists());
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
const QString uncPath = "//" + QtNetworkSettings::winServerName() + "/testshare/readme.txt";
QFile unc(uncPath);
QVERIFY2(unc.exists(), msgFileDoesNotExist(uncPath).constData());
@@ -543,7 +539,7 @@ void tst_QFile::open_data()
<< int(QIODevice::ReadOnly)
<< false
<< QFile::OpenError;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
//opening devices requires administrative privileges (and elevation).
HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hTest != INVALID_HANDLE_VALUE) {
@@ -574,7 +570,7 @@ void tst_QFile::open()
QSKIP("Running this test as root doesn't make sense");
#endif
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN32) || defined(Q_OS_WINRT)
QEXPECT_FAIL("noreadfile", "Windows does not currently support non-readable files.", Abort);
#endif
if (filename.isEmpty())
@@ -626,7 +622,7 @@ void tst_QFile::size_data()
QTest::addColumn<qint64>("size");
QTest::newRow( "exist01" ) << m_testFile << (qint64)245;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// Only test UNC on Windows./
QTest::newRow("unc") << "//" + QString(QtNetworkSettings::winServerName() + "/testshare/test.pri") << (qint64)34;
#endif
@@ -637,10 +633,6 @@ void tst_QFile::size()
QFETCH( QString, filename );
QFETCH( qint64, size );
-#ifdef Q_OS_WINCE
- filename = QFileInfo(filename).absoluteFilePath();
-#endif
-
{
QFile f( filename );
QCOMPARE( f.size(), size );
@@ -660,9 +652,6 @@ void tst_QFile::size()
fclose(stream);
}
- // Currently low level file I/O is not well supported on Windows CE, so
- // skip this part of the test.
-#ifndef Q_OS_WINCE
{
QFile f;
@@ -675,7 +664,6 @@ void tst_QFile::size()
f.close();
QT_CLOSE(fd);
}
-#endif
}
void tst_QFile::sizeNoExist()
@@ -920,7 +908,6 @@ private:
};
#endif // !QT_NO_PROCESS
-#if !defined(Q_OS_WINCE)
void tst_QFile::readAllStdin()
{
#ifdef QT_NO_PROCESS
@@ -1011,7 +998,6 @@ void tst_QFile::readLineStdin_lineByLine()
}
#endif
}
-#endif
void tst_QFile::text()
{
@@ -1112,7 +1098,7 @@ void tst_QFile::ungetChar()
QCOMPARE(buf[2], '4');
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QString driveLetters()
{
wchar_t volumeName[MAX_PATH];
@@ -1149,7 +1135,7 @@ void tst_QFile::invalidFile_data()
#if !defined(Q_OS_WIN)
QTest::newRow( "x11" ) << QString( "qwe//" );
#else
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
QTest::newRow( "colon2" ) << invalidDriveLetter() + QString::fromLatin1(":ail:invalid");
#endif
QTest::newRow( "colon3" ) << QString( ":failinvalid" );
@@ -1211,13 +1197,11 @@ void tst_QFile::permissions_data()
QTest::newRow("data0") << QCoreApplication::instance()->applicationFilePath() << uint(QFile::ExeUser) << true << false;
QTest::newRow("data1") << m_testSourceFile << uint(QFile::ReadUser) << true << false;
QTest::newRow("readonly") << QString::fromLatin1("readonlyfile") << uint(QFile::WriteUser) << false << false;
-#ifndef Q_OS_WINCE
QTest::newRow("longfile") << QString::fromLatin1("longFileNamelongFileNamelongFileNamelongFileName"
"longFileNamelongFileNamelongFileNamelongFileName"
"longFileNamelongFileNamelongFileNamelongFileName"
"longFileNamelongFileNamelongFileNamelongFileName"
"longFileNamelongFileNamelongFileNamelongFileName.txt") << uint(QFile::ReadUser) << true << true;
-#endif
QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ReadUser) << true << false;
QTest::newRow("resource2") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::WriteUser) << false << false;
QTest::newRow("resource3") << ":/tst_qfileinfo/resources/file1.ext1" << uint(QFile::ExeUser) << false << false;
@@ -1244,7 +1228,7 @@ void tst_QFile::permissions()
QFile::remove(file);
}
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
if (qt_ntfs_permission_lookup)
QEXPECT_FAIL("readonly", "QTBUG-25630", Abort);
#endif
@@ -1369,15 +1353,9 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
-#ifdef Q_OS_WINCE
- // Need to reset permissions on Windows to be able to delete
- QVERIFY(QFile::setPermissions("file-copy-destination.txt",
- QFile::WriteOther));
-#else
// Need to reset permissions on Windows to be able to delete
QVERIFY(QFile::setPermissions("file-copy-destination.txt",
QFile::ReadOwner | QFile::WriteOwner));
-#endif
QVERIFY(QFile::remove("file-copy-destination.txt"));
// Fallback copy of open file.
@@ -1398,7 +1376,7 @@ void tst_QFile::copyFallback()
#endif
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
static QString getWorkingDirectoryForLink(const QString &linkFileName)
{
bool neededCoInit = false;
@@ -1437,6 +1415,7 @@ static QString getWorkingDirectoryForLink(const QString &linkFileName)
}
#endif
+#ifndef Q_OS_WINRT
void tst_QFile::link()
{
QFile::remove("myLink.lnk");
@@ -1457,7 +1436,7 @@ void tst_QFile::link()
QCOMPARE(QFile::symLinkTarget("myLink.lnk"), referenceTarget);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN)
QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath());
QCOMPARE(QDir::fromNativeSeparators(wd), QDir::cleanPath(info1.absolutePath()));
#endif
@@ -1511,6 +1490,7 @@ void tst_QFile::readBrokenLink()
QVERIFY(QFile::link("ole/..", "myLink2.lnk"));
QCOMPARE(QFileInfo("myLink2.lnk").symLinkTarget(), QDir::currentPath());
}
+#endif // Q_OS_WINRT
void tst_QFile::readTextFile_data()
{
@@ -1595,7 +1575,7 @@ void tst_QFile::writeTextFile()
QCOMPARE(file.readAll(), out);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void tst_QFile::largeUncFileSupport()
{
qint64 size = Q_INT64_C(8589934592);
@@ -1674,11 +1654,7 @@ void tst_QFile::bufferedRead()
file.write("abcdef");
file.close();
-#if defined(Q_OS_WINCE)
- FILE *stdFile = fopen((QCoreApplication::applicationDirPath() + "/stdfile.txt").toLatin1() , "r");
-#else
FILE *stdFile = fopen("stdfile.txt", "r");
-#endif
QVERIFY(stdFile);
char c;
QCOMPARE(int(fread(&c, 1, 1, stdFile)), 1);
@@ -1823,11 +1799,7 @@ void tst_QFile::FILEReadWrite()
f.close();
}
-#ifdef Q_OS_WINCE
- FILE *fp = fopen(qPrintable(QCoreApplication::applicationDirPath() + "\\FILEReadWrite.txt"), "r+b");
-#else
FILE *fp = fopen("FILEReadWrite.txt", "r+b");
-#endif
QVERIFY(fp);
QFile file;
QVERIFY2(file.open(fp, QFile::ReadWrite), msgOpenFailed(file).constData());
@@ -2032,10 +2004,6 @@ void tst_QFile::longFileName()
}
{
QFile file(fileName);
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort);
- QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort);
-#endif
QVERIFY2(file.open(QFile::WriteOnly | QFile::Text), msgOpenFailed(file).constData());
QTextStream ts(&file);
ts << fileName << endl;
@@ -2303,7 +2271,7 @@ void tst_QFile::writeLargeDataBlock_data()
QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd;
QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(QT_NO_NETWORK)
// Some semi-randomness to avoid collisions.
QTest::newRow("unc file")
<< QString("//" + QtNetworkSettings::winServerName() + "/TESTSHAREWRITABLE/largefile-%1-%2.txt")
@@ -2318,8 +2286,8 @@ static QByteArray getLargeDataBlock()
if (array.isNull())
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
- int resizeSize = 1024 * 1024; // WinCE does not have much space
+#if defined(Q_OS_VXWORKS)
+ int resizeSize = 1024 * 1024; // VxWorks does not have much space
#else
int resizeSize = 64 * 1024 * 1024;
#endif
@@ -2447,9 +2415,7 @@ void tst_QFile::virtualFile()
void tst_QFile::textFile()
{
-#if defined(Q_OS_WINCE)
- FILE *fs = ::fopen((QCoreApplication::applicationDirPath() + "/writeabletextfile").toLatin1() , "wt");
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
FILE *fs = ::fopen("writeabletextfile", "wt");
#else
FILE *fs = ::fopen("writeabletextfile", "w");
@@ -2662,7 +2628,7 @@ void tst_QFile::appendAndRead()
void tst_QFile::miscWithUncPathAsCurrentDir()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QString current = QDir::currentPath();
const QString path = QLatin1String("//") + QtNetworkSettings::winServerName()
+ QLatin1String("/testshare");
@@ -2686,7 +2652,6 @@ void tst_QFile::standarderror()
void tst_QFile::handle()
{
int fd;
-#if !defined(Q_OS_WINCE)
QFile file(m_testSourceFile);
QVERIFY2(file.open(QIODevice::ReadOnly), msgOpenFailed(file).constData());
fd = int(file.handle());
@@ -2714,7 +2679,6 @@ void tst_QFile::handle()
#endif
QCOMPARE(c, '*');
-#endif
//test round trip of adopted stdio file handle
QFile file2;
@@ -2957,10 +2921,6 @@ void tst_QFile::map()
QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile";
-#ifdef Q_OS_WINCE
- fileName = QFileInfo(fileName).absoluteFilePath();
-#endif
-
if (QFile::exists(fileName)) {
QVERIFY(QFile::setPermissions(fileName,
QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser));
@@ -3002,7 +2962,7 @@ void tst_QFile::map()
QCOMPARE(file.error(), QFile::NoError);
// hpux won't let you map multiple times.
-#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API)
// exotic test to make sure that multiple maps work
// note: windows ce does not reference count mutliple maps
@@ -3125,10 +3085,6 @@ void tst_QFile::mapOpenMode()
QVERIFY2(file.open(om), msgOpenFailed(om, file).constData());
uchar *memory = file.map(0, fileSize, QFileDevice::MemoryMapFlags(flags));
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL("ReadOnly + MapPrivate" , "Windows CE does not support MapPrivateOption.", Abort);
- QEXPECT_FAIL("ReadWrite + MapPrivate", "Windows CE does not support MapPrivateOption.", Abort);
-#endif
QVERIFY(memory);
QVERIFY(memcmp(memory, pattern, fileSize) == 0);
@@ -3161,10 +3117,6 @@ void tst_QFile::mapWrittenFile()
QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile";
-#ifdef Q_OS_WINCE
- fileName = QFileInfo(fileName).absoluteFilePath();
-#endif
-
if (QFile::exists(fileName)) {
QVERIFY(QFile::setPermissions(fileName,
QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser));
@@ -3263,10 +3215,6 @@ protected:
bool MessageHandler::ok = true;
QtMessageHandler MessageHandler::oldMessageHandler = 0;
- //allthough Windows CE (not mobile!) has functions that allow redirecting
- //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
- //it does not have functions to simply open them like below .
-#ifndef Q_OS_WINCE
void tst_QFile::openStandardStreamsFileDescriptors()
{
@@ -3326,7 +3274,6 @@ void tst_QFile::openStandardStreamsBufferedStreams()
QVERIFY(msgHandler.testPassed());
}
-#endif
void tst_QFile::writeNothing()
{
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 8d62a38e6b..b3527f5d27 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -49,13 +49,13 @@
#ifdef Q_OS_WIN
#include <qt_windows.h>
#include <qlibrary.h>
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
#include <lm.h>
#endif
#endif
#include <qplatformdefs.h>
#include <qdebug.h>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
#include "../../../network-settings.h"
#endif
#include <private/qfileinfo_p.h>
@@ -141,7 +141,7 @@ inline bool qIsLikelyToBeNfs(int /* handle */)
static QString seedAndTemplate()
{
- qsrand(QDateTime::currentDateTimeUtc().toTime_t());
+ qsrand(QDateTime::currentSecsSinceEpoch());
return QDir::tempPath() + "/tst_qfileinfo-XXXXXX";
}
@@ -256,7 +256,7 @@ private slots:
void refresh();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void ntfsJunctionPointsAndSymlinks_data();
void ntfsJunctionPointsAndSymlinks();
void brokenShortcut();
@@ -273,7 +273,7 @@ private slots:
void detachingOperations();
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
void owner();
#endif
void group();
@@ -354,17 +354,8 @@ void tst_QFileInfo::copy()
file.flush();
QTest::qWait(250);
-#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
- if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA ||
- QSysInfo::windowsVersion() & QSysInfo::WV_CE_based)
- file.close();
-#endif
-#if defined(Q_OS_WINCE)
- // On Windows CE we need to close the file.
- // Otherwise the content will be cached and not
- // flushed to the storage, although we flushed it
- // manually!!! CE has interim cache, we cannot influence.
- QTest::qWait(5000);
+#if defined(Q_OS_WIN)
+ file.close();
#endif
info3.refresh();
privateInfo3 = getPrivate(info3);
@@ -422,12 +413,12 @@ void tst_QFileInfo::isDir_data()
QTest::newRow("broken link") << "brokenlink.lnk" << false;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
QTest::newRow("drive 1") << "c:" << true;
QTest::newRow("drive 2") << "c:/" << true;
//QTest::newRow("drive 2") << "t:s" << false;
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
QTest::newRow("unc 1") << uncRoot << true;
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
@@ -464,13 +455,13 @@ void tst_QFileInfo::isRoot_data()
QTest::newRow("simple dir") << m_resourcesDir << false;
QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << false;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
QTest::newRow("drive 1") << "c:" << false;
QTest::newRow("drive 2") << "c:/" << true;
QTest::newRow("drive 3") << "p:/" << false;
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
QTest::newRow("unc 1") << uncRoot << true;
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
@@ -519,7 +510,7 @@ void tst_QFileInfo::exists_data()
QTest::newRow("simple dir") << m_resourcesDir << true;
QTest::newRow("simple dir with slash") << (m_resourcesDir + QLatin1Char('/')) << true;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
const QString uncRoot = QStringLiteral("//") + QtNetworkSettings::winServerName();
QTest::newRow("unc 1") << uncRoot << true;
QTest::newRow("unc 2") << uncRoot + QLatin1Char('/') << true;
@@ -554,7 +545,7 @@ void tst_QFileInfo::absolutePath_data()
QTest::addColumn<QString>("filename");
QString drivePrefix;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT))
+#if (defined(Q_OS_WIN) && !defined(Q_OS_WINRT))
drivePrefix = QDir::currentPath().left(2);
QString nonCurrentDrivePrefix =
drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:");
@@ -573,7 +564,7 @@ void tst_QFileInfo::absolutePath_data()
QTest::newRow("3") << "/usr/local/bin/" << drivePrefix + "/usr/local/bin" << "";
QTest::newRow("/test") << "/test" << drivePrefix + "/" << "test";
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/"
<< "autoexec.bat";
QTest::newRow("c:autoexec.bat") << QDir::currentPath().left(2) + "autoexec.bat" << QDir::currentPath()
@@ -606,7 +597,7 @@ void tst_QFileInfo::absFilePath_data()
QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt";
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt";
QString drivePrefix;
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if defined(Q_OS_WIN)
QString curr = QDir::currentPath();
curr.remove(0, 2); // Make it a absolute path with no drive specifier: \depot\qt-4.2\tests\auto\qfileinfo
@@ -774,7 +765,7 @@ void tst_QFileInfo::fileName_data()
QTest::newRow("relativeFile") << "tmp.txt" << "tmp.txt";
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << "tmp.txt";
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE))
+#if defined(Q_OS_WIN)
QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "tmp.txt";
QTest::newRow("driveWithNoSlash") << "c:tmp.txt" << "tmp.txt";
#else
@@ -1024,7 +1015,7 @@ void tst_QFileInfo::size()
void tst_QFileInfo::systemFiles()
{
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT)
QSKIP("This is a Windows only test");
#endif
QFileInfo fi("c:\\pagefile.sys");
@@ -1121,11 +1112,7 @@ void tst_QFileInfo::fileTimes_data()
void tst_QFileInfo::fileTimes()
{
-#if defined(Q_OS_WINCE)
- int sleepTime = 3000;
-#else
int sleepTime = 2000;
-#endif
QFETCH(QString, fileName);
if (QFile::exists(fileName)) {
QVERIFY(QFile::remove(fileName));
@@ -1133,10 +1120,6 @@ void tst_QFileInfo::fileTimes()
QTest::qSleep(sleepTime);
{
QFile file(fileName);
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL("longfile", "No long filenames on WinCE", Abort);
- QEXPECT_FAIL("longfile absolutepath", "No long filenames on WinCE", Abort);
-#endif
QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
if (qIsLikelyToBeNfs(file.handle()))
@@ -1162,7 +1145,7 @@ void tst_QFileInfo::fileTimes()
{
QFileInfo fileInfo(fileName);
// On unix created() returns the same as lastModified().
-#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_UNIX)
QVERIFY(fileInfo.created() < beforeWrite);
#endif
QVERIFY(fileInfo.lastModified() > beforeWrite);
@@ -1174,7 +1157,7 @@ void tst_QFileInfo::fileTimes()
}
QFileInfo fileInfo(fileName);
-#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_UNIX)
QVERIFY(fileInfo.created() < beforeWrite);
#endif
//In Vista the last-access timestamp is not updated when the file is accessed/touched (by default).
@@ -1193,9 +1176,7 @@ void tst_QFileInfo::fileTimes()
RegCloseKey(key);
}
#endif
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL("simple", "WinCE only stores date of access data, not the time", Continue);
-#elif defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue);
#elif defined(Q_OS_QNX)
QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue);
@@ -1211,8 +1192,8 @@ void tst_QFileInfo::fileTimes()
void tst_QFileInfo::fileTimes_oldFile()
{
- // This is not supported on WinCE or WinRT
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+ // This is not supported on WinRT
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// All files are opened in share mode (both read and write).
DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
@@ -1310,7 +1291,7 @@ void tst_QFileInfo::isHidden_data()
QTest::newRow(qPrintable("drive." + info.path())) << info.path() << false;
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory"));
QVERIFY(SetFileAttributesW(reinterpret_cast<LPCWSTR>(QString("./hidden-directory").utf16()),FILE_ATTRIBUTE_HIDDEN));
QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true;
@@ -1413,7 +1394,7 @@ void tst_QFileInfo::isNativePath()
void tst_QFileInfo::refresh()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
int sleepTime = 3000;
#else
int sleepTime = 2000;
@@ -1436,17 +1417,8 @@ void tst_QFileInfo::refresh()
QCOMPARE(info.lastModified(), lastModified);
QCOMPARE(info.size(), qint64(7));
-#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
- if (QSysInfo::windowsVersion() & QSysInfo::WV_VISTA ||
- QSysInfo::windowsVersion() & QSysInfo::WV_CE_based)
- file.close();
-#endif
-#if defined(Q_OS_WINCE)
- // On Windows CE we need to close the file.
- // Otherwise the content will be cached and not
- // flushed to the storage, although we flushed it
- // manually!!! CE has interim cache, we cannot influence.
- QTest::qWait(5000);
+#if defined(Q_OS_WIN)
+ file.close();
#endif
info.refresh();
QCOMPARE(info.size(), qint64(13));
@@ -1459,7 +1431,7 @@ void tst_QFileInfo::refresh()
QCOMPARE(info2.size(), info.size());
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
{
QTest::addColumn<QString>("path");
@@ -1633,11 +1605,7 @@ void tst_QFileInfo::isWritable()
tempfile.remove();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
-#ifdef Q_OS_WINCE
- QFileInfo fi("\\Windows\\wince.nls");
-#else
QFileInfo fi("c:\\pagefile.sys");
-#endif
QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData());
QVERIFY(!fi.isWritable());
#endif
@@ -1813,8 +1781,7 @@ void tst_QFileInfo::detachingOperations()
QVERIFY(!info1.caching());
}
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
-#if defined (Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
BOOL IsUserAdmin()
{
BOOL b;
@@ -1835,14 +1802,14 @@ BOOL IsUserAdmin()
return(b);
}
-#endif
-#if defined(Q_OS_WIN)
QT_BEGIN_NAMESPACE
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
QT_END_NAMESPACE
-#endif
+#endif // Q_OS_WIN && !Q_OS_WINRT
+
+#ifndef Q_OS_WINRT
void tst_QFileInfo::owner()
{
QString userName;
@@ -1904,7 +1871,7 @@ void tst_QFileInfo::owner()
qt_ntfs_permission_lookup = 0;
#endif
}
-#endif
+#endif // !Q_OS_WINRT
void tst_QFileInfo::group()
{
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index 187f72d095..fe2a1a562d 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -146,12 +146,7 @@ void tst_QFileSystemWatcher::basicTest()
// resolution of the modification time is system dependent, but it's at most 1 second when using
// the polling engine. I've heard rumors that FAT32 has a 2 second resolution. So, we have to
// wait a bit before we can modify the file (hrmph)...
-#ifndef Q_OS_WINCE
QTest::qWait(2000);
-#else
- // WinCE is always a little bit slower. Give it a little bit more time
- QTest::qWait(5000);
-#endif
testFile.open(QIODevice::WriteOnly | QIODevice::Append);
testFile.write(QByteArray("world"));
@@ -309,9 +304,6 @@ void tst_QFileSystemWatcher::watchDirectory()
QVERIFY(temporaryDir.rmdir(testDirName));
// waiting max 5 seconds for notification for directory removal to trigger
-#ifdef Q_OS_WINCE
- QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort);
-#endif
QTRY_COMPARE(changedSpy.count(), 2);
QCOMPARE(changedSpy.at(0).count(), 1);
QCOMPARE(changedSpy.at(1).count(), 1);
@@ -553,9 +545,6 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
QEXPECT_FAIL("", "See QTBUG-30943", Continue);
#endif
QCOMPARE(fileChangedSpyCount, 0);
-#ifdef Q_OS_WINCE
- QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort);
-#endif
QCOMPARE(dirChangedSpy.count(), 1);
dirChangedSpy.clear();
diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
index 30eaa5aab9..5cb532f76b 100644
--- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
@@ -100,9 +100,6 @@ void tst_QIODevice::getSetCheck()
//----------------------------------------------------------------------------------
void tst_QIODevice::constructing_QTcpSocket()
{
-#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
- QSKIP("Networking tests in a WinCE emulator are unstable");
-#endif
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
@@ -205,9 +202,6 @@ void tst_QIODevice::read_QByteArray()
//--------------------------------------------------------------------
void tst_QIODevice::unget()
{
-#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST)
- QSKIP("Networking tests in a WinCE emulator are unstable");
-#endif
#if defined(Q_OS_MAC)
QSKIP("The unget network test is unstable on Mac. See QTBUG-39983.");
#endif
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index 2e5cfb1053..b21701f341 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -34,7 +34,7 @@
#include <qsysinfo.h>
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
#include <unistd.h>
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
# include <qt_windows.h>
#endif
@@ -281,7 +281,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid()
{
#if defined(QT_NO_PROCESS)
QSKIP("This test requires QProcess support");
-#elif defined(Q_OS_WINRT) || defined(Q_OS_WINCE) || defined(Q_OS_IOS)
+#elif defined(Q_OS_WINRT) || defined(QT_PLATFORM_UIKIT)
QSKIP("We cannot retrieve information about other processes on this platform.");
#else
const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid";
@@ -455,7 +455,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(ProcessProperties)
static inline ProcessProperties processProperties()
{
ProcessProperties result;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
HANDLE processToken = NULL;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &processToken)) {
DWORD elevation; // struct containing a DWORD, not present in some MinGW headers.
@@ -484,7 +484,7 @@ void tst_QLockFile::noPermissionsWindows()
{
// Windows: Do the permissions test in a system directory in which
// files cannot be created.
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINRT)
QSKIP("This test is for desktop Windows only");
#endif
#ifdef Q_OS_WIN
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro
index 6eb72343bc..7b83d5dbe8 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.pro
@@ -4,4 +4,4 @@ TARGET = tst_qlockfile
SOURCES += tst_qlockfile.cpp
QT = core testlib concurrent
-win32:!wince:!winrt:LIBS += -ladvapi32
+win32:!winrt:LIBS += -ladvapi32
diff --git a/tests/auto/corelib/io/qprocess/qprocess.pri b/tests/auto/corelib/io/qprocess/qprocess.pri
index a43c823846..d5a7532ee1 100644
--- a/tests/auto/corelib/io/qprocess/qprocess.pri
+++ b/tests/auto/corelib/io/qprocess/qprocess.pri
@@ -10,13 +10,12 @@ SUBPROGRAMS = \
testProcessDeadWhileReading \
testProcessEOF \
testExitCodes \
+ testForwarding \
testGuiProcess \
testDetached \
fileWriterProcess \
testSetWorkingDirectory \
testSoftExit
-!contains(QMAKE_PLATFORM, wince): SUBPROGRAMS += testForwarding
-
!qtHaveModule(widgets): SUBPROGRAMS -= \
testGuiProcess
diff --git a/tests/auto/corelib/io/qprocess/qprocess.pro b/tests/auto/corelib/io/qprocess/qprocess.pro
index 6ba54b1e92..3867ac5741 100644
--- a/tests/auto/corelib/io/qprocess/qprocess.pro
+++ b/tests/auto/corelib/io/qprocess/qprocess.pro
@@ -8,7 +8,7 @@ SUBDIRS += testProcessSpacesArgs/nospace.pro \
testProcessSpacesArgs/twospaces.pro \
testSpaceInName
-win32:!wince* {
+win32 {
SUBDIRS += \
testProcessEchoGui \
testSetNamedPipeHandleState
diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
index 19f30de552..e18e48e516 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
@@ -31,9 +31,6 @@
int main()
{
-#if defined(_WIN32_WCE) && defined(_X86_)
- return 0;
-#else
int c;
while ((c = fgetc(stdin)) != -1) {
if (c == '\0')
@@ -42,5 +39,4 @@ int main()
fflush(stdout);
}
return 0;
-#endif
}
diff --git a/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
index 4de359d83f..9f13f5c00f 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
@@ -31,10 +31,6 @@
int main(int argc, char **argv)
{
-#if defined(_WIN32_WCE)
- // no environment in Windows CE
- return 0;
-#else
if (argc == 1)
return 1;
@@ -44,5 +40,4 @@ int main(int argc, char **argv)
return 0;
}
return 1;
-#endif
}
diff --git a/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp b/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
index 07409166f2..4934708153 100644
--- a/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
@@ -31,11 +31,7 @@
int main()
{
-#if defined(_WIN32_WCE)
- for (int i=0; i<240; i++) {
-#else //fprintf Output is very slow on Windows CE
for (int i=0; i<10240; i++) {
-#endif
fprintf(stdout, "%d -this is a number\n", i);
fflush(stderr);
}
diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
index 494d8147a7..0d40a9b83c 100644
--- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
@@ -31,21 +31,10 @@
int main(int argc, char ** argv)
{
-#if defined(WINCE) || defined(_WIN32_WCE)
- // No pipes on this "OS"
- FILE* file = fopen("\\temp\\qprocess_args_test.txt","w+");
- for (int i = 0; i < argc; ++i) {
- if (i)
- fprintf(file, "|");
- fprintf(file, argv[i]);
- }
- fclose(file);
-#else
for (int i = 0; i < argc; ++i) {
if (i)
printf("|");
printf("%s", argv[i]);
}
-#endif
return 0;
}
diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro
index d19a631cae..80e8bcad98 100644
--- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro
+++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro
@@ -1,6 +1,6 @@
win32 {
SOURCES = main_win.cpp
- !wince: LIBS += -luser32
+ LIBS += -luser32
}
unix {
SOURCES = main_unix.cpp
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 59f271d727..3f3533c9a1 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -64,7 +64,6 @@ private slots:
void startDetached();
void crashTest();
void crashTest2();
-#ifndef Q_OS_WINCE
void echoTest_data();
void echoTest();
void echoTest2();
@@ -110,7 +109,6 @@ private slots:
void discardUnwantedOutput();
void setWorkingDirectory();
void setNonExistentWorkingDirectory();
-#endif // not Q_OS_WINCE
void exitStatus_data();
void exitStatus();
@@ -154,11 +152,9 @@ protected slots:
void readFromProcess();
void exitLoopSlot();
void processApplicationEvents();
-#ifndef Q_OS_WINCE
void restartProcess();
void waitForReadyReadInAReadyReadSlotSlot();
void waitForBytesWrittenInABytesWrittenSlotSlot();
-#endif
private:
qint64 bytesAvailable;
@@ -406,8 +402,6 @@ void tst_QProcess::crashTest2()
QCOMPARE(process.exitStatus(), QProcess::CrashExit);
}
-#ifndef Q_OS_WINCE
-//Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::echoTest_data()
{
QTest::addColumn<QByteArray>("input");
@@ -462,7 +456,6 @@ void tst_QProcess::echoTest()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
void tst_QProcess::exitLoopSlot()
{
@@ -474,8 +467,6 @@ void tst_QProcess::processApplicationEvents()
QCoreApplication::processEvents();
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::echoTest2()
{
@@ -523,10 +514,8 @@ void tst_QProcess::echoTest2()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-// Reading and writing to a process is not supported on Qt/CE
+#if defined(Q_OS_WIN)
void tst_QProcess::echoTestGui()
{
QProcess process;
@@ -555,10 +544,9 @@ void tst_QProcess::testSetNamedPipeHandleState()
QCOMPARE(process.exitCode(), 0);
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
}
-#endif // !Q_OS_WINCE && Q_OS_WIN
+#endif // Q_OS_WIN
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-// Batch files are not supported on Windows CE
+#if defined(Q_OS_WIN)
void tst_QProcess::batFiles_data()
{
QTest::addColumn<QString>("batFile");
@@ -585,7 +573,7 @@ void tst_QProcess::batFiles()
QVERIFY(proc.readAll().startsWith(output));
}
-#endif // !Q_OS_WINCE && Q_OS_WIN
+#endif // Q_OS_WIN
void tst_QProcess::exitStatus_data()
{
@@ -627,8 +615,6 @@ void tst_QProcess::exitStatus()
}
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::loopBackTest()
{
@@ -649,10 +635,7 @@ void tst_QProcess::loopBackTest()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::readTimeoutAndThenCrash()
{
@@ -683,7 +666,6 @@ void tst_QProcess::readTimeoutAndThenCrash()
QCOMPARE(spy2.count(), 1);
QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy2.at(0).at(0).constData()), QProcess::Crashed);
}
-#endif
void tst_QProcess::waitForFinished()
{
@@ -694,9 +676,6 @@ void tst_QProcess::waitForFinished()
QVERIFY(process.waitForFinished());
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
-#if defined (Q_OS_WINCE)
- QEXPECT_FAIL("", "Reading and writing to a process is not supported on Qt/CE", Continue);
-#endif
QString output = process.readAll();
QCOMPARE(output.count("\n"), 10*1024);
@@ -705,8 +684,6 @@ void tst_QProcess::waitForFinished()
QCOMPARE(process.error(), QProcess::FailedToStart);
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::deadWhileReading()
{
QProcess process;
@@ -724,10 +701,7 @@ void tst_QProcess::deadWhileReading()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::restartProcessDeadlock()
{
@@ -757,10 +731,7 @@ void tst_QProcess::restartProcess()
QVERIFY(process);
process->start("testProcessEcho/testProcessEcho");
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::closeWriteChannel()
{
QByteArray testData("Data to read");
@@ -789,10 +760,7 @@ void tst_QProcess::closeWriteChannel()
QCOMPARE(more.exitStatus(), QProcess::NormalExit);
QCOMPARE(more.exitCode(), 0);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE"
void tst_QProcess::closeReadChannel()
{
for (int i = 0; i < 10; ++i) {
@@ -822,10 +790,7 @@ void tst_QProcess::closeReadChannel()
QCOMPARE(proc.exitCode(), 0);
}
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::openModes()
{
QProcess proc;
@@ -866,10 +831,7 @@ void tst_QProcess::openModes()
QVERIFY(!proc.isWritable());
QCOMPARE(proc.state(), QProcess::NotRunning);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
{
@@ -903,17 +865,12 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
QCOMPARE(proc.exitCode(), 0);
}
-#endif
void tst_QProcess::hardExit()
{
QProcess proc;
-#if defined(Q_OS_WINCE)
- proc.start("testSoftExit/testSoftExit");
-#else
proc.start("testProcessEcho/testProcessEcho");
-#endif
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
@@ -940,9 +897,7 @@ void tst_QProcess::softExit()
proc.start("testSoftExit/testSoftExit");
QVERIFY(proc.waitForStarted(10000));
-#if !defined(Q_OS_WINCE)
QVERIFY(proc.waitForReadyRead(10000));
-#endif
QVERIFY(proc.processId() > 0);
@@ -953,8 +908,6 @@ void tst_QProcess::softExit()
QCOMPARE(int(proc.error()), int(QProcess::UnknownError));
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
class SoftExitProcess : public QProcess
{
Q_OBJECT
@@ -1076,10 +1029,7 @@ void tst_QProcess::softExitInSlots()
QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000);
QCOMPARE(proc.state(), QProcess::NotRunning);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::mergedChannels()
{
QProcess process;
@@ -1102,10 +1052,6 @@ void tst_QProcess::mergedChannels()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
-
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::forwardedChannels_data()
{
@@ -1158,10 +1104,7 @@ void tst_QProcess::forwardedChannels()
QCOMPARE(process.readAllStandardOutput(), outdata);
QCOMPARE(process.readAllStandardError(), errdata);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::atEnd()
{
QProcess process;
@@ -1183,7 +1126,6 @@ void tst_QProcess::atEnd()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
class TestThread : public QThread
{
@@ -1205,9 +1147,7 @@ protected:
process.start("testProcessEcho/testProcessEcho");
-#if !defined(Q_OS_WINCE)
QCOMPARE(process.write("abc\0", 4), qint64(4));
-#endif
exitCode = exec();
}
@@ -1256,8 +1196,6 @@ void tst_QProcess::processesInMultipleThreads()
}
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForFinishedWithTimeout()
{
QProcess process;
@@ -1271,10 +1209,7 @@ void tst_QProcess::waitForFinishedWithTimeout()
QVERIFY(process.waitForFinished());
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForReadyReadInAReadyReadSlot()
{
QProcess process;
@@ -1300,10 +1235,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
QCOMPARE(process.exitCode(), 0);
QVERIFY(process.bytesAvailable() > bytesAvailable);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
{
QProcess *process = qobject_cast<QProcess *>(sender());
@@ -1313,10 +1245,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot()
QVERIFY(process->waitForReadyRead(5000));
QTestEventLoop::instance().exitLoop();
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
{
QProcess process;
@@ -1339,10 +1268,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
{
QProcess *process = qobject_cast<QProcess *>(sender());
@@ -1351,7 +1277,6 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot()
QVERIFY(process->waitForBytesWritten(5000));
QTestEventLoop::instance().exitLoop();
}
-#endif
void tst_QProcess::spaceArgsTest_data()
{
@@ -1430,14 +1355,12 @@ void tst_QProcess::spaceArgsTest()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
-#if !defined(Q_OS_WINCE)
QStringList actual = QString::fromLatin1(process.readAll()).split("|");
QVERIFY(!actual.isEmpty());
// not interested in the program name, it might be different.
actual.removeFirst();
QCOMPARE(actual, args);
-#endif
if (program.contains(QLatin1Char(' ')))
program = QLatin1Char('"') + program + QLatin1Char('"');
@@ -1454,14 +1377,12 @@ void tst_QProcess::spaceArgsTest()
QVERIFY2(started, errorMessage.constData());
QVERIFY(process.waitForFinished(5000));
-#if !defined(Q_OS_WINCE)
actual = QString::fromLatin1(process.readAll()).split("|");
QVERIFY(!actual.isEmpty());
// not interested in the program name, it might be different.
actual.removeFirst();
QCOMPARE(actual, args);
-#endif
}
}
@@ -1482,26 +1403,12 @@ void tst_QProcess::nativeArguments()
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
QCOMPARE(proc.exitCode(), 0);
-#if defined(Q_OS_WINCE)
- // WinCE test outputs to a file, so check that
- FILE* file = fopen("\\temp\\qprocess_args_test.txt","r");
- QVERIFY(file);
- char buf[256];
- fgets(buf, 256, file);
- fclose(file);
- QStringList actual = QString::fromLatin1(buf).split(QLatin1Char('|'));
-#else
QStringList actual = QString::fromLatin1(proc.readAll()).split(QLatin1Char('|'));
-#endif
QVERIFY(!actual.isEmpty());
// not interested in the program name, it might be different.
actual.removeFirst();
QStringList expected;
-#if defined(Q_OS_WINCE)
- expected << "hello" << "kitty," << "\"*\"!"; // Weird, weird ...
-#else
expected << "hello" << "kitty," << "*!";
-#endif
QCOMPARE(actual, expected);
}
@@ -1706,8 +1613,6 @@ void tst_QProcess::failToStartEmptyArgs()
QCOMPARE(process.error(), QProcess::FailedToStart);
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::removeFileWhileProcessIsRunning()
{
QFile file(m_temporaryDir.path() + QLatin1String("/removeFile.txt"));
@@ -1725,9 +1630,7 @@ void tst_QProcess::removeFileWhileProcessIsRunning()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
-#ifndef Q_OS_WINCE
-// OS doesn't support environment variables
+
void tst_QProcess::setEnvironment_data()
{
QTest::addColumn<QString>("name");
@@ -1802,9 +1705,7 @@ void tst_QProcess::setEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
}
-#endif
-#ifndef Q_OS_WINCE
-// OS doesn't support environment variables
+
void tst_QProcess::setProcessEnvironment_data()
{
setEnvironment_data();
@@ -1842,25 +1743,16 @@ void tst_QProcess::setProcessEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
}
-#endif
void tst_QProcess::systemEnvironment()
{
-#if defined (Q_OS_WINCE)
- // there is no concept of system variables on Windows CE as there is no console
- QVERIFY(QProcess::systemEnvironment().isEmpty());
- QVERIFY(QProcessEnvironment::systemEnvironment().isEmpty());
-#else
QVERIFY(!QProcess::systemEnvironment().isEmpty());
QVERIFY(!QProcessEnvironment::systemEnvironment().isEmpty());
QVERIFY(QProcessEnvironment::systemEnvironment().contains("PATH"));
QVERIFY(!QProcess::systemEnvironment().filter(QRegExp("^PATH=", Qt::CaseInsensitive)).isEmpty());
-#endif
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::spaceInName()
{
QProcess process;
@@ -1871,7 +1763,6 @@ void tst_QProcess::spaceInName()
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
QCOMPARE(process.exitCode(), 0);
}
-#endif
void tst_QProcess::lockupsInStartDetached()
{
@@ -1886,8 +1777,6 @@ void tst_QProcess::lockupsInStartDetached()
QProcess::startDetached("yjhbrty");
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::atEnd2()
{
QProcess process;
@@ -1902,7 +1791,6 @@ void tst_QProcess::atEnd2()
}
QCOMPARE(lines.size(), 7);
}
-#endif
void tst_QProcess::waitForReadyReadForNonexistantProcess()
{
@@ -1932,8 +1820,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QCOMPARE(finishedSpy2.count(), 0);
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::setStandardInputFile()
{
static const char data[] = "A bunch\1of\2data\3\4\5\6\7...";
@@ -1961,10 +1847,7 @@ void tst_QProcess::setStandardInputFile()
all = process2.readAll();
QCOMPARE(all.size(), 0);
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::setStandardOutputFile_data()
{
QTest::addColumn<int>("channelToTest");
@@ -2082,10 +1965,7 @@ void tst_QProcess::setStandardOutputFileAndWaitForBytesWritten()
QCOMPARE(all, QByteArray::fromRawData(testdata, sizeof testdata - 1));
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::setStandardOutputProcess_data()
{
QTest::addColumn<bool>("merged");
@@ -2126,10 +2006,7 @@ void tst_QProcess::setStandardOutputProcess()
else
QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd"));
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::fileWriterProcess()
{
const QByteArray line = QByteArrayLiteral(" -- testing testing 1 2 3\n");
@@ -2163,16 +2040,11 @@ void tst_QProcess::fileWriterProcess()
QCOMPARE(QFile(fileName).size(), qint64(stdinStr.size()));
} while (stopWatch.elapsed() < 3000);
}
-#endif
void tst_QProcess::detachedWorkingDirectoryAndPid()
{
qint64 pid;
-#ifdef Q_OS_WINCE
- QTest::qSleep(1000);
-#endif
-
QFile infoFile(m_temporaryDir.path() + QLatin1String("/detachedinfo.txt"));
if (infoFile.exists())
QVERIFY(infoFile.remove());
@@ -2209,8 +2081,6 @@ void tst_QProcess::detachedWorkingDirectoryAndPid()
QCOMPARE(actualPid, pid);
}
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::switchReadChannels()
{
const char data[] = "ABCD";
@@ -2239,10 +2109,7 @@ void tst_QProcess::switchReadChannels()
process.setReadChannel(QProcess::StandardOutput);
QCOMPARE(process.read(1), QByteArray("D"));
}
-#endif
-#ifndef Q_OS_WINCE
-// Reading and writing to a process is not supported on Qt/CE
void tst_QProcess::discardUnwantedOutput()
{
QProcess process;
@@ -2260,11 +2127,8 @@ void tst_QProcess::discardUnwantedOutput()
process.setReadChannel(QProcess::StandardError);
QCOMPARE(process.bytesAvailable(), Q_INT64_C(0));
}
-#endif
-#ifndef Q_OS_WINCE
// Q_OS_WIN - setWorkingDirectory will chdir before starting the process on unices
-// Windows CE does not support working directory logic
void tst_QProcess::setWorkingDirectory()
{
QProcess process;
@@ -2300,7 +2164,6 @@ void tst_QProcess::setNonExistentWorkingDirectory()
QVERIFY2(process.errorString().startsWith("chdir:"), process.errorString().toLocal8Bit());
#endif
}
-#endif
void tst_QProcess::startFinishStartFinish()
{
@@ -2310,11 +2173,9 @@ void tst_QProcess::startFinishStartFinish()
QCOMPARE(process.state(), QProcess::NotRunning);
process.start("testProcessOutput/testProcessOutput");
-#if !defined(Q_OS_WINCE)
QVERIFY(process.waitForReadyRead(10000));
QCOMPARE(QString::fromLatin1(process.readLine().trimmed()),
QString("0 -this is a number"));
-#endif
if (process.state() != QProcess::NotRunning) {
QVERIFY(process.waitForFinished(10000));
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
index a4a5d5b0c7..af5078a3dc 100644
--- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -44,9 +44,7 @@ private slots:
void caseSensitivity();
void systemEnvironment();
-#ifndef Q_OS_WINCE
void putenv();
-#endif
};
void tst_QProcessEnvironment::operator_eq()
@@ -257,12 +255,6 @@ void tst_QProcessEnvironment::systemEnvironment()
QVERIFY(nonexistant.isNull());
-#ifdef Q_OS_WINCE
- // Windows CE has no environment
- QVERIFY(path.isEmpty());
- QVERIFY(!system.contains("PATH"));
- QVERIFY(system.isEmpty());
-#else
// all other system have environments
if (path.isEmpty())
QFAIL("Could not find the PATH environment variable -- please correct the test environment");
@@ -272,18 +264,15 @@ void tst_QProcessEnvironment::systemEnvironment()
QVERIFY(!system.contains(envname));
-# ifdef Q_OS_WIN
+#ifdef Q_OS_WIN
// check case-insensitive too
QVERIFY(system.contains("path"));
QCOMPARE(system.value("path"), QString::fromLocal8Bit(path));
QVERIFY(!system.contains(QString(envname).toLower()));
-# endif
#endif
}
-#ifndef Q_OS_WINCE
-//Windows CE has no environment
void tst_QProcessEnvironment::putenv()
{
static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE";
@@ -317,7 +306,6 @@ void tst_QProcessEnvironment::putenv()
QCOMPARE(eAfter.value(lower), QString("Hello, World"));
# endif
}
-#endif
QTEST_MAIN(tst_QProcessEnvironment)
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 87a801c9dd..2f039cbcd8 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -1521,7 +1521,7 @@ void tst_QSettings::sync()
// Now "some other app" will change other.software.org.ini
QString userConfDir = settingsPath("__user__") + QDir::separator();
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
unlink((userConfDir + "other.software.org.ini").toLatin1());
rename((userConfDir + "software.org.ini").toLatin1(),
(userConfDir + "other.software.org.ini").toLatin1());
@@ -2856,27 +2856,19 @@ void tst_QSettings::isWritable()
if (s1.contains("foo")) {
#if defined(Q_OS_MACX)
- if (QSysInfo::macVersion() >= QSysInfo::MV_10_9) {
- QVERIFY(s1.isWritable());
- if (format == QSettings::NativeFormat) {
- QVERIFY(!s2.isWritable());
- QVERIFY(!s3.isWritable());
- } else {
- QVERIFY(s2.isWritable());
- QVERIFY(s3.isWritable());
- }
- } else if (QSysInfo::macVersion() >= QSysInfo::MV_10_7 &&
- format == QSettings::NativeFormat) {
- QVERIFY(!s1.isWritable());
+ QVERIFY(s1.isWritable());
+ if (format == QSettings::NativeFormat) {
QVERIFY(!s2.isWritable());
QVERIFY(!s3.isWritable());
- } else
-#endif
- {
- QVERIFY(s1.isWritable());
+ } else {
QVERIFY(s2.isWritable());
QVERIFY(s3.isWritable());
}
+#else
+ QVERIFY(s1.isWritable());
+ QVERIFY(s2.isWritable());
+ QVERIFY(s3.isWritable());
+#endif
} else {
QVERIFY(!s1.isWritable());
QVERIFY(!s2.isWritable());
diff --git a/tests/auto/corelib/io/qstorageinfo/BLACKLIST b/tests/auto/corelib/io/qstorageinfo/BLACKLIST
new file mode 100644
index 0000000000..ab4f888dd9
--- /dev/null
+++ b/tests/auto/corelib/io/qstorageinfo/BLACKLIST
@@ -0,0 +1,2 @@
+[storageList]
+opensuse-42.1
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 0e73ea7862..487c13be94 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -307,7 +307,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir()
void tst_QTemporaryDir::openOnRootDrives()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
// If it's possible to create a file in the root directory, it
@@ -321,7 +321,7 @@ void tst_QTemporaryDir::openOnRootDrives()
QVERIFY(dir.isValid());
}
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
SetErrorMode(lastErrorMode);
#endif
}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index 8ebde627df..59cd3a8411 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -415,9 +415,7 @@ void tst_QTemporaryFile::size()
// On CE it takes more time for the filesystem to update
// the information. Usually you have to close it or seek
// to get latest information. flush() does not help either.
-#if !defined(Q_OS_WINCE)
QCOMPARE(file.size(), qint64(6));
-#endif
file.seek(0);
QCOMPARE(file.size(), qint64(6));
}
@@ -436,7 +434,7 @@ void tst_QTemporaryFile::resize()
void tst_QTemporaryFile::openOnRootDrives()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
unsigned int lastErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
// If it's possible to create a file in the root directory, it
@@ -450,19 +448,14 @@ void tst_QTemporaryFile::openOnRootDrives()
QVERIFY(file.open());
}
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
SetErrorMode(lastErrorMode);
#endif
}
void tst_QTemporaryFile::stressTest()
{
-#if defined(Q_OS_WINCE)
- // 200 is still ok, first colision happens after ~30
- const int iterations = 200;
-#else
const int iterations = 1000;
-#endif
QSet<QString> names;
for (int i = 0; i < iterations; ++i) {
diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
index 104873b85e..9533989b9d 100644
--- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
@@ -175,20 +175,16 @@ private slots:
void octTest();
void zeroTermination();
void ws_manipulator();
-#ifndef Q_OS_WINCE
void stillOpenWhenAtEnd();
-#endif
void readNewlines_data();
void readNewlines();
void seek();
void pos();
void pos2();
void pos3LargeFile();
-#if !defined(Q_OS_WINCE)
void readStdin();
void readAllFromStdin();
void readLineFromStdin();
-#endif
void read();
void qbool();
void forcePoint();
@@ -1207,8 +1203,6 @@ void tst_QTextStream::ws_manipulator()
}
// ------------------------------------------------------------------------------
-#ifndef Q_OS_WINCE
-// Qt/CE: Cannot test network on emulator
void tst_QTextStream::stillOpenWhenAtEnd()
{
QFile file(QFINDTESTDATA("tst_qtextstream.cpp"));
@@ -1229,7 +1223,6 @@ void tst_QTextStream::stillOpenWhenAtEnd()
while (!stream2.readLine().isNull()) {}
QVERIFY(socket.isOpen());
}
-#endif
// ------------------------------------------------------------------------------
void tst_QTextStream::readNewlines_data()
@@ -1498,8 +1491,6 @@ void tst_QTextStream::pos3LargeFile()
}
// ------------------------------------------------------------------------------
-// Qt/CE has no stdin/out support for processes
-#if !defined(Q_OS_WINCE)
void tst_QTextStream::readStdin()
{
#ifdef QT_NO_PROCESS
@@ -1527,7 +1518,6 @@ void tst_QTextStream::readStdin()
}
// ------------------------------------------------------------------------------
-// Qt/CE has no stdin/out support for processes
void tst_QTextStream::readAllFromStdin()
{
#ifdef QT_NO_PROCESS
@@ -1549,7 +1539,6 @@ void tst_QTextStream::readAllFromStdin()
}
// ------------------------------------------------------------------------------
-// Qt/CE has no stdin/out support for processes
void tst_QTextStream::readLineFromStdin()
{
#ifdef QT_NO_PROCESS
@@ -1572,7 +1561,6 @@ void tst_QTextStream::readLineFromStdin()
QVERIFY(stdinProcess.waitForFinished(5000));
#endif
}
-#endif
// ------------------------------------------------------------------------------
void tst_QTextStream::read()
@@ -2799,12 +2787,7 @@ void tst_QTextStream::status_real_read()
void tst_QTextStream::status_integer_read()
{
-#ifdef Q_OS_WINCE
- QString text = QLatin1String("123 abc ");
- QTextStream s(&text);
-#else
QTextStream s("123 abc ");
-#endif
int i;
QString w;
s >> i;
@@ -2822,12 +2805,7 @@ void tst_QTextStream::status_integer_read()
void tst_QTextStream::status_word_read()
{
-#ifdef Q_OS_WINCE
- QString text = QLatin1String("abc ");
- QTextStream s(&text);
-#else
QTextStream s("abc ");
-#endif
QString w;
s >> w;
QCOMPARE(s.status(), QTextStream::Ok);
diff --git a/tests/auto/corelib/io/qurlinternal/qurlinternal.pro b/tests/auto/corelib/io/qurlinternal/qurlinternal.pro
index ae5e023446..3828512dce 100644
--- a/tests/auto/corelib/io/qurlinternal/qurlinternal.pro
+++ b/tests/auto/corelib/io/qurlinternal/qurlinternal.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
TARGET = tst_qurlinternal
SOURCES += tst_qurlinternal.cpp ../../codecs/utf8/utf8data.cpp
QT = core core-private testlib
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
index 4b3f76a78e..6ea7a38137 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
@@ -239,18 +239,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
// Basic tree StandardItemModel
QModelIndex parent;
QVariant blue = QVariant(QColor(Qt::blue));
-#ifndef Q_OS_WINCE
for (int i = 0; i < 4; ++i) {
-#else
- for (int i = 0; i < 2; ++i) {
-#endif
parent = model->index(0, 0, parent);
model->insertRows(0, 26 + i, parent);
-#ifndef Q_OS_WINCE
- model->insertColumns(0, 26 + i, parent);
-#else
model->insertColumns(0, 4 + i, parent);
-#endif
// Fill in some values to make it easier to debug
/*
for (int x = 0; x < 26 + i; ++x) {
@@ -272,18 +264,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
// Basic tree StandardItemModel
QModelIndex parent;
QVariant blue = QVariant(QColor(Qt::blue));
-#ifndef Q_OS_WINCE
for (int i = 0; i < 4; ++i) {
-#else
- for (int i = 0; i < 2; ++i) {
-#endif
parent = realModel->index(0, 0, parent);
realModel->insertRows(0, 26+i, parent);
-#ifndef Q_OS_WINCE
- realModel->insertColumns(0, 26+i, parent);
-#else
realModel->insertColumns(0, 4, parent);
-#endif
// Fill in some values to make it easier to debug
/*
for (int x = 0; x < 26+i; ++x) {
@@ -324,11 +308,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
QSqlQuery q;
q.exec("CREATE TABLE test(id int primary key, name varchar(30))");
q.prepare("INSERT INTO test(id, name) values (?, ?)");
-#ifndef Q_OS_WINCE
for (int i = 0; i < 1024; ++i) {
-#else
- for (int i = 0; i < 512; ++i) {
-#endif
q.addBindValue(i);
q.addBindValue("Mr. Smith" + QString::number(i));
q.exec();
@@ -344,11 +324,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
}
if (QListWidget *listWidget = qobject_cast<QListWidget *>(model->parent())) {
-#ifndef Q_OS_WINCE
- int items = 100;
-#else
int items = 50;
-#endif
while (items--)
listWidget->addItem(QLatin1String("item ") + QString::number(items));
return QModelIndex();
diff --git a/tests/auto/corelib/json/json.pro b/tests/auto/corelib/json/json.pro
index b3038d7ca1..16c2ae2fb7 100644
--- a/tests/auto/corelib/json/json.pro
+++ b/tests/auto/corelib/json/json.pro
@@ -1,12 +1,12 @@
TARGET = tst_json
-QT = core testlib
+QT = core-private testlib
CONFIG -= app_bundle
CONFIG += testcase
!android:TESTDATA += bom.json test.json test.bjson test3.json test2.json
else:RESOURCES += json.qrc
-!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) {
+!qtConfig(doubleconversion):!qtConfig(system-doubleconversion) {
DEFINES += QT_NO_DOUBLECONVERSION
}
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 5878d56a47..1194260efa 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -137,6 +137,8 @@ private Q_SLOTS:
void garbageAtEnd();
void removeNonLatinKey();
+ void documentFromVariant();
+
private:
QString testDataDir;
};
@@ -1184,14 +1186,14 @@ void tst_QtJson::toVariantMap()
QCOMPARE(map.size(), 3);
QCOMPARE(map.value("Key"), QVariant(QString("Value")));
- QCOMPARE(map.value("null"), QVariant());
+ QCOMPARE(map.value("null"), QVariant::fromValue(nullptr));
QCOMPARE(map.value("Array").type(), QVariant::List);
QVariantList list = map.value("Array").toList();
QCOMPARE(list.size(), 4);
QCOMPARE(list.at(0), QVariant(true));
QCOMPARE(list.at(1), QVariant(999.));
QCOMPARE(list.at(2), QVariant(QLatin1String("string")));
- QCOMPARE(list.at(3), QVariant());
+ QCOMPARE(list.at(3), QVariant::fromValue(nullptr));
}
void tst_QtJson::toVariantHash()
@@ -1213,14 +1215,14 @@ void tst_QtJson::toVariantHash()
QCOMPARE(hash.size(), 3);
QCOMPARE(hash.value("Key"), QVariant(QString("Value")));
- QCOMPARE(hash.value("null"), QVariant());
+ QCOMPARE(hash.value("null"), QVariant::fromValue(nullptr));
QCOMPARE(hash.value("Array").type(), QVariant::List);
QVariantList list = hash.value("Array").toList();
QCOMPARE(list.size(), 4);
QCOMPARE(list.at(0), QVariant(true));
QCOMPARE(list.at(1), QVariant(999.));
QCOMPARE(list.at(2), QVariant(QLatin1String("string")));
- QCOMPARE(list.at(3), QVariant());
+ QCOMPARE(list.at(3), QVariant::fromValue(nullptr));
}
void tst_QtJson::toVariantList()
@@ -1244,14 +1246,14 @@ void tst_QtJson::toVariantList()
QCOMPARE(list.size(), 3);
QCOMPARE(list[0], QVariant(QString("Value")));
- QCOMPARE(list[1], QVariant());
+ QCOMPARE(list[1], QVariant::fromValue(nullptr));
QCOMPARE(list[2].type(), QVariant::List);
QVariantList vlist = list[2].toList();
QCOMPARE(vlist.size(), 4);
QCOMPARE(vlist.at(0), QVariant(true));
QCOMPARE(vlist.at(1), QVariant(999.));
QCOMPARE(vlist.at(2), QVariant(QLatin1String("string")));
- QCOMPARE(vlist.at(3), QVariant());
+ QCOMPARE(vlist.at(3), QVariant::fromValue(nullptr));
}
void tst_QtJson::toJson()
@@ -2749,8 +2751,9 @@ void tst_QtJson::unicodeKeys()
QCOMPARE(error.error, QJsonParseError::NoError);
QJsonObject o = doc.object();
- QCOMPARE(o.keys().size(), 5);
- Q_FOREACH (const QString &key, o.keys()) {
+ const auto keys = o.keys();
+ QCOMPARE(keys.size(), 5);
+ for (const QString &key : keys) {
QString suffix = key.mid(key.indexOf(QLatin1Char('_')));
QCOMPARE(o[key].toString(), QString("hello") + suffix);
}
@@ -2788,5 +2791,43 @@ void tst_QtJson::removeNonLatinKey()
QVERIFY(restoredObject.contains(nonLatinKeyName));
}
+void tst_QtJson::documentFromVariant()
+{
+ // Test the valid forms of QJsonDocument::fromVariant.
+
+ QString string = QStringLiteral("value");
+
+ QStringList strList;
+ strList.append(string);
+
+ QJsonDocument da1 = QJsonDocument::fromVariant(QVariant(strList));
+ QVERIFY(da1.isArray());
+
+ QVariantList list;
+ list.append(string);
+
+ QJsonDocument da2 = QJsonDocument::fromVariant(list);
+ QVERIFY(da2.isArray());
+
+ // As JSON arrays they should be equal.
+ QCOMPARE(da1.array(), da2.array());
+
+
+ QMap <QString, QVariant> map;
+ map["key"] = string;
+
+ QJsonDocument do1 = QJsonDocument::fromVariant(QVariant(map));
+ QVERIFY(do1.isObject());
+
+ QHash <QString, QVariant> hash;
+ hash["key"] = string;
+
+ QJsonDocument do2 = QJsonDocument::fromVariant(QVariant(hash));
+ QVERIFY(do2.isObject());
+
+ // As JSON objects they should be equal.
+ QCOMPARE(do1.object(), do2.object());
+}
+
QTEST_MAIN(tst_QtJson)
#include "tst_qtjson.moc"
diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro
index f85c39e9e6..75b98bcd09 100644
--- a/tests/auto/corelib/kernel/kernel.pro
+++ b/tests/auto/corelib/kernel/kernel.pro
@@ -1,6 +1,8 @@
TEMPLATE=subdirs
SUBDIRS=\
qcoreapplication \
+ qdeadlinetimer \
+ qelapsedtimer \
qeventdispatcher \
qeventloop \
qmath \
@@ -31,11 +33,11 @@ SUBDIRS=\
qobject \
qsocketnotifier
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qsocketnotifier \
qsharedmemory
# This test is only applicable on Windows
!win32*|winrt: SUBDIRS -= qwineventnotifier
-android|ios: SUBDIRS -= qsharedmemory qsystemsemaphore
+android|uikit: SUBDIRS -= qclipboard qobject qsharedmemory qsystemsemaphore
diff --git a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
index a49bb9ae1f..d166351490 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
+++ b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
@@ -3,4 +3,4 @@ TARGET = tst_qcoreapplication
QT = core testlib core-private
SOURCES = tst_qcoreapplication.cpp
HEADERS = tst_qcoreapplication.h
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index a8de5b7a9a..0691297497 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -155,7 +155,7 @@ void tst_QCoreApplication::qAppName()
void tst_QCoreApplication::argc()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
QSKIP("QCoreApplication::arguments() parses arguments from actual command line on this platform.");
#endif
{
diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro b/tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro
new file mode 100644
index 0000000000..12ad7dabc2
--- /dev/null
+++ b/tests/auto/corelib/kernel/qdeadlinetimer/qdeadlinetimer.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+TARGET = tst_qdeadlinetimer
+QT = core testlib
+SOURCES = tst_qdeadlinetimer.cpp
+
diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp
new file mode 100644
index 0000000000..7642604cfe
--- /dev/null
+++ b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp
@@ -0,0 +1,625 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QString>
+#include <QtCore/QTime>
+#include <QtCore/QDeadlineTimer>
+#include <QtTest/QtTest>
+
+#if QT_HAS_INCLUDE(<chrono>)
+# include <chrono>
+#endif
+
+static const int minResolution = 100; // the minimum resolution for the tests
+
+Q_DECLARE_METATYPE(Qt::TimerType)
+
+class tst_QDeadlineTimer : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase_data();
+ void basics();
+ void foreverness();
+ void current();
+ void deadlines();
+ void setDeadline();
+ void expire();
+ void stdchrono();
+};
+
+void tst_QDeadlineTimer::initTestCase_data()
+{
+ qRegisterMetaType<Qt::TimerType>();
+ QTest::addColumn<Qt::TimerType>("timerType");
+ QTest::newRow("precise") << Qt::PreciseTimer;
+ QTest::newRow("coarse") << Qt::CoarseTimer;
+}
+
+void tst_QDeadlineTimer::basics()
+{
+ QDeadlineTimer deadline;
+ QCOMPARE(deadline.timerType(), Qt::CoarseTimer);
+
+ QFETCH_GLOBAL(Qt::TimerType, timerType);
+ deadline = QDeadlineTimer(timerType);
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline, QDeadlineTimer(timerType));
+ QVERIFY(!(deadline != QDeadlineTimer(timerType)));
+ QVERIFY(!(deadline < QDeadlineTimer()));
+ QVERIFY(deadline <= QDeadlineTimer());
+ QVERIFY(deadline >= QDeadlineTimer());
+ QVERIFY(!(deadline > QDeadlineTimer()));
+ QVERIFY(!(deadline < deadline));
+ QVERIFY(deadline <= deadline);
+ QVERIFY(deadline >= deadline);
+ QVERIFY(!(deadline > deadline));
+
+ // should have expired, but we may be running too early after boot
+ QTRY_VERIFY_WITH_TIMEOUT(deadline.hasExpired(), 100);
+
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QCOMPARE(deadline.deadline(), qint64(0));
+ QCOMPARE(deadline.deadlineNSecs(), qint64(0));
+
+ deadline.setRemainingTime(0, timerType);
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+
+ deadline.setPreciseRemainingTime(0, 0, timerType);
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+
+ deadline.setDeadline(0, timerType);
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QCOMPARE(deadline.deadline(), qint64(0));
+ QCOMPARE(deadline.deadlineNSecs(), qint64(0));
+
+ deadline.setPreciseDeadline(0, 0, timerType);
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QCOMPARE(deadline.deadline(), qint64(0));
+ QCOMPARE(deadline.deadlineNSecs(), qint64(0));
+}
+
+void tst_QDeadlineTimer::foreverness()
+{
+ QFETCH_GLOBAL(Qt::TimerType, timerType);
+ // we don't check whether timerType() is our type since it's possible it detects it's forever
+
+ QDeadlineTimer deadline = QDeadlineTimer::Forever;
+ QCOMPARE(deadline.timerType(), Qt::CoarseTimer);
+ QVERIFY(deadline.isForever());
+ QVERIFY(!deadline.hasExpired());
+ QCOMPARE(deadline.remainingTime(), qint64(-1));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits<qint64>::max());
+
+ deadline = QDeadlineTimer(-1, timerType);
+ QVERIFY(deadline.isForever());
+ QVERIFY(!deadline.hasExpired());
+ QCOMPARE(deadline.remainingTime(), qint64(-1));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits<qint64>::max());
+
+ deadline.setRemainingTime(-1, timerType);
+ QVERIFY(deadline.isForever());
+ QVERIFY(!deadline.hasExpired());
+ QCOMPARE(deadline.remainingTime(), qint64(-1));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits<qint64>::max());
+
+ deadline.setPreciseRemainingTime(-1, 0, timerType);
+ QVERIFY(deadline.isForever());
+ QVERIFY(!deadline.hasExpired());
+ QCOMPARE(deadline.remainingTime(), qint64(-1));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits<qint64>::max());
+
+ deadline.setPreciseRemainingTime(-1, -1, timerType);
+ QVERIFY(deadline.isForever());
+ QVERIFY(!deadline.hasExpired());
+ QCOMPARE(deadline.remainingTime(), qint64(-1));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits<qint64>::max());
+
+ deadline.setDeadline(std::numeric_limits<qint64>::max(), timerType);
+ QVERIFY(deadline.isForever());
+ QVERIFY(!deadline.hasExpired());
+ QCOMPARE(deadline.remainingTime(), qint64(-1));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits<qint64>::max());
+
+ deadline.setPreciseDeadline(std::numeric_limits<qint64>::max(), 0, timerType);
+ QVERIFY(deadline.isForever());
+ QVERIFY(!deadline.hasExpired());
+ QCOMPARE(deadline.remainingTime(), qint64(-1));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), std::numeric_limits<qint64>::max());
+
+ QCOMPARE(deadline, deadline);
+ QVERIFY(!(deadline < deadline));
+ QVERIFY(deadline <= deadline);
+ QVERIFY(deadline >= deadline);
+ QVERIFY(!(deadline > deadline));
+
+ // adding to forever must still be forever
+ QDeadlineTimer deadline2 = deadline + 1;
+ QVERIFY(deadline2.isForever());
+ QVERIFY(!deadline2.hasExpired());
+ QCOMPARE(deadline2.remainingTime(), qint64(-1));
+ QCOMPARE(deadline2.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline2.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline2.deadlineNSecs(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline2.timerType(), deadline.timerType());
+
+ QCOMPARE(deadline2 - deadline, qint64(0));
+ QCOMPARE(deadline2, deadline);
+ QVERIFY(!(deadline2 < deadline));
+ QVERIFY(deadline2 <= deadline);
+ QVERIFY(deadline2 >= deadline);
+ QVERIFY(!(deadline2 > deadline));
+
+ // subtracting from forever is *also* forever
+ deadline2 = deadline - 1;
+ QVERIFY(deadline2.isForever());
+ QVERIFY(!deadline2.hasExpired());
+ QCOMPARE(deadline2.remainingTime(), qint64(-1));
+ QCOMPARE(deadline2.remainingTimeNSecs(), qint64(-1));
+ QCOMPARE(deadline2.deadline(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline2.deadlineNSecs(), std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline2.timerType(), deadline.timerType());
+
+ QCOMPARE(deadline2 - deadline, qint64(0));
+ QCOMPARE(deadline2, deadline);
+ QVERIFY(!(deadline2 < deadline));
+ QVERIFY(deadline2 <= deadline);
+ QVERIFY(deadline2 >= deadline);
+ QVERIFY(!(deadline2 > deadline));
+
+ // compare and order against a default-constructed object
+ QDeadlineTimer expired;
+ QVERIFY(!(deadline == expired));
+ QVERIFY(deadline != expired);
+ QVERIFY(!(deadline < expired));
+ QVERIFY(!(deadline <= expired));
+ QVERIFY(deadline >= expired);
+ QVERIFY(deadline > expired);
+}
+
+void tst_QDeadlineTimer::current()
+{
+ QFETCH_GLOBAL(Qt::TimerType, timerType);
+ auto deadline = QDeadlineTimer::current(timerType);
+ QVERIFY(deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+
+ // subtracting from current should be "more expired"
+ QDeadlineTimer earlierDeadline = deadline - 1;
+ QVERIFY(earlierDeadline.hasExpired());
+ QVERIFY(!earlierDeadline.isForever());
+ QCOMPARE(earlierDeadline.timerType(), timerType);
+ QCOMPARE(earlierDeadline.remainingTime(), qint64(0));
+ QCOMPARE(earlierDeadline.remainingTimeNSecs(), qint64(0));
+ QVERIFY(earlierDeadline.deadline() != 0);
+ QVERIFY(earlierDeadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(earlierDeadline.deadlineNSecs() != 0);
+ QVERIFY(earlierDeadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+ QCOMPARE(earlierDeadline.deadline(), deadline.deadline() - 1);
+ QCOMPARE(earlierDeadline.deadlineNSecs(), deadline.deadlineNSecs() - 1000*1000);
+
+ QCOMPARE(earlierDeadline - deadline, qint64(-1));
+ QVERIFY(earlierDeadline != deadline);
+ QVERIFY(earlierDeadline < deadline);
+ QVERIFY(earlierDeadline <= deadline);
+ QVERIFY(!(earlierDeadline >= deadline));
+ QVERIFY(!(earlierDeadline > deadline));
+}
+
+void tst_QDeadlineTimer::deadlines()
+{
+ QFETCH_GLOBAL(Qt::TimerType, timerType);
+
+ QDeadlineTimer deadline(4 * minResolution, timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTime() > (3 * minResolution));
+ QVERIFY(deadline.remainingTime() <= (4 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+
+ deadline.setRemainingTime(4 * minResolution, timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTime() > (3 * minResolution));
+ QVERIFY(deadline.remainingTime() <= (4 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+
+ deadline.setPreciseRemainingTime(0, 4000000 * minResolution, timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTime() > (3 * minResolution));
+ QVERIFY(deadline.remainingTime() <= (4 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+
+ deadline.setPreciseRemainingTime(1, 0, timerType); // 1 sec
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTime() > (1000 - minResolution));
+ QVERIFY(deadline.remainingTime() <= 1000);
+ QVERIFY(deadline.remainingTimeNSecs() > (1000 - minResolution)*1000*1000);
+ QVERIFY(deadline.remainingTimeNSecs() <= (1000*1000*1000));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+
+ // adding to a future deadline must still be further in the future
+ QDeadlineTimer laterDeadline = deadline + 1;
+ QVERIFY(!laterDeadline.hasExpired());
+ QVERIFY(!laterDeadline.isForever());
+ QCOMPARE(laterDeadline.timerType(), timerType);
+ QVERIFY(laterDeadline.remainingTime() > (1000 - minResolution));
+ QVERIFY(laterDeadline.remainingTime() <= 1001);
+ QVERIFY(laterDeadline.remainingTimeNSecs() > (1001 - minResolution)*1000*1000);
+ QVERIFY(laterDeadline.remainingTimeNSecs() <= (1001*1000*1000));
+ QVERIFY(laterDeadline.deadline() != 0);
+ QVERIFY(laterDeadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(laterDeadline.deadlineNSecs() != 0);
+ QVERIFY(laterDeadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+ QCOMPARE(laterDeadline.deadline(), deadline.deadline() + 1);
+ QCOMPARE(laterDeadline.deadlineNSecs(), deadline.deadlineNSecs() + 1000*1000);
+
+ QCOMPARE(laterDeadline - deadline, qint64(1));
+ QVERIFY(laterDeadline != deadline);
+ QVERIFY(!(laterDeadline < deadline));
+ QVERIFY(!(laterDeadline <= deadline));
+ QVERIFY(laterDeadline >= deadline);
+ QVERIFY(laterDeadline > deadline);
+
+ // compare and order against a default-constructed object
+ QDeadlineTimer expired;
+ QVERIFY(!(deadline == expired));
+ QVERIFY(deadline != expired);
+ QVERIFY(!(deadline < expired));
+ QVERIFY(!(deadline <= expired));
+ QVERIFY(deadline >= expired);
+ QVERIFY(deadline > expired);
+
+ // compare and order against a forever deadline
+ QDeadlineTimer forever_(QDeadlineTimer::Forever);
+ QVERIFY(!(deadline == forever_));
+ QVERIFY(deadline != forever_);
+ QVERIFY(deadline < forever_);
+ QVERIFY(deadline <= forever_);
+ QVERIFY(!(deadline >= forever_));
+ QVERIFY(!(deadline > forever_));
+}
+
+void tst_QDeadlineTimer::setDeadline()
+{
+ QFETCH_GLOBAL(Qt::TimerType, timerType);
+ auto now = QDeadlineTimer::current(timerType);
+ QDeadlineTimer deadline;
+
+ deadline.setDeadline(now.deadline(), timerType);
+ QVERIFY(deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QCOMPARE(deadline.deadline(), now.deadline());
+ // don't check deadlineNSecs!
+
+ deadline.setPreciseDeadline(now.deadlineNSecs() / (1000 * 1000 * 1000),
+ now.deadlineNSecs() % (1000 * 1000 * 1000), timerType);
+ QVERIFY(deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QCOMPARE(deadline.deadline(), now.deadline());
+ QCOMPARE(deadline.deadlineNSecs(), now.deadlineNSecs());
+
+ now = QDeadlineTimer::current(timerType);
+ deadline.setDeadline(now.deadline() + 4 * minResolution, timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTime() > (3 * minResolution));
+ QVERIFY(deadline.remainingTime() <= (4 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution));
+ QCOMPARE(deadline.deadline(), now.deadline() + 4 * minResolution); // yes, it's exact
+ // don't check deadlineNSecs!
+
+ now = QDeadlineTimer::current(timerType);
+ qint64 nsec = now.deadlineNSecs() + 4000000 * minResolution;
+ deadline.setPreciseDeadline(nsec / (1000 * 1000 * 1000),
+ nsec % (1000 * 1000 * 1000), timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTime() > (3 * minResolution));
+ QVERIFY(deadline.remainingTime() <= (4 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() > (3000000 * minResolution));
+ QVERIFY(deadline.remainingTimeNSecs() <= (4000000 * minResolution));
+ QCOMPARE(deadline.deadline(), nsec / (1000 * 1000));
+ QCOMPARE(deadline.deadlineNSecs(), nsec);
+}
+
+void tst_QDeadlineTimer::expire()
+{
+ QFETCH_GLOBAL(Qt::TimerType, timerType);
+
+ QDeadlineTimer deadline(minResolution, timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+
+ qint64 previousDeadline = deadline.deadlineNSecs();
+
+ QTest::qSleep(2 * minResolution);
+
+ QCOMPARE(deadline.remainingTime(), qint64(0));
+ QCOMPARE(deadline.remainingTimeNSecs(), qint64(0));
+ QVERIFY(deadline.deadline() != 0);
+ QVERIFY(deadline.deadline() != std::numeric_limits<qint64>::max());
+ QVERIFY(deadline.deadlineNSecs() != 0);
+ QVERIFY(deadline.deadlineNSecs() != std::numeric_limits<qint64>::max());
+ QCOMPARE(deadline.deadlineNSecs(), previousDeadline);
+}
+
+void tst_QDeadlineTimer::stdchrono()
+{
+#if !QT_HAS_INCLUDE(<chrono>)
+ QSKIP("std::chrono not found on this system");
+#else
+ using namespace std::chrono;
+ QFETCH_GLOBAL(Qt::TimerType, timerType);
+
+ // create some forevers
+ QDeadlineTimer deadline = milliseconds::max();
+ QVERIFY(deadline.isForever());
+ deadline = milliseconds::max();
+ QVERIFY(deadline.isForever());
+ deadline.setRemainingTime(milliseconds::max(), timerType);
+ QVERIFY(deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ deadline = nanoseconds::max();
+ QVERIFY(deadline.isForever());
+ deadline.setRemainingTime(nanoseconds::max(), timerType);
+ QVERIFY(deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ deadline = hours::max();
+ QVERIFY(deadline.isForever());
+ deadline.setRemainingTime(hours::max(), timerType);
+ QVERIFY(deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+
+ deadline = time_point<system_clock>::max();
+ QVERIFY(deadline.isForever());
+ deadline.setDeadline(time_point<system_clock>::max(), timerType);
+ QVERIFY(deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ deadline = time_point<steady_clock>::max();
+ QVERIFY(deadline.isForever());
+ deadline.setDeadline(time_point<steady_clock>::max(), timerType);
+ QVERIFY(deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+
+ QVERIFY(deadline == time_point<steady_clock>::max());
+ QVERIFY(deadline == time_point<system_clock>::max());
+ QCOMPARE(deadline.remainingTimeAsDuration(), nanoseconds::max());
+
+ // make it expired
+ deadline = time_point<system_clock>();
+ QVERIFY(deadline.hasExpired());
+ deadline.setDeadline(time_point<system_clock>(), timerType);
+ QVERIFY(deadline.hasExpired());
+ QCOMPARE(deadline.timerType(), timerType);
+ deadline = time_point<steady_clock>();
+ QVERIFY(deadline.hasExpired());
+ deadline.setDeadline(time_point<steady_clock>(), timerType);
+ QVERIFY(deadline.hasExpired());
+ QCOMPARE(deadline.timerType(), timerType);
+
+ QCOMPARE(deadline.remainingTimeAsDuration(), nanoseconds::zero());
+
+ auto steady_before = steady_clock::now();
+ auto system_before = system_clock::now();
+
+ QTest::qSleep(minResolution);
+ auto now = QDeadlineTimer::current(timerType);
+ QTest::qSleep(minResolution);
+
+ auto steady_after = steady_clock::now();
+ auto system_after = system_clock::now();
+
+ {
+ auto diff = duration_cast<milliseconds>(steady_after - now.deadline<steady_clock>());
+ QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
+ QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
+ QDeadlineTimer dt_after(steady_after, timerType);
+ QVERIFY2(now < dt_after,
+ ("now = " + QLocale().toString(now.deadlineNSecs()) +
+ "; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1());
+
+ diff = duration_cast<milliseconds>(now.deadline<steady_clock>() - steady_before);
+ QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
+ QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
+ QDeadlineTimer dt_before(steady_before, timerType);
+ QVERIFY2(now > dt_before,
+ ("now = " + QLocale().toString(now.deadlineNSecs()) +
+ "; before = " + QLocale().toString(dt_before.deadlineNSecs())).toLatin1());
+ }
+ {
+ auto diff = duration_cast<milliseconds>(system_after - now.deadline<system_clock>());
+ QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
+ QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
+ QDeadlineTimer dt_after(system_after, timerType);
+ QVERIFY2(now < dt_after,
+ ("now = " + QLocale().toString(now.deadlineNSecs()) +
+ "; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1());
+
+ diff = duration_cast<milliseconds>(now.deadline<system_clock>() - system_before);
+ QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
+ QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
+ QDeadlineTimer dt_before(system_before, timerType);
+ QVERIFY2(now > dt_before,
+ ("now = " + QLocale().toString(now.deadlineNSecs()) +
+ "; before = " + QLocale().toString(dt_before.deadlineNSecs())).toLatin1());
+ }
+
+ // make it regular
+ now = QDeadlineTimer::current(timerType);
+ deadline.setRemainingTime(milliseconds(4 * minResolution), timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTimeAsDuration() > milliseconds(3 * minResolution));
+ QVERIFY(deadline.remainingTimeAsDuration() < milliseconds(5 * minResolution));
+ QVERIFY(deadline.remainingTimeAsDuration() > nanoseconds(3000000 * minResolution));
+ QVERIFY(deadline.remainingTimeAsDuration() < nanoseconds(5000000 * minResolution));
+ QVERIFY(deadline.deadline<steady_clock>() > (steady_clock::now() + milliseconds(3 * minResolution)));
+ QVERIFY(deadline.deadline<steady_clock>() < (steady_clock::now() + milliseconds(5 * minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() > (system_clock::now() + milliseconds(3 * minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() < (system_clock::now() + milliseconds(5 * minResolution)));
+ if (timerType == Qt::CoarseTimer) {
+ QVERIFY(deadline > (now + milliseconds(3 * minResolution)));
+ QVERIFY(deadline < (now + milliseconds(5 * minResolution)));
+ QVERIFY(deadline > (now + nanoseconds(3000000 * minResolution)));
+ QVERIFY(deadline < (now + nanoseconds(5000000 * minResolution)));
+ QVERIFY(deadline > milliseconds(3 * minResolution));
+ QVERIFY(deadline < milliseconds(5 * minResolution));
+ QVERIFY(deadline > nanoseconds(3000000 * minResolution));
+ QVERIFY(deadline < nanoseconds(5000000 * minResolution));
+ QVERIFY(deadline >= steady_clock::now());
+ QVERIFY(deadline >= system_clock::now());
+ }
+
+ now = QDeadlineTimer::current(timerType);
+ deadline = QDeadlineTimer(seconds(1), timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTimeAsDuration() > (seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.remainingTimeAsDuration() <= seconds(1));
+ QVERIFY(deadline.deadline<steady_clock>() > (steady_clock::now() + seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<steady_clock>() <= (steady_clock::now() + seconds(1) + milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() > (system_clock::now() + seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() <= (system_clock::now() + seconds(1) + milliseconds(minResolution)));
+ if (timerType == Qt::CoarseTimer) {
+ QVERIFY(deadline > (seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline <= seconds(1));
+ }
+
+ now = QDeadlineTimer::current(timerType);
+ deadline.setRemainingTime(hours(1), timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTimeAsDuration() > (hours(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.remainingTimeAsDuration() <= hours(1));
+ QVERIFY(deadline.deadline<steady_clock>() > (steady_clock::now() + hours(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<steady_clock>() <= (steady_clock::now() + hours(1) + milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() > (system_clock::now() + hours(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() <= (system_clock::now() + hours(1) + milliseconds(minResolution)));
+
+ now = QDeadlineTimer::current(timerType);
+ deadline.setDeadline(system_clock::now() + seconds(1), timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTimeAsDuration() > (seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.remainingTimeAsDuration() <= seconds(1));
+ QVERIFY(deadline.deadline<steady_clock>() > (steady_clock::now() + seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<steady_clock>() <= (steady_clock::now() + seconds(1) + milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() > (system_clock::now() + seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() <= (system_clock::now() + seconds(1) + milliseconds(minResolution)));
+
+ now = QDeadlineTimer::current(timerType);
+ deadline.setDeadline(steady_clock::now() + seconds(1), timerType);
+ QVERIFY(!deadline.hasExpired());
+ QVERIFY(!deadline.isForever());
+ QCOMPARE(deadline.timerType(), timerType);
+ QVERIFY(deadline.remainingTimeAsDuration() > (seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.remainingTimeAsDuration() <= seconds(1));
+ QVERIFY(deadline.deadline<steady_clock>() > (steady_clock::now() + seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<steady_clock>() <= (steady_clock::now() + seconds(1) + milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() > (system_clock::now() + seconds(1) - milliseconds(minResolution)));
+ QVERIFY(deadline.deadline<system_clock>() <= (system_clock::now() + seconds(1) + milliseconds(minResolution)));
+#endif
+}
+
+QTEST_MAIN(tst_QDeadlineTimer)
+
+#include "tst_qdeadlinetimer.moc"
diff --git a/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro b/tests/auto/corelib/kernel/qelapsedtimer/qelapsedtimer.pro
index 657a63a5d7..657a63a5d7 100644
--- a/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro
+++ b/tests/auto/corelib/kernel/qelapsedtimer/qelapsedtimer.pro
diff --git a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp
index 9db001c37d..9db001c37d 100644
--- a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp
+++ b/tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp
diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro
index 5cd043b584..295a42aa9c 100644
--- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro
+++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro
@@ -3,6 +3,6 @@ TARGET = tst_qeventloop
QT = core network testlib core-private
SOURCES = $$PWD/tst_qeventloop.cpp
-win32:!wince:!winrt: LIBS += -luser32
+win32:!winrt: LIBS += -luser32
-contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB
+qtConfig(glib): DEFINES += HAVE_GLIB
diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
index 1d4e647a4b..b5f1d0fe00 100644
--- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
+++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
@@ -6,11 +6,11 @@ SOURCES = tst_qmetatype.cpp
TESTDATA=./typeFlags.bin
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-win32-msvc*|wince|winrt {
+win32-msvc*|winrt {
# Prevents "fatal error C1128: number of sections exceeded object file format limit".
QMAKE_CXXFLAGS += /bigobj
# Reduce compile time
- win32-msvc2012|wince|winrt {
+ win32-msvc2012|winrt {
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE -= -O2
}
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index fbb6a30917..86f47f3511 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -669,6 +669,9 @@ template<> struct TestValueFactory<QMetaType::QModelIndex> {
template<> struct TestValueFactory<QMetaType::QPersistentModelIndex> {
static QPersistentModelIndex *create() { return new QPersistentModelIndex(); }
};
+template<> struct TestValueFactory<QMetaType::Nullptr> {
+ static std::nullptr_t *create() { return new std::nullptr_t; }
+};
template<> struct TestValueFactory<QMetaType::QRegExp> {
static QRegExp *create()
{
@@ -1798,6 +1801,7 @@ DECLARE_NONSTREAMABLE(QJsonArray)
DECLARE_NONSTREAMABLE(QJsonDocument)
DECLARE_NONSTREAMABLE(QObject*)
DECLARE_NONSTREAMABLE(QWidget*)
+DECLARE_NONSTREAMABLE(std::nullptr_t)
#define DECLARE_GUI_CLASS_NONSTREAMABLE(MetaTypeName, MetaTypeId, RealType) \
DECLARE_NONSTREAMABLE(RealType)
diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
index 125915047a..cc51b4c661 100644
--- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
+++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
@@ -2,9 +2,6 @@ CONFIG -= app_bundle debug_and_release
CONFIG += console
DESTDIR = ./
QT = core
-wince {
- LIBS += coredll.lib
-}
HEADERS += signalbug.h
SOURCES += signalbug.cpp
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 333305d603..0f7f75fb2e 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -66,6 +66,7 @@ private slots:
void connectDisconnectNotify();
void connectDisconnectNotifyPMF();
void disconnectNotify_receiverDestroyed();
+ void disconnectNotify_metaObjConnection();
void connectNotify_connectSlotsByName();
void connectDisconnectNotify_shadowing();
void emitInDefinedOrder();
@@ -146,6 +147,7 @@ private slots:
void noDeclarativeParentChangedOnDestruction();
void deleteLaterInAboutToBlockHandler();
void mutableFunctor();
+ void checkArgumentsForNarrowing();
};
struct QObjectCreatedOnShutdown
@@ -923,8 +925,7 @@ void tst_QObject::connectDisconnectNotifyPMF()
// Test disconnectNotify when disconnecting by QMetaObject::Connection
QVERIFY(QObject::disconnect(conn));
- // disconnectNotify() is not called, but it probably should be.
- QVERIFY(s->disconnectedSignals.isEmpty());
+ QVERIFY(!s->disconnectedSignals.isEmpty());
// Test connectNotify when connecting by function pointer
s->clearNotifications();
@@ -969,6 +970,25 @@ void tst_QObject::disconnectNotify_receiverDestroyed()
delete s;
}
+void tst_QObject::disconnectNotify_metaObjConnection()
+{
+ NotifyObject *s = new NotifyObject;
+ NotifyObject *r = new NotifyObject;
+
+ QMetaObject::Connection c = QObject::connect((SenderObject*)s, SIGNAL(signal1()),
+ (ReceiverObject*)r, SLOT(slot1()));
+ QVERIFY(c);
+ QVERIFY(QObject::disconnect(c));
+
+ QCOMPARE(s->disconnectedSignals.count(), 1);
+ QCOMPARE(s->disconnectedSignals.at(0), QMetaMethod::fromSignal(&SenderObject::signal1));
+
+ delete r;
+ QCOMPARE(s->disconnectedSignals.count(), 1);
+
+ delete s;
+}
+
class ConnectByNameNotifySenderObject : public QObject
{
Q_OBJECT
@@ -1575,11 +1595,7 @@ Q_DECLARE_METATYPE(PropertyObject::Priority)
void tst_QObject::threadSignalEmissionCrash()
{
-#if defined(Q_OS_WINCE)
- int loopCount = 100;
-#else
int loopCount = 1000;
-#endif
for (int i = 0; i < loopCount; ++i) {
QTcpSocket socket;
socket.connectToHost("localhost", 80);
@@ -6731,6 +6747,515 @@ void tst_QObject::mutableFunctor()
QCOMPARE(functor.count, 0); // but the original object should have been copied at connect time
}
+void tst_QObject::checkArgumentsForNarrowing()
+{
+ enum UnscopedEnum {};
+ enum SignedUnscopedEnum { SignedUnscopedEnumV1 = -1, SignedUnscopedEnumV2 = 1 };
+
+ QVERIFY(sizeof(UnscopedEnum) <= sizeof(int));
+ QVERIFY(sizeof(SignedUnscopedEnum) <= sizeof(int));
+
+ // floating point to integral
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, bool>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, bool>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, bool>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, char>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, short>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, int>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<float, long long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, long long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, long long>::value));
+
+
+ // floating point to a smaller floating point
+ if (sizeof(double) > sizeof(float)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<double, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, float>::value));
+ }
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<float, double>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<float, long double>::value));
+
+ if (sizeof(long double) > sizeof(double))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long double, float>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<double, long double>::value));
+
+
+ // integral to floating point
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, long double>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<char, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<char, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<char, long double>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, long double>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, long double>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, long double>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, long double>::value));
+
+
+ // enum to floating point
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, long double>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, float>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, double>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, long double>::value));
+
+
+ // integral to smaller integral
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<bool, bool>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<char, char>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, signed char>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<signed char, long long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned char>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned char, unsigned long long>::value));
+
+ if (sizeof(bool) > sizeof(char))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned char>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned char>::value));
+
+ if (sizeof(bool) > sizeof(short))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned short>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned short>::value));
+
+ if (sizeof(bool) > sizeof(int))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned int>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned int>::value));
+
+ if (sizeof(bool) > sizeof(long))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long>::value));
+
+ if (sizeof(bool) > sizeof(long long))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long long>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<bool, unsigned long long>::value));
+
+ if (sizeof(short) > sizeof(char)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, signed char>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, signed char>::value));
+ }
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<short, long long>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned short, unsigned long long>::value));
+
+ if (sizeof(int) > sizeof(short)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned short>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned short>::value));
+ }
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int, long long>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned int, unsigned long long>::value));
+
+ if (sizeof(long) > sizeof(int)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned int>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned int>::value));
+ }
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<long, long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<long, long long>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned long, unsigned long long>::value));
+
+ if (sizeof(long long) > sizeof(long)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned long>::value));
+ }
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<long long, long long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<unsigned long long, unsigned long long>::value));
+
+
+ // integral to integral with different signedness. smaller ones tested above
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<signed char, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned char, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned char, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned char, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned char, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned char, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<short, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned short, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<int, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned int, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<long long, unsigned long long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<unsigned long long, long long>::value));
+
+ // enum to smaller integral
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, UnscopedEnum>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, SignedUnscopedEnum>::value));
+
+ if (std::is_signed<typename std::underlying_type<UnscopedEnum>::type>::value) {
+ if (sizeof(UnscopedEnum) > sizeof(char))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, signed char>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, signed char>::value));
+
+ if (sizeof(UnscopedEnum) > sizeof(short))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, short>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, short>::value));
+
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, int>::value));
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, long>::value));
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, long long>::value));
+ } else {
+ if (sizeof(UnscopedEnum) > sizeof(bool))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, bool>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, bool>::value));
+
+ if (sizeof(UnscopedEnum) > sizeof(char))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned char>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned char>::value));
+
+ if (sizeof(UnscopedEnum) > sizeof(short))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned short>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned short>::value));
+
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned int>::value));
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned long>::value));
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<UnscopedEnum, unsigned long long>::value));
+ }
+
+ QVERIFY(std::is_signed<typename std::underlying_type<SignedUnscopedEnum>::type>::value);
+
+ if (sizeof(SignedUnscopedEnum) > sizeof(char))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, signed char>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, signed char>::value));
+
+ if (sizeof(SignedUnscopedEnum) > sizeof(short))
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, short>::value));
+ else
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, short>::value));
+
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, int>::value));
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, long>::value));
+ QVERIFY(!(QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, long long>::value));
+
+
+ enum class ScopedEnumBackedBySChar : signed char { A };
+ enum class ScopedEnumBackedByUChar : unsigned char { A };
+ enum class ScopedEnumBackedByShort : short { A };
+ enum class ScopedEnumBackedByUShort : unsigned short { A };
+ enum class ScopedEnumBackedByInt : int { A };
+ enum class ScopedEnumBackedByUInt : unsigned int { A };
+ enum class ScopedEnumBackedByLong : long { A };
+ enum class ScopedEnumBackedByULong : unsigned long { A };
+ enum class ScopedEnumBackedByLongLong : long long { A };
+ enum class ScopedEnumBackedByULongLong : unsigned long long { A };
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, ScopedEnumBackedBySChar>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, ScopedEnumBackedByUChar>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, ScopedEnumBackedByShort>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, ScopedEnumBackedByUShort>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, ScopedEnumBackedByInt>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, ScopedEnumBackedByUInt>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, ScopedEnumBackedByLong>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, ScopedEnumBackedByULong>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, ScopedEnumBackedByLongLong>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, ScopedEnumBackedByULongLong>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, signed char>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned char>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, unsigned short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, unsigned int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, long long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned long long>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, signed char>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, long long>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned char>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned short>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned int>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, unsigned long long>::value));
+
+ if (sizeof(short) > sizeof(char)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, char>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, signed char>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned char>::value));
+ }
+
+ if (sizeof(int) > sizeof(short)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, short>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned short>::value));
+ }
+
+ if (sizeof(long) > sizeof(int)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, int>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned int>::value));
+ }
+
+ if (sizeof(long long) > sizeof(long)) {
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, unsigned long>::value));
+ }
+
+ // different signedness of the underlying type
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<SignedUnscopedEnum, unsigned long long>::value));
+
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedBySChar, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByShort, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByInt, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLong, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByLongLong, unsigned long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUChar, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUShort, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByUInt, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULong, long long>::value));
+
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, signed char>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, short>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, int>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, long>::value));
+ QVERIFY((QtPrivate::AreArgumentsNarrowedBase<ScopedEnumBackedByULongLong, long long>::value));
+
+ // other types which should be always unaffected
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<void *, void *>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, QString>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString &, QString &>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<const QString &, const QString &>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QObject, QObject>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QObject *, QObject *>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<const QObject *, const QObject *>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<std::nullptr_t, std::nullptr_t>::value));
+
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, QObject>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, QVariant>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, void *>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<QString, long long>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<bool, const QObject *&>::value));
+ QVERIFY((!QtPrivate::AreArgumentsNarrowedBase<int (*)(bool), void (QObject::*)()>::value));
+}
+
// Test for QtPrivate::HasQ_OBJECT_Macro
Q_STATIC_ASSERT(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value);
Q_STATIC_ASSERT(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value);
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
index b6f6d2a7f3..26caff4301 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
+++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
@@ -90,7 +90,7 @@ private slots:
// extreme cases
void useTooMuchMemory();
-#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_HPUX)
void attachTooMuch();
#endif
@@ -516,8 +516,7 @@ void tst_QSharedMemory::useTooMuchMemory()
attach before the system runs out of resources.
*/
// HPUX doesn't allow for multiple attaches per process.
-// For WinCE, this test nearly kills the system, so skip it.
-#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_HPUX)
void tst_QSharedMemory::attachTooMuch()
{
QSKIP("disabled");
@@ -576,9 +575,7 @@ void tst_QSharedMemory::simpleProducerConsumer()
char *get = (char*)consumer.data();
// On Windows CE you always have ReadWrite access. Thus
// ViewMapOfFile returns the same pointer
-#if !defined(Q_OS_WINCE)
QVERIFY(put != get);
-#endif
for (int i = 0; i < size; ++i) {
put[i] = 'Q';
QCOMPARE(get[i], 'Q');
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro
index 58e4b98af7..04806de5f7 100644
--- a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro
+++ b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro
@@ -3,6 +3,6 @@ TARGET = tst_qsocketnotifier
QT = core-private network-private testlib
SOURCES = tst_qsocketnotifier.cpp
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
include(../../../network/socket/platformsocketengine/platformsocketengine.pri)
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index 6fd192c357..28df01cc16 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -52,6 +52,7 @@ private slots:
void remainingTime();
void remainingTimeDuringActivation_data();
void remainingTimeDuringActivation();
+ void basic_chrono();
void livelock_data();
void livelock();
void timerInfiniteRecursion_data();
@@ -68,6 +69,7 @@ private slots:
void singleShotStaticFunctionZeroTimeout();
void recurseOnTimeoutAndStopTimer();
void singleShotToFunctors();
+ void singleShot_chrono();
void crossThreadSingleShotToFunctor();
void dontBlockEvents();
@@ -214,6 +216,57 @@ void tst_QTimer::remainingTimeDuringActivation()
}
}
+void tst_QTimer::basic_chrono()
+{
+#if !QT_HAS_INCLUDE(<chrono>)
+ QSKIP("This test requires C++11 <chrono> support");
+#else
+ // duplicates zeroTimer, singleShotTimeout, interval and remainingTime
+ using namespace std::chrono;
+ TimerHelper helper;
+ QTimer timer;
+ timer.setInterval(nanoseconds(0));
+ timer.start();
+ QCOMPARE(timer.intervalAsDuration().count(), milliseconds::rep(0));
+ QCOMPARE(timer.remainingTimeAsDuration().count(), milliseconds::rep(0));
+
+ connect(&timer, SIGNAL(timeout()), &helper, SLOT(timeout()));
+
+ QCoreApplication::processEvents();
+
+ QCOMPARE(helper.count, 1);
+
+ helper.count = 0;
+ timer.start(milliseconds(100));
+ QCOMPARE(helper.count, 0);
+
+ QTest::qWait(TIMEOUT_TIMEOUT);
+ QVERIFY(helper.count > 0);
+ int oldCount = helper.count;
+
+ QTest::qWait(TIMEOUT_TIMEOUT);
+ QVERIFY(helper.count > oldCount);
+
+ helper.count = 0;
+ timer.start(microseconds(200000));
+ QCOMPARE(timer.intervalAsDuration().count(), milliseconds::rep(200));
+ QTest::qWait(50);
+ QCOMPARE(helper.count, 0);
+
+ milliseconds rt = timer.remainingTimeAsDuration();
+ QVERIFY2(qAbs(rt.count() - 150) < 50, qPrintable(QString::number(rt.count())));
+
+ helper.count = 0;
+ timer.setSingleShot(true);
+ timer.start(milliseconds(100));
+ QTest::qWait(500);
+ QCOMPARE(helper.count, 1);
+ QTest::qWait(500);
+ QCOMPARE(helper.count, 1);
+ helper.count = 0;
+#endif
+}
+
void tst_QTimer::livelock_data()
{
QTest::addColumn<int>("interval");
@@ -295,9 +348,6 @@ void tst_QTimer::livelock()
QTRY_COMPARE(tester.timeoutsForFirst, 1);
QCOMPARE(tester.timeoutsForExtra, 0);
QTRY_COMPARE(tester.timeoutsForSecond, 1);
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue);
-#endif
QVERIFY(tester.postEventAtRightTime);
}
@@ -790,6 +840,51 @@ void tst_QTimer::singleShotToFunctors()
_t = Q_NULLPTR;
}
+void tst_QTimer::singleShot_chrono()
+{
+#if !QT_HAS_INCLUDE(<chrono>)
+ QSKIP("This test requires C++11 <chrono> support");
+#else
+ // duplicates singleShotStaticFunctionZeroTimeout and singleShotToFunctors
+ using namespace std::chrono;
+ TimerHelper helper;
+
+ QTimer::singleShot(hours(0), &helper, SLOT(timeout()));
+ QTest::qWait(500);
+ QCOMPARE(helper.count, 1);
+ QTest::qWait(500);
+ QCOMPARE(helper.count, 1);
+
+ TimerHelper nhelper;
+
+ QTimer::singleShot(seconds(0), &nhelper, &TimerHelper::timeout);
+ QCoreApplication::processEvents();
+ QCOMPARE(nhelper.count, 1);
+ QCoreApplication::processEvents();
+ QCOMPARE(nhelper.count, 1);
+
+ int count = 0;
+ QTimer::singleShot(microseconds(0), CountedStruct(&count));
+ QCoreApplication::processEvents();
+ QCOMPARE(count, 1);
+
+ _e.reset(new QEventLoop);
+ QTimer::singleShot(0, &StaticEventLoop::quitEventLoop);
+ QCOMPARE(_e->exec(), 0);
+
+ QObject c3;
+ QTimer::singleShot(milliseconds(500), &c3, CountedStruct(&count));
+ QTest::qWait(800);
+ QCOMPARE(count, 2);
+
+ QTimer::singleShot(0, [&count] { ++count; });
+ QCoreApplication::processEvents();
+ QCOMPARE(count, 3);
+
+ _e.reset();
+#endif
+}
+
class DontBlockEvents : public QObject
{
Q_OBJECT
diff --git a/tests/auto/corelib/kernel/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro
index 33e8b6e2ad..96071f9f73 100644
--- a/tests/auto/corelib/kernel/qvariant/qvariant.pro
+++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro
@@ -5,7 +5,7 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES = tst_qvariant.cpp
RESOURCES += qvariant.qrc
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-contains(QT_CONFIG, c++11): CONFIG += c++11
-!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) {
+qtConfig(c++11): CONFIG += c++11
+!qtConfig(doubleconversion):!qtConfig(system-doubleconversion) {
DEFINES += QT_NO_DOUBLECONVERSION
}
diff --git a/tests/auto/corelib/kernel/qvariant/stream/qt5.0/qdatetime.bin b/tests/auto/corelib/kernel/qvariant/stream/qt5.0/qdatetime.bin
index ee3da63a18..e3a897c37d 100644
--- a/tests/auto/corelib/kernel/qvariant/stream/qt5.0/qdatetime.bin
+++ b/tests/auto/corelib/kernel/qvariant/stream/qt5.0/qdatetime.bin
Binary files differ
diff --git a/tests/auto/corelib/mimetypes/mimetypes.pro b/tests/auto/corelib/mimetypes/mimetypes.pro
index 9063d677e7..9dd091374f 100644
--- a/tests/auto/corelib/mimetypes/mimetypes.pro
+++ b/tests/auto/corelib/mimetypes/mimetypes.pro
@@ -4,5 +4,5 @@ SUBDIRS = \
qmimetype \
qmimedatabase
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qmimetype
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 61ca1a5ddd..2cf9ea4913 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -41,7 +41,6 @@
#include <QtCore/QStandardPaths>
#include <QtCore/QTemporaryDir>
#include <QtCore/QTextStream>
-#include <QFutureSynchronizer>
#include <QtConcurrent/QtConcurrentRun>
#include <QtTest/QtTest>
@@ -116,7 +115,7 @@ Q_CONSTRUCTOR_FUNCTION(initializeLang)
static QString seedAndTemplate()
{
- qsrand(QDateTime::currentDateTimeUtc().toTime_t());
+ qsrand(QDateTime::currentSecsSinceEpoch());
return QDir::tempPath() + "/tst_qmimedatabase-XXXXXX";
}
@@ -844,18 +843,18 @@ void tst_QMimeDatabase::findByFile()
void tst_QMimeDatabase::fromThreads()
{
- QThreadPool::globalInstance()->setMaxThreadCount(20);
+ QThreadPool tp;
+ tp.setMaxThreadCount(20);
// Note that data-based tests cannot be used here (QTest::fetchData asserts).
- QFutureSynchronizer<void> sync;
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::mimeTypeForName));
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::aliases));
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::allMimeTypes));
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::icons));
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::inheritance));
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::knownSuffix));
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::mimeTypeForFileWithContent));
- sync.addFuture(QtConcurrent::run(this, &tst_QMimeDatabase::allMimeTypes)); // a second time
- // sync dtor blocks waiting for finished
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::mimeTypeForName);
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::aliases);
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::allMimeTypes);
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::icons);
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::inheritance);
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::knownSuffix);
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::mimeTypeForFileWithContent);
+ QtConcurrent::run(&tp, this, &tst_QMimeDatabase::allMimeTypes); // a second time
+ QVERIFY(tp.waitForDone(60000));
}
#ifndef QT_NO_PROCESS
diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro
index 777e920995..774edc655a 100644
--- a/tests/auto/corelib/plugin/plugin.pro
+++ b/tests/auto/corelib/plugin/plugin.pro
@@ -3,8 +3,7 @@ SUBDIRS=\
qfactoryloader \
quuid
-load(qfeatures)
-!contains(QT_DISABLED_FEATURES, library): SUBDIRS += \
+qtConfig(library): SUBDIRS += \
qpluginloader \
qplugin \
qlibrary
diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro
index f1e76c31bf..3345651730 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro
+++ b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro
@@ -19,7 +19,6 @@ win32 {
mac: CONFIG -= app_bundle
-load(qfeatures)
-contains(QT_DISABLED_FEATURES, library) {
+!qtConfig(library) {
LIBS += -L ../bin/ -lplugin1 -lplugin2
}
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
index 44bd0be14e..3e15861021 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
+++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
@@ -6,7 +6,6 @@ TARGET = mylib
DESTDIR = ../
QT = core
-wince: DEFINES += WIN32_MSVC
win32-msvc: DEFINES += WIN32_MSVC
# This project is testdata for tst_qlibrary
diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
index d55747501c..bd73227b3d 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
+++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
@@ -7,7 +7,6 @@ DESTDIR = ../
VERSION = 2
QT = core
-wince: DEFINES += WIN32_MSVC
win32-msvc: DEFINES += WIN32_MSVC
# Force a copy of the library to have an extension that is non-standard.
diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
index ed41ab51e1..42fed1191b 100644
--- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
+++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
@@ -189,7 +189,7 @@ void tst_QLibrary::load_data()
QTest::newRow("ok (libmylib ver. 1)") << appDir + "/libmylib" <<true;
#endif
-# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+# if defined(Q_OS_WIN32)
QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << true;
QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << true;
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << true;
@@ -223,10 +223,6 @@ void tst_QLibrary::unload_data()
QString appDir = QCoreApplication::applicationDirPath();
QTest::newRow( "mylib" ) << appDir + "/mylib" << true;
-#ifdef Q_OS_MAC
- if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_3)
- QEXPECT_FAIL("mylib", "dlcompat cannot unload libraries", Continue);
-#endif
QTest::newRow( "ok01" ) << appDir + "/nolib" << false;
}
@@ -346,11 +342,7 @@ void tst_QLibrary::errorString_data()
QTest::newRow("bad load()") << (int)Load << QString("nosuchlib") << false << QString("Cannot load library nosuchlib: .*");
QTest::newRow("call errorString() on QLibrary with no d-pointer (crashtest)") << (int)(Load | DontSetFileName) << QString() << false << QString("Unknown error");
-#ifdef Q_OS_WINCE
- QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in .*: .*");
-#else
QTest::newRow("bad resolve") << (int)Resolve << appDir + "/mylib" << false << QString("Cannot resolve symbol \"nosuchsymbol\" in \\S+: .*");
-#endif
QTest::newRow("good resolve") << (int)Resolve << appDir + "/mylib" << true << QString("Unknown error");
#ifdef Q_OS_WIN
@@ -414,7 +406,7 @@ void tst_QLibrary::loadHints_data()
QString appDir = QCoreApplication::applicationDirPath();
lh |= QLibrary::ResolveAllSymbolsHint;
-# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+# if defined(Q_OS_WIN32) || defined(Q_OS_WINRT)
QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << int(lh) << true;
QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << int(lh) << true;
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << int(lh) << true;
@@ -467,13 +459,8 @@ void tst_QLibrary::fileName_data()
QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib"))
<< sys_qualifiedLibraryName(QLatin1String("mylib"));
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
-#ifndef Q_OS_WINCE
QTest::newRow( "ok03" ) << "user32"
<< "USER32.dll";
-#else
- QTest::newRow( "ok03" ) << "coredll"
- << "coredll.dll";
-#endif
#endif
}
diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
index 874429aab7..ee7cf7ded8 100644
--- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
+++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
@@ -61,7 +61,8 @@ void tst_QPlugin::initTestCase()
void tst_QPlugin::loadDebugPlugin()
{
- foreach (QString fileName, dir.entryList(QStringList() << "*debug*", QDir::Files)) {
+ const auto fileNames = dir.entryList(QStringList() << "*debug*", QDir::Files);
+ for (const QString &fileName : fileNames) {
if (!QLibrary::isLibrary(fileName))
continue;
QPluginLoader loader(dir.filePath(fileName));
@@ -87,8 +88,8 @@ void tst_QPlugin::loadDebugPlugin()
void tst_QPlugin::loadReleasePlugin()
{
- foreach (QString fileName, dir.entryList(QStringList() << "*release*", QDir::Files)) {
- if (!QLibrary::isLibrary(fileName))
+ const auto fileNames = dir.entryList(QStringList() << "*release*", QDir::Files);
+ for (const QString &fileName : fileNames) {
continue;
QPluginLoader loader(dir.filePath(fileName));
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
diff --git a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro
index 83d00f7cd8..c681f5585c 100644
--- a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro
+++ b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro
@@ -5,7 +5,7 @@ SUBDIRS = lib \
theplugin \
tst
!android: !win32: !mac: SUBDIRS += almostplugin
-macx-*: contains(QT_CONFIG, private_tests): SUBDIRS += machtest
+macx-*: qtConfig(private_tests): SUBDIRS += machtest
TARGET = tst_qpluginloader
# no special install rule for subdir
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro
index 101392927c..5f9fa6664b 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro
+++ b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = ../tst_qpluginloader
QT = core testlib
-contains(QT_CONFIG, private_tests): QT += core-private
+qtConfig(private_tests): QT += core-private
SOURCES = ../tst_qpluginloader.cpp ../fakeplugin.cpp
HEADERS = ../theplugin/plugininterface.h
CONFIG -= app_bundle
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
index bc853de24e..499d276ef8 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
@@ -140,11 +140,6 @@ void tst_QPluginLoader::cleanup()
void tst_QPluginLoader::errorString()
{
-#if defined(Q_OS_WINCE)
- // On WinCE we need an QCoreApplication object for current dir
- int argc = 0;
- QCoreApplication app(argc,0);
-#endif
const QString unknown(QLatin1String("Unknown error"));
{
diff --git a/tests/auto/corelib/thread/qmutex/qmutex.pro b/tests/auto/corelib/thread/qmutex/qmutex.pro
index 229e57eb89..cb9d364b71 100644
--- a/tests/auto/corelib/thread/qmutex/qmutex.pro
+++ b/tests/auto/corelib/thread/qmutex/qmutex.pro
@@ -2,3 +2,4 @@ CONFIG += testcase
TARGET = tst_qmutex
QT = core testlib
SOURCES = tst_qmutex.cpp
+win32:QT += core-private
diff --git a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
index 594bae674c..b24ecfcd43 100644
--- a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
+++ b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp
@@ -31,16 +31,27 @@
#include <qatomic.h>
#include <qcoreapplication.h>
-#include <qdatetime.h>
+#include <qelapsedtimer.h>
#include <qmutex.h>
#include <qthread.h>
#include <qwaitcondition.h>
+#ifdef Q_OS_WIN
+#include <private/qsystemlibrary_p.h>
+#include <cmath>
+#endif
+
class tst_QMutex : public QObject
{
Q_OBJECT
private slots:
- void tryLock();
+ void initTestCase();
+ void tryLock_non_recursive();
+ void try_lock_for_non_recursive();
+ void try_lock_until_non_recursive();
+ void tryLock_recursive();
+ void try_lock_for_recursive();
+ void try_lock_until_recursive();
void lock_unlock_locked_tryLock();
void stressTest();
void tryLockRace();
@@ -48,6 +59,8 @@ private slots:
void tryLockNegative_data();
void tryLockNegative();
void moreStress();
+private:
+ void initializeSystemTimersResolution();
};
static const int iterations = 100;
@@ -58,257 +71,819 @@ QSemaphore testsTurn;
QSemaphore threadsTurn;
enum { waitTime = 100 };
+uint systemTimersResolution = 1;
+
+#if QT_HAS_INCLUDE(<chrono>)
+static Q_CONSTEXPR std::chrono::milliseconds waitTimeAsDuration(waitTime);
+#endif
+
+/*
+ Depending on the OS, tryWaits may return early than expected because of the
+ resolution of the underlying timer is too coarse. E.g.: on Windows
+ WaitForSingleObjectEx does *not* use high resolution multimedia timers, and
+ it's actually very coarse, about 16msec by default.
+
+ Try to find out the timer resolution in here, so that the tryLock tests can
+ actually take into account early wakes.
+*/
+void tst_QMutex::initializeSystemTimersResolution()
+{
+#ifdef Q_OS_WIN
+ // according to MSDN, Windows can default up to this
+ systemTimersResolution = 16;
+
+ // private API. There's no way on Windows to otherwise know the
+ // actual resolution of the application's timers (you can only set it)
+ // cf. https://stackoverflow.com/questions/7685762/windows-7-timing-functions-how-to-use-getsystemtimeadjustment-correctly/11743614#11743614
+ typedef NTSTATUS (NTAPI *NtQueryTimerResolutionType)(OUT PULONG MinimumResolution,
+ OUT PULONG MaximumResolution,
+ OUT PULONG ActualResolution);
+
+ const NtQueryTimerResolutionType NtQueryTimerResolutionPtr =
+ reinterpret_cast<NtQueryTimerResolutionType>(QSystemLibrary::resolve(QStringLiteral("ntdll"), "NtQueryTimerResolution"));
+
+ if (!NtQueryTimerResolutionPtr)
+ return;
+
+ ULONG minimumResolution;
+ ULONG maximumResolution;
+ ULONG actualResolution;
+
+ if (!NtQueryTimerResolutionPtr(&minimumResolution, &maximumResolution, &actualResolution)) {
+ // the result is in 100ns units => adjust to msec
+ const double actualResolutionMsec = actualResolution / 10000.0;
+ systemTimersResolution = static_cast<int>(std::ceil(actualResolutionMsec));
+ }
+#endif // Q_OS_WIN
+}
+
+void tst_QMutex::initTestCase()
+{
+ initializeSystemTimersResolution();
+}
-void tst_QMutex::tryLock()
+void tst_QMutex::tryLock_non_recursive()
{
- // test non-recursive mutex
+ class Thread : public QThread
{
- class Thread : public QThread
+ public:
+ void run()
{
- public:
- void run()
- {
- testsTurn.release();
-
- // TEST 1: thread can't acquire lock
- threadsTurn.acquire();
- QVERIFY(!normalMutex.tryLock());
- testsTurn.release();
-
- // TEST 2: thread can acquire lock
- threadsTurn.acquire();
- QVERIFY(normalMutex.tryLock());
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- QVERIFY(!normalMutex.tryLock());
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- normalMutex.unlock();
- testsTurn.release();
-
- // TEST 3: thread can't acquire lock, timeout = waitTime
- threadsTurn.acquire();
- QTime timer;
- timer.start();
- QVERIFY(!normalMutex.tryLock(waitTime));
- QVERIFY(timer.elapsed() >= waitTime);
- testsTurn.release();
-
- // TEST 4: thread can acquire lock, timeout = waitTime
- threadsTurn.acquire();
- timer.start();
- QVERIFY(normalMutex.tryLock(waitTime));
- QVERIFY(timer.elapsed() <= waitTime);
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- timer.start();
- // it's non-recursive, so the following lock needs to fail
- QVERIFY(!normalMutex.tryLock(waitTime));
- QVERIFY(timer.elapsed() >= waitTime);
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- normalMutex.unlock();
- testsTurn.release();
-
- // TEST 5: thread can't acquire lock, timeout = 0
- threadsTurn.acquire();
- QVERIFY(!normalMutex.tryLock(0));
- testsTurn.release();
-
- // TEST 6: thread can acquire lock, timeout = 0
- threadsTurn.acquire();
- timer.start();
- QVERIFY(normalMutex.tryLock(0));
- QVERIFY(timer.elapsed() < waitTime);
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- QVERIFY(!normalMutex.tryLock(0));
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- normalMutex.unlock();
- testsTurn.release();
-
- // TEST 7 overflow: thread can acquire lock, timeout = 3000 (QTBUG-24795)
- threadsTurn.acquire();
- timer.start();
- QVERIFY(normalMutex.tryLock(3000));
- QVERIFY(timer.elapsed() < 3000);
- normalMutex.unlock();
- testsTurn.release();
-
- threadsTurn.acquire();
- }
- };
+ testsTurn.release();
+
+ // TEST 1: thread can't acquire lock
+ threadsTurn.acquire();
+ QVERIFY(!normalMutex.tryLock());
+ testsTurn.release();
+
+ // TEST 2: thread can acquire lock
+ threadsTurn.acquire();
+ QVERIFY(normalMutex.tryLock());
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(!normalMutex.tryLock());
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 3: thread can't acquire lock, timeout = waitTime
+ threadsTurn.acquire();
+ QElapsedTimer timer;
+ timer.start();
+ QVERIFY(!normalMutex.tryLock(waitTime));
+ QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);
+ testsTurn.release();
+
+ // TEST 4: thread can acquire lock, timeout = waitTime
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.tryLock(waitTime));
+ QVERIFY(timer.elapsed() <= waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ timer.start();
+ // it's non-recursive, so the following lock needs to fail
+ QVERIFY(!normalMutex.tryLock(waitTime));
+ QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 5: thread can't acquire lock, timeout = 0
+ threadsTurn.acquire();
+ QVERIFY(!normalMutex.tryLock(0));
+ testsTurn.release();
+
+ // TEST 6: thread can acquire lock, timeout = 0
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.tryLock(0));
+ QVERIFY(timer.elapsed() < waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(!normalMutex.tryLock(0));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 7 overflow: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.tryLock(3000));
+ QVERIFY(timer.elapsed() < 3000 + systemTimersResolution);
+ normalMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ }
+ };
- Thread thread;
- thread.start();
+ Thread thread;
+ thread.start();
+
+ // TEST 1: thread can't acquire lock
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 2: thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 3: thread can't acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 4: thread can acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 5: thread can't acquire lock, timeout = 0
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 6: thread can acquire lock, timeout = 0
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 7: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ testsTurn.acquire();
+ normalMutex.lock();
+ threadsTurn.release();
+ QThread::msleep(100);
+ normalMutex.unlock();
+
+ // wait for thread to finish
+ testsTurn.acquire();
+ threadsTurn.release();
+ thread.wait();
+}
- // TEST 1: thread can't acquire lock
- testsTurn.acquire();
- normalMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- threadsTurn.release();
-
- // TEST 2: thread can acquire lock
- testsTurn.acquire();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- normalMutex.unlock();
- threadsTurn.release();
-
- // TEST 3: thread can't acquire lock, timeout = waitTime
- testsTurn.acquire();
- normalMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- threadsTurn.release();
-
- // TEST 4: thread can acquire lock, timeout = waitTime
- testsTurn.acquire();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- normalMutex.unlock();
- threadsTurn.release();
-
- // TEST 5: thread can't acquire lock, timeout = 0
- testsTurn.acquire();
- normalMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- threadsTurn.release();
-
- // TEST 6: thread can acquire lock, timeout = 0
- testsTurn.acquire();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- normalMutex.unlock();
- threadsTurn.release();
-
- // TEST 7: thread can acquire lock, timeout = 3000 (QTBUG-24795)
- testsTurn.acquire();
- normalMutex.lock();
- threadsTurn.release();
- QThread::msleep(100);
- normalMutex.unlock();
-
- // wait for thread to finish
- testsTurn.acquire();
- threadsTurn.release();
- thread.wait();
- }
+void tst_QMutex::try_lock_for_non_recursive() {
+#if !QT_HAS_INCLUDE(<chrono>)
+ QSKIP("This test requires <chrono>");
+#else
+ class Thread : public QThread
+ {
+ public:
+ void run()
+ {
+ testsTurn.release();
+
+ // TEST 1: thread can't acquire lock
+ threadsTurn.acquire();
+ QVERIFY(!normalMutex.try_lock());
+ testsTurn.release();
+
+ // TEST 2: thread can acquire lock
+ threadsTurn.acquire();
+ QVERIFY(normalMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(!normalMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 3: thread can't acquire lock, timeout = waitTime
+ threadsTurn.acquire();
+ QElapsedTimer timer;
+ timer.start();
+ QVERIFY(!normalMutex.try_lock_for(waitTimeAsDuration));
+ QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);
+ testsTurn.release();
+
+ // TEST 4: thread can acquire lock, timeout = waitTime
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.try_lock_for(waitTimeAsDuration));
+ QVERIFY(timer.elapsed() <= waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ timer.start();
+ // it's non-recursive, so the following lock needs to fail
+ QVERIFY(!normalMutex.try_lock_for(waitTimeAsDuration));
+ QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 5: thread can't acquire lock, timeout = 0
+ threadsTurn.acquire();
+ QVERIFY(!normalMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ testsTurn.release();
+
+ // TEST 6: thread can acquire lock, timeout = 0
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ QVERIFY(timer.elapsed() < waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(!normalMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 7 overflow: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.try_lock_for(std::chrono::milliseconds(3000)));
+ QVERIFY(timer.elapsed() < 3000 + systemTimersResolution);
+ normalMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ }
+ };
+
+ Thread thread;
+ thread.start();
+
+ // TEST 1: thread can't acquire lock
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 2: thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 3: thread can't acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 4: thread can acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 5: thread can't acquire lock, timeout = 0
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 6: thread can acquire lock, timeout = 0
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 7: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ testsTurn.acquire();
+ normalMutex.lock();
+ threadsTurn.release();
+ QThread::msleep(100);
+ normalMutex.unlock();
+
+ // wait for thread to finish
+ testsTurn.acquire();
+ threadsTurn.release();
+ thread.wait();
+#endif
+}
- // test recursive mutex
+void tst_QMutex::try_lock_until_non_recursive()
+{
+#if !QT_HAS_INCLUDE(<chrono>)
+ QSKIP("This test requires <chrono>");
+#else
+ class Thread : public QThread
{
- class Thread : public QThread
+ public:
+ void run()
{
- public:
- void run()
- {
- testsTurn.release();
-
- threadsTurn.acquire();
- QVERIFY(!recursiveMutex.tryLock());
- testsTurn.release();
-
- threadsTurn.acquire();
- QVERIFY(recursiveMutex.tryLock());
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- QVERIFY(recursiveMutex.tryLock());
- QVERIFY(lockCount.testAndSetRelaxed(1, 2));
- QVERIFY(lockCount.testAndSetRelaxed(2, 1));
- recursiveMutex.unlock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- recursiveMutex.unlock();
- testsTurn.release();
-
- threadsTurn.acquire();
- QTime timer;
- timer.start();
- QVERIFY(!recursiveMutex.tryLock(waitTime));
- QVERIFY(timer.elapsed() >= waitTime);
- QVERIFY(!recursiveMutex.tryLock(0));
- testsTurn.release();
-
- threadsTurn.acquire();
- timer.start();
- QVERIFY(recursiveMutex.tryLock(waitTime));
- QVERIFY(timer.elapsed() <= waitTime);
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- QVERIFY(recursiveMutex.tryLock(waitTime));
- QVERIFY(lockCount.testAndSetRelaxed(1, 2));
- QVERIFY(lockCount.testAndSetRelaxed(2, 1));
- recursiveMutex.unlock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- recursiveMutex.unlock();
- testsTurn.release();
-
- threadsTurn.acquire();
- QVERIFY(!recursiveMutex.tryLock(0));
- QVERIFY(!recursiveMutex.tryLock(0));
- testsTurn.release();
-
- threadsTurn.acquire();
- timer.start();
- QVERIFY(recursiveMutex.tryLock(0));
- QVERIFY(timer.elapsed() < waitTime);
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- QVERIFY(recursiveMutex.tryLock(0));
- QVERIFY(lockCount.testAndSetRelaxed(1, 2));
- QVERIFY(lockCount.testAndSetRelaxed(2, 1));
- recursiveMutex.unlock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- recursiveMutex.unlock();
- testsTurn.release();
-
- threadsTurn.acquire();
- }
- };
+ const std::chrono::milliseconds systemTimersResolutionAsDuration(systemTimersResolution);
+ testsTurn.release();
+
+ // TEST 1: thread can't acquire lock
+ threadsTurn.acquire();
+ QVERIFY(!normalMutex.try_lock());
+ testsTurn.release();
+
+ // TEST 2: thread can acquire lock
+ threadsTurn.acquire();
+ QVERIFY(normalMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(!normalMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 3: thread can't acquire lock, timeout = waitTime
+ threadsTurn.acquire();
+ auto endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ QVERIFY(!normalMutex.try_lock_until(endTimePoint));
+ QVERIFY(std::chrono::steady_clock::now() >= endTimePoint - systemTimersResolutionAsDuration);
+ testsTurn.release();
+
+ // TEST 4: thread can acquire lock, timeout = waitTime
+ threadsTurn.acquire();
+ endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ QVERIFY(normalMutex.try_lock_until(endTimePoint));
+ QVERIFY(std::chrono::steady_clock::now() <= endTimePoint + systemTimersResolutionAsDuration);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ // it's non-recursive, so the following lock needs to fail
+ QVERIFY(!normalMutex.try_lock_until(endTimePoint));
+ QVERIFY(std::chrono::steady_clock::now() >= endTimePoint - systemTimersResolutionAsDuration);
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 5: thread can't acquire lock, timeout = 0
+ threadsTurn.acquire();
+ QVERIFY(!normalMutex.try_lock_until(std::chrono::steady_clock::now()));
+ testsTurn.release();
+
+ // TEST 6: thread can acquire lock, timeout = 0
+ threadsTurn.acquire();
+ endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ QVERIFY(normalMutex.try_lock_until(std::chrono::steady_clock::now()));
+ QVERIFY(std::chrono::steady_clock::now() < endTimePoint + systemTimersResolutionAsDuration);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(!normalMutex.try_lock_until(std::chrono::steady_clock::now()));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ // TEST 7 overflow: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ threadsTurn.acquire();
+ endTimePoint = std::chrono::steady_clock::now() + std::chrono::milliseconds(3000);
+ QVERIFY(normalMutex.try_lock_until(endTimePoint));
+ QVERIFY(std::chrono::steady_clock::now() < endTimePoint + systemTimersResolutionAsDuration);
+ normalMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ }
+ };
- Thread thread;
- thread.start();
+ Thread thread;
+ thread.start();
+
+ // TEST 1: thread can't acquire lock
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 2: thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 3: thread can't acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 4: thread can acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 5: thread can't acquire lock, timeout = 0
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // TEST 6: thread can acquire lock, timeout = 0
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // TEST 7: thread can acquire lock, timeout = 3000 (QTBUG-24795)
+ testsTurn.acquire();
+ normalMutex.lock();
+ threadsTurn.release();
+ QThread::msleep(100);
+ normalMutex.unlock();
+
+ // wait for thread to finish
+ testsTurn.acquire();
+ threadsTurn.release();
+ thread.wait();
+#endif
+}
- // thread can't acquire lock
- testsTurn.acquire();
- recursiveMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- recursiveMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 2));
- threadsTurn.release();
-
- // thread can acquire lock
- testsTurn.acquire();
- QVERIFY(lockCount.testAndSetRelaxed(2, 1));
- recursiveMutex.unlock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- recursiveMutex.unlock();
- threadsTurn.release();
-
- // thread can't acquire lock, timeout = waitTime
- testsTurn.acquire();
- recursiveMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- recursiveMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 2));
- threadsTurn.release();
-
- // thread can acquire lock, timeout = waitTime
- testsTurn.acquire();
- QVERIFY(lockCount.testAndSetRelaxed(2, 1));
- recursiveMutex.unlock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- recursiveMutex.unlock();
- threadsTurn.release();
-
- // thread can't acquire lock, timeout = 0
- testsTurn.acquire();
- recursiveMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(0, 1));
- recursiveMutex.lock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 2));
- threadsTurn.release();
-
- // thread can acquire lock, timeout = 0
- testsTurn.acquire();
- QVERIFY(lockCount.testAndSetRelaxed(2, 1));
- recursiveMutex.unlock();
- QVERIFY(lockCount.testAndSetRelaxed(1, 0));
- recursiveMutex.unlock();
- threadsTurn.release();
-
- // stop thread
- testsTurn.acquire();
- threadsTurn.release();
- thread.wait();
- }
+void tst_QMutex::tryLock_recursive()
+{
+ class Thread : public QThread
+ {
+ public:
+ void run()
+ {
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(!recursiveMutex.tryLock());
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(recursiveMutex.tryLock());
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.tryLock());
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QElapsedTimer timer;
+ timer.start();
+ QVERIFY(!recursiveMutex.tryLock(waitTime));
+ QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);
+ QVERIFY(!recursiveMutex.tryLock(0));
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(recursiveMutex.tryLock(waitTime));
+ QVERIFY(timer.elapsed() <= waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.tryLock(waitTime));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(!recursiveMutex.tryLock(0));
+ QVERIFY(!recursiveMutex.tryLock(0));
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(recursiveMutex.tryLock(0));
+ QVERIFY(timer.elapsed() < waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.tryLock(0));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ }
+ };
+
+ Thread thread;
+ thread.start();
+
+ // thread can't acquire lock
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = 0
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock, timeout = 0
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // stop thread
+ testsTurn.acquire();
+ threadsTurn.release();
+ thread.wait();
+}
+
+void tst_QMutex::try_lock_for_recursive()
+{
+#if !QT_HAS_INCLUDE(<chrono>)
+ QSKIP("This test requires <chrono>");
+#else
+ class Thread : public QThread
+ {
+ public:
+ void run()
+ {
+ const std::chrono::milliseconds systemTimersResolutionAsDuration(systemTimersResolution);
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(!recursiveMutex.try_lock());
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(recursiveMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QElapsedTimer timer;
+ timer.start();
+ QVERIFY(!recursiveMutex.try_lock_for(waitTimeAsDuration));
+ QVERIFY(timer.elapsed() >= waitTime - systemTimersResolution);
+ QVERIFY(!recursiveMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(recursiveMutex.try_lock_for(waitTimeAsDuration));
+ QVERIFY(timer.elapsed() <= waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.try_lock_for(waitTimeAsDuration));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(!recursiveMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ QVERIFY(!recursiveMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(recursiveMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ QVERIFY(timer.elapsed() < waitTime + systemTimersResolution);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.try_lock_for(std::chrono::milliseconds::zero()));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ }
+ };
+
+ Thread thread;
+ thread.start();
+
+ // thread can't acquire lock
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = 0
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock, timeout = 0
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // stop thread
+ testsTurn.acquire();
+ threadsTurn.release();
+ thread.wait();
+#endif
+}
+
+void tst_QMutex::try_lock_until_recursive()
+{
+#if !QT_HAS_INCLUDE(<chrono>)
+ QSKIP("This test requires <chrono>");
+#else
+ class Thread : public QThread
+ {
+ public:
+ void run()
+ {
+ const std::chrono::milliseconds systemTimersResolutionAsDuration(systemTimersResolution);
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(!recursiveMutex.try_lock());
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(recursiveMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.try_lock());
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ auto endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ QVERIFY(!recursiveMutex.try_lock_until(endTimePoint));
+ QVERIFY(std::chrono::steady_clock::now() >= endTimePoint - systemTimersResolutionAsDuration);
+ QVERIFY(!recursiveMutex.try_lock());
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ QVERIFY(recursiveMutex.try_lock_until(endTimePoint));
+ QVERIFY(std::chrono::steady_clock::now() <= endTimePoint + systemTimersResolutionAsDuration);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ QVERIFY(recursiveMutex.try_lock_until(endTimePoint));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ QVERIFY(!recursiveMutex.try_lock_until(std::chrono::steady_clock::now()));
+ QVERIFY(!recursiveMutex.try_lock_until(std::chrono::steady_clock::now()));
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ endTimePoint = std::chrono::steady_clock::now() + waitTimeAsDuration;
+ QVERIFY(recursiveMutex.try_lock_until(std::chrono::steady_clock::now()));
+ QVERIFY(std::chrono::steady_clock::now() <= endTimePoint + systemTimersResolutionAsDuration);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.try_lock_until(std::chrono::steady_clock::now()));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ }
+ };
+
+ Thread thread;
+ thread.start();
+
+ // thread can't acquire lock
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock, timeout = waitTime
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = 0
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock, timeout = 0
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // stop thread
+ testsTurn.acquire();
+ threadsTurn.release();
+ thread.wait();
+#endif
}
class mutex_Thread : public QThread
@@ -439,7 +1014,7 @@ enum { one_minute = 6 * 1000, //not really one minute, but else it is too long.
class StressTestThread : public QThread
{
- QTime t;
+ QElapsedTimer t;
public:
static QBasicAtomicInt lockCount;
static QBasicAtomicInt sentinel;
@@ -491,7 +1066,7 @@ public:
void run()
{
- QTime t;
+ QElapsedTimer t;
t.start();
do {
if (mutex.tryLock())
@@ -619,7 +1194,7 @@ void tst_QMutex::tryLockNegative()
class MoreStressTestThread : public QThread
{
- QTime t;
+ QElapsedTimer t;
public:
static QAtomicInt lockCount;
static QAtomicInt sentinel[threadCount];
diff --git a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp
index 341bd21e5a..8597bf1a6d 100644
--- a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp
+++ b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp
@@ -350,15 +350,9 @@ const int AlphabetSize = sizeof(alphabet) - 1;
const int BufferSize = 4096; // GCD of BufferSize and alphabet size must be 1
char buffer[BufferSize];
-#ifndef Q_OS_WINCE
const int ProducerChunkSize = 3;
const int ConsumerChunkSize = 7;
const int Multiplier = 10;
-#else
-const int ProducerChunkSize = 2;
-const int ConsumerChunkSize = 5;
-const int Multiplier = 3;
-#endif
// note: the code depends on the fact that DataSize is a multiple of
// ProducerChunkSize, ConsumerChunkSize, and BufferSize
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index b4d0866d01..06b27f79cd 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -95,9 +95,7 @@ private slots:
void requestTermination();
-#ifndef Q_OS_WINCE
void stressTest();
-#endif
void quitLock();
};
@@ -664,7 +662,7 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data)
#if defined Q_OS_UNIX
const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this);
Q_UNUSED(state);
-#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#elif defined(Q_OS_WINRT)
nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL);
#elif defined Q_OS_WIN
unsigned thrdid = 0;
@@ -684,11 +682,7 @@ void NativeThreadWrapper::join()
#if defined Q_OS_UNIX
pthread_join(nativeThreadHandle, 0);
#elif defined Q_OS_WIN
-#ifndef Q_OS_WINCE
WaitForSingleObjectEx(nativeThreadHandle, INFINITE, FALSE);
-#else
- WaitForSingleObject(nativeThreadHandle, INFINITE);
-#endif
CloseHandle(nativeThreadHandle);
#endif
}
@@ -874,13 +868,8 @@ void tst_QThread::adoptedThreadExecFinished()
void tst_QThread::adoptMultipleThreads()
{
#if defined(Q_OS_WIN)
- // Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
-# if defined(Q_OS_WINCE)
- const int numThreads = 20;
-# else
// need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher()
const int numThreads = 200;
-# endif
#else
const int numThreads = 5;
#endif
@@ -911,13 +900,8 @@ void tst_QThread::adoptMultipleThreads()
void tst_QThread::adoptMultipleThreadsOverlap()
{
#if defined(Q_OS_WIN)
- // Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
-# if defined(Q_OS_WINCE)
- const int numThreads = 20;
-# else
// need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher()
const int numThreads = 200;
-# endif
#else
const int numThreads = 5;
#endif
@@ -950,7 +934,6 @@ void tst_QThread::adoptMultipleThreadsOverlap()
QCOMPARE(recorder.activationCount.load(), numThreads);
}
-#ifndef Q_OS_WINCE
// Disconnects on WinCE
void tst_QThread::stressTest()
{
@@ -962,7 +945,6 @@ void tst_QThread::stressTest()
t.wait(one_minute);
}
}
-#endif
class Syncronizer : public QObject
{ Q_OBJECT
diff --git a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp
index ba64bf2963..a9af182ed8 100644
--- a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp
+++ b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp
@@ -120,7 +120,7 @@ void tst_QThreadOnce::sameThread()
void tst_QThreadOnce::multipleThreads()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
+#if defined(Q_OS_VXWORKS)
const int NumberOfThreads = 20;
#else
const int NumberOfThreads = 100;
diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
index f3eba5c823..49a3b3e4db 100644
--- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
+++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
@@ -40,10 +40,8 @@
#include <pthread.h>
#endif
#ifdef Q_OS_WIN
-#ifndef Q_OS_WINCE
-#include <process.h>
-#endif
-#include <windows.h>
+# include <process.h>
+# include <qt_windows.h>
#endif
class tst_QThreadStorage : public QObject
@@ -202,6 +200,13 @@ void testAdoptedThreadStorageWin(void *p)
}
QObject::connect(QThread::currentThread(), SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
}
+#ifdef Q_OS_WINRT
+unsigned __stdcall testAdoptedThreadStorageWinRT(void *p)
+{
+ testAdoptedThreadStorageWin(p);
+ return 0;
+}
+#endif
void *testAdoptedThreadStorageUnix(void *pointers)
{
testAdoptedThreadStorageWin(pointers);
@@ -219,13 +224,14 @@ void tst_QThreadStorage::adoptedThreads()
const int state = pthread_create(&thread, 0, testAdoptedThreadStorageUnix, &pointers);
QCOMPARE(state, 0);
pthread_join(thread, 0);
-#elif defined Q_OS_WIN && !defined(Q_OS_WINRT)
+#elif defined Q_OS_WINRT
+ HANDLE thread;
+ thread = (HANDLE) _beginthreadex(NULL, 0, testAdoptedThreadStorageWinRT, &pointers, 0, 0);
+ QVERIFY(thread);
+ WaitForSingleObjectEx(thread, INFINITE, FALSE);
+#elif defined Q_OS_WIN
HANDLE thread;
-#if defined(Q_OS_WINCE)
- thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)testAdoptedThreadStorageWin, &pointers, 0, NULL);
-#else
thread = (HANDLE)_beginthread(testAdoptedThreadStorageWin, 0, &pointers);
-#endif
QVERIFY(thread);
WaitForSingleObject(thread, INFINITE);
#endif
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index a100de4c41..310c5f6fd3 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -34,9 +34,6 @@
#include <qhash.h>
#include <limits.h>
#include <private/qtools_p.h>
-#if defined(Q_OS_WINCE)
-#include <qcoreapplication.h>
-#endif
class tst_QByteArray : public QObject
{
@@ -246,11 +243,7 @@ void tst_QByteArray::qCompress_data()
{
QTest::addColumn<QByteArray>("ba");
-#ifndef Q_OS_WINCE
const int size1 = 1024*1024;
-#else
- const int size1 = 1024;
-#endif
QByteArray ba1( size1, 0 );
QTest::newRow( "00" ) << QByteArray();
@@ -267,11 +260,6 @@ void tst_QByteArray::qCompress_data()
ba1.fill( 'A' );
QTest::newRow( "03" ) << ba1;
-#if defined(Q_OS_WINCE)
- int tmpArgc = 0;
- char** tmpArgv = 0;
- QCoreApplication app(tmpArgc, tmpArgv);
-#endif
QFile file( QFINDTESTDATA("rfc3252.txt") );
QVERIFY( file.open(QIODevice::ReadOnly) );
QTest::newRow( "04" ) << file.readAll();
@@ -728,7 +716,7 @@ void tst_QByteArray::qvsnprintf()
memset(buf, 42, sizeof(buf));
#ifdef Q_OS_WIN
// VS 2005 uses the Qt implementation of vsnprintf.
-# if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
+# if defined(_MSC_VER)
QCOMPARE(::qsnprintf(buf, 3, "%s", "bubu"), -1);
QCOMPARE(static_cast<const char*>(buf), "bu");
# else
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index e51f5d4694..92585fd471 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -31,9 +31,6 @@
#include <qfile.h>
#include <qstringlist.h>
#include <private/qunicodetables_p.h>
-#if defined(Q_OS_WINCE)
-#include <qcoreapplication.h>
-#endif
class tst_QChar : public QObject
{
diff --git a/tests/auto/corelib/tools/qcollator/qcollator.pro b/tests/auto/corelib/tools/qcollator/qcollator.pro
index ed879ee70e..2f3995a75f 100644
--- a/tests/auto/corelib/tools/qcollator/qcollator.pro
+++ b/tests/auto/corelib/tools/qcollator/qcollator.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qcollator
-QT = core testlib
+QT = core-private testlib
SOURCES = tst_qcollator.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU
+qtConfig(icu): DEFINES += QT_USE_ICU
diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
index 36bc8621d2..30c7b1bf69 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
@@ -71,8 +71,12 @@ int main(int argc, char *argv[])
// A hidden option
QCommandLineOption hiddenOption(QStringList() << QStringLiteral("hidden"));
hiddenOption.setDescription(QStringLiteral("THIS SHOULD NEVER APPEAR"));
- hiddenOption.setHidden(true);
+ hiddenOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(hiddenOption);
+ QCommandLineOption hiddenOption2(QStringList() << QStringLiteral("hidden2"));
+ hiddenOption2.setDescription(QStringLiteral("NEITHER SHOULD THIS"));
+ hiddenOption2.setHidden(true);
+ parser.addOption(hiddenOption2);
// This program supports different options depending on the "command" (first argument).
// Call parse() to find out the positional arguments.
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index 9552152136..a54ad3d9c9 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -450,6 +450,13 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes_data()
<< QStringList("abc") << QStringList("val");
QTest::newRow("implicitlylong_with_space") << QCommandLineParser::ParseAsCompactedShortOptions << (QStringList() << "-c" << "val")
<< QStringList("c") << QStringList("val");
+
+ QTest::newRow("forceshort_detached") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I" << "45")
+ << QStringList("I") << QStringList("45");
+ QTest::newRow("forceshort_attached") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I46")
+ << QStringList("I") << QStringList("46");
+ QTest::newRow("forceshort_mixed") << QCommandLineParser::ParseAsLongOptions << (QStringList() << "-I45" << "-nn")
+ << (QStringList() << "I" << "nn") << QStringList("45");
}
void tst_QCommandLineParser::testSingleDashWordOptionModes()
@@ -468,6 +475,10 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes()
parser.addOption(QCommandLineOption("b", QStringLiteral("b option.")));
parser.addOption(QCommandLineOption(QStringList() << "c" << "abc", QStringLiteral("c option."), QStringLiteral("value")));
parser.addOption(QCommandLineOption("nn", QStringLiteral("nn option.")));
+ QCommandLineOption forceShort(QStringLiteral("I"), QStringLiteral("always short option"),
+ QStringLiteral("path"), QStringLiteral("default"));
+ forceShort.setFlags(QCommandLineOption::ShortOptionStyle);
+ parser.addOption(forceShort);
QVERIFY(parser.parse(commandLine));
QCOMPARE(parser.optionNames(), expectedOptionNames);
for (int i = 0; i < expectedOptionValues.count(); ++i)
@@ -501,9 +512,6 @@ void tst_QCommandLineParser::testVersionOption()
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess support");
#else
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
#if defined(Q_OS_ANDROID)
QSKIP("Deploying executable applications to file system on Android not supported.");
#endif
@@ -570,9 +578,6 @@ void tst_QCommandLineParser::testHelpOption()
#ifdef QT_NO_PROCESS
QSKIP("This test requires QProcess support");
#else
-#ifdef Q_OS_WINCE
- QSKIP("Reading and writing to a process is not supported on Qt/CE");
-#endif
#if defined(Q_OS_ANDROID)
QSKIP("Deploying executable applications to file system on Android not supported.");
#endif
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index cfec327319..0404a276ff 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -28,10 +28,7 @@
****************************************************************************/
#include <QtTest/QtTest>
-#ifndef Q_OS_WINCE
#include <time.h>
-#endif
-
#include <qdatetime.h>
#include <private/qdatetime_p.h>
@@ -62,8 +59,8 @@ private slots:
void date();
void time();
void timeSpec();
- void toTime_t_data();
- void toTime_t();
+ void toSecsSinceEpoch_data();
+ void toSecsSinceEpoch();
void daylightSavingsTimeChange_data();
void daylightSavingsTimeChange();
void springForward_data();
@@ -73,7 +70,7 @@ private slots:
void setTime();
void setTimeSpec_data();
void setTimeSpec();
- void setTime_t();
+ void setSecsSinceEpoch();
void setMSecsSinceEpoch_data();
void setMSecsSinceEpoch();
void fromMSecsSinceEpoch_data();
@@ -108,10 +105,8 @@ private slots:
void msecsTo();
void operator_eqeq_data();
void operator_eqeq();
-#ifndef Q_OS_WINCE
void operator_insert_extract_data();
void operator_insert_extract();
-#endif
void currentDateTime();
void currentDateTimeUtc();
void currentDateTimeUtc2();
@@ -180,22 +175,22 @@ tst_QDateTime::tst_QDateTime()
differently, so don't probe them here.
*/
const uint day = 24 * 3600; // in seconds
- zoneIsCET = (QDateTime(QDate(2038, 1, 19), QTime(4, 14, 7)).toTime_t() == 0x7fffffff
+ zoneIsCET = (QDateTime(QDate(2038, 1, 19), QTime(4, 14, 7)).toSecsSinceEpoch() == 0x7fffffff
// Entries a year apart robustly differ by multiples of day.
- && QDateTime(QDate(2015, 7, 1), QTime()).toTime_t() == 1435701600
- && QDateTime(QDate(2015, 1, 1), QTime()).toTime_t() == 1420066800
- && QDateTime(QDate(2013, 7, 1), QTime()).toTime_t() == 1372629600
- && QDateTime(QDate(2013, 1, 1), QTime()).toTime_t() == 1356994800
- && QDateTime(QDate(2012, 7, 1), QTime()).toTime_t() == 1341093600
- && QDateTime(QDate(2012, 1, 1), QTime()).toTime_t() == 1325372400
- && QDateTime(QDate(2008, 7, 1), QTime()).toTime_t() == 1214863200
- && QDateTime(QDate(2004, 1, 1), QTime()).toTime_t() == 1072911600
- && QDateTime(QDate(2000, 1, 1), QTime()).toTime_t() == 946681200
- && QDateTime(QDate(1990, 7, 1), QTime()).toTime_t() == 646783200
- && QDateTime(QDate(1990, 1, 1), QTime()).toTime_t() == 631148400
- && QDateTime(QDate(1979, 1, 1), QTime()).toTime_t() == 283993200
- // .toTime_t() returns -1 for everything before this:
- && QDateTime(QDate(1970, 1, 1), QTime(1, 0, 0)).toTime_t() == 0);
+ && QDateTime(QDate(2015, 7, 1), QTime()).toSecsSinceEpoch() == 1435701600
+ && QDateTime(QDate(2015, 1, 1), QTime()).toSecsSinceEpoch() == 1420066800
+ && QDateTime(QDate(2013, 7, 1), QTime()).toSecsSinceEpoch() == 1372629600
+ && QDateTime(QDate(2013, 1, 1), QTime()).toSecsSinceEpoch() == 1356994800
+ && QDateTime(QDate(2012, 7, 1), QTime()).toSecsSinceEpoch() == 1341093600
+ && QDateTime(QDate(2012, 1, 1), QTime()).toSecsSinceEpoch() == 1325372400
+ && QDateTime(QDate(2008, 7, 1), QTime()).toSecsSinceEpoch() == 1214863200
+ && QDateTime(QDate(2004, 1, 1), QTime()).toSecsSinceEpoch() == 1072911600
+ && QDateTime(QDate(2000, 1, 1), QTime()).toSecsSinceEpoch() == 946681200
+ && QDateTime(QDate(1990, 7, 1), QTime()).toSecsSinceEpoch() == 646783200
+ && QDateTime(QDate(1990, 1, 1), QTime()).toSecsSinceEpoch() == 631148400
+ && QDateTime(QDate(1979, 1, 1), QTime()).toSecsSinceEpoch() == 283993200
+ // .toSecsSinceEpoch() returns -1 for everything before this:
+ && QDateTime(QDate(1970, 1, 1), QTime(1, 0, 0)).toSecsSinceEpoch() == 0);
// Use .toMSecsSinceEpoch() if you really need to test anything earlier.
/*
@@ -207,12 +202,12 @@ tst_QDateTime::tst_QDateTime()
*/
const int sampled = 3;
// UTC starts of months in 2004, 2038 and 1970:
- uint jans[sampled] = { 12418 * day, 24837 * day, 0 };
- uint juls[sampled] = { 12600 * day, 25018 * day, 181 * day };
+ qint64 jans[sampled] = { 12418 * day, 24837 * day, 0 };
+ qint64 juls[sampled] = { 12600 * day, 25018 * day, 181 * day };
localTimeType = LocalTimeIsUtc;
for (int i = sampled; i-- > 0; ) {
- QDateTime jan = QDateTime::fromTime_t(jans[i]);
- QDateTime jul = QDateTime::fromTime_t(juls[i]);
+ QDateTime jan = QDateTime::fromSecsSinceEpoch(jans[i]);
+ QDateTime jul = QDateTime::fromSecsSinceEpoch(juls[i]);
if (jan.date().year() < 1970 || jul.date().month() < 7) {
localTimeType = LocalTimeBehindUtc;
break;
@@ -259,9 +254,7 @@ void tst_QDateTime::initTestCase()
void tst_QDateTime::init()
{
-#if defined(Q_OS_WINCE)
- SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
-#elif defined(Q_OS_WIN32)
+#if defined(Q_OS_WIN32)
SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
#endif
}
@@ -523,52 +516,52 @@ void tst_QDateTime::setTimeSpec()
QCOMPARE(dateTime.timeSpec(), newTimeSpec);
}
-void tst_QDateTime::setTime_t()
+void tst_QDateTime::setSecsSinceEpoch()
{
QDateTime dt1;
- dt1.setTime_t(0);
+ dt1.setSecsSinceEpoch(0);
QCOMPARE(dt1.toUTC(), QDateTime(QDate(1970, 1, 1), QTime(), Qt::UTC));
QCOMPARE(dt1.timeSpec(), Qt::LocalTime);
dt1.setTimeSpec(Qt::UTC);
- dt1.setTime_t(0);
+ dt1.setSecsSinceEpoch(0);
QCOMPARE(dt1, QDateTime(QDate(1970, 1, 1), QTime(), Qt::UTC));
QCOMPARE(dt1.timeSpec(), Qt::UTC);
- dt1.setTime_t(123456);
+ dt1.setSecsSinceEpoch(123456);
QCOMPARE(dt1, QDateTime(QDate(1970, 1, 2), QTime(10, 17, 36), Qt::UTC));
if (zoneIsCET) {
QDateTime dt2;
- dt2.setTime_t(123456);
+ dt2.setSecsSinceEpoch(123456);
QCOMPARE(dt2, QDateTime(QDate(1970, 1, 2), QTime(11, 17, 36), Qt::LocalTime));
}
- dt1.setTime_t((uint)(quint32)-123456);
+ dt1.setSecsSinceEpoch((uint)(quint32)-123456);
QCOMPARE(dt1, QDateTime(QDate(2106, 2, 5), QTime(20, 10, 40), Qt::UTC));
if (zoneIsCET) {
QDateTime dt2;
- dt2.setTime_t((uint)(quint32)-123456);
+ dt2.setSecsSinceEpoch((uint)(quint32)-123456);
QCOMPARE(dt2, QDateTime(QDate(2106, 2, 5), QTime(21, 10, 40), Qt::LocalTime));
}
- dt1.setTime_t(1214567890);
+ dt1.setSecsSinceEpoch(1214567890);
QCOMPARE(dt1, QDateTime(QDate(2008, 6, 27), QTime(11, 58, 10), Qt::UTC));
if (zoneIsCET) {
QDateTime dt2;
- dt2.setTime_t(1214567890);
+ dt2.setSecsSinceEpoch(1214567890);
QCOMPARE(dt2, QDateTime(QDate(2008, 6, 27), QTime(13, 58, 10), Qt::LocalTime));
}
- dt1.setTime_t(0x7FFFFFFF);
+ dt1.setSecsSinceEpoch(0x7FFFFFFF);
QCOMPARE(dt1, QDateTime(QDate(2038, 1, 19), QTime(3, 14, 7), Qt::UTC));
if (zoneIsCET) {
QDateTime dt2;
- dt2.setTime_t(0x7FFFFFFF);
+ dt2.setSecsSinceEpoch(0x7FFFFFFF);
QCOMPARE(dt2, QDateTime(QDate(2038, 1, 19), QTime(4, 14, 7), Qt::LocalTime));
}
dt1 = QDateTime(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::OffsetFromUTC, 60 * 60);
- dt1.setTime_t(123456);
+ dt1.setSecsSinceEpoch(123456);
QCOMPARE(dt1, QDateTime(QDate(1970, 1, 2), QTime(10, 17, 36), Qt::UTC));
QCOMPARE(dt1.timeSpec(), Qt::OffsetFromUTC);
QCOMPARE(dt1.offsetFromUtc(), 60 * 60);
@@ -672,7 +665,7 @@ void tst_QDateTime::setMSecsSinceEpoch()
QCOMPARE(dt.toMSecsSinceEpoch(), msecs);
if (quint64(msecs / 1000) < 0xFFFFFFFF) {
- QCOMPARE(qint64(dt.toTime_t()), msecs / 1000);
+ QCOMPARE(qint64(dt.toSecsSinceEpoch()), msecs / 1000);
}
QDateTime reference(QDate(1970, 1, 1), QTime(), Qt::UTC);
@@ -723,9 +716,9 @@ void tst_QDateTime::fromMSecsSinceEpoch()
QCOMPARE(dtOffset.toMSecsSinceEpoch(), msecs);
if (quint64(msecs / 1000) < 0xFFFFFFFF) {
- QCOMPARE(qint64(dtLocal.toTime_t()), msecs / 1000);
- QCOMPARE(qint64(dtUtc.toTime_t()), msecs / 1000);
- QCOMPARE(qint64(dtOffset.toTime_t()), msecs / 1000);
+ QCOMPARE(qint64(dtLocal.toSecsSinceEpoch()), msecs / 1000);
+ QCOMPARE(qint64(dtUtc.toSecsSinceEpoch()), msecs / 1000);
+ QCOMPARE(qint64(dtOffset.toSecsSinceEpoch()), msecs / 1000);
}
QDateTime reference(QDate(1970, 1, 1), QTime(), Qt::UTC);
@@ -1429,27 +1422,19 @@ void tst_QDateTime::msecsTo()
void tst_QDateTime::currentDateTime()
{
-#if defined(Q_OS_WINCE)
- __time64_t buf1, buf2;
- ::_time64(&buf1);
-#else
time_t buf1, buf2;
::time(&buf1);
-#endif
QDateTime lowerBound;
- lowerBound.setTime_t(buf1);
+ lowerBound.setSecsSinceEpoch(buf1);
QDateTime dt1 = QDateTime::currentDateTime();
QDateTime dt2 = QDateTime::currentDateTime().toLocalTime();
QDateTime dt3 = QDateTime::currentDateTime().toUTC();
-#if defined(Q_OS_WINCE)
- ::_time64(&buf2);
-#else
::time(&buf2);
-#endif
+
QDateTime upperBound;
- upperBound.setTime_t(buf2);
+ upperBound.setSecsSinceEpoch(buf2);
// Note we must add 2 seconds here because time() may return up to
// 1 second difference from the more accurate method used by QDateTime::currentDateTime()
upperBound = upperBound.addSecs(2);
@@ -1460,11 +1445,11 @@ void tst_QDateTime::currentDateTime()
"dt2: %3\n"
"dt3: %4\n"
"upperBound: %5\n")
- .arg(lowerBound.toTime_t())
- .arg(dt1.toTime_t())
- .arg(dt2.toTime_t())
- .arg(dt3.toTime_t())
- .arg(upperBound.toTime_t());
+ .arg(lowerBound.toSecsSinceEpoch())
+ .arg(dt1.toSecsSinceEpoch())
+ .arg(dt2.toSecsSinceEpoch())
+ .arg(dt3.toSecsSinceEpoch())
+ .arg(upperBound.toSecsSinceEpoch());
QVERIFY2(lowerBound < upperBound, qPrintable(details));
@@ -1482,27 +1467,20 @@ void tst_QDateTime::currentDateTime()
void tst_QDateTime::currentDateTimeUtc()
{
-#if defined(Q_OS_WINCE)
- __time64_t buf1, buf2;
- ::_time64(&buf1);
-#else
time_t buf1, buf2;
::time(&buf1);
-#endif
+
QDateTime lowerBound;
- lowerBound.setTime_t(buf1);
+ lowerBound.setSecsSinceEpoch(buf1);
QDateTime dt1 = QDateTime::currentDateTimeUtc();
QDateTime dt2 = QDateTime::currentDateTimeUtc().toLocalTime();
QDateTime dt3 = QDateTime::currentDateTimeUtc().toUTC();
-#if defined(Q_OS_WINCE)
- ::_time64(&buf2);
-#else
::time(&buf2);
-#endif
+
QDateTime upperBound;
- upperBound.setTime_t(buf2);
+ upperBound.setSecsSinceEpoch(buf2);
// Note we must add 2 seconds here because time() may return up to
// 1 second difference from the more accurate method used by QDateTime::currentDateTime()
upperBound = upperBound.addSecs(2);
@@ -1513,11 +1491,11 @@ void tst_QDateTime::currentDateTimeUtc()
"dt2: %3\n"
"dt3: %4\n"
"upperBound: %5\n")
- .arg(lowerBound.toTime_t())
- .arg(dt1.toTime_t())
- .arg(dt2.toTime_t())
- .arg(dt3.toTime_t())
- .arg(upperBound.toTime_t());
+ .arg(lowerBound.toSecsSinceEpoch())
+ .arg(dt1.toSecsSinceEpoch())
+ .arg(dt2.toSecsSinceEpoch())
+ .arg(dt3.toSecsSinceEpoch())
+ .arg(upperBound.toSecsSinceEpoch());
QVERIFY2(lowerBound < upperBound, qPrintable(details));
@@ -1562,14 +1540,14 @@ void tst_QDateTime::currentDateTimeUtc2()
QCOMPARE(local.toUTC(), utc);
QCOMPARE(utc.toLocalTime(), local);
- // and finally, the time_t should equal our number
- QCOMPARE(qint64(utc.toTime_t()), msec / 1000);
- QCOMPARE(qint64(local.toTime_t()), msec / 1000);
+ // and finally, the SecsSinceEpoch should equal our number
+ QCOMPARE(qint64(utc.toSecsSinceEpoch()), msec / 1000);
+ QCOMPARE(qint64(local.toSecsSinceEpoch()), msec / 1000);
QCOMPARE(utc.toMSecsSinceEpoch(), msec);
QCOMPARE(local.toMSecsSinceEpoch(), msec);
}
-void tst_QDateTime::toTime_t_data()
+void tst_QDateTime::toSecsSinceEpoch_data()
{
QTest::addColumn<QString>("dateTimeStr");
QTest::addColumn<bool>("res");
@@ -1585,11 +1563,12 @@ void tst_QDateTime::toTime_t_data()
<< bool( sizeof(uint) > 32 && sizeof(time_t) > 32 );
}
-void tst_QDateTime::toTime_t()
+void tst_QDateTime::toSecsSinceEpoch()
{
QFETCH( QString, dateTimeStr );
QDateTime datetime = dt( dateTimeStr );
+ qint64 asSecsSinceEpoch = datetime.toSecsSinceEpoch();
uint asTime_t = datetime.toTime_t();
QFETCH( bool, res );
if (res) {
@@ -1597,11 +1576,14 @@ void tst_QDateTime::toTime_t()
} else {
QVERIFY( asTime_t == (uint)-1 );
}
+ QCOMPARE(asSecsSinceEpoch, datetime.toMSecsSinceEpoch() / 1000);
if ( asTime_t != (uint) -1 ) {
QDateTime datetime2 = QDateTime::fromTime_t( asTime_t );
QCOMPARE(datetime, datetime2);
}
+ QDateTime datetime2 = QDateTime::fromSecsSinceEpoch(asSecsSinceEpoch);
+ QCOMPARE(datetime, datetime2);
}
void tst_QDateTime::daylightSavingsTimeChange_data()
@@ -1640,7 +1622,7 @@ void tst_QDateTime::daylightSavingsTimeChange()
// First with simple construction
QDateTime dt = QDateTime(outDST, QTime(0, 0, 0), Qt::LocalTime);
- int outDSTsecs = dt.toTime_t();
+ int outDSTsecs = dt.toSecsSinceEpoch();
dt.setDate(inDST);
dt = dt.addSecs(1);
@@ -1662,8 +1644,8 @@ void tst_QDateTime::daylightSavingsTimeChange()
dt = dt.addMonths(-months).addSecs(1);
QCOMPARE(dt, QDateTime(inDST, QTime(0, 0, 5)));
- // now using fromTime_t
- dt = QDateTime::fromTime_t(outDSTsecs);
+ // now using fromSecsSinceEpoch
+ dt = QDateTime::fromSecsSinceEpoch(outDSTsecs);
QCOMPARE(dt, QDateTime(outDST, QTime(0, 0, 0)));
dt.setDate(inDST);
@@ -1717,7 +1699,7 @@ void tst_QDateTime::springForward_data()
QTest::addColumn<int>("adjust"); // minutes ahead of UTC on day stepped from
/*
- Zone tests compare a summer and winter moment's time_t to known values.
+ Zone tests compare a summer and winter moment's SecsSinceEpoch to known values.
This could in principle be flawed (two DST-using zones in the same
hemisphere with the same DST and standard times but different transition
times) but no actual example is known where this is a problem. Please
@@ -1727,8 +1709,8 @@ void tst_QDateTime::springForward_data()
test.
*/
- uint winter = QDateTime(QDate(2015, 1, 1), QTime()).toTime_t();
- uint summer = QDateTime(QDate(2015, 7, 1), QTime()).toTime_t();
+ uint winter = QDateTime(QDate(2015, 1, 1), QTime()).toSecsSinceEpoch();
+ uint summer = QDateTime(QDate(2015, 7, 1), QTime()).toSecsSinceEpoch();
if (winter == 1420066800 && summer == 1435701600) {
QTest::newRow("CET from day before") << QDate(2015, 3, 29) << QTime(2, 30, 0) << 1 << 60;
@@ -1859,7 +1841,6 @@ void tst_QDateTime::operator_eqeq()
}
}
-#ifndef Q_OS_WINCE
Q_DECLARE_METATYPE(QDataStream::Version)
void tst_QDateTime::operator_insert_extract_data()
@@ -1988,7 +1969,6 @@ void tst_QDateTime::operator_insert_extract()
qputenv("TZ", previousTimeZone.constData());
tzset();
}
-#endif
void tst_QDateTime::toString_strformat()
{
@@ -2442,7 +2422,7 @@ void tst_QDateTime::setOffsetFromUtc()
dt1.setMSecsSinceEpoch(123456789);
QCOMPARE(dt1.timeSpec(), Qt::OffsetFromUTC);
QCOMPARE(dt1.offsetFromUtc(), 60 * 60);
- dt1.setTime_t(123456789);
+ dt1.setSecsSinceEpoch(123456789);
QCOMPARE(dt1.timeSpec(), Qt::OffsetFromUTC);
QCOMPARE(dt1.offsetFromUtc(), 60 * 60);
@@ -3060,7 +3040,7 @@ void tst_QDateTime::timeZones() const
QCOMPARE(dt1.time(), QTime(0, 0, 0));
QCOMPARE(dt1.timeZone(), nzTz);
- QDateTime dt2 = QDateTime::fromTime_t(1338465600, nzTz);
+ QDateTime dt2 = QDateTime::fromSecsSinceEpoch(1338465600, nzTz);
QCOMPARE(dt2.date(), dt1.date());
QCOMPARE(dt2.time(), dt1.time());
QCOMPARE(dt2.timeSpec(), dt1.timeSpec());
diff --git a/tests/auto/corelib/tools/qfreelist/qfreelist.pro b/tests/auto/corelib/tools/qfreelist/qfreelist.pro
index fb108338bd..4825987bcf 100644
--- a/tests/auto/corelib/tools/qfreelist/qfreelist.pro
+++ b/tests/auto/corelib/tools/qfreelist/qfreelist.pro
@@ -2,4 +2,4 @@ CONFIG += testcase
TARGET = tst_qfreelist
QT = core-private testlib
SOURCES = tst_qfreelist.cpp
-!contains(QT_CONFIG,private_tests): SOURCES += $$QT_SOURCE_TREE/src/corelib/tools/qfreelist.cpp
+!qtConfig(private_tests): SOURCES += $$QT_SOURCE_TREE/src/corelib/tools/qfreelist.cpp
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 06ff09dc6c..0b864e71d4 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -49,6 +49,7 @@ private slots:
void find(); // copied from tst_QMap
void constFind(); // copied from tst_QMap
void contains(); // copied from tst_QMap
+ void qhash();
void take(); // copied from tst_QMap
void operator_eq(); // copied from tst_QMap
void rehash_isnt_quadratic();
@@ -695,6 +696,69 @@ void tst_QHash::contains()
QVERIFY(!map1.contains(43));
}
+namespace {
+class QGlobalQHashSeedResetter
+{
+ int oldSeed;
+public:
+ // not entirely correct (may lost changes made by another thread between the query
+ // of the old and the setting of the new seed), but qSetGlobalQHashSeed doesn't
+ // return the old value, so this is the best we can do:
+ explicit QGlobalQHashSeedResetter(int newSeed)
+ : oldSeed(qGlobalQHashSeed())
+ {
+ qSetGlobalQHashSeed(newSeed);
+ }
+ ~QGlobalQHashSeedResetter()
+ {
+ qSetGlobalQHashSeed(oldSeed);
+ }
+};
+
+template <typename Key, typename T>
+QHash<T, Key> inverted(const QHash<Key, T> &in)
+{
+ QHash<T, Key> result;
+ for (auto it = in.begin(), end = in.end(); it != end; ++it)
+ result[it.value()] = it.key();
+ return result;
+}
+
+template <typename AssociativeContainer>
+void make_test_data(AssociativeContainer &c)
+{
+ c["one"] = "1";
+ c["two"] = "2";
+}
+
+}
+
+void tst_QHash::qhash()
+{
+ const QGlobalQHashSeedResetter seed1(0);
+
+ QHash<QString, QString> hash1;
+ make_test_data(hash1);
+ const QHash<QString, QString> hsah1 = inverted(hash1);
+
+ const QGlobalQHashSeedResetter seed2(1);
+
+ QHash<QString, QString> hash2;
+ make_test_data(hash2);
+ const QHash<QString, QString> hsah2 = inverted(hash2);
+
+ QCOMPARE(hash1, hash2);
+ QCOMPARE(hsah1, hsah2);
+ QCOMPARE(qHash(hash1), qHash(hash2));
+ QCOMPARE(qHash(hsah1), qHash(hsah2));
+
+ // by construction this is almost impossible to cause false collisions:
+ QVERIFY(hash1 != hsah1);
+ QVERIFY(hash2 != hsah2);
+ QVERIFY(qHash(hash1) != qHash(hsah1));
+ QVERIFY(qHash(hash2) != qHash(hsah2));
+}
+
//copied from tst_QMap
void tst_QHash::take()
{
@@ -996,11 +1060,7 @@ void tst_QHash::rehash_isnt_quadratic()
// this test should be incredibly slow if rehash() is quadratic
for (int j = 0; j < 5; ++j) {
QHash<int, int> testHash;
-#if defined(Q_OS_WINCE) // mobiles do not have infinite mem...
- for (int i = 0; i < 50000; ++i)
-#else
for (int i = 0; i < 500000; ++i)
-#endif
testHash.insertMulti(1, 1);
}
}
diff --git a/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro
index a996dab23e..61054b40e4 100644
--- a/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro
+++ b/tests/auto/corelib/tools/qlatin1string/qlatin1string.pro
@@ -3,7 +3,7 @@ TARGET = tst_qlatin1string
QT = core testlib
SOURCES = tst_qlatin1string.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-contains(QT_CONFIG,c++11): CONFIG += c++11
-contains(QT_CONFIG,c++14): CONFIG += c++14
+qtConfig(c++11): CONFIG += c++11
+qtConfig(c++14): CONFIG += c++14
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
index 878b4b52b6..06e2e1cc45 100644
--- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
+++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
@@ -44,12 +44,42 @@ class tst_QLatin1String : public QObject
Q_OBJECT
private Q_SLOTS:
+ void at();
+ void midLeftRight();
void nullString();
void emptyString();
void relationalOperators_data();
void relationalOperators();
};
+
+void tst_QLatin1String::at()
+{
+ const QLatin1String l1("Hello World");
+ QCOMPARE(l1.at(0), QLatin1Char('H'));
+ QCOMPARE(l1.at(l1.size() - 1), QLatin1Char('d'));
+ QCOMPARE(l1[0], QLatin1Char('H'));
+ QCOMPARE(l1[l1.size() - 1], QLatin1Char('d'));
+}
+
+void tst_QLatin1String::midLeftRight()
+{
+ const QLatin1String l1("Hello World");
+ QCOMPARE(l1.mid(0), l1);
+ QCOMPARE(l1.mid(0, l1.size()), l1);
+ QCOMPARE(l1.left(l1.size()), l1);
+ QCOMPARE(l1.right(l1.size()), l1);
+
+ QCOMPARE(l1.mid(6), QLatin1String("World"));
+ QCOMPARE(l1.mid(6, 5), QLatin1String("World"));
+ QCOMPARE(l1.right(5), QLatin1String("World"));
+
+ QCOMPARE(l1.mid(6, 1), QLatin1String("W"));
+ QCOMPARE(l1.right(5).left(1), QLatin1String("W"));
+
+ QCOMPARE(l1.left(5), QLatin1String("Hello"));
+}
+
void tst_QLatin1String::nullString()
{
// default ctor
diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp
index 3aee0ff17d..6e020ac35b 100644
--- a/tests/auto/corelib/tools/qline/tst_qline.cpp
+++ b/tests/auto/corelib/tools/qline/tst_qline.cpp
@@ -44,6 +44,12 @@ private slots:
void testLength();
void testLength_data();
+ void testCenter();
+ void testCenter_data();
+
+ void testCenterF();
+ void testCenterF_data();
+
void testNormalVector();
void testNormalVector_data();
@@ -268,6 +274,77 @@ void tst_QLine::testLength()
QCOMPARE(l.dy(), qreal(vy));
}
+void tst_QLine::testCenter()
+{
+ QFETCH(int, x1);
+ QFETCH(int, y1);
+ QFETCH(int, x2);
+ QFETCH(int, y2);
+ QFETCH(int, centerX);
+ QFETCH(int, centerY);
+
+ const QPoint c = QLine(x1, y1, x2, y2).center();
+ QCOMPARE(centerX, c.x());
+ QCOMPARE(centerY, c.y());
+}
+
+void tst_QLine::testCenter_data()
+{
+ QTest::addColumn<int>("x1");
+ QTest::addColumn<int>("y1");
+ QTest::addColumn<int>("x2");
+ QTest::addColumn<int>("y2");
+ QTest::addColumn<int>("centerX");
+ QTest::addColumn<int>("centerY");
+
+ QTest::newRow("[0, 0]") << 0 << 0 << 0 << 0 << 0 << 0;
+ QTest::newRow("top") << 0 << 0 << 2 << 0 << 1 << 0;
+ QTest::newRow("right") << 0 << 0 << 0 << 2 << 0 << 1;
+ QTest::newRow("bottom") << 0 << 0 << -2 << 0 << -1 << 0;
+ QTest::newRow("left") << 0 << 0 << 0 << -2 << 0 << -1;
+
+ QTest::newRow("precision+") << 0 << 0 << 1 << 1 << 0 << 0;
+ QTest::newRow("precision-") << -1 << -1 << 0 << 0 << 0 << 0;
+
+ const int max = std::numeric_limits<int>::max();
+ const int min = std::numeric_limits<int>::min();
+ QTest::newRow("max") << max << max << max << max << max << max;
+ QTest::newRow("min") << min << min << min << min << min << min;
+ QTest::newRow("minmax") << min << min << max << max << 0 << 0;
+}
+
+void tst_QLine::testCenterF()
+{
+ QFETCH(double, x1);
+ QFETCH(double, y1);
+ QFETCH(double, x2);
+ QFETCH(double, y2);
+ QFETCH(double, centerX);
+ QFETCH(double, centerY);
+
+ const QPointF c = QLineF(x1, y1, x2, y2).center();
+ QCOMPARE(centerX, c.x());
+ QCOMPARE(centerY, c.y());
+}
+
+void tst_QLine::testCenterF_data()
+{
+ QTest::addColumn<double>("x1");
+ QTest::addColumn<double>("y1");
+ QTest::addColumn<double>("x2");
+ QTest::addColumn<double>("y2");
+ QTest::addColumn<double>("centerX");
+ QTest::addColumn<double>("centerY");
+
+ QTest::newRow("[0, 0]") << 0.0 << 0.0 << 0.0 << 0.0 << 0.0 << 0.0;
+ QTest::newRow("top") << 0.0 << 0.0 << 1.0 << 0.0 << 0.5 << 0.0;
+ QTest::newRow("right") << 0.0 << 0.0 << 0.0 << 1.0 << 0.0 << 0.5;
+ QTest::newRow("bottom") << 0.0 << 0.0 << -1.0 << 0.0 << -0.5 << 0.0;
+ QTest::newRow("left") << 0.0 << 0.0 << 0.0 << -1.0 << 0.0 << -0.5;
+
+ const double max = std::numeric_limits<qreal>::max();
+ QTest::newRow("max") << max << max << max << max << max << max;
+}
void tst_QLine::testNormalVector_data()
{
diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro
index d9004d1eb6..595ee258e7 100644
--- a/tests/auto/corelib/tools/qlocale/test/test.pro
+++ b/tests/auto/corelib/tools/qlocale/test/test.pro
@@ -4,7 +4,7 @@ QT = core testlib core-private
embedded: QT += gui
SOURCES = ../tst_qlocale.cpp
-!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) {
+!qtConfig(doubleconversion):!qtConfig(system-doubleconversion) {
DEFINES += QT_NO_DOUBLECONVERSION
}
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index ee706e9f3d..8d9a789507 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -52,15 +52,6 @@
# include <fenv.h>
#endif
-#ifdef Q_OS_WINCE
-#include <windows.h> // needed for GetUserDefaultLCID
-#define _control87 _controlfp
-extern "C" DWORD GetThreadLocale(void) {
- return GetUserDefaultLCID();
-}
-
-#endif
-
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
# include <stdlib.h>
#endif
@@ -85,9 +76,7 @@ private slots:
#endif
void ctor();
-#if !defined(Q_OS_WINCE)
void emptyCtor();
-#endif
void legacyNames();
void unixLocaleName();
void matchingLocales();
@@ -156,8 +145,8 @@ tst_QLocale::tst_QLocale()
qRegisterMetaType<QLocale::FormatType>("QLocale::FormatType");
// Test if in Central European Time zone
- uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t();
- uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t();
+ uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toSecsSinceEpoch();
+ uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toSecsSinceEpoch();
europeanTimeZone = (x1 == 631148400 && x2 == 644191200);
}
@@ -394,10 +383,7 @@ void tst_QLocale::ctor()
#undef TEST_CTOR
}
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
-// Not when Q_OS_WINCE is defined because the test uses unsupported
-// Windows CE QProcess functionality (std streams, env)
-// Also Qt needs to be compiled without QT_NO_PROCESS
+#if !defined(QT_NO_PROCESS)
static inline bool runSysApp(const QString &binary,
const QStringList &env,
QString *output,
@@ -447,7 +433,6 @@ static inline bool runSysAppTest(const QString &binary,
}
#endif
-#if !defined(Q_OS_WINCE)
void tst_QLocale::emptyCtor()
{
#ifdef QT_NO_PROCESS
@@ -517,7 +502,6 @@ void tst_QLocale::emptyCtor()
#undef TEST_CTOR
#endif
}
-#endif
void tst_QLocale::legacyNames()
{
diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
index 2f285f3393..a98d37d733 100644
--- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
+++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
@@ -927,11 +927,7 @@ void tst_QRegExp::rainersSlowRegExpCopyBug()
{
// this test should take an extreme amount of time if QRegExp is broken
QRegExp original(email);
-#if defined(Q_OS_WINCE)
- for (int i = 0; i < 100; ++i) {
-#else
for (int i = 0; i < 100000; ++i) {
-#endif
QRegExp copy = original;
(void)copy.exactMatch("~");
QRegExp copy2 = original;
@@ -980,13 +976,9 @@ void Thread::run()
str += "abbbdekcz";
int x;
-#if defined(Q_OS_WINCE)
- for (int j = 0; j < 100; ++j) {
-#else
- for (int j = 0; j < 10000; ++j) {
-#endif
+ for (int j = 0; j < 10000; ++j)
x = rx.indexIn(str);
- }
+
QCOMPARE(x, 3072);
}
@@ -1022,13 +1014,9 @@ void Thread2::run()
str += "abbbdekcz";
int x;
-#if defined(Q_OS_WINCE)
- for (int j = 0; j < 100; ++j) {
-#else
- for (int j = 0; j < 10000; ++j) {
-#endif
+ for (int j = 0; j < 10000; ++j)
x = rx.indexIn(str);
- }
+
QCOMPARE(x, 3072);
}
diff --git a/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
index c030f04a27..e1840808ff 100644
--- a/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
+++ b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = defaultoptimize forceoptimize
-contains(QT_CONFIG,private_tests):SUBDIRS += alwaysoptimize
+qtConfig(private_tests): SUBDIRS += alwaysoptimize
diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
index 5825bdb6d6..2a93250ba5 100644
--- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
+++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
@@ -61,6 +61,9 @@ struct Match
QStringList captured;
QHash<QString, QString> namedCaptured;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(Match, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(Match)
@@ -85,9 +88,9 @@ bool operator==(const QRegularExpressionMatch &rem, const Match &m)
}
}
- Q_FOREACH (const QString &name, m.namedCaptured.keys()) {
- QString remCaptured = rem.captured(name);
- QString mCaptured = m.namedCaptured.value(name);
+ for (auto it = m.namedCaptured.begin(), end = m.namedCaptured.end(); it != end; ++it) {
+ const QString remCaptured = rem.captured(it.key());
+ const QString mCaptured = it.value();
if (remCaptured != mCaptured
|| remCaptured.isNull() != mCaptured.isNull()
|| remCaptured.isEmpty() != mCaptured.isEmpty()) {
@@ -115,12 +118,11 @@ bool operator!=(const Match &m, const QRegularExpressionMatch &rem)
}
-bool operator==(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+bool operator==(const QRegularExpressionMatchIterator &iterator, const QVector<Match> &expectedMatchList)
{
QRegularExpressionMatchIterator i = iterator;
- foreach (const Match &expectedMatch, expectedMatchList)
- {
+ for (const Match &expectedMatch : expectedMatchList) {
if (!i.hasNext())
return false;
@@ -135,17 +137,17 @@ bool operator==(const QRegularExpressionMatchIterator &iterator, const QList<Mat
return true;
}
-bool operator==(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+bool operator==(const QVector<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
{
return operator==(iterator, expectedMatchList);
}
-bool operator!=(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+bool operator!=(const QRegularExpressionMatchIterator &iterator, const QVector<Match> &expectedMatchList)
{
return !operator==(iterator, expectedMatchList);
}
-bool operator!=(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+bool operator!=(const QVector<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
{
return !operator==(expectedMatchList, iterator);
}
@@ -1117,9 +1119,9 @@ void tst_QRegularExpression::globalMatch_data()
QTest::addColumn<int>("offset");
QTest::addColumn<QRegularExpression::MatchType>("matchType");
QTest::addColumn<QRegularExpression::MatchOptions>("matchOptions");
- QTest::addColumn<QList<Match> >("matchList");
+ QTest::addColumn<QVector<Match> >("matchList");
- QList<Match> matchList;
+ QVector<Match> matchList;
Match m;
matchList.clear();
@@ -1375,7 +1377,7 @@ void tst_QRegularExpression::globalMatch()
QFETCH(int, offset);
QFETCH(QRegularExpression::MatchType, matchType);
QFETCH(QRegularExpression::MatchOptions, matchOptions);
- QFETCH(QList<Match>, matchList);
+ QFETCH(QVector<Match>, matchList);
testMatch<QRegularExpressionMatchIterator>(regexp,
static_cast<QREGlobalMatchStringPMF>(&QRegularExpression::globalMatch),
diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
index c212589f59..145ba7ff72 100644
--- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
+++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp
@@ -45,6 +45,7 @@ private slots:
void sizeWhenReserved();
void free();
void reserveAndRead();
+ void reserveAndReadInPacketMode();
void reserveFrontAndRead();
void chop();
void ungetChar();
@@ -58,6 +59,12 @@ void tst_QRingBuffer::constructing()
{
QRingBuffer ringBuffer;
+ const int chunkSize = ringBuffer.chunkSize();
+ ringBuffer.setChunkSize(0);
+ QCOMPARE(ringBuffer.chunkSize(), Q_INT64_C(0));
+ ringBuffer.setChunkSize(chunkSize);
+ QCOMPARE(ringBuffer.chunkSize(), chunkSize);
+
QCOMPARE(ringBuffer.size(), Q_INT64_C(0));
QVERIFY(ringBuffer.isEmpty());
QCOMPARE(ringBuffer.nextDataBlockSize(), Q_INT64_C(0));
@@ -237,6 +244,25 @@ void tst_QRingBuffer::reserveAndRead()
QCOMPARE(ringBuffer.size(), Q_INT64_C(0));
}
+void tst_QRingBuffer::reserveAndReadInPacketMode()
+{
+ QRingBuffer ringBuffer(0);
+ // try to allocate 255 buffers
+ for (int i = 1; i < 256; ++i) {
+ char *ringPos = ringBuffer.reserve(i);
+ QVERIFY(ringPos);
+ }
+
+ // count and check the size of stored buffers
+ int buffersCount = 0;
+ while (!ringBuffer.isEmpty()) {
+ QByteArray ba = ringBuffer.read();
+ ++buffersCount;
+ QCOMPARE(ba.size(), buffersCount);
+ }
+ QCOMPARE(buffersCount, 255);
+}
+
void tst_QRingBuffer::reserveFrontAndRead()
{
QRingBuffer ringBuffer;
diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
index 7fde84af5d..21efaede00 100644
--- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
+++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
@@ -278,12 +278,16 @@ void tst_QScopedPointer::isNull()
{
QScopedPointer<int> p;
QVERIFY(p.isNull());
+ QVERIFY(p == nullptr);
+ QVERIFY(nullptr == p);
}
/* Invoke on a set value. */
{
QScopedPointer<int> p(new int(69));
QVERIFY(!p.isNull());
+ QVERIFY(p != nullptr);
+ QVERIFY(nullptr != p);
}
}
diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
index 0cccdb8262..7bebe5e9e0 100644
--- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp
@@ -342,7 +342,7 @@ namespace QTest {
"\n"
"#ifdef Q_OS_WIN\n"
"#include <windows.h>\n"
- "#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)\n"
+ "#if defined(Q_CC_MSVC)\n"
"#include <crtdbg.h>\n"
"#endif\n"
"static void q_test_setup()\n"
@@ -358,7 +358,7 @@ namespace QTest {
"#endif\n"
"int main(int argc, char **argv)\n"
"{\n"
- "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) && !defined(Q_OS_WINCE)\n"
+ "#if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)\n"
" _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook);\n"
"#endif\n";
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index b5912badf2..d0a0feb125 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -57,11 +57,13 @@ private slots:
void basics_data();
void basics();
void operators();
+ void nullptrOps();
void swap();
void moveSemantics();
void useOfForwardDeclared();
void memoryManagement();
void dropLastReferenceOfForwardDeclared();
+ void nonVirtualDestructors();
void lock();
void downCast();
void functionCallDownCast();
@@ -362,6 +364,50 @@ void tst_QSharedPointer::operators()
QCOMPARE(qHash(p2), qHash(p2.data()));
}
+void tst_QSharedPointer::nullptrOps()
+{
+ QSharedPointer<char> p1(nullptr);
+ QSharedPointer<char> p2 = nullptr;
+ QSharedPointer<char> null;
+
+ QVERIFY(p1 == null);
+ QVERIFY(p1 == nullptr);
+ QVERIFY(nullptr == p1);
+ QVERIFY(!p1);
+ QVERIFY(!p1.data());
+ QVERIFY(p2 == null);
+ QVERIFY(p2 == nullptr);
+ QVERIFY(nullptr == p2);
+ QVERIFY(!p2);
+ QVERIFY(!p2.data());
+ QVERIFY(p1 == p2);
+
+ QSharedPointer<char> p3 = p1;
+ QVERIFY(p3 == p1);
+ QVERIFY(p3 == null);
+ QVERIFY(p3 == nullptr);
+ QVERIFY(nullptr == p3);
+ QVERIFY(!p3.data());
+
+ p3 = nullptr;
+
+ // check for non-ambiguity
+ QSharedPointer<char> p1_zero(0);
+ QSharedPointer<char> p2_zero = 0;
+
+ p3 = 0;
+
+ QSharedPointer<char> p4(new char);
+ QVERIFY(p4);
+ QVERIFY(p4.data());
+ QVERIFY(p4 != nullptr);
+ QVERIFY(nullptr != p4);
+ QVERIFY(p4 != p1);
+ QVERIFY(p4 != p2);
+ QVERIFY(p4 != null);
+ QVERIFY(p4 != p3);
+}
+
void tst_QSharedPointer::swap()
{
QSharedPointer<int> p1, p2(new int(42)), control = p2;
@@ -578,6 +624,56 @@ void tst_QSharedPointer::dropLastReferenceOfForwardDeclared()
QCOMPARE(forwardDeclaredDestructorRunCount, 1);
}
+// NVD for "non-virtual destructor"
+struct NVDData
+{
+ static int destructorCounter;
+ ~NVDData() { ++destructorCounter; }
+
+ int dummy;
+};
+int NVDData::destructorCounter;
+
+struct NVDDerivedData : NVDData
+{
+ static int destructorCounter;
+ ~NVDDerivedData() { ++destructorCounter; }
+};
+int NVDDerivedData::destructorCounter;
+
+void tst_QSharedPointer::nonVirtualDestructors()
+{
+ NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0;
+ {
+ QSharedPointer<NVDData> ptr(new NVDData);
+ }
+ QCOMPARE(NVDData::destructorCounter, 1);
+ QCOMPARE(NVDDerivedData::destructorCounter, 0);
+
+ NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0;
+ {
+ QSharedPointer<NVDDerivedData> ptr(new NVDDerivedData);
+ }
+ QCOMPARE(NVDData::destructorCounter, 1);
+ QCOMPARE(NVDDerivedData::destructorCounter, 1);
+
+ NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0;
+ {
+ QSharedPointer<NVDData> bptr;
+ QSharedPointer<NVDDerivedData> ptr(new NVDDerivedData);
+ bptr = ptr;
+ }
+ QCOMPARE(NVDData::destructorCounter, 1);
+ QCOMPARE(NVDDerivedData::destructorCounter, 1);
+
+ NVDData::destructorCounter = NVDDerivedData::destructorCounter = 0;
+ {
+ QSharedPointer<NVDData> ptr(new NVDDerivedData);
+ }
+ QCOMPARE(NVDData::destructorCounter, 1);
+ QCOMPARE(NVDDerivedData::destructorCounter, 1);
+}
+
void tst_QSharedPointer::lock()
{
QSharedPointer<int> sp = QSharedPointer<int>::create();
@@ -1310,6 +1406,18 @@ template<typename T> int CustomDeleter<T>::callCount = 0;
void tst_QSharedPointer::customDeleter()
{
{
+ QSharedPointer<Data> ptr(0, &Data::doDelete);
+ QSharedPointer<Data> ptr2(0, &Data::alsoDelete);
+ QSharedPointer<Data> ptr3(0, &Data::virtualDelete);
+ }
+ safetyCheck();
+ {
+ QSharedPointer<Data> ptr(nullptr, &Data::doDelete);
+ QSharedPointer<Data> ptr2(nullptr, &Data::alsoDelete);
+ QSharedPointer<Data> ptr3(nullptr, &Data::virtualDelete);
+ }
+ safetyCheck();
+ {
QSharedPointer<Data> ptr(new Data, &Data::doDelete);
QSharedPointer<Data> ptr2(new Data, &Data::alsoDelete);
QSharedPointer<Data> ptr3(new Data, &Data::virtualDelete);
@@ -1492,6 +1600,33 @@ void tst_QSharedPointer::customDeleter()
QCOMPARE(refcount, 2);
safetyCheck();
+ CustomDeleter<NVDData> nvdeleter;
+ nvdeleter.callCount = 0;
+ {
+ QSharedPointer<NVDData> ptr(new NVDData, nvdeleter);
+ }
+ QCOMPARE(nvdeleter.callCount, 1);
+ safetyCheck();
+
+ CustomDeleter<NVDDerivedData> nvderiveddeleter;
+ nvdeleter.callCount = 0;
+ nvderiveddeleter.callCount = 0;
+ {
+ QSharedPointer<NVDDerivedData> ptr(new NVDDerivedData, nvderiveddeleter);
+ }
+ QCOMPARE(nvdeleter.callCount, 0);
+ QCOMPARE(nvderiveddeleter.callCount, 1);
+ safetyCheck();
+
+ nvdeleter.callCount = 0;
+ nvderiveddeleter.callCount = 0;
+ {
+ QSharedPointer<NVDData> ptr(new NVDDerivedData, nvderiveddeleter);
+ }
+ QCOMPARE(nvdeleter.callCount, 0);
+ QCOMPARE(nvderiveddeleter.callCount, 1);
+ safetyCheck();
+
// a custom deleter with a different pointer parameter
{
QSharedPointer<char> ptr(static_cast<char *>(malloc(1)), free);
@@ -1603,9 +1738,6 @@ void tst_QSharedPointer::creating()
void tst_QSharedPointer::creatingVariadic()
{
-#if !defined(Q_COMPILER_RVALUE_REFS) || !defined(Q_COMPILER_VARIADIC_TEMPLATES)
- QSKIP("This compiler is not in C++11 mode or it doesn't support rvalue refs and variadic templates");
-#else
int i = 42;
{
@@ -1633,12 +1765,10 @@ void tst_QSharedPointer::creatingVariadic()
QCOMPARE(ptr->i, 2);
QCOMPARE(ptr->ptr, (void*)0);
-#ifdef Q_COMPILER_NULLPTR
NoDefaultConstructor2(nullptr, 3); // control check
ptr = QSharedPointer<NoDefaultConstructor2>::create(nullptr, 3);
QCOMPARE(ptr->i, 3);
QCOMPARE(ptr->ptr, (void*)nullptr);
-#endif
}
{
NoDefaultConstructorRef1 x(i); // control check
@@ -1674,7 +1804,6 @@ void tst_QSharedPointer::creatingVariadic()
QCOMPARE(ptr->str, QString("bytearray"));
QCOMPARE(ptr->i, 42);
}
-#endif
}
void tst_QSharedPointer::creatingQObject()
@@ -1771,13 +1900,11 @@ void tst_QSharedPointer::threadStressTest_data()
QTest::newRow("1+1") << 1 << 1;
QTest::newRow("2+10") << 2 << 10;
-#ifndef Q_OS_WINCE
- // Windows CE cannot run this many threads
+
QTest::newRow("5+10") << 5 << 10;
QTest::newRow("5+30") << 5 << 30;
QTest::newRow("100+100") << 100 << 100;
-#endif
}
void tst_QSharedPointer::threadStressTest()
@@ -1811,11 +1938,7 @@ void tst_QSharedPointer::threadStressTest()
base.clear();
-#ifdef Q_OS_WINCE
- srand(QDateTime::currentDateTime().toTime_t());
-#else
srand(time(NULL));
-#endif
// start threads
for (int i = 0; i < allThreads.count(); ++i)
if (allThreads[i]) allThreads[i]->start();
diff --git a/tests/auto/corelib/tools/qstring/qstring.pro b/tests/auto/corelib/tools/qstring/qstring.pro
index 1ff9a4fc9e..ec8a9b5df5 100644
--- a/tests/auto/corelib/tools/qstring/qstring.pro
+++ b/tests/auto/corelib/tools/qstring/qstring.pro
@@ -1,13 +1,13 @@
CONFIG += testcase
TARGET = tst_qstring
-QT = core testlib
+QT = core-private testlib
SOURCES = tst_qstring.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU
-contains(QT_CONFIG,c++11): CONFIG += c++11
+qtConfig(icu): DEFINES += QT_USE_ICU
+qtConfig(c++11): CONFIG += c++11
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) {
+!qtConfig(doubleconversion):!qtConfig(system-doubleconversion) {
DEFINES += QT_NO_DOUBLECONVERSION
}
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 44b8135410..a0a872710c 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -37,10 +37,6 @@
# undef QT_ASCII_CAST_WARNINGS
#endif
-#if defined(Q_OS_WIN) && defined(Q_OS_WINCE)
-#define Q_OS_WIN_AND_WINCE
-#endif
-
#include <QtTest/QtTest>
#include <qregexp.h>
#include <qregularexpression.h>
@@ -88,11 +84,11 @@ public:
template <typename MemFun>
void apply0(QString &s, MemFun mf) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(ch); }
template <typename MemFun, typename A1>
void apply1(QString &s, MemFun mf, A1 a1) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(a1, ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(a1, ch); }
};
template <>
@@ -258,6 +254,9 @@ public:
};
} // unnamed namespace
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(CharStarContainer, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(CharStarContainer)
@@ -531,7 +530,7 @@ private slots:
void integer_conversion();
void tortureSprintfDouble();
void toNum();
-#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE)
+#if !defined(Q_OS_WIN)
void localeAwareCompare_data();
void localeAwareCompare();
#endif
@@ -649,7 +648,7 @@ QString verifyZeroTermination(const QString &str)
} while (0) \
/**/
-typedef QList<int> IntList;
+typedef QVector<int> IntList;
tst_QString::tst_QString()
{
@@ -1057,10 +1056,6 @@ void tst_QString::acc_01()
QVERIFY(a.isNull());
QVERIFY(*a.toLatin1().constData() == '\0');
{
-#if defined(Q_OS_WINCE)
- int argc = 0;
- QCoreApplication app(argc, 0);
-#endif
QFile f("COMPARE.txt");
f.open(QIODevice::ReadOnly);
QTextStream ts( &f );
@@ -1204,7 +1199,7 @@ void tst_QString::macTypes()
#ifndef Q_OS_MAC
QSKIP("This is a Mac-only test");
#else
- extern void tst_QString_macTypes(); // in qstring_mac.mm
+ extern void tst_QString_macTypes(); // in qcore_foundation.mm
tst_QString_macTypes();
#endif
}
@@ -5082,6 +5077,12 @@ void tst_QString::operator_eqeq_nullstring()
QVERIFY( QString("") == "" );
QVERIFY( "" == QString("") );
+ QVERIFY(QString() == nullptr);
+ QVERIFY(nullptr == QString());
+
+ QVERIFY(QString("") == nullptr);
+ QVERIFY(nullptr == QString(""));
+
QVERIFY( QString().size() == 0 );
QVERIFY( QString("").size() == 0 );
@@ -5095,6 +5096,8 @@ void tst_QString::operator_smaller()
QString null;
QString empty("");
QString foo("foo");
+ const char *nullC = nullptr;
+ const char *emptyC = "";
QVERIFY( !(null < QString()) );
QVERIFY( !(null > QString()) );
@@ -5105,6 +5108,12 @@ void tst_QString::operator_smaller()
QVERIFY( !(null < empty) );
QVERIFY( !(null > empty) );
+ QVERIFY( !(nullC < empty) );
+ QVERIFY( !(nullC > empty) );
+
+ QVERIFY( !(null < emptyC) );
+ QVERIFY( !(null > emptyC) );
+
QVERIFY( null < foo );
QVERIFY( !(null > foo) );
QVERIFY( foo > null );
@@ -5436,15 +5445,11 @@ void tst_QString::tortureSprintfDouble()
#include <locale.h>
-#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE)
-// On Q_OS_WIN others than Win CE, we cannot set the system or user locale
+#if !defined(Q_OS_WIN)
+// On Q_OS_WIN, we cannot set the system or user locale
void tst_QString::localeAwareCompare_data()
{
-#ifdef Q_OS_WIN_AND_WINCE
- QTest::addColumn<ulong>("locale");
-#else
QTest::addColumn<QString>("locale");
-#endif
QTest::addColumn<QString>("s1");
QTest::addColumn<QString>("s2");
QTest::addColumn<int>("result");
@@ -5454,15 +5459,9 @@ void tst_QString::localeAwareCompare_data()
Latin-1-specific characters (I think). Compare with Swedish
below.
*/
-#ifdef Q_OS_WIN_AND_WINCE // assume c locale to be english
- QTest::newRow("c1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1;
- QTest::newRow("c2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
- QTest::newRow("c3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
-#else
QTest::newRow("c1") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1;
QTest::newRow("c2") << QString("C") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
QTest::newRow("c3") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
-#endif
/*
It's hard to test English, because it's treated differently
@@ -5472,15 +5471,9 @@ void tst_QString::localeAwareCompare_data()
comparison of Latin-1 values, although I'm not sure. So I
just test digits to make sure that it's not totally broken.
*/
-#ifdef Q_OS_WIN_AND_WINCE
- QTest::newRow("english1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("4") << 1;
- QTest::newRow("english2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("4") << QString("6") << -1;
- QTest::newRow("english3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("6") << -1;
-#else
QTest::newRow("english1") << QString("en_US") << QString("5") << QString("4") << 1;
QTest::newRow("english2") << QString("en_US") << QString("4") << QString("6") << -1;
QTest::newRow("english3") << QString("en_US") << QString("5") << QString("6") << -1;
-#endif
/*
In Swedish, a with ring above (E5) comes before a with
diaresis (E4), which comes before o diaresis (F6), which
@@ -5491,11 +5484,6 @@ void tst_QString::localeAwareCompare_data()
QTest::newRow("swedish2") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
QTest::newRow("swedish3") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
QTest::newRow("swedish4") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1;
-#elif defined(Q_OS_WIN_AND_WINCE)
- QTest::newRow("swedish1") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1;
- QTest::newRow("swedish2") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
- QTest::newRow("swedish3") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
- QTest::newRow("swedish4") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1;
#else
QTest::newRow("swedish1") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1;
QTest::newRow("swedish2") << QString("sv_SE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
@@ -5521,10 +5509,6 @@ void tst_QString::localeAwareCompare_data()
QTest::newRow("german1") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1;
QTest::newRow("german2") << QString("de_DE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
QTest::newRow("german3") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1;
-#elif defined(Q_OS_WIN_AND_WINCE)
- QTest::newRow("german1") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1;
- QTest::newRow("german2") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
- QTest::newRow("german3") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1;
#else
QTest::newRow("german1") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1;
QTest::newRow("german2") << QString("de_DE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
@@ -5534,11 +5518,7 @@ void tst_QString::localeAwareCompare_data()
void tst_QString::localeAwareCompare()
{
-#ifdef Q_OS_WIN_AND_WINCE
- QFETCH(ulong, locale);
-#else
QFETCH(QString, locale);
-#endif
QFETCH(QString, s1);
QFETCH(QString, s2);
QFETCH(int, result);
@@ -5546,11 +5526,7 @@ void tst_QString::localeAwareCompare()
QStringRef r1(&s1, 0, s1.length());
QStringRef r2(&s2, 0, s2.length());
-#ifdef Q_OS_WIN_AND_WINCE
- DWORD oldLcid = GetUserDefaultLCID();
- SetUserDefaultLCID(locale);
- QCOMPARE(locale, GetUserDefaultLCID());
-#elif defined (Q_OS_MAC) || defined(QT_USE_ICU)
+#if defined (Q_OS_DARWIN) || defined(QT_USE_ICU)
QSKIP("Setting the locale is not supported on OS X or ICU (you can set the C locale, but that won't affect localeAwareCompare)");
#else
if (!locale.isEmpty()) {
@@ -5612,14 +5588,10 @@ void tst_QString::localeAwareCompare()
QVERIFY(testres == 0);
}
-#ifdef Q_OS_WIN_AND_WINCE
- SetUserDefaultLCID(oldLcid);
-#else
if (!locale.isEmpty())
setlocale(LC_ALL, "");
-#endif
}
-#endif //!defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE)
+#endif //!defined(Q_OS_WIN)
void tst_QString::reverseIterators()
{
diff --git a/tests/auto/corelib/tools/qstringapisymmetry/.gitignore b/tests/auto/corelib/tools/qstringapisymmetry/.gitignore
new file mode 100644
index 0000000000..d28de05438
--- /dev/null
+++ b/tests/auto/corelib/tools/qstringapisymmetry/.gitignore
@@ -0,0 +1 @@
+tst_qstringapisymmetry
diff --git a/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro
new file mode 100644
index 0000000000..bc38b17949
--- /dev/null
+++ b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+TARGET = tst_qstringapisymmetry
+QT = core testlib
+SOURCES = tst_qstringapisymmetry.cpp
+qtConfig(c++14): CONFIG += c++14
diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
new file mode 100644
index 0000000000..7305a00d94
--- /dev/null
+++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#undef QT_NO_CAST_FROM_ASCII
+#undef QT_NO_CAST_TO_ASCII
+#undef QT_ASCII_CAST_WARNINGS
+
+#include <QString>
+#include <QChar>
+#include <QStringRef>
+#include <QLatin1String>
+
+#include <QTest>
+
+Q_DECLARE_METATYPE(QLatin1String)
+Q_DECLARE_METATYPE(QStringRef)
+
+template <typename T>
+QString toQString(const T &t) { return QString(t); }
+QString toQString(const QStringRef &ref) { return ref.toString(); }
+
+// FIXME: these are missing at the time of writing, add them, then remove the dummies here:
+#define MAKE_RELOP(op, A1, A2) \
+ static bool operator op (A1 lhs, A2 rhs) \
+ { return toQString(lhs) op toQString(rhs); } \
+ /*end*/
+#define MAKE_ALL(A1, A2) \
+ MAKE_RELOP(==, A1, A2) \
+ MAKE_RELOP(!=, A1, A2) \
+ MAKE_RELOP(<, A1, A2) \
+ MAKE_RELOP(>, A1, A2) \
+ MAKE_RELOP(<=, A1, A2) \
+ MAKE_RELOP(>=, A1, A2) \
+ /*end*/
+
+MAKE_ALL(QByteArray, QChar)
+MAKE_ALL(QByteArray, QLatin1String)
+
+MAKE_ALL(const char*, QChar)
+
+#undef MAKE_ALL
+#undef MAKE_RELOP
+// END FIXME
+
+class tst_QStringApiSymmetry : public QObject
+{
+ Q_OBJECT
+
+ void compare_data(bool hasConceptOfNullAndEmpty=true);
+ template <typename LHS, typename RHS>
+ void compare_impl() const;
+
+private Q_SLOTS:
+ // test all combinations of {QChar, QStringRef, QString, QLatin1String, QByteArray, const char*}
+ void compare_QChar_QChar_data() { compare_data(false); }
+ void compare_QChar_QChar() { compare_impl<QChar, QChar>(); }
+ void compare_QChar_QStringRef_data() { compare_data(false); }
+ void compare_QChar_QStringRef() { compare_impl<QChar, QStringRef>(); }
+ void compare_QChar_QString_data() { compare_data(false); }
+ void compare_QChar_QString() { compare_impl<QChar, QString>(); }
+ void compare_QChar_QLatin1String_data() { compare_data(false); }
+ void compare_QChar_QLatin1String() { compare_impl<QChar, QLatin1String>(); }
+ void compare_QChar_QByteArray_data() { compare_data(false); }
+ void compare_QChar_QByteArray() { compare_impl<QChar, QByteArray>(); }
+ void compare_QChar_const_char_star_data() { compare_data(false); }
+ void compare_QChar_const_char_star() { compare_impl<QChar, const char *>(); }
+
+ void compare_QStringRef_QChar_data() { compare_data(false); }
+ void compare_QStringRef_QChar() { compare_impl<QStringRef, QChar>(); }
+ void compare_QStringRef_QStringRef_data() { compare_data(); }
+ void compare_QStringRef_QStringRef() { compare_impl<QStringRef, QStringRef>(); }
+ void compare_QStringRef_QString_data() { compare_data(); }
+ void compare_QStringRef_QString() { compare_impl<QStringRef, QString>(); }
+ void compare_QStringRef_QLatin1String_data() { compare_data(); }
+ void compare_QStringRef_QLatin1String() { compare_impl<QStringRef, QLatin1String>(); }
+ void compare_QStringRef_QByteArray_data() { compare_data(); }
+ void compare_QStringRef_QByteArray() { compare_impl<QStringRef, QByteArray>(); }
+ void compare_QStringRef_const_char_star_data() { compare_data(); }
+ void compare_QStringRef_const_char_star() { compare_impl<QStringRef, const char *>(); }
+
+ void compare_QString_QChar_data() { compare_data(false); }
+ void compare_QString_QChar() { compare_impl<QString, QChar>(); }
+ void compare_QString_QStringRef_data() { compare_data(); }
+ void compare_QString_QStringRef() { compare_impl<QString, QStringRef>(); }
+ void compare_QString_QString_data() { compare_data(); }
+ void compare_QString_QString() { compare_impl<QString, QString>(); }
+ void compare_QString_QLatin1String_data() { compare_data(); }
+ void compare_QString_QLatin1String() { compare_impl<QString, QLatin1String>(); }
+ void compare_QString_QByteArray_data() { compare_data(); }
+ void compare_QString_QByteArray() { compare_impl<QString, QByteArray>(); }
+ void compare_QString_const_char_star_data() { compare_data(); }
+ void compare_QString_const_char_star() { compare_impl<QString, const char *>(); }
+
+ void compare_QLatin1String_QChar_data() { compare_data(false); }
+ void compare_QLatin1String_QChar() { compare_impl<QLatin1String, QChar>(); }
+ void compare_QLatin1String_QStringRef_data() { compare_data(); }
+ void compare_QLatin1String_QStringRef() { compare_impl<QLatin1String, QStringRef>(); }
+ void compare_QLatin1String_QString_data() { compare_data(); }
+ void compare_QLatin1String_QString() { compare_impl<QLatin1String, QString>(); }
+ void compare_QLatin1String_QLatin1String_data() { compare_data(); }
+ void compare_QLatin1String_QLatin1String() { compare_impl<QLatin1String, QLatin1String>(); }
+ void compare_QLatin1String_QByteArray_data() { compare_data(); }
+ void compare_QLatin1String_QByteArray() { compare_impl<QLatin1String, QByteArray>(); }
+ void compare_QLatin1String_const_char_star_data() { compare_data(); }
+ void compare_QLatin1String_const_char_star() { compare_impl<QLatin1String, const char *>(); }
+
+ void compare_QByteArray_QChar_data() { compare_data(false); }
+ void compare_QByteArray_QChar() { compare_impl<QByteArray, QChar>(); }
+ void compare_QByteArray_QStringRef_data() { compare_data(); }
+ void compare_QByteArray_QStringRef() { compare_impl<QByteArray, QStringRef>(); }
+ void compare_QByteArray_QString_data() { compare_data(); }
+ void compare_QByteArray_QString() { compare_impl<QByteArray, QString>(); }
+ void compare_QByteArray_QLatin1String_data() { compare_data(); }
+ void compare_QByteArray_QLatin1String() { compare_impl<QByteArray, QLatin1String>(); }
+ void compare_QByteArray_QByteArray_data() { compare_data(); }
+ void compare_QByteArray_QByteArray() { compare_impl<QByteArray, QByteArray>(); }
+ void compare_QByteArray_const_char_star_data() { compare_data(); }
+ void compare_QByteArray_const_char_star() { compare_impl<QByteArray, const char *>(); }
+
+ void compare_const_char_star_QChar_data() { compare_data(false); }
+ void compare_const_char_star_QChar() { compare_impl<const char *, QChar>(); }
+ void compare_const_char_star_QStringRef_data() { compare_data(); }
+ void compare_const_char_star_QStringRef() { compare_impl<const char *, QStringRef>(); }
+ void compare_const_char_star_QString_data() { compare_data(); }
+ void compare_const_char_star_QString() { compare_impl<const char *, QString>(); }
+ void compare_const_char_star_QLatin1String_data() { compare_data(false); }
+ void compare_const_char_star_QLatin1String() { compare_impl<const char *, QLatin1String>(); }
+ void compare_const_char_star_QByteArray_data() { compare_data(); }
+ void compare_const_char_star_QByteArray() { compare_impl<const char *, QByteArray>(); }
+ //void compare_const_char_star_const_char_star_data() { compare_data(); }
+ //void compare_const_char_star_const_char_star() { compare_impl<const char *, const char *>(); }
+
+};
+
+void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty)
+{
+ QTest::addColumn<QStringRef>("lhsUnicode");
+ QTest::addColumn<QLatin1String>("lhsLatin1");
+ QTest::addColumn<QStringRef>("rhsUnicode");
+ QTest::addColumn<QLatin1String>("rhsLatin1");
+ QTest::addColumn<int>("caseSensitiveCompareResult");
+ QTest::addColumn<int>("caseInsensitiveCompareResult");
+
+ if (hasConceptOfNullAndEmpty) {
+ QTest::newRow("null <> null") << QStringRef() << QLatin1String()
+ << QStringRef() << QLatin1String()
+ << 0 << 0;
+ static const QString empty("");
+ QTest::newRow("null <> empty") << QStringRef() << QLatin1String()
+ << QStringRef(&empty) << QLatin1String("")
+ << 0 << 0;
+ }
+
+#define ROW(lhs, rhs) \
+ do { \
+ static const QString pinned[] = { \
+ QString(QLatin1String(lhs)), \
+ QString(QLatin1String(rhs)), \
+ }; \
+ QTest::newRow(qUtf8Printable(QLatin1String("'" lhs "' <> '" rhs "': "))) \
+ << QStringRef(&pinned[0]) << QLatin1String(lhs) \
+ << QStringRef(&pinned[1]) << QLatin1String(rhs) \
+ << qstrcmp(lhs, rhs) << qstricmp(lhs, rhs); \
+ } while (false)
+ ROW("", "0");
+ ROW("0", "");
+ ROW("0", "1");
+ ROW("0", "0");
+ ROW("\xE4", "\xE4"); // ä <> ä
+ ROW("\xE4", "\xC4"); // ä <> Ä
+#undef ROW
+}
+
+template <class Str> Str make(const QStringRef &sf, QLatin1String l1, const QByteArray &u8);
+template <> QChar make(const QStringRef &sf, QLatin1String, const QByteArray &) { return sf.isEmpty() ? QChar() : sf.at(0); }
+template <> QStringRef make(const QStringRef &sf, QLatin1String, const QByteArray &) { return sf; }
+template <> QString make(const QStringRef &sf, QLatin1String, const QByteArray &) { return sf.toString(); }
+template <> QLatin1String make(const QStringRef &, QLatin1String l1, const QByteArray &) { return l1; }
+template <> QByteArray make(const QStringRef &, QLatin1String, const QByteArray &u8) { return u8; }
+template <> const char * make(const QStringRef &, QLatin1String, const QByteArray &u8) { return u8.data(); }
+
+template <typename> struct is_utf8_encoded : std::false_type {};
+template <> struct is_utf8_encoded<const char*> : std::true_type {};
+template <> struct is_utf8_encoded<QByteArray> : std::true_type {};
+
+template <typename> struct is_latin1_encoded : std::false_type {};
+template <> struct is_latin1_encoded<QLatin1String> : std::true_type {};
+
+template <typename LHS, typename RHS>
+struct has_nothrow_compare {
+ enum { value = is_utf8_encoded<LHS>::value == is_utf8_encoded<RHS>::value };
+};
+
+template <typename LHS, typename RHS>
+void tst_QStringApiSymmetry::compare_impl() const
+{
+ QFETCH(QStringRef, lhsUnicode);
+ QFETCH(QLatin1String, lhsLatin1);
+ QFETCH(QStringRef, rhsUnicode);
+ QFETCH(QLatin1String, rhsLatin1);
+ QFETCH(int, caseSensitiveCompareResult);
+
+ const auto lhsU8 = lhsUnicode.toUtf8();
+ const auto rhsU8 = rhsUnicode.toUtf8();
+
+ const auto lhs = make<LHS>(lhsUnicode, lhsLatin1, lhsU8);
+ const auto rhs = make<RHS>(rhsUnicode, rhsLatin1, rhsU8);
+
+#ifdef Q_COMPILER_NOEXCEPT
+# define QVERIFY_NOEXCEPT(expr) do { \
+ if (has_nothrow_compare<LHS, RHS>::value) {} else \
+ QEXPECT_FAIL("", "Qt is missing a nothrow utf8-utf16 comparator", Continue); \
+ QVERIFY(noexcept(expr)); } while (0)
+#else
+# define QVERIFY_NOEXCEPT(expr)
+#endif
+
+#define CHECK(op) \
+ QVERIFY_NOEXCEPT(lhs op rhs); \
+ do { if (caseSensitiveCompareResult op 0) { \
+ QVERIFY(lhs op rhs); \
+ } else { \
+ QVERIFY(!(lhs op rhs)); \
+ } } while (false)
+
+ CHECK(==);
+ CHECK(!=);
+ CHECK(<);
+ CHECK(>);
+ CHECK(<=);
+ CHECK(>=);
+#undef CHECK
+}
+
+QTEST_APPLESS_MAIN(tst_QStringApiSymmetry)
+
+#include "tst_qstringapisymmetry.moc"
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index 7a361c0693..f6a1432f5c 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -73,8 +73,22 @@ void runScenario()
QCOMPARE(r, r2);
r = stringref Q stringref;
QCOMPARE(r, QString(stringref.toString() + stringref.toString()));
+ r = stringref P stringref;
+ QCOMPARE(r, QString(stringref.toString() + stringref.toString()));
r = string P l1string;
QCOMPARE(r, r2);
+ r = l1string P stringref;
+ QCOMPARE(r, QString(l1string + stringref.toString()));
+ r = stringref P l1string;
+ QCOMPARE(r, QString(stringref.toString() + l1string));
+ r = stringref P string;
+ QCOMPARE(r, QString(stringref.toString() + string));
+ r = string P stringref;
+ QCOMPARE(r, QString(string + stringref.toString()));
+ r = stringref P achar;
+ QCOMPARE(r, QString(stringref.toString() + achar));
+ r = achar P stringref;
+ QCOMPARE(r, QString(achar + stringref.toString()));
r = string Q QStringLiteral(LITERAL);
QCOMPARE(r, r2);
r = QStringLiteral(LITERAL) Q string;
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
index dc3547f9ba..2385aa992c 100644
--- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
@@ -32,9 +32,6 @@
#include <qstringlist.h>
#include <locale.h>
-#ifdef Q_OS_WINCE
-#include <windows.h> // needed for GetUserDefaultLCID
-#endif
class tst_QStringList : public QObject
{
@@ -205,13 +202,7 @@ void tst_QStringList::sort()
list2 << "BETA" << "Gamma" << "alpha" << "beta" << "epsilon" << "gAmma" << "gamma";
QCOMPARE( list1, list2 );
-#ifdef Q_OS_WINCE
- DWORD oldLcid = GetUserDefaultLCID();
- // Assume c locale to be english
- SetUserDefaultLCID(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
-#else
char *current_locale = setlocale(LC_ALL, "C");
-#endif
QStringList list3, list4;
list3 << "alpha" << "beta" << "BETA" << "gamma" << "Gamma" << "gAmma" << "epsilon";
list3.sort(Qt::CaseInsensitive);
@@ -224,11 +215,7 @@ void tst_QStringList::sort()
QCOMPARE(list4.at(0), QString("alpha"));
QVERIFY(list4.indexOf("epsilon") > 0);
QVERIFY(list4.indexOf("epsilon") < (list4.count() - 1));
-#ifdef Q_OS_WINCE
- SetUserDefaultLCID(oldLcid);
-#else
setlocale(LC_ALL, current_locale);
-#endif
}
void tst_QStringList::replaceInStrings()
@@ -354,6 +341,7 @@ void tst_QStringList::join() const
QFETCH(QString, expectedResult);
QCOMPARE(input.join(separator), expectedResult);
+ QCOMPARE(input.join(QLatin1String(separator.toLatin1())), expectedResult);
}
void tst_QStringList::join_data() const
diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
index 25b97ceaa8..d2374fe0ae 100644
--- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
+++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
@@ -81,6 +81,7 @@ private slots:
void integer_conversion();
void trimmed();
void truncate();
+ void chop();
void left();
void right();
void mid();
@@ -1904,6 +1905,48 @@ void tst_QStringRef::truncate()
}
}
+void tst_QStringRef::chop()
+{
+ const QString originalString = QStringLiteral("OriginalString~");
+ const QStringRef cref(&originalString);
+ {
+ const int n = 1;
+ QStringRef ref = cref;
+ QString str = originalString;
+ ref.chop(n);
+ str.chop(n);
+ QCOMPARE(ref.toString(), QLatin1String("OriginalString"));
+ QCOMPARE(ref.toString(), str);
+ }
+ {
+ const int n = -1;
+ QStringRef ref = cref;
+ QString str = originalString;
+ ref.chop(n);
+ str.chop(n);
+ QCOMPARE(ref.toString(), originalString);
+ QCOMPARE(ref.toString(), str);
+ }
+ {
+ const int n = 0;
+ QStringRef ref = cref;
+ QString str = originalString;
+ ref.chop(n);
+ str.chop(n);
+ QCOMPARE(ref.toString(), originalString);
+ QCOMPARE(ref.toString(), str);
+ }
+ {
+ const int n = 1000;
+ QStringRef ref = cref;
+ QString str = originalString;
+ ref.chop(n);
+ str.chop(n);
+ QCOMPARE(ref.toString(), str);
+ QVERIFY(ref.isEmpty());
+ }
+}
+
void tst_QStringRef::left()
{
QString originalString = "OrginalString~";
diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
index cf43e391b5..383f357206 100644
--- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
+++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
@@ -68,11 +68,7 @@ protected:
void tst_QTimeLine::range()
{
-#ifdef Q_OS_WINCE //On WinCE timer resolution is bad - using longer times instead
- QTimeLine timeLine(2000);
-#else
QTimeLine timeLine(200);
-#endif
QCOMPARE(timeLine.startFrame(), 0);
QCOMPARE(timeLine.endFrame(), 0);
timeLine.setFrameRange(0, 1);
diff --git a/tests/auto/corelib/tools/qtimezone/qtimezone.pro b/tests/auto/corelib/tools/qtimezone/qtimezone.pro
index 4459ed6020..afc4c59dfe 100644
--- a/tests/auto/corelib/tools/qtimezone/qtimezone.pro
+++ b/tests/auto/corelib/tools/qtimezone/qtimezone.pro
@@ -2,6 +2,6 @@ CONFIG += testcase
TARGET = tst_qtimezone
QT = core-private testlib
SOURCES = tst_qtimezone.cpp
-contains(QT_CONFIG,icu) {
+qtConfig(icu) {
DEFINES += QT_USE_ICU
}
diff --git a/tests/auto/corelib/tools/qvector/qvector.pro b/tests/auto/corelib/tools/qvector/qvector.pro
index d49516923f..b9a4ae747b 100644
--- a/tests/auto/corelib/tools/qvector/qvector.pro
+++ b/tests/auto/corelib/tools/qvector/qvector.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-contains(QT_CONFIG, c++11):CONFIG += c++11
+qtConfig(c++11): CONFIG += c++11
TARGET = tst_qvector
QT = core testlib
SOURCES = $$PWD/tst_qvector.cpp
diff --git a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
index 834fc85a29..e2ae91cb64 100644
--- a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
+++ b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
-contains(QT_CONFIG, c++11):CONFIG += c++11
-contains(QT_CONFIG, c++14):CONFIG += c++14
+qtConfig(c++11): CONFIG += c++11
+qtConfig(c++14): CONFIG += c++14
TARGET = tst_qversionnumber
QT = core testlib
SOURCES = tst_qversionnumber.cpp
diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
index 34d9256244..c37a15089a 100644
--- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
+++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
@@ -29,6 +29,7 @@
#include <QtTest/QtTest>
#include <QtCore/qversionnumber.h>
+#include <QtCore/qlibraryinfo.h>
class tst_QVersionNumber : public QObject
{
@@ -79,6 +80,7 @@ private slots:
void serialize_data();
void serialize();
void moveSemantics();
+ void qtVersion();
};
void tst_QVersionNumber::singleInstanceData()
@@ -636,6 +638,17 @@ void tst_QVersionNumber::moveSemantics()
#endif
}
+void tst_QVersionNumber::qtVersion()
+{
+ QVersionNumber v = QLibraryInfo::version();
+ QVERIFY(!v.isNull());
+ QCOMPARE(v.majorVersion(), QT_VERSION_MAJOR);
+ // we can't compare the minor and micro version:
+ // the library may change without the test being recompiled
+
+ QCOMPARE(v.toString(), QString(qVersion()));
+}
+
QTEST_APPLESS_MAIN(tst_QVersionNumber)
#include "tst_qversionnumber.moc"
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index f9e1c454e7..e45771a704 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -18,7 +18,6 @@ SUBDIRS=\
qdate \
qdatetime \
qeasingcurve \
- qelapsedtimer \
qexplicitlyshareddatapointer \
qfreelist \
qhash \
@@ -51,6 +50,7 @@ SUBDIRS=\
qstl \
qstring \
qstring_no_cast_from_bytearray \
+ qstringapisymmetry \
qstringbuilder \
qstringiterator \
qstringlist \
diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
index 9556a167c5..79cd17b5b3 100644
--- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
+++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp
@@ -65,6 +65,16 @@ static inline int best(int a, int b, int c)
return qMin(qMin(a, b), c);
}
+template <typename C>
+const C sorted_by_name(C c) { // return by const value so we can feed directly into range-for loops below
+ using T = typename C::value_type;
+ auto byName = [](const T &lhs, const T &rhs) {
+ return lhs.name() < rhs.name();
+ };
+ std::sort(c.begin(), c.end(), byName);
+ return c;
+}
+
/**
* Opens \a filename and returns content produced as per
* xmlconf/xmltest/canonxml.html.
@@ -97,7 +107,8 @@ static QByteArray makeCanonical(const QString &filename,
while (!reader.atEnd()) {
reader.readNext();
if (reader.isDTD()) {
- if (!reader.notationDeclarations().isEmpty()) {
+ const auto notationDeclarations = reader.notationDeclarations();
+ if (!notationDeclarations.isEmpty()) {
QString dtd;
QTextStream writeDtd(&dtd);
@@ -105,10 +116,7 @@ static QByteArray makeCanonical(const QString &filename,
writeDtd << docType;
writeDtd << " [";
writeDtd << endl;
- QMap<QString, QXmlStreamNotationDeclaration> sortedNotationDeclarations;
- foreach (QXmlStreamNotationDeclaration notation, reader.notationDeclarations())
- sortedNotationDeclarations.insert(notation.name().toString(), notation);
- foreach (QXmlStreamNotationDeclaration notation, sortedNotationDeclarations.values()) {
+ for (const QXmlStreamNotationDeclaration &notation : sorted_by_name(notationDeclarations)) {
writeDtd << "<!NOTATION ";
writeDtd << notation.name().toString();
if (notation.publicId().isEmpty()) {
@@ -135,11 +143,7 @@ static QByteArray makeCanonical(const QString &filename,
}
} else if (reader.isStartElement()) {
writer.writeStartElement(reader.namespaceUri().toString(), reader.name().toString());
-
- QMap<QString, QXmlStreamAttribute> sortedAttributes;
- foreach(QXmlStreamAttribute attribute, reader.attributes())
- sortedAttributes.insert(attribute.name().toString(), attribute);
- foreach(QXmlStreamAttribute attribute, sortedAttributes.values())
+ for (const QXmlStreamAttribute &attribute : sorted_by_name(reader.attributes()))
writer.writeAttribute(attribute);
writer.writeCharacters(QString()); // write empty string to avoid having empty xml tags
} else if (reader.isCharacters()) {
@@ -236,6 +240,8 @@ public:
*/
class MissedBaseline
{
+ friend class QVector<MissedBaseline>;
+ MissedBaseline() {} // for QVector, don't use
public:
MissedBaseline(const QString &aId,
const QByteArray &aExpected,
@@ -247,13 +253,20 @@ public:
qFatal("%s: aId must not be an empty string", Q_FUNC_INFO);
}
+ void swap(MissedBaseline &other) Q_DECL_NOTHROW
+ {
+ qSwap(id, other.id);
+ qSwap(expected, other.expected);
+ qSwap(output, other.output);
+ }
+
QString id;
QByteArray expected;
QByteArray output;
};
- QList<GeneralFailure> failures;
- QList<MissedBaseline> missedBaselines;
+ QVector<GeneralFailure> failures;
+ QVector<MissedBaseline> missedBaselines;
/**
* The count of how many tests that were run.
@@ -507,6 +520,9 @@ private:
QString m_ch;
QStack<QUrl> m_baseURI;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_SHARED(TestSuiteHandler::MissedBaseline)
+QT_END_NAMESPACE
class tst_QXmlStream: public QObject
{
@@ -718,8 +734,9 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
writer << " qualifiedName=\"" << reader.qualifiedName().toString() << '"';
if (!reader.prefix().isEmpty())
writer << " prefix=\"" << reader.prefix().toString() << '"';
- if (reader.attributes().size()) {
- foreach(QXmlStreamAttribute attribute, reader.attributes()) {
+ const auto attributes = reader.attributes();
+ if (attributes.size()) {
+ for (const QXmlStreamAttribute &attribute : attributes) {
writer << endl << " Attribute(";
if (!attribute.name().isEmpty())
writer << " name=\"" << attribute.name().toString() << '"';
@@ -734,8 +751,9 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
writer << " )" << endl;
}
}
- if (reader.namespaceDeclarations().size()) {
- foreach(QXmlStreamNamespaceDeclaration namespaceDeclaration, reader.namespaceDeclarations()) {
+ const auto namespaceDeclarations = reader.namespaceDeclarations();
+ if (namespaceDeclarations.size()) {
+ for (const QXmlStreamNamespaceDeclaration &namespaceDeclaration : namespaceDeclarations) {
writer << endl << " NamespaceDeclaration(";
if (!namespaceDeclaration.prefix().isEmpty())
writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << '"';
@@ -744,8 +762,9 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
writer << " )" << endl;
}
}
- if (reader.notationDeclarations().size()) {
- foreach(QXmlStreamNotationDeclaration notationDeclaration, reader.notationDeclarations()) {
+ const auto notationDeclarations = reader.notationDeclarations();
+ if (notationDeclarations.size()) {
+ for (const QXmlStreamNotationDeclaration &notationDeclaration : notationDeclarations) {
writer << endl << " NotationDeclaration(";
if (!notationDeclaration.name().isEmpty())
writer << " name=\"" << notationDeclaration.name().toString() << '"';
@@ -756,8 +775,9 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
writer << " )" << endl;
}
}
- if (reader.entityDeclarations().size()) {
- foreach(QXmlStreamEntityDeclaration entityDeclaration, reader.entityDeclarations()) {
+ const auto entityDeclarations = reader.entityDeclarations();
+ if (entityDeclarations.size()) {
+ for (const QXmlStreamEntityDeclaration &entityDeclaration : entityDeclarations) {
writer << endl << " EntityDeclaration(";
if (!entityDeclaration.name().isEmpty())
writer << " name=\"" << entityDeclaration.name().toString() << '"';
@@ -803,7 +823,8 @@ void tst_QXmlStream::testReader_data() const
QTest::addColumn<QString>("ref");
QDir dir;
dir.cd(QFINDTESTDATA("data/"));
- foreach(QString filename , dir.entryList(QStringList() << "*.xml")) {
+ const auto fileNames = dir.entryList(QStringList() << "*.xml");
+ for (const QString &filename : fileNames) {
QString reference = QFileInfo(filename).baseName() + ".ref";
QTest::newRow(dir.filePath(filename).toLatin1().data()) << dir.filePath(filename) << dir.filePath(reference);
}
diff --git a/tests/auto/dbus/dbus.pro b/tests/auto/dbus/dbus.pro
index c5cddee5f5..1769583fca 100644
--- a/tests/auto/dbus/dbus.pro
+++ b/tests/auto/dbus/dbus.pro
@@ -26,6 +26,6 @@ SUBDIRS+=\
qdbusthreading \
qdbusxmlparser
-!contains(QT_CONFIG,private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qdbusmarshall \
diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
index 0def290eff..0edc5a92ea 100644
--- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
+++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp
@@ -1818,7 +1818,7 @@ void tst_QDBusAbstractAdaptor::typeMatching_data()
LLDateTimeMap lldtmap;
lldtmap[-1] = QDateTime();
QDateTime now = QDateTime::currentDateTime();
- lldtmap[now.toTime_t()] = now; // array of struct of int64 and struct of 3 ints and struct of 4 ints and int
+ lldtmap[now.toSecsSinceEpoch()] = now; // array of struct of int64 and struct of 3 ints and struct of 4 ints and int
QTest::newRow("lldtmap") << "LLDateTimeMap" << "a{x((iii)(iiii)i)}" << QVariant::fromValue(lldtmap);
MyStruct s;
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index 4a09dca544..95daa256b5 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -1057,6 +1057,48 @@ void tst_QDBusConnection::multipleInterfacesInQObject()
QVERIFY_HOOKCALLED();
}
+void tst_QDBusConnection::connectSignal()
+{
+ if (!QCoreApplication::instance())
+ QSKIP("Test requires a QCoreApplication");
+
+ QDBusConnection con = QDBusConnection::sessionBus();
+
+ QDBusMessage signal = QDBusMessage::createSignal("/", "org.qtproject.TestCase",
+ "oneSignal");
+ signal << "one parameter";
+
+ SignalReceiver recv;
+ QVERIFY(con.connect(con.baseService(), signal.path(), signal.interface(),
+ signal.member(), &recv, SLOT(oneSlot(QString))));
+ QVERIFY(con.send(signal));
+ QTest::qWait(100);
+ QCOMPARE(recv.argumentReceived, signal.arguments().at(0).toString());
+ QCOMPARE(recv.signalsReceived, 1);
+
+ // disconnect and try with a signature
+ recv.argumentReceived.clear();
+ recv.signalsReceived = 0;
+ QVERIFY(con.disconnect(con.baseService(), signal.path(), signal.interface(),
+ signal.member(), &recv, SLOT(oneSlot(QString))));
+ QVERIFY(con.connect(con.baseService(), signal.path(), signal.interface(),
+ signal.member(), "s", &recv, SLOT(oneSlot(QString))));
+ QVERIFY(con.send(signal));
+ QTest::qWait(100);
+ QCOMPARE(recv.argumentReceived, signal.arguments().at(0).toString());
+ QCOMPARE(recv.signalsReceived, 1);
+
+ // confirm that we are, indeed, a unique connection
+ recv.argumentReceived.clear();
+ recv.signalsReceived = 0;
+ QVERIFY(!con.connect(con.baseService(), signal.path(), signal.interface(),
+ signal.member(), "s", &recv, SLOT(oneSlot(QString))));
+ QVERIFY(con.send(signal));
+ QTest::qWait(100);
+ QCOMPARE(recv.argumentReceived, signal.arguments().at(0).toString());
+ QCOMPARE(recv.signalsReceived, 1);
+}
+
void tst_QDBusConnection::slotsWithLessParameters()
{
if (!QCoreApplication::instance())
@@ -1068,25 +1110,36 @@ void tst_QDBusConnection::slotsWithLessParameters()
"oneSignal");
signal << "one parameter";
- signalsReceived = 0;
+ SignalReceiver recv;
QVERIFY(con.connect(con.baseService(), signal.path(), signal.interface(),
- signal.member(), this, SLOT(oneSlot())));
+ signal.member(), &recv, SLOT(oneSlot())));
QVERIFY(con.send(signal));
QTest::qWait(100);
- QCOMPARE(signalsReceived, 1);
+ QCOMPARE(recv.argumentReceived, QString());
+ QCOMPARE(recv.signalsReceived, 1);
// disconnect and try with a signature
- signalsReceived = 0;
+ recv.signalsReceived = 0;
QVERIFY(con.disconnect(con.baseService(), signal.path(), signal.interface(),
- signal.member(), this, SLOT(oneSlot())));
+ signal.member(), &recv, SLOT(oneSlot())));
QVERIFY(con.connect(con.baseService(), signal.path(), signal.interface(),
- signal.member(), "s", this, SLOT(oneSlot())));
+ signal.member(), "s", &recv, SLOT(oneSlot())));
+ QVERIFY(con.send(signal));
+ QTest::qWait(100);
+ QCOMPARE(recv.argumentReceived, QString());
+ QCOMPARE(recv.signalsReceived, 1);
+
+ // confirm that we are, indeed, a unique connection
+ recv.signalsReceived = 0;
+ QVERIFY(!con.connect(con.baseService(), signal.path(), signal.interface(),
+ signal.member(), "s", &recv, SLOT(oneSlot())));
QVERIFY(con.send(signal));
QTest::qWait(100);
- QCOMPARE(signalsReceived, 1);
+ QCOMPARE(recv.argumentReceived, QString());
+ QCOMPARE(recv.signalsReceived, 1);
}
-void tst_QDBusConnection::secondCallWithCallback()
+void SignalReceiver::secondCallWithCallback()
{
QDBusConnection con = QDBusConnection::sessionBus();
QDBusMessage msg = QDBusMessage::createMethodCall(con.baseService(), "/test", QString(),
@@ -1106,12 +1159,12 @@ void tst_QDBusConnection::nestedCallWithCallback()
QDBusMessage msg = QDBusMessage::createMethodCall(connection.baseService(), "/test", QString(),
"ThisFunctionDoesntExist");
- signalsReceived = 0;
- connection.callWithCallback(msg, this, SLOT(exitLoop()), SLOT(secondCallWithCallback()), 10);
+ SignalReceiver recv;
+ connection.callWithCallback(msg, &recv, SLOT(exitLoop()), SLOT(secondCallWithCallback()), 10);
QTestEventLoop::instance().enterLoop(15);
QVERIFY(!QTestEventLoop::instance().timeout());
- QCOMPARE(signalsReceived, 1);
+ QCOMPARE(recv.signalsReceived, 1);
QCOMPARE_HOOKCOUNT(2);
}
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
index b9eb0d9db7..b4d689e6f4 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
@@ -69,20 +69,30 @@ public:
MyObjectWithoutInterface(QObject *parent = 0) : QObject(parent), callCount(0) {}
};
-class tst_QDBusConnection: public QObject
+class SignalReceiver : public QObject
{
Q_OBJECT
-
- int signalsReceived;
public:
- static int hookCallCount;
- tst_QDBusConnection();
+ QString argumentReceived;
+ int signalsReceived;
+ SignalReceiver() : signalsReceived(0) {}
public slots:
+ void oneSlot(const QString &arg) { ++signalsReceived; argumentReceived = arg;}
void oneSlot() { ++signalsReceived; }
void exitLoop() { ++signalsReceived; QTestEventLoop::instance().exitLoop(); }
void secondCallWithCallback();
+};
+
+class tst_QDBusConnection: public QObject
+{
+ Q_OBJECT
+
+public:
+ static int hookCallCount;
+ tst_QDBusConnection();
+public slots:
void init();
void cleanup();
@@ -115,6 +125,7 @@ private slots:
void callSelfByAnotherName();
void multipleInterfacesInQObject();
+ void connectSignal();
void slotsWithLessParameters();
void nestedCallWithCallback();
diff --git a/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro
index e9a41c0fb4..caedb5a0f2 100644
--- a/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro
+++ b/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro
@@ -6,4 +6,4 @@ SUBDIRS = qpong qdbusmarshall
QT = core-private testlib
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro
index b0442a0ee4..031cc252c8 100644
--- a/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro
+++ b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro
@@ -5,10 +5,9 @@ DESTDIR = ./
QT = core-private dbus-private testlib
-contains(QT_CONFIG, dbus-linked) {
+qtConfig(dbus-linked) {
DEFINES += QT_LINKED_LIBDBUS
- LIBS += $$QT_LIBS_DBUS
- QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+ QMAKE_USE += dbus
} else {
SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp
}
diff --git a/tests/auto/dbus/qdbustype/qdbustype.pro b/tests/auto/dbus/qdbustype/qdbustype.pro
index 17ae349675..75a9980732 100644
--- a/tests/auto/dbus/qdbustype/qdbustype.pro
+++ b/tests/auto/dbus/qdbustype/qdbustype.pro
@@ -2,10 +2,9 @@ CONFIG += testcase parallel_test
TARGET = tst_qdbustype
QT = core-private dbus-private testlib
SOURCES += tst_qdbustype.cpp
-contains(QT_CONFIG, dbus-linked) {
+qtConfig(dbus-linked) {
DEFINES += QT_LINKED_LIBDBUS
- LIBS += $$QT_LIBS_DBUS
- QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+ QMAKE_USE += dbus
} else {
SOURCES += ../../../../src/dbus/qdbus_symbols.cpp
}
diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro
index d3393663ed..8d8a2df393 100644
--- a/tests/auto/gui/gui.pro
+++ b/tests/auto/gui/gui.pro
@@ -3,7 +3,7 @@ TEMPLATE=subdirs
SUBDIRS = \
kernel
-!ios: SUBDIRS += \
+!uikit: SUBDIRS += \
image \
math3d \
painting \
@@ -13,4 +13,4 @@ SUBDIRS = \
util \
itemmodels \
-!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= qopengl qopenglconfig
+!qtConfig(opengl(es2)?): SUBDIRS -= qopengl qopenglconfig
diff --git a/tests/auto/gui/image/image.pro b/tests/auto/gui/image/image.pro
index 9199763c40..5a74df4c78 100644
--- a/tests/auto/gui/image/image.pro
+++ b/tests/auto/gui/image/image.pro
@@ -14,6 +14,6 @@ SUBDIRS=\
!qtHaveModule(network): SUBDIRS -= \
qimagereader
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qpixmapcache \
diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro
index 485472c70c..46bfb2a586 100644
--- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro
+++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro
@@ -3,14 +3,5 @@ TARGET = tst_qicoimageformat
SOURCES+= tst_qicoimageformat.cpp
QT += testlib
-wince {
- CONFIG(debug, debug|release):{
- addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll
- } else {
- addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll
- }
- addPlugins.path = imageformats
- DEPLOYMENT += addPlugins
-}
TESTDATA += icons/*
android:RESOURCES+=qicoimageformat.qrc
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index a0914b7700..4218d0751f 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -393,7 +393,6 @@ void tst_QIcon::addFile()
icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png"), QSize(), QIcon::Selected);
icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-save-128.png"), QSize(), QIcon::Selected);
-#ifndef Q_OS_WINCE
QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() ==
QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage());
QVERIFY(icon.pixmap(32, QIcon::Normal).toImage() ==
@@ -406,13 +405,6 @@ void tst_QIcon::addFile()
QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-32.png")).toImage());
QVERIFY(icon.pixmap(128, QIcon::Selected).toImage() ==
QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-128.png")).toImage());
-#else
- // WinCE only includes the 16x16 images for size reasons
- QVERIFY(icon.pixmap(16, QIcon::Normal).toImage() ==
- QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png")).toImage());
- QVERIFY(icon.pixmap(16, QIcon::Selected).toImage() ==
- QPixmap(QLatin1String(":/styles/commonstyle/images/standardbutton-save-16.png")).toImage());
-#endif
}
static bool sizeLess(const QSize &a, const QSize &b)
diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro
index 36d64a275f..39ce4e26cb 100644
--- a/tests/auto/gui/image/qimage/qimage.pro
+++ b/tests/auto/gui/image/qimage/qimage.pro
@@ -3,7 +3,7 @@ TARGET = tst_qimage
SOURCES += tst_qimage.cpp
QT += core-private gui-private testlib
-contains(QT_CONFIG, c++11): CONFIG += c++11
+qtConfig(c++11): CONFIG += c++11
android: RESOURCES+=qimage.qrc
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 85d258de5b..a1ab812aaa 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -39,6 +39,10 @@
#include <private/qimage_p.h>
#include <private/qdrawhelper_p.h>
+#ifdef Q_OS_DARWIN
+#include <CoreGraphics/CoreGraphics.h>
+#endif
+
Q_DECLARE_METATYPE(QImage::Format)
Q_DECLARE_METATYPE(Qt::GlobalColor)
@@ -108,6 +112,7 @@ private slots:
void smoothScale();
void smoothScale2_data();
void smoothScale2();
+ void smoothScale3_data();
void smoothScale3();
void smoothScale4();
@@ -197,6 +202,14 @@ private slots:
void pixelColor();
void pixel();
+ void ditherGradient_data();
+ void ditherGradient();
+
+#ifdef Q_OS_DARWIN
+ void toCGImage_data();
+ void toCGImage();
+#endif
+
private:
const QString m_prefix;
};
@@ -292,17 +305,13 @@ void tst_QImage::swap()
void tst_QImage::create()
{
bool cr = true;
-#if !defined(Q_OS_WINCE)
QT_TRY {
-#endif
//QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian);
QImage image(7000000, 7000000, QImage::Format_Indexed8);
image.setColorCount(256);
cr = !image.isNull();
-#if !defined(Q_OS_WINCE)
} QT_CATCH (...) {
}
-#endif
QVERIFY( !cr );
}
@@ -1750,9 +1759,12 @@ static inline int rand8()
return int(256. * (qrand() / (RAND_MAX + 1.0)));
}
-// compares img.scale against the bilinear filtering used by QPainter
-void tst_QImage::smoothScale3()
+void tst_QImage::smoothScale3_data()
{
+ QTest::addColumn<QImage>("img");
+ QTest::addColumn<qreal>("scale_x");
+ QTest::addColumn<qreal>("scale_y");
+
QImage img(128, 128, QImage::Format_RGB32);
for (int y = 0; y < img.height(); ++y) {
for (int x = 0; x < img.width(); ++x) {
@@ -1765,36 +1777,49 @@ void tst_QImage::smoothScale3()
}
}
- qreal scales[2] = { .5, 2 };
+ QTest::newRow("(0.5, 0.5)") << img << qreal(0.5) << qreal(0.5);
+ QTest::newRow("(0.5, 1.0)") << img << qreal(0.5) << qreal(1.0);
+ QTest::newRow("(1.0, 0.5)") << img << qreal(1.0) << qreal(0.5);
+ QTest::newRow("(0.5, 2.0)") << img << qreal(0.5) << qreal(2.0);
+ QTest::newRow("(1.0, 2.0)") << img << qreal(1.0) << qreal(2.0);
+ QTest::newRow("(2.0, 0.5)") << img << qreal(2.0) << qreal(0.5);
+ QTest::newRow("(2.0, 1.0)") << img << qreal(2.0) << qreal(1.0);
+ QTest::newRow("(2.0, 2.0)") << img << qreal(2) << qreal(2);
+}
+// compares img.scale against the bilinear filtering used by QPainter
+void tst_QImage::smoothScale3()
+{
+ QFETCH(QImage, img);
+ QFETCH(qreal, scale_x);
+ QFETCH(qreal, scale_y);
- for (int i = 0; i < 2; ++i) {
- QImage a = img.scaled(img.size() * scales[i], Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- QImage b(a.size(), a.format());
- b.fill(0x0);
+ QImage a = img.scaled(img.width() * scale_x, img.height() * scale_y, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ QImage b(a.size(), a.format());
+ b.fill(0x0);
- QPainter p(&b);
- p.setRenderHint(QPainter::SmoothPixmapTransform);
- p.scale(scales[i], scales[i]);
- p.drawImage(0, 0, img);
- p.end();
- int err = 0;
-
- for (int y = 0; y < a.height(); ++y) {
- for (int x = 0; x < a.width(); ++x) {
- QRgb ca = a.pixel(x, y);
- QRgb cb = b.pixel(x, y);
-
- // tolerate a little bit of rounding errors
- bool r = true;
- r &= qAbs(qRed(ca) - qRed(cb)) <= 18;
- r &= qAbs(qGreen(ca) - qGreen(cb)) <= 18;
- r &= qAbs(qBlue(ca) - qBlue(cb)) <= 18;
- if (!r)
- err++;
- }
+ QPainter p(&b);
+ p.setRenderHint(QPainter::SmoothPixmapTransform);
+ p.scale(scale_x, scale_y);
+ p.drawImage(0, 0, img);
+ p.end();
+ int err = 0;
+
+ for (int y = 0; y < a.height(); ++y) {
+ for (int x = 0; x < a.width(); ++x) {
+ QRgb ca = a.pixel(x, y);
+ QRgb cb = b.pixel(x, y);
+
+ // tolerate a little bit of rounding errors
+ int tolerance = 3;
+ bool r = true;
+ r &= qAbs(qRed(ca) - qRed(cb)) <= tolerance;
+ r &= qAbs(qGreen(ca) - qGreen(cb)) <= tolerance;
+ r &= qAbs(qBlue(ca) - qBlue(cb)) <= tolerance;
+ if (!r)
+ err++;
}
- QCOMPARE(err, 0);
}
+ QCOMPARE(err, 0);
}
// Tests smooth upscale is smooth
@@ -1819,11 +1844,7 @@ void tst_QImage::smoothScale4()
void tst_QImage::smoothScaleBig()
{
-#if defined(Q_OS_WINCE)
- int bigValue = 2000;
-#else
int bigValue = 200000;
-#endif
QImage tall(4, bigValue, QImage::Format_ARGB32);
tall.fill(0x0);
@@ -3222,5 +3243,114 @@ void tst_QImage::pixel()
}
}
+void tst_QImage::ditherGradient_data()
+{
+ QTest::addColumn<QImage>("image");
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addColumn<int>("flags");
+ QTest::addColumn<int>("minimumExpectedGradient");
+
+ QImage rgb32(256, 16, QImage::Format_RGB32);
+ QLinearGradient gradient(QRectF(rgb32.rect()).topLeft(), QRectF(rgb32.rect()).topRight());
+ gradient.setColorAt(0.0, QColor(0, 0, 0));
+ gradient.setColorAt(1.0, QColor(255, 255, 255));
+ QPainter p;
+ p.begin(&rgb32);
+ p.fillRect(rgb32.rect(), gradient);
+ p.end();
+
+ QTest::newRow("rgb32 -> rgb444 (no dither)") << rgb32 << QImage::Format_RGB444 << 0 << 16;
+ QTest::newRow("rgb32 -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("rgb32 -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("rgb32 -> rgb16 (no dither)") << rgb32 << QImage::Format_RGB16 << 0 << 32;
+ QTest::newRow("rgb32 -> rgb16 (dithering)") << rgb32 << QImage::Format_RGB16 << int(Qt::PreferDither | Qt::OrderedDither) << 65;
+ QTest::newRow("rgb32 -> rgb666 (no dither)") << rgb32 << QImage::Format_RGB666 << 0 << 64;
+ QTest::newRow("rgb32 -> rgb666 (dithering)") << rgb32 << QImage::Format_RGB666 << int(Qt::PreferDither | Qt::OrderedDither) << 129;
+
+ // Test we get the same results for opaque input in the ARGBPM implementation.
+ rgb32 = qMove(rgb32).convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ QTest::newRow("argb32pm -> argb4444pm (no dither)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << 0 << 16;
+ QTest::newRow("argb32pm -> rgb444 (dithering)") << rgb32 << QImage::Format_RGB444 << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("argb32pm -> argb4444pm (dithering)") << rgb32 << QImage::Format_ARGB4444_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 33;
+ QTest::newRow("argb32pm -> argb8565pm (no dither)") << rgb32 << QImage::Format_ARGB8565_Premultiplied << 0 << 32;
+ QTest::newRow("argb32pm -> argb8565pm (dithering)") << rgb32 << QImage::Format_ARGB8565_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 65;
+ QTest::newRow("argb32pm -> argb6666pm (no dither)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << 0 << 64;
+ QTest::newRow("argb32pm -> argb6666pm (dithering)") << rgb32 << QImage::Format_ARGB6666_Premultiplied << int(Qt::PreferDither | Qt::OrderedDither) << 129;
+
+ QImage rgb30(1024, 16, QImage::Format_RGB30);
+ QLinearGradient gradient30(QRectF(rgb30.rect()).topLeft(), QRectF(rgb30.rect()).topRight());
+ gradient30.setColorAt(0.0, QColor(0, 0, 0));
+ gradient30.setColorAt(1.0, QColor(255, 255, 255));
+ p.begin(&rgb30);
+ p.fillRect(rgb30.rect(), gradient30);
+ p.end();
+
+ QTest::newRow("rgb30 -> rgb32 (no dither)") << rgb30 << QImage::Format_RGB32 << 0 << 256;
+ QTest::newRow("rgb30 -> rgb32 (dithering)") << rgb30 << QImage::Format_RGB32 << int(Qt::PreferDither | Qt::OrderedDither) << 513;
+ QTest::newRow("rgb30 -> rgb888 (no dither)") << rgb30 << QImage::Format_RGB888 << 0 << 256;
+ QTest::newRow("rgb30 -> rgb888 (dithering)") << rgb30 << QImage::Format_RGB888 << int(Qt::PreferDither | Qt::OrderedDither) << 513;
+}
+
+void tst_QImage::ditherGradient()
+{
+ QFETCH(QImage, image);
+ QFETCH(QImage::Format, format);
+ QFETCH(int, flags);
+ QFETCH(int, minimumExpectedGradient);
+
+ QImage converted = image.convertToFormat(format, (Qt::ImageConversionFlags)flags);
+ int observedGradientSteps = 0;
+ int lastTotal = -1;
+ for (int i = 0; i < converted.width(); ++i) {
+ int total = 0;
+ for (int j = 0; j < converted.height(); ++j) {
+ uint c = converted.pixel(i, j);
+ QCOMPARE(qAlpha(c), 255);
+ total += qRed(c);
+ }
+ if (total > lastTotal) {
+ observedGradientSteps++;
+ lastTotal = total;
+ }
+ }
+ QVERIFY(observedGradientSteps >= minimumExpectedGradient);
+}
+
+#ifdef Q_OS_DARWIN
+
+void tst_QImage::toCGImage_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+ QTest::addColumn<bool>("supported");
+
+ // Populate test data with supported status for all QImage formats.
+ QSet<QImage::Format> supported =
+ { QImage::Format_ARGB32, QImage::Format_RGB32, QImage::Format_RGBA8888_Premultiplied,
+ QImage::Format_RGBA8888, QImage::Format_RGBX8888, QImage::Format_ARGB32_Premultiplied };
+
+ for (int i = QImage::Format_Invalid; i < QImage::Format_Grayscale8; ++i) {
+ QTest::newRow(qPrintable(formatToString(QImage::Format(i))))
+ << QImage::Format(i) << supported.contains(QImage::Format(i));
+ }
+}
+
+// Verify that toCGImage() returns a valid CGImageRef for supported image formats.
+void tst_QImage::toCGImage()
+{
+ QFETCH(QImage::Format, format);
+ QFETCH(bool, supported);
+
+ QImage qimage(64, 64, format);
+ qimage.fill(Qt::red);
+
+ CGImageRef cgimage = qimage.toCGImage();
+ QCOMPARE(cgimage != nullptr, supported);
+
+ CGImageRelease(cgimage);
+}
+
+#endif
+
+
QTEST_GUILESS_MAIN(tst_QImage)
#include "tst_qimage.moc"
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index 7a94217641..191aabdf6a 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -239,7 +239,7 @@ void tst_QImageWriter::writeImage2_data()
foreach (const QString format, formats) {
const QString fileName = QLatin1String("solidcolor_")
+ QString::number(imgFormat) + QLatin1Char('.') + format;
- QTest::newRow(fileName.toLatin1()) << fileName
+ QTest::newRow(fileName.toLatin1()) << writePrefix + fileName
<< format.toLatin1()
<< image;
}
@@ -496,9 +496,6 @@ void tst_QImageWriter::saveToTemporaryFile()
QVERIFY(writer.write(image));
else
qWarning() << file.errorString();
-#if defined(Q_OS_WINCE)
- file.reset();
-#endif
QCOMPARE(QImage(writer.fileName()), image);
}
{
@@ -513,18 +510,15 @@ void tst_QImageWriter::saveToTemporaryFile()
}
{
// 3) Via QImageWriter's API, with a named temp file
- QTemporaryFile file("tempXXXXXX");
+ QTemporaryFile file(writePrefix + QLatin1String("tempXXXXXX"));
QVERIFY2(file.open(), qPrintable(file.errorString()));
QImageWriter writer(&file, "PNG");
QVERIFY(writer.write(image));
-#if defined(Q_OS_WINCE)
- file.reset();
-#endif
QCOMPARE(QImage(writer.fileName()), image);
}
{
// 4) Via QImage's API, with a named temp file
- QTemporaryFile file("tempXXXXXX");
+ QTemporaryFile file(writePrefix + QLatin1String("tempXXXXXX"));
QVERIFY2(file.open(), qPrintable(file.errorString()));
QVERIFY(image.save(&file, "PNG"));
file.reset();
diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro
index a04ad73b80..1de428a685 100644
--- a/tests/auto/gui/image/qmovie/qmovie.pro
+++ b/tests/auto/gui/image/qmovie/qmovie.pro
@@ -1,12 +1,13 @@
CONFIG += testcase
TARGET = tst_qmovie
QT += testlib
+QT_FOR_CONFIG += gui-private
qtHaveModule(widgets): QT += widgets
SOURCES += tst_qmovie.cpp
MOC_DIR=tmp
-!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
+qtConfig(gif): DEFINES += QTEST_HAVE_GIF
+qtConfig(jpeg): DEFINES += QTEST_HAVE_JPEG
RESOURCES += resources.qrc
TESTDATA += animations/*
diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro
index 5a4656998a..e6a020af1a 100644
--- a/tests/auto/gui/image/qpixmap/qpixmap.pro
+++ b/tests/auto/gui/image/qpixmap/qpixmap.pro
@@ -5,9 +5,7 @@ QT += core-private gui-private testlib
qtHaveModule(widgets): QT += widgets widgets-private
SOURCES += tst_qpixmap.cpp
-!wince:!winrt {
- win32:LIBS += -lgdi32 -luser32
-}
+win32:!winrt:LIBS += -lgdi32 -luser32
RESOURCES += qpixmap.qrc
TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/*
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 6adfe05fb0..79d3a57d73 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -442,22 +442,16 @@ void tst_QPixmap::fill_data()
QTest::newRow(("syscolor_" + QByteArray::number(color)).constData())
<< uint(color) << true << false;
-#if defined (Q_OS_WINCE)
- QPixmap pixmap(1,1);
- if (QApplication::desktop()->grab().depth() >= 24) {
-#else
- QPixmap pixmap(1, 1); {
-#endif
- QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false;
- QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false;
- QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false;
- QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false;
- QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false;
- QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false;
- QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false;
- QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false;
- QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false;
- }
+ QPixmap pixmap(1, 1);
+ QTest::newRow("alpha_7f_red") << 0x7fff0000u << false << false;
+ QTest::newRow("alpha_3f_blue") << 0x3f0000ffu << false << false;
+ QTest::newRow("alpha_b7_green") << 0xbf00ff00u << false << false;
+ QTest::newRow("alpha_7f_white") << 0x7fffffffu << false << false;
+ QTest::newRow("alpha_3f_white") << 0x3fffffffu << false << false;
+ QTest::newRow("alpha_b7_white") << 0xb7ffffffu << false << false;
+ QTest::newRow("alpha_7f_black") << 0x7f000000u << false << false;
+ QTest::newRow("alpha_3f_black") << 0x3f000000u << false << false;
+ QTest::newRow("alpha_b7_black") << 0xbf000000u << false << false;
QTest::newRow("bitmap_color0") << uint(Qt::color0) << true << true;
QTest::newRow("bitmap_color1") << uint(Qt::color1) << true << true;
@@ -891,9 +885,6 @@ void tst_QPixmap::fromWinHBITMAP()
HGDIOBJ old_brush = SelectObject(bitmap_dc, CreateSolidBrush(RGB(red, green, blue)));
Rectangle(bitmap_dc, 0, 0, 100, 100);
-#ifdef Q_OS_WINCE //the device context has to be deleted before QPixmap::fromWinHBITMAP()
- DeleteDC(bitmap_dc);
-#endif
QPixmap pixmap = qt_pixmapFromWinHBITMAP(bitmap);
QCOMPARE(pixmap.width(), 100);
QCOMPARE(pixmap.height(), 100);
@@ -906,9 +897,7 @@ void tst_QPixmap::fromWinHBITMAP()
DeleteObject(SelectObject(bitmap_dc, old_brush));
DeleteObject(SelectObject(bitmap_dc, bitmap));
-#ifndef Q_OS_WINCE
DeleteDC(bitmap_dc);
-#endif
ReleaseDC(0, display_dc);
}
@@ -1010,7 +999,6 @@ void tst_QPixmap::fromWinHICON_data()
void tst_QPixmap::fromWinHICON()
{
-#ifndef Q_OS_WINCE
QFETCH(int, width);
QFETCH(int, height);
QFETCH(QString, image);
@@ -1028,7 +1016,6 @@ void tst_QPixmap::fromWinHICON()
// between QImage::Format_ARGB32 and QImage::Format_ARGB32_Premultiplied, or elsewhere
QVERIFY(compareImages(imageFromHICON, imageFromFile));
-#endif // Q_OS_WINCE
}
#endif // Q_OS_WIN && !Q_OS_WINRT
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 5000e1a926..631962ad34 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -25,7 +25,7 @@ SUBDIRS=\
qopenglwindow \
qrasterwindow
-win32:!wince:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
+win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
!qtHaveModule(widgets): SUBDIRS -= \
qmouseevent_modal \
@@ -34,4 +34,6 @@ win32:!wince:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop
!qtHaveModule(network): SUBDIRS -= \
qguieventloop
-!contains(QT_CONFIG, opengl(es2)?): SUBDIRS -= qopenglwindow
+!qtConfig(opengl(es2)?): SUBDIRS -= qopenglwindow
+
+uikit: SUBDIRS -= qclipboard
diff --git a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
index a42b359f29..7e98704aea 100644
--- a/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
+++ b/tests/auto/gui/kernel/noqteventloop/noqteventloop.pro
@@ -5,4 +5,4 @@ QT += core-private network gui-private testlib
SOURCES += tst_noqteventloop.cpp
-contains(QT_CONFIG,dynamicgl):win32:!wince*:!winrt: LIBS += -luser32
+qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32
diff --git a/tests/auto/gui/kernel/qclipboard/copier/main.cpp b/tests/auto/gui/kernel/qclipboard/copier/main.cpp
index 22f2aa3bb8..32e91a9939 100644
--- a/tests/auto/gui/kernel/qclipboard/copier/main.cpp
+++ b/tests/auto/gui/kernel/qclipboard/copier/main.cpp
@@ -33,11 +33,9 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QString paste = QStringLiteral("testString.!");
-#ifndef Q_OS_WINCE
const QStringList arguments = app.arguments();
if (arguments.size() > 1)
paste = arguments.at(1);
-#endif
#ifndef QT_NO_CLIPBOARD
QGuiApplication::clipboard()->setText(paste);
#endif
diff --git a/tests/auto/gui/kernel/qclipboard/paster/main.cpp b/tests/auto/gui/kernel/qclipboard/paster/main.cpp
index c96d903fb7..7fca8af1cb 100644
--- a/tests/auto/gui/kernel/qclipboard/paster/main.cpp
+++ b/tests/auto/gui/kernel/qclipboard/paster/main.cpp
@@ -66,13 +66,9 @@ int main(int argc, char **argv)
return 0;
}
-#ifndef Q_OS_WINCE
QString expected;
if (parser.isSet(textOption))
expected = parser.value(textOption);
-#else // !Q_OS_WINCE
- const QString expected = QStringLiteral("testString.!");
-#endif // Q_OS_WINCE
if (!expected.isEmpty()) {
#ifndef QT_NO_CLIPBOARD
const QString actual = QGuiApplication::clipboard()->text();
diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro
index 40bf9c8d8e..59b77b11ba 100644
--- a/tests/auto/gui/kernel/qclipboard/test/test.pro
+++ b/tests/auto/gui/kernel/qclipboard/test/test.pro
@@ -13,10 +13,6 @@ win32 {
}
}
-wince* {
- DEPLOYMENT += rsc reg_resource
-}
-
!winrt: TEST_HELPER_INSTALLS = \
../copier/copier \
../paster/paster
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index 6bad45fefe..b1ec94403a 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -73,8 +73,10 @@ void tst_QClipboard::cleanupTestCase()
void tst_QClipboard::init()
{
+#ifndef QT_NO_PROCESS
const QString testdataDir = QFileInfo(QFINDTESTDATA("copier")).absolutePath();
QVERIFY2(QDir::setCurrent(testdataDir), qPrintable("Could not chdir to " + testdataDir));
+#endif
}
Q_DECLARE_METATYPE(QClipboard::Mode)
@@ -313,10 +315,6 @@ void tst_QClipboard::setMimeData()
QMimeData *mimeData = new QMimeData;
const QString TestName(QLatin1String("tst_QClipboard::setMimeData() mimeData"));
mimeData->setObjectName(TestName);
-#if defined(Q_OS_WINCE)
- // need to set text on CE
- mimeData->setText(QLatin1String("Qt/CE foo"));
-#endif
QGuiApplication::clipboard()->setMimeData(mimeData);
QCOMPARE(QGuiApplication::clipboard()->mimeData(), (const QMimeData *)mimeData);
diff --git a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
index 9d42ae5850..43b2b79698 100644
--- a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
+++ b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp
@@ -26,6 +26,7 @@
**
****************************************************************************/
+#include <QtCore/QTemporaryDir>
#include <QtTest/QtTest>
#include <QtGui/qevent.h>
@@ -38,6 +39,7 @@ public:
public slots:
void initTestCase();
+ void cleanupTestCase();
private slots:
void constructor();
@@ -54,6 +56,9 @@ private:
bool appendFileContent(QFileOpenEvent& event, const QByteArray& writeContent);
bool event(QEvent *);
+
+ QTemporaryDir m_temporaryDir;
+ QString m_originalCurrent;
};
tst_qfileopenevent::~tst_qfileopenevent()
@@ -62,6 +67,13 @@ tst_qfileopenevent::~tst_qfileopenevent()
void tst_qfileopenevent::initTestCase()
{
+ m_originalCurrent = QDir::currentPath();
+ QDir::setCurrent(m_temporaryDir.path());
+}
+
+void tst_qfileopenevent::cleanupTestCase()
+{
+ QDir::setCurrent(m_originalCurrent);
}
void tst_qfileopenevent::createFile(const QString &filename, const QByteArray &content)
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 32d0aa504c..f8bcb14ab3 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -106,11 +106,29 @@ void tst_QGuiApplication::displayName()
int argc = 1;
char *argv[] = { const_cast<char*>("tst_qguiapplication") };
QGuiApplication app(argc, argv);
+ QSignalSpy spy(&app, &QGuiApplication::applicationDisplayNameChanged);
+
QCOMPARE(::qAppName(), QString::fromLatin1("tst_qguiapplication"));
QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("tst_qguiapplication"));
QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("tst_qguiapplication"));
+
+ QGuiApplication::setApplicationName("The Core Application");
+ QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("The Core Application"));
+ QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The Core Application"));
+ QCOMPARE(spy.count(), 1);
+
QGuiApplication::setApplicationDisplayName("The GUI Application");
QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application"));
+ QCOMPARE(spy.count(), 2);
+
+ QGuiApplication::setApplicationName("The Core Application 2");
+ QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("The Core Application 2"));
+ QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application"));
+ QCOMPARE(spy.count(), 2);
+
+ QGuiApplication::setApplicationDisplayName("The GUI Application 2");
+ QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application 2"));
+ QCOMPARE(spy.count(), 3);
}
void tst_QGuiApplication::desktopFileName()
diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index 8002303723..cca0e95c29 100644
--- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -31,8 +31,6 @@
#include <QtGui>
#include <QtTest/QtTest>
-#include "../../../qtest-config.h"
-
Q_DECLARE_METATYPE(QMetaType::Type)
class tst_QGuiMetaType: public QObject
@@ -75,14 +73,14 @@ private slots:
F(QVector4D, QVector4D) \
F(QQuaternion, QQuaternion)
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
# define FOR_EACH_GUI_METATYPE(F) \
FOR_EACH_GUI_METATYPE_BASE(F) \
F(QCursor, QCursor)
-#else // !QTEST_NO_CURSOR
+#else // !QT_NO_CURSOR
# define FOR_EACH_GUI_METATYPE(F) \
FOR_EACH_GUI_METATYPE_BASE(F)
-#endif // !QTEST_NO_CURSOR
+#endif // !QT_NO_CURSOR
namespace {
@@ -131,7 +129,7 @@ template<> struct TypeComparator<QMetaType::QBitmap>
{ return v1.size() == v2.size(); }
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
template<> struct TypeComparator<QMetaType::QCursor>
{
static bool equal(const QCursor &v1, const QCursor &v2)
@@ -176,7 +174,7 @@ template<> struct TestValueFactory<QMetaType::QRegion> {
template<> struct TestValueFactory<QMetaType::QBitmap> {
static QBitmap *create() { return new QBitmap(16, 32); }
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
template<> struct TestValueFactory<QMetaType::QCursor> {
static QCursor *create() { return new QCursor(Qt::WaitCursor); }
};
diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
index 8be7227c54..a057ec2207 100644
--- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
@@ -52,8 +52,6 @@
#include "tst_qvariant_common.h"
-#include "../../../../qtest-config.h"
-
class tst_QGuiVariant : public QObject
{
Q_OBJECT
@@ -172,7 +170,7 @@ void tst_QGuiVariant::canConvert_data()
var = QVariant::fromValue(QColor());
QTest::newRow("Color")
<< var << N << N << N << Y << Y << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << Y << N << N << N << N;
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
var = QVariant::fromValue(QCursor());
QTest::newRow("Cursor")
<< var << N << N << N << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N;
@@ -508,7 +506,7 @@ void tst_QGuiVariant::writeToReadFromDataStream_data()
QTest::newRow( "bitmap_valid" ) << QVariant::fromValue( bitmap ) << false;
QTest::newRow( "brush_valid" ) << QVariant::fromValue( QBrush( Qt::red ) ) << false;
QTest::newRow( "color_valid" ) << QVariant::fromValue( QColor( Qt::red ) ) << false;
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QTest::newRow( "cursor_valid" ) << QVariant::fromValue( QCursor( Qt::PointingHandCursor ) ) << false;
#endif
QTest::newRow( "font_valid" ) << QVariant::fromValue( QFont( "times", 12 ) ) << false;
@@ -716,14 +714,14 @@ void tst_QGuiVariant::implicitConstruction()
F(Quaternion) \
F(PolygonF)
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
# define FOR_EACH_GUI_CLASS(F) \
FOR_EACH_GUI_CLASS_BASE(F) \
F(Cursor)
-#else // !QTEST_NO_CURSOR
+#else // !QT_NO_CURSOR
# define FOR_EACH_GUI_CLASS(F) \
FOR_EACH_GUI_CLASS_BASE(F)
-#endif // QTEST_NO_CURSOR
+#endif // QT_NO_CURSOR
#define CONSTRUCT(TYPE) \
{ \
@@ -741,14 +739,14 @@ void tst_QGuiVariant::implicitConstruction()
void tst_QGuiVariant::guiVariantAtExit()
{
// crash test, it should not crash at QGuiApplication exit
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
static QVariant cursor = QCursor();
#endif
static QVariant point = QPoint();
static QVariant icon = QIcon();
static QVariant image = QImage();
static QVariant palette = QPalette();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
Q_UNUSED(cursor);
#endif
Q_UNUSED(point);
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 0d0b6ae81e..6394a956bd 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -725,7 +725,7 @@ void tst_QKeySequence::listFromString()
void tst_QKeySequence::translated_data()
{
-#if defined (Q_OS_MAC) || defined (Q_OS_WINCE)
+#if defined (Q_OS_DARWIN)
QSKIP("Test not applicable");
#endif
@@ -756,7 +756,7 @@ void tst_QKeySequence::translated_data()
void tst_QKeySequence::translated()
{
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QFETCH(QString, transKey);
QFETCH(QString, compKey);
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
index 6af6738bdb..a1de205571 100644
--- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
@@ -75,6 +75,7 @@ public slots:
void cleanupTestCase();
void init();
private slots:
+ void mouseEventBasic();
void checkMousePressEvent_data();
void checkMousePressEvent();
void checkMouseReleaseEvent_data();
@@ -107,6 +108,26 @@ void tst_QMouseEvent::init()
testMouseWidget->mouseReleaseModifiers = 0;
}
+void tst_QMouseEvent::mouseEventBasic()
+{
+ QPointF local(100, 100);
+ QPointF scene(200, 200);
+ QPointF screen(300, 300);
+ QMouseEvent me(QEvent::MouseButtonPress, local, scene, screen, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QCOMPARE(me.isAccepted(), true);
+ QCOMPARE(me.button(), Qt::LeftButton);
+ QCOMPARE(me.buttons(), Qt::LeftButton);
+ QCOMPARE(me.localPos(), local);
+ QCOMPARE(me.windowPos(), scene);
+ QCOMPARE(me.screenPos(), screen);
+
+ QPointF changedLocal(33, 66);
+ me.setLocalPos(changedLocal);
+ QCOMPARE(me.localPos(), changedLocal);
+ QCOMPARE(me.windowPos(), scene);
+ QCOMPARE(me.screenPos(), screen);
+}
+
void tst_QMouseEvent::checkMousePressEvent_data()
{
QTest::addColumn<int>("buttonPressed");
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index 74fd64bf59..e6fd67e3a8 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -213,11 +213,10 @@ private:
QTouchDevice *touchPadDevice;
};
-tst_QTouchEvent::tst_QTouchEvent() : touchScreenDevice(new QTouchDevice), touchPadDevice(new QTouchDevice)
+tst_QTouchEvent::tst_QTouchEvent()
+ : touchScreenDevice(QTest::createTouchDevice())
+ , touchPadDevice(QTest::createTouchDevice(QTouchDevice::TouchPad))
{
- touchPadDevice->setType(QTouchDevice::TouchPad);
- QWindowSystemInterface::registerTouchDevice(touchScreenDevice);
- QWindowSystemInterface::registerTouchDevice(touchPadDevice);
}
void tst_QTouchEvent::cleanup()
@@ -1490,10 +1489,6 @@ bool WindowTouchEventFilter::eventFilter(QObject *, QEvent *event)
void tst_QTouchEvent::testQGuiAppDelivery()
{
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
QWindow w;
w.setGeometry(100, 100, 100, 100);
w.show();
@@ -1521,38 +1516,33 @@ void tst_QTouchEvent::testQGuiAppDelivery()
QCOMPARE(filter.d.isEmpty(), true);
// Now the real thing.
- QWindowSystemInterface::handleTouchEvent(&w, device, points); // TouchBegin
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchBegin
QCoreApplication::processEvents();
QCOMPARE(filter.d.count(), 1);
- QCOMPARE(filter.d.contains(device), true);
- QCOMPARE(filter.d.value(device).points.count(), 1);
- QCOMPARE(filter.d.value(device).lastSeenType, QEvent::TouchBegin);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchBegin);
points[0].state = Qt::TouchPointMoved;
- QWindowSystemInterface::handleTouchEvent(&w, device, points); // TouchUpdate
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchUpdate
QCoreApplication::processEvents();
QCOMPARE(filter.d.count(), 1);
- QCOMPARE(filter.d.contains(device), true);
- QCOMPARE(filter.d.value(device).points.count(), 2);
- QCOMPARE(filter.d.value(device).lastSeenType, QEvent::TouchUpdate);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 2);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchUpdate);
points[0].state = Qt::TouchPointReleased;
- QWindowSystemInterface::handleTouchEvent(&w, device, points); // TouchEnd
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, points); // TouchEnd
QCoreApplication::processEvents();
QCOMPARE(filter.d.count(), 1);
- QCOMPARE(filter.d.contains(device), true);
- QCOMPARE(filter.d.value(device).points.count(), 3);
- QCOMPARE(filter.d.value(device).lastSeenType, QEvent::TouchEnd);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 3);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchEnd);
}
void tst_QTouchEvent::testMultiDevice()
{
- QTouchDevice *deviceOne = new QTouchDevice;
- deviceOne->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(deviceOne);
- QTouchDevice *deviceTwo = new QTouchDevice;
- deviceTwo->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(deviceTwo);
+ QTouchDevice *deviceTwo = QTest::createTouchDevice();
QWindow w;
w.setGeometry(100, 100, 100, 100);
@@ -1564,7 +1554,7 @@ void tst_QTouchEvent::testMultiDevice()
QList<QWindowSystemInterface::TouchPoint> pointsOne, pointsTwo;
- // deviceOne reports a single point, deviceTwo reports the beginning of a multi-point sequence.
+ // touchScreenDevice reports a single point, deviceTwo reports the beginning of a multi-point sequence.
// Even though there is a point with id 0 for both devices, they should be delivered cleanly, independently.
QWindowSystemInterface::TouchPoint tp;
tp.id = 0;
@@ -1580,20 +1570,20 @@ void tst_QTouchEvent::testMultiDevice()
tp.area = QHighDpi::toNative(area1, QHighDpiScaling::factor(&w), screenOrigin);
pointsTwo.append(tp);
- QWindowSystemInterface::handleTouchEvent(&w, deviceOne, pointsOne);
+ QWindowSystemInterface::handleTouchEvent(&w, touchScreenDevice, pointsOne);
QWindowSystemInterface::handleTouchEvent(&w, deviceTwo, pointsTwo);
QCoreApplication::processEvents();
- QCOMPARE(filter.d.contains(deviceOne), true);
+ QCOMPARE(filter.d.contains(touchScreenDevice), true);
QCOMPARE(filter.d.contains(deviceTwo), true);
- QCOMPARE(filter.d.value(deviceOne).lastSeenType, QEvent::TouchBegin);
+ QCOMPARE(filter.d.value(touchScreenDevice).lastSeenType, QEvent::TouchBegin);
QCOMPARE(filter.d.value(deviceTwo).lastSeenType, QEvent::TouchBegin);
- QCOMPARE(filter.d.value(deviceOne).points.count(), 1);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.count(), 1);
QCOMPARE(filter.d.value(deviceTwo).points.count(), 2);
- QCOMPARE(filter.d.value(deviceOne).points.at(0).screenRect(), QRectF(area0));
- QCOMPARE(filter.d.value(deviceOne).points.at(0).state(), pointsOne[0].state);
+ QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).screenRect(), QRectF(area0));
+ QCOMPARE(filter.d.value(touchScreenDevice).points.at(0).state(), pointsOne[0].state);
QCOMPARE(filter.d.value(deviceTwo).points.at(0).screenRect(), QRectF(area0));
QCOMPARE(filter.d.value(deviceTwo).points.at(0).state(), pointsTwo[0].state);
diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST
index 93b7310d10..19d9262bca 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -1,13 +1,17 @@
[positioning:default]
ubuntu-14.04
+ubuntu-16.04
[modalWindowPosition]
ubuntu-14.04
+ubuntu-16.04
[modalWithChildWindow]
ubuntu-14.04
+ubuntu-16.04
[setVisible]
ubuntu-14.04
[modalWindowEnterEventOnHide_QTBUG35109]
ubuntu-14.04
+ubuntu-16.04
[modalDialogClosingOneOfTwoModal]
osx
[modalWindowModallity]
diff --git a/tests/auto/gui/kernel/qwindow/qwindow.pro b/tests/auto/gui/kernel/qwindow/qwindow.pro
index 08e1b1d3a0..844b3e8507 100644
--- a/tests/auto/gui/kernel/qwindow/qwindow.pro
+++ b/tests/auto/gui/kernel/qwindow/qwindow.pro
@@ -5,4 +5,4 @@ QT += core-private gui-private testlib
SOURCES += tst_qwindow.cpp
-contains(QT_CONFIG,dynamicgl):win32:!wince:!winrt: LIBS += -luser32
+qtConfig(dynamicgl):win32:!winrt: LIBS += -luser32
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 70446e803a..a41c574454 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -40,7 +40,7 @@
#if defined(Q_OS_QNX)
#include <QOpenGLContext>
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
# include <QtCore/qt_windows.h>
#endif
@@ -106,7 +106,7 @@ private slots:
private:
QPoint m_availableTopLeft;
QSize m_testWindowSize;
- QTouchDevice *touchDevice;
+ QTouchDevice *touchDevice = QTest::createTouchDevice();
};
void tst_QWindow::initTestCase()
@@ -120,9 +120,6 @@ void tst_QWindow::initTestCase()
if (screenWidth > 2000)
width = 100 * ((screenWidth + 500) / 1000);
m_testWindowSize = QSize(width, width);
- touchDevice = new QTouchDevice;
- touchDevice->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(touchDevice);
}
void tst_QWindow::cleanup()
@@ -2098,7 +2095,7 @@ void tst_QWindow::modalWindowEnterEventOnHide_QTBUG35109()
static bool isNativeWindowVisible(const QWindow *window)
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
return IsWindowVisible(reinterpret_cast<HWND>(window->winId()));
#else
Q_UNIMPLEMENTED();
diff --git a/tests/auto/gui/painting/painting.pro b/tests/auto/gui/painting/painting.pro
index 0f7595c871..831fffab30 100644
--- a/tests/auto/gui/painting/painting.pro
+++ b/tests/auto/gui/painting/painting.pro
@@ -16,7 +16,7 @@ SUBDIRS=\
qwmatrix \
qpolygon \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qpathclipper \
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 00e7436c0f..ab893385e3 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -52,6 +52,7 @@ private slots:
void name();
void namehex_data();
void namehex();
+ void setNamedColor_data();
void setNamedColor();
void constructNamedColorWithSpace();
@@ -525,26 +526,49 @@ static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
#undef rgb
-void tst_QColor::setNamedColor()
+void tst_QColor::setNamedColor_data()
{
- for (int i = 0; i < rgbTblSize; ++i) {
- QColor expected;
- expected.setRgba(rgbTbl[i].value);
-
- QColor color;
- color.setNamedColor(QLatin1String(rgbTbl[i].name));
- QCOMPARE(color, expected);
+ QTest::addColumn<QColor>("byCtor");
+ QTest::addColumn<QColor>("bySetNamedColor");
+ QTest::addColumn<QColor>("expected");
+ for (const auto e : rgbTbl) {
+ QColor expected;
+ expected.setRgba(e.value);
+
+#define ROW(expr) \
+ do { \
+ QColor bySetNamedColor; \
+ bySetNamedColor.setNamedColor(expr); \
+ auto byCtor = QColor(expr); \
+ QTest::newRow(e.name + QByteArrayLiteral(#expr)) \
+ << byCtor << bySetNamedColor << expected; \
+ } while (0) \
+ /*end*/
+
+ ROW(QLatin1String(e.name));
+ ROW(QString(QLatin1String(e.name)));
// name should be case insensitive
- color.setNamedColor(QString(rgbTbl[i].name).toUpper());
- QCOMPARE(color, expected);
-
+ ROW(QLatin1String(QByteArray(e.name).toUpper()));
+ ROW(QString(e.name).toUpper());
// spaces should be ignored
- color.setNamedColor(QString(rgbTbl[i].name).insert(1, ' '));
- QCOMPARE(color, expected);
+ ROW(QLatin1String(QByteArray(e.name).insert(1, ' ')));
+ ROW(QString(e.name).insert(1, ' '));
+#undef ROW
}
}
+void tst_QColor::setNamedColor()
+{
+ QFETCH(QColor, byCtor);
+ QFETCH(QColor, bySetNamedColor);
+ QFETCH(QColor, expected);
+
+ QCOMPARE(byCtor, expected);
+ QCOMPARE(bySetNamedColor, expected);
+}
+
+
void tst_QColor::constructNamedColorWithSpace()
{
QColor whiteSmoke("white smoke");
@@ -556,7 +580,7 @@ void tst_QColor::colorNames()
QStringList all = QColor::colorNames();
QCOMPARE(all.size(), rgbTblSize);
for (int i = 0; i < all.size(); ++i)
- QCOMPARE(all.at(i), QString::fromLatin1(rgbTbl[i].name));
+ QCOMPARE(all.at(i), QLatin1String(rgbTbl[i].name));
}
void tst_QColor::spec()
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 8a97a9261f..1bd7f67810 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -39,9 +39,7 @@
#include <qimage.h>
#include <qthread.h>
#include <limits.h>
-#if !defined(Q_OS_WINCE)
#include <math.h>
-#endif
#include <qpaintengine.h>
#ifndef QT_NO_WIDGETS
#include <qdesktopwidget.h>
@@ -297,6 +295,9 @@ private slots:
void QTBUG50153_drawImage_assert();
+ void rotateImage_data();
+ void rotateImage();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -5061,6 +5062,64 @@ void tst_QPainter::QTBUG50153_drawImage_assert()
}
}
+void tst_QPainter::rotateImage_data()
+{
+ QTest::addColumn<QImage>("image");
+ QTest::addColumn<bool>("smooth");
+
+ QImage image(128, 128, QImage::Format_RGB32);
+ for (int y = 0; y < 128; ++y) {
+ for (int x = 0; x < 128; ++x) {
+ image.setPixel(x, y, qRgb(x + y, x + y, x + y));
+ }
+ }
+
+ QTest::newRow("fast") << image << false;
+ QTest::newRow("smooth") << image << true;
+}
+
+void tst_QPainter::rotateImage()
+{
+ QFETCH(QImage, image);
+ QFETCH(bool, smooth);
+
+ QImage dest(184, 184, QImage::Format_ARGB32_Premultiplied);
+ dest.fill(Qt::transparent);
+
+ QPainter painter(&dest);
+ QTransform transform;
+ transform.translate(92, 0);
+ transform.rotate(45);
+ painter.setTransform(transform);
+ painter.setRenderHint(QPainter::SmoothPixmapTransform, smooth);
+ painter.drawImage(0, 0, image);
+ painter.end();
+
+ QRgb lastRow = qRgba(0, 0, 0, 0);
+ for (int y = 0; y < 184; ++y) {
+ QRgb row = qRgba(0, 0, 0, 0);
+ for (int x = 0; x < 184; ++x) {
+ QRgb pixel = dest.pixel(x, y);
+ if (qAlpha(pixel) < 255)
+ continue;
+ if (qAlpha(row) == 0) {
+ row = pixel;
+ } else {
+ QCOMPARE(qRed(pixel), qGreen(pixel));
+ QCOMPARE(qGreen(pixel), qBlue(pixel));
+ QVERIFY(qAbs(qRed(row) - qRed(pixel)) <= 2);
+ QVERIFY(qAbs(qGreen(row) - qGreen(pixel)) <= 2);
+ QVERIFY(qAbs(qBlue(row) - qBlue(pixel)) <= 2);
+ }
+
+ }
+ if (qAlpha(row) && qAlpha(lastRow))
+ QVERIFY(qGray(lastRow) <= qGray(row));
+ lastRow = row;
+ }
+
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index 0261f60479..98f63984b3 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -840,22 +840,23 @@ void tst_QPainterPath::testArcMoveTo_data()
QTest::addColumn<QRectF>("rect");
QTest::addColumn<qreal>("angle");
- QList<QRectF> rects;
- rects << QRectF(100, 100, 100, 100)
- << QRectF(100, 100, -100, 100)
- << QRectF(100, 100, 100, -100)
- << QRectF(100, 100, -100, -100);
-
- for (int domain=0; domain<rects.size(); ++domain) {
+ static Q_CONSTEXPR QRectF rects[] = {
+ QRectF(100, 100, 100, 100),
+ QRectF(100, 100, -100, 100),
+ QRectF(100, 100, 100, -100),
+ QRectF(100, 100, -100, -100),
+ };
+
+ for (uint domain = 0; domain < sizeof rects / sizeof *rects; ++domain) {
const QByteArray dB = QByteArray::number(domain);
for (int i=-360; i<=360; ++i) {
QTest::newRow(("test " + dB + ' ' + QByteArray::number(i)).constData())
- << rects.at(domain) << (qreal) i;
+ << rects[domain] << (qreal) i;
}
// test low angles
- QTest::newRow("low angles 1") << rects.at(domain) << (qreal) 1e-10;
- QTest::newRow("low angles 2") << rects.at(domain) << (qreal)-1e-10;
+ QTest::newRow("low angles 1") << rects[domain] << (qreal) 1e-10;
+ QTest::newRow("low angles 2") << rects[domain] << (qreal)-1e-10;
}
}
diff --git a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
index e153460bf2..671220f94b 100644
--- a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
+++ b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro
@@ -5,6 +5,6 @@ HEADERS += paths.h
SOURCES += tst_qpathclipper.cpp paths.cpp
QT += gui-private testlib
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
unix:!darwin:!haiku:!integrity: LIBS += -lm
diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
index 4d6f52bf8a..13b6e28f5f 100644
--- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
+++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
@@ -43,6 +43,10 @@ public:
tst_QPolygon();
private slots:
+ void boundingRect_data();
+ void boundingRect();
+ void boundingRectF_data();
+ void boundingRectF();
void makeEllipse();
void swap();
};
@@ -51,6 +55,79 @@ tst_QPolygon::tst_QPolygon()
{
}
+void tst_QPolygon::boundingRect_data()
+{
+ QTest::addColumn<QPolygon>("poly");
+ QTest::addColumn<QRect>("brect");
+
+#define ROW(args, rect) \
+ do { \
+ QPolygon poly; \
+ poly.setPoints args; \
+ QTest::newRow(#args) << poly << QRect rect; \
+ } while (0)
+
+ QTest::newRow("empty") << QPolygon() << QRect(0, 0, 0, 0);
+ ROW((1, 0,1), ( 0, 1, 1, 1));
+ ROW((2, 0,1, 1,0), ( 0, 0, 2, 2));
+ ROW((3, -1,1, -1,-1, 1,0), (-1,-1, 3, 3));
+#undef ROW
+}
+
+void tst_QPolygon::boundingRect()
+{
+ QFETCH(QPolygon, poly);
+ QFETCH(QRect, brect);
+
+ QCOMPARE(poly.boundingRect(), brect);
+}
+
+namespace {
+struct MyPolygonF : QPolygonF
+{
+ // QPolygonF doesn't have setPoints...
+ void setPoints(int nPoints, int firstx, int firsty, ...) {
+ va_list ap;
+ reserve(nPoints);
+ *this << QPointF(firstx, firsty);
+ va_start(ap, firsty);
+ while (--nPoints) {
+ const int x = va_arg(ap, int);
+ const int y = va_arg(ap, int);
+ *this << QPointF(x, y);
+ }
+ va_end(ap);
+ }
+};
+}
+
+void tst_QPolygon::boundingRectF_data()
+{
+ QTest::addColumn<QPolygonF>("poly");
+ QTest::addColumn<QRectF>("brect");
+
+#define ROW(args, rect) \
+ do { \
+ MyPolygonF poly; \
+ poly.setPoints args; \
+ QTest::newRow(#args) << QPolygonF(poly) << QRectF rect; \
+ } while (0)
+
+ QTest::newRow("empty") << QPolygonF() << QRectF(0, 0, 0, 0);
+ ROW((1, 0,1), ( 0, 1, 0, 0));
+ ROW((2, 0,1, 1,0), ( 0, 0, 1, 1));
+ ROW((3, -1,1, -1,-1, 1,0), (-1,-1, 2, 2));
+#undef ROW
+}
+
+void tst_QPolygon::boundingRectF()
+{
+ QFETCH(QPolygonF, poly);
+ QFETCH(QRectF, brect);
+
+ QCOMPARE(poly.boundingRect(), brect);
+}
+
void tst_QPolygon::makeEllipse()
{
// create an ellipse with R1 = R2 = R, i.e. a circle
diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp
index d24435198e..6a297dbfc2 100644
--- a/tests/auto/gui/painting/qregion/tst_qregion.cpp
+++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp
@@ -47,6 +47,7 @@ public:
private slots:
void moveSemantics();
void boundingRect();
+ void rangeFor();
void rects();
void swap();
void setRects();
@@ -136,17 +137,34 @@ void tst_QRegion::boundingRect()
}
+void tst_QRegion::rangeFor()
+{
+ // compile-only test for range-for over QRegion, so really useless
+ // content otherwise:
+ QRect rect(10, -20, 30, 40);
+ QRegion region(rect);
+ int equal = 0;
+ for (const QRect &r : region) // check this compiles
+ equal += int(r == rect); // can't use QCOMPARE here b/c of the
+ // MSVC 201272013 parse bug re:
+ // do-while in range-for loops
+ QCOMPARE(equal, 1);
+}
+
void tst_QRegion::rects()
{
{
QRect rect;
QRegion region(rect);
QVERIFY(region.isEmpty());
+ QCOMPARE(region.begin(), region.end());
QVERIFY(region.rects().isEmpty());
}
{
QRect rect(10, -20, 30, 40);
QRegion region(rect);
+ QCOMPARE(region.end(), region.begin() + 1);
+ QCOMPARE(*region.begin(), rect);
QCOMPARE(region.rects().count(), 1);
QCOMPARE(region.rects()[0], rect);
}
@@ -192,6 +210,7 @@ void tst_QRegion::setRects()
region.setRects(&rect, 0);
QVERIFY(region.isEmpty());
QCOMPARE(region, QRegion());
+ QCOMPARE(region.begin(), region.end());
QVERIFY(!region.boundingRect().isValid());
QVERIFY(region.rects().isEmpty());
}
@@ -199,6 +218,7 @@ void tst_QRegion::setRects()
QRegion region;
QRect rect;
region.setRects(&rect, 1);
+ QCOMPARE(region.begin(), region.end());
QVERIFY(!region.boundingRect().isValid());
QVERIFY(region.rects().isEmpty());
}
@@ -206,8 +226,10 @@ void tst_QRegion::setRects()
QRegion region;
QRect rect(10, -20, 30, 40);
region.setRects(&rect, 1);
+ QCOMPARE(region.end(), region.begin() + 1);
QCOMPARE(region.rects().count(), 1);
QCOMPARE(region.rects()[0], rect);
+ QCOMPARE(*region.begin(), rect);
}
}
@@ -320,8 +342,12 @@ void tst_QRegion::emptyPolygonRegion()
QRegion r(pa);
QTEST(r.isEmpty(), "isEmpty");
+ QTEST(int(std::distance(r.begin(), r.end())), "numRects");
+ QVector<QRect> rects;
+ std::copy(r.begin(), r.end(), std::back_inserter(rects));
QTEST(r.rects().count(), "numRects");
QTEST(r.rects(), "rects");
+ QCOMPARE(r.rects(), rects);
}
@@ -860,6 +886,7 @@ void tst_QRegion::isEmpty()
QFETCH(QRegion, region);
QVERIFY(region.isEmpty());
+ QCOMPARE(region.begin(), region.end());
QCOMPARE(region, QRegion());
QCOMPARE(region.rectCount(), 0);
QCOMPARE(region.boundingRect(), QRect());
@@ -892,6 +919,11 @@ void tst_QRegion::regionFromPath()
path.addRect(0, 100, 100, 1000);
QRegion rgn(path.toFillPolygon().toPolygon());
+
+ QCOMPARE(rgn.end(), rgn.begin() + 2);
+ QCOMPARE(rgn.begin()[0], QRect(0, 0, 10, 10));
+ QCOMPARE(rgn.begin()[1], QRect(0, 100, 100, 1000));
+
QCOMPARE(rgn.rects().size(), 2);
QCOMPARE(rgn.rects().at(0), QRect(0, 0, 10, 10));
QCOMPARE(rgn.rects().at(1), QRect(0, 100, 100, 1000));
@@ -905,8 +937,14 @@ void tst_QRegion::regionFromPath()
path.addRect(10, 10, 80, 80);
QRegion rgn(path.toFillPolygon().toPolygon());
- QCOMPARE(rgn.rects().size(), 4);
+ QCOMPARE(rgn.end(), rgn.begin() + 4);
+ QCOMPARE(rgn.begin()[0], QRect(0, 0, 100, 10));
+ QCOMPARE(rgn.begin()[1], QRect(0, 10, 10, 80));
+ QCOMPARE(rgn.begin()[2], QRect(90, 10, 10, 80));
+ QCOMPARE(rgn.begin()[3], QRect(0, 90, 100, 10));
+
+ QCOMPARE(rgn.rects().size(), 4);
QCOMPARE(rgn.rects().at(0), QRect(0, 0, 100, 10));
QCOMPARE(rgn.rects().at(1), QRect(0, 10, 10, 80));
QCOMPARE(rgn.rects().at(2), QRect(90, 10, 10, 80));
diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
index e05d7dd022..a79526c434 100644
--- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
+++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
@@ -114,7 +114,7 @@ void tst_QWMatrix::mapping_data()
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -300, -400, 300, 400 ) );
-#if (defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(M_PI)
+#if defined(Q_OS_WIN) && !defined(M_PI)
#define M_PI 3.14159265897932384626433832795f
#endif
diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro
index a4ef016e39..aaef6e5125 100644
--- a/tests/auto/gui/qopengl/qopengl.pro
+++ b/tests/auto/gui/qopengl/qopengl.pro
@@ -8,4 +8,4 @@ QT += gui-private core-private testlib
SOURCES += tst_qopengl.cpp
-linux:contains(QT_CONFIG, xcb-glx):contains(QT_CONFIG, xcb-xlib):!contains(QT_CONFIG, egl): DEFINES += USE_GLX
+linux:qtConfig(xcb-glx):qtConfig(xcb-xlib):!qtConfig(egl): DEFINES += USE_GLX
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp
index 15244744bf..ed48a4978a 100644
--- a/tests/auto/gui/qopengl/tst_qopengl.cpp
+++ b/tests/auto/gui/qopengl/tst_qopengl.cpp
@@ -41,7 +41,7 @@
#include <QtGui/QOffscreenSurface>
#include <QtGui/QGenericMatrix>
#include <QtGui/QMatrix4x4>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/qopengltextureblitter.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qopenglextensions_p.h>
#include <qpa/qplatformintegration.h>
diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
index d3404e335a..be3ef968ef 100644
--- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
+++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
@@ -48,6 +48,8 @@ private slots:
void getSetCheck();
void maximumBlockCount();
void anchorAt();
+ void imageAt();
+ void formatAt();
};
tst_QAbstractTextDocumentLayout::tst_QAbstractTextDocumentLayout()
@@ -156,7 +158,7 @@ void tst_QAbstractTextDocumentLayout::anchorAt()
// anchorAt on start returns link
QRect linkBr = metrics.boundingRect("foo");
- QPointF linkPoint(linkBr.width() + blockStart.x(), (linkBr.height() / 2) + blockStart.y());
+ QPointF linkPoint((linkBr.width() / 2) + blockStart.x(), (linkBr.height() / 2) + blockStart.y());
QCOMPARE(documentLayout->anchorAt(linkPoint), QString("link"));
// anchorAt() on top of preedit at end should not assert
@@ -171,5 +173,61 @@ void tst_QAbstractTextDocumentLayout::anchorAt()
QCOMPARE(documentLayout->anchorAt(preeditPoint), QString());
}
+void tst_QAbstractTextDocumentLayout::imageAt()
+{
+ QTextDocument doc;
+ doc.setHtml("foo<a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a>");
+ QAbstractTextDocumentLayout *documentLayout = doc.documentLayout();
+ QTextBlock firstBlock = doc.begin();
+ QTextLayout *layout = firstBlock.layout();
+ layout->setPreeditArea(doc.toPlainText().length(), "xxx");
+
+ doc.setPageSize(QSizeF(1000, 1000));
+ QFontMetrics metrics(layout->font());
+ QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft();
+
+ QRect fooBr = metrics.boundingRect("foo");
+ QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25);
+ // imageAt on image returns source
+ QCOMPARE(documentLayout->imageAt(imagePoint), QString("image"));
+ // anchorAt on image returns link
+ QCOMPARE(documentLayout->anchorAt(imagePoint), QString("link"));
+
+ // imageAt on start returns nothing (there's the "foo" text)
+ QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y());
+ QCOMPARE(documentLayout->imageAt(fooPoint), QString());
+}
+
+void tst_QAbstractTextDocumentLayout::formatAt()
+{
+ QTextDocument doc;
+ doc.setHtml("foo<i><a href=\"link\"><img src=\"image\" width=\"50\" height=\"50\"/></a></i>");
+ QAbstractTextDocumentLayout *documentLayout = doc.documentLayout();
+ QTextBlock firstBlock = doc.begin();
+ QTextLayout *layout = firstBlock.layout();
+ layout->setPreeditArea(doc.toPlainText().length(), "xxx");
+
+ doc.setPageSize(QSizeF(1000, 1000));
+ QFontMetrics metrics(layout->font());
+ QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft();
+
+ QRect fooBr = metrics.boundingRect("foo");
+ QPointF imagePoint(fooBr.width() + blockStart.x() + 25, blockStart.y() + 25);
+
+ QTextFormat format = documentLayout->formatAt(imagePoint);
+ QVERIFY(format.isCharFormat());
+ QVERIFY(format.toCharFormat().isAnchor());
+ QVERIFY(format.toCharFormat().fontItalic());
+ QVERIFY(format.isImageFormat());
+
+ // move over the unformatted "foo" text)
+ QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y());
+ format = documentLayout->formatAt(fooPoint);
+ QVERIFY(format.isCharFormat());
+ QVERIFY(!format.toCharFormat().isAnchor());
+ QVERIFY(!format.toCharFormat().fontItalic());
+ QVERIFY(!format.isImageFormat());
+}
+
QTEST_MAIN(tst_QAbstractTextDocumentLayout)
#include "tst_qabstracttextdocumentlayout.moc"
diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro
index 88d1fcfd2d..776b4b3de2 100644
--- a/tests/auto/gui/text/qcssparser/qcssparser.pro
+++ b/tests/auto/gui/text/qcssparser/qcssparser.pro
@@ -3,16 +3,10 @@ TARGET = tst_qcssparser
SOURCES += tst_qcssparser.cpp
QT += xml gui-private testlib
-requires(contains(QT_CONFIG,private_tests))
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+TESTDATA += testdata
-wince* {
- addFiles.files = testdata
- addFiles.path = .
- timesFont.files = C:/Windows/Fonts/times.ttf
- timesFont.path = .
- DEPLOYMENT += addFiles timesFont
-}
+requires(qtConfig(private_tests))
+DEFINES += SRCDIR=\\\"$$PWD\\\"
android {
RESOURCES += \
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 847d6e2e2f..45cfd6f43a 100644
--- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
@@ -27,9 +27,6 @@
****************************************************************************/
#include <QtTest/QtTest>
#include <QtXml/QtXml>
-#if defined(Q_OS_WINCE)
-#include <QtGui/QFontDatabase>
-#endif
#include <QtGui/QFontInfo>
#include <QtGui/QFontMetrics>
@@ -39,10 +36,6 @@ class tst_QCssParser : public QObject
{
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
private slots:
void scanner_data();
void scanner();
@@ -85,41 +78,16 @@ private slots:
void extractBorder();
void noTextDecoration();
void quotedAndUnquotedIdentifiers();
-
-private:
-#if defined(Q_OS_WINCE)
- int m_timesFontId;
-#endif
};
-void tst_QCssParser::initTestCase()
-{
-#if defined(Q_OS_WINCE)
- QFontDatabase fontDB;
- m_timesFontId = -1;
- if (!fontDB.families().contains("Times New Roman")) {
- m_timesFontId = QFontDatabase::addApplicationFont("times.ttf");
- QVERIFY(m_timesFontId != -1);
- }
-#endif
-}
-
-void tst_QCssParser::cleanupTestCase()
-{
-#if defined(Q_OS_WINCE)
- if (m_timesFontId != -1)
- QFontDatabase::removeApplicationFont(m_timesFontId);
-#endif
-}
-
void tst_QCssParser::scanner_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("output");
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) || defined(Q_OS_WINRT)
QDir d(":/");
-#elif !defined(Q_OS_IRIX) && !defined(Q_OS_WINCE)
+#elif !defined(Q_OS_IRIX)
QDir d(SRCDIR);
#else
QDir d(QDir::current());
@@ -145,10 +113,14 @@ static const char *tokenName(QCss::TokenType t)
case QCss::CDC: return "CDC";
case QCss::INCLUDES: return "INCLUDES";
case QCss::DASHMATCH: return "DASHMATCH";
+ case QCss::BEGINSWITH: return "BEGINSWITH";
+ case QCss::ENDSWITH: return "ENDSWITH";
+ case QCss::CONTAINS: return "CONTAINS";
case QCss::LBRACE: return "LBRACE";
case QCss::PLUS: return "PLUS";
case QCss::GREATER: return "GREATER";
case QCss::COMMA: return "COMMA";
+ case QCss::TILDE: return "TILDE";
case QCss::STRING: return "STRING";
case QCss::INVALID: return "INVALID";
case QCss::IDENT: return "IDENT";
@@ -509,7 +481,7 @@ void tst_QCssParser::selector_data()
QCss::BasicSelector basic;
basic.elementName = "p";
- basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfPreceeds;
+ basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfDirectAdjecent;
sel.basicSelectors << basic;
basic = QCss::BasicSelector();
@@ -601,14 +573,29 @@ void tst_QCssParser::selector_data()
QCss::BasicSelector basic;
basic.elementName = "e";
- basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfPreceeds;
+ basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfDirectAdjecent;
sel.basicSelectors << basic;
basic.elementName = "f";
basic.relationToNext = QCss::BasicSelector::NoRelation;
sel.basicSelectors << basic;
- QTest::newRow("precede") << QString("e + f") << sel;
+ QTest::newRow("lastsibling") << QString("e + f") << sel;
+ }
+
+ {
+ QCss::Selector sel;
+ QCss::BasicSelector basic;
+
+ basic.elementName = "e";
+ basic.relationToNext = QCss::BasicSelector::MatchNextSelectorIfIndirectAdjecent;
+ sel.basicSelectors << basic;
+
+ basic.elementName = "f";
+ basic.relationToNext = QCss::BasicSelector::NoRelation;
+ sel.basicSelectors << basic;
+
+ QTest::newRow("previoussibling") << QString("e ~ f") << sel;
}
{
@@ -647,11 +634,11 @@ void tst_QCssParser::selector_data()
QCss::AttributeSelector attrSel;
attrSel.name = "foo";
attrSel.value = "warning";
- attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchContains;
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchIncludes;
basic.attributeSelectors << attrSel;
sel.basicSelectors << basic;
- QTest::newRow("attr-contains") << QString("e[foo~=\"warning\"]") << sel;
+ QTest::newRow("attr-includes") << QString("e[foo~=\"warning\"]") << sel;
}
{
@@ -662,11 +649,26 @@ void tst_QCssParser::selector_data()
QCss::AttributeSelector attrSel;
attrSel.name = "lang";
attrSel.value = "en";
- attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchBeginsWith;
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchDashMatch;
+ basic.attributeSelectors << attrSel;
+ sel.basicSelectors << basic;
+
+ QTest::newRow("attr-dash") << QString("e[lang|=\"en\"]") << sel;
+ }
+
+ {
+ QCss::Selector sel;
+ QCss::BasicSelector basic;
+
+ basic.elementName = "e";
+ QCss::AttributeSelector attrSel;
+ attrSel.name = "foo";
+ attrSel.value = "warning";
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchContains;
basic.attributeSelectors << attrSel;
sel.basicSelectors << basic;
- QTest::newRow("attr-contains") << QString("e[lang|=\"en\"]") << sel;
+ QTest::newRow("attr-contains") << QString("e[foo*=\"warning\"]") << sel;
}
{
@@ -677,7 +679,7 @@ void tst_QCssParser::selector_data()
QCss::AttributeSelector attrSel;
attrSel.name = "class";
- attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchContains;
+ attrSel.valueMatchCriterium = QCss::AttributeSelector::MatchIncludes;
attrSel.value = "warning";
basic.attributeSelectors.append(attrSel);
@@ -999,11 +1001,20 @@ void tst_QCssParser::styleSelector_data()
QTest::newRow("attrmatch") << true << QString("[foo=bar]") << QString("<p foo=\"bar\" />") << QString();
QTest::newRow("noattrmatch") << false << QString("[foo=bar]") << QString("<p foo=\"xyz\" />") << QString();
- QTest::newRow("contains") << true << QString("[foo~=bar]") << QString("<p foo=\"baz bleh bar\" />") << QString();
- QTest::newRow("notcontains") << false << QString("[foo~=bar]") << QString("<p foo=\"test\" />") << QString();
+ QTest::newRow("includes") << true << QString("[foo~=bar]") << QString("<p foo=\"baz bleh bar\" />") << QString();
+ QTest::newRow("notincludes") << false << QString("[foo~=bar]") << QString("<p foo=\"bazblehbar\" />") << QString();
- QTest::newRow("beingswith") << true << QString("[foo|=bar]") << QString("<p foo=\"bar-bleh\" />") << QString();
- QTest::newRow("notbeingswith") << false << QString("[foo|=bar]") << QString("<p foo=\"bleh-bar\" />") << QString();
+ QTest::newRow("dashmatch") << true << QString("[foo|=bar]") << QString("<p foo=\"bar-bleh\" />") << QString();
+ QTest::newRow("nodashmatch") << false << QString("[foo|=bar]") << QString("<p foo=\"barbleh\" />") << QString();
+
+ QTest::newRow("beginswith") << true << QString("[foo^=bar]") << QString("<p foo=\"barbleh\" />") << QString();
+ QTest::newRow("nobeginswith") << false << QString("[foo^=bar]") << QString("<p foo=\"blehbleh\" />") << QString();
+
+ QTest::newRow("endswith") << true << QString("[foo$=bar]") << QString("<p foo=\"barbar\" />") << QString();
+ QTest::newRow("noendswith") << false << QString("[foo$=bar]") << QString("<p foo=\"blehbleh\" />") << QString();
+
+ QTest::newRow("contains") << true << QString("[foo*=bar]") << QString("<p foo=\"blehbarbleh\" />") << QString();
+ QTest::newRow("nocontains") << false << QString("[foo*=bar]") << QString("<p foo=\"blehbleh\" />") << QString();
QTest::newRow("attr2") << true << QString("[bar=foo]") << QString("<p bleh=\"bar\" bar=\"foo\" />") << QString();
@@ -1084,10 +1095,19 @@ void tst_QCssParser::styleSelector_data()
<< QString("<p1 /><p2 />")
<< QString("p2");
- QTest::newRow("noprevioussibling") << false << QString("p2 + p1")
+ QTest::newRow("notprevioussibling") << false << QString("p2 + p1")
<< QString("<p1 /><p2 />")
<< QString("p2");
+ QTest::newRow("anyprevioussibling") << true << QString("p1 ~ p3")
+ << QString("<p1 /><p2 /><p3 />")
+ << QString("p3");
+
+ QTest::newRow("noprevioussibling") << false << QString("p3 ~ p2")
+ << QString("<p1 /><p2 /><p3 />")
+ << QString("p3");
+
+
QTest::newRow("ancestry_firstmismatch") << false << QString("parent child[foo=bar]")
<< QString("<parent><child /></parent>")
<< QString("parent/child");
diff --git a/tests/auto/gui/text/qfont/BLACKLIST b/tests/auto/gui/text/qfont/BLACKLIST
index d859dee03e..8890ec1ef3 100644
--- a/tests/auto/gui/text/qfont/BLACKLIST
+++ b/tests/auto/gui/text/qfont/BLACKLIST
@@ -1,2 +1,4 @@
[exactMatch]
+# QTBUG-46054
opensuse-13.1
+opensuse-42.1
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index d8a6afb804..ca984a26a5 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -62,6 +62,7 @@ private slots:
void styleName();
void defaultFamily_data();
void defaultFamily();
+ void toAndFromString();
void sharing();
};
@@ -508,11 +509,11 @@ void tst_QFont::defaultFamily_data()
QTest::addColumn<QFont::StyleHint>("styleHint");
QTest::addColumn<QStringList>("acceptableFamilies");
- QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif"));
- QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace"));
- QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive"));
- QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy"));
- QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif"));
+ QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif").split(","));
+ QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace").split(","));
+ QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive").split(","));
+ QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy").split(","));
+ QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif").split(","));
}
void tst_QFont::defaultFamily()
@@ -539,6 +540,26 @@ void tst_QFont::defaultFamily()
QVERIFY2(isAcceptable, msgNotAcceptableFont(familyForHint, acceptableFamilies));
}
+void tst_QFont::toAndFromString()
+{
+ QFont defaultFont = QGuiApplication::font();
+ QString family = defaultFont.family();
+
+ QFontDatabase fdb;
+ const QStringList stylesList = fdb.styles(family);
+ if (stylesList.size() == 0)
+ QSKIP("Default font doesn't have any styles");
+
+ for (const QString &style : stylesList) {
+ QFont result;
+ QFont initial = fdb.font(family, style, defaultFont.pointSize());
+
+ result.fromString(initial.toString());
+
+ QCOMPARE(result, initial);
+ }
+}
+
void tst_QFont::sharing()
{
// QFontCache references the engineData
diff --git a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
index 54bc802cf0..fbca313ea3 100644
--- a/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
+++ b/tests/auto/gui/text/qfontcache/tst_qfontcache.cpp
@@ -101,8 +101,6 @@ void tst_QFontCache::engineData()
}
if (req.pointSize < 0)
req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.stretch == 0)
- req.stretch = 100;
req.family = cacheKey;
diff --git a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
index 5dba2fc06a..8a08cdc182 100644
--- a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
+++ b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
@@ -2,12 +2,7 @@ CONFIG += testcase
TARGET = tst_qfontdatabase
SOURCES += tst_qfontdatabase.cpp
QT += testlib core-private gui-private
-
-wince* {
- additionalFiles.files = FreeMono.ttf
- additionalFiles.path = .
- DEPLOYMENT += additionalFiles
-}
+TESTDATA += LED_REAL.TTF
android {
RESOURCES += testdata.qrc
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index adaf3b1f7a..f71d808390 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -64,6 +64,8 @@ private slots:
void aliases();
void fallbackFonts();
+ void liberationFont();
+
private:
const QString m_testFont;
};
@@ -275,5 +277,23 @@ void tst_QFontDatabase::fallbackFonts()
}
}
+void tst_QFontDatabase::liberationFont()
+{
+ QString libSans("Liberation Sans");
+ QString libSansNarrow("Liberation Sans Narrow");
+
+ QFontDatabase db;
+ if (!db.hasFamily(libSans) || !db.hasFamily(libSansNarrow))
+ QSKIP("Requires Liberation Sans installed");
+
+ QFont fontLS(libSans);
+ QFont fontLSN(libSansNarrow);
+
+ QFontMetrics fmLS(fontLS);
+ QFontMetrics fmLSN(fontLSN);
+
+ QVERIFY(fmLS.width(QStringLiteral("foo bar")) > fmLSN.width(QStringLiteral("foo bar")));
+}
+
QTEST_MAIN(tst_QFontDatabase)
#include "tst_qfontdatabase.moc"
diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
index 3abca8ce89..c08019a561 100644
--- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro
+++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
@@ -6,12 +6,5 @@ SOURCES += \
tst_qglyphrun.cpp
-wince* {
- additionalFiles.files = test.ttf
- additionalFiles.path = ../../../shared/resources/
- DEPLOYMENT += additionalFiles
-} else {
- RESOURCES += \
- testdata.qrc
-}
-
+RESOURCES += \
+ testdata.qrc
diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc
index 8f8e32ed24..c7ac9641d1 100644
--- a/tests/auto/gui/text/qrawfont/testdata.qrc
+++ b/tests/auto/gui/text/qrawfont/testdata.qrc
@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/">
<file>testfont_bold_italic.ttf</file>
+ <file>testfont_os2_v1.ttf</file>
<file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file>
</qresource>
</RCC>
diff --git a/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf
new file mode 100644
index 0000000000..ee8b67d892
--- /dev/null
+++ b/tests/auto/gui/text/qrawfont/testfont_os2_v1.ttf
Binary files differ
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index 471b32dd50..3cf108ed62 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -93,6 +93,7 @@ private slots:
private:
QString testFont;
QString testFontBoldItalic;
+ QString testFontOs2V1;
#endif // QT_NO_RAWFONT
};
@@ -110,6 +111,7 @@ void tst_QRawFont::initTestCase()
{
testFont = QFINDTESTDATA("testfont.ttf");
testFontBoldItalic = QFINDTESTDATA("testfont_bold_italic.ttf");
+ testFontOs2V1 = QFINDTESTDATA("testfont_os2_v1.ttf");
if (testFont.isEmpty() || testFontBoldItalic.isEmpty())
QFAIL("qrawfont unittest font files not found!");
@@ -184,6 +186,7 @@ void tst_QRawFont::correctFontData_data()
QTest::addColumn<QFont::HintingPreference>("hintingPreference");
QTest::addColumn<qreal>("unitsPerEm");
QTest::addColumn<qreal>("pixelSize");
+ QTest::addColumn<int>("capHeight");
int hintingPreferences[] = {
int(QFont::PreferDefaultHinting),
@@ -207,7 +210,8 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Normal
<< QFont::HintingPreference(*hintingPreference)
<< qreal(1000.0)
- << qreal(10.0);
+ << qreal(10.0)
+ << 7;
fileName = testFontBoldItalic;
title = fileName
@@ -221,7 +225,23 @@ void tst_QRawFont::correctFontData_data()
<< QFont::Bold
<< QFont::HintingPreference(*hintingPreference)
<< qreal(1000.0)
- << qreal(10.0);
+ << qreal(10.0)
+ << 7;
+
+ fileName = testFontOs2V1;
+ title = fileName
+ + QLatin1String(": hintingPreference=")
+ + QString::number(*hintingPreference);
+
+ QTest::newRow(qPrintable(title))
+ << fileName
+ << QString::fromLatin1("QtBidiTestFont")
+ << QFont::StyleNormal
+ << QFont::Normal
+ << QFont::HintingPreference(*hintingPreference)
+ << qreal(1000.0)
+ << qreal(10.0)
+ << 7;
++hintingPreference;
}
@@ -236,6 +256,7 @@ void tst_QRawFont::correctFontData()
QFETCH(QFont::HintingPreference, hintingPreference);
QFETCH(qreal, unitsPerEm);
QFETCH(qreal, pixelSize);
+ QFETCH(int, capHeight);
QRawFont font(fileName, 10, hintingPreference);
QVERIFY(font.isValid());
@@ -246,6 +267,11 @@ void tst_QRawFont::correctFontData()
QCOMPARE(font.hintingPreference(), hintingPreference);
QCOMPARE(font.unitsPerEm(), unitsPerEm);
QCOMPARE(font.pixelSize(), pixelSize);
+
+ // Some platforms return the actual fractional height of the
+ // H character when the value is missing from the OS/2 table,
+ // so we ceil it off to match (any touched pixel counts).
+ QCOMPARE(qCeil(font.capHeight()), capHeight);
}
void tst_QRawFont::glyphIndices()
diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro
index 0f4906ce4d..09d0dd4126 100644
--- a/tests/auto/gui/text/qstatictext/qstatictext.pro
+++ b/tests/auto/gui/text/qstatictext/qstatictext.pro
@@ -4,4 +4,4 @@ QT += testlib
SOURCES += tst_qstatictext.cpp
-contains(QT_CONFIG, private_tests): QT += core-private gui-private
+qtConfig(private_tests): QT += core-private gui-private
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index aba5b301be..de5b2a8676 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -2921,15 +2921,28 @@ void tst_QTextDocument::testUndoBlocks()
doc->undo();
QCOMPARE(doc->toPlainText(), QString(""));
+ cursor.insertText("town");
+ cursor.beginEditBlock(); // Edit block 1 - Deletion/Insertion
+ cursor.setPosition(0, QTextCursor::KeepAnchor);
+ cursor.insertText("r");
+ cursor.endEditBlock();
+ cursor.insertText("est"); // Merged into edit block 1
+ QCOMPARE(doc->toPlainText(), QString("rest"));
+ doc->undo();
+ QCOMPARE(doc->toPlainText(), QString("town"));
+ doc->undo();
+ QCOMPARE(doc->toPlainText(), QString(""));
+
+ // This case would not happen in practice. If the user typed out this text, it would all be part of one
+ // edit block. This would cause the undo to clear all text. But for the purpose of testing the beginEditBlock
+ // and endEditBlock calls with respect to qtextdocument this is tested.
cursor.insertText("quod");
- cursor.beginEditBlock();
+ cursor.beginEditBlock(); // Edit block 1 - Insertion
cursor.insertText(" erat");
cursor.endEditBlock();
- cursor.insertText(" demonstrandum");
+ cursor.insertText(" demonstrandum"); // Merged into edit block 1
QCOMPARE(doc->toPlainText(), QString("quod erat demonstrandum"));
doc->undo();
- QCOMPARE(doc->toPlainText(), QString("quod erat"));
- doc->undo();
QCOMPARE(doc->toPlainText(), QString("quod"));
doc->undo();
QCOMPARE(doc->toPlainText(), QString(""));
diff --git a/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro b/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro
index 1419e32012..0bbe0c8c4e 100644
--- a/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro
+++ b/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro
@@ -6,5 +6,5 @@ SOURCES += tst_qtextpiecetable.cpp
HEADERS += ../qtextdocument/common.h
requires(!win32)
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index 0beea6528b..36907b9258 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -150,7 +150,7 @@ static void doShapingTests()
}
} else {
// decomposed shaping
- if (string.at(0) == 0x1fc1 || string.at(0) == 0x1fed)
+ if (string.at(0) == QChar(0x1fc1) || string.at(0) == QChar(0x1fed))
return;
if (string.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != string)
return;
diff --git a/tests/auto/gui/text/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro
index ebcd6ec022..ee92855093 100644
--- a/tests/auto/gui/text/qzip/qzip.pro
+++ b/tests/auto/gui/text/qzip/qzip.pro
@@ -2,12 +2,7 @@ CONFIG += testcase
TARGET = tst_qzip
QT += gui-private testlib
SOURCES += tst_qzip.cpp
-
-wince* {
- addFiles.files = testdata
- addFiles.path = .
- DEPLOYMENT += addFiles
-}
+TESTDATA += testdata
android {
RESOURCES += \
diff --git a/tests/auto/gui/text/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp
index 50e9a0f0ef..c0bf5fef8e 100644
--- a/tests/auto/gui/text/qzip/tst_qzip.cpp
+++ b/tests/auto/gui/text/qzip/tst_qzip.cpp
@@ -50,7 +50,7 @@ void tst_QZip::basicUnpack()
QZipReader::FileInfo fi = files.at(0);
QVERIFY(fi.isValid());
- QCOMPARE(fi.filePath, QString("test/"));
+ QCOMPARE(fi.filePath, QString("test"));
QCOMPARE(uint(fi.isDir), (uint) 1);
QCOMPARE(uint(fi.isFile), (uint) 0);
QCOMPARE(uint(fi.isSymLink), (uint) 0);
diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro
index dc67794a98..bb4984767f 100644
--- a/tests/auto/gui/text/text.pro
+++ b/tests/auto/gui/text/text.pro
@@ -22,13 +22,15 @@ SUBDIRS=\
qtextpiecetable \
qtextscriptengine \
qtexttable \
-
-contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter
+ qzip \
+ qtextodfwriter
win32:SUBDIRS -= qtextpiecetable
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qfontcache \
qcssparser \
qtextlayout \
qtextpiecetable \
+ qzip \
+ qtextodfwriter
diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
index 58164f1fa1..add23d46cf 100644
--- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
+++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp
@@ -46,7 +46,7 @@ void tst_qdesktopservices::openUrl()
{
// At the bare minimum check that they return false for invalid url's
QCOMPARE(QDesktopServices::openUrl(QUrl()), false);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// this test is only valid on windows on other systems it might mean open a new document in the application handling .file
const QRegularExpression messagePattern("ShellExecute 'file://invalid\\.file' failed \\(error \\d+\\)\\.");
QVERIFY(messagePattern.isValid());
diff --git a/tests/auto/network/access/access.pro b/tests/auto/network/access/access.pro
index bc76190e30..1d78cf253b 100644
--- a/tests/auto/network/access/access.pro
+++ b/tests/auto/network/access/access.pro
@@ -12,9 +12,12 @@ SUBDIRS=\
qftp \
qhttpnetworkreply \
qabstractnetworkcache \
+ hpack \
+ http2
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qhttpnetworkconnection \
qhttpnetworkreply \
qftp \
-
+ hpack \
+ http2
diff --git a/tests/auto/network/access/hpack/hpack.pro b/tests/auto/network/access/hpack/hpack.pro
new file mode 100644
index 0000000000..3c8b8e7944
--- /dev/null
+++ b/tests/auto/network/access/hpack/hpack.pro
@@ -0,0 +1,6 @@
+QT += core core-private network network-private testlib
+CONFIG += testcase parallel_test c++14
+TEMPLATE = app
+TARGET = tst_hpack
+
+SOURCES += tst_hpack.cpp
diff --git a/tests/auto/network/access/hpack/tst_hpack.cpp b/tests/auto/network/access/hpack/tst_hpack.cpp
new file mode 100644
index 0000000000..bd337c9f5f
--- /dev/null
+++ b/tests/auto/network/access/hpack/tst_hpack.cpp
@@ -0,0 +1,852 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2014 Governikus GmbH & Co. KG.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QtNetwork/private/bitstreams_p.h>
+#include <QtNetwork/private/hpack_p.h>
+
+#include <QtCore/qbytearray.h>
+
+#include <cstdlib>
+#include <vector>
+#include <string>
+
+QT_USE_NAMESPACE
+
+using namespace HPack;
+
+class tst_Hpack: public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_Hpack();
+private Q_SLOTS:
+ void bitstreamConstruction();
+ void bitstreamWrite();
+ void bitstreamReadWrite();
+ void bitstreamCompression();
+ void bitstreamErrors();
+
+ void lookupTableConstructor();
+
+ void lookupTableStatic_data();
+ void lookupTableStatic();
+ void lookupTableDynamic();
+
+ void hpackEncodeRequest_data();
+ void hpackEncodeRequest();
+ void hpackDecodeRequest_data();
+ void hpackDecodeRequest();
+
+ void hpackEncodeResponse_data();
+ void hpackEncodeResponse();
+ void hpackDecodeResponse_data();
+ void hpackDecodeResponse();
+
+ // TODO: more-more-more tests needed!
+
+private:
+ void hpackEncodeRequest(bool withHuffman);
+ void hpackEncodeResponse(bool withHuffman);
+
+ HttpHeader header1;
+ std::vector<uchar> buffer1;
+ BitOStream request1;
+
+ HttpHeader header2;
+ std::vector<uchar> buffer2;
+ BitOStream request2;
+
+ HttpHeader header3;
+ std::vector<uchar> buffer3;
+ BitOStream request3;
+};
+
+using StreamError = BitIStream::Error;
+
+tst_Hpack::tst_Hpack()
+ : request1(buffer1),
+ request2(buffer2),
+ request3(buffer3)
+{
+}
+
+void tst_Hpack::bitstreamConstruction()
+{
+ const uchar bytes[] = {0xDE, 0xAD, 0xBE, 0xEF};
+ const int size = int(sizeof bytes);
+
+ // Default ctors:
+ std::vector<uchar> buffer;
+ {
+ const BitOStream out(buffer);
+ QVERIFY(out.bitLength() == 0);
+ QVERIFY(out.byteLength() == 0);
+
+ const BitIStream in;
+ QVERIFY(in.bitLength() == 0);
+ QVERIFY(in.streamOffset() == 0);
+ QVERIFY(in.error() == StreamError::NoError);
+ }
+
+ // Create istream with some data:
+ {
+ BitIStream in(bytes, bytes + size);
+ QVERIFY(in.bitLength() == size * 8);
+ QVERIFY(in.streamOffset() == 0);
+ QVERIFY(in.error() == StreamError::NoError);
+ // 'Read' some data back:
+ for (int i = 0; i < size; ++i) {
+ uchar bitPattern = 0;
+ const auto bitsRead = in.peekBits(i * 8, 8, &bitPattern);
+ QVERIFY(bitsRead == 8);
+ QVERIFY(bitPattern == bytes[i]);
+ }
+ }
+
+ // Copy ctors:
+ {
+ // Ostreams - copy is disabled.
+ // Istreams:
+ const BitIStream in1;
+ const BitIStream in2(in1);
+ QVERIFY(in2.bitLength() == in1.bitLength());
+ QVERIFY(in2.streamOffset() == in1.streamOffset());
+ QVERIFY(in2.error() == StreamError::NoError);
+
+ const BitIStream in3(bytes, bytes + size);
+ const BitIStream in4(in3);
+ QVERIFY(in4.bitLength() == in3.bitLength());
+ QVERIFY(in4.streamOffset() == in3.streamOffset());
+ QVERIFY(in4.error() == StreamError::NoError);
+ }
+}
+
+void tst_Hpack::bitstreamWrite()
+{
+ // Known representations,
+ // https://http2.github.io/http2-spec/compression.html.
+ // 5.1 Integer Representation
+
+ // Test bit/byte lengths of the
+ // resulting data:
+ std::vector<uchar> buffer;
+ BitOStream out(buffer);
+ out.write(3);
+ // 11, fits into 8-bit prefix:
+ QVERIFY(out.bitLength() == 8);
+ QVERIFY(out.byteLength() == 1);
+ QVERIFY(out.begin()[0] == 3);
+
+ out.clear();
+ QVERIFY(out.bitLength() == 0);
+ QVERIFY(out.byteLength() == 0);
+
+ // This number does not fit into 8-bit
+ // prefix we'll need 2 bytes:
+ out.write(256);
+ QVERIFY(out.byteLength() == 2);
+ QVERIFY(out.bitLength() == 16);
+ QVERIFY(out.begin()[0] == 0xff);
+ QVERIFY(out.begin()[1] == 1);
+
+ out.clear();
+
+ // See 5.2 String Literal Representation.
+
+ // We use Huffman code,
+ // char 'a' has a prefix code 00011 (5 bits)
+ out.write(QByteArray("aaa", 3), true);
+ QVERIFY(out.byteLength() == 3);
+ QVERIFY(out.bitLength() == 24);
+ // Now we must have in our stream:
+ // 10000010 | 00011000| 11000111
+ const uchar *encoded = out.begin();
+ QVERIFY(encoded[0] == 0x82);
+ QVERIFY(encoded[1] == 0x18);
+ QVERIFY(encoded[2] == 0xC7);
+ // TODO: add more tests ...
+}
+
+void tst_Hpack::bitstreamReadWrite()
+{
+ // We can write into the bit stream:
+ // 1) bit patterns
+ // 2) integers (see HPACK, 5.1)
+ // 3) string (see HPACK, 5.2)
+ std::vector<uchar> buffer;
+ BitOStream out(buffer);
+ out.writeBits(0xf, 3);
+ QVERIFY(out.byteLength() == 1);
+ QVERIFY(out.bitLength() == 3);
+
+ // Now, read it back:
+ {
+ BitIStream in(out.begin(), out.end());
+ uchar bitPattern = 0;
+ const auto bitsRead = in.peekBits(0, 3, &bitPattern);
+ // peekBits pack into the most significant byte/bit:
+ QVERIFY(bitsRead == 3);
+ QVERIFY((bitPattern >> 5) == 7);
+ }
+
+ const quint32 testInt = 133;
+ out.write(testInt);
+
+ // This integer does not fit into the current 5-bit prefix,
+ // so byteLength == 2.
+ QVERIFY(out.byteLength() == 2);
+ const auto bitLength = out.bitLength();
+ QVERIFY(bitLength > 3);
+
+ // Now, read it back:
+ {
+ BitIStream in(out.begin(), out.end());
+ in.skipBits(3); // Bit pattern
+ quint32 value = 0;
+ QVERIFY(in.read(&value));
+ QVERIFY(in.error() == StreamError::NoError);
+ QCOMPARE(value, testInt);
+ }
+
+ const QByteArray testString("ABCDE", 5);
+ out.write(testString, true); // Compressed
+ out.write(testString, false); // Non-compressed
+ QVERIFY(out.byteLength() > 2);
+ QVERIFY(out.bitLength() > bitLength);
+
+ // Now, read it back:
+ {
+ BitIStream in(out.begin(), out.end());
+ in.skipBits(bitLength); // Bit pattern and integer
+ QByteArray value;
+ // Read compressed string first ...
+ QVERIFY(in.read(&value));
+ QCOMPARE(value, testString);
+ QCOMPARE(in.error(), StreamError::NoError);
+ // Now non-compressed ...
+ QVERIFY(in.read(&value));
+ QCOMPARE(value, testString);
+ QCOMPARE(in.error(), StreamError::NoError);
+ }
+}
+
+void tst_Hpack::bitstreamCompression()
+{
+ // Similar to bitstreamReadWrite but
+ // writes/reads a lot of mixed strings/integers.
+ std::vector<std::string> strings;
+ std::vector<quint32> integers;
+ std::vector<bool> isA; // integer or string.
+ const std::string bytes("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()[]/*");
+ const unsigned nValues = 100000;
+
+ quint64 totalStringBytes = 0;
+ std::vector<uchar> buffer;
+ BitOStream out(buffer);
+ for (unsigned i = 0; i < nValues; ++i) {
+ const bool isString = std::rand() % 1000 > 500;
+ isA.push_back(isString);
+ if (!isString) {
+ integers.push_back(std::rand() % 1000);
+ out.write(integers.back());
+ } else {
+ const auto start = std::rand() % (bytes.length() / 2);
+ auto end = start * 2;
+ if (!end)
+ end = bytes.length() / 2;
+ strings.push_back(bytes.substr(start, end - start));
+ const auto &s = strings.back();
+ totalStringBytes += s.size();
+ QByteArray data(s.c_str(), int(s.size()));
+ const bool compressed(std::rand() % 1000 > 500);
+ out.write(data, compressed);
+ }
+ }
+
+ qDebug() << "Compressed(?) byte length:" << out.byteLength()
+ << "total string bytes:" << totalStringBytes;
+ qDebug() << "total integer bytes (for quint32):" << integers.size() * sizeof(quint32);
+
+ QVERIFY(out.byteLength() > 0);
+ QVERIFY(out.bitLength() > 0);
+
+ BitIStream in(out.begin(), out.end());
+
+ for (unsigned i = 0, iS = 0, iI = 0; i < nValues; ++i) {
+ if (isA[i]) {
+ QByteArray data;
+ QVERIFY(in.read(&data));
+ QCOMPARE(in.error(), StreamError::NoError);
+ QCOMPARE(data.toStdString(), strings[iS]);
+ ++iS;
+ } else {
+ quint32 value = 0;
+ QVERIFY(in.read(&value));
+ QCOMPARE(in.error(), StreamError::NoError);
+ QCOMPARE(value, integers[iI]);
+ ++iI;
+ }
+ }
+}
+
+void tst_Hpack::bitstreamErrors()
+{
+ {
+ BitIStream in;
+ quint32 val = 0;
+ QVERIFY(!in.read(&val));
+ QCOMPARE(in.error(), StreamError::NotEnoughData);
+ }
+ {
+ // Integer in a stream, that does not fit into quint32.
+ const uchar bytes[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ BitIStream in(bytes, bytes + sizeof bytes);
+ quint32 val = 0;
+ QVERIFY(!in.read(&val));
+ QCOMPARE(in.error(), StreamError::InvalidInteger);
+ }
+ {
+ const uchar byte = 0x82; // 1 - Huffman compressed, 2 - the (fake) byte length.
+ BitIStream in(&byte, &byte + 1);
+ QByteArray val;
+ QVERIFY(!in.read(&val));
+ QCOMPARE(in.error(), StreamError::NotEnoughData);
+ }
+}
+
+void tst_Hpack::lookupTableConstructor()
+{
+ {
+ FieldLookupTable nonIndexed(4096, false);
+ QVERIFY(nonIndexed.dynamicDataSize() == 0);
+ QVERIFY(nonIndexed.numberOfDynamicEntries() == 0);
+ QVERIFY(nonIndexed.numberOfStaticEntries() != 0);
+ QVERIFY(nonIndexed.numberOfStaticEntries() == nonIndexed.numberOfEntries());
+ // Now we add some fake field and verify what 'non-indexed' means ... no search
+ // by name.
+ QVERIFY(nonIndexed.prependField("custom-key", "custom-value"));
+ // 54: 10 + 12 in name/value pair above + 32 required by HPACK specs ...
+ QVERIFY(nonIndexed.dynamicDataSize() == 54);
+ QVERIFY(nonIndexed.numberOfDynamicEntries() == 1);
+ QCOMPARE(nonIndexed.numberOfEntries(), nonIndexed.numberOfStaticEntries() + 1);
+ // Should fail to find it (invalid index 0) - search is disabled.
+ QVERIFY(nonIndexed.indexOf("custom-key", "custom-value") == 0);
+ }
+ {
+ // "key" + "value" == 8 bytes, + 32 (HPACK's requirement) == 40.
+ // Let's ask for a max-size 32 so that entry does not fit:
+ FieldLookupTable nonIndexed(32, false);
+ QVERIFY(nonIndexed.prependField("key", "value"));
+ QVERIFY(nonIndexed.numberOfEntries() == nonIndexed.numberOfStaticEntries());
+ QVERIFY(nonIndexed.indexOf("key", "value") == 0);
+ }
+ {
+ FieldLookupTable indexed(4096, true);
+ QVERIFY(indexed.dynamicDataSize() == 0);
+ QVERIFY(indexed.numberOfDynamicEntries() == 0);
+ QVERIFY(indexed.numberOfStaticEntries() != 0);
+ QVERIFY(indexed.numberOfStaticEntries() == indexed.numberOfEntries());
+ QVERIFY(indexed.prependField("custom-key", "custom-value"));
+ QVERIFY(indexed.dynamicDataSize() == 54);
+ QVERIFY(indexed.numberOfDynamicEntries() == 1);
+ QVERIFY(indexed.numberOfEntries() == indexed.numberOfStaticEntries() + 1);
+ QVERIFY(indexed.indexOf("custom-key") == indexed.numberOfStaticEntries() + 1);
+ QVERIFY(indexed.indexOf("custom-key", "custom-value") == indexed.numberOfStaticEntries() + 1);
+ }
+}
+
+void tst_Hpack::lookupTableStatic_data()
+{
+ QTest::addColumn<QByteArray>("expectedName");
+ QTest::addColumn<QByteArray>("expectedValue");
+
+ // Some predefined fields to find
+ // (they are always defined/required by HPACK).
+ QTest::newRow(":authority|") << QByteArray(":authority") << QByteArray("");
+ QTest::newRow(":method|GET") << QByteArray(":method") << QByteArray("GET");
+ QTest::newRow(":method|POST") << QByteArray(":method") << QByteArray("POST");
+ QTest::newRow(":path|/") << QByteArray(":path") << QByteArray("/");
+ QTest::newRow(":path|/index.html") << QByteArray(":path") << QByteArray("/index.html");
+ QTest::newRow(":scheme|http") << QByteArray(":scheme") << QByteArray("http");
+ QTest::newRow(":scheme|https") << QByteArray(":scheme") << QByteArray("https");
+ QTest::newRow(":status|200") << QByteArray(":status") << QByteArray("200");
+ QTest::newRow(":status|204") << QByteArray(":status") << QByteArray("204");
+ QTest::newRow(":status|206") << QByteArray(":status") << QByteArray("206");
+ QTest::newRow(":status|304") << QByteArray(":status") << QByteArray("304");
+ QTest::newRow(":status|400") << QByteArray(":status") << QByteArray("400");
+ QTest::newRow(":status|404") << QByteArray(":status") << QByteArray("404");
+ QTest::newRow(":status|500") << QByteArray(":status") << QByteArray("500");
+}
+
+void tst_Hpack::lookupTableStatic()
+{
+ const FieldLookupTable table(0, false /*all static, no need in 'search index'*/);
+
+ QFETCH(QByteArray, expectedName);
+ QFETCH(QByteArray, expectedValue);
+
+ const quint32 index = table.indexOf(expectedName, expectedValue);
+ QVERIFY(index != 0);
+
+ QByteArray name, value;
+ QVERIFY(table.field(index, &name, &value));
+ QCOMPARE(name, expectedName);
+ QCOMPARE(value, expectedValue);
+}
+
+void tst_Hpack::lookupTableDynamic()
+{
+ // HPACK's table size:
+ // for every field -> size += field.name.length() + field.value.length() + 32.
+ // Let's set some size limit and try to fill table with enough entries to have several
+ // items evicted.
+ const quint32 tableSize = 8192;
+ const char stringData[] = "abcdefghijklmnopABCDEFGHIJKLMNOP0123456789()[]:";
+ const quint32 dataSize = sizeof stringData - 1;
+
+ FieldLookupTable table(tableSize, true);
+
+ std::vector<QByteArray> fieldsToFind;
+ quint32 evicted = 0;
+
+ while (true) {
+ // Strings are repeating way too often, I want to
+ // have at least some items really evicted and not found,
+ // therefore these weird dances with start/len.
+ const quint32 start = std::rand() % (dataSize - 10);
+ quint32 len = std::rand() % (dataSize - start);
+ if (!len)
+ len = 1;
+
+ const QByteArray val(stringData + start, len);
+ fieldsToFind.push_back(val);
+ const quint32 entriesBefore = table.numberOfDynamicEntries();
+ QVERIFY(table.prependField(val, val));
+ QVERIFY(table.indexOf(val));
+ QVERIFY(table.indexOf(val) == table.indexOf(val, val));
+ QByteArray fieldName, fieldValue;
+ table.field(table.indexOf(val), &fieldName, &fieldValue);
+
+ QVERIFY(val == fieldName);
+ QVERIFY(val == fieldValue);
+
+ if (table.numberOfDynamicEntries() <= entriesBefore) {
+ // We had to evict several items ...
+ evicted += entriesBefore - table.numberOfDynamicEntries() + 1;
+ if (evicted >= 200)
+ break;
+ }
+ }
+
+ QVERIFY(table.dynamicDataSize() <= tableSize);
+ QVERIFY(table.numberOfDynamicEntries() > 0);
+ QVERIFY(table.indexOf(fieldsToFind.back())); // We MUST have it in a table!
+
+ using size_type = std::vector<QByteArray>::size_type;
+ for (size_type i = 0, e = fieldsToFind.size(); i < e; ++i) {
+ const auto &val = fieldsToFind[i];
+ const quint32 index = table.indexOf(val);
+ if (!index) {
+ QVERIFY(i < size_type(evicted));
+ } else {
+ QVERIFY(index == table.indexOf(val, val));
+ QByteArray fieldName, fieldValue;
+ QVERIFY(table.field(index, &fieldName, &fieldValue));
+ QVERIFY(val == fieldName);
+ QVERIFY(val == fieldValue);
+ }
+ }
+
+ table.clearDynamicTable();
+
+ QVERIFY(table.numberOfDynamicEntries() == 0);
+ QVERIFY(table.dynamicDataSize() == 0);
+ QVERIFY(table.indexOf(fieldsToFind.back()) == 0);
+
+ QVERIFY(table.prependField("name1", "value1"));
+ QVERIFY(table.prependField("name2", "value2"));
+
+ QVERIFY(table.indexOf("name1") == table.numberOfStaticEntries() + 2);
+ QVERIFY(table.indexOf("name2", "value2") == table.numberOfStaticEntries() + 1);
+ QVERIFY(table.indexOf("name1", "value2") == 0);
+ QVERIFY(table.indexOf("name2", "value1") == 0);
+ QVERIFY(table.indexOf("name3") == 0);
+
+ QVERIFY(!table.indexIsValid(table.numberOfEntries() + 1));
+
+ QVERIFY(table.prependField("name1", "value1"));
+ QVERIFY(table.numberOfDynamicEntries() == 3);
+ table.evictEntry();
+ QVERIFY(table.indexOf("name1") != 0);
+ table.evictEntry();
+ QVERIFY(table.indexOf("name2") == 0);
+ QVERIFY(table.indexOf("name1") != 0);
+ table.evictEntry();
+ QVERIFY(table.dynamicDataSize() == 0);
+ QVERIFY(table.numberOfDynamicEntries() == 0);
+ QVERIFY(table.indexOf("name1") == 0);
+}
+
+void tst_Hpack::hpackEncodeRequest_data()
+{
+ QTest::addColumn<bool>("compression");
+ QTest::newRow("no-string-compression") << false;
+ QTest::newRow("with-string-compression") << true;
+}
+
+void tst_Hpack::hpackEncodeRequest(bool withHuffman)
+{
+ // This function uses examples from HPACK specs
+ // (see appendix).
+
+ Encoder encoder(4096, withHuffman);
+ // HPACK, C.3.1 First Request
+ /*
+ :method: GET
+ :scheme: http
+ :path: /
+ :authority: www.example.com
+
+ Hex dump of encoded data (without Huffman):
+
+ 8286 8441 0f77 7777 2e65 7861 6d70 6c65 | ...A.www.example
+ 2e63 6f6d
+
+ Hex dump of encoded data (with Huffman):
+
+ 8286 8441 8cf1 e3c2 e5f2 3a6b a0ab 90f4 ff
+ */
+ request1.clear();
+ header1 = {{":method", "GET"},
+ {":scheme", "http"},
+ {":path", "/"},
+ {":authority", "www.example.com"}};
+ QVERIFY(encoder.encodeRequest(request1, header1));
+ QVERIFY(encoder.dynamicTableSize() == 57);
+
+ // HPACK, C.3.2 Second Request
+ /*
+ Header list to encode:
+
+ :method: GET
+ :scheme: http
+ :path: /
+ :authority: www.example.com
+ cache-control: no-cache
+
+ Hex dump of encoded data (without Huffman):
+
+ 8286 84be 5808 6e6f 2d63 6163 6865
+
+ Hex dump of encoded data (with Huffman):
+
+ 8286 84be 5886 a8eb 1064 9cbf
+ */
+
+ request2.clear();
+ header2 = {{":method", "GET"},
+ {":scheme", "http"},
+ {":path", "/"},
+ {":authority", "www.example.com"},
+ {"cache-control", "no-cache"}};
+ encoder.encodeRequest(request2, header2);
+ QVERIFY(encoder.dynamicTableSize() == 110);
+
+ // HPACK, C.3.3 Third Request
+ /*
+ Header list to encode:
+
+ :method: GET
+ :scheme: https
+ :path: /index.html
+ :authority: www.example.com
+ custom-key: custom-value
+
+ Hex dump of encoded data (without Huffman):
+
+ 8287 85bf 400a 6375 7374 6f6d 2d6b 6579
+ 0c63 7573 746f 6d2d 7661 6c75 65
+
+ Hex dump of encoded data (with Huffman):
+
+ 8287 85bf 4088 25a8 49e9 5ba9 7d7f 8925
+ a849 e95b b8e8 b4bf
+ */
+ request3.clear();
+ header3 = {{":method", "GET"},
+ {":scheme", "https"},
+ {":path", "/index.html"},
+ {":authority", "www.example.com"},
+ {"custom-key", "custom-value"}};
+ encoder.encodeRequest(request3, header3);
+ QVERIFY(encoder.dynamicTableSize() == 164);
+}
+
+void tst_Hpack::hpackEncodeRequest()
+{
+ QFETCH(bool, compression);
+
+ hpackEncodeRequest(compression);
+
+ // See comments above about these hex dumps ...
+ const uchar bytes1NH[] = {0x82, 0x86, 0x84, 0x41,
+ 0x0f, 0x77, 0x77, 0x77,
+ 0x2e, 0x65, 0x78, 0x61,
+ 0x6d, 0x70, 0x6c, 0x65,
+ 0x2e, 0x63, 0x6f, 0x6d};
+
+ const uchar bytes1WH[] = {0x82, 0x86, 0x84, 0x41,
+ 0x8c, 0xf1, 0xe3, 0xc2,
+ 0xe5, 0xf2, 0x3a, 0x6b,
+ 0xa0, 0xab, 0x90, 0xf4,
+ 0xff};
+
+ const uchar *hexDump1 = compression ? bytes1WH : bytes1NH;
+ const quint64 byteLength1 = compression ? sizeof bytes1WH : sizeof bytes1NH;
+
+ QCOMPARE(request1.byteLength(), byteLength1);
+ QCOMPARE(request1.bitLength(), byteLength1 * 8);
+
+ for (quint32 i = 0, e = request1.byteLength(); i < e; ++i)
+ QCOMPARE(hexDump1[i], request1.begin()[i]);
+
+ const uchar bytes2NH[] = {0x82, 0x86, 0x84, 0xbe,
+ 0x58, 0x08, 0x6e, 0x6f,
+ 0x2d, 0x63, 0x61, 0x63,
+ 0x68, 0x65};
+
+ const uchar bytes2WH[] = {0x82, 0x86, 0x84, 0xbe,
+ 0x58, 0x86, 0xa8, 0xeb,
+ 0x10, 0x64, 0x9c, 0xbf};
+
+ const uchar *hexDump2 = compression ? bytes2WH : bytes2NH;
+ const auto byteLength2 = compression ? sizeof bytes2WH : sizeof bytes2NH;
+ QVERIFY(request2.byteLength() == byteLength2);
+ QVERIFY(request2.bitLength() == byteLength2 * 8);
+ for (quint32 i = 0, e = request2.byteLength(); i < e; ++i)
+ QCOMPARE(hexDump2[i], request2.begin()[i]);
+
+ const uchar bytes3NH[] = {0x82, 0x87, 0x85, 0xbf,
+ 0x40, 0x0a, 0x63, 0x75,
+ 0x73, 0x74, 0x6f, 0x6d,
+ 0x2d, 0x6b, 0x65, 0x79,
+ 0x0c, 0x63, 0x75, 0x73,
+ 0x74, 0x6f, 0x6d, 0x2d,
+ 0x76, 0x61, 0x6c, 0x75,
+ 0x65};
+ const uchar bytes3WH[] = {0x82, 0x87, 0x85, 0xbf,
+ 0x40, 0x88, 0x25, 0xa8,
+ 0x49, 0xe9, 0x5b, 0xa9,
+ 0x7d, 0x7f, 0x89, 0x25,
+ 0xa8, 0x49, 0xe9, 0x5b,
+ 0xb8, 0xe8, 0xb4, 0xbf};
+
+ const uchar *hexDump3 = compression ? bytes3WH : bytes3NH;
+ const quint64 byteLength3 = compression ? sizeof bytes3WH : sizeof bytes3NH;
+ QCOMPARE(request3.byteLength(), byteLength3);
+ QCOMPARE(request3.bitLength(), byteLength3 * 8);
+ for (quint32 i = 0, e = request3.byteLength(); i < e; ++i)
+ QCOMPARE(hexDump3[i], request3.begin()[i]);
+}
+
+void tst_Hpack::hpackDecodeRequest_data()
+{
+ QTest::addColumn<bool>("compression");
+ QTest::newRow("no-string-compression") << false;
+ QTest::newRow("with-string-compression") << true;
+}
+
+void tst_Hpack::hpackDecodeRequest()
+{
+ QFETCH(bool, compression);
+ hpackEncodeRequest(compression);
+
+ QVERIFY(request1.byteLength());
+ QVERIFY(request2.byteLength());
+ QVERIFY(request3.byteLength());
+
+ Decoder decoder(4096);
+ BitIStream inputStream1(request1.begin(), request1.end());
+ QVERIFY(decoder.decodeHeaderFields(inputStream1));
+ QCOMPARE(decoder.dynamicTableSize(), quint32(57));
+ {
+ const auto &decoded = decoder.decodedHeader();
+ QVERIFY(decoded == header1);
+ }
+
+ BitIStream inputStream2{request2.begin(), request2.end()};
+ QVERIFY(decoder.decodeHeaderFields(inputStream2));
+ QCOMPARE(decoder.dynamicTableSize(), quint32(110));
+ {
+ const auto &decoded = decoder.decodedHeader();
+ QVERIFY(decoded == header2);
+ }
+
+ BitIStream inputStream3(request3.begin(), request3.end());
+ QVERIFY(decoder.decodeHeaderFields(inputStream3));
+ QCOMPARE(decoder.dynamicTableSize(), quint32(164));
+ {
+ const auto &decoded = decoder.decodedHeader();
+ QVERIFY(decoded == header3);
+ }
+}
+
+void tst_Hpack::hpackEncodeResponse_data()
+{
+ hpackEncodeRequest_data();
+}
+
+void tst_Hpack::hpackEncodeResponse()
+{
+ QFETCH(bool, compression);
+
+ hpackEncodeResponse(compression);
+
+ // TODO: we can also test bytes - using hex dumps from HPACK's specs,
+ // for now only test a table behavior/expected sizes.
+}
+
+void tst_Hpack::hpackEncodeResponse(bool withCompression)
+{
+ Encoder encoder(256, withCompression); // 256 - this will result in entries evicted.
+
+ // HPACK, C.5.1 First Response
+ /*
+ Header list to encode:
+
+ :status: 302
+ cache-control: private
+ date: Mon, 21 Oct 2013 20:13:21 GMT
+ location: https://www.example.com
+ */
+ request1.clear();
+ header1 = {{":status", "302"},
+ {"cache-control", "private"},
+ {"date", "Mon, 21 Oct 2013 20:13:21 GMT"},
+ {"location", "https://www.example.com"}};
+
+ QVERIFY(encoder.encodeResponse(request1, header1));
+ QCOMPARE(encoder.dynamicTableSize(), quint32(222));
+
+ // HPACK, C.5.2 Second Response
+ /*
+
+
+ The (":status", "302") header field is evicted from the dynamic
+ table to free space to allow adding the (":status", "307") header field.
+
+ Header list to encode:
+
+ :status: 307
+ cache-control: private
+ date: Mon, 21 Oct 2013 20:13:21 GMT
+ location: https://www.example.com
+ */
+ request2.clear();
+ header2 = {{":status", "307"},
+ {"cache-control", "private"},
+ {"date", "Mon, 21 Oct 2013 20:13:21 GMT"},
+ {"location", "https://www.example.com"}};
+ QVERIFY(encoder.encodeResponse(request2, header2));
+ QCOMPARE(encoder.dynamicTableSize(), quint32(222));
+
+ // HPACK, C.5.3 Third Response
+ /*
+ Several header fields are evicted from the dynamic table
+ during the processing of this header list.
+
+ Header list to encode:
+
+ :status: 200
+ cache-control: private
+ date: Mon, 21 Oct 2013 20:13:22 GMT
+ location: https://www.example.com
+ content-encoding: gzip
+ set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1
+ */
+ request3.clear();
+ header3 = {{":status", "200"},
+ {"cache-control", "private"},
+ {"date", "Mon, 21 Oct 2013 20:13:22 GMT"},
+ {"location", "https://www.example.com"},
+ {"content-encoding", "gzip"},
+ {"set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1"}};
+ QVERIFY(encoder.encodeResponse(request3, header3));
+ QCOMPARE(encoder.dynamicTableSize(), quint32(215));
+}
+
+void tst_Hpack::hpackDecodeResponse_data()
+{
+ hpackEncodeRequest_data();
+}
+
+void tst_Hpack::hpackDecodeResponse()
+{
+ QFETCH(bool, compression);
+
+ hpackEncodeResponse(compression);
+
+ QVERIFY(request1.byteLength());
+ Decoder decoder(256); // This size will result in entries evicted.
+ BitIStream inputStream1(request1.begin(), request1.end());
+ QVERIFY(decoder.decodeHeaderFields(inputStream1));
+ QCOMPARE(decoder.dynamicTableSize(), quint32(222));
+
+ {
+ const auto &decoded = decoder.decodedHeader();
+ QVERIFY(decoded == header1);
+ }
+
+ QVERIFY(request2.byteLength());
+ BitIStream inputStream2(request2.begin(), request2.end());
+ QVERIFY(decoder.decodeHeaderFields(inputStream2));
+ QCOMPARE(decoder.dynamicTableSize(), quint32(222));
+
+ {
+ const auto &decoded = decoder.decodedHeader();
+ QVERIFY(decoded == header2);
+ }
+
+ QVERIFY(request3.byteLength());
+ BitIStream inputStream3(request3.begin(), request3.end());
+ QVERIFY(decoder.decodeHeaderFields(inputStream3));
+ QCOMPARE(decoder.dynamicTableSize(), quint32(215));
+
+ {
+ const auto &decoded = decoder.decodedHeader();
+ QVERIFY(decoded == header3);
+ }
+}
+
+QTEST_MAIN(tst_Hpack)
+
+#include "tst_hpack.moc"
diff --git a/tests/auto/network/access/http2/certs/fluke.cert b/tests/auto/network/access/http2/certs/fluke.cert
new file mode 100644
index 0000000000..ace4e4f0eb
--- /dev/null
+++ b/tests/auto/network/access/http2/certs/fluke.cert
@@ -0,0 +1,75 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 0 (0x0)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=NO, ST=Oslo, L=Nydalen, O=Nokia Corporation and/or its subsidiary(-ies), OU=Development, CN=fluke.troll.no/emailAddress=ahanssen@trolltech.com
+ Validity
+ Not Before: Dec 4 01:10:32 2007 GMT
+ Not After : Apr 21 01:10:32 2035 GMT
+ Subject: C=NO, ST=Oslo, O=Nokia Corporation and/or its subsidiary(-ies), OU=Development, CN=fluke.troll.no
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:a7:c8:a0:4a:c4:19:05:1b:66:ba:32:e2:d2:f1:
+ 1c:6f:17:82:e4:39:2e:01:51:90:db:04:34:32:11:
+ 21:c2:0d:6f:59:d8:53:90:54:3f:83:8f:a9:d3:b3:
+ d5:ee:1a:9b:80:ae:c3:25:c9:5e:a5:af:4b:60:05:
+ aa:a0:d1:91:01:1f:ca:04:83:e3:58:1c:99:32:45:
+ 84:70:72:58:03:98:4a:63:8b:41:f5:08:49:d2:91:
+ 02:60:6b:e4:64:fe:dd:a0:aa:74:08:e9:34:4c:91:
+ 5f:12:3d:37:4d:54:2c:ad:7f:5b:98:60:36:02:8c:
+ 3b:f6:45:f3:27:6a:9b:94:9d
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints:
+ CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
+ X509v3 Subject Key Identifier:
+ 21:85:04:3D:23:01:66:E5:F7:9F:1A:84:24:8A:AF:0A:79:F4:E5:AC
+ X509v3 Authority Key Identifier:
+ DirName:/C=NO/ST=Oslo/L=Nydalen/O=Nokia Corporation and/or its subsidiary(-ies)/OU=Development/CN=fluke.troll.no/emailAddress=ahanssen@trolltech.com
+ serial:8E:A8:B4:E8:91:B7:54:2E
+
+ Signature Algorithm: sha1WithRSAEncryption
+ 6d:57:5f:d1:05:43:f0:62:05:ec:2a:71:a5:dc:19:08:f2:c4:
+ a6:bd:bb:25:d9:ca:89:01:0e:e4:cf:1f:c1:8c:c8:24:18:35:
+ 53:59:7b:c0:43:b4:32:e6:98:b2:a6:ef:15:05:0b:48:5f:e1:
+ a0:0c:97:a9:a1:77:d8:35:18:30:bc:a9:8f:d3:b7:54:c7:f1:
+ a9:9e:5d:e6:19:bf:f6:3c:5b:2b:d8:e4:3e:62:18:88:8b:d3:
+ 24:e1:40:9b:0c:e6:29:16:62:ab:ea:05:24:70:36:aa:55:93:
+ ef:02:81:1b:23:10:a2:04:eb:56:95:75:fc:f8:94:b1:5d:42:
+ c5:3f:36:44:85:5d:3a:2e:90:46:8a:a2:b9:6f:87:ae:0c:15:
+ 40:19:31:90:fc:3b:25:bb:ae:f1:66:13:0d:85:90:d9:49:34:
+ 8f:f2:5d:f9:7a:db:4d:5d:27:f6:76:9d:35:8c:06:a6:4c:a3:
+ b1:b2:b6:6f:1d:d7:a3:00:fd:72:eb:9e:ea:44:a1:af:21:34:
+ 7d:c7:42:e2:49:91:19:8b:c0:ad:ba:82:80:a8:71:70:f4:35:
+ 31:91:63:84:20:95:e9:60:af:64:8b:cc:ff:3d:8a:76:74:3d:
+ c8:55:6d:e4:8e:c3:2b:1c:e8:42:18:ae:9f:e6:6b:9c:34:06:
+ ec:6a:f2:c3
+-----BEGIN CERTIFICATE-----
+MIIEEzCCAvugAwIBAgIBADANBgkqhkiG9w0BAQUFADCBnDELMAkGA1UEBhMCTk8x
+DTALBgNVBAgTBE9zbG8xEDAOBgNVBAcTB055ZGFsZW4xFjAUBgNVBAoTDVRyb2xs
+dGVjaCBBU0ExFDASBgNVBAsTC0RldmVsb3BtZW50MRcwFQYDVQQDEw5mbHVrZS50
+cm9sbC5ubzElMCMGCSqGSIb3DQEJARYWYWhhbnNzZW5AdHJvbGx0ZWNoLmNvbTAe
+Fw0wNzEyMDQwMTEwMzJaFw0zNTA0MjEwMTEwMzJaMGMxCzAJBgNVBAYTAk5PMQ0w
+CwYDVQQIEwRPc2xvMRYwFAYDVQQKEw1Ucm9sbHRlY2ggQVNBMRQwEgYDVQQLEwtE
+ZXZlbG9wbWVudDEXMBUGA1UEAxMOZmx1a2UudHJvbGwubm8wgZ8wDQYJKoZIhvcN
+AQEBBQADgY0AMIGJAoGBAKfIoErEGQUbZroy4tLxHG8XguQ5LgFRkNsENDIRIcIN
+b1nYU5BUP4OPqdOz1e4am4CuwyXJXqWvS2AFqqDRkQEfygSD41gcmTJFhHByWAOY
+SmOLQfUISdKRAmBr5GT+3aCqdAjpNEyRXxI9N01ULK1/W5hgNgKMO/ZF8ydqm5Sd
+AgMBAAGjggEaMIIBFjAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NM
+IEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUIYUEPSMBZuX3nxqEJIqv
+Cnn05awwgbsGA1UdIwSBszCBsKGBoqSBnzCBnDELMAkGA1UEBhMCTk8xDTALBgNV
+BAgTBE9zbG8xEDAOBgNVBAcTB055ZGFsZW4xFjAUBgNVBAoTDVRyb2xsdGVjaCBB
+U0ExFDASBgNVBAsTC0RldmVsb3BtZW50MRcwFQYDVQQDEw5mbHVrZS50cm9sbC5u
+bzElMCMGCSqGSIb3DQEJARYWYWhhbnNzZW5AdHJvbGx0ZWNoLmNvbYIJAI6otOiR
+t1QuMA0GCSqGSIb3DQEBBQUAA4IBAQBtV1/RBUPwYgXsKnGl3BkI8sSmvbsl2cqJ
+AQ7kzx/BjMgkGDVTWXvAQ7Qy5piypu8VBQtIX+GgDJepoXfYNRgwvKmP07dUx/Gp
+nl3mGb/2PFsr2OQ+YhiIi9Mk4UCbDOYpFmKr6gUkcDaqVZPvAoEbIxCiBOtWlXX8
++JSxXULFPzZEhV06LpBGiqK5b4euDBVAGTGQ/Dslu67xZhMNhZDZSTSP8l35ettN
+XSf2dp01jAamTKOxsrZvHdejAP1y657qRKGvITR9x0LiSZEZi8CtuoKAqHFw9DUx
+kWOEIJXpYK9ki8z/PYp2dD3IVW3kjsMrHOhCGK6f5mucNAbsavLD
+-----END CERTIFICATE-----
diff --git a/tests/auto/network/access/http2/certs/fluke.key b/tests/auto/network/access/http2/certs/fluke.key
new file mode 100644
index 0000000000..9d1664d609
--- /dev/null
+++ b/tests/auto/network/access/http2/certs/fluke.key
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQCnyKBKxBkFG2a6MuLS8RxvF4LkOS4BUZDbBDQyESHCDW9Z2FOQ
+VD+Dj6nTs9XuGpuArsMlyV6lr0tgBaqg0ZEBH8oEg+NYHJkyRYRwclgDmEpji0H1
+CEnSkQJga+Rk/t2gqnQI6TRMkV8SPTdNVCytf1uYYDYCjDv2RfMnapuUnQIDAQAB
+AoGANFzLkanTeSGNFM0uttBipFT9F4a00dqHz6JnO7zXAT26I5r8sU1pqQBb6uLz
+/+Qz5Zwk8RUAQcsMRgJetuPQUb0JZjF6Duv24hNazqXBCu7AZzUenjafwmKC/8ri
+KpX3fTwqzfzi//FKGgbXQ80yykSSliDL3kn/drATxsLCgQECQQDXhEFWLJ0vVZ1s
+1Ekf+3NITE+DR16X+LQ4W6vyEHAjTbaNWtcTKdAWLA2l6N4WAAPYSi6awm+zMxx4
+VomVTsjdAkEAx0z+e7natLeFcrrq8pbU+wa6SAP1VfhQWKitxL1e7u/QO90NCpxE
+oQYKzMkmmpOOFjQwEMAy1dvFMbm4LHlewQJAC/ksDBaUcQHHqjktCtrUb8rVjAyW
+A8lscckeB2fEYyG5J6dJVaY4ClNOOs5yMDS2Afk1F6H/xKvtQ/5CzInA/QJATDub
+K+BPU8jO9q+gpuIi3VIZdupssVGmCgObVCHLakG4uO04y9IyPhV9lA9tALtoIf4c
+VIvv5fWGXBrZ48kZAQJBAJmVCdzQxd9LZI5vxijUCj5EI4e+x5DRqVUvyP8KCZrC
+AiNyoDP85T+hBZaSXK3aYGpVwelyj3bvo1GrTNwNWLw=
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/network/access/http2/http2.pro b/tests/auto/network/access/http2/http2.pro
new file mode 100644
index 0000000000..e130f30784
--- /dev/null
+++ b/tests/auto/network/access/http2/http2.pro
@@ -0,0 +1,8 @@
+QT += core core-private network network-private testlib
+
+CONFIG += testcase parallel_test c++11
+TARGET = tst_http2
+HEADERS += http2srv.h
+SOURCES += tst_http2.cpp http2srv.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp
new file mode 100644
index 0000000000..f919937fc3
--- /dev/null
+++ b/tests/auto/network/access/http2/http2srv.cpp
@@ -0,0 +1,640 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QtNetwork/private/http2protocol_p.h>
+#include <QtNetwork/private/bitstreams_p.h>
+
+#include "http2srv.h"
+
+#ifndef QT_NO_SSL
+#include <QtNetwork/qsslconfiguration.h>
+#include <QtNetwork/qsslsocket.h>
+#include <QtNetwork/qsslkey.h>
+#endif
+
+#include <QtNetwork/qtcpsocket.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qfile.h>
+
+#include <cstdlib>
+#include <cstring>
+#include <limits>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Http2;
+using namespace HPack;
+
+namespace
+{
+
+inline bool is_valid_client_stream(quint32 streamID)
+{
+ // A valid client stream ID is an odd integer number in the range [1, INT_MAX].
+ return (streamID & 0x1) && streamID <= std::numeric_limits<qint32>::max();
+}
+
+}
+
+Http2Server::Http2Server(bool h2c, const Http2Settings &ss, const Http2Settings &cs)
+ : serverSettings(ss),
+ clearTextHTTP2(h2c)
+{
+ for (const auto &s : cs)
+ expectedClientSettings[quint16(s.identifier)] = s.value;
+
+ responseBody = "<html>\n"
+ "<head>\n"
+ "<title>Sample \"Hello, World\" Application</title>\n"
+ "</head>\n"
+ "<body bgcolor=white>\n"
+ "<table border=\"0\" cellpadding=\"10\">\n"
+ "<tr>\n"
+ "<td>\n"
+ "<img src=\"images/springsource.png\">\n"
+ "</td>\n"
+ "<td>\n"
+ "<h1>Sample \"Hello, World\" Application</h1>\n"
+ "</td>\n"
+ "</tr>\n"
+ "</table>\n"
+ "<p>This is the home page for the HelloWorld Web application. </p>\n"
+ "</body>\n"
+ "</html>";
+}
+
+Http2Server::~Http2Server()
+{
+}
+
+void Http2Server::setResponseBody(const QByteArray &body)
+{
+ responseBody = body;
+}
+
+void Http2Server::startServer()
+{
+#ifdef QT_NO_SSL
+ // Let the test fail with timeout.
+ if (!clearTextHTTP2)
+ return;
+#endif
+ if (listen())
+ emit serverStarted(serverPort());
+}
+
+
+void Http2Server::sendServerSettings()
+{
+ Q_ASSERT(socket);
+
+ if (!serverSettings.size())
+ return;
+
+ writer.start(FrameType::SETTINGS, FrameFlag::EMPTY, connectionStreamID);
+ for (const auto &s : serverSettings) {
+ writer.append(s.identifier);
+ writer.append(s.value);
+ if (s.identifier == Settings::INITIAL_WINDOW_SIZE_ID)
+ streamRecvWindowSize = s.value;
+ }
+ writer.write(*socket);
+ // Now, let's update our peer on a session recv window size:
+ const quint32 updatedSize = 10 * streamRecvWindowSize;
+ if (sessionRecvWindowSize < updatedSize) {
+ const quint32 delta = updatedSize - sessionRecvWindowSize;
+ sessionRecvWindowSize = updatedSize;
+ sessionCurrRecvWindow = updatedSize;
+ sendWINDOW_UPDATE(connectionStreamID, delta);
+ }
+
+ waitingClientAck = true;
+ settingsSent = true;
+}
+
+void Http2Server::sendGOAWAY(quint32 streamID, quint32 error, quint32 lastStreamID)
+{
+ Q_ASSERT(socket);
+
+ writer.start(FrameType::GOAWAY, FrameFlag::EMPTY, streamID);
+ writer.append(lastStreamID);
+ writer.append(error);
+ writer.write(*socket);
+}
+
+void Http2Server::sendRST_STREAM(quint32 streamID, quint32 error)
+{
+ Q_ASSERT(socket);
+
+ writer.start(FrameType::RST_STREAM, FrameFlag::EMPTY, streamID);
+ writer.append(error);
+ writer.write(*socket);
+}
+
+void Http2Server::sendDATA(quint32 streamID, quint32 windowSize)
+{
+ Q_ASSERT(socket);
+
+ const auto it = suspendedStreams.find(streamID);
+ Q_ASSERT(it != suspendedStreams.end());
+
+ const quint32 offset = it->second;
+ Q_ASSERT(offset < quint32(responseBody.size()));
+
+ const quint32 bytes = std::min<quint32>(windowSize, responseBody.size() - offset);
+ const quint32 frameSizeLimit(clientSetting(Settings::MAX_FRAME_SIZE_ID, Http2::maxFrameSize));
+ const uchar *src = reinterpret_cast<const uchar *>(responseBody.constData() + offset);
+ const bool last = offset + bytes == quint32(responseBody.size());
+
+ writer.start(FrameType::DATA, FrameFlag::EMPTY, streamID);
+ writer.writeDATA(*socket, frameSizeLimit, src, bytes);
+
+ if (last) {
+ writer.start(FrameType::DATA, FrameFlag::END_STREAM, streamID);
+ writer.setPayloadSize(0);
+ writer.write(*socket);
+ suspendedStreams.erase(it);
+ activeRequests.erase(streamID);
+
+ Q_ASSERT(closedStreams.find(streamID) == closedStreams.end());
+ closedStreams.insert(streamID);
+ } else {
+ it->second += bytes;
+ }
+}
+
+void Http2Server::sendWINDOW_UPDATE(quint32 streamID, quint32 delta)
+{
+ Q_ASSERT(socket);
+
+ writer.start(FrameType::WINDOW_UPDATE, FrameFlag::EMPTY, streamID);
+ writer.append(delta);
+ writer.write(*socket);
+}
+
+void Http2Server::incomingConnection(qintptr socketDescriptor)
+{
+ if (clearTextHTTP2) {
+ socket.reset(new QTcpSocket);
+ const bool set = socket->setSocketDescriptor(socketDescriptor);
+ Q_UNUSED(set) Q_ASSERT(set);
+ // Stop listening:
+ close();
+ QMetaObject::invokeMethod(this, "connectionEstablished",
+ Qt::QueuedConnection);
+ } else {
+#ifndef QT_NO_SSL
+ socket.reset(new QSslSocket);
+ QSslSocket *sslSocket = static_cast<QSslSocket *>(socket.data());
+ // Add HTTP2 as supported protocol:
+ auto conf = QSslConfiguration::defaultConfiguration();
+ auto protos = conf.allowedNextProtocols();
+ protos.prepend(QSslConfiguration::ALPNProtocolHTTP2);
+ conf.setAllowedNextProtocols(protos);
+ sslSocket->setSslConfiguration(conf);
+ // SSL-related setup ...
+ sslSocket->setPeerVerifyMode(QSslSocket::VerifyNone);
+ sslSocket->setProtocol(QSsl::TlsV1_2OrLater);
+ connect(sslSocket, SIGNAL(sslErrors(QList<QSslError>)),
+ this, SLOT(ignoreErrorSlot()));
+ QFile file(SRCDIR "certs/fluke.key");
+ file.open(QIODevice::ReadOnly);
+ QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
+ sslSocket->setPrivateKey(key);
+ auto localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert");
+ sslSocket->setLocalCertificateChain(localCert);
+ sslSocket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState);
+ // Stop listening.
+ close();
+ // Start SSL handshake and ALPN:
+ connect(sslSocket, SIGNAL(encrypted()), this, SLOT(connectionEstablished()));
+ sslSocket->startServerEncryption();
+#else
+ Q_UNREACHABLE();
+#endif
+ }
+}
+
+quint32 Http2Server::clientSetting(Http2::Settings identifier, quint32 defaultValue)
+{
+ const auto it = expectedClientSettings.find(quint16(identifier));
+ if (it != expectedClientSettings.end())
+ return it->second;
+ return defaultValue;
+}
+
+void Http2Server::connectionEstablished()
+{
+ using namespace Http2;
+
+ connect(socket.data(), SIGNAL(readyRead()),
+ this, SLOT(readReady()));
+
+ waitingClientPreface = true;
+ waitingClientAck = false;
+ waitingClientSettings = false;
+ settingsSent = false;
+ // We immediately send our settings so that our client
+ // can use flow control correctly.
+ sendServerSettings();
+
+ if (socket->bytesAvailable())
+ readReady();
+}
+
+void Http2Server::ignoreErrorSlot()
+{
+#ifndef QT_NO_SSL
+ static_cast<QSslSocket *>(socket.data())->ignoreSslErrors();
+#endif
+}
+
+// Now HTTP2 "server" part:
+/*
+This code is overly simplified but it tests the basic HTTP2 expected behavior:
+1. CONNECTION PREFACE
+2. SETTINGS
+3. sends our own settings (to modify the flow control)
+4. collects and reports requests
+5. if asked - sends responds to those requests
+6. does some very basic error handling
+7. tests frames validity/stream logic at the very basic level.
+*/
+
+void Http2Server::readReady()
+{
+ if (connectionError)
+ return;
+
+ if (waitingClientPreface) {
+ handleConnectionPreface();
+ } else {
+ const auto status = reader.read(*socket);
+ switch (status) {
+ case FrameStatus::incompleteFrame:
+ break;
+ case FrameStatus::goodFrame:
+ handleIncomingFrame();
+ break;
+ default:
+ connectionError = true;
+ sendGOAWAY(connectionStreamID, PROTOCOL_ERROR, connectionStreamID);
+ }
+ }
+
+ if (socket->bytesAvailable())
+ QMetaObject::invokeMethod(this, "readReady", Qt::QueuedConnection);
+}
+
+void Http2Server::handleConnectionPreface()
+{
+ Q_ASSERT(waitingClientPreface);
+
+ if (socket->bytesAvailable() < clientPrefaceLength)
+ return; // Wait for more data ...
+
+ char buf[clientPrefaceLength] = {};
+ socket->read(buf, clientPrefaceLength);
+ if (std::memcmp(buf, Http2clientPreface, clientPrefaceLength)) {
+ sendGOAWAY(connectionStreamID, PROTOCOL_ERROR, connectionStreamID);
+ emit clientPrefaceError();
+ connectionError = true;
+ return;
+ }
+
+ waitingClientPreface = false;
+ waitingClientSettings = true;
+}
+
+void Http2Server::handleIncomingFrame()
+{
+ // Frames that our implementation can send include:
+ // 1. SETTINGS (happens only during connection preface,
+ // handled already by this point)
+ // 2. SETTIGNS with ACK should be sent only as a response
+ // to a server's SETTINGS
+ // 3. HEADERS
+ // 4. CONTINUATION
+ // 5. DATA
+ // 6. PING
+ // 7. RST_STREAM
+ // 8. GOAWAY
+
+ inboundFrame = std::move(reader.inboundFrame());
+
+ if (continuedRequest.size()) {
+ if (inboundFrame.type() != FrameType::CONTINUATION ||
+ inboundFrame.streamID() != continuedRequest.front().streamID()) {
+ sendGOAWAY(connectionStreamID, PROTOCOL_ERROR, connectionStreamID);
+ emit invalidFrame();
+ connectionError = true;
+ return;
+ }
+ }
+
+ switch (inboundFrame.type()) {
+ case FrameType::SETTINGS:
+ handleSETTINGS();
+ break;
+ case FrameType::HEADERS:
+ case FrameType::CONTINUATION:
+ continuedRequest.push_back(std::move(inboundFrame));
+ processRequest();
+ break;
+ case FrameType::DATA:
+ handleDATA();
+ break;
+ case FrameType::RST_STREAM:
+ // TODO: this is not tested for now.
+ break;
+ case FrameType::PING:
+ // TODO: this is not tested for now.
+ break;
+ case FrameType::GOAWAY:
+ // TODO: this is not tested for now.
+ break;
+ case FrameType::WINDOW_UPDATE:
+ handleWINDOW_UPDATE();
+ break;
+ default:;
+ }
+}
+
+void Http2Server::handleSETTINGS()
+{
+ // SETTINGS is either a part of the connection preface,
+ // or a SETTINGS ACK.
+ Q_ASSERT(inboundFrame.type() == FrameType::SETTINGS);
+
+ if (inboundFrame.flags().testFlag(FrameFlag::ACK)) {
+ if (!waitingClientAck || inboundFrame.dataSize()) {
+ emit invalidFrame();
+ connectionError = true;
+ waitingClientAck = false;
+ return;
+ }
+
+ waitingClientAck = false;
+ emit serverSettingsAcked();
+ return;
+ }
+
+ // QHttp2ProtocolHandler always sends some settings,
+ // and the size is a multiple of 6.
+ if (!inboundFrame.dataSize() || inboundFrame.dataSize() % 6) {
+ sendGOAWAY(connectionStreamID, FRAME_SIZE_ERROR, connectionStreamID);
+ emit clientPrefaceError();
+ connectionError = true;
+ return;
+ }
+
+ const uchar *src = inboundFrame.dataBegin();
+ const uchar *end = src + inboundFrame.dataSize();
+
+ const auto notFound = expectedClientSettings.end();
+
+ while (src != end) {
+ const auto id = qFromBigEndian<quint16>(src);
+ const auto value = qFromBigEndian<quint32>(src + 2);
+ if (expectedClientSettings.find(id) == notFound ||
+ expectedClientSettings[id] != value) {
+ emit clientPrefaceError();
+ connectionError = true;
+ return;
+ }
+
+ src += 6;
+ }
+
+ // Send SETTINGS ACK:
+ writer.start(FrameType::SETTINGS, FrameFlag::ACK, connectionStreamID);
+ writer.write(*socket);
+ waitingClientSettings = false;
+ emit clientPrefaceOK();
+}
+
+void Http2Server::handleDATA()
+{
+ Q_ASSERT(inboundFrame.type() == FrameType::DATA);
+
+ const auto streamID = inboundFrame.streamID();
+
+ if (!is_valid_client_stream(streamID) ||
+ closedStreams.find(streamID) != closedStreams.end()) {
+ emit invalidFrame();
+ connectionError = true;
+ sendGOAWAY(connectionStreamID, PROTOCOL_ERROR, connectionStreamID);
+ return;
+ }
+
+ const auto payloadSize = inboundFrame.payloadSize();
+ if (sessionCurrRecvWindow < payloadSize) {
+ // Client does not respect our session window size!
+ emit invalidRequest(streamID);
+ connectionError = true;
+ sendGOAWAY(connectionStreamID, FLOW_CONTROL_ERROR, connectionStreamID);
+ return;
+ }
+
+ auto it = streamWindows.find(streamID);
+ if (it == streamWindows.end())
+ it = streamWindows.insert(std::make_pair(streamID, streamRecvWindowSize)).first;
+
+
+ if (it->second < payloadSize) {
+ emit invalidRequest(streamID);
+ connectionError = true;
+ sendGOAWAY(connectionStreamID, FLOW_CONTROL_ERROR, connectionStreamID);
+ return;
+ }
+
+ it->second -= payloadSize;
+ if (it->second < streamRecvWindowSize / 2) {
+ sendWINDOW_UPDATE(streamID, streamRecvWindowSize / 2);
+ it->second += streamRecvWindowSize / 2;
+ }
+
+ sessionCurrRecvWindow -= payloadSize;
+
+ if (sessionCurrRecvWindow < sessionRecvWindowSize / 2) {
+ // This is some quite naive and trivial logic on when to update.
+
+ sendWINDOW_UPDATE(connectionStreamID, sessionRecvWindowSize / 2);
+ sessionCurrRecvWindow += sessionRecvWindowSize / 2;
+ }
+
+ if (inboundFrame.flags().testFlag(FrameFlag::END_STREAM)) {
+ closedStreams.insert(streamID); // Enter "half-closed remote" state.
+ streamWindows.erase(it);
+ emit receivedData(streamID);
+ }
+}
+
+void Http2Server::handleWINDOW_UPDATE()
+{
+ const auto streamID = inboundFrame.streamID();
+ if (!streamID) // We ignore this for now to keep things simple.
+ return;
+
+ if (streamID && suspendedStreams.find(streamID) == suspendedStreams.end()) {
+ if (closedStreams.find(streamID) == closedStreams.end()) {
+ sendRST_STREAM(streamID, PROTOCOL_ERROR);
+ emit invalidFrame();
+ connectionError = true;
+ }
+
+ return;
+ }
+
+ const quint32 delta = qFromBigEndian<quint32>(inboundFrame.dataBegin());
+ if (!delta || delta > quint32(std::numeric_limits<qint32>::max())) {
+ sendRST_STREAM(streamID, PROTOCOL_ERROR);
+ emit invalidFrame();
+ connectionError = true;
+ return;
+ }
+
+ emit windowUpdate(streamID);
+ sendDATA(streamID, delta);
+}
+
+void Http2Server::sendResponse(quint32 streamID, bool emptyBody)
+{
+ Q_ASSERT(activeRequests.find(streamID) != activeRequests.end());
+
+ writer.start(FrameType::HEADERS, FrameFlag::END_HEADERS, streamID);
+ if (emptyBody)
+ writer.addFlag(FrameFlag::END_STREAM);
+
+ HttpHeader header = {{":status", "200"}};
+ if (!emptyBody) {
+ header.push_back(HPack::HeaderField("content-length",
+ QString("%1").arg(responseBody.size()).toLatin1()));
+ }
+
+ HPack::BitOStream ostream(writer.outboundFrame().buffer);
+ const bool result = encoder.encodeResponse(ostream, header);
+ Q_ASSERT(result);
+ Q_UNUSED(result)
+
+ const quint32 maxFrameSize(clientSetting(Settings::MAX_FRAME_SIZE_ID, Http2::maxFrameSize));
+ writer.writeHEADERS(*socket, maxFrameSize);
+
+ if (!emptyBody) {
+ Q_ASSERT(suspendedStreams.find(streamID) == suspendedStreams.end());
+
+ const quint32 windowSize = clientSetting(Settings::INITIAL_WINDOW_SIZE_ID,
+ Http2::defaultSessionWindowSize);
+ // Suspend to immediately resume it.
+ suspendedStreams[streamID] = 0; // start sending from offset 0
+ sendDATA(streamID, windowSize);
+ } else {
+ activeRequests.erase(streamID);
+ closedStreams.insert(streamID);
+ }
+}
+
+void Http2Server::processRequest()
+{
+ Q_ASSERT(continuedRequest.size());
+
+ if (!continuedRequest.back().flags().testFlag(FrameFlag::END_HEADERS))
+ return;
+
+ // We test here:
+ // 1. stream is 'idle'.
+ // 2. has priority set and dependency (it's 0x0 at the moment).
+ // 3. header can be decompressed.
+ const auto &headersFrame = continuedRequest.front();
+ const auto streamID = headersFrame.streamID();
+ if (!is_valid_client_stream(streamID)) {
+ emit invalidRequest(streamID);
+ connectionError = true;
+ sendGOAWAY(connectionStreamID, PROTOCOL_ERROR, connectionStreamID);
+ return;
+ }
+
+ if (closedStreams.find(streamID) != closedStreams.end()) {
+ emit invalidFrame();
+ connectionError = true;
+ sendGOAWAY(connectionStreamID, PROTOCOL_ERROR, connectionStreamID);
+ return;
+ }
+
+ quint32 dep = 0;
+ uchar w = 0;
+ if (!headersFrame.priority(&dep, &w)) {
+ emit invalidFrame();
+ sendRST_STREAM(streamID, PROTOCOL_ERROR);
+ return;
+ }
+
+ // Assemble headers ...
+ quint32 totalSize = 0;
+ for (const auto &frame : continuedRequest) {
+ if (std::numeric_limits<quint32>::max() - frame.dataSize() < totalSize) {
+ // Resulted in overflow ...
+ emit invalidFrame();
+ connectionError = true;
+ sendGOAWAY(connectionStreamID, PROTOCOL_ERROR, connectionStreamID);
+ return;
+ }
+ totalSize += frame.dataSize();
+ }
+
+ std::vector<uchar> hpackBlock(totalSize);
+ auto dst = hpackBlock.begin();
+ for (const auto &frame : continuedRequest) {
+ if (!frame.dataSize())
+ continue;
+ std::copy(frame.dataBegin(), frame.dataBegin() + frame.dataSize(), dst);
+ dst += frame.dataSize();
+ }
+
+ HPack::BitIStream inputStream{&hpackBlock[0], &hpackBlock[0] + hpackBlock.size()};
+
+ if (!decoder.decodeHeaderFields(inputStream)) {
+ emit decompressionFailed(streamID);
+ sendRST_STREAM(streamID, COMPRESSION_ERROR);
+ closedStreams.insert(streamID);
+ return;
+ }
+
+ // Actually, if needed, we can do a comparison here.
+ activeRequests[streamID] = decoder.decodedHeader();
+ if (headersFrame.flags().testFlag(FrameFlag::END_STREAM))
+ emit receivedRequest(streamID);
+ // else - we're waiting for incoming DATA frames ...
+ continuedRequest.clear();
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/network/access/http2/http2srv.h b/tests/auto/network/access/http2/http2srv.h
new file mode 100644
index 0000000000..73b1d80f8e
--- /dev/null
+++ b/tests/auto/network/access/http2/http2srv.h
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HTTP2SRV_H
+#define HTTP2SRV_H
+
+#include <QtNetwork/private/http2protocol_p.h>
+#include <QtNetwork/private/http2frames_p.h>
+#include <QtNetwork/private/hpack_p.h>
+
+#include <QtNetwork/qabstractsocket.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtNetwork/qtcpserver.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qglobal.h>
+
+#include <vector>
+#include <map>
+#include <set>
+
+QT_BEGIN_NAMESPACE
+
+struct Http2Setting
+{
+ Http2::Settings identifier;
+ quint32 value = 0;
+
+ Http2Setting(Http2::Settings ident, quint32 v)
+ : identifier(ident),
+ value(v)
+ {}
+};
+
+using Http2Settings = std::vector<Http2Setting>;
+
+class Http2Server : public QTcpServer
+{
+ Q_OBJECT
+public:
+ Http2Server(bool clearText, const Http2Settings &serverSettings,
+ const Http2Settings &clientSettings);
+
+ ~Http2Server();
+
+ // To be called before server started:
+ void setResponseBody(const QByteArray &body);
+
+ // Invokables, since we can call them from the main thread,
+ // but server (can) work on its own thread.
+ Q_INVOKABLE void startServer();
+ Q_INVOKABLE void sendServerSettings();
+ Q_INVOKABLE void sendGOAWAY(quint32 streamID, quint32 error,
+ quint32 lastStreamID);
+ Q_INVOKABLE void sendRST_STREAM(quint32 streamID, quint32 error);
+ Q_INVOKABLE void sendDATA(quint32 streamID, quint32 windowSize);
+ Q_INVOKABLE void sendWINDOW_UPDATE(quint32 streamID, quint32 delta);
+
+ Q_INVOKABLE void handleConnectionPreface();
+ Q_INVOKABLE void handleIncomingFrame();
+ Q_INVOKABLE void handleSETTINGS();
+ Q_INVOKABLE void handleDATA();
+ Q_INVOKABLE void handleWINDOW_UPDATE();
+
+ Q_INVOKABLE void sendResponse(quint32 streamID, bool emptyBody);
+
+private:
+ void processRequest();
+
+Q_SIGNALS:
+ void serverStarted(quint16 port);
+ // Error/success notifications:
+ void clientPrefaceOK();
+ void clientPrefaceError();
+ void serverSettingsAcked();
+ void invalidFrame();
+ void invalidRequest(quint32 streamID);
+ void decompressionFailed(quint32 streamID);
+ void receivedRequest(quint32 streamID);
+ void receivedData(quint32 streamID);
+ void windowUpdate(quint32 streamID);
+
+private slots:
+ void connectionEstablished();
+ void readReady();
+
+private:
+ void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
+
+ quint32 clientSetting(Http2::Settings identifier, quint32 defaultValue);
+
+ QScopedPointer<QAbstractSocket> socket;
+
+ // Connection preface:
+ bool waitingClientPreface = false;
+ bool waitingClientSettings = false;
+ bool settingsSent = false;
+ bool waitingClientAck = false;
+
+ Http2Settings serverSettings;
+ std::map<quint16, quint32> expectedClientSettings;
+
+ bool connectionError = false;
+
+ Http2::FrameReader reader;
+ Http2::Frame inboundFrame;
+ Http2::FrameWriter writer;
+
+ using FrameSequence = std::vector<Http2::Frame>;
+ FrameSequence continuedRequest;
+
+ std::map<quint32, quint32> streamWindows;
+
+ HPack::Decoder decoder{HPack::FieldLookupTable::DefaultSize};
+ HPack::Encoder encoder{HPack::FieldLookupTable::DefaultSize, true};
+
+ using Http2Requests = std::map<quint32, HPack::HttpHeader>;
+ Http2Requests activeRequests;
+ // 'remote half-closed' streams to keep
+ // track of streams with END_STREAM set:
+ std::set<quint32> closedStreams;
+ // streamID + offset in response body to send.
+ std::map<quint32, quint32> suspendedStreams;
+
+ // We potentially reset this once (see sendServerSettings)
+ // and do not change later:
+ quint32 sessionRecvWindowSize = Http2::defaultSessionWindowSize;
+ // This changes in the range [0, sessionRecvWindowSize]
+ // while handling DATA frames:
+ quint32 sessionCurrRecvWindow = sessionRecvWindowSize;
+ // This we potentially update only once (sendServerSettings).
+ quint32 streamRecvWindowSize = Http2::defaultSessionWindowSize;
+
+ QByteArray responseBody;
+ bool clearTextHTTP2 = false;
+
+protected slots:
+ void ignoreErrorSlot();
+};
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
new file mode 100644
index 0000000000..582a103b2e
--- /dev/null
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -0,0 +1,441 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include "http2srv.h"
+
+#include <QtNetwork/qnetworkaccessmanager.h>
+#include <QtNetwork/qnetworkrequest.h>
+#include <QtNetwork/qnetworkreply.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qurl.h>
+
+#ifndef QT_NO_SSL
+#ifndef QT_NO_OPENSSL
+#include <QtNetwork/private/qsslsocket_openssl_symbols_p.h>
+#endif // NO_OPENSSL
+#endif // NO_SSL
+
+
+#include <cstdlib>
+
+// At the moment our HTTP/2 imlpementation requires ALPN and this means OpenSSL.
+#if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)
+const bool clearTextHTTP2 = false;
+#else
+const bool clearTextHTTP2 = true;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class tst_Http2 : public QObject
+{
+ Q_OBJECT
+public:
+ tst_Http2();
+ ~tst_Http2();
+private slots:
+ // Tests:
+ void singleRequest();
+ void multipleRequests();
+ void flowControlClientSide();
+ void flowControlServerSide();
+
+protected slots:
+ // Slots to listen to our in-process server:
+ void serverStarted(quint16 port);
+ void clientPrefaceOK();
+ void clientPrefaceError();
+ void serverSettingsAcked();
+ void invalidFrame();
+ void invalidRequest(quint32 streamID);
+ void decompressionFailed(quint32 streamID);
+ void receivedRequest(quint32 streamID);
+ void receivedData(quint32 streamID);
+ void windowUpdated(quint32 streamID);
+ void replyFinished();
+
+private:
+ void clearHTTP2State();
+ // Run event for 'ms' milliseconds.
+ // The default value '5000' is enough for
+ // small payload.
+ void runEventLoop(int ms = 5000);
+ void stopEventLoop();
+ // TODO: different parameters like client/server settings ...
+ Http2Server *newServer(const Http2Settings &serverSettings);
+ // Send a get or post request, depending on a payload (empty or not).
+ void sendRequest(int streamNumber,
+ QNetworkRequest::Priority priority = QNetworkRequest::NormalPriority,
+ const QByteArray &payload = QByteArray());
+
+ quint16 serverPort = 0;
+ QThread *workerThread = nullptr;
+ QNetworkAccessManager manager;
+
+ QEventLoop eventLoop;
+ QTimer timer;
+
+ int nRequests = 0;
+
+ int windowUpdates = 0;
+ bool prefaceOK = false;
+ bool serverGotSettingsACK = false;
+
+ static const Http2Settings defaultServerSettings;
+};
+
+const Http2Settings tst_Http2::defaultServerSettings{{Http2::Settings::MAX_CONCURRENT_STREAMS_ID, 100}};
+
+tst_Http2::tst_Http2()
+ : workerThread(new QThread)
+{
+ workerThread->start();
+
+ timer.setInterval(10000);
+ timer.setSingleShot(true);
+
+ connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
+}
+
+tst_Http2::~tst_Http2()
+{
+ workerThread->quit();
+ workerThread->wait(5000);
+
+ if (workerThread->isFinished()) {
+ delete workerThread;
+ } else {
+ connect(workerThread, &QThread::finished,
+ workerThread, &QThread::deleteLater);
+ }
+}
+
+void tst_Http2::singleRequest()
+{
+ clearHTTP2State();
+
+ serverPort = 0;
+ nRequests = 1;
+
+ auto srv = newServer(defaultServerSettings);
+
+ QMetaObject::invokeMethod(srv, "startServer", Qt::QueuedConnection);
+ runEventLoop();
+
+ QVERIFY(serverPort != 0);
+
+ const QString urlAsString(clearTextHTTP2 ? QString("http://127.0.0.1:%1/index.html")
+ : QString("https://127.0.0.1:%1/index.html"));
+ const QUrl url(urlAsString.arg(serverPort));
+
+ QNetworkRequest request(url);
+ request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true));
+
+ auto reply = manager.get(request);
+ connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
+ // Since we're using self-signed certificates,
+ // ignore SSL errors:
+ reply->ignoreSslErrors();
+
+ runEventLoop();
+
+ QVERIFY(nRequests == 0);
+ QVERIFY(prefaceOK);
+ QVERIFY(serverGotSettingsACK);
+
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QVERIFY(reply->isFinished());
+
+ QMetaObject::invokeMethod(srv, "deleteLater", Qt::QueuedConnection);
+}
+
+void tst_Http2::multipleRequests()
+{
+ clearHTTP2State();
+
+ serverPort = 0;
+ nRequests = 10;
+
+ auto srv = newServer(defaultServerSettings);
+
+ QMetaObject::invokeMethod(srv, "startServer", Qt::QueuedConnection);
+
+ runEventLoop();
+ QVERIFY(serverPort != 0);
+
+ // Just to make the order a bit more interesting
+ // we'll index this randomly:
+ QNetworkRequest::Priority priorities[] = {QNetworkRequest::HighPriority,
+ QNetworkRequest::NormalPriority,
+ QNetworkRequest::LowPriority};
+
+
+
+ for (int i = 0; i < nRequests; ++i)
+ sendRequest(i, priorities[std::rand() % 3]);
+
+ runEventLoop();
+
+ QVERIFY(nRequests == 0);
+ QVERIFY(prefaceOK);
+ QVERIFY(serverGotSettingsACK);
+
+ QMetaObject::invokeMethod(srv, "deleteLater", Qt::QueuedConnection);
+}
+
+void tst_Http2::flowControlClientSide()
+{
+ // Create a server but impose limits:
+ // 1. Small MAX frame size, so we test CONTINUATION frames.
+ // 2. Small client windows so server responses cause client streams
+ // to suspend and server sends WINDOW_UPDATE frames.
+ // 3. Few concurrent streams, to test protocol handler can resume
+ // suspended requests.
+ using namespace Http2;
+
+ clearHTTP2State();
+
+ serverPort = 0;
+ nRequests = 10;
+ windowUpdates = 0;
+
+ const Http2Settings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, 3}};
+
+ auto srv = newServer(serverSettings);
+
+ const QByteArray respond(int(Http2::defaultSessionWindowSize * 50), 'x');
+ srv->setResponseBody(respond);
+
+ QMetaObject::invokeMethod(srv, "startServer", Qt::QueuedConnection);
+
+ runEventLoop();
+ QVERIFY(serverPort != 0);
+
+ for (int i = 0; i < nRequests; ++i)
+ sendRequest(i);
+
+ runEventLoop(120000);
+
+ QVERIFY(nRequests == 0);
+ QVERIFY(prefaceOK);
+ QVERIFY(serverGotSettingsACK);
+ QVERIFY(windowUpdates > 0);
+
+ QMetaObject::invokeMethod(srv, "deleteLater", Qt::QueuedConnection);
+}
+
+void tst_Http2::flowControlServerSide()
+{
+ // Quite aggressive test:
+ // low MAX_FRAME_SIZE forces a lot of small DATA frames,
+ // payload size exceedes stream/session RECV window sizes
+ // so that our implementation should deal with WINDOW_UPDATE
+ // on a session/stream level correctly + resume/suspend streams
+ // to let all replies finish without any error.
+ using namespace Http2;
+
+ clearHTTP2State();
+
+ serverPort = 0;
+ nRequests = 30;
+
+ const Http2Settings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, 7}};
+
+ auto srv = newServer(serverSettings);
+
+ const QByteArray payload(int(Http2::defaultSessionWindowSize * 500), 'x');
+
+ QMetaObject::invokeMethod(srv, "startServer", Qt::QueuedConnection);
+
+ runEventLoop();
+ QVERIFY(serverPort != 0);
+
+ for (int i = 0; i < nRequests; ++i)
+ sendRequest(i, QNetworkRequest::NormalPriority, payload);
+
+ runEventLoop(120000);
+
+ QVERIFY(nRequests == 0);
+ QVERIFY(prefaceOK);
+ QVERIFY(serverGotSettingsACK);
+
+ QMetaObject::invokeMethod(srv, "deleteLater", Qt::QueuedConnection);
+ srv = nullptr;
+}
+
+void tst_Http2::serverStarted(quint16 port)
+{
+ serverPort = port;
+ stopEventLoop();
+}
+
+void tst_Http2::clearHTTP2State()
+{
+ windowUpdates = 0;
+ prefaceOK = false;
+ serverGotSettingsACK = false;
+}
+
+void tst_Http2::runEventLoop(int ms)
+{
+ timer.setInterval(ms);
+ timer.start();
+ eventLoop.exec();
+}
+
+void tst_Http2::stopEventLoop()
+{
+ timer.stop();
+ eventLoop.quit();
+}
+
+Http2Server *tst_Http2::newServer(const Http2Settings &serverSettings)
+{
+ using namespace Http2;
+ // Client's settings are fixed by qhttp2protocolhandler.
+ const Http2Settings clientSettings = {{Settings::MAX_FRAME_SIZE_ID, quint32(Http2::maxFrameSize)},
+ {Settings::ENABLE_PUSH_ID, quint32(0)}};
+ auto srv = new Http2Server(clearTextHTTP2, serverSettings, clientSettings);
+
+ using Srv = Http2Server;
+ using Cl = tst_Http2;
+
+ connect(srv, &Srv::serverStarted, this, &Cl::serverStarted);
+ connect(srv, &Srv::clientPrefaceOK, this, &Cl::clientPrefaceOK);
+ connect(srv, &Srv::clientPrefaceError, this, &Cl::clientPrefaceError);
+ connect(srv, &Srv::serverSettingsAcked, this, &Cl::serverSettingsAcked);
+ connect(srv, &Srv::invalidFrame, this, &Cl::invalidFrame);
+ connect(srv, &Srv::invalidRequest, this, &Cl::invalidRequest);
+ connect(srv, &Srv::receivedRequest, this, &Cl::receivedRequest);
+ connect(srv, &Srv::receivedData, this, &Cl::receivedData);
+ connect(srv, &Srv::windowUpdate, this, &Cl::windowUpdated);
+
+ srv->moveToThread(workerThread);
+
+ return srv;
+}
+
+void tst_Http2::sendRequest(int streamNumber,
+ QNetworkRequest::Priority priority,
+ const QByteArray &payload)
+{
+ static const QString urlAsString(clearTextHTTP2 ? "http://127.0.0.1:%1/stream%2.html"
+ : "https://127.0.0.1:%1/stream%2.html");
+
+ const QUrl url(urlAsString.arg(serverPort).arg(streamNumber));
+ QNetworkRequest request(url);
+ request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true));
+ request.setPriority(priority);
+
+ QNetworkReply *reply = nullptr;
+ if (payload.size())
+ reply = manager.post(request, payload);
+ else
+ reply = manager.get(request);
+
+ reply->ignoreSslErrors();
+ connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
+}
+
+void tst_Http2::clientPrefaceOK()
+{
+ prefaceOK = true;
+}
+
+void tst_Http2::clientPrefaceError()
+{
+ prefaceOK = false;
+}
+
+void tst_Http2::serverSettingsAcked()
+{
+ serverGotSettingsACK = true;
+}
+
+void tst_Http2::invalidFrame()
+{
+}
+
+void tst_Http2::invalidRequest(quint32 streamID)
+{
+ Q_UNUSED(streamID)
+}
+
+void tst_Http2::decompressionFailed(quint32 streamID)
+{
+ Q_UNUSED(streamID)
+}
+
+void tst_Http2::receivedRequest(quint32 streamID)
+{
+ qDebug() << " server got a request on stream" << streamID;
+ Http2Server *srv = qobject_cast<Http2Server *>(sender());
+ Q_ASSERT(srv);
+ QMetaObject::invokeMethod(srv, "sendResponse", Qt::QueuedConnection,
+ Q_ARG(quint32, streamID),
+ Q_ARG(bool, false /*non-empty body*/));
+}
+
+void tst_Http2::receivedData(quint32 streamID)
+{
+ qDebug() << " server got a 'POST' request on stream" << streamID;
+ Http2Server *srv = qobject_cast<Http2Server *>(sender());
+ Q_ASSERT(srv);
+ QMetaObject::invokeMethod(srv, "sendResponse", Qt::QueuedConnection,
+ Q_ARG(quint32, streamID),
+ Q_ARG(bool, true /*HEADERS only*/));
+}
+
+void tst_Http2::windowUpdated(quint32 streamID)
+{
+ Q_UNUSED(streamID)
+
+ ++windowUpdates;
+}
+
+void tst_Http2::replyFinished()
+{
+ QVERIFY(nRequests);
+
+ if (const auto reply = qobject_cast<QNetworkReply *>(sender()))
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+
+ --nRequests;
+ if (!nRequests)
+ stopEventLoop();
+}
+
+QT_END_NAMESPACE
+
+QTEST_MAIN(tst_Http2)
+
+#include "tst_http2.moc"
diff --git a/tests/auto/network/access/qftp/qftp.pro b/tests/auto/network/access/qftp/qftp.pro
index 4294f27e74..1959c1acac 100644
--- a/tests/auto/network/access/qftp/qftp.pro
+++ b/tests/auto/network/access/qftp/qftp.pro
@@ -2,12 +2,5 @@ CONFIG += testcase
TARGET = tst_qftp
SOURCES += tst_qftp.cpp
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
QT = core network network-private testlib
-
-wince {
- addFiles.files = rfc3252.txt
- addFiles.path = .
- DEPLOYMENT += addFiles
-}
-
diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp
index edeb471401..a13fa86405 100644
--- a/tests/auto/network/access/qftp/tst_qftp.cpp
+++ b/tests/auto/network/access/qftp/tst_qftp.cpp
@@ -276,14 +276,9 @@ void tst_QFtp::init()
inFileDirExistsFunction = false;
-#if !defined(Q_OS_WINCE)
srand(time(0));
uniqueExtension = QString::number((quintptr)this) + QString::number(rand())
+ QString::number((qulonglong)time(0));
-#else
- srand(0);
- uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + QLatin1Char('0');
-#endif
}
void tst_QFtp::cleanup()
@@ -1353,11 +1348,7 @@ void tst_QFtp::abort_data()
QTest::newRow( "get_fluke02" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/rfc3252") << QByteArray();
// Qt/CE test environment has too little memory for this test
-#if !defined(Q_OS_WINCE)
QByteArray bigData( 10*1024*1024, 0 );
-#else
- QByteArray bigData( 1*1024*1024, 0 );
-#endif
bigData.fill( 'B' );
QTest::newRow( "put_fluke01" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/upload/abort_put") << bigData;
}
diff --git a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro
index bd20fd33dd..d32b651b86 100644
--- a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro
+++ b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qhttpnetworkconnection
SOURCES += tst_qhttpnetworkconnection.cpp
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
QT = core-private network-private testlib
diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index ef742aaa9a..84766f5484 100644
--- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -151,14 +151,7 @@ void tst_QHttpNetworkConnection::head()
QHttpNetworkRequest request(protocol + host + path, QHttpNetworkRequest::Head);
QHttpNetworkReply *reply = connection.sendRequest(request);
- QTime stopWatch;
- stopWatch.start();
- do {
- QCoreApplication::instance()->processEvents();
- if (stopWatch.elapsed() >= 30000)
- break;
- } while (!reply->isFinished());
-
+ QTRY_VERIFY_WITH_TIMEOUT(reply->isFinished(), 30000);
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
// only check it if it is set and expected
@@ -208,15 +201,7 @@ void tst_QHttpNetworkConnection::get()
QHttpNetworkRequest request(protocol + host + path);
QHttpNetworkReply *reply = connection.sendRequest(request);
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (reply->bytesAvailable())
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
+ QTRY_VERIFY_WITH_TIMEOUT(reply->bytesAvailable(), 30000);
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
@@ -224,17 +209,8 @@ void tst_QHttpNetworkConnection::get()
if (reply->contentLength() != -1 && contentLength != -1)
QCOMPARE(reply->contentLength(), qint64(contentLength));
- stopWatch.start();
- QByteArray ba;
- do {
- QCoreApplication::instance()->processEvents();
- while (reply->bytesAvailable())
- ba += reply->readAny();
- if (stopWatch.elapsed() >= 30000)
- break;
- } while (!reply->isFinished());
-
- QVERIFY(reply->isFinished());
+ QTRY_VERIFY_WITH_TIMEOUT(reply->isFinished(), 30000);
+ QByteArray ba = reply->readAll();
//do not require server generated error pages to be a fixed size
if (downloadSize != -1)
QCOMPARE(ba.size(), downloadSize);
@@ -303,13 +279,7 @@ void tst_QHttpNetworkConnection::put()
connect(reply, SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)),
SLOT(finishedWithError(QNetworkReply::NetworkError,QString)));
- QTime stopWatch;
- stopWatch.start();
- do {
- QCoreApplication::instance()->processEvents();
- if (stopWatch.elapsed() >= 30000)
- break;
- } while (!reply->isFinished() && !finishedCalled && !finishedWithErrorCalled);
+ QTRY_VERIFY_WITH_TIMEOUT(reply->isFinished() || finishedCalled || finishedWithErrorCalled, 30000);
if (reply->isFinished()) {
QByteArray ba;
@@ -385,16 +355,7 @@ void tst_QHttpNetworkConnection::post()
QHttpNetworkReply *reply = connection.sendRequest(request);
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (reply->bytesAvailable())
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
-
+ QTRY_VERIFY_WITH_TIMEOUT(reply->bytesAvailable(), 30000);
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
@@ -411,17 +372,8 @@ void tst_QHttpNetworkConnection::post()
}
}
- stopWatch.start();
- QByteArray ba;
- do {
- QCoreApplication::instance()->processEvents();
- while (reply->bytesAvailable())
- ba += reply->readAny();
- if (stopWatch.elapsed() >= 30000)
- break;
- } while (!reply->isFinished());
-
- QVERIFY(reply->isFinished());
+ QTRY_VERIFY_WITH_TIMEOUT(reply->isFinished(), 30000);
+ QByteArray ba = reply->readAll();
//don't require fixed size for generated error pages
if (downloadSize != -1)
QCOMPARE(ba.size(), downloadSize);
@@ -536,17 +488,7 @@ void tst_QHttpNetworkConnection::get401()
connect(reply, SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)),
SLOT(finishedWithError(QNetworkReply::NetworkError,QString)));
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (finishedCalled)
- break;
- if (finishedWithErrorCalled)
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
+ QTRY_VERIFY_WITH_TIMEOUT(finishedCalled || finishedWithErrorCalled, 30000);
QCOMPARE(reply->statusCode(), statusCode);
delete reply;
}
@@ -595,16 +537,8 @@ void tst_QHttpNetworkConnection::compression()
if (!autoCompress)
request.setHeaderField("Accept-Encoding", contentCoding.toLatin1());
QHttpNetworkReply *reply = connection.sendRequest(request);
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (reply->bytesAvailable())
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
+ QTRY_VERIFY_WITH_TIMEOUT(reply->bytesAvailable(), 30000);
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
bool isLengthOk = (reply->contentLength() == qint64(contentLength)
@@ -613,17 +547,8 @@ void tst_QHttpNetworkConnection::compression()
QVERIFY(isLengthOk);
- stopWatch.start();
- QByteArray ba;
- do {
- QCoreApplication::instance()->processEvents();
- while (reply->bytesAvailable())
- ba += reply->readAny();
- if (stopWatch.elapsed() >= 30000)
- break;
- } while (!reply->isFinished());
-
- QVERIFY(reply->isFinished());
+ QTRY_VERIFY_WITH_TIMEOUT(reply->isFinished(), 30000);
+ QByteArray ba = reply->readAll();
QCOMPARE(ba.size(), downloadSize);
delete reply;
@@ -694,17 +619,7 @@ void tst_QHttpNetworkConnection::ignoresslerror()
connect(reply, SIGNAL(finished()), SLOT(finishedReply()));
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (reply->bytesAvailable())
- break;
- if (statusCode == 100 && finishedWithErrorCalled)
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
+ QTRY_VERIFY_WITH_TIMEOUT(reply->bytesAvailable() || (statusCode == 100 && finishedWithErrorCalled), 30000);
QCOMPARE(reply->statusCode(), statusCode);
delete reply;
}
@@ -746,15 +661,7 @@ void tst_QHttpNetworkConnection::nossl()
connect(reply, SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)),
SLOT(finishedWithError(QNetworkReply::NetworkError,QString)));
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (finishedWithErrorCalled)
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
+ QTRY_VERIFY_WITH_TIMEOUT(finishedWithErrorCalled, 30000);
QCOMPARE(netErrorCode, networkError);
delete reply;
}
@@ -774,6 +681,15 @@ void tst_QHttpNetworkConnection::getMultiple_data()
QTest::newRow("1 connection, pipelining allowed, 100 requests") << quint16(1) << true << 100;
}
+static bool allRepliesFinished(const QList<QHttpNetworkReply*> *_replies)
+{
+ const QList<QHttpNetworkReply*> &replies = *_replies;
+ for (int i = 0; i < replies.length(); i++)
+ if (!replies.at(i)->isFinished())
+ return false;
+ return true;
+}
+
void tst_QHttpNetworkConnection::getMultiple()
{
QFETCH(quint16, connectionCount);
@@ -797,27 +713,7 @@ void tst_QHttpNetworkConnection::getMultiple()
replies.append(reply);
}
- QTime stopWatch;
- stopWatch.start();
- int finishedCount = 0;
- do {
- QCoreApplication::instance()->processEvents();
- if (stopWatch.elapsed() >= 60000)
- break;
-
- finishedCount = 0;
- for (int i = 0; i < replies.length(); i++)
- if (replies.at(i)->isFinished())
- finishedCount++;
-
- } while (finishedCount != replies.length());
-
- // redundant
- for (int i = 0; i < replies.length(); i++)
- QVERIFY(replies.at(i)->isFinished());
-
- qDebug() << "===" << stopWatch.elapsed() << "msec ===";
-
+ QTRY_VERIFY_WITH_TIMEOUT(allRepliesFinished(&replies), 60000);
qDeleteAll(requests);
qDeleteAll(replies);
}
@@ -854,24 +750,10 @@ void tst_QHttpNetworkConnection::getMultipleWithPipeliningAndMultiplePriorities(
replies.append(reply);
}
- QTime stopWatch;
- stopWatch.start();
- int finishedCount = 0;
- do {
- QCoreApplication::instance()->processEvents();
- if (stopWatch.elapsed() >= 60000)
- break;
-
- finishedCount = 0;
- for (int i = 0; i < replies.length(); i++)
- if (replies.at(i)->isFinished())
- finishedCount++;
-
- } while (finishedCount != replies.length());
+ QTRY_VERIFY_WITH_TIMEOUT(allRepliesFinished(&replies), 60000);
int pipelinedCount = 0;
for (int i = 0; i < replies.length(); i++) {
- QVERIFY(replies.at(i)->isFinished());
QVERIFY (!(replies.at(i)->request().isPipeliningAllowed() == false
&& replies.at(i)->isPipeliningUsed()));
@@ -885,8 +767,6 @@ void tst_QHttpNetworkConnection::getMultipleWithPipeliningAndMultiplePriorities(
// requests had been pipelined)
QVERIFY(pipelinedCount >= requestCount / 2);
- qDebug() << "===" << stopWatch.elapsed() << "msec ===";
-
qDeleteAll(requests);
qDeleteAll(replies);
}
@@ -1062,17 +942,7 @@ void tst_QHttpNetworkConnection::getAndThenDeleteObject()
QHttpNetworkReply *reply = connection->sendRequest(request);
reply->setDownstreamLimited(true);
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (reply->bytesAvailable())
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
-
- QVERIFY(reply->bytesAvailable());
+ QTRY_VERIFY_WITH_TIMEOUT(reply->bytesAvailable(), 30000);
QCOMPARE(reply->statusCode() ,200);
QVERIFY(!reply->isFinished()); // must not be finished
diff --git a/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro
index 1810a38f6e..31570e6f01 100644
--- a/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro
+++ b/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qhttpnetworkreply
SOURCES += tst_qhttpnetworkreply.cpp
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
QT = core-private network-private testlib
diff --git a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro
index bd10c77252..d3a92436ac 100644
--- a/tests/auto/network/access/qnetworkreply/qnetworkreply.pro
+++ b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-!winrt:!wince: SUBDIRS += echo
+!winrt:SUBDIRS += echo
test.depends += $$SUBDIRS
SUBDIRS += test
diff --git a/tests/auto/network/access/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro
index 772bb55990..45a5734305 100644
--- a/tests/auto/network/access/qnetworkreply/test/test.pro
+++ b/tests/auto/network/access/qnetworkreply/test/test.pro
@@ -5,12 +5,13 @@ SOURCES += ../tst_qnetworkreply.cpp
TARGET = ../tst_qnetworkreply
QT = core-private network-private testlib
+QT_FOR_CONFIG += gui-private
RESOURCES += ../qnetworkreply.qrc
TESTDATA += ../empty ../rfc3252.txt ../resource ../bigfile ../*.jpg ../certs \
../index.html ../smb-file.txt
-contains(QT_CONFIG,xcb): CONFIG+=insignificant_test # unstable, QTBUG-21102
+qtConfig(xcb): CONFIG+=insignificant_test # unstable, QTBUG-21102
win32:CONFIG += insignificant_test # QTBUG-24226
!winrt: TEST_HELPER_INSTALLS = ../echo/echo
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 93bdbdd6a5..43e05c95f9 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -205,6 +205,7 @@ private Q_SLOTS:
void invalidProtocol();
void getFromData_data();
void getFromData();
+ void getFromFile_data();
void getFromFile();
void getFromFileSpecial_data();
void getFromFileSpecial();
@@ -650,8 +651,10 @@ private slots:
#endif
void slotError(QAbstractSocket::SocketError err)
{
- Q_ASSERT(!client.isNull());
- qDebug() << "slotError" << err << client->errorString();
+ if (client.isNull())
+ qDebug() << "slotError" << err;
+ else
+ qDebug() << "slotError" << err << client->errorString();
}
public slots:
@@ -1674,14 +1677,26 @@ void tst_QNetworkReply::getFromData()
QCOMPARE(reply->readAll(), expected);
}
+void tst_QNetworkReply::getFromFile_data()
+{
+ QTest::addColumn<bool>("backgroundAttribute");
+
+ QTest::newRow("no-background-attribute") << false;
+ QTest::newRow("background-attribute") << true;
+}
+
void tst_QNetworkReply::getFromFile()
{
+ QFETCH(bool, backgroundAttribute);
+
// create the file:
QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX");
file.setAutoRemove(true);
QVERIFY2(file.open(), qPrintable(file.errorString()));
QNetworkRequest request(QUrl::fromLocalFile(file.fileName()));
+ if (backgroundAttribute)
+ request.setAttribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(true));
QNetworkReplyPtr reply;
static const char fileData[] = "This is some data that is in the file.\r\n";
@@ -1691,6 +1706,7 @@ void tst_QNetworkReply::getFromFile()
QCOMPARE(file.size(), qint64(data.size()));
RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::GetOperation, request, reply));
+ QVERIFY(waitForFinish(reply) != Timeout);
QCOMPARE(reply->url(), request.url());
QCOMPARE(reply->error(), QNetworkReply::NoError);
@@ -4319,9 +4335,6 @@ void tst_QNetworkReply::ioPutToFileFromProcess()
QSKIP("No qprocess support", SkipAll);
#else
-#if defined(Q_OS_WINCE)
- QSKIP("Currently no stdin/out supported for Windows CE");
-#else
#ifdef Q_OS_WIN
if (qstrcmp(QTest::currentDataTag(), "small") == 0)
QSKIP("When passing a CR-LF-LF sequence through Windows stdio, it gets converted, "
@@ -4355,7 +4368,6 @@ void tst_QNetworkReply::ioPutToFileFromProcess()
QCOMPARE(file.size(), qint64(data.size()));
QByteArray contents = file.readAll();
QCOMPARE(contents, data);
-#endif
#endif // QT_NO_PROCESS
}
@@ -6328,17 +6340,7 @@ void tst_QNetworkReply::getAndThenDeleteObject()
reply->setReadBufferSize(1);
reply->setParent((QObject*)0); // must be 0 because else it is the manager
- QTime stopWatch;
- stopWatch.start();
- forever {
- QCoreApplication::instance()->processEvents();
- if (reply->bytesAvailable())
- break;
- if (stopWatch.elapsed() >= 30000)
- break;
- }
-
- QVERIFY(reply->bytesAvailable());
+ QTRY_VERIFY_WITH_TIMEOUT(reply->bytesAvailable(), 30000);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
QVERIFY(!reply->isFinished()); // must not be finished
@@ -6561,12 +6563,7 @@ void tst_QNetworkReply::getFromHttpIntoBuffer2()
QFETCH(bool, useDownloadBuffer);
// On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results.
-#if defined(Q_OS_WINCE_WM)
- // Show some mercy to non-desktop platform/s
- enum {UploadSize = 4*1024*1024}; // 4 MB
-#else
enum {UploadSize = 32*1024*1024}; // 32 MB
-#endif
GetFromHttpIntoBuffer2Server server(UploadSize, true, false);
@@ -7892,10 +7889,6 @@ void tst_QNetworkReply::backgroundRequestInterruption()
QNetworkSessionPrivate::setUsagePolicies(*const_cast<QNetworkSession *>(session.data()), original);
QVERIFY(reply->isFinished());
-#ifdef Q_OS_OSX
- if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
- QEXPECT_FAIL("ftp, bg, nobg", "See QTBUG-32435", Abort);
-#endif
QCOMPARE(reply->error(), error);
#endif
}
diff --git a/tests/auto/network/kernel/kernel.pro b/tests/auto/network/kernel/kernel.pro
index bb13c7dd7d..42df80dfa1 100644
--- a/tests/auto/network/kernel/kernel.pro
+++ b/tests/auto/network/kernel/kernel.pro
@@ -7,6 +7,7 @@ SUBDIRS=\
qauthenticator \
qnetworkproxy \
qnetworkinterface \
+ qnetworkdatagram \
qnetworkaddressentry \
qhostaddress \
@@ -17,7 +18,7 @@ winrt: SUBDIRS -= \
osx: SUBDIRS -= \ # QTBUG-41847
qhostinfo \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qauthenticator \
qhostinfo \
diff --git a/tests/auto/network/kernel/qauthenticator/qauthenticator.pro b/tests/auto/network/kernel/qauthenticator/qauthenticator.pro
index 5e4759b690..5038eea9af 100644
--- a/tests/auto/network/kernel/qauthenticator/qauthenticator.pro
+++ b/tests/auto/network/kernel/qauthenticator/qauthenticator.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qauthenticator
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
QT = core network-private testlib
SOURCES += tst_qauthenticator.cpp
DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro
index 19d74dfd9b..a79fa2f59d 100644
--- a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro
+++ b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro
@@ -5,10 +5,4 @@ SOURCES += tst_qhostaddress.cpp
QT = core network testlib
-win32: {
-wince {
- LIBS += -lws2
-} else {
- LIBS += -lws2_32
-}
-}
+win32:LIBS += -lws2_32
diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
index 4fb97fe1f2..419c781aab 100644
--- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
+++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
@@ -62,6 +62,8 @@ private slots:
void specialAddresses();
void compare_data();
void compare();
+ void isEqual_data();
+ void isEqual();
void assignment();
void scopeId();
void hashKey();
@@ -291,6 +293,7 @@ void tst_QHostAddress::compare_data()
QTest::newRow("5") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::Broadcast) << false;
QTest::newRow("6") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << false;
QTest::newRow("7") << QHostAddress() << QHostAddress(QHostAddress::LocalHostIPv6) << false;
+ QTest::newRow("any4-any6") << QHostAddress(QHostAddress::AnyIPv4) << QHostAddress(QHostAddress::AnyIPv6) << false;
Q_IPV6ADDR localhostv4mapped = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1 } };
QTest::newRow("v4-v4mapped") << QHostAddress(QHostAddress::LocalHost) << QHostAddress("::ffff:127.0.0.1") << false;
@@ -309,6 +312,53 @@ void tst_QHostAddress::compare()
QCOMPARE(qHash(first), qHash(second));
}
+void tst_QHostAddress::isEqual_data()
+{
+ QTest::addColumn<QHostAddress>("first");
+ QTest::addColumn<QHostAddress>("second");
+ QTest::addColumn<int>("flags");
+ QTest::addColumn<bool>("result");
+
+ // QHostAddress::StrictConversion is already tested in compare()
+ QTest::newRow("localhost4to6-local") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertLocalHost << true;
+ QTest::newRow("localhost4to6-compat") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4CompatToIPv4 << false;
+ QTest::newRow("localhost4to6-mapped") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4MappedToIPv4 << false;
+ QTest::newRow("localhost4to6-unspec") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertUnspecifiedAddress << false;
+ QTest::newRow("0.0.0.1-::1-local") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertLocalHost << false;
+ QTest::newRow("v4-v4compat-local") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertLocalHost << false;
+ QTest::newRow("v4-v4mapped-local") << QHostAddress("192.168.1.1") << QHostAddress("::ffff:192.168.1.1") << (int)QHostAddress::ConvertLocalHost << false;
+ QTest::newRow("0.0.0.1-::1-unspec") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertUnspecifiedAddress << false;
+ QTest::newRow("v4-v4compat-unspec") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertUnspecifiedAddress << false;
+ QTest::newRow("v4-v4mapped-unspec") << QHostAddress("192.168.1.1") << QHostAddress("::ffff:192.168.1.1") << (int)QHostAddress::ConvertUnspecifiedAddress << false;
+ QTest::newRow("0.0.0.1-::1-compat") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4CompatToIPv4 << false;
+ QTest::newRow("v4-v4compat-compat") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertV4CompatToIPv4 << true;
+ QTest::newRow("v4-v4mapped-compat") << QHostAddress("192.168.1.1") << QHostAddress("::ffff:192.168.1.1") << (int)QHostAddress::ConvertV4CompatToIPv4 << false;
+ QTest::newRow("0.0.0.1-::1-mapped") << QHostAddress("0.0.0.1") << QHostAddress(QHostAddress::LocalHostIPv6) << (int)QHostAddress::ConvertV4MappedToIPv4 << false;
+ QTest::newRow("v4-v4compat-mapped") << QHostAddress("192.168.1.1") << QHostAddress("::192.168.1.1") << (int)QHostAddress::ConvertV4MappedToIPv4 << false;
+ QTest::newRow("v4-v4mapped-mapped") << QHostAddress("192.168.1.1") << QHostAddress("::FFFF:192.168.1.1") << (int)QHostAddress::ConvertV4MappedToIPv4 << true;
+ QTest::newRow("undef-any-local") << QHostAddress() << QHostAddress(QHostAddress::Any) << (int)QHostAddress::ConvertLocalHost << false;
+ QTest::newRow("undef-any-unspec") << QHostAddress() << QHostAddress(QHostAddress::Any) << (int)QHostAddress::ConvertUnspecifiedAddress << false;
+ QTest::newRow("anyv6-anyv4-compat") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertV4CompatToIPv4 << true;
+ QTest::newRow("anyv6-anyv4-mapped") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertV4MappedToIPv4 << false;
+ QTest::newRow("anyv6-anyv4-unspec") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertUnspecifiedAddress << true;
+ QTest::newRow("any-anyv4-unspec") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertUnspecifiedAddress << true;
+ QTest::newRow("any-anyv6-unspec") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv6) << (int)QHostAddress::ConvertUnspecifiedAddress << true;
+ QTest::newRow("anyv6-anyv4-local") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertLocalHost << false;
+ QTest::newRow("any-anyv4-local") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4) << (int)QHostAddress::ConvertLocalHost << false;
+ QTest::newRow("any-anyv6-local") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv6) << (int)QHostAddress::ConvertLocalHost << false;
+}
+
+void tst_QHostAddress::isEqual()
+{
+ QFETCH(QHostAddress, first);
+ QFETCH(QHostAddress, second);
+ QFETCH(int, flags);
+ QFETCH(bool, result);
+
+ QCOMPARE(first.isEqual(second, QHostAddress::ConversionModeFlag(flags)), result);
+ QCOMPARE(second.isEqual(first, QHostAddress::ConversionModeFlag(flags)), result);
+}
+
void tst_QHostAddress::assignment()
{
QHostAddress address;
diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro
index 12858c97ee..67a37faeb5 100644
--- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro
+++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro
@@ -3,14 +3,10 @@ TARGET = tst_qhostinfo
SOURCES += tst_qhostinfo.cpp
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
QT = core-private network-private testlib
-wince {
- LIBS += ws2.lib
-} else {
- win32:LIBS += -lws2_32
-}
+win32:LIBS += -lws2_32
# needed for getaddrinfo with official MinGW
mingw:DEFINES += _WIN32_WINNT=0x0501
diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
index 13d4442ada..f6d9b71aa2 100644
--- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
@@ -66,11 +66,7 @@
#include "private/qhostinfo_p.h"
#if !defined(QT_NO_GETADDRINFO)
-# if !defined(Q_OS_WINCE)
# include <sys/types.h>
-# else
-# include <types.h>
-# endif
# if defined(Q_OS_UNIX)
# include <sys/socket.h>
# endif
@@ -399,11 +395,7 @@ protected:
void tst_QHostInfo::threadSafety()
{
const int nattempts = 5;
-#if defined(Q_OS_WINCE)
- const int runs = 10;
-#else
const int runs = 100;
-#endif
LookupThread thr[nattempts];
for (int j = 0; j < runs; ++j) {
for (int i = 0; i < nattempts; ++i)
diff --git a/tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro b/tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro
new file mode 100644
index 0000000000..a2fe44060e
--- /dev/null
+++ b/tests/auto/network/kernel/qnetworkdatagram/qnetworkdatagram.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase console
+CONFIG -= app_bundle
+TARGET = tst_qnetworkdatagram
+SOURCES += tst_qnetworkdatagram.cpp
+QT = core network testlib
diff --git a/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp
new file mode 100644
index 0000000000..3295580432
--- /dev/null
+++ b/tests/auto/network/kernel/qnetworkdatagram/tst_qnetworkdatagram.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QNetworkDatagram>
+#include <QtTest>
+#include <QCoreApplication>
+
+class tst_QNetworkDatagram : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QNetworkDatagram();
+
+private Q_SLOTS:
+ void getSetCheck();
+ void makeReply_data();
+ void makeReply();
+};
+
+tst_QNetworkDatagram::tst_QNetworkDatagram()
+{
+}
+
+void tst_QNetworkDatagram::getSetCheck()
+{
+ QNetworkDatagram dg;
+
+ QVERIFY(dg.isNull());
+ QVERIFY(!dg.isValid());
+ QCOMPARE(dg.senderAddress(), QHostAddress());
+ QCOMPARE(dg.destinationAddress(), QHostAddress());
+ QCOMPARE(dg.senderPort(), -1);
+ QCOMPARE(dg.destinationPort(), -1);
+ QCOMPARE(dg.hopLimit(), -1);
+ QCOMPARE(dg.interfaceIndex(), 0U);
+
+ dg.setHopLimit(1);
+ QCOMPARE(dg.hopLimit(), 1);
+ dg.setHopLimit(255);
+ QCOMPARE(dg.hopLimit(), 255);
+
+ dg.setInterfaceIndex(1);
+ QCOMPARE(dg.interfaceIndex(), 1U);
+ dg.setInterfaceIndex(1234567U);
+ QCOMPARE(dg.interfaceIndex(), 1234567U);
+
+ dg.setSender(QHostAddress::Any, 12345);
+ QCOMPARE(dg.senderAddress(), QHostAddress(QHostAddress::Any));
+ QCOMPARE(dg.senderPort(), 12345);
+ dg.setSender(QHostAddress::LocalHost);
+ QCOMPARE(dg.senderAddress(), QHostAddress(QHostAddress::LocalHost));
+ QCOMPARE(dg.senderPort(), 0);
+
+ dg.setDestination(QHostAddress::LocalHostIPv6, 12345);
+ QCOMPARE(dg.destinationAddress(), QHostAddress(QHostAddress::LocalHostIPv6));
+ QCOMPARE(dg.destinationPort(), 12345);
+ dg.setDestination(QHostAddress::Broadcast, 137);
+ QCOMPARE(dg.destinationAddress(), QHostAddress(QHostAddress::Broadcast));
+ QCOMPARE(dg.destinationPort(), 137);
+}
+
+void tst_QNetworkDatagram::makeReply_data()
+{
+ qRegisterMetaType<QNetworkDatagram>();
+ QTest::addColumn<QNetworkDatagram>("dgram");
+ QTest::addColumn<QString>("localAddress");
+
+ QNetworkDatagram dgram("some data", QHostAddress("192.0.2.1"), 10001);
+ dgram.setHopLimit(64);
+ dgram.setSender(QHostAddress::LocalHost, 12345);
+ QTest::newRow("ipv4") << dgram << "192.0.2.1";
+
+ dgram.setDestination(QHostAddress("224.0.0.1"), 10002);
+ QTest::newRow("ipv4-multicast") << dgram << QString();
+
+ dgram.setSender(QHostAddress::LocalHostIPv6, 12346);
+ dgram.setDestination(QHostAddress("2001:db8::1"), 12347);
+ QTest::newRow("ipv6") << dgram << "2001:db8::1";
+
+ dgram.setSender(QHostAddress("fe80::1%1"), 10003);
+ dgram.setDestination(QHostAddress("fe80::2%1"), 10004);
+ dgram.setInterfaceIndex(1);
+ QTest::newRow("ipv6-linklocal") << dgram << "fe80::2%1";
+
+ dgram.setDestination(QHostAddress("ff02::1%1"), 10005);
+ QTest::newRow("ipv6-multicast") << dgram << QString();
+}
+
+void tst_QNetworkDatagram::makeReply()
+{
+ QFETCH(QNetworkDatagram, dgram);
+ QFETCH(QString, localAddress);
+
+ {
+ QNetworkDatagram reply = dgram.makeReply("World");
+ QCOMPARE(reply.data(), QByteArray("World"));
+ QCOMPARE(reply.senderAddress(), QHostAddress(localAddress));
+ QCOMPARE(reply.senderPort(), localAddress.isEmpty() ? -1 : dgram.destinationPort());
+ QCOMPARE(reply.destinationAddress(), dgram.senderAddress());
+ QCOMPARE(reply.destinationPort(), dgram.senderPort());
+ QCOMPARE(reply.interfaceIndex(), dgram.interfaceIndex());
+ QCOMPARE(reply.hopLimit(), -1);
+ }
+
+ QNetworkDatagram copy = dgram;
+ copy.setData(copy.data());
+ {
+ QNetworkDatagram reply = qMove(copy).makeReply("World");
+ QCOMPARE(reply.data(), QByteArray("World"));
+ QCOMPARE(reply.senderAddress(), QHostAddress(localAddress));
+ QCOMPARE(reply.senderPort(), localAddress.isEmpty() ? -1 : dgram.destinationPort());
+ QCOMPARE(reply.destinationAddress(), dgram.senderAddress());
+ QCOMPARE(reply.destinationPort(), dgram.senderPort());
+ QCOMPARE(reply.interfaceIndex(), dgram.interfaceIndex());
+ QCOMPARE(reply.hopLimit(), -1);
+ }
+}
+
+QTEST_MAIN(tst_QNetworkDatagram)
+#include "tst_qnetworkdatagram.moc"
diff --git a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri
index a3b4e89450..46c722deba 100644
--- a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri
+++ b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri
@@ -4,15 +4,9 @@ QNETWORK_SRC = $$QT_SOURCE_TREE/src/network
INCLUDEPATH += $$QNETWORK_SRC
-win32 {
- wince {
- LIBS += -lws2
- } else {
- LIBS += -lws2_32
- }
-}
+win32:LIBS += -lws2_32
-unix:contains(QT_CONFIG, reduce_exports) {
+unix:qtConfig(reduce_exports) {
SOURCES += $$QNETWORK_SRC/socket/qnativesocketengine_unix.cpp
SOURCES += $$QNETWORK_SRC/socket/qnativesocketengine.cpp
SOURCES += $$QNETWORK_SRC/socket/qabstractsocketengine.cpp
diff --git a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro
index eee762037d..ab96bb444e 100644
--- a/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro
+++ b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro
@@ -4,7 +4,7 @@ SOURCES += tst_platformsocketengine.cpp
include(../platformsocketengine/platformsocketengine.pri)
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
MOC_DIR=tmp
diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
index b3ecd884cd..43b5422635 100644
--- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
+++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
@@ -495,9 +495,6 @@ void tst_PlatformSocketEngine::readWriteBufferSize()
qint64 bufferSize = device.receiveBufferSize();
QVERIFY(bufferSize != -1);
device.setReceiveBufferSize(bufferSize + 1);
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL(0, "Not supported by default on WinCE", Continue);
-#endif
QVERIFY(device.receiveBufferSize() > bufferSize);
bufferSize = device.sendBufferSize();
@@ -607,8 +604,8 @@ void tst_PlatformSocketEngine::invalidSend()
PLATFORMSOCKETENGINE socket;
QVERIFY(socket.initialize(QAbstractSocket::TcpSocket));
- QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::writeDatagram() was"
- " called by a socket other than QAbstractSocket::UdpSocket");
+ QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::writeDatagram() was called"
+ " not in QAbstractSocket::BoundState or QAbstractSocket::ConnectedState");
QCOMPARE(socket.writeDatagram("hei", 3, QIpPacketHeader(QHostAddress::LocalHost, 143)),
(qlonglong) -1);
}
@@ -650,7 +647,7 @@ void tst_PlatformSocketEngine::receiveUrgentData()
QByteArray response;
// Native OOB data test doesn't work on HP-UX or WinCE
-#if !defined(Q_OS_HPUX) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_HPUX)
// The server sends an urgent message
msg = 'Q';
QCOMPARE(int(::send(socketDescriptor, &msg, sizeof(msg), MSG_OOB)), 1);
diff --git a/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro b/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro
index 12ce576e23..56a4fb8aee 100644
--- a/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro
+++ b/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro
@@ -7,6 +7,6 @@ include(../platformsocketengine/platformsocketengine.pri)
MOC_DIR=tmp
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
QT = core-private network-private testlib
diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 7237542e5c..68f3ea059b 100644
--- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -626,11 +626,7 @@ void tst_QHttpSocketEngine::downloadBigFile()
QTime stopWatch;
stopWatch.start();
-#if defined(Q_OS_WINCE)
- QTestEventLoop::instance().enterLoop(240);
-#else
QTestEventLoop::instance().enterLoop(60);
-#endif
if (QTestEventLoop::instance().timeout())
QFAIL("Network operation timed out");
diff --git a/tests/auto/network/socket/qlocalsocket/test/test.pro b/tests/auto/network/socket/qlocalsocket/test/test.pro
index 6a5df7f9b6..ab9ed90b1d 100644
--- a/tests/auto/network/socket/qlocalsocket/test/test.pro
+++ b/tests/auto/network/socket/qlocalsocket/test/test.pro
@@ -2,13 +2,7 @@ CONFIG += testcase
DEFINES += QLOCALSERVER_DEBUG
DEFINES += QLOCALSOCKET_DEBUG
-
-wince* {
- DEFINES += QT_LOCALSOCKET_TCP
- DEFINES += SRCDIR=\\\"../\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/../\\\"
-}
+DEFINES += SRCDIR=\\\"$$PWD/../\\\"
QT = core network testlib
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index 17d7697f94..8cc06a77ba 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -868,10 +868,8 @@ void tst_QLocalSocket::threadedConnection_data()
QTest::newRow("1 client") << 1;
QTest::newRow("2 clients") << 2;
QTest::newRow("5 clients") << 5;
-#ifndef Q_OS_WINCE
QTest::newRow("10 clients") << 10;
QTest::newRow("20 clients") << 20;
-#endif
}
void tst_QLocalSocket::threadedConnection()
diff --git a/tests/auto/network/socket/qsctpsocket/qsctpsocket.pro b/tests/auto/network/socket/qsctpsocket/qsctpsocket.pro
new file mode 100644
index 0000000000..49a40ce9b5
--- /dev/null
+++ b/tests/auto/network/socket/qsctpsocket/qsctpsocket.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+TARGET = tst_qsctpsocket
+QT = core network testlib
+
+SOURCES += tst_qsctpsocket.cpp
+
diff --git a/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp
new file mode 100644
index 0000000000..fc976fbd0d
--- /dev/null
+++ b/tests/auto/network/socket/qsctpsocket/tst_qsctpsocket.cpp
@@ -0,0 +1,488 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite 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 <QtTest/QtTest>
+#include <QDebug>
+#include <QEventLoop>
+#include <QByteArray>
+#include <QString>
+#include <QHostAddress>
+#include <QHostInfo>
+#include <QNetworkInterface>
+#include <QTime>
+
+#include <QSctpSocket>
+#include <QSctpServer>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+
+#define SOCKET int
+#define INVALID_SOCKET -1
+
+class tst_QSctpSocket : public QObject
+{
+ Q_OBJECT
+
+public:
+ static void enterLoop(int secs)
+ {
+ ++loopLevel;
+ QTestEventLoop::instance().enterLoop(secs);
+ --loopLevel;
+ }
+ static void exitLoop()
+ {
+ // Safe exit - if we aren't in an event loop, don't
+ // exit one.
+ if (loopLevel > 0)
+ QTestEventLoop::instance().exitLoop();
+ }
+ static bool timeout()
+ {
+ return QTestEventLoop::instance().timeout();
+ }
+
+private slots:
+ void constructing();
+ void bind_data();
+ void bind();
+ void setInvalidSocketDescriptor();
+ void setSocketDescriptor();
+ void socketDescriptor();
+ void hostNotFound();
+ void connecting();
+ void readAndWrite();
+ void loop_data();
+ void loop();
+ void loopInTCPMode_data();
+ void loopInTCPMode();
+ void readDatagramAfterClose();
+ void clientSendDataOnDelayedDisconnect();
+
+protected slots:
+ void exitLoopSlot();
+
+private:
+ static int loopLevel;
+};
+
+int tst_QSctpSocket::loopLevel = 0;
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::constructing()
+{
+ QSctpSocket socket;
+
+ // Check the initial state of the QSctpSocket.
+ QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState);
+ QVERIFY(socket.isSequential());
+ QVERIFY(!socket.isOpen());
+ QVERIFY(!socket.isValid());
+ QCOMPARE(socket.socketType(), QAbstractSocket::SctpSocket);
+ QCOMPARE(socket.maxChannelCount(), 0);
+ QCOMPARE(socket.readChannelCount(), 0);
+ QCOMPARE(socket.writeChannelCount(), 0);
+
+ char c;
+ QCOMPARE(socket.getChar(&c), false);
+ QCOMPARE(socket.bytesAvailable(), Q_INT64_C(0));
+ QCOMPARE(socket.canReadLine(), false);
+ QCOMPARE(socket.readLine(), QByteArray());
+ QCOMPARE(socket.socketDescriptor(), qintptr(-1));
+ QCOMPARE(int(socket.localPort()), 0);
+ QVERIFY(socket.localAddress() == QHostAddress());
+ QCOMPARE(int(socket.peerPort()), 0);
+ QVERIFY(socket.peerAddress() == QHostAddress());
+ QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
+ QCOMPARE(socket.errorString(), QString("Unknown error"));
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::bind_data()
+{
+ QTest::addColumn<QString>("stringAddr");
+ QTest::addColumn<bool>("successExpected");
+ QTest::addColumn<QString>("stringExpectedLocalAddress");
+
+ // iterate all interfaces, add all addresses on them as test data
+ QList<QNetworkInterface> interfaces = QNetworkInterface::allInterfaces();
+ for (const QNetworkInterface &interface : interfaces) {
+ if (!interface.isValid())
+ continue;
+
+ for (const QNetworkAddressEntry &entry : interface.addressEntries()) {
+ if (entry.ip().isInSubnet(QHostAddress::parseSubnet("fe80::/10"))
+ || entry.ip().isInSubnet(QHostAddress::parseSubnet("169.254/16")))
+ continue; // link-local bind will fail, at least on Linux, so skip it.
+
+ QString ip(entry.ip().toString());
+ QTest::newRow(ip.toLatin1().constData()) << ip << true << ip;
+ }
+ }
+
+ // additionally, try bind to known-bad addresses, and make sure this doesn't work
+ // these ranges are guaranteed to be reserved for 'documentation purposes',
+ // and thus, should be unused in the real world. Not that I'm assuming the
+ // world is full of competent administrators, or anything.
+ QStringList knownBad;
+ knownBad << "198.51.100.1";
+ knownBad << "2001:0DB8::1";
+ foreach (const QString &badAddress, knownBad) {
+ QTest::newRow(badAddress.toLatin1().constData()) << badAddress << false << QString();
+ }
+}
+
+// Testing bind function
+void tst_QSctpSocket::bind()
+{
+ QFETCH(QString, stringAddr);
+ QFETCH(bool, successExpected);
+ QFETCH(QString, stringExpectedLocalAddress);
+
+ QHostAddress addr(stringAddr);
+ QHostAddress expectedLocalAddress(stringExpectedLocalAddress);
+
+ QSctpSocket socket;
+ qDebug() << "Binding " << addr;
+
+ if (successExpected)
+ QVERIFY2(socket.bind(addr), qPrintable(socket.errorString()));
+ else
+ QVERIFY(!socket.bind(addr));
+
+ QCOMPARE(socket.localAddress(), expectedLocalAddress);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::setInvalidSocketDescriptor()
+{
+ QSctpSocket socket;
+ QCOMPARE(socket.socketDescriptor(), qintptr(INVALID_SOCKET));
+ QVERIFY(!socket.setSocketDescriptor(-5, QAbstractSocket::UnconnectedState));
+ QCOMPARE(socket.socketDescriptor(), qintptr(INVALID_SOCKET));
+
+ QCOMPARE(socket.error(), QAbstractSocket::UnsupportedSocketOperationError);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::setSocketDescriptor()
+{
+ QSctpServer server;
+
+ server.setMaxChannelCount(16);
+ QVERIFY(server.listen());
+
+ SOCKET sock = ::socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
+
+ QVERIFY(sock != INVALID_SOCKET);
+ QSctpSocket socket;
+ QVERIFY(socket.setSocketDescriptor(sock, QAbstractSocket::UnconnectedState));
+ QCOMPARE(socket.socketDescriptor(), qintptr(sock));
+ QCOMPARE(socket.readChannelCount(), 0);
+ QCOMPARE(socket.writeChannelCount(), 0);
+
+ socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(socket.waitForConnected(3000));
+ QVERIFY(server.waitForNewConnection(3000));
+
+ QCOMPARE(socket.readChannelCount(), server.maxChannelCount());
+ QVERIFY(socket.writeChannelCount() <= server.maxChannelCount());
+
+ QSctpSocket *acceptedSocket = server.nextPendingDatagramConnection();
+ QVERIFY(acceptedSocket);
+ QCOMPARE(acceptedSocket->readChannelCount(), socket.writeChannelCount());
+ QCOMPARE(acceptedSocket->writeChannelCount(), socket.readChannelCount());
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::socketDescriptor()
+{
+ QSctpSocket socket;
+
+ QSctpServer server;
+
+ QVERIFY(server.listen());
+
+ QCOMPARE(socket.socketDescriptor(), qintptr(INVALID_SOCKET));
+ socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(server.waitForNewConnection(3000));
+ if (socket.state() != QAbstractSocket::ConnectedState) {
+ QVERIFY((socket.state() == QAbstractSocket::HostLookupState
+ && socket.socketDescriptor() == INVALID_SOCKET)
+ || socket.state() == QAbstractSocket::ConnectingState);
+ QVERIFY(socket.waitForConnected(3000));
+ QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
+ }
+ QVERIFY(socket.socketDescriptor() != INVALID_SOCKET);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::hostNotFound()
+{
+ QSctpSocket socket;
+
+ socket.connectToHost("nosuchserver.qt-project.org", 80);
+ QVERIFY(!socket.waitForConnected(3000));
+ QCOMPARE(socket.state(), QTcpSocket::UnconnectedState);
+ QCOMPARE(socket.error(), QAbstractSocket::HostNotFoundError);
+}
+
+// Testing connect function
+void tst_QSctpSocket::connecting()
+{
+ QSctpServer server;
+
+ QVERIFY(server.listen());
+
+ QSctpSocket socket;
+ socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(socket.waitForConnected(3000));
+
+ QVERIFY(server.waitForNewConnection(3000));
+ QSctpSocket *acceptedSocket = server.nextPendingDatagramConnection();
+ QVERIFY(acceptedSocket);
+
+ QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(acceptedSocket->state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(socket.readChannelCount(), acceptedSocket->readChannelCount());
+ QCOMPARE(socket.writeChannelCount(),acceptedSocket->writeChannelCount());
+}
+
+// Testing read/write functions
+void tst_QSctpSocket::readAndWrite()
+{
+ QSctpServer server;
+
+ QVERIFY(server.listen());
+
+ QSctpSocket socket;
+ socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(socket.waitForConnected(3000));
+
+ QVERIFY(server.waitForNewConnection(3000));
+ QSctpSocket *acceptedSocket = server.nextPendingDatagramConnection();
+ QVERIFY(acceptedSocket);
+
+ QByteArray ba(1000, 1);
+ QVERIFY(acceptedSocket->writeDatagram(ba));
+ QVERIFY(acceptedSocket->waitForBytesWritten(3000));
+
+ QVERIFY(socket.waitForReadyRead(3000));
+ QNetworkDatagram datagram = socket.readDatagram();
+ QVERIFY(datagram.isValid());
+ QCOMPARE(datagram.data(), ba);
+
+ QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
+ QCOMPARE(socket.errorString(), QString("Unknown error"));
+ QCOMPARE(acceptedSocket->state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(acceptedSocket->error(), QAbstractSocket::UnknownSocketError);
+ QCOMPARE(acceptedSocket->errorString(), QString("Unknown error"));
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::loop_data()
+{
+ QTest::addColumn<QByteArray>("peterDatagram");
+ QTest::addColumn<QByteArray>("paulDatagram");
+ QTest::addColumn<int>("peterChannel");
+ QTest::addColumn<int>("paulChannel");
+
+ QTest::newRow("\"Almond!\" | \"Joy!\"") << QByteArray("Almond!") << QByteArray("Joy!") << 0 << 0;
+ QTest::newRow("\"A\" | \"B\"") << QByteArray("A") << QByteArray("B") << 1 << 1;
+ QTest::newRow("\"AB\" | \"B\"") << QByteArray("AB") << QByteArray("B") << 0 << 1;
+ QTest::newRow("\"AB\" | \"BB\"") << QByteArray("AB") << QByteArray("BB") << 1 << 0;
+ QTest::newRow("\"A\\0B\" | \"B\\0B\"") << QByteArray::fromRawData("A\0B", 3) << QByteArray::fromRawData("B\0B", 3) << 0 << 1;
+ QTest::newRow("BigDatagram") << QByteArray(600, '@') << QByteArray(600, '@') << 1 << 0;
+}
+
+void tst_QSctpSocket::loop()
+{
+ QFETCH(QByteArray, peterDatagram);
+ QFETCH(QByteArray, paulDatagram);
+ QFETCH(int, peterChannel);
+ QFETCH(int, paulChannel);
+
+ QSctpServer server;
+
+ server.setMaxChannelCount(10);
+ QVERIFY(server.listen());
+
+ QSctpSocket peter;
+ peter.setMaxChannelCount(10);
+ peter.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(peter.waitForConnected(3000));
+
+ QVERIFY(server.waitForNewConnection(3000));
+ QSctpSocket *paul = server.nextPendingDatagramConnection();
+ QVERIFY(paul);
+
+ peter.setCurrentWriteChannel(peterChannel);
+ QVERIFY(peter.writeDatagram(peterDatagram));
+ paul->setCurrentWriteChannel(paulChannel);
+ QVERIFY(paul->writeDatagram(paulDatagram));
+ QVERIFY(peter.flush());
+ QVERIFY(paul->flush());
+
+ peter.setCurrentReadChannel(paulChannel);
+ QVERIFY(peter.waitForReadyRead(3000));
+ QCOMPARE(peter.bytesAvailable(), paulDatagram.size());
+ QCOMPARE(peter.readDatagram().data(), paulDatagram);
+
+ paul->setCurrentReadChannel(peterChannel);
+ QVERIFY(paul->waitForReadyRead(3000));
+ QCOMPARE(paul->bytesAvailable(), peterDatagram.size());
+ QCOMPARE(paul->readDatagram().data(), peterDatagram);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::loopInTCPMode_data()
+{
+ QTest::addColumn<QByteArray>("peterDatagram");
+ QTest::addColumn<QByteArray>("paulDatagram");
+
+ QTest::newRow("\"Almond!\" | \"Joy!\"") << QByteArray("Almond!") << QByteArray("Joy!");
+ QTest::newRow("\"A\" | \"B\"") << QByteArray("A") << QByteArray("B");
+ QTest::newRow("\"AB\" | \"B\"") << QByteArray("AB") << QByteArray("B");
+ QTest::newRow("\"AB\" | \"BB\"") << QByteArray("AB") << QByteArray("BB");
+ QTest::newRow("\"A\\0B\" | \"B\\0B\"") << QByteArray::fromRawData("A\0B", 3) << QByteArray::fromRawData("B\0B", 3);
+ QTest::newRow("BigDatagram") << QByteArray(600, '@') << QByteArray(600, '@');
+}
+
+void tst_QSctpSocket::loopInTCPMode()
+{
+ QFETCH(QByteArray, peterDatagram);
+ QFETCH(QByteArray, paulDatagram);
+
+ QSctpServer server;
+
+ server.setMaxChannelCount(-1);
+ QVERIFY(server.listen());
+
+ QSctpSocket peter;
+ peter.setMaxChannelCount(-1);
+ peter.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(peter.waitForConnected(3000));
+ QVERIFY(server.waitForNewConnection(3000));
+
+ QTcpSocket *paul = server.nextPendingConnection();
+ QVERIFY(paul);
+
+ QCOMPARE(peter.write(peterDatagram), qint64(peterDatagram.size()));
+ QCOMPARE(paul->write(paulDatagram), qint64(paulDatagram.size()));
+ QVERIFY(peter.flush());
+ QVERIFY(paul->flush());
+
+ QVERIFY(peter.waitForReadyRead(3000));
+ QVERIFY(paul->waitForReadyRead(3000));
+
+ QCOMPARE(peter.bytesAvailable(), paulDatagram.size());
+ QByteArray peterBuffer = peter.readAll();
+
+ QCOMPARE(paul->bytesAvailable(), peterDatagram.size());
+ QByteArray paulBuffer = paul->readAll();
+
+ QCOMPARE(peterBuffer, paulDatagram);
+ QCOMPARE(paulBuffer, peterDatagram);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::exitLoopSlot()
+{
+ exitLoop();
+}
+
+//----------------------------------------------------------------------------------
+void tst_QSctpSocket::readDatagramAfterClose()
+{
+ QSctpServer server;
+
+ QVERIFY(server.listen());
+
+ QSctpSocket socket;
+ socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(socket.waitForConnected(3000));
+ QVERIFY(server.waitForNewConnection(3000));
+
+ QSctpSocket *acceptedSocket = server.nextPendingDatagramConnection();
+ QVERIFY(acceptedSocket);
+
+ connect(&socket, &QIODevice::readyRead, this, &tst_QSctpSocket::exitLoopSlot);
+
+ QByteArray ba(1000, 1);
+ QVERIFY(acceptedSocket->writeDatagram(ba));
+
+ enterLoop(10);
+ if (timeout())
+ QFAIL("Network operation timed out");
+
+ QCOMPARE(socket.bytesAvailable(), ba.size());
+ socket.close();
+ QVERIFY(!socket.readDatagram().isValid());
+}
+
+// Test buffered socket properly send data on delayed disconnect
+void tst_QSctpSocket::clientSendDataOnDelayedDisconnect()
+{
+ QSctpServer server;
+
+ QVERIFY(server.listen());
+
+ // Connect to server, write data and close socket
+ QSctpSocket socket;
+ socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(socket.waitForConnected(3000));
+
+ QByteArray sendData("GET /\r\n");
+ sendData = sendData.repeated(1000);
+ QVERIFY(socket.writeDatagram(sendData));
+ socket.close();
+ QCOMPARE(socket.state(), QAbstractSocket::ClosingState);
+ QVERIFY(socket.waitForDisconnected(3000));
+
+ QVERIFY(server.waitForNewConnection(3000));
+ QSctpSocket *acceptedSocket = server.nextPendingDatagramConnection();
+ QVERIFY(acceptedSocket);
+
+ QVERIFY(acceptedSocket->waitForReadyRead(3000));
+ QNetworkDatagram datagram = acceptedSocket->readDatagram();
+ QVERIFY(datagram.isValid());
+ QCOMPARE(datagram.data(), sendData);
+}
+
+QTEST_MAIN(tst_QSctpSocket)
+
+#include "tst_qsctpsocket.moc"
diff --git a/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro
index f3c24e19fd..71ceafa133 100644
--- a/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro
+++ b/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro
@@ -10,4 +10,4 @@ MOC_DIR=tmp
QT = core-private network-private testlib
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
index b4955df107..c945d77cda 100644
--- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -785,11 +785,7 @@ void tst_QSocks5SocketEngine::downloadBigFile()
QTime stopWatch;
stopWatch.start();
-#if !defined(Q_OS_WINCE)
QTestEventLoop::instance().enterLoop(60);
-#else
- QTestEventLoop::instance().enterLoop(180);
-#endif
if (QTestEventLoop::instance().timeout())
QFAIL("Network operation timed out");
diff --git a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
index fdf1c48adf..1a8e7920d3 100644
--- a/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
+++ b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
@@ -47,16 +47,8 @@ int main(int argc, char *argv[])
return 1;
}
-#if defined(Q_OS_WINCE)
- QFile file(QLatin1String("/test_signal.txt"));
- file.open(QIODevice::WriteOnly);
- file.write("Listening\n");
- file.flush();
- file.close();
-#else
printf("Listening\n");
fflush(stdout);
-#endif
server.waitForNewConnection(5000);
qFatal("Crash");
diff --git a/tests/auto/network/socket/qtcpserver/test/test.pro b/tests/auto/network/socket/qtcpserver/test/test.pro
index f0abfbc085..4491523383 100644
--- a/tests/auto/network/socket/qtcpserver/test/test.pro
+++ b/tests/auto/network/socket/qtcpserver/test/test.pro
@@ -1,16 +1,7 @@
CONFIG += testcase
SOURCES += ../tst_qtcpserver.cpp
-win32: {
-wince {
- LIBS += -lws2
- crashApp.files = ../crashingServer/crashingServer.exe
- crashApp.path = crashingServer
- DEPLOYMENT += crashApp
-} else {
- LIBS += -lws2_32
-}
-}
+win32:LIBS += -lws2_32
TARGET = ../tst_qtcpserver
diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
index 30aab3bf34..5a0baf73b5 100644
--- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
@@ -106,6 +106,8 @@ private slots:
void eagainBlockingAccept();
+ void canAccessPendingConnectionsWhileNotListening();
+
private:
#ifndef QT_NO_BEARERMANAGEMENT
QNetworkSession *networkSession;
@@ -467,11 +469,7 @@ void tst_QTcpServer::waitForConnectionTest()
ThreadConnector connector(findLocalIpSocket.localAddress(), server.serverPort());
connector.start();
-#if defined(Q_OS_WINCE)
- QVERIFY(server.waitForNewConnection(9000, &timeout));
-#else
QVERIFY(server.waitForNewConnection(3000, &timeout));
-#endif
QVERIFY(!timeout);
}
@@ -562,21 +560,6 @@ void tst_QTcpServer::addressReusable()
QSKIP("No proxy support");
#endif // QT_NO_NETWORKPROXY
}
-#if defined(Q_OS_WINCE)
- QString signalName = QString::fromLatin1("/test_signal.txt");
- QFile::remove(signalName);
- // The crashingServer process will crash once it gets a connection.
- QProcess process;
- QString processExe = crashingServerDir + "/crashingServer";
- process.start(processExe);
- QVERIFY2(process.waitForStarted(), qPrintable(
- QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString())));
- int waitCount = 5;
- while (waitCount-- && !QFile::exists(signalName))
- QTest::qWait(1000);
- QVERIFY(QFile::exists(signalName));
- QFile::remove(signalName);
-#else
// The crashingServer process will crash once it gets a connection.
QProcess process;
QString processExe = crashingServerDir + "/crashingServer";
@@ -584,7 +567,6 @@ void tst_QTcpServer::addressReusable()
QVERIFY2(process.waitForStarted(), qPrintable(
QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString())));
QVERIFY(process.waitForReadyRead(5000));
-#endif
QTcpSocket socket;
socket.connectToHost(QHostAddress::LocalHost, 49199);
@@ -990,5 +972,22 @@ void tst_QTcpServer::eagainBlockingAccept()
server.close();
}
+class NonListeningTcpServer : public QTcpServer
+{
+public:
+ void addSocketFromOutside(QTcpSocket* s)
+ {
+ addPendingConnection(s);
+ }
+};
+
+void tst_QTcpServer::canAccessPendingConnectionsWhileNotListening()
+{
+ NonListeningTcpServer server;
+ QTcpSocket socket;
+ server.addSocketFromOutside(&socket);
+ QCOMPARE(&socket, server.nextPendingConnection());
+}
+
QTEST_MAIN(tst_QTcpServer)
#include "tst_qtcpserver.moc"
diff --git a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro
index fe6042b8a7..1183b23556 100644
--- a/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro
+++ b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
SUBDIRS = test
-!wince:!vxworks: SUBDIRS += stressTest
+!vxworks: SUBDIRS += stressTest
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/network/socket/qtcpsocket/test/test.pro b/tests/auto/network/socket/qtcpsocket/test/test.pro
index 3e64b87b53..337e75b372 100644
--- a/tests/auto/network/socket/qtcpsocket/test/test.pro
+++ b/tests/auto/network/socket/qtcpsocket/test/test.pro
@@ -2,13 +2,7 @@ CONFIG += testcase
QT = core-private network-private testlib
SOURCES += ../tst_qtcpsocket.cpp
-win32: {
-wince {
- LIBS += -lws2
-} else {
- LIBS += -lws2_32
-}
-}
+win32:LIBS += -lws2_32
TARGET = tst_qtcpsocket
diff --git a/tests/auto/network/socket/qudpsocket/test/test.pro b/tests/auto/network/socket/qudpsocket/test/test.pro
index e4812416dc..73486a2bc3 100644
--- a/tests/auto/network/socket/qudpsocket/test/test.pro
+++ b/tests/auto/network/socket/qudpsocket/test/test.pro
@@ -15,10 +15,4 @@ win32 {
DESTDIR = ../
}
-wince* {
- addApp.files = ../clientserver/clientserver.exe
- addApp.path = clientserver
- DEPLOYMENT += addApp
-}
-
TARGET = tst_qudpsocket
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index ba49e8b041..aa01384350 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -39,6 +39,7 @@
#include <qhostinfo.h>
#include <qtcpsocket.h>
#include <qmap.h>
+#include <qnetworkdatagram.h>
#include <QNetworkProxy>
#include <QNetworkInterface>
@@ -114,6 +115,7 @@ protected slots:
void async_readDatagramSlot();
private:
+ QList<QHostAddress> allAddresses;
#ifndef QT_NO_BEARERMANAGEMENT
QNetworkConfigurationManager *netConfMan;
QNetworkConfiguration networkConfiguration;
@@ -173,6 +175,7 @@ void tst_QUdpSocket::initTestCase()
{
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
+ allAddresses = QNetworkInterface::allAddresses();
}
void tst_QUdpSocket::init()
@@ -252,6 +255,11 @@ void tst_QUdpSocket::unconnectedServerAndClientTest()
int(strlen(message[i])));
buf[strlen(message[i])] = '\0';
QCOMPARE(QByteArray(buf), QByteArray(message[i]));
+ QCOMPARE(port, clientSocket.localPort());
+ if (host.toIPv4Address()) // in case the sender is IPv4 mapped in IPv6
+ QCOMPARE(host.toIPv4Address(), makeNonAny(clientSocket.localAddress()).toIPv4Address());
+ else
+ QCOMPARE(host, makeNonAny(clientSocket.localAddress()));
}
}
@@ -325,14 +333,32 @@ void tst_QUdpSocket::broadcasting()
QVERIFY(serverSocket.hasPendingDatagrams());
do {
- QByteArray arr; arr.resize(serverSocket.pendingDatagramSize() + 1);
- QHostAddress host;
- quint16 port;
const int messageLength = int(strlen(message[i]));
- QCOMPARE((int) serverSocket.readDatagram(arr.data(), arr.size() - 1, &host, &port),
- messageLength);
+ QNetworkDatagram dgram = serverSocket.receiveDatagram();
+ QVERIFY(dgram.isValid());
+ QByteArray arr = dgram.data();
+
+ QCOMPARE(arr.length(), messageLength);
arr.resize(messageLength);
QCOMPARE(arr, QByteArray(message[i]));
+
+ if (dgram.senderAddress().toIPv4Address()) // in case it's a v6-mapped address
+ QVERIFY2(allAddresses.contains(QHostAddress(dgram.senderAddress().toIPv4Address())),
+ dgram.senderAddress().toString().toLatin1());
+ else if (!dgram.senderAddress().isNull())
+ QVERIFY2(allAddresses.contains(dgram.senderAddress()),
+ dgram.senderAddress().toString().toLatin1());
+ QCOMPARE(dgram.senderPort(), int(broadcastSocket.localPort()));
+ if (!dgram.destinationAddress().isNull()) {
+ QVERIFY2(dgram.destinationAddress() == QHostAddress::Broadcast
+ || broadcastAddresses.contains(dgram.destinationAddress()),
+ dgram.destinationAddress().toString().toLatin1());
+ QCOMPARE(dgram.destinationPort(), int(serverSocket.localPort()));
+ }
+
+ int ttl = dgram.hopLimit();
+ if (ttl != -1)
+ QVERIFY(ttl != 0);
} while (serverSocket.hasPendingDatagrams());
}
}
@@ -435,13 +461,8 @@ void tst_QUdpSocket::ipv6Loop()
char peterBuffer[16*1024];
char paulBuffer[16*1024];
-#if !defined(Q_OS_WINCE)
- QVERIFY2(peter.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(peter).constData());
- QVERIFY2(paul.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(paul).constData());
-#else
- QVERIFY(peter.waitForReadyRead(15000));
- QVERIFY(paul.waitForReadyRead(15000));
-#endif
+ QVERIFY(peter.waitForReadyRead(5000));
+ QVERIFY(paul.waitForReadyRead(5000));
if (success) {
QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length()));
QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length()));
@@ -938,9 +959,6 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
#ifdef QT_NO_PROCESS
QSKIP("No qprocess support", SkipAll);
#else
-#if defined(Q_OS_WINCE)
- QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE).");
-#endif
QProcess serverProcess;
serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
QIODevice::ReadWrite | QIODevice::Text);
@@ -1002,9 +1020,6 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
#ifdef QT_NO_PROCESS
QSKIP("No qprocess support", SkipAll);
#else
-#if defined(Q_OS_WINCE)
- QSKIP("This test depends on reading data from QProcess (not supported on Qt/WinCE).");
-#endif
QProcess serverProcess;
serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
QIODevice::ReadWrite | QIODevice::Text);
@@ -1081,7 +1096,7 @@ void tst_QUdpSocket::zeroLengthDatagram()
#ifdef FORCE_SESSION
sender.setProperty("_q_networksession", QVariant::fromValue(networkSession));
#endif
- QCOMPARE(sender.writeDatagram(QByteArray(), QHostAddress::LocalHost, receiver.localPort()), qint64(0));
+ QCOMPARE(sender.writeDatagram(QNetworkDatagram(QByteArray(), QHostAddress::LocalHost, receiver.localPort())), qint64(0));
QVERIFY2(receiver.waitForReadyRead(1000), QtNetworkSettings::msgSocketError(receiver).constData());
QVERIFY(receiver.hasPendingDatagrams());
@@ -1366,10 +1381,20 @@ void tst_QUdpSocket::multicast()
QVERIFY(receiver.hasPendingDatagrams());
QList<QByteArray> receivedDatagrams;
while (receiver.hasPendingDatagrams()) {
- QByteArray datagram;
- datagram.resize(receiver.pendingDatagramSize());
- receiver.readDatagram(datagram.data(), datagram.size(), 0, 0);
- receivedDatagrams << datagram;
+ QNetworkDatagram dgram = receiver.receiveDatagram();
+ receivedDatagrams << dgram.data();
+
+ QVERIFY2(allAddresses.contains(dgram.senderAddress()),
+ dgram.senderAddress().toString().toLatin1());
+ QCOMPARE(dgram.senderPort(), int(sender.localPort()));
+ if (!dgram.destinationAddress().isNull()) {
+ QCOMPARE(dgram.destinationAddress(), groupAddress);
+ QCOMPARE(dgram.destinationPort(), int(receiver.localPort()));
+ }
+
+ int ttl = dgram.hopLimit();
+ if (ttl != -1)
+ QVERIFY(ttl != 0);
}
QCOMPARE(receivedDatagrams, datagrams);
@@ -1464,7 +1489,8 @@ void tst_QUdpSocket::linkLocalIPv6()
quint16 port = 0;
foreach (const QHostAddress& addr, addresses) {
QUdpSocket *s = new QUdpSocket;
- QVERIFY2(s->bind(addr, port), qPrintable(s->errorString()));
+ QVERIFY2(s->bind(addr, port), addr.toString().toLatin1()
+ + '/' + QByteArray::number(port) + ": " + qPrintable(s->errorString()));
port = s->localPort(); //bind same port, different networks
sockets << s;
}
@@ -1474,24 +1500,25 @@ void tst_QUdpSocket::linkLocalIPv6()
QSignalSpy neutralReadSpy(&neutral, SIGNAL(readyRead()));
QByteArray testData("hello");
- QByteArray receiveBuffer("xxxxx");
foreach (QUdpSocket *s, sockets) {
QSignalSpy spy(s, SIGNAL(readyRead()));
neutralReadSpy.clear();
QVERIFY(s->writeDatagram(testData, s->localAddress(), neutral.localPort()));
QTRY_VERIFY(neutralReadSpy.count() > 0); //note may need to accept a firewall prompt
- QHostAddress from;
- quint16 fromPort;
- QCOMPARE((int)neutral.readDatagram(receiveBuffer.data(), receiveBuffer.length(), &from, &fromPort), testData.length());
- QCOMPARE(from, s->localAddress());
- QCOMPARE(fromPort, s->localPort());
- QCOMPARE(receiveBuffer, testData);
-
- QVERIFY(neutral.writeDatagram(testData, s->localAddress(), s->localPort()));
+
+ QNetworkDatagram dgram = neutral.receiveDatagram(testData.length() * 2);
+ QVERIFY(dgram.isValid());
+ QCOMPARE(dgram.senderAddress(), s->localAddress());
+ QCOMPARE(dgram.senderPort(), int(s->localPort()));
+ QCOMPARE(dgram.data().length(), testData.length());
+ QCOMPARE(dgram.data(), testData);
+
+ QVERIFY(neutral.writeDatagram(dgram.makeReply(testData)));
QTRY_VERIFY(spy.count() > 0); //note may need to accept a firewall prompt
- QCOMPARE((int)s->readDatagram(receiveBuffer.data(), receiveBuffer.length(), &from, &fromPort), testData.length());
- QCOMPARE(receiveBuffer, testData);
+
+ dgram = s->receiveDatagram(testData.length() * 2);
+ QCOMPARE(dgram.data(), testData);
//sockets bound to other interfaces shouldn't have received anything
foreach (QUdpSocket *s2, sockets) {
@@ -1546,21 +1573,23 @@ void tst_QUdpSocket::linkLocalIPv4()
QVERIFY(neutral.bind(QHostAddress(QHostAddress::AnyIPv4)));
QByteArray testData("hello");
- QByteArray receiveBuffer("xxxxx");
foreach (QUdpSocket *s, sockets) {
QVERIFY(s->writeDatagram(testData, s->localAddress(), neutral.localPort()));
QVERIFY2(neutral.waitForReadyRead(10000), QtNetworkSettings::msgSocketError(neutral).constData());
- QHostAddress from;
- quint16 fromPort;
- QCOMPARE((int)neutral.readDatagram(receiveBuffer.data(), receiveBuffer.length(), &from, &fromPort), testData.length());
- QCOMPARE(from, s->localAddress());
- QCOMPARE(fromPort, s->localPort());
- QCOMPARE(receiveBuffer, testData);
-
- QVERIFY(neutral.writeDatagram(testData, s->localAddress(), s->localPort()));
+
QVERIFY2(s->waitForReadyRead(10000), QtNetworkSettings::msgSocketError(*s).constData());
- QCOMPARE((int)s->readDatagram(receiveBuffer.data(), receiveBuffer.length(), &from, &fromPort), testData.length());
- QCOMPARE(receiveBuffer, testData);
+ QNetworkDatagram dgram = neutral.receiveDatagram(testData.length() * 2);
+ QVERIFY(dgram.isValid());
+ QCOMPARE(dgram.senderAddress(), s->localAddress());
+ QCOMPARE(dgram.senderPort(), int(s->localPort()));
+ QCOMPARE(dgram.data().length(), testData.length());
+ QCOMPARE(dgram.data(), testData);
+
+ QVERIFY(neutral.writeDatagram(dgram.makeReply(testData)));
+
+ dgram = s->receiveDatagram(testData.length() * 2);
+ QVERIFY(dgram.isValid());
+ QCOMPARE(dgram.data(), testData);
//sockets bound to other interfaces shouldn't have received anything
foreach (QUdpSocket *s2, sockets) {
diff --git a/tests/auto/network/socket/socket.pro b/tests/auto/network/socket/socket.pro
index 436ebe5c7f..06fe356a5a 100644
--- a/tests/auto/network/socket/socket.pro
+++ b/tests/auto/network/socket/socket.pro
@@ -1,4 +1,6 @@
TEMPLATE=subdirs
+QT_FOR_CONFIG += network
+
SUBDIRS=\
qhttpsocketengine \
qudpsocket \
@@ -8,13 +10,17 @@ SUBDIRS=\
qsocks5socketengine \
qabstractsocket \
platformsocketengine \
+ qsctpsocket \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
platformsocketengine \
qtcpsocket \
qhttpsocketengine \
qsocks5socketengine \
+!qtConfig(sctp): SUBDIRS -= \
+ qsctpsocket \
+
winrt: SUBDIRS -= \
qhttpsocketengine \
qsocks5socketengine \
diff --git a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
index 87a210c051..7c1cd5b66b 100644
--- a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
+++ b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
SOURCES += tst_qsslcertificate.cpp
-!wince:win32:LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core network testlib
TARGET = tst_qsslcertificate
diff --git a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro
index 4cb2dfebab..81ef2d8d9a 100644
--- a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro
+++ b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
SOURCES += tst_qsslcipher.cpp
-win32:!wince: LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core network testlib
TARGET = tst_qsslcipher
diff --git a/tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro b/tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro
new file mode 100644
index 0000000000..b8053f9eb3
--- /dev/null
+++ b/tests/auto/network/ssl/qssldiffiehellmanparameters/qssldiffiehellmanparameters.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+CONFIG += parallel_test
+
+SOURCES += tst_qssldiffiehellmanparameters.cpp
+!wince*:win32:LIBS += -lws2_32
+QT = core network testlib
+
+TARGET = tst_qssldiffiehellmanparameters
diff --git a/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
new file mode 100644
index 0000000000..f3b9003fbb
--- /dev/null
+++ b/tests/auto/network/ssl/qssldiffiehellmanparameters/tst_qssldiffiehellmanparameters.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** 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 <QtTest/QtTest>
+#include <QSslDiffieHellmanParameters>
+#include <QSslSocket>
+#include <QByteArray>
+
+class tst_QSslDiffieHellmanParameters : public QObject
+{
+ Q_OBJECT
+
+#ifndef QT_NO_SSL
+private Q_SLOTS:
+ void constructionEmpty();
+ void constructionDefault();
+ void constructionDER();
+ void constructionPEM();
+ void unsafe512Bits();
+ void unsafeNonPrime();
+#endif
+};
+
+#ifndef QT_NO_SSL
+
+void tst_QSslDiffieHellmanParameters::constructionEmpty()
+{
+ QSslDiffieHellmanParameters dh;
+
+ QCOMPARE(dh.isEmpty(), true);
+ QCOMPARE(dh.isValid(), true);
+ QCOMPARE(dh.error(), QSslDiffieHellmanParameters::NoError);
+}
+
+void tst_QSslDiffieHellmanParameters::constructionDefault()
+{
+ QSslDiffieHellmanParameters dh = QSslDiffieHellmanParameters::defaultParameters();
+
+#ifndef QT_NO_OPENSSL
+ QCOMPARE(dh.isValid(), true);
+ QCOMPARE(dh.error(), QSslDiffieHellmanParameters::NoError);
+#endif
+}
+
+void tst_QSslDiffieHellmanParameters::constructionDER()
+{
+ // Uniquely generated with 'openssl dhparam -outform DER -out out.der -check -2 4096'
+ const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArray::fromBase64(QByteArrayLiteral(
+ "MIICCAKCAgEAsbQYx57ZlyEyWF8jD5WYEswGR2aTVFsHqP3026SdyTwcjY+YlMOae0EagK"
+ "jDA0UlPcih1kguQOvOVgyc5gI3YbBb4pCNEdy048xITlsdqG7qC3+2VvFR3vfixEbQQll9"
+ "2cGIIneD/36p7KJcDnBNUwwWj/VJKhTwelTfKTj2T39si9xGMkqZiQuCaXRk6vSKZ4ZDPk"
+ "jiq5Ti1kHVFbL9SMWRa8zplPtDMrVfhSyw10njgD4qKd1UoUPdmhEPhRZlHaZ/cAHNSHMj"
+ "uhDakeMpN+XP2/sl5IpPZ3/vVOk9PhBDFO1NYzKx/b7RQgZCUmXoglKYpfBiz8OheoI0hK"
+ "V0fU/OCtHjRrP4hE9vIHA2aE+gaQZiYCciGcR9BjHQ7Y8K9qHyTX8UIz2G4ZKzQZK9G+pA"
+ "K0xD+1H3qZ/MaUhzNDQOwwihnTjjXzTjfIGqYDdbouAhw+tX51CsGonI0cL3s3QMa3CwGH"
+ "mw+AH2b/Z68dTSy0sC3CYn9cNbrctqyeHwQrsx9FfpOz+Z6sk2WsPgqgSp/pDVVgm5oSfO"
+ "2mN7WAWgUlf9TQuj1HIRCTI+PbBq2vYvn+YResMRo+8ng1QptKAAgQoVVGNRYxZ9iAZlvO"
+ "52DcHKlsqDuafQ1XVGmzVIrKtBi2gfLtPqY4v6g6v26l8gbzK67PpWstllHiPb4VMCAQI="
+ )), QSsl::Der);
+
+#ifndef QT_NO_OPENSSL
+ QCOMPARE(dh.isValid(), true);
+ QCOMPARE(dh.error(), QSslDiffieHellmanParameters::NoError);
+#endif
+}
+
+void tst_QSslDiffieHellmanParameters::constructionPEM()
+{
+ // Uniquely generated with 'openssl dhparam -outform PEM -out out.pem -check -2 4096'
+ const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArrayLiteral(
+ "-----BEGIN DH PARAMETERS-----\n"
+ "MIICCAKCAgEA9QTdqhQkbGuhWzBsW5X475AjjrITpg1BHX5+mp1sstUd84Lshq1T\n"
+ "+S2QQQtdl25EPoUblpyyLAf8krFSH4YwR7jjLWklA8paDOwRYod0zLmVZ1Wx6og3\n"
+ "PRc8P+SCs+6gKTXfv//bJJhiJXnM73lDFsGHbSqN+msf20ei/zy5Rwey2t8dPjLC\n"
+ "Q+qkb/avlovi2t2rsUWcxMT1875TQ4HuApayqw3R3lTQe9u05b9rTrinmT7AE4mm\n"
+ "xGqO9FZJdXYE2sOKwwJkpM48KFyV90uJANmqJnQrkgdukaGTHwxZxgAyO6ur/RWC\n"
+ "kzf9STFT6IY4Qy05q+oZVJfh8xPHszKmmC8nWaLfiHMYBnL5fv+1kh/aU11Kz9TG\n"
+ "iDXwQ+tzhKAutQPUwe3IGQUYQMZPwZI4vegdU88/7YPXuWt7b/0Il5+2ma5FbtG2\n"
+ "u02PMi+J3JZsYi/tEUv1tJBVHGH0kDpgcyOm8rvkCtNbNkETzfwUPoEgA0oPMhVt\n"
+ "sFGub1av+jLRyFNGNBJcqXAO+Tq2zXG00DxbGY+aooJ50qU/Lh5gfnCEMDXlMM9P\n"
+ "T8JVpWaaNLCC+0Z5txsfYp+FO8mOttIPIF6F8FtmTnm/jhNntvqKvsU+NHylIYzr\n"
+ "o42EpiWwS7ktPPUS2GtG+IUdy8rvdO1xJ5kNxs7ZlygY4W1htOhbUusCAQI=\n"
+ "-----END DH PARAMETERS-----\n"
+ ), QSsl::Pem);
+
+#ifndef QT_NO_OPENSSL
+ QCOMPARE(dh.isValid(), true);
+ QCOMPARE(dh.error(), QSslDiffieHellmanParameters::NoError);
+#endif
+}
+
+void tst_QSslDiffieHellmanParameters::unsafe512Bits()
+{
+ // Uniquely generated with 'openssl dhparam -outform PEM -out out.pem -check -2 512'
+ const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArrayLiteral(
+ "-----BEGIN DH PARAMETERS-----\n"
+ "MEYCQQCf8goDn56akiliAtEL1ZG7VH+9wfLxsv8/B1emTUG+rMKB1yaVAU7HaAiM\n"
+ "Gtmo2bAWUqBczUTOTzqmWTm28P6bAgEC\n"
+ "-----END DH PARAMETERS-----\n"
+ ), QSsl::Pem);
+
+#ifndef QT_NO_OPENSSL
+ QCOMPARE(dh.isValid(), false);
+ QCOMPARE(dh.error(), QSslDiffieHellmanParameters::UnsafeParametersError);
+#endif
+}
+
+void tst_QSslDiffieHellmanParameters::unsafeNonPrime()
+{
+ // Uniquely generated with 'openssl dhparam -outform DER -out out.der -check -2 1024'
+ // and then modified by hand to make P not be a prime number.
+ const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArray::fromBase64(QByteArrayLiteral(
+ "MIGHAoGBALLcOLg+ow8TMnbCUeNjwys6wUTIH9mn4ZSeIbD6qvCsJgg4cUxXwJQmPY"
+ "Xl15AsKXgkXWh0n+/N6tjH0sSRJnzDvN2H3KxFLKkvxmBYrDOJMdCuMgZD50aOsVyd"
+ "vholAW9zilkoYkB6sqwxY1Z2dbpTWajCsUAWZQ0AIP4Y5nesAgEC"
+ )), QSsl::Der);
+
+#ifndef QT_NO_OPENSSL
+ QCOMPARE(dh.isValid(), false);
+ QCOMPARE(dh.error(), QSslDiffieHellmanParameters::UnsafeParametersError);
+#endif
+}
+
+#endif // QT_NO_SSL
+
+QTEST_MAIN(tst_QSslDiffieHellmanParameters)
+#include "tst_qssldiffiehellmanparameters.moc"
diff --git a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro
index e67b64b2b7..a180086c5e 100644
--- a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro
+++ b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
SOURCES += tst_qsslellipticcurve.cpp
-win32:!wince: LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core network testlib
TARGET = tst_qsslellipticcurve
diff --git a/tests/auto/network/ssl/qsslerror/qsslerror.pro b/tests/auto/network/ssl/qsslerror/qsslerror.pro
index 7737aae3f1..117fd4ac27 100644
--- a/tests/auto/network/ssl/qsslerror/qsslerror.pro
+++ b/tests/auto/network/ssl/qsslerror/qsslerror.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
SOURCES += tst_qsslerror.cpp
-win32:!wince: LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core network testlib
TARGET = tst_qsslerror
diff --git a/tests/auto/network/ssl/qsslkey/qsslkey.pro b/tests/auto/network/ssl/qsslkey/qsslkey.pro
index 7eb04793f3..8c3877631a 100644
--- a/tests/auto/network/ssl/qsslkey/qsslkey.pro
+++ b/tests/auto/network/ssl/qsslkey/qsslkey.pro
@@ -1,9 +1,9 @@
CONFIG += testcase
SOURCES += tst_qsslkey.cpp
-win32:!wince: LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core network testlib
-contains(QT_CONFIG, private_tests) {
+qtConfig(private_tests) {
QT += core-private network-private
}
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
index 8afc71a216..0112af4ed7 100644
--- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
+++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
@@ -34,9 +34,14 @@
#include <QtNetwork/qhostaddress.h>
#include <QtNetwork/qnetworkproxy.h>
-#if !defined(QT_NO_SSL) && defined(QT_BUILD_INTERNAL)
-#include "private/qsslkey_p.h"
-#define TEST_CRYPTO
+#ifdef QT_BUILD_INTERNAL
+ #ifndef QT_NO_SSL
+ #include "private/qsslkey_p.h"
+ #define TEST_CRYPTO
+ #endif
+ #ifndef QT_NO_OPENSSL
+ #include "private/qsslsocket_openssl_symbols_p.h"
+ #endif
#endif
class tst_QSslKey : public QObject
@@ -58,7 +63,7 @@ class tst_QSslKey : public QObject
QList<KeyInfo> keyInfoList;
- void createPlainTestRows();
+ void createPlainTestRows(bool filter = false, QSsl::EncodingFormat format = QSsl::EncodingFormat::Pem);
public slots:
void initTestCase();
@@ -69,6 +74,10 @@ private slots:
void emptyConstructor();
void constructor_data();
void constructor();
+#ifndef QT_NO_OPENSSL
+ void constructorHandle_data();
+ void constructorHandle();
+#endif
void copyAndAssign_data();
void copyAndAssign();
void equalsOperator();
@@ -142,7 +151,7 @@ Q_DECLARE_METATYPE(QSsl::KeyAlgorithm)
Q_DECLARE_METATYPE(QSsl::KeyType)
Q_DECLARE_METATYPE(QSsl::EncodingFormat)
-void tst_QSslKey::createPlainTestRows()
+void tst_QSslKey::createPlainTestRows(bool filter, QSsl::EncodingFormat format)
{
QTest::addColumn<QString>("absFilePath");
QTest::addColumn<QSsl::KeyAlgorithm>("algorithm");
@@ -150,6 +159,9 @@ void tst_QSslKey::createPlainTestRows()
QTest::addColumn<int>("length");
QTest::addColumn<QSsl::EncodingFormat>("format");
foreach (KeyInfo keyInfo, keyInfoList) {
+ if (filter && keyInfo.format != format)
+ continue;
+
QTest::newRow(keyInfo.fileInfo.fileName().toLatin1())
<< keyInfo.fileInfo.absoluteFilePath() << keyInfo.algorithm << keyInfo.type
<< keyInfo.length << keyInfo.format;
@@ -176,6 +188,45 @@ void tst_QSslKey::constructor()
QVERIFY(!key.isNull());
}
+#ifndef QT_NO_OPENSSL
+
+void tst_QSslKey::constructorHandle_data()
+{
+ createPlainTestRows(true);
+}
+
+void tst_QSslKey::constructorHandle()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("This test requires -developer-build.");
+#else
+ if (!QSslSocket::supportsSsl())
+ return;
+
+ QFETCH(QString, absFilePath);
+ QFETCH(QSsl::KeyAlgorithm, algorithm);
+ QFETCH(QSsl::KeyType, type);
+ QFETCH(int, length);
+
+ QByteArray pem = readFile(absFilePath);
+ auto func = (type == QSsl::KeyType::PublicKey
+ ? q_PEM_read_bio_PUBKEY
+ : q_PEM_read_bio_PrivateKey);
+
+ BIO* bio = q_BIO_new(q_BIO_s_mem());
+ q_BIO_write(bio, pem.constData(), pem.length());
+ QSslKey key(func(bio, nullptr, nullptr, nullptr), type);
+ q_BIO_free(bio);
+
+ QVERIFY(!key.isNull());
+ QCOMPARE(key.algorithm(), algorithm);
+ QCOMPARE(key.type(), type);
+ QCOMPARE(key.length(), length);
+#endif
+}
+
+#endif
+
void tst_QSslKey::copyAndAssign_data()
{
createPlainTestRows();
diff --git a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro
index de2be8e126..5c92ca833a 100644
--- a/tests/auto/network/ssl/qsslsocket/qsslsocket.pro
+++ b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
SOURCES += tst_qsslsocket.cpp
-win32:!wince: LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core core-private network-private testlib
TARGET = tst_qsslsocket
@@ -15,19 +15,11 @@ win32 {
}
# OpenSSL support
-contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
+qtConfig(openssl)|qtConfig(openssl-linked) {
# Add optional SSL libs
LIBS += $$OPENSSL_LIBS
}
-wince* {
- DEFINES += SRCDIR=\\\"./\\\"
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
- certFiles.files = certs ssl.tar.gz
- certFiles.path = .
- DEPLOYMENT += certFiles
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
-
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 00c3a41d88..4eb26d17fe 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -57,7 +57,7 @@
#include "private/qsslconfiguration_p.h"
Q_DECLARE_METATYPE(QSslSocket::SslMode)
-typedef QList<QSslError::SslError> SslErrorList;
+typedef QVector<QSslError::SslError> SslErrorList;
Q_DECLARE_METATYPE(SslErrorList)
Q_DECLARE_METATYPE(QSslError)
Q_DECLARE_METATYPE(QSslKey)
@@ -220,6 +220,10 @@ private slots:
void qtbug18498_peek();
void qtbug18498_peek2();
void dhServer();
+#ifndef QT_NO_OPENSSL
+ void dhServerCustomParamsNull();
+ void dhServerCustomParams();
+#endif
void ecdhServer();
void verifyClientCertificate_data();
void verifyClientCertificate();
@@ -230,6 +234,8 @@ private slots:
void simplePskConnect();
void ephemeralServerKey_data();
void ephemeralServerKey();
+ void allowedProtocolNegotiation();
+ void pskServer();
#endif
void setEmptyDefaultConfiguration(); // this test should be last
@@ -381,14 +387,14 @@ void tst_QSslSocket::cleanup()
#ifndef QT_NO_SSL
QSslSocketPtr tst_QSslSocket::newSocket()
{
- QSslSocket *socket = new QSslSocket;
+ const auto socket = QSslSocketPtr::create();
proxyAuthCalled = 0;
- connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+ connect(socket.data(), SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
Qt::DirectConnection);
- return QSslSocketPtr(socket);
+ return socket;
}
#endif
@@ -628,7 +634,8 @@ void tst_QSslSocket::sslErrors()
// check the SSL errors contain HostNameMismatch and an error due to
// the certificate being self-signed
SslErrorList sslErrors;
- foreach (const QSslError &err, socket->sslErrors())
+ const auto socketSslErrors = socket->sslErrors();
+ for (const QSslError &err : socketSslErrors)
sslErrors << err.error();
qSort(sslErrors);
QVERIFY(sslErrors.contains(QSslError::HostNameMismatch));
@@ -637,7 +644,8 @@ void tst_QSslSocket::sslErrors()
// check the same errors were emitted by sslErrors
QVERIFY(!sslErrorsSpy.isEmpty());
SslErrorList emittedErrors;
- foreach (const QSslError &err, qvariant_cast<QList<QSslError> >(sslErrorsSpy.first().first()))
+ const auto sslErrorsSpyErrors = qvariant_cast<QList<QSslError> >(qAsConst(sslErrorsSpy).first().first());
+ for (const QSslError &err : sslErrorsSpyErrors)
emittedErrors << err.error();
qSort(emittedErrors);
QCOMPARE(sslErrors, emittedErrors);
@@ -646,7 +654,7 @@ void tst_QSslSocket::sslErrors()
QVERIFY(!peerVerifyErrorSpy.isEmpty());
SslErrorList peerErrors;
const QList<QVariantList> &peerVerifyList = peerVerifyErrorSpy;
- foreach (const QVariantList &args, peerVerifyList)
+ for (const QVariantList &args : peerVerifyList)
peerErrors << qvariant_cast<QSslError>(args.first()).error();
qSort(peerErrors);
QCOMPARE(sslErrors, peerErrors);
@@ -1160,7 +1168,9 @@ void tst_QSslSocket::protocolServerSide_data()
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2
#endif
+#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-ssl3") << QSsl::SslV3 << QSsl::SslV3 << true;
+#endif
QTest::newRow("tls1.0-tls1.0") << QSsl::TlsV1_0 << QSsl::TlsV1_0 << true;
QTest::newRow("tls1ssl3-tls1ssl3") << QSsl::TlsV1SslV3 << QSsl::TlsV1SslV3 << true;
QTest::newRow("any-any") << QSsl::AnyProtocol << QSsl::AnyProtocol << true;
@@ -1174,23 +1184,27 @@ void tst_QSslSocket::protocolServerSide_data()
QTest::newRow("ssl2-any") << QSsl::SslV2 << QSsl::AnyProtocol << false; // no idea why it does not work, but we don't care about SSL 2
#endif
-#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
+#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-ssl2") << QSsl::SslV3 << QSsl::SslV2 << false;
#endif
+#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-tls1.0") << QSsl::SslV3 << QSsl::TlsV1_0 << false;
QTest::newRow("ssl3-tls1ssl3") << QSsl::SslV3 << QSsl::TlsV1SslV3 << true;
QTest::newRow("ssl3-secure") << QSsl::SslV3 << QSsl::SecureProtocols << false;
-#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
+#endif
+#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) && !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << false; // we won't set a SNI header here because we connect to a
// numerical IP, so OpenSSL will send a SSL 2 handshake
-#else
+#elif !defined(OPENSSL_NO_SSL3)
QTest::newRow("ssl3-any") << QSsl::SslV3 << QSsl::AnyProtocol << true;
#endif
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("tls1.0-ssl2") << QSsl::TlsV1_0 << QSsl::SslV2 << false;
#endif
+#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("tls1.0-ssl3") << QSsl::TlsV1_0 << QSsl::SslV3 << false;
+#endif
QTest::newRow("tls1-tls1ssl3") << QSsl::TlsV1_0 << QSsl::TlsV1SslV3 << true;
QTest::newRow("tls1.0-secure") << QSsl::TlsV1_0 << QSsl::SecureProtocols << true;
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
@@ -1203,7 +1217,9 @@ void tst_QSslSocket::protocolServerSide_data()
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("tls1ssl3-ssl2") << QSsl::TlsV1SslV3 << QSsl::SslV2 << false;
#endif
+#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("tls1ssl3-ssl3") << QSsl::TlsV1SslV3 << QSsl::SslV3 << true;
+#endif
QTest::newRow("tls1ssl3-tls1.0") << QSsl::TlsV1SslV3 << QSsl::TlsV1_0 << true;
QTest::newRow("tls1ssl3-secure") << QSsl::TlsV1SslV3 << QSsl::SecureProtocols << true;
QTest::newRow("tls1ssl3-any") << QSsl::TlsV1SslV3 << QSsl::AnyProtocol << true;
@@ -1211,7 +1227,9 @@ void tst_QSslSocket::protocolServerSide_data()
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("secure-ssl2") << QSsl::SecureProtocols << QSsl::SslV2 << false;
#endif
+#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("secure-ssl3") << QSsl::SecureProtocols << QSsl::SslV3 << false;
+#endif
QTest::newRow("secure-tls1.0") << QSsl::SecureProtocols << QSsl::TlsV1_0 << true;
QTest::newRow("secure-tls1ssl3") << QSsl::SecureProtocols << QSsl::TlsV1SslV3 << true;
QTest::newRow("secure-any") << QSsl::SecureProtocols << QSsl::AnyProtocol << true;
@@ -1219,7 +1237,9 @@ void tst_QSslSocket::protocolServerSide_data()
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("any-ssl2") << QSsl::AnyProtocol << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2
#endif
+#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("any-ssl3") << QSsl::AnyProtocol << QSsl::SslV3 << true;
+#endif
QTest::newRow("any-tls1.0") << QSsl::AnyProtocol << QSsl::TlsV1_0 << true;
QTest::newRow("any-tls1ssl3") << QSsl::AnyProtocol << QSsl::TlsV1SslV3 << true;
QTest::newRow("any-secure") << QSsl::AnyProtocol << QSsl::SecureProtocols << true;
@@ -1244,8 +1264,8 @@ void tst_QSslSocket::protocolServerSide()
QEventLoop loop;
QTimer::singleShot(5000, &loop, SLOT(quit()));
- QSslSocketPtr client(new QSslSocket);
- socket = client.data();
+ QSslSocket client;
+ socket = &client;
QFETCH(QSsl::SslProtocol, clientProtocol);
socket->setProtocol(clientProtocol);
// upon SSL wrong version error, error will be triggered, not sslErrors
@@ -1253,14 +1273,14 @@ void tst_QSslSocket::protocolServerSide()
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
- client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
loop.exec();
QFETCH(bool, works);
QAbstractSocket::SocketState expectedState = (works) ? QAbstractSocket::ConnectedState : QAbstractSocket::UnconnectedState;
- QCOMPARE(int(client->state()), int(expectedState));
- QCOMPARE(client->isEncrypted(), works);
+ QCOMPARE(int(client.state()), int(expectedState));
+ QCOMPARE(client.isEncrypted(), works);
}
#ifndef QT_NO_OPENSSL
@@ -1285,8 +1305,8 @@ void tst_QSslSocket::serverCipherPreferences()
QEventLoop loop;
QTimer::singleShot(5000, &loop, SLOT(quit()));
- QSslSocketPtr client(new QSslSocket);
- socket = client.data();
+ QSslSocket client;
+ socket = &client;
socket->setCiphers("AES256-SHA:AES128-SHA");
// upon SSL wrong version error, error will be triggered, not sslErrors
@@ -1294,12 +1314,12 @@ void tst_QSslSocket::serverCipherPreferences()
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
- client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
loop.exec();
- QVERIFY(client->isEncrypted());
- QCOMPARE(client->sessionCipher().name(), QString("AES128-SHA"));
+ QVERIFY(client.isEncrypted());
+ QCOMPARE(client.sessionCipher().name(), QString("AES128-SHA"));
}
{
@@ -1314,8 +1334,8 @@ void tst_QSslSocket::serverCipherPreferences()
QEventLoop loop;
QTimer::singleShot(5000, &loop, SLOT(quit()));
- QSslSocketPtr client(new QSslSocket);
- socket = client.data();
+ QSslSocket client;
+ socket = &client;
socket->setCiphers("AES256-SHA:AES128-SHA");
// upon SSL wrong version error, error will be triggered, not sslErrors
@@ -1323,12 +1343,12 @@ void tst_QSslSocket::serverCipherPreferences()
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
- client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
loop.exec();
- QVERIFY(client->isEncrypted());
- QCOMPARE(client->sessionCipher().name(), QString("AES256-SHA"));
+ QVERIFY(client.isEncrypted());
+ QCOMPARE(client.sessionCipher().name(), QString("AES256-SHA"));
}
}
@@ -1419,21 +1439,21 @@ void tst_QSslSocket::setSocketDescriptor()
QEventLoop loop;
QTimer::singleShot(5000, &loop, SLOT(quit()));
- QSslSocketPtr client(new QSslSocket);
- socket = client.data();;
+ QSslSocket client;
+ socket = &client;
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
- client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
loop.exec();
- QCOMPARE(client->state(), QAbstractSocket::ConnectedState);
- QVERIFY(client->isEncrypted());
- QVERIFY(!client->peerAddress().isNull());
- QVERIFY(client->peerPort() != 0);
- QVERIFY(!client->localAddress().isNull());
- QVERIFY(client->localPort() != 0);
+ QCOMPARE(client.state(), QAbstractSocket::ConnectedState);
+ QVERIFY(client.isEncrypted());
+ QVERIFY(!client.peerAddress().isNull());
+ QVERIFY(client.peerPort() != 0);
+ QVERIFY(!client.localAddress().isNull());
+ QVERIFY(client.localPort() != 0);
}
void tst_QSslSocket::setSslConfiguration_data()
@@ -2846,10 +2866,37 @@ void tst_QSslSocket::qtbug18498_peek2()
void tst_QSslSocket::dhServer()
{
- if (!QSslSocket::supportsSsl()) {
- qWarning("SSL not supported, skipping test");
+ if (!QSslSocket::supportsSsl())
+ QSKIP("No SSL support");
+
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
return;
- }
+
+ SslServer server;
+ server.ciphers = QLatin1String("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA");
+ QVERIFY(server.listen());
+
+ QEventLoop loop;
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+
+ QSslSocket client;
+ socket = &client;
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
+ connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
+
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+
+ loop.exec();
+ QCOMPARE(client.state(), QAbstractSocket::ConnectedState);
+}
+
+#ifndef QT_NO_OPENSSL
+void tst_QSslSocket::dhServerCustomParamsNull()
+{
+ if (!QSslSocket::supportsSsl())
+ QSKIP("No SSL support");
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
@@ -2857,22 +2904,74 @@ void tst_QSslSocket::dhServer()
SslServer server;
server.ciphers = QLatin1String("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA");
+
+ QSslConfiguration cfg = server.config;
+ cfg.setDiffieHellmanParameters(QSslDiffieHellmanParameters());
+ server.config = cfg;
+
QVERIFY(server.listen());
QEventLoop loop;
QTimer::singleShot(5000, &loop, SLOT(quit()));
- QSslSocketPtr client(new QSslSocket);
- socket = client.data();
+ QSslSocket client;
+ socket = &client;
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
- client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
loop.exec();
- QCOMPARE(client->state(), QAbstractSocket::ConnectedState);
+
+ QVERIFY(client.state() != QAbstractSocket::ConnectedState);
}
+#endif // QT_NO_OPENSSL
+
+#ifndef QT_NO_OPENSSL
+void tst_QSslSocket::dhServerCustomParams()
+{
+ if (!QSslSocket::supportsSsl())
+ QSKIP("No SSL support");
+
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ SslServer server;
+ server.ciphers = QLatin1String("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA");
+
+ QSslConfiguration cfg = server.config;
+
+ // Custom 2048-bit DH parameters generated with 'openssl dhparam -outform DER -out out.der -check -2 2048'
+ const auto dh = QSslDiffieHellmanParameters::fromEncoded(QByteArray::fromBase64(QByteArrayLiteral(
+ "MIIBCAKCAQEAvVA7b8keTfjFutCtTJmP/pnQfw/prKa+GMed/pBWjrC4N1YwnI8h/A861d9WE/VWY7XMTjvjX3/0"
+ "aaU8wEe0EXNpFdlTH+ZMQctQTSJOyQH0RCTwJfDGPCPT9L+c9GKwEKWORH38Earip986HJc0w3UbnfIwXUdsWHiXi"
+ "Z6r3cpyBmTKlsXTFiDVAOUXSiO8d/zOb6zHZbDfyB/VbtZRmnA7TXVn9oMzC0g9+FXHdrV4K+XfdvNZdCegvoAZiy"
+ "R6ZQgNG9aZ36/AQekhg060hp55f9HDPgXqYeNeXBiferjUtU7S9b3s83XhOJAr01/0Tf5dENwCfg2gK36TM8cC4wI"
+ "BAg==")), QSsl::Der);
+ cfg.setDiffieHellmanParameters(dh);
+
+ server.config = cfg;
+
+ QVERIFY(server.listen());
+
+ QEventLoop loop;
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+
+ QSslSocket client;
+ socket = &client;
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
+ connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
+
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+
+ loop.exec();
+
+ QVERIFY(client.state() == QAbstractSocket::ConnectedState);
+}
+#endif // QT_NO_OPENSSL
void tst_QSslSocket::ecdhServer()
{
@@ -2892,16 +2991,16 @@ void tst_QSslSocket::ecdhServer()
QEventLoop loop;
QTimer::singleShot(5000, &loop, SLOT(quit()));
- QSslSocketPtr client(new QSslSocket);
- socket = client.data();
+ QSslSocket client;
+ socket = &client;
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
- client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
loop.exec();
- QCOMPARE(client->state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(client.state(), QAbstractSocket::ConnectedState);
}
void tst_QSslSocket::verifyClientCertificate_data()
@@ -3003,16 +3102,16 @@ void tst_QSslSocket::verifyClientCertificate()
QFETCH(QList<QSslCertificate>, clientCerts);
QFETCH(QSslKey, clientKey);
- QSslSocketPtr client(new QSslSocket);
- client->setLocalCertificateChain(clientCerts);
- client->setPrivateKey(clientKey);
- socket = client.data();
+ QSslSocket client;
+ client.setLocalCertificateChain(clientCerts);
+ client.setPrivateKey(clientKey);
+ socket = &client;
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(disconnected()), &loop, SLOT(quit()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
- client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ client.connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
loop.exec();
@@ -3034,8 +3133,8 @@ void tst_QSslSocket::verifyClientCertificate()
}
// check client socket
- QCOMPARE(int(client->state()), int(expectedState));
- QCOMPARE(client->isEncrypted(), works);
+ QCOMPARE(int(client.state()), int(expectedState));
+ QCOMPARE(client.isEncrypted(), works);
}
void tst_QSslSocket::readBufferMaxSize()
@@ -3126,8 +3225,12 @@ class PskProvider : public QObject
Q_OBJECT
public:
+ bool m_server;
+ QByteArray m_identity;
+ QByteArray m_psk;
+
explicit PskProvider(QObject *parent = 0)
- : QObject(parent)
+ : QObject(parent), m_server(false)
{
}
@@ -3146,7 +3249,11 @@ public slots:
{
QVERIFY(authenticator);
QCOMPARE(authenticator->identityHint(), PSK_SERVER_IDENTITY_HINT);
- QVERIFY(authenticator->maximumIdentityLength() > 0);
+ if (m_server)
+ QCOMPARE(authenticator->maximumIdentityLength(), 0);
+ else
+ QVERIFY(authenticator->maximumIdentityLength() > 0);
+
QVERIFY(authenticator->maximumPreSharedKeyLength() > 0);
if (!m_identity.isEmpty()) {
@@ -3159,12 +3266,61 @@ public slots:
QCOMPARE(authenticator->preSharedKey(), m_psk);
}
}
-
-private:
- QByteArray m_identity;
- QByteArray m_psk;
};
+class PskServer : public QTcpServer
+{
+ Q_OBJECT
+public:
+ PskServer()
+ : socket(0),
+ config(QSslConfiguration::defaultConfiguration()),
+ ignoreSslErrors(true),
+ peerVerifyMode(QSslSocket::AutoVerifyPeer),
+ protocol(QSsl::TlsV1_0),
+ m_pskProvider()
+ {
+ m_pskProvider.m_server = true;
+ }
+ QSslSocket *socket;
+ QSslConfiguration config;
+ bool ignoreSslErrors;
+ QSslSocket::PeerVerifyMode peerVerifyMode;
+ QSsl::SslProtocol protocol;
+ QString ciphers;
+ PskProvider m_pskProvider;
+
+protected:
+ void incomingConnection(qintptr socketDescriptor)
+ {
+ socket = new QSslSocket(this);
+ socket->setSslConfiguration(config);
+ socket->setPeerVerifyMode(peerVerifyMode);
+ socket->setProtocol(protocol);
+ if (ignoreSslErrors)
+ connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
+
+ if (!ciphers.isEmpty()) {
+ socket->setCiphers(ciphers);
+ }
+
+ QVERIFY(socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState));
+ QVERIFY(!socket->peerAddress().isNull());
+ QVERIFY(socket->peerPort() != 0);
+ QVERIFY(!socket->localAddress().isNull());
+ QVERIFY(socket->localPort() != 0);
+
+ connect(socket, &QSslSocket::preSharedKeyAuthenticationRequired, &m_pskProvider, &PskProvider::providePsk);
+
+ socket->startServerEncryption();
+ }
+
+protected slots:
+ void ignoreErrorSlot()
+ {
+ socket->ignoreSslErrors();
+ }
+};
void tst_QSslSocket::simplePskConnect_data()
{
QTest::addColumn<PskConnectTestType>("pskTestType");
@@ -3188,7 +3344,7 @@ void tst_QSslSocket::simplePskConnect()
bool pskCipherFound = false;
const QList<QSslCipher> supportedCiphers = QSslSocket::supportedCiphers();
- foreach (const QSslCipher &cipher, supportedCiphers) {
+ for (const QSslCipher &cipher : supportedCiphers) {
if (cipher.name() == PSK_CIPHER_WITHOUT_AUTH) {
pskCipherFound = true;
break;
@@ -3466,6 +3622,129 @@ void tst_QSslSocket::ephemeralServerKey()
QCOMPARE(client->sslConfiguration().ephemeralServerKey().isNull(), emptyKey);
}
+void tst_QSslSocket::allowedProtocolNegotiation()
+{
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)
+
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ const QByteArray expectedNegotiated("cool-protocol");
+ QList<QByteArray> serverProtos;
+ serverProtos << expectedNegotiated << "not-so-cool-protocol";
+ QList<QByteArray> clientProtos;
+ clientProtos << "uber-cool-protocol" << expectedNegotiated << "not-so-cool-protocol";
+
+
+ SslServer server;
+ server.config.setAllowedNextProtocols(serverProtos);
+ QVERIFY(server.listen());
+
+ QSslSocket clientSocket;
+ auto configuration = clientSocket.sslConfiguration();
+ configuration.setAllowedNextProtocols(clientProtos);
+ clientSocket.setSslConfiguration(configuration);
+
+ clientSocket.connectToHostEncrypted("127.0.0.1", server.serverPort());
+ clientSocket.ignoreSslErrors();
+
+ QEventLoop loop;
+ QTimer::singleShot(5000, &loop, SLOT(quit()));
+ connect(&clientSocket, SIGNAL(encrypted()), &loop, SLOT(quit()));
+ loop.exec();
+
+ QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() ==
+ clientSocket.sslConfiguration().nextNegotiatedProtocol());
+ QVERIFY(server.socket->sslConfiguration().nextNegotiatedProtocol() == expectedNegotiated);
+
+#endif // OPENSSL_VERSION_NUMBER
+}
+
+void tst_QSslSocket::pskServer()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (!QSslSocket::supportsSsl() || setProxy)
+ return;
+
+ QSslSocket socket;
+ this->socket = &socket;
+
+ QSignalSpy connectedSpy(&socket, SIGNAL(connected()));
+ QVERIFY(connectedSpy.isValid());
+
+ QSignalSpy disconnectedSpy(&socket, SIGNAL(disconnected()));
+ QVERIFY(disconnectedSpy.isValid());
+
+ QSignalSpy connectionEncryptedSpy(&socket, SIGNAL(encrypted()));
+ QVERIFY(connectionEncryptedSpy.isValid());
+
+ QSignalSpy pskAuthenticationRequiredSpy(&socket, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)));
+ QVERIFY(pskAuthenticationRequiredSpy.isValid());
+
+ connect(&socket, SIGNAL(connected()), this, SLOT(exitLoop()));
+ connect(&socket, SIGNAL(disconnected()), this, SLOT(exitLoop()));
+ connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop()));
+ connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop()));
+ connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop()));
+ connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(exitLoop()));
+ connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop()));
+ connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop()));
+
+ // force a PSK cipher w/o auth
+ socket.setCiphers(PSK_CIPHER_WITHOUT_AUTH);
+
+ PskProvider provider;
+ provider.setIdentity(PSK_CLIENT_IDENTITY);
+ provider.setPreSharedKey(PSK_CLIENT_PRESHAREDKEY);
+ connect(&socket, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), &provider, SLOT(providePsk(QSslPreSharedKeyAuthenticator*)));
+ socket.setPeerVerifyMode(QSslSocket::VerifyNone);
+
+ PskServer server;
+ server.m_pskProvider.setIdentity(provider.m_identity);
+ server.m_pskProvider.setPreSharedKey(provider.m_psk);
+ server.config.setPreSharedKeyIdentityHint(PSK_SERVER_IDENTITY_HINT);
+ QVERIFY(server.listen());
+
+ // Start connecting
+ socket.connectToHost(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
+ enterLoop(5);
+
+ // Entered connected state
+ QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
+ QCOMPARE(socket.mode(), QSslSocket::UnencryptedMode);
+ QVERIFY(!socket.isEncrypted());
+ QCOMPARE(connectedSpy.count(), 1);
+ QCOMPARE(disconnectedSpy.count(), 0);
+
+ // Enter encrypted mode
+ socket.startClientEncryption();
+ QCOMPARE(socket.mode(), QSslSocket::SslClientMode);
+ QVERIFY(!socket.isEncrypted());
+ QCOMPARE(connectionEncryptedSpy.count(), 0);
+
+ // Start handshake.
+ enterLoop(10);
+
+ // We must get the PSK signal in all cases
+ QCOMPARE(pskAuthenticationRequiredSpy.count(), 1);
+
+ QCOMPARE(connectionEncryptedSpy.count(), 1);
+ QVERIFY(socket.isEncrypted());
+ QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
+
+ // check writing
+ socket.write("Hello from Qt TLS/PSK!");
+ QVERIFY(socket.waitForBytesWritten());
+
+ // disconnect
+ socket.disconnectFromHost();
+ enterLoop(10);
+
+ QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState);
+ QCOMPARE(disconnectedSpy.count(), 1);
+}
+
#endif // QT_NO_OPENSSL
#endif // QT_NO_SSL
diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro
index ae911e43ed..c862b3d3ae 100644
--- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro
+++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
testcase.timeout = 300 # this test is slow
SOURCES += tst_qsslsocket_onDemandCertificates_member.cpp
-win32:!wince: LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core core-private network-private testlib
TARGET = tst_qsslsocket_onDemandCertificates_member
@@ -15,10 +15,6 @@ win32 {
}
}
-wince* {
- DEFINES += SRCDIR=\\\"./\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro
index 25e5a5d5c7..c27a58fcd2 100644
--- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro
+++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
SOURCES += tst_qsslsocket_onDemandCertificates_static.cpp
-win32:!wince: LIBS += -lws2_32
+win32:LIBS += -lws2_32
QT = core core-private network-private testlib
TARGET = tst_qsslsocket_onDemandCertificates_static
@@ -14,10 +14,6 @@ win32 {
}
}
-wince* {
- DEFINES += SRCDIR=\\\"./\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/network/ssl/ssl.pro b/tests/auto/network/ssl/ssl.pro
index 25d79ebfe8..ec74748f5b 100644
--- a/tests/auto/network/ssl/ssl.pro
+++ b/tests/auto/network/ssl/ssl.pro
@@ -1,4 +1,6 @@
TEMPLATE=subdirs
+QT_FOR_CONFIG += network
+
SUBDIRS=\
qsslcertificate \
qsslcipher \
@@ -6,8 +8,8 @@ SUBDIRS=\
qsslerror \
qsslkey \
-contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
- contains(QT_CONFIG, private_tests) {
+qtConfig(ssl)|qtConfig(openssl)|qtConfig(openssl-linked) {
+ qtConfig(private_tests) {
SUBDIRS += \
qsslsocket \
qsslsocket_onDemandCertificates_member \
@@ -19,8 +21,9 @@ winrt: SUBDIRS -= \
qsslsocket_onDemandCertificates_member \
qsslsocket_onDemandCertificates_static \
-contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
- contains(QT_CONFIG, private_tests) {
- SUBDIRS += qasn1element
+qtConfig(ssl)|qtConfig(openssl)|qtConfig(openssl-linked) {
+ qtConfig(private_tests) {
+ SUBDIRS += qasn1element \
+ qssldiffiehellmanparameters
}
}
diff --git a/tests/auto/opengl/qgl/BLACKLIST b/tests/auto/opengl/qgl/BLACKLIST
index a7aaa04900..a83d1272a0 100644
--- a/tests/auto/opengl/qgl/BLACKLIST
+++ b/tests/auto/opengl/qgl/BLACKLIST
@@ -1,17 +1,25 @@
[glWidgetRendering]
windows
+winrt
[glFBORendering]
windows
+winrt
[multipleFBOInterleavedRendering]
windows
+winrt
[glPBufferRendering]
windows
+winrt
[replaceClipping]
windows
+winrt
[clipTest]
windows
+winrt
opensuse-13.1
[graphicsViewClipping]
windows
+winrt
[glFBOUseInGLWidget]
windows
+winrt
diff --git a/tests/auto/opengl/qglthreads/qglthreads.pro b/tests/auto/opengl/qglthreads/qglthreads.pro
index ab8bda741e..9aa21fb3a2 100644
--- a/tests/auto/opengl/qglthreads/qglthreads.pro
+++ b/tests/auto/opengl/qglthreads/qglthreads.pro
@@ -5,10 +5,3 @@ QT += opengl widgets testlib gui-private core-private
HEADERS += tst_qglthreads.h
SOURCES += tst_qglthreads.cpp
-
-x11 {
- LIBS += $$QMAKE_LIBS_X11
-}
-
-
-
diff --git a/tests/auto/other/compiler/compiler.pro b/tests/auto/other/compiler/compiler.pro
index 19f86582e9..5a00e53878 100644
--- a/tests/auto/other/compiler/compiler.pro
+++ b/tests/auto/other/compiler/compiler.pro
@@ -3,7 +3,7 @@ TARGET = tst_compiler
SOURCES += tst_compiler.cpp baseclass.cpp derivedclass.cpp othersource.cpp
HEADERS += baseclass.h derivedclass.h
QT = core testlib
-contains(QT_CONFIG, c++11): CONFIG += c++11
-contains(QT_CONFIG, c++14): CONFIG += c++14
+qtConfig(c++11): CONFIG += c++11
+qtConfig(c++14): CONFIG += c++14
diff --git a/tests/auto/other/gestures/gestures.pro b/tests/auto/other/gestures/gestures.pro
index 3d0ef7c745..0ec0435f62 100644
--- a/tests/auto/other/gestures/gestures.pro
+++ b/tests/auto/other/gestures/gestures.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
TARGET = tst_gestures
-QT += widgets testlib gui-private
+QT += widgets testlib
SOURCES += tst_gestures.cpp
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp
index 59b285b032..d153146574 100644
--- a/tests/auto/other/gestures/tst_gestures.cpp
+++ b/tests/auto/other/gestures/tst_gestures.cpp
@@ -40,7 +40,6 @@
#include <qgraphicswidget.h>
#include <qgraphicsview.h>
#include <qmainwindow.h>
-#include <qpa/qwindowsysteminterface.h>
#include <qdebug.h>
@@ -2318,9 +2317,7 @@ void tst_Gestures::bug_13501_gesture_not_accepted()
w.show();
QVERIFY(waitForWindowExposed(&w));
//QTest::mousePress(&ignoreEvent, Qt::LeftButton);
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
+ QTouchDevice *device = QTest::createTouchDevice();
QTest::touchEvent(&w, device).press(0, QPoint(10, 10), &w);
}
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index 0b1471c4b1..8d6886a6c6 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -165,7 +165,16 @@ const char *PaintCommands::imageFormatTable[] = {
"Format_ARGB8555_Premultiplied",
"Format_RGB888",
"Format_RGB444",
- "Format_ARGB4444_Premultiplied"
+ "Format_ARGB4444_Premultiplied",
+ "Format_RGBX8888",
+ "Format_RGBA8888",
+ "Format_RGBA8888_Premultiplied",
+ "Format_BGR30",
+ "Format_A2BGR30_Premultiplied",
+ "Format_RGB30",
+ "Format_A2RGB30_Premultiplied",
+ "Alpha8",
+ "Grayscale8",
};
int PaintCommands::translateEnum(const char *table[], const QString &pattern, int limit)
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index 81c5926f3a..8fc0521102 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -71,6 +71,10 @@ private slots:
void testRasterRGB32();
void testRasterRGB16_data();
void testRasterRGB16();
+ void testRasterA2RGB30PM_data();
+ void testRasterA2RGB30PM();
+ void testRasterBGR30_data();
+ void testRasterBGR30();
void testRasterARGB8565PM_data();
void testRasterARGB8565PM();
void testRasterGrayscale8_data();
@@ -154,6 +158,30 @@ void tst_Lancelot::testRasterRGB16()
}
+void tst_Lancelot::testRasterA2RGB30PM_data()
+{
+ setupTestSuite();
+}
+
+
+void tst_Lancelot::testRasterA2RGB30PM()
+{
+ runTestSuite(Raster, QImage::Format_A2RGB30_Premultiplied);
+}
+
+
+void tst_Lancelot::testRasterBGR30_data()
+{
+ setupTestSuite();
+}
+
+
+void tst_Lancelot::testRasterBGR30()
+{
+ runTestSuite(Raster, QImage::Format_BGR30);
+}
+
+
void tst_Lancelot::testRasterARGB8565PM_data()
{
setupTestSuite();
diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp
index 7380398071..22c2e1fbc7 100644
--- a/tests/auto/other/languagechange/tst_languagechange.cpp
+++ b/tests/auto/other/languagechange/tst_languagechange.cpp
@@ -281,9 +281,6 @@ void tst_languageChange::retranslatability()
fooFile.write("test");
fooFile.close();
dlg.setDirectory(temporaryDir.path());
-#ifdef Q_OS_WINCE
- dlg.setDirectory("\\Windows");
-#endif
dlg.setFileMode(QFileDialog::ExistingFiles);
dlg.setViewMode(QFileDialog::Detail);
stateMachine.start();
@@ -295,13 +292,8 @@ void tst_languageChange::retranslatability()
// In case we use a Color dialog, we do not want to test for
// strings non existing in the dialog and which do not get
// translated.
- if ((dialogType == ColorDialog) &&
-#ifndef Q_OS_WINCE
- (qApp->desktop()->width() < 480 || qApp->desktop()->height() < 350)
-#else
- true // On Qt/WinCE we always use compact mode
-#endif
- ) {
+ const QSize desktopSize = QApplication::desktop()->size();
+ if (dialogType == ColorDialog && (desktopSize.width() < 480 || desktopSize.height() < 350)) {
expected.remove("QColorDialog::&Basic colors");
expected.remove("QColorDialog::&Custom colors");
expected.remove("QColorDialog::&Define Custom Colors >>");
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index 0ce0e8d0f5..68473906b0 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -539,7 +539,7 @@ void tst_NetworkSelfTest::httpServer()
{
QByteArray uniqueExtension = QByteArray::number((qulonglong)this) +
QByteArray::number((qulonglong)qrand()) +
- QByteArray::number((qulonglong)QDateTime::currentDateTime().toTime_t());
+ QByteArray::number(QDateTime::currentSecsSinceEpoch());
netChat(80, QList<Chat>()
// HTTP/0.9 chat:
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index 0e9f054a01..0babac4b6f 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -1,4 +1,6 @@
TEMPLATE=subdirs
+QT_FOR_CONFIG += gui-private
+
SUBDIRS=\
# atwrapper \ # QTBUG-19452
compiler \
@@ -21,7 +23,6 @@ SUBDIRS=\
qsharedpointer_and_qwidget \
qprocess_and_guieventloop \
qtokenautomaton \
- windowsmobile \
toolsupport \
!qtHaveModule(gui): SUBDIRS -= \
@@ -52,9 +53,9 @@ cross_compile: SUBDIRS -= \
atwrapper \
compiler
-wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility
+!qtConfig(accessibility): SUBDIRS -= qaccessibility
-!contains(QT_CONFIG, accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux
+!qtConfig(accessibility-atspi-bridge): SUBDIRS -= qaccessibilitylinux
!mac: SUBDIRS -= \
macgui \
@@ -62,7 +63,7 @@ wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility
macplist \
qaccessibilitymac
-!embedded|wince: SUBDIRS -= \
+!embedded: SUBDIRS -= \
qdirectpainter
winrt: SUBDIRS -= \
diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro
index 7b3173798d..fb9de6f450 100644
--- a/tests/auto/other/qaccessibility/qaccessibility.pro
+++ b/tests/auto/other/qaccessibility/qaccessibility.pro
@@ -1,18 +1,12 @@
CONFIG += testcase
TARGET = tst_qaccessibility
-requires(contains(QT_CONFIG,accessibility))
+requires(qtConfig(accessibility))
QT += testlib core-private gui-private widgets-private
SOURCES += tst_qaccessibility.cpp
HEADERS += accessiblewidgets.h
unix:!darwin:!haiku:!integity: LIBS += -lm
-wince {
- accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll
- accessneeded.path = accessible
- DEPLOYMENT += accessneeded
-}
-
win32 {
!*g++:!winrt {
include(../../../../src/3rdparty/iaccessible2/iaccessible2.pri)
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 99e3fc5bf2..2f5936f1ad 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -68,20 +68,6 @@ static inline void setFrameless(QWidget *w)
w->setWindowFlags(flags);
}
-#if defined(Q_OS_WINCE)
-extern "C" bool SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
-#define SPI_GETPLATFORMTYPE 257
-inline bool IsValidCEPlatform() {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(tszPlatform) / sizeof(*tszPlatform), tszPlatform, 0)) {
- QString platform = QString::fromWCharArray(tszPlatform);
- if ((platform == QLatin1String("PocketPC")) || (platform == QLatin1String("Smartphone")))
- return false;
- }
- return true;
-}
-#endif
-
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
int index, const QRect &domain)
{
@@ -1315,6 +1301,16 @@ void tst_QAccessibility::tabTest()
child2->actionInterface()->doAction(QAccessibleActionInterface::pressAction());
QCOMPARE(tabBar->currentIndex(), 1);
+ // Test that setAccessibleTabName changes a tab's accessible name
+ tabBar->setAccessibleTabName(0, "AccFoo");
+ tabBar->setAccessibleTabName(1, "AccBar");
+ QCOMPARE(child1->text(QAccessible::Name), QLatin1String("AccFoo"));
+ QCOMPARE(child2->text(QAccessible::Name), QLatin1String("AccBar"));
+ tabBar->setCurrentIndex(0);
+ QCOMPARE(interface->text(QAccessible::Name), QLatin1String("AccFoo"));
+ tabBar->setCurrentIndex(1);
+ QCOMPARE(interface->text(QAccessible::Name), QLatin1String("AccBar"));
+
delete tabBar;
QTestAccessibility::clearEvents();
}
@@ -1352,10 +1348,17 @@ void tst_QAccessibility::tabWidgetTest()
QCOMPARE(tabButton1Interface->text(QAccessible::Name), QLatin1String("Tab 1"));
QAccessibleInterface* tabButton2Interface = tabBarInterface->child(1);
- QVERIFY(tabButton1Interface);
+ QVERIFY(tabButton2Interface);
QCOMPARE(tabButton2Interface->role(), QAccessible::PageTab);
QCOMPARE(tabButton2Interface->text(QAccessible::Name), QLatin1String("Tab 2"));
+ // Test that setAccessibleTabName changes a tab's accessible name
+ tabWidget->setCurrentIndex(0);
+ tabWidget->tabBar()->setAccessibleTabName(0, "Acc Tab");
+ QCOMPARE(tabButton1Interface->role(), QAccessible::PageTab);
+ QCOMPARE(tabButton1Interface->text(QAccessible::Name), QLatin1String("Acc Tab"));
+ QCOMPARE(tabBarInterface->text(QAccessible::Name), QLatin1String("Acc Tab"));
+
QAccessibleInterface* tabButtonLeft = tabBarInterface->child(2);
QVERIFY(tabButtonLeft);
QCOMPARE(tabButtonLeft->role(), QAccessible::PushButton);
@@ -1469,10 +1472,6 @@ void tst_QAccessibility::menuTest()
QCOMPARE(iHelp->role(), QAccessible::MenuItem);
QCOMPARE(iAction->role(), QAccessible::MenuItem);
#ifndef Q_OS_MAC
-#ifdef Q_OS_WINCE
- if (!IsValidCEPlatform())
- QSKIP("Tests do not work on Mobile platforms due to native menus");
-#endif
QCOMPARE(mw.mapFromGlobal(interface->rect().topLeft()), mw.menuBar()->geometry().topLeft());
QCOMPARE(interface->rect().size(), mw.menuBar()->size());
@@ -3561,10 +3560,6 @@ void tst_QAccessibility::dockWidgetTest()
void tst_QAccessibility::comboBoxTest()
{
-#if defined(Q_OS_WINCE)
- if (!IsValidCEPlatform())
- QSKIP("Test skipped on Windows Mobile test hardware");
-#endif
{ // not editable combobox
QComboBox combo;
combo.addItems(QStringList() << "one" << "two" << "three");
diff --git a/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp b/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp
index cb69c80f37..b32b1226b2 100644
--- a/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp
+++ b/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp
@@ -34,7 +34,7 @@ QT_BEGIN_NAMESPACE
Basic::Token Basic::classifier3(const QChar *data)
{
- if (data[0] == 100)
+ if (data[0].unicode() == 100)
{
@@ -50,7 +50,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[0] == 97)
+ else if (data[0].unicode() == 97)
{
@@ -66,7 +66,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[0] == 103)
+ else if (data[0].unicode() == 103)
{
@@ -89,19 +89,19 @@ Basic::Token Basic::classifier3(const QChar *data)
Basic::Token Basic::classifier4(const QChar *data)
{
- if (data[0] == 70)
+ if (data[0].unicode() == 70)
{
- if (data[1] == 70)
+ if (data[1].unicode() == 70)
{
- if (data[2] == 70)
+ if (data[2].unicode() == 70)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -111,7 +111,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -124,11 +124,11 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[2] == 71)
+ else if (data[2].unicode() == 71)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -138,7 +138,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -151,12 +151,12 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[2] == 76)
+ else if (data[2].unicode() == 76)
{
- if(data[3] == 77)
+ if (data[3].unicode() == 77)
return FFLM;
@@ -192,7 +192,7 @@ Basic::Token Basic::classifier3(const QChar *data)
Basic::Token Basic::classifier14(const QChar *data)
{
- if (data[0] == 119)
+ if (data[0].unicode() == 119)
{
@@ -208,7 +208,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[0] == 99)
+ else if (data[0].unicode() == 99)
{
diff --git a/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp
index 59164ea3f4..dace6be146 100644
--- a/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp
+++ b/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp
@@ -36,7 +36,7 @@ using namespace BasicNamespace;
Basic::Token Basic::classifier3(const QChar *data)
{
- if (data[0] == 100)
+ if (data[0].unicode() == 100)
{
@@ -52,7 +52,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[0] == 97)
+ else if (data[0].unicode() == 97)
{
@@ -68,7 +68,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[0] == 103)
+ else if (data[0].unicode() == 103)
{
@@ -91,19 +91,19 @@ Basic::Token Basic::classifier3(const QChar *data)
Basic::Token Basic::classifier4(const QChar *data)
{
- if (data[0] == 70)
+ if (data[0].unicode() == 70)
{
- if (data[1] == 70)
+ if (data[1].unicode() == 70)
{
- if (data[2] == 70)
+ if (data[2].unicode() == 70)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -113,7 +113,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -126,11 +126,11 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[2] == 71)
+ else if (data[2].unicode() == 71)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -140,7 +140,7 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -153,12 +153,12 @@ Basic::Token Basic::classifier3(const QChar *data)
}
- else if (data[2] == 76)
+ else if (data[2].unicode() == 76)
{
- if(data[3] == 77)
+ if (data[3].unicode() == 77)
return FFLM;
diff --git a/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp b/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp
index d005b64b8d..c24900eed0 100644
--- a/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp
+++ b/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
Boilerplate::Token Boilerplate::classifier3(const QChar *data)
{
- if (data[0] == 100)
+ if (data[0].unicode() == 100)
{
@@ -52,7 +52,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data)
}
- else if (data[0] == 97)
+ else if (data[0].unicode() == 97)
{
@@ -68,7 +68,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data)
}
- else if (data[0] == 103)
+ else if (data[0].unicode() == 103)
{
@@ -91,19 +91,19 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data)
Boilerplate::Token Boilerplate::classifier4(const QChar *data)
{
- if (data[0] == 70)
+ if (data[0].unicode() == 70)
{
- if (data[1] == 70)
+ if (data[1].unicode() == 70)
{
- if (data[2] == 70)
+ if (data[2].unicode() == 70)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -113,7 +113,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -126,11 +126,11 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data)
}
- else if (data[2] == 71)
+ else if (data[2].unicode() == 71)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -140,7 +140,7 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -153,12 +153,12 @@ Boilerplate::Token Boilerplate::classifier3(const QChar *data)
}
- else if (data[2] == 76)
+ else if (data[2].unicode() == 76)
{
- if(data[3] == 77)
+ if (data[3].unicode() == 77)
return FFLM;
diff --git a/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp
index 87632d83ff..879f55fa32 100644
--- a/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp
+++ b/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp
@@ -34,7 +34,7 @@ QT_BEGIN_NAMESPACE
NoNamespace::Token NoNamespace::classifier3(const QChar *data)
{
- if (data[0] == 100)
+ if (data[0].unicode() == 100)
{
@@ -50,7 +50,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
}
- else if (data[0] == 97)
+ else if (data[0].unicode() == 97)
{
@@ -66,7 +66,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
}
- else if (data[0] == 103)
+ else if (data[0].unicode() == 103)
{
@@ -89,19 +89,19 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
NoNamespace::Token NoNamespace::classifier4(const QChar *data)
{
- if (data[0] == 70)
+ if (data[0].unicode() == 70)
{
- if (data[1] == 70)
+ if (data[1].unicode() == 70)
{
- if (data[2] == 70)
+ if (data[2].unicode() == 70)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -111,7 +111,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -124,11 +124,11 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
}
- else if (data[2] == 71)
+ else if (data[2].unicode() == 71)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -138,7 +138,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -151,12 +151,12 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
}
- else if (data[2] == 76)
+ else if (data[2].unicode() == 76)
{
- if(data[3] == 77)
+ if (data[3].unicode() == 77)
return FFLM;
@@ -176,7 +176,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
NoNamespace::Token NoNamespace::classifier14(const QChar *data)
{
- if (data[0] == 119)
+ if (data[0].unicode() == 119)
{
@@ -192,7 +192,7 @@ NoNamespace::Token NoNamespace::classifier3(const QChar *data)
}
- else if (data[0] == 99)
+ else if (data[0].unicode() == 99)
{
diff --git a/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp b/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp
index 68bd051afb..5be9b3879f 100644
--- a/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp
+++ b/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp
@@ -36,7 +36,7 @@ using namespace NoToStringNS;
NoToString::Token NoToString::classifier3(const QChar *data)
{
- if (data[0] == 100)
+ if (data[0].unicode() == 100)
{
@@ -52,7 +52,7 @@ NoToString::Token NoToString::classifier3(const QChar *data)
}
- else if (data[0] == 97)
+ else if (data[0].unicode() == 97)
{
@@ -68,7 +68,7 @@ NoToString::Token NoToString::classifier3(const QChar *data)
}
- else if (data[0] == 103)
+ else if (data[0].unicode() == 103)
{
@@ -91,19 +91,19 @@ NoToString::Token NoToString::classifier3(const QChar *data)
NoToString::Token NoToString::classifier4(const QChar *data)
{
- if (data[0] == 70)
+ if (data[0].unicode() == 70)
{
- if (data[1] == 70)
+ if (data[1].unicode() == 70)
{
- if (data[2] == 70)
+ if (data[2].unicode() == 70)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -113,7 +113,7 @@ NoToString::Token NoToString::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -126,11 +126,11 @@ NoToString::Token NoToString::classifier3(const QChar *data)
}
- else if (data[2] == 71)
+ else if (data[2].unicode() == 71)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -140,7 +140,7 @@ NoToString::Token NoToString::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -153,12 +153,12 @@ NoToString::Token NoToString::classifier3(const QChar *data)
}
- else if (data[2] == 76)
+ else if (data[2].unicode() == 76)
{
- if(data[3] == 77)
+ if (data[3].unicode() == 77)
return FFLM;
diff --git a/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp
index 0a452c5757..69c6de2f39 100644
--- a/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp
+++ b/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp
@@ -36,7 +36,7 @@ using namespace TheNamespace;
WithNamespace::Token WithNamespace::classifier3(const QChar *data)
{
- if (data[0] == 100)
+ if (data[0].unicode() == 100)
{
@@ -52,7 +52,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
}
- else if (data[0] == 97)
+ else if (data[0].unicode() == 97)
{
@@ -68,7 +68,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
}
- else if (data[0] == 103)
+ else if (data[0].unicode() == 103)
{
@@ -91,19 +91,19 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
WithNamespace::Token WithNamespace::classifier4(const QChar *data)
{
- if (data[0] == 70)
+ if (data[0].unicode() == 70)
{
- if (data[1] == 70)
+ if (data[1].unicode() == 70)
{
- if (data[2] == 70)
+ if (data[2].unicode() == 70)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -113,7 +113,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -126,11 +126,11 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
}
- else if (data[2] == 71)
+ else if (data[2].unicode() == 71)
{
- if (data[3] == 70)
+ if (data[3].unicode() == 70)
{
@@ -140,7 +140,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
}
- else if (data[3] == 71)
+ else if (data[3].unicode() == 71)
{
@@ -153,12 +153,12 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
}
- else if (data[2] == 76)
+ else if (data[2].unicode() == 76)
{
- if(data[3] == 77)
+ if (data[3].unicode() == 77)
return FFLM;
@@ -178,7 +178,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
WithNamespace::Token WithNamespace::classifier14(const QChar *data)
{
- if (data[0] == 119)
+ if (data[0].unicode() == 119)
{
@@ -194,7 +194,7 @@ WithNamespace::Token WithNamespace::classifier3(const QChar *data)
}
- else if (data[0] == 99)
+ else if (data[0].unicode() == 99)
{
diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp
index 7942a84615..f93c8f825b 100644
--- a/tests/auto/other/toolsupport/tst_toolsupport.cpp
+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp
@@ -129,29 +129,14 @@ void tst_toolsupport::offsets_data()
#endif
{
-#ifdef Q_OS_WIN
QTest::newRow("QDateTimePrivate::m_msecs")
- << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 8 << 8;
- QTest::newRow("QDateTimePrivate::m_spec")
- << pmm_to_offsetof(&QDateTimePrivate::m_spec) << 16 << 16;
- QTest::newRow("QDateTimePrivate::m_offsetFromUtc")
- << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 20 << 20;
- QTest::newRow("QDateTimePrivate::m_timeZone")
- << pmm_to_offsetof(&QDateTimePrivate::m_timeZone) << 24 << 24;
+ << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 0 << 0;
QTest::newRow("QDateTimePrivate::m_status")
- << pmm_to_offsetof(&QDateTimePrivate::m_status) << 28 << 32;
-#else
- QTest::newRow("QDateTimePrivate::m_msecs")
- << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 4 << 8;
- QTest::newRow("QDateTimePrivate::m_spec")
- << pmm_to_offsetof(&QDateTimePrivate::m_spec) << 12 << 16;
+ << pmm_to_offsetof(&QDateTimePrivate::m_status) << 8 << 8;
QTest::newRow("QDateTimePrivate::m_offsetFromUtc")
- << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 16 << 20;
+ << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 12 << 12;
QTest::newRow("QDateTimePrivate::m_timeZone")
<< pmm_to_offsetof(&QDateTimePrivate::m_timeZone) << 20 << 24;
- QTest::newRow("QDateTimePrivate::m_status")
- << pmm_to_offsetof(&QDateTimePrivate::m_status) << 24 << 32;
-#endif
}
#endif // RUN_MEMBER_OFFSET_TEST
}
diff --git a/tests/auto/other/windowsmobile/test/ddhelper.cpp b/tests/auto/other/windowsmobile/test/ddhelper.cpp
deleted file mode 100644
index 3ce99a0ded..0000000000
--- a/tests/auto/other/windowsmobile/test/ddhelper.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifdef Q_OS_WINCE_WM
-
-#include <Ddraw.h>
-#include <QDebug>
-
-static LPDIRECTDRAW g_pDD = NULL; // DirectDraw object
-static LPDIRECTDRAWSURFACE g_pDDSSurface = NULL; // DirectDraw primary surface
-
-static DDSCAPS ddsCaps;
-static DDSURFACEDESC ddsSurfaceDesc;
-static void *buffer = NULL;
-
-static int width = 0;
-static int height = 0;
-static int pitch = 0;
-static int bitCount = 0;
-static int windowId = 0;
-
-static bool initialized = false;
-static bool locked = false;
-
-void q_lock()
-{
- if (locked) {
- qWarning("Direct Painter already locked (QDirectPainter::lock())");
- return;
- }
- locked = true;
-
-
- memset(&ddsSurfaceDesc, 0, sizeof(ddsSurfaceDesc));
- ddsSurfaceDesc.dwSize = sizeof(ddsSurfaceDesc);
-
- HRESULT h = g_pDDSSurface->Lock(0, &ddsSurfaceDesc, DDLOCK_WRITEONLY, 0);
- if (h != DD_OK)
- qDebug() << "GetSurfaceDesc failed!";
-
- width = ddsSurfaceDesc.dwWidth;
- height = ddsSurfaceDesc.dwHeight;
- bitCount = ddsSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
- pitch = ddsSurfaceDesc.lPitch;
- buffer = ddsSurfaceDesc.lpSurface;
-}
-
-void q_unlock()
-{
- if( !locked) {
- qWarning("Direct Painter not locked (QDirectPainter::unlock()");
- return;
- }
- g_pDDSSurface->Unlock(0);
- locked = false;
-}
-
-void q_initDD()
-{
- if (initialized)
- return;
-
- DirectDrawCreate(NULL, &g_pDD, NULL);
-
- HRESULT h;
- h = g_pDD->SetCooperativeLevel(0, DDSCL_NORMAL);
-
- if (h != DD_OK)
- qDebug() << "cooperation level failed";
-
- h = g_pDD->TestCooperativeLevel();
- if (h != DD_OK)
- qDebug() << "cooperation level failed test";
-
- DDSURFACEDESC ddsd;
- memset(&ddsd, 0, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
-
- ddsd.dwFlags = DDSD_CAPS;
-
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- h = g_pDD->CreateSurface(&ddsd, &g_pDDSSurface, NULL);
-
- if (h != DD_OK)
- qDebug() << "CreateSurface failed!";
-
- if (g_pDDSSurface->GetCaps(&ddsCaps) != DD_OK)
- qDebug() << "GetCaps failed";
-
- q_lock();
- q_unlock();
- initialized = true;
-}
-
-uchar* q_frameBuffer()
-{
- return (uchar*) buffer;
-}
-
-int q_screenDepth()
-{
- return bitCount;
-}
-
-int q_screenWidth()
-{
- return width;
-}
-
-int q_screenHeight()
-{
- return height;
-}
-
-int q_linestep()
-{
- return pitch;
-}
-
-#endif //Q_OS_WINCE_WM
-
-
diff --git a/tests/auto/other/windowsmobile/test/test.pro b/tests/auto/other/windowsmobile/test/test.pro
deleted file mode 100644
index 36dd15f60e..0000000000
--- a/tests/auto/other/windowsmobile/test/test.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-
-CONFIG += testcase
-QT += widgets testlib
-HEADERS += ddhelper.h
-SOURCES += tst_windowsmobile.cpp ddhelper.cpp
-RESOURCES += windowsmobile.qrc
-
-TARGET = ../tst_windowsmobile
-
-wincewm*: {
- addFiles.files = $$OUT_PWD/../testQMenuBar/*.exe
-
-
- addFiles.path = "\\Program Files\\tst_windowsmobile"
- DEPLOYMENT += addFiles
-}
-
-wincewm*: {
- LIBS += Ddraw.lib
-}
-
-
-
diff --git a/tests/auto/other/windowsmobile/test/testQMenuBar_current.png b/tests/auto/other/windowsmobile/test/testQMenuBar_current.png
deleted file mode 100644
index f0042b8fe0..0000000000
--- a/tests/auto/other/windowsmobile/test/testQMenuBar_current.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png
deleted file mode 100644
index 8086c41ce9..0000000000
--- a/tests/auto/other/windowsmobile/test/testSimpleWidget_current.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp
deleted file mode 100644
index 8d0e468bd6..0000000000
--- a/tests/auto/other/windowsmobile/test/tst_windowsmobile.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtCore/QDate>
-#include <QtCore/QDebug>
-#include <QtCore/QObject>
-#include <QtGui>
-#ifdef Q_OS_WINCE_WM
-#include <windows.h>
-#include "ddhelper.h"
-#endif
-
-
-
-class tst_WindowsMobile : public QObject
-{
- Q_OBJECT
-public:
- tst_WindowsMobile()
- {
- qApp->setCursorFlashTime (24 * 3600 * 1000); // once a day
- // qApp->setCursorFlashTime (INT_MAX);
-#ifdef Q_OS_WINCE_WM
- q_initDD();
-#endif
- }
-
-#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501
- private slots:
- void testMainWindowAndMenuBar();
- void testSimpleWidget();
-#endif
-};
-
-#if defined(Q_OS_WINCE_WM) && defined(_WIN32_WCE) && _WIN32_WCE <= 0x501
-
-bool qt_wince_is_platform(const QString &platformString) {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
- sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
- return true;
- return false;
-}
-
-bool qt_wince_is_smartphone() {
- return qt_wince_is_platform(QString::fromLatin1("Smartphone"));
-}
-
-void openMenu()
-{
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,450,630,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,450,630,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0);
- QTest::qWait(2000);
- ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0);
-}
-
-void compareScreenshots(const QString &image1, const QString &image2)
-{
- QImage screenShot(image1);
- QImage original(image2);
-
- // cut away the title bar before comparing
- QDesktopWidget desktop;
- QRect desktopFrameRect = desktop.frameGeometry();
- QRect desktopClientRect = desktop.availableGeometry();
-
- QPainter p1(&screenShot);
- QPainter p2(&original);
-
- //screenShot.save("scr1.png", "PNG");
- p1.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black);
- p2.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black);
-
- //screenShot.save("scr2.png", "PNG");
- //original.save("orig1.png", "PNG");
-
- QCOMPARE(original, screenShot);
-}
-
-void takeScreenShot(const QString filename)
-{
- q_lock();
- QImage image = QImage(( uchar *) q_frameBuffer(), q_screenWidth(),
- q_screenHeight(), q_screenWidth() * q_screenDepth() / 8, QImage::Format_RGB16);
- image.save(filename, "PNG");
- q_unlock();
-}
-
-void tst_WindowsMobile::testMainWindowAndMenuBar()
-{
- if (qt_wince_is_smartphone())
- QSKIP("This test is only for Windows Mobile");
-
- QProcess process;
- process.start("testQMenuBar.exe");
- QCOMPARE(process.state(), QProcess::Running);
- QTest::qWait(6000);
- openMenu();
- QTest::qWait(1000);
- takeScreenShot("testQMenuBar_current.png");
- process.close();
- compareScreenshots("testQMenuBar_current.png", ":/testQMenuBar_current.png");
-}
-
-void tst_WindowsMobile::testSimpleWidget()
-{
- if (qt_wince_is_smartphone())
- QSKIP("This test is only for Windows Mobile");
-
- QMenuBar menubar;
- menubar.show();
- QWidget maximized;
- QPalette pal = maximized.palette();
- pal.setColor(QPalette::Background, Qt::red);
- maximized.setPalette(pal);
- maximized.showMaximized();
- QWidget widget;
- widget.setGeometry(100, 100, 200, 200);
- widget.setWindowTitle("Widget");
- widget.show();
- qApp->processEvents();
- QTest::qWait(1000);
-
- QWidget widget2;
- widget2.setGeometry(100, 380, 300, 200);
- widget2.setWindowTitle("Widget 2");
- widget2.setWindowFlags(Qt::Popup);
- widget2.show();
-
- qApp->processEvents();
- QTest::qWait(1000);
- takeScreenShot("testSimpleWidget_current.png");
- compareScreenshots("testSimpleWidget_current.png", ":/testSimpleWidget_current.png");
-}
-
-
-#endif //Q_OS_WINCE_WM
-
-
-QTEST_MAIN(tst_WindowsMobile)
-#include "tst_windowsmobile.moc"
-
diff --git a/tests/auto/other/windowsmobile/test/windowsmobile.qrc b/tests/auto/other/windowsmobile/test/windowsmobile.qrc
deleted file mode 100644
index 5d6f61459e..0000000000
--- a/tests/auto/other/windowsmobile/test/windowsmobile.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>testQMenuBar_current.png</file>
- <file>testSimpleWidget_current.png</file>
-</qresource>
-</RCC>
diff --git a/tests/auto/other/windowsmobile/testQMenuBar/main.cpp b/tests/auto/other/windowsmobile/testQMenuBar/main.cpp
deleted file mode 100644
index 8d9071ff72..0000000000
--- a/tests/auto/other/windowsmobile/testQMenuBar/main.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtCore/QDate>
-#include <QtCore/QDebug>
-#include <QtCore/QObject>
-#include <QtGui>
-#include <windows.h>
-
-int main(int argc, char * argv[])
-{
- QList<QWidget*> widgets;
- QApplication app(argc, argv);
-
- QMainWindow mainWindow;
- mainWindow.setWindowTitle("Test");
- QMenu *fileMenu = mainWindow.menuBar()->addMenu("File");
- QMenu *editMenu = mainWindow.menuBar()->addMenu("Edit");
- QMenu *viewMenu = mainWindow.menuBar()->addMenu("View");
- QMenu *toolsMenu = mainWindow.menuBar()->addMenu("Tools");
- QMenu *optionsMenu = mainWindow.menuBar()->addMenu("Options");
- QMenu *helpMenu = mainWindow.menuBar()->addMenu("Help");
-
- qApp->processEvents();
-
- fileMenu->addAction("Open");
- QAction *close = fileMenu->addAction("Close");
- fileMenu->addSeparator();
- fileMenu->addAction("Exit");
-
- close->setEnabled(false);
-
- editMenu->addAction("Cut");
- editMenu->addAction("Pase");
- editMenu->addAction("Copy");
- editMenu->addSeparator();
- editMenu->addAction("Find");
-
- viewMenu->addAction("Hide");
- viewMenu->addAction("Show");
- viewMenu->addAction("Explore");
- QAction *visible = viewMenu->addAction("Visible");
- visible->setCheckable(true);
- visible->setChecked(true);
-
- toolsMenu->addMenu("Hammer");
- toolsMenu->addMenu("Caliper");
- toolsMenu->addMenu("Helm");
-
- optionsMenu->addMenu("Settings");
- optionsMenu->addMenu("Standard");
- optionsMenu->addMenu("Extended");
-
- QMenu *subMenu = helpMenu->addMenu("Help");
- subMenu->addAction("Index");
- subMenu->addSeparator();
- subMenu->addAction("Vodoo Help");
- helpMenu->addAction("Contens");
- helpMenu->addSeparator();
- helpMenu->addAction("About");
-
- QToolBar toolbar;
- mainWindow.addToolBar(&toolbar);
- toolbar.addAction(QIcon(qApp->style()->standardPixmap(QStyle::SP_FileIcon)), QString("textAction"));
-
- QTextEdit textEdit;
- mainWindow.setCentralWidget(&textEdit);
-
- mainWindow.showMaximized();
-
- app.exec();
-}
diff --git a/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro b/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro
deleted file mode 100644
index 12ef683c11..0000000000
--- a/tests/auto/other/windowsmobile/testQMenuBar/testQMenuBar.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCES += main.cpp
-QT += widgets
-TARGET = ../testQMenuBar
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/other/windowsmobile/windowsmobile.pro b/tests/auto/other/windowsmobile/windowsmobile.pro
deleted file mode 100644
index 2e6b444d7b..0000000000
--- a/tests/auto/other/windowsmobile/windowsmobile.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-
-TEMPLATE = subdirs
-
-wincewm* {
- SUBDIRS = testQMenuBar
-}
- SUBDIRS += test
-
-
diff --git a/tests/auto/sql/kernel/qsql/qsql.pro b/tests/auto/sql/kernel/qsql/qsql.pro
index 71e2989572..1c7452cd73 100644
--- a/tests/auto/sql/kernel/qsql/qsql.pro
+++ b/tests/auto/sql/kernel/qsql/qsql.pro
@@ -3,9 +3,3 @@ TARGET = tst_qsql
SOURCES += tst_qsql.cpp
QT = core-private sql-private testlib
-
-wince {
- DEPLOYMENT_PLUGIN += qsqlite
-}
-mingw: LIBS += -lws2_32
-
diff --git a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro
index 7da5b8bc8e..9ee414bf34 100644
--- a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro
+++ b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro
@@ -3,17 +3,3 @@ TARGET = tst_qsqldatabase
SOURCES += tst_qsqldatabase.cpp
QT = core sql testlib core-private sql-private
-
-win32: {
- !wince: LIBS += -lws2_32
- else: LIBS += -lws2
-}
-
-wince {
- DEPLOYMENT_PLUGIN += qsqlite
-
- testData.files = testdata
- testData.path = .
-
- DEPLOYMENT += testData
-}
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
index 389d3abf85..701da7d346 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
@@ -43,20 +43,6 @@
#include <QtSql/private/qsqldriver_p.h>
#include <QtTest/QtTest>
-#if defined(Q_OS_WIN)
-# include <qt_windows.h>
-# if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
-# include <winsock2.h>
-# endif
-#else
-#include <unistd.h>
-#endif
-#if defined(Q_OS_WINRT)
- static inline int qgethostname(char *name, int) { qstrcpy(name, "localhost"); return 9; }
-#else
-# define qgethostname gethostname
-#endif
-
#define CHECK_DATABASE( db ) \
if ( !db.isValid() ) { qFatal( "db is Invalid" ); }
@@ -71,16 +57,10 @@ static QString qGetHostName()
{
static QString hostname;
- if ( !hostname.isEmpty() )
- return hostname;
-
- char hn[257];
-
- if ( qgethostname( hn, 255 ) == 0 ) {
- hn[256] = '\0';
- hostname = QString::fromLatin1( hn );
- hostname.replace( QLatin1Char( '.' ), QLatin1Char( '_' ) );
- hostname.replace( QLatin1Char( '-' ), QLatin1Char( '_' ) );
+ if (hostname.isEmpty()) {
+ hostname = QSysInfo::machineHostName();
+ hostname.replace(QLatin1Char( '.' ), QLatin1Char( '_' ));
+ hostname.replace(QLatin1Char( '-' ), QLatin1Char( '_' ));
}
return hostname;
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
index bd8fbcca0e..8126e72ad2 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
@@ -100,6 +100,8 @@ private slots:
void eventNotificationIBase();
void eventNotificationPSQL_data() { generic_data("QPSQL"); }
void eventNotificationPSQL();
+ void eventNotificationSQLite_data() { generic_data("QSQLITE"); }
+ void eventNotificationSQLite();
//database specific 64 bit integer test
void bigIntField_data() { generic_data(); }
@@ -2109,6 +2111,35 @@ void tst_QSqlDatabase::eventNotificationPSQL()
QVERIFY_SQL(driver, unsubscribeFromNotification(procedureName));
}
+void tst_QSqlDatabase::eventNotificationSQLite()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+ if (db.driverName().compare(QLatin1String("QSQLITE"), Qt::CaseInsensitive)) {
+ QSKIP("QSQLITE specific test");
+ }
+ const QString tableName(qTableName("sqlitnotifytest", __FILE__, db));
+ tst_Databases::safeDropTable(db, tableName);
+
+ QSignalSpy notificationSpy(db.driver(), SIGNAL(notification(QString)));
+ QSignalSpy notificationSpyExt(db.driver(), SIGNAL(notification(QString,QSqlDriver::NotificationSource,QVariant)));
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INTEGER, realVal REAL)"));
+ db.driver()->subscribeToNotification(tableName);
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)"));
+ QTRY_COMPARE(notificationSpy.count(), 1);
+ QTRY_COMPARE(notificationSpyExt.count(), 1);
+ QList<QVariant> arguments = notificationSpy.takeFirst();
+ QCOMPARE(arguments.at(0).toString(), tableName);
+ arguments = notificationSpyExt.takeFirst();
+ QCOMPARE(arguments.at(0).toString(), tableName);
+ db.driver()->unsubscribeFromNotification(tableName);
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)"));
+ QTRY_COMPARE(notificationSpy.count(), 0);
+ QTRY_COMPARE(notificationSpyExt.count(), 0);
+}
+
void tst_QSqlDatabase::sqlite_bindAndFetchUInt()
{
QFETCH(QString, dbName);
diff --git a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro
index 8bfe1da1ce..772dc89177 100644
--- a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro
+++ b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro
@@ -3,16 +3,3 @@ TARGET = tst_qsqldriver
SOURCES += tst_qsqldriver.cpp
QT = core sql testlib core-private sql-private
-
-wince {
- plugFiles.files = ../../../plugins/sqldrivers
- plugFiles.path = .
- DEPLOYMENT += plugFiles
- LIBS += -lws2
-} else {
- mingw {
- LIBS += -lws2_32
- } else:win32 {
- LIBS += ws2_32.lib
- }
-}
diff --git a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro
index a6be23892d..c7638f9c0b 100644
--- a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro
+++ b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro
@@ -4,12 +4,3 @@ CONFIG += testcase
SOURCES += tst_qsqlquery.cpp
QT = core sql testlib core-private sql-private
-
-win32:!wince: LIBS += -lws2_32
-
-wince {
- plugFiles.files = ../../../plugins/sqldrivers
- plugFiles.path = .
- DEPLOYMENT += plugFiles
- LIBS += -lws2
-}
diff --git a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro
index 64d8c5ccfb..32e0f2228f 100644
--- a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro
+++ b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro
@@ -3,14 +3,3 @@ TARGET = tst_qsqlthread
SOURCES += tst_qsqlthread.cpp
QT = core sql testlib core-private sql-private
-
-
-wince {
- plugFiles.files = ../../../plugins/sqldrivers
- plugFiles.path = .
- DEPLOYMENT += plugFiles
- LIBS += -lws2
-} else {
- win32:LIBS += -lws2_32
-}
-
diff --git a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro
index 2576fbad71..05eb871694 100644
--- a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro
+++ b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro
@@ -3,11 +3,3 @@ TARGET = tst_qsqlquerymodel
SOURCES += tst_qsqlquerymodel.cpp
QT += widgets sql testlib core-private sql-private
-
-wince {
- DEPLOYMENT_PLUGIN += qsqlite
- LIBS += -lws2
-} else {
- win32:LIBS += -lws2_32
-}
-
diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
index cade7c171d..5695c06b29 100644
--- a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
+++ b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
@@ -3,16 +3,3 @@ TARGET = tst_qsqlrelationaltablemodel
SOURCES += tst_qsqlrelationaltablemodel.cpp
QT = core sql testlib core-private sql-private
-
-wince {
- plugFiles.files = ../../../plugins/sqldrivers
- plugFiles.path = .
- DEPLOYMENT += plugFiles
- LIBS += -lws2
-} else {
- mingw {
- LIBS += -lws2_32
- } else:win32 {
- LIBS += ws2_32.lib
- }
-}
diff --git a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro
index 2af39b341f..958f0507bf 100644
--- a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro
+++ b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro
@@ -3,13 +3,3 @@ TARGET = tst_qsqltablemodel
SOURCES += tst_qsqltablemodel.cpp
QT = core core-private sql sql-private testlib
-
-wince {
- plugFiles.files = ../../../plugins/sqldrivers
- plugFiles.path = .
- DEPLOYMENT += plugFiles
- LIBS += -lws2
-} else {
- win32:LIBS += -lws2_32
-}
-
diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
index 3586b7f420..97eb19599b 100644
--- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
+++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
@@ -128,6 +128,7 @@ private slots:
void compare_registered_enums();
void compare_class_enums();
void compare_boolfuncs();
+ void compare_to_nullptr();
void compare_pointerfuncs();
void compare_tostring();
void compare_tostring_data();
@@ -148,6 +149,7 @@ private slots:
void verify2();
void tryVerify();
void tryVerify2();
+ void verifyExplicitOperatorBool();
};
enum MyUnregisteredEnum { MyUnregisteredEnumValue1, MyUnregisteredEnumValue2 };
@@ -183,6 +185,24 @@ void tst_Cmptest::compare_boolfuncs()
QCOMPARE(!boolfunc(), false);
}
+namespace {
+template <typename T>
+T *null() Q_DECL_NOTHROW { return nullptr; }
+}
+
+void tst_Cmptest::compare_to_nullptr()
+{
+ QCOMPARE(null<int>(), nullptr);
+ QCOMPARE(null<const int>(), nullptr);
+ QCOMPARE(null<volatile int>(), nullptr);
+ QCOMPARE(null<const volatile int>(), nullptr);
+
+ QCOMPARE(nullptr, null<int>());
+ QCOMPARE(nullptr, null<const int>());
+ QCOMPARE(nullptr, null<volatile int>());
+ QCOMPARE(nullptr, null<const volatile int>());
+}
+
static int i = 0;
static int *intptr() { return &i; }
@@ -465,5 +485,21 @@ void tst_Cmptest::tryVerify2()
QTRY_VERIFY2_WITH_TIMEOUT(opaqueFunc() < 2, QByteArray::number(opaqueFunc()).constData(), 1);
}
+void tst_Cmptest::verifyExplicitOperatorBool()
+{
+ struct ExplicitOperatorBool {
+ int m_i;
+ explicit ExplicitOperatorBool(int i) : m_i(i) {}
+ explicit operator bool() const { return m_i > 0; }
+ bool operator !() const { return !bool(*this); }
+ };
+
+ ExplicitOperatorBool val1(42);
+ QVERIFY(val1);
+
+ ExplicitOperatorBool val2(-273);
+ QVERIFY(!val2);
+}
+
QTEST_MAIN(tst_Cmptest)
#include "tst_cmptest.moc"
diff --git a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp
index 6cfa023b7e..87b241f5e5 100644
--- a/tests/auto/testlib/selftests/crashes/tst_crashes.cpp
+++ b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp
@@ -44,7 +44,7 @@ private slots:
void tst_Crashes::crash()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
//we avoid the error dialogbox to appear on windows
SetErrorMode( SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
#endif
diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml
index a66413dfa0..621aceb887 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.lightxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml
@@ -8,13 +8,13 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_unregistered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="158">
+<Incident type="fail" file="tst_cmptest.cpp" line="160">
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_registered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="165">
+<Incident type="fail" file="tst_cmptest.cpp" line="167">
<Description><![CDATA[Compared values are not the same
Actual (Qt::Monday): Monday
Expected (Qt::Sunday): Sunday]]></Description>
@@ -22,7 +22,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_class_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="171">
+<Incident type="fail" file="tst_cmptest.cpp" line="173">
<Description><![CDATA[Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description>
@@ -33,12 +33,16 @@
<Incident type="pass" file="" line="0" />
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compare_to_nullptr">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="compare_pointerfuncs">
<Incident type="pass" file="" line="0" />
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_tostring">
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123)
@@ -47,19 +51,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@@ -74,31 +78,31 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1
@@ -107,7 +111,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListInt">
-<Incident type="fail" file="tst_cmptest.cpp" line="343">
+<Incident type="fail" file="tst_cmptest.cpp" line="363">
<Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4]]></Description>
@@ -115,7 +119,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListDouble">
-<Incident type="fail" file="tst_cmptest.cpp" line="350">
+<Incident type="fail" file="tst_cmptest.cpp" line="370">
<Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1]]></Description>
@@ -123,7 +127,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQColor">
-<Incident type="fail" file="tst_cmptest.cpp" line="360">
+<Incident type="fail" file="tst_cmptest.cpp" line="380">
<Description><![CDATA[Compared values are not the same
Actual (yellow): #ffff00
Expected (green) : #00ff00]]></Description>
@@ -134,13 +138,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0
@@ -149,13 +153,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -165,13 +169,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0
@@ -180,19 +184,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -202,7 +206,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal-empty]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="435">
+<Incident type="fail" file="tst_cmptest.cpp" line="455">
<DataTag><![CDATA[1-empty]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -211,7 +215,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="435">
+<Incident type="fail" file="tst_cmptest.cpp" line="455">
<DataTag><![CDATA[different lists]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -220,29 +224,33 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify">
-<Incident type="fail" file="tst_cmptest.cpp" line="447">
+<Incident type="fail" file="tst_cmptest.cpp" line="467">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="453">
+<Incident type="fail" file="tst_cmptest.cpp" line="473">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
-<Incident type="fail" file="tst_cmptest.cpp" line="459">
+<Incident type="fail" file="tst_cmptest.cpp" line="479">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="465">
+<Incident type="fail" file="tst_cmptest.cpp" line="485">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="verifyExplicitOperatorBool">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="cleanupTestCase">
<Incident type="pass" file="" line="0" />
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity
index 925acb37fe..8801e05e6e 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.teamcity
+++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity
@@ -2,117 +2,121 @@
##teamcity[testStarted name='initTestCase()']
##teamcity[testFinished name='initTestCase()']
##teamcity[testStarted name='compare_unregistered_enums()']
-##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(158)|]' details='Compared values are not the same']
+##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(160)|]' details='Compared values are not the same']
##teamcity[testFinished name='compare_unregistered_enums()']
##teamcity[testStarted name='compare_registered_enums()']
-##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(165)|]' details='Compared values are not the same|n Actual (Qt::Monday): Monday|n Expected (Qt::Sunday): Sunday']
+##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(167)|]' details='Compared values are not the same|n Actual (Qt::Monday): Monday|n Expected (Qt::Sunday): Sunday']
##teamcity[testFinished name='compare_registered_enums()']
##teamcity[testStarted name='compare_class_enums()']
-##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: tst_cmptest.cpp(171)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2']
+##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: tst_cmptest.cpp(173)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2']
##teamcity[testFinished name='compare_class_enums()']
##teamcity[testStarted name='compare_boolfuncs()']
##teamcity[testFinished name='compare_boolfuncs()']
+##teamcity[testStarted name='compare_to_nullptr()']
+##teamcity[testFinished name='compare_to_nullptr()']
##teamcity[testStarted name='compare_pointerfuncs()']
##teamcity[testFinished name='compare_pointerfuncs()']
##teamcity[testStarted name='compare_tostring(int, string)']
-##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)']
+##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)']
##teamcity[testFinished name='compare_tostring(int, string)']
##teamcity[testStarted name='compare_tostring(both invalid)']
##teamcity[testFinished name='compare_tostring(both invalid)']
##teamcity[testStarted name='compare_tostring(null hash, invalid)']
-##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()']
+##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()']
##teamcity[testFinished name='compare_tostring(null hash, invalid)']
##teamcity[testStarted name='compare_tostring(string, null user type)']
-##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)']
+##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)']
##teamcity[testFinished name='compare_tostring(string, null user type)']
##teamcity[testStarted name='compare_tostring(both non-null user type)']
-##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: tst_cmptest.cpp(242)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,<value not representable as string>)|n Expected (expected): QVariant(PhonyClass,<value not representable as string>)']
+##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,<value not representable as string>)|n Expected (expected): QVariant(PhonyClass,<value not representable as string>)']
##teamcity[testFinished name='compare_tostring(both non-null user type)']
##teamcity[testStarted name='compareQStringLists(empty lists)']
##teamcity[testFinished name='compareQStringLists(empty lists)']
##teamcity[testStarted name='compareQStringLists(equal lists)']
##teamcity[testFinished name='compareQStringLists(equal lists)']
##teamcity[testStarted name='compareQStringLists(last item different)']
-##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
+##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
##teamcity[testFinished name='compareQStringLists(last item different)']
##teamcity[testStarted name='compareQStringLists(second-last item different)']
-##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
+##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"']
##teamcity[testFinished name='compareQStringLists(second-last item different)']
##teamcity[testStarted name='compareQStringLists(prefix)']
-##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1']
+##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1']
##teamcity[testFinished name='compareQStringLists(prefix)']
##teamcity[testStarted name='compareQStringLists(short list second)']
-##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1']
+##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1']
##teamcity[testFinished name='compareQStringLists(short list second)']
##teamcity[testStarted name='compareQStringLists(short list first)']
-##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: tst_cmptest.cpp(336)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12']
+##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12']
##teamcity[testFinished name='compareQStringLists(short list first)']
##teamcity[testStarted name='compareQListInt()']
-##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: tst_cmptest.cpp(343)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4']
+##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: tst_cmptest.cpp(363)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4']
##teamcity[testFinished name='compareQListInt()']
##teamcity[testStarted name='compareQListDouble()']
-##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: tst_cmptest.cpp(350)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1']
+##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: tst_cmptest.cpp(370)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1']
##teamcity[testFinished name='compareQListDouble()']
##teamcity[testStarted name='compareQColor()']
-##teamcity[testFailed name='compareQColor()' message='Failure! |[Loc: tst_cmptest.cpp(360)|]' details='Compared values are not the same|n Actual (yellow): #ffff00|n Expected (green) : #00ff00']
+##teamcity[testFailed name='compareQColor()' message='Failure! |[Loc: tst_cmptest.cpp(380)|]' details='Compared values are not the same|n Actual (yellow): #ffff00|n Expected (green) : #00ff00']
##teamcity[testFinished name='compareQColor()']
##teamcity[testStarted name='compareQPixmaps(both null)']
##teamcity[testFinished name='compareQPixmaps(both null)']
##teamcity[testStarted name='compareQPixmaps(one null)']
-##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
+##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
##teamcity[testFinished name='compareQPixmaps(one null)']
##teamcity[testStarted name='compareQPixmaps(other null)']
-##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
+##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
##teamcity[testFinished name='compareQPixmaps(other null)']
##teamcity[testStarted name='compareQPixmaps(equal)']
##teamcity[testFinished name='compareQPixmaps(equal)']
##teamcity[testStarted name='compareQPixmaps(different size)']
-##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
+##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
##teamcity[testFinished name='compareQPixmaps(different size)']
##teamcity[testStarted name='compareQPixmaps(different pixels)']
-##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(385)|]' details='Compared values are not the same']
+##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared values are not the same']
##teamcity[testFinished name='compareQPixmaps(different pixels)']
##teamcity[testStarted name='compareQImages(both null)']
##teamcity[testFinished name='compareQImages(both null)']
##teamcity[testStarted name='compareQImages(one null)']
-##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
+##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0']
##teamcity[testFinished name='compareQImages(one null)']
##teamcity[testStarted name='compareQImages(other null)']
-##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
+##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1']
##teamcity[testFinished name='compareQImages(other null)']
##teamcity[testStarted name='compareQImages(equal)']
##teamcity[testFinished name='compareQImages(equal)']
##teamcity[testStarted name='compareQImages(different size)']
-##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
+##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20']
##teamcity[testFinished name='compareQImages(different size)']
##teamcity[testStarted name='compareQImages(different format)']
-##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3']
+##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3']
##teamcity[testFinished name='compareQImages(different format)']
##teamcity[testStarted name='compareQImages(different pixels)']
-##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(412)|]' details='Compared values are not the same']
+##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared values are not the same']
##teamcity[testFinished name='compareQImages(different pixels)']
##teamcity[testStarted name='compareQRegion(equal-empty)']
##teamcity[testFinished name='compareQRegion(equal-empty)']
##teamcity[testStarted name='compareQRegion(1-empty)']
-##teamcity[testFailed name='compareQRegion(1-empty)' message='Failure! |[Loc: tst_cmptest.cpp(435)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(null)']
+##teamcity[testFailed name='compareQRegion(1-empty)' message='Failure! |[Loc: tst_cmptest.cpp(455)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(null)']
##teamcity[testFinished name='compareQRegion(1-empty)']
##teamcity[testStarted name='compareQRegion(equal)']
##teamcity[testFinished name='compareQRegion(equal)']
##teamcity[testStarted name='compareQRegion(different lists)']
-##teamcity[testFailed name='compareQRegion(different lists)' message='Failure! |[Loc: tst_cmptest.cpp(435)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)']
+##teamcity[testFailed name='compareQRegion(different lists)' message='Failure! |[Loc: tst_cmptest.cpp(455)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)']
##teamcity[testFinished name='compareQRegion(different lists)']
##teamcity[testStarted name='verify()']
-##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(447)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
+##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(467)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
##teamcity[testFinished name='verify()']
##teamcity[testStarted name='verify2()']
-##teamcity[testFailed name='verify2()' message='Failure! |[Loc: tst_cmptest.cpp(453)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
+##teamcity[testFailed name='verify2()' message='Failure! |[Loc: tst_cmptest.cpp(473)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
##teamcity[testFinished name='verify2()']
##teamcity[testStarted name='tryVerify()']
-##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: tst_cmptest.cpp(459)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
+##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: tst_cmptest.cpp(479)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()']
##teamcity[testFinished name='tryVerify()']
##teamcity[testStarted name='tryVerify2()']
-##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: tst_cmptest.cpp(465)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
+##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: tst_cmptest.cpp(485)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)']
##teamcity[testFinished name='tryVerify2()']
+##teamcity[testStarted name='verifyExplicitOperatorBool()']
+##teamcity[testFinished name='verifyExplicitOperatorBool()']
##teamcity[testStarted name='cleanupTestCase()']
##teamcity[testFinished name='cleanupTestCase()']
##teamcity[testSuiteFinished name='tst_Cmptest']
diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt
index c7094a4113..9c7f56e6c3 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.txt
+++ b/tests/auto/testlib/selftests/expected_cmptest.txt
@@ -2,122 +2,124 @@
Config: Using QtTest library
PASS : tst_Cmptest::initTestCase()
FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same
- Loc: [tst_cmptest.cpp(158)]
+ Loc: [tst_cmptest.cpp(160)]
FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same
Actual (Qt::Monday): Monday
Expected (Qt::Sunday): Sunday
- Loc: [tst_cmptest.cpp(165)]
+ Loc: [tst_cmptest.cpp(167)]
FAIL! : tst_Cmptest::compare_class_enums() Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2
- Loc: [tst_cmptest.cpp(171)]
+ Loc: [tst_cmptest.cpp(173)]
PASS : tst_Cmptest::compare_boolfuncs()
+PASS : tst_Cmptest::compare_to_nullptr()
PASS : tst_Cmptest::compare_pointerfuncs()
FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same
Actual (actual) : QVariant(int,123)
Expected (expected): QVariant(QString,hi)
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(262)]
PASS : tst_Cmptest::compare_tostring(both invalid)
FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(262)]
FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(262)]
FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
Expected (expected): QVariant(PhonyClass,<value not representable as string>)
- Loc: [tst_cmptest.cpp(242)]
+ Loc: [tst_cmptest.cpp(262)]
PASS : tst_Cmptest::compareQStringLists(empty lists)
PASS : tst_Cmptest::compareQStringLists(equal lists)
FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(356)]
FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(356)]
FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(356)]
FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(356)]
FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes.
Actual (opA) size: 1
Expected (opB) size: 12
- Loc: [tst_cmptest.cpp(336)]
+ Loc: [tst_cmptest.cpp(356)]
FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4
- Loc: [tst_cmptest.cpp(343)]
+ Loc: [tst_cmptest.cpp(363)]
FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1
- Loc: [tst_cmptest.cpp(350)]
+ Loc: [tst_cmptest.cpp(370)]
FAIL! : tst_Cmptest::compareQColor() Compared values are not the same
Actual (yellow): #ffff00
Expected (green) : #00ff00
- Loc: [tst_cmptest.cpp(360)]
+ Loc: [tst_cmptest.cpp(380)]
PASS : tst_Cmptest::compareQPixmaps(both null)
FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0
- Loc: [tst_cmptest.cpp(385)]
+ Loc: [tst_cmptest.cpp(405)]
FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ.
Actual (opA).isNull(): 0
Expected (opB).isNull(): 1
- Loc: [tst_cmptest.cpp(385)]
+ Loc: [tst_cmptest.cpp(405)]
PASS : tst_Cmptest::compareQPixmaps(equal)
FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20
- Loc: [tst_cmptest.cpp(385)]
+ Loc: [tst_cmptest.cpp(405)]
FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same
- Loc: [tst_cmptest.cpp(385)]
+ Loc: [tst_cmptest.cpp(405)]
PASS : tst_Cmptest::compareQImages(both null)
FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0
- Loc: [tst_cmptest.cpp(412)]
+ Loc: [tst_cmptest.cpp(432)]
FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ.
Actual (opA).isNull(): 0
Expected (opB).isNull(): 1
- Loc: [tst_cmptest.cpp(412)]
+ Loc: [tst_cmptest.cpp(432)]
PASS : tst_Cmptest::compareQImages(equal)
FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20
- Loc: [tst_cmptest.cpp(412)]
+ Loc: [tst_cmptest.cpp(432)]
FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3
- Loc: [tst_cmptest.cpp(412)]
+ Loc: [tst_cmptest.cpp(432)]
FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same
- Loc: [tst_cmptest.cpp(412)]
+ Loc: [tst_cmptest.cpp(432)]
PASS : tst_Cmptest::compareQRegion(equal-empty)
FAIL! : tst_Cmptest::compareQRegion(1-empty) Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
Expected (rB): QRegion(null)
- Loc: [tst_cmptest.cpp(435)]
+ Loc: [tst_cmptest.cpp(455)]
PASS : tst_Cmptest::compareQRegion(equal)
FAIL! : tst_Cmptest::compareQRegion(different lists) Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)
- Loc: [tst_cmptest.cpp(435)]
+ Loc: [tst_cmptest.cpp(455)]
FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. ()
- Loc: [tst_cmptest.cpp(447)]
+ Loc: [tst_cmptest.cpp(467)]
FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42)
- Loc: [tst_cmptest.cpp(453)]
+ Loc: [tst_cmptest.cpp(473)]
FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. ()
- Loc: [tst_cmptest.cpp(459)]
+ Loc: [tst_cmptest.cpp(479)]
FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42)
- Loc: [tst_cmptest.cpp(465)]
+ Loc: [tst_cmptest.cpp(485)]
+PASS : tst_Cmptest::verifyExplicitOperatorBool()
PASS : tst_Cmptest::cleanupTestCase()
-Totals: 13 passed, 30 failed, 0 skipped, 0 blacklisted, 246ms
+Totals: 15 passed, 30 failed, 0 skipped, 0 blacklisted, 244ms
********* Finished testing of tst_Cmptest *********
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml
index d472840e98..f64ffe3792 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xml
@@ -10,13 +10,13 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_unregistered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="158">
+<Incident type="fail" file="tst_cmptest.cpp" line="160">
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_registered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="165">
+<Incident type="fail" file="tst_cmptest.cpp" line="167">
<Description><![CDATA[Compared values are not the same
Actual (Qt::Monday): Monday
Expected (Qt::Sunday): Sunday]]></Description>
@@ -24,7 +24,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_class_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="171">
+<Incident type="fail" file="tst_cmptest.cpp" line="173">
<Description><![CDATA[Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description>
@@ -35,12 +35,16 @@
<Incident type="pass" file="" line="0" />
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compare_to_nullptr">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="compare_pointerfuncs">
<Incident type="pass" file="" line="0" />
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_tostring">
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123)
@@ -49,19 +53,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="242">
+<Incident type="fail" file="tst_cmptest.cpp" line="262">
<DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@@ -76,31 +80,31 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="336">
+<Incident type="fail" file="tst_cmptest.cpp" line="356">
<DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1
@@ -109,7 +113,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListInt">
-<Incident type="fail" file="tst_cmptest.cpp" line="343">
+<Incident type="fail" file="tst_cmptest.cpp" line="363">
<Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4]]></Description>
@@ -117,7 +121,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListDouble">
-<Incident type="fail" file="tst_cmptest.cpp" line="350">
+<Incident type="fail" file="tst_cmptest.cpp" line="370">
<Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1]]></Description>
@@ -125,7 +129,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQColor">
-<Incident type="fail" file="tst_cmptest.cpp" line="360">
+<Incident type="fail" file="tst_cmptest.cpp" line="380">
<Description><![CDATA[Compared values are not the same
Actual (yellow): #ffff00
Expected (green) : #00ff00]]></Description>
@@ -136,13 +140,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0
@@ -151,13 +155,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="385">
+<Incident type="fail" file="tst_cmptest.cpp" line="405">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -167,13 +171,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0
@@ -182,19 +186,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="412">
+<Incident type="fail" file="tst_cmptest.cpp" line="432">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -204,7 +208,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal-empty]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="435">
+<Incident type="fail" file="tst_cmptest.cpp" line="455">
<DataTag><![CDATA[1-empty]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -213,7 +217,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="435">
+<Incident type="fail" file="tst_cmptest.cpp" line="455">
<DataTag><![CDATA[different lists]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -222,29 +226,33 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify">
-<Incident type="fail" file="tst_cmptest.cpp" line="447">
+<Incident type="fail" file="tst_cmptest.cpp" line="467">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="453">
+<Incident type="fail" file="tst_cmptest.cpp" line="473">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
-<Incident type="fail" file="tst_cmptest.cpp" line="459">
+<Incident type="fail" file="tst_cmptest.cpp" line="479">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="465">
+<Incident type="fail" file="tst_cmptest.cpp" line="485">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="verifyExplicitOperatorBool">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="cleanupTestCase">
<Incident type="pass" file="" line="0" />
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
index 9f1726b0d6..de47ac97f5 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<testsuite errors="0" failures="30" tests="19" name="tst_Cmptest">
+<testsuite errors="0" failures="30" tests="21" name="tst_Cmptest">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
@@ -20,6 +20,7 @@
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2" result="fail"/>
</testcase>
<testcase result="pass" name="compare_boolfuncs"/>
+ <testcase result="pass" name="compare_to_nullptr"/>
<testcase result="pass" name="compare_pointerfuncs"/>
<testcase result="fail" name="compare_tostring">
<failure tag="int, string" message="Compared values are not the same
@@ -114,6 +115,7 @@
<testcase result="fail" name="tryVerify2">
<failure message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. (42)" result="fail"/>
</testcase>
+ <testcase result="pass" name="verifyExplicitOperatorBool"/>
<testcase result="pass" name="cleanupTestCase"/>
<system-err/>
</testsuite>
diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro
index 688799048f..d2b750bdc5 100644
--- a/tests/auto/tools/moc/moc.pro
+++ b/tests/auto/tools/moc/moc.pro
@@ -28,7 +28,8 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n
qtbug-35657-gadget.h \
non-gadget-parent-class.h grand-parent-gadget-class.h \
related-metaobjects-in-gadget.h \
- related-metaobjects-name-conflict.h
+ related-metaobjects-name-conflict.h \
+ namespace.h
if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h
diff --git a/tests/auto/tools/moc/namespace.h b/tests/auto/tools/moc/namespace.h
new file mode 100644
index 0000000000..6e04831589
--- /dev/null
+++ b/tests/auto/tools/moc/namespace.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef NAMESPACE_H
+#define NAMESPACE_H
+
+#include <QObject>
+
+#include "namespace_no_merge.h"
+// moc should not merge namespace_no_merge.h content with this one !
+
+namespace FooNamespace {
+ Q_NAMESPACE
+ enum class Enum1 {
+ Key1,
+ Key2
+ };
+ Q_ENUM_NS(Enum1)
+
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class Enum2 {
+ Key3,
+ Key4
+ };
+ Q_ENUM_NS(Enum2)
+ }
+
+ using namespace FooNamespace;
+ namespace Bar = FooNamespace;
+
+ // Moc should merge this namespace with the previous one
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class Enum3 {
+ Key5,
+ Key6
+ };
+ Q_ENUM_NS(Enum3)
+
+ namespace FooMoreNestedNamespace {
+ Q_NAMESPACE
+ enum class Enum4 {
+ Key7,
+ Key8
+ };
+ Q_ENUM_NS(Enum4)
+ }
+ }
+}
+
+#endif // NAMESPACE_H
diff --git a/tests/auto/qtest-config.h b/tests/auto/tools/moc/namespace_no_merge.h
index b3696a1456..8d1639ad4c 100644
--- a/tests/auto/qtest-config.h
+++ b/tests/auto/tools/moc/namespace_no_merge.h
@@ -26,15 +26,49 @@
**
****************************************************************************/
-#ifndef QTEST_CONFIG_H
-#define QTEST_CONFIG_H
+#ifndef NAMESPACE_NO_MERGE_H
+#define NAMESPACE_NO_MERGE_H
-#include <qglobal.h>
+#include <QObject>
-#ifndef QTEST_NO_CURSOR
-# if defined(QT_NO_CURSOR) || defined(Q_OS_WINCE) || defined(MEEGO_EDITION_HARMATTAN)
-# define QTEST_NO_CURSOR
-# endif
-#endif // QTEST_NO_CURSOR
+namespace FooNamespace {
+ Q_NAMESPACE
+ enum class MEnum1 {
+ Key1,
+ Key2
+ };
+ Q_ENUM_NS(MEnum1)
-#endif // QTEST_CONFIG_H
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class MEnum2 {
+ Key3,
+ Key4
+ };
+ Q_ENUM_NS(MEnum2)
+ }
+
+ using namespace FooNamespace;
+ namespace Bar = FooNamespace;
+
+ // Moc should merge this namespace with the previous one
+ namespace FooNestedNamespace {
+ Q_NAMESPACE
+ enum class MEnum3 {
+ Key5,
+ Key6
+ };
+ Q_ENUM_NS(MEnum3)
+
+ namespace FooMoreNestedNamespace {
+ Q_NAMESPACE
+ enum class MEnum4 {
+ Key7,
+ Key8
+ };
+ Q_ENUM_NS(MEnum4)
+ }
+ }
+}
+
+#endif // NAMESPACE_NO_MERGE_H
diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h
index 9fb5da4b07..6100bf67ad 100644
--- a/tests/auto/tools/moc/parse-defines.h
+++ b/tests/auto/tools/moc/parse-defines.h
@@ -139,6 +139,9 @@ public slots:
signals:
DEFINE_CMDLINE_SIGNAL;
+#define QTBUG55853(X) PD_DEFINE1(X, signalQTBUG55853)
+#define PD_EMPTY /* empty */
+ void QTBUG55853(PD_EMPTY)();
};
#undef QString
diff --git a/tests/auto/tools/moc/subdir/extradefines.h b/tests/auto/tools/moc/subdir/extradefines.h
new file mode 100644
index 0000000000..e7888ce80d
--- /dev/null
+++ b/tests/auto/tools/moc/subdir/extradefines.h
@@ -0,0 +1 @@
+#define FOO 1
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index b49d7bc477..ecf6c7e992 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -69,9 +69,83 @@
#include "non-gadget-parent-class.h"
#include "grand-parent-gadget-class.h"
+#include "namespace.h"
+
+#ifdef Q_MOC_RUN
+// check that moc can parse these constructs, they are being used in Windows winsock2.h header
+#define STRING_HASH_HASH(x) ("foo" ## x ## "bar")
+const char *string_hash_hash = STRING_HASH_HASH("baz");
+#endif
Q_DECLARE_METATYPE(const QMetaObject*);
+namespace TestNonQNamespace {
+
+struct TestGadget {
+ Q_GADGET
+ Q_CLASSINFO("key", "value")
+public:
+ enum class TestGEnum1 {
+ Key1 = 11,
+ Key2
+ };
+ Q_ENUM(TestGEnum1)
+
+ enum class TestGEnum2 {
+ Key1 = 17,
+ Key2
+ };
+ Q_ENUM(TestGEnum2)
+};
+
+}
+
+namespace TestQNamespace {
+ Q_NAMESPACE
+ enum class TestEnum1 {
+ Key1 = 11,
+ Key2
+ };
+ Q_ENUM_NS(TestEnum1)
+
+ enum class TestEnum2 {
+ Key1 = 17,
+ Key2
+ };
+ Q_ENUM_NS(TestEnum2)
+
+ // try to dizzy moc by adding a struct in between
+ struct TestGadget {
+ Q_GADGET
+ public:
+ enum class TestGEnum1 {
+ Key1 = 13,
+ Key2
+ };
+ enum class TestGEnum2 {
+ Key1 = 23,
+ Key2
+ };
+ Q_ENUM(TestGEnum1)
+ Q_ENUM(TestGEnum2)
+ };
+
+ enum class TestFlag1 {
+ None = 0,
+ Flag1 = 1,
+ Flag2 = 2,
+ Any = Flag1 | Flag2
+ };
+ Q_FLAG_NS(TestFlag1)
+
+ enum class TestFlag2 {
+ None = 0,
+ Flag1 = 4,
+ Flag2 = 8,
+ Any = Flag1 | Flag2
+ };
+ Q_FLAG_NS(TestFlag2)
+}
QT_USE_NAMESPACE
@@ -489,13 +563,6 @@ public:
Q_ENUMS(EnumSourceClass::TestEnum)
};
-#if defined(Q_MOC_RUN)
-// Task #119503
-#define _TASK_119503
-#if !_TASK_119503
-#endif
-#endif
-
class CtorTestClass : public QObject
{
Q_OBJECT
@@ -576,6 +643,10 @@ private slots:
void frameworkSearchPath();
void cstyleEnums();
void defineMacroViaCmdline();
+ void defineMacroViaForcedInclude();
+ void defineMacroViaForcedIncludeRelative();
+ void environmentIncludePaths_data();
+ void environmentIncludePaths();
void specifyMetaTagsFromCmdline();
void invokable();
void singleFunctionKeywordSignalAndSlot();
@@ -624,6 +695,7 @@ private slots:
void gadgetHierarchy();
void optionsFileError_data();
void optionsFileError();
+ void testQNamespace();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -1254,6 +1326,92 @@ void tst_Moc::defineMacroViaCmdline()
#endif
}
+void tst_Moc::defineMacroViaForcedInclude()
+{
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
+ QProcess proc;
+
+ QStringList args;
+ args << "--include" << m_sourceDirectory + QLatin1String("/subdir/extradefines.h");
+ args << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h");
+
+ proc.start(m_moc, args);
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+#else
+ QSKIP("Only tested on linux/gcc");
+#endif
+}
+
+void tst_Moc::defineMacroViaForcedIncludeRelative()
+{
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
+ QProcess proc;
+
+ QStringList args;
+ args << "--include" << QStringLiteral("extradefines.h") << "-I" + m_sourceDirectory + "/subdir";
+ args << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h");
+
+ proc.start(m_moc, args);
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+#else
+ QSKIP("Only tested on linux/gcc");
+#endif
+}
+
+
+void tst_Moc::environmentIncludePaths_data()
+{
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
+ QTest::addColumn<QString>("cmdline");
+ QTest::addColumn<QString>("varname");
+
+ QTest::newRow("INCLUDE") << "--compiler-flavor=msvc" << "INCLUDE";
+ QTest::newRow("CPATH1") << QString() << "CPATH";
+ QTest::newRow("CPATH2") << "--compiler-flavor=unix" << "CPATH";
+ QTest::newRow("CPLUS_INCLUDE_PATH1") << QString() << "CPLUS_INCLUDE_PATH";
+ QTest::newRow("CPLUS_INCLUDE_PATH2") << "--compiler-flavor=unix" << "CPLUS_INCLUDE_PATH";
+#endif
+}
+
+void tst_Moc::environmentIncludePaths()
+{
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
+ QFETCH(QString, cmdline);
+ QFETCH(QString, varname);
+
+ QStringList args;
+ if (!cmdline.isEmpty())
+ args << cmdline;
+ args << "--include" << QStringLiteral("extradefines.h")
+ << m_sourceDirectory + QStringLiteral("/macro-on-cmdline.h");
+
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ env.remove("INCLUDE");
+ env.remove("CPATH");
+ env.remove("CPLUS_INCLUDE_PATH");
+ env.insert(varname, m_sourceDirectory + "/subdir");
+
+ QProcess proc;
+ proc.setProcessEnvironment(env);
+ proc.start(m_moc, args);
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+#else
+ QSKIP("Only tested on linux/gcc");
+#endif
+}
+
// tst_Moc::specifyMetaTagsFromCmdline()
// plugin_metadata.h contains a plugin which we register here. Since we're not building this
// application as a plugin, we need top copy some of the initializer code found in qplugin.h:
@@ -1918,6 +2076,41 @@ void tst_Moc::warnings_data()
<< QString()
<< QString("standard input:5: Error: Class declaration lacks Q_OBJECT macro.");
+ QTest::newRow("Namespace declaration lacks Q_NAMESPACE macro.")
+ << QByteArray("namespace X {\nQ_CLASSINFO(\"key\",\"value\")\nenum class MyEnum {Key1 = 1}\nQ_ENUMS(MyEnum)\n}\n")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:1: Error: Namespace declaration lacks Q_NAMESPACE macro.");
+
+ QTest::newRow("Wrong Q_ENUM context.")
+ << QByteArray("namespace X {\nQ_NAMESPACE\n\nenum class MyEnum {Key1 = 1}\nQ_ENUM(MyEnum)\n}\n")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:5: Error: Q_ENUM can't be used in a Q_NAMESPACE, use Q_ENUM_NS instead");
+
+ QTest::newRow("Wrong Q_FLAG context.")
+ << QByteArray("namespace X {\nQ_NAMESPACE\n\nenum class MyEnum {Key1 = 1}\nQ_FLAG(MyEnum)\n}\n")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:5: Error: Q_FLAG can't be used in a Q_NAMESPACE, use Q_FLAG_NS instead");
+
+ QTest::newRow("Wrong Q_ENUM_NS context.")
+ << QByteArray("class X {\nQ_GADGET\n\nenum class MyEnum {Key1 = 1}\nQ_ENUM_NS(MyEnum)\n};\n")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:5: Error: Q_ENUM_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_ENUM instead");
+
+ QTest::newRow("Wrong Q_FLAG_NS context.")
+ << QByteArray("class X {\nQ_GADGET\n\nenum class MyEnum {Key1 = 1}\nQ_FLAG_NS(MyEnum)\n};\n")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:5: Error: Q_FLAG_NS can't be used in a Q_OBJECT/Q_GADGET, use Q_FLAG instead");
+
QTest::newRow("Invalid macro definition")
<< QByteArray("#define Foo(a, b, c) a b c #a #b #c a##b##c #d\n Foo(45, 42, 39);")
<< QStringList()
@@ -1939,6 +2132,13 @@ void tst_Moc::warnings_data()
<< QString("IGNORE_ALL_STDOUT")
<< QString(":-1: Error: Unexpected character in macro argument list.");
+ QTest::newRow("Missing header warning")
+ << QByteArray("class X : public QObject { Q_OBJECT };")
+ << (QStringList() << QStringLiteral("--include") << QStringLiteral("doesnotexist.h"))
+ << 0
+ << QString("IGNORE_ALL_STDOUT")
+ << QStringLiteral("Warning: Failed to resolve include \"doesnotexist.h\" for moc file <standard input>");
+
QTest::newRow("QTBUG-54815: Crash on invalid input")
<< QByteArray("class M{(})F<{}d000000000000000#0")
<< QStringList()
@@ -2012,18 +2212,19 @@ void tst_Moc::cxx11Enums_data()
QTest::addColumn<const QMetaObject *>("meta");
QTest::addColumn<QByteArray>("enumName");
QTest::addColumn<char>("prefix");
+ QTest::addColumn<bool>("isScoped");
const QMetaObject *meta1 = &CXX11Enums::staticMetaObject;
const QMetaObject *meta2 = &CXX11Enums2::staticMetaObject;
- QTest::newRow("EnumClass") << meta1 << QByteArray("EnumClass") << 'A';
- QTest::newRow("EnumClass 2") << meta2 << QByteArray("EnumClass") << 'A';
- QTest::newRow("TypedEnum") << meta1 << QByteArray("TypedEnum") << 'B';
- QTest::newRow("TypedEnum 2") << meta2 << QByteArray("TypedEnum") << 'B';
- QTest::newRow("TypedEnumClass") << meta1 << QByteArray("TypedEnumClass") << 'C';
- QTest::newRow("TypedEnumClass 2") << meta2 << QByteArray("TypedEnumClass") << 'C';
- QTest::newRow("NormalEnum") << meta1 << QByteArray("NormalEnum") << 'D';
- QTest::newRow("NormalEnum 2") << meta2 << QByteArray("NormalEnum") << 'D';
+ QTest::newRow("EnumClass") << meta1 << QByteArray("EnumClass") << 'A' << true;
+ QTest::newRow("EnumClass 2") << meta2 << QByteArray("EnumClass") << 'A' << true;
+ QTest::newRow("TypedEnum") << meta1 << QByteArray("TypedEnum") << 'B' << false;
+ QTest::newRow("TypedEnum 2") << meta2 << QByteArray("TypedEnum") << 'B' << false;
+ QTest::newRow("TypedEnumClass") << meta1 << QByteArray("TypedEnumClass") << 'C' << true;
+ QTest::newRow("TypedEnumClass 2") << meta2 << QByteArray("TypedEnumClass") << 'C' << true;
+ QTest::newRow("NormalEnum") << meta1 << QByteArray("NormalEnum") << 'D' << false;
+ QTest::newRow("NormalEnum 2") << meta2 << QByteArray("NormalEnum") << 'D' << false;
}
void tst_Moc::cxx11Enums()
@@ -2033,6 +2234,7 @@ void tst_Moc::cxx11Enums()
QFETCH(QByteArray, enumName);
QFETCH(char, prefix);
+ QFETCH(bool, isScoped);
int idx;
idx = meta->indexOfEnumerator(enumName);
@@ -2046,6 +2248,7 @@ void tst_Moc::cxx11Enums()
QCOMPARE(meta->enumerator(idx).keyToValue(v), i);
QCOMPARE(meta->enumerator(idx).valueToKey(i), v.constData());
}
+ QCOMPARE(meta->enumerator(idx).isScoped(), isScoped);
}
void tst_Moc::returnRefs()
@@ -3194,6 +3397,9 @@ void tst_Moc::parseDefines()
index = mo->indexOfSignal("cmdlineSignal(QMap<int,int>)");
QVERIFY(index != -1);
+
+ index = mo->indexOfSignal("signalQTBUG55853()");
+ QVERIFY(index != -1);
}
void tst_Moc::preprocessorOnly()
@@ -3538,6 +3744,45 @@ void tst_Moc::optionsFileError()
#endif
}
+static void checkEnum(const QMetaEnum &enumerator, const QByteArray &name, const QVector<QPair<QByteArray, int >> &keys)
+{
+ QCOMPARE(name, QByteArray{enumerator.name()});
+ QCOMPARE(keys.size(), enumerator.keyCount());
+ for (int i = 0; i < enumerator.keyCount(); ++i) {
+ QCOMPARE(keys[i].first, QByteArray{enumerator.key(i)});
+ QCOMPARE(keys[i].second, enumerator.value(i));
+ }
+}
+
+void tst_Moc::testQNamespace()
+{
+ QCOMPARE(TestQNamespace::staticMetaObject.enumeratorCount(), 4);
+ checkEnum(TestQNamespace::staticMetaObject.enumerator(0), "TestEnum1",
+ {{"Key1", 11}, {"Key2", 12}});
+ checkEnum(TestQNamespace::staticMetaObject.enumerator(1), "TestEnum2",
+ {{"Key1", 17}, {"Key2", 18}});
+ checkEnum(TestQNamespace::staticMetaObject.enumerator(2), "TestFlag1",
+ {{"None", 0}, {"Flag1", 1}, {"Flag2", 2}, {"Any", 1 | 2}});
+ checkEnum(TestQNamespace::staticMetaObject.enumerator(3), "TestFlag2",
+ {{"None", 0}, {"Flag1", 4}, {"Flag2", 8}, {"Any", 4 | 8}});
+
+ QCOMPARE(TestQNamespace::TestGadget::staticMetaObject.enumeratorCount(), 2);
+ checkEnum(TestQNamespace::TestGadget::staticMetaObject.enumerator(0), "TestGEnum1",
+ {{"Key1", 13}, {"Key2", 14}});
+ checkEnum(TestQNamespace::TestGadget::staticMetaObject.enumerator(1), "TestGEnum2",
+ {{"Key1", 23}, {"Key2", 24}});
+
+ QMetaEnum meta = QMetaEnum::fromType<TestQNamespace::TestEnum1>();
+ QVERIFY(meta.isValid());
+ QCOMPARE(meta.name(), "TestEnum1");
+ QCOMPARE(meta.enclosingMetaObject(), &TestQNamespace::staticMetaObject);
+ QCOMPARE(meta.keyCount(), 2);
+
+ QCOMPARE(FooNamespace::staticMetaObject.enumeratorCount(), 1);
+ QCOMPARE(FooNamespace::FooNestedNamespace::staticMetaObject.enumeratorCount(), 2);
+ QCOMPARE(FooNamespace::FooNestedNamespace::FooMoreNestedNamespace::staticMetaObject.enumeratorCount(), 1);
+}
+
QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS
diff --git a/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro b/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro
index 4bfa89a44e..fa232b323b 100644
--- a/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro
+++ b/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
QT = core testlib dbus
TARGET = tst_qdbuscpp2xml
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS
SOURCES += tst_qdbuscpp2xml.cpp \
diff --git a/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro b/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro
index 8c29ff47c4..02910b0267 100644
--- a/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro
+++ b/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro
@@ -2,4 +2,4 @@ CONFIG += testcase
QT = core testlib
TARGET = tst_qdbusxml2cpp
SOURCES += tst_qdbusxml2cpp.cpp
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp
index 4cd335d732..62fcedddb9 100644
--- a/tests/auto/tools/qmakelib/evaltest.cpp
+++ b/tests/auto/tools/qmakelib/evaltest.cpp
@@ -815,6 +815,49 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir)
<< "##:2: member() argument 2 (start) '4..foo' invalid."
<< true;
+ // The argument processing is shared with $$member(), so some tests are skipped.
+ QTest::newRow("$$str_member(): empty")
+ << "VAR = $$str_member()"
+ << "VAR ="
+ << ""
+ << true;
+
+ QTest::newRow("$$str_member(): too short")
+ << "VAR = $$str_member(string_value, 7, 12)"
+ << "VAR =" // this is actually kinda stupid
+ << ""
+ << true;
+
+ QTest::newRow("$$str_member(): ok")
+ << "VAR = $$str_member(string_value, 7, 11)"
+ << "VAR = value"
+ << ""
+ << true;
+
+ QTest::newRow("$$str_member(): ok (default start)")
+ << "VAR = $$str_member(string_value)"
+ << "VAR = s"
+ << ""
+ << true;
+
+ QTest::newRow("$$str_member(): ok (default end)")
+ << "VAR = $$str_member(string_value, 7)"
+ << "VAR = v"
+ << ""
+ << true;
+
+ QTest::newRow("$$str_member(): negative")
+ << "VAR = $$str_member(string_value, -5, -3)"
+ << "VAR = val"
+ << ""
+ << true;
+
+ QTest::newRow("$$str_member(): inverse")
+ << "VAR = $$str_member(string_value, -2, 1)"
+ << "VAR = ulav_gnirt"
+ << ""
+ << true;
+
QTest::newRow("$$first(): empty")
<< "IN = \nVAR = $$first(IN)"
<< "VAR ="
@@ -839,6 +882,30 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir)
<< "##:1: first(var) requires one argument."
<< true;
+ QTest::newRow("$$take_first(): empty")
+ << "IN = \nVAR = $$take_first(IN)"
+ << "VAR =\nIN ="
+ << ""
+ << true;
+
+ QTest::newRow("$$take_first(): one")
+ << "IN = one\nVAR = $$take_first(IN)"
+ << "VAR = one\nIN ="
+ << ""
+ << true;
+
+ QTest::newRow("$$take_first(): multiple")
+ << "IN = one two three\nVAR = $$take_first(IN)"
+ << "VAR = one\nIN = two three"
+ << ""
+ << true;
+
+ QTest::newRow("$$take_first(): bad number of arguments")
+ << "VAR = $$take_first(1, 2)"
+ << "VAR ="
+ << "##:1: take_first(var) requires one argument."
+ << true;
+
QTest::newRow("$$last(): empty")
<< "IN = \nVAR = $$last(IN)"
<< "VAR ="
@@ -863,6 +930,30 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir)
<< "##:1: last(var) requires one argument."
<< true;
+ QTest::newRow("$$take_last(): empty")
+ << "IN = \nVAR = $$take_last(IN)"
+ << "VAR =\nIN ="
+ << ""
+ << true;
+
+ QTest::newRow("$$take_last(): one")
+ << "IN = one\nVAR = $$take_last(IN)"
+ << "VAR = one\nIN ="
+ << ""
+ << true;
+
+ QTest::newRow("$$take_last(): multiple")
+ << "IN = one two three\nVAR = $$take_last(IN)"
+ << "VAR = three\nIN = one two"
+ << ""
+ << true;
+
+ QTest::newRow("$$take_last(): bad number of arguments")
+ << "VAR = $$take_last(1, 2)"
+ << "VAR ="
+ << "##:1: take_last(var) requires one argument."
+ << true;
+
QTest::newRow("$$size()")
<< "IN = one two three\nVAR = $$size(IN)"
<< "VAR = 3"
@@ -875,6 +966,18 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir)
<< "##:1: size(var) requires one argument."
<< true;
+ QTest::newRow("$$str_size()")
+ << "VAR = $$str_size(one two three)"
+ << "VAR = 13"
+ << ""
+ << true;
+
+ QTest::newRow("$$str_size(): bad number of arguments")
+ << "VAR = $$str_size(1, 2)"
+ << "VAR ="
+ << "##:1: str_size(str) requires one argument."
+ << true;
+
QTest::newRow("$$fromfile(): right var")
<< "VAR = $$fromfile(" + qindir + "/fromfile/infile.prx, DEFINES)"
<< "VAR = QT_DLL"
@@ -1003,6 +1106,48 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir)
<< "##:1: format_number(): invalid format option foo=bar."
<< true;
+ QTest::newRow("$$num_add(): one")
+ << "VAR = $$num_add(10)"
+ << "VAR = 10"
+ << ""
+ << true;
+
+ QTest::newRow("$$num_add(): two")
+ << "VAR = $$num_add(1, 2)"
+ << "VAR = 3"
+ << ""
+ << true;
+
+ QTest::newRow("$$num_add(): three")
+ << "VAR = $$num_add(1, 3, 5)"
+ << "VAR = 9"
+ << ""
+ << true;
+
+ QTest::newRow("$$num_add(): negative")
+ << "VAR = $$num_add(7, -13)"
+ << "VAR = -6"
+ << ""
+ << true;
+
+ QTest::newRow("$$num_add(): bad number of arguments")
+ << "VAR = $$num_add()"
+ << "VAR = "
+ << "##:1: num_add(num, ...) requires at least one argument."
+ << true;
+
+ QTest::newRow("$$num_add(): bad number: float")
+ << "VAR = $$num_add(1.1)"
+ << "VAR ="
+ << "##:1: num_add(): floats are currently not supported."
+ << true;
+
+ QTest::newRow("$$num_add(): bad number: malformed")
+ << "VAR = $$num_add(fail)"
+ << "VAR ="
+ << "##:1: num_add(): malformed number fail."
+ << true;
+
QTest::newRow("$$join(): empty")
<< "IN = \nVAR = $$join(IN, //)"
<< "VAR ="
@@ -1181,9 +1326,9 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir)
<< true;
QTest::newRow("$$system(): bad number of arguments")
- << "VAR = $$system(1, 2, 3)"
+ << "VAR = $$system(1, 2, 3, 4)"
<< "VAR ="
- << "##:1: system(execute) requires one or two arguments."
+ << "##:1: system(command, [mode], [stsvar]) requires one to three arguments."
<< true;
QTest::newRow("$$unique()")
@@ -1198,6 +1343,18 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir)
<< "##:1: unique(var) requires one argument."
<< true;
+ QTest::newRow("$$sorted()")
+ << "IN = one two three\nVAR = $$sorted(IN)"
+ << "VAR = one three two"
+ << ""
+ << true;
+
+ QTest::newRow("$$sorted(): bad number of arguments")
+ << "VAR = $$sorted(1, 2)"
+ << "VAR ="
+ << "##:1: sorted(var) requires one argument."
+ << true;
+
QTest::newRow("$$reverse()")
<< "IN = one two three\nVAR = $$reverse(IN)"
<< "VAR = three two one"
@@ -2102,7 +2259,7 @@ void tst_qmakelib::addTestFunctions(const QString &qindir)
<< "jsontext = not good\n"
"parseJson(jsontext, json): OK = 1"
<< "OK = UNDEF"
- << ""
+ << "##:2: Error parsing json at offset 1: illegal value"
<< true;
QTest::newRow("parseJson(): bad number of arguments")
@@ -2168,6 +2325,18 @@ void tst_qmakelib::addTestFunctions(const QString &qindir)
<< "##:1: load(feature) requires one or two arguments."
<< true;
+ QTest::newRow("discard_from()")
+ << "HERE = 1\nPLUS = one\ninclude(include/inc.pri)\ndiscard_from(include/inc.pri): OK = 1"
+ << "OK = 1\nHERE = 1\nPLUS = one\nVAR = UNDEF"
+ << ""
+ << true;
+
+ QTest::newRow("discard_from(): bad number of arguments")
+ << "discard_from(1, 2): OK = 1"
+ << "OK = UNDEF"
+ << "##:1: discard_from(file) requires one argument."
+ << true;
+
// We don't test debug() and log(), because they print directly to stderr.
QTest::newRow("message()")
@@ -2189,12 +2358,18 @@ void tst_qmakelib::addTestFunctions(const QString &qindir)
<< "Project WARNING: World, be warned!"
<< true;
- QTest::newRow("error()")
+ QTest::newRow("error(message)")
<< "error('World, you FAIL!'): OK = 1\nOKE = 1"
<< "OK = UNDEF\nOKE = UNDEF"
<< "Project ERROR: World, you FAIL!"
<< false;
+ QTest::newRow("error(empty)")
+ << "error(): OK = 1\nOKE = 1"
+ << "OK = UNDEF\nOKE = UNDEF"
+ << ""
+ << false;
+
QTest::newRow("if(error())")
<< "if(error(\\'World, you FAIL!\\')): OK = 1\nOKE = 1"
<< "OK = UNDEF\nOKE = UNDEF"
@@ -2581,19 +2756,20 @@ void tst_qmakelib::proEval()
QMakeTestHandler handler;
handler.setExpectedMessages(msgs.replace("##:", infile + ':').split('\n', QString::SkipEmptyParts));
QMakeVfs vfs;
- QMakeParser parser(0, &vfs, &handler);
+ ProFileCache cache;
+ QMakeParser parser(&cache, &vfs, &handler);
QMakeGlobals globals;
globals.do_cache = false;
globals.xqmakespec = "fake-g++";
globals.environment = m_env;
globals.setProperties(m_prop);
globals.setDirectories(m_indir, m_outdir);
- ProFile *outPro = parser.parsedProBlock(out, "out", 1, QMakeParser::FullGrammar);
+ ProFile *outPro = parser.parsedProBlock(QStringRef(&out), "out", 1, QMakeParser::FullGrammar);
if (!outPro->isOk()) {
qWarning("Expected output is malformed");
verified = false;
}
- ProFile *pro = parser.parsedProBlock(in, infile, 1, QMakeParser::FullGrammar);
+ ProFile *pro = parser.parsedProBlock(QStringRef(&in), infile, 1, QMakeParser::FullGrammar);
QMakeEvaluator visitor(&globals, &parser, &vfs, &handler);
visitor.setOutputDir(m_outdir);
#ifdef Q_OS_WIN
diff --git a/tests/auto/tools/qmakelib/parsertest.cpp b/tests/auto/tools/qmakelib/parsertest.cpp
index 5e12d930f8..dc92f98f45 100644
--- a/tests/auto/tools/qmakelib/parsertest.cpp
+++ b/tests/auto/tools/qmakelib/parsertest.cpp
@@ -1962,7 +1962,7 @@ void tst_qmakelib::proParser()
handler.setExpectedMessages(msgs.split('\n', QString::SkipEmptyParts));
QMakeVfs vfs;
QMakeParser parser(0, &vfs, &handler);
- ProFile *pro = parser.parsedProBlock(in, "in", 1, QMakeParser::FullGrammar);
+ ProFile *pro = parser.parsedProBlock(QStringRef(&in), "in", 1, QMakeParser::FullGrammar);
if (handler.printedMessages()) {
qWarning("Got unexpected message(s)");
verified = false;
diff --git a/tests/auto/tools/qmakelib/testdata/include/inc.pri b/tests/auto/tools/qmakelib/testdata/include/inc.pri
index 1f1b3a287f..f9a4ec1bfa 100644
--- a/tests/auto/tools/qmakelib/testdata/include/inc.pri
+++ b/tests/auto/tools/qmakelib/testdata/include/inc.pri
@@ -1,6 +1,8 @@
VAR = val
.VAR = nope
+PLUS += more
+
fake-*: MATCH = 1
defineTest(func) {
diff --git a/tests/auto/widgets/dialogs/dialogs.pro b/tests/auto/widgets/dialogs/dialogs.pro
index c6667824d9..cf548f2dea 100644
--- a/tests/auto/widgets/dialogs/dialogs.pro
+++ b/tests/auto/widgets/dialogs/dialogs.pro
@@ -13,7 +13,7 @@ SUBDIRS=\
qsidebar \
qwizard \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qsidebar \
mac:qinputdialog.CONFIG += no_check_target # QTBUG-25496
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index e6a0c5e86b..ac7ba02700 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -69,10 +69,8 @@ private slots:
void showMaximized();
void showMinimized();
void showFullScreen();
-#ifndef Q_OS_WINCE
void showAsTool();
void toolDialogPosition();
-#endif
void deleteMainDefault();
void deleteInExec();
#ifndef QT_NO_SIZEGRIP
@@ -358,8 +356,6 @@ void tst_QDialog::showFullScreen()
QVERIFY(!dialog.isVisible());
}
-// No real support for Qt::Tool on WinCE
-#ifndef Q_OS_WINCE
void tst_QDialog::showAsTool()
{
#if defined(Q_OS_UNIX)
@@ -379,10 +375,7 @@ void tst_QDialog::showAsTool()
QCOMPARE(dialog.wasActive(), false);
}
}
-#endif
-// No real support for Qt::Tool on WinCE
-#ifndef Q_OS_WINCE
// Verify that pos() returns the same before and after show()
// for a dialog with the Tool window type.
void tst_QDialog::toolDialogPosition()
@@ -394,7 +387,6 @@ void tst_QDialog::toolDialogPosition()
const QPoint afterShowPosition = dialog.pos();
QCOMPARE(afterShowPosition, beforeShowPosition);
}
-#endif
class Dialog : public QDialog
{
diff --git a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro
index 2a11a29420..4ea23a896f 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro
+++ b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro
@@ -8,18 +8,6 @@ QT += widgets widgets-private testlib
QT += core-private gui-private
SOURCES += tst_qfiledialog.cpp
-wince* {
- addFiles.files = *.cpp
- addFiles.path = .
- filesInDir.files = *.pro
- filesInDir.path = someDir
- DEPLOYMENT += addFiles filesInDir
-}
-
-wince* {
- DEFINES += SRCDIR=\\\"./\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
linux*: CONFIG += insignificant_test # Crashes on different Linux distros
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index e61c61ddfd..e13e0201bc 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -186,9 +186,6 @@ void tst_QFiledialog::init()
QFileDialogPrivate::setLastVisitedDirectory(QUrl());
// populate the sidebar with some default settings
QFileDialog fd;
-#if defined(Q_OS_WINCE)
- QTest::qWait(1000);
-#endif
}
void tst_QFiledialog::cleanup()
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro
index fb432a7d21..1b35b2e4ac 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro
+++ b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro
@@ -6,17 +6,4 @@ QT += core-private gui-private
SOURCES += tst_qfiledialog2.cpp
-wince* {
- addFiles.files = *.cpp
- addFiles.path = .
- filesInDir.files = *.pro
- filesInDir.path = someDir
- DEPLOYMENT += addFiles filesInDir
-}
-
-wince* {
- DEFINES += SRCDIR=\\\"./\\\"
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
-
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 82934982c4..a16bd1a787 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -54,7 +54,7 @@
#include <qpa/qplatformdialoghelper.h>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
#include "../../../network-settings.h"
#endif
@@ -107,7 +107,7 @@ private slots:
#ifndef Q_OS_MAC
void task227930_correctNavigationKeyboardBehavior();
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
void task226366_lowerCaseHardDriveWindows();
#endif
void completionOnLevelAfterRoot();
@@ -138,9 +138,6 @@ tst_QFileDialog2::tst_QFileDialog2()
: tempDir(QDir::tempPath() + "/tst_qfiledialog2.XXXXXX")
{
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
-#if defined(Q_OS_WINCE)
- qApp->setAutoMaximizeThreshold(-1);
-#endif
}
void tst_QFileDialog2::cleanupSettingsFile()
@@ -167,9 +164,6 @@ void tst_QFileDialog2::init()
QFileDialogPrivate::setLastVisitedDirectory(QUrl());
// populate the sidebar with some default settings
QFileDialog fd;
-#if defined(Q_OS_WINCE)
- QTest::qWait(1000);
-#endif
}
void tst_QFileDialog2::cleanup()
@@ -189,11 +183,7 @@ void tst_QFileDialog2::listRoot()
fd.show();
QCOMPARE(qt_test_isFetchedRoot(),false);
fd.setDirectory("");
-#ifdef Q_OS_WINCE
- QTest::qWait(1500);
-#else
QTest::qWait(500);
-#endif
QCOMPARE(qt_test_isFetchedRoot(),true);
}
#endif
@@ -286,7 +276,7 @@ void tst_QFileDialog2::showNameFilterDetails()
void tst_QFileDialog2::unc()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// Only test UNC on Windows./
QString dir("\\\\" + QtNetworkSettings::winServerName() + "\\testsharewritable");
#else
@@ -634,7 +624,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior()
}
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows()
{
QFileDialog fd;
@@ -664,7 +654,7 @@ void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows()
void tst_QFileDialog2::completionOnLevelAfterRoot()
{
QFileDialog fd;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
fd.setDirectory("C:/");
QDir current = fd.directory();
QStringList entryList = current.entryList(QStringList(), QDir::Dirs);
@@ -708,7 +698,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot()
fd.show();
QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit");
QTest::qWait(2000);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
//I love testlib :D
for (int i = 0; i < 5; i++)
QTest::keyClick(edit, testDir.at(i).toLower().toLatin1() - 'a' + Qt::Key_A);
@@ -719,7 +709,7 @@ void tst_QFileDialog2::completionOnLevelAfterRoot()
QTest::qWait(200);
QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
QTest::qWait(200);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
QCOMPARE(edit->text(), testDir);
#else
QTRY_COMPARE(edit->text(), QString("etc"));
@@ -853,33 +843,21 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
fd.setDirectory(current.absolutePath());
fd.setViewMode(QFileDialog::Detail);
fd.show();
-#if defined(Q_OS_WINCE)
- QTest::qWait(1500);
-#else
QTest::qWait(500);
-#endif
QTreeView *tree = fd.findChild<QTreeView*>("treeView");
tree->header()->setSortIndicator(3,Qt::DescendingOrder);
QTest::qWait(200);
QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox");
QPushButton *button = buttonBox->button(QDialogButtonBox::Open);
QTest::mouseClick(button, Qt::LeftButton);
-#if defined(Q_OS_WINCE)
- QTest::qWait(1500);
-#else
QTest::qWait(500);
-#endif
QFileDialog fd2;
fd2.setFileMode(QFileDialog::Directory);
fd2.restoreState(fd.saveState());
current.cd("aaaaaaaaaaaaaaaaaa");
fd2.setDirectory(current.absolutePath());
fd2.show();
-#if defined(Q_OS_WINCE)
- QTest::qWait(1500);
-#else
QTest::qWait(500);
-#endif
QTreeView *tree2 = fd2.findChild<QTreeView*>("treeView");
tree2->setFocus();
@@ -889,22 +867,14 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open);
fd2.selectFile("g");
QTest::mouseClick(button2, Qt::LeftButton);
-#if defined(Q_OS_WINCE)
- QTest::qWait(1500);
-#else
QTest::qWait(500);
-#endif
QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QLatin1String("/g"));
QFileDialog fd3(0, "This is a third file dialog", tempFile->fileName());
fd3.restoreState(fd.saveState());
fd3.setFileMode(QFileDialog::Directory);
fd3.show();
-#if defined(Q_OS_WINCE)
- QTest::qWait(1500);
-#else
QTest::qWait(500);
-#endif
QTreeView *tree3 = fd3.findChild<QTreeView*>("treeView");
tree3->setFocus();
@@ -913,11 +883,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
QDialogButtonBox *buttonBox3 = fd3.findChild<QDialogButtonBox*>("buttonBox");
QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open);
QTest::mouseClick(button3, Qt::LeftButton);
-#if defined(Q_OS_WINCE)
- QTest::qWait(1500);
-#else
QTest::qWait(500);
-#endif
QCOMPARE(fd3.selectedFiles().first(), tempFile->fileName());
current.cd("aaaaaaaaaaaaaaaaaa");
@@ -999,11 +965,7 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries()
sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
// give the background processes more time on windows mobile
-#ifdef Q_OS_WINCE
- QTest::qWait(1000);
-#else
QTest::qWait(250);
-#endif
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2);
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index ad7600c784..00693ba6f7 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -40,7 +40,7 @@
#include <QStyle>
#include <QtGlobal>
#include <QTemporaryDir>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
# include <qt_windows.h> // for SetFileAttributes
#endif
@@ -332,7 +332,7 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
return false;
}
file.close();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (initial_files.at(i)[0] == '.') {
QString hiddenFile = QDir::toNativeSeparators(file.fileName());
wchar_t nativeHiddenFile[MAX_PATH];
@@ -369,14 +369,9 @@ void tst_QFileSystemModel::rowCount()
QSignalSpy spy2(model, SIGNAL(rowsInserted(QModelIndex,int,int)));
QSignalSpy spy3(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
-#if !defined(Q_OS_WINCE)
QStringList files = QStringList() << "b" << "d" << "f" << "h" << "j" << ".a" << ".c" << ".e" << ".g";
QString l = "b,d,f,h,j,.a,.c,.e,.g";
-#else
- // Cannot hide them on CE
- QStringList files = QStringList() << "b" << "d" << "f" << "h" << "j";
- QString l = "b,d,f,h,j";
-#endif
+
QVERIFY(createFiles(tmp, files));
QModelIndex root = model->setRootPath(tmp);
@@ -404,9 +399,6 @@ static inline QString lastEntry(const QModelIndex &root)
void tst_QFileSystemModel::rowsInserted()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Watching directories does not work on CE(see #137910)");
-#endif
QString tmp = flatDirTestPath;
rowCount();
QModelIndex root = model->index(model->rootPath());
@@ -461,9 +453,6 @@ void tst_QFileSystemModel::rowsRemoved_data()
void tst_QFileSystemModel::rowsRemoved()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Watching directories does not work on CE(see #137910)");
-#endif
QString tmp = flatDirTestPath;
rowCount();
QModelIndex root = model->index(model->rootPath());
@@ -552,7 +541,6 @@ void tst_QFileSystemModel::filters_data()
QTest::addColumn<int>("dirFilters");
QTest::addColumn<QStringList>("nameFilters");
QTest::addColumn<int>("rowCount");
-#if !defined(Q_OS_WINCE)
QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 2;
QTest::newRow("no dirs - dot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 1;
QTest::newRow("no dirs - dotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 1;
@@ -574,30 +562,6 @@ void tst_QFileSystemModel::filters_data()
(int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "a") << 1;
QTest::newRow("dir+files+hid+dot+cas+alldir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") <<
(int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << (QStringList() << "Z") << 1;
-#else
- QTest::qWait(3000); // We need to calm down a bit...
- QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 0;
- QTest::newRow("no dirs - dot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 1;
- QTest::newRow("no dirs - dotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 1;
- QTest::newRow("no dirs - dotanddotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 0;
- QTest::newRow("one dir - dot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 2;
- QTest::newRow("one dir - dotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 2;
- QTest::newRow("one dir - dotanddotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 1;
- QTest::newRow("one dir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs) << QStringList() << 1;
- QTest::newRow("no dir + hidden") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::Hidden) << QStringList() << 0;
- QTest::newRow("dir+hid+files") << (QStringList() << "a" << "b" << "c") << QStringList() <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden) << QStringList() << 3;
- QTest::newRow("dir+file+hid-dot .A") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".A") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList() << 4;
- QTest::newRow("dir+files+hid+dot A") << (QStringList() << "a" << "b" << "c") << (QStringList() << "AFolder") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << (QStringList() << "A*") << 2;
- QTest::newRow("dir+files+hid+dot+cas1") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "Z") << 1;
- QTest::newRow("dir+files+hid+dot+cas2") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "a") << 1;
- QTest::newRow("dir+files+hid+dot+cas+alldir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << (QStringList() << "Z") << 1;
-#endif
QTest::newRow("case sensitive") << (QStringList() << "Antiguagdb" << "Antiguamtd"
<< "Antiguamtp" << "afghanistangdb" << "afghanistanmtd")
diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST
index b62f3e3344..07f3a41df3 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST
@@ -1,4 +1,5 @@
[task256466_wrongStyle]
opensuse-13.1
+opensuse-42.1
rhel-7.1
rhel-7.2
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index d6b3ce07e8..d6c4841b22 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -395,11 +395,8 @@ void tst_QMessageBox::about()
QVERIFY(closeHelper.done());
#endif
-#if !defined(Q_OS_WINCE)
const int keyToSend = Qt::Key_Enter;
-#else
- const keyToSend = Qt::Key_Escape;
-#endif
+
closeHelper.start(keyToSend);
QMessageBox::aboutQt(0, "Caption");
#ifdef Q_OS_MAC
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 2635a2ed82..016835f142 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -51,9 +51,6 @@ class tst_QWizard : public QObject
{
Q_OBJECT
-public:
- tst_QWizard();
-
private slots:
void cleanup();
void buttonText();
@@ -128,13 +125,6 @@ private slots:
*/
};
-tst_QWizard::tst_QWizard()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QWizard::cleanup()
{
QVERIFY(QApplication::topLevelWidgets().isEmpty());
@@ -962,9 +952,6 @@ void tst_QWizard::setOption_IndependentPages()
void tst_QWizard::setOption_IgnoreSubTitles()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Skipped because of limited resources and potential crash. (Task: 166824)");
-#endif
const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
const int kPixels = (availableGeometry.width() + 500) / 1000;
const int frame = 50 * kPixels;
@@ -1073,9 +1060,6 @@ void tst_QWizard::setOption_IgnoreSubTitles()
void tst_QWizard::setOption_ExtendedWatermarkPixmap()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Skipped because of limited resources and potential crash. (Task: 166824)");
-#endif
QPixmap watermarkPixmap(200, 400);
watermarkPixmap.fill(Qt::black);
@@ -2062,10 +2046,6 @@ void tst_QWizard::combinations_data()
void tst_QWizard::combinations()
{
-#ifdef Q_OS_WINCE
- QSKIP("Too much memory usage for testing on CE emulator");
-#endif
-
QFETCH(bool, ref);
QFETCH(bool, testEquality);
QFETCH(QList<Operation *>, operations);
diff --git a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro
index bf0f99598b..4fbe13cce7 100644
--- a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro
+++ b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro
@@ -5,10 +5,3 @@ QT += widgets widgets-private testlib
QT += gui-private
SOURCES += tst_qpixmapfilter.cpp
-
-wince {
- addFiles.files = noise.png
- addFiles.path = .
- DEPLOYMENT += addFiles
-}
-
diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp
index 6b0c1ecf57..c3ebb838bb 100644
--- a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp
+++ b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp
@@ -38,8 +38,6 @@
#include <QtCore/QHash>
#include <QtCore/QDebug>
-#include <qpa/qwindowsysteminterface.h>
-
class tst_QGestureRecognizer : public QObject
{
Q_OBJECT
@@ -64,15 +62,13 @@ private:
tst_QGestureRecognizer::tst_QGestureRecognizer()
: m_fingerDistance(qRound(QGuiApplication::primaryScreen()->physicalDotsPerInch() / 2.0))
- , m_touchDevice(new QTouchDevice)
+ , m_touchDevice(QTest::createTouchDevice())
{
qputenv("QT_PAN_TOUCHPOINTS", "2"); // Prevent device detection of pan touch point count.
}
void tst_QGestureRecognizer::initTestCase()
{
- m_touchDevice->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(m_touchDevice);
}
#ifndef QT_NO_GESTURES
diff --git a/tests/auto/widgets/graphicsview/graphicsview.pro b/tests/auto/widgets/graphicsview/graphicsview.pro
index dce3c6dda9..e99897a4f6 100644
--- a/tests/auto/widgets/graphicsview/graphicsview.pro
+++ b/tests/auto/widgets/graphicsview/graphicsview.pro
@@ -19,7 +19,7 @@ SUBDIRS=\
qgraphicsview \
qgraphicswidget \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qgraphicsanchorlayout \
qgraphicsanchorlayout1 \
qgraphicsitem \
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 90ea2cb58b..f5b2269297 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -38,7 +38,6 @@ class tst_QGraphicsGridLayout : public QObject
Q_OBJECT
private slots:
- void initTestCase();
void qgraphicsgridlayout_data();
void qgraphicsgridlayout();
void addItem_data();
@@ -294,16 +293,6 @@ Q_DECLARE_METATYPE(ItemList);
typedef QList<QSizeF> SizeList;
-
-// This will be called before the first test function is executed.
-// It is only called once.
-void tst_QGraphicsGridLayout::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QGraphicsGridLayout::qgraphicsgridlayout_data()
{
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
index 5bfa15db16..88526144fc 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
@@ -5,4 +5,4 @@ QT += core-private gui-private
SOURCES += tst_qgraphicsitem.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-win32:!wince:!winrt: LIBS += -luser32
+win32:!winrt: LIBS += -luser32
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index dc527767a7..76e3b43ce2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -57,9 +57,7 @@
Q_DECLARE_METATYPE(QPainterPath)
-#include "../../../qtest-config.h"
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
#include <windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
@@ -279,9 +277,6 @@ class tst_QGraphicsItem : public QObject
{
Q_OBJECT
-public slots:
- void init();
-
private slots:
void construction();
void constructionWithParent();
@@ -355,7 +350,7 @@ private slots:
void filtersChildEvents();
void filtersChildEvents2();
void ensureVisible();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void cursor();
#endif
//void textControlGetterSetter();
@@ -481,13 +476,6 @@ private:
QList<QGraphicsItem *> paintedItems;
};
-void tst_QGraphicsItem::init()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QGraphicsItem::construction()
{
for (int i = 0; i < 7; ++i) {
@@ -4187,7 +4175,7 @@ void tst_QGraphicsItem::ensureVisible()
QTest::qWait(25);
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QGraphicsItem::cursor()
{
QGraphicsScene scene;
@@ -4535,7 +4523,7 @@ protected:
case QGraphicsItem::ItemSceneHasChanged:
break;
case QGraphicsItem::ItemCursorChange:
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
oldValues << cursor();
#endif
break;
@@ -5101,10 +5089,6 @@ public:
void tst_QGraphicsItem::paint()
{
-#ifdef Q_OS_MACX
- if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7)
- QSKIP("QTBUG-31454 - Unstable auto-test");
-#endif
QGraphicsScene scene;
PaintTester paintTester;
@@ -6589,12 +6573,6 @@ public:
void tst_QGraphicsItem::ensureUpdateOnTextItem()
{
-#ifdef Q_OS_MAC
- if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) {
- QSKIP("This test is unstable on 10.7 in CI");
- }
-#endif
-
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
@@ -11042,9 +11020,7 @@ void tst_QGraphicsItem::touchEventPropagation()
touchPoints << tp;
sendMousePress(&scene, tp.scenePos());
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
+ QTouchDevice *device = QTest::createTouchDevice();
QTouchEvent touchBegin(QEvent::TouchBegin, device, Qt::NoModifier, Qt::TouchPointPressed, touchPoints);
qApp->sendEvent(&scene, &touchBegin);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 491dda9f9e..01708d526c 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -33,8 +33,6 @@
#include <private/qgraphicsproxywidget_p.h>
#include <private/qlayoutengine_p.h> // qSmartMin functions...
-#include "../../../qtest-config.h"
-
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton)
{
QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, button, 0);
@@ -97,7 +95,7 @@ private slots:
void focusNextPrevChild();
void focusOutEvent_data();
void focusOutEvent();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void hoverEnterLeaveEvent_data();
void hoverEnterLeaveEvent();
#endif
@@ -140,7 +138,7 @@ private slots:
void setFocus_complexTwoWidgets();
void popup_basic();
void popup_subwidget();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void changingCursor_basic();
#endif
void tooltip_basic();
@@ -272,9 +270,6 @@ public:
// It is only called once.
void tst_QGraphicsProxyWidget::initTestCase()
{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
// Disable menu animations to prevent the alpha widget from getting in the way
// in actionsContextMenu().
QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false);
@@ -416,7 +411,7 @@ void tst_QGraphicsProxyWidget::setWidget()
}
QWidget *widget = new QWidget;
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
widget->setCursor(Qt::IBeamCursor);
#endif
widget->setPalette(QPalette(Qt::magenta));
@@ -453,7 +448,7 @@ void tst_QGraphicsProxyWidget::setWidget()
QVERIFY(subWidget->testAttribute(Qt::WA_DontShowOnScreen));
QVERIFY(!subWidget->testAttribute(Qt::WA_QuitOnClose));
QCOMPARE(proxy->acceptHoverEvents(), true);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QVERIFY(proxy->hasCursor());
// These should match
@@ -936,7 +931,7 @@ protected:
}
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data()
{
QTest::addColumn<bool>("hasWidget");
@@ -1524,7 +1519,7 @@ void tst_QGraphicsProxyWidget::setWidget_simple()
// Properties
// QCOMPARE(proxy.focusPolicy(), lineEdit->focusPolicy());
// QCOMPARE(proxy.palette(), lineEdit->palette());
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QCOMPARE(proxy.cursor().shape(), lineEdit->cursor().shape());
#endif
QCOMPARE(proxy.layoutDirection(), lineEdit->layoutDirection());
@@ -1573,7 +1568,7 @@ void tst_QGraphicsProxyWidget::resize_simple_data()
QTest::addColumn<QSizeF>("size");
QTest::newRow("200, 200") << QSizeF(200, 200);
-#if !defined(Q_PROCESSOR_ARM) && !defined(Q_OS_WINCE)
+#if !defined(Q_PROCESSOR_ARM)
QTest::newRow("1000, 1000") << QSizeF(1000, 1000);
// Since 4.5, 10000x10000 runs out of memory.
// QTest::newRow("10000, 10000") << QSizeF(10000, 10000);
@@ -2541,7 +2536,7 @@ void tst_QGraphicsProxyWidget::popup_subwidget()
QCOMPARE(popup->size(), child->size().toSize());
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QGraphicsProxyWidget::changingCursor_basic()
{
// Confirm that mouse events are working properly by checking that
@@ -3647,7 +3642,7 @@ public slots:
void tst_QGraphicsProxyWidget::QTBUG_6986_sendMouseEventToAlienWidget()
{
-#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(QTEST_NO_CURSOR)
+#if defined(Q_OS_DARWIN) || defined(Q_OS_WIN) || defined(QT_NO_CURSOR)
QSKIP("Test case unstable on this platform");
#endif
QGraphicsView view;
@@ -3804,9 +3799,7 @@ void tst_QGraphicsProxyWidget::forwardTouchEvent()
EventSpy eventSpy(widget);
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
+ QTouchDevice *device = QTest::createTouchDevice();
QCOMPARE(eventSpy.counts[QEvent::TouchBegin], 0);
QCOMPARE(eventSpy.counts[QEvent::TouchUpdate], 0);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
index 986ba019b4..351cecd92e 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
@@ -4,18 +4,9 @@ QT += widgets widgets-private testlib
QT += core-private gui-private
SOURCES += tst_qgraphicsscene.cpp
RESOURCES += images.qrc
-win32:!wince:!winrt: LIBS += -luser32
+win32:!winrt: LIBS += -luser32
-!wince: DEFINES += SRCDIR=\\\"$$PWD\\\"
+DEFINES += SRCDIR=\\\"$$PWD\\\"
DEFINES += QT_NO_CAST_TO_ASCII
-wince* {
- rootFiles.files = Ash_European.jpg graphicsScene_selection.data
- rootFiles.path = .
- renderFiles.files = testData\\render\\*
- renderFiles.path = testData\\render
- DEPLOYMENT += rootFiles renderFiles
- DEFINES += SRCDIR=\\\".\\\"
-}
-
RESOURCES += testdata.qrc
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index a346bb9d1f..d95f6e408e 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -28,9 +28,6 @@
#include <QtTest/QtTest>
-#if defined(Q_OS_WINCE)
-#include <ceconfig.h>
-#endif
#include <QtGui>
#include <QtWidgets>
@@ -41,7 +38,7 @@
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
#include <windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
@@ -170,7 +167,6 @@ class tst_QGraphicsScene : public QObject
{
Q_OBJECT
public slots:
- void initTestCase();
void cleanup();
private slots:
@@ -271,15 +267,9 @@ private slots:
void taskQT_3674_doNotCrash();
void taskQTBUG_15977_renderWithDeviceCoordinateCache();
void taskQTBUG_16401_focusItem();
+ void taskQTBUG_42915_focusNextPrevChild();
};
-void tst_QGraphicsScene::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QGraphicsScene::cleanup()
{
// ensure not even skipped tests with custom input context leave it dangling
@@ -1250,7 +1240,7 @@ void tst_QGraphicsScene::addText()
void tst_QGraphicsScene::removeItem()
{
-#if (defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)) || defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID)
QSKIP("No mouse cursor support");
#endif
QGraphicsScene scene;
@@ -1587,11 +1577,7 @@ void tst_QGraphicsScene::hoverEvents_siblings()
QGraphicsView view(&scene);
view.setRenderHint(QPainter::Antialiasing, true);
-#if defined(Q_OS_WINCE)
- view.setMinimumSize(230, 200);
-#else
view.setMinimumSize(400, 300);
-#endif
view.rotate(10);
view.scale(1.7, 1.7);
view.show();
@@ -1660,11 +1646,7 @@ void tst_QGraphicsScene::hoverEvents_parentChild()
QGraphicsView view(&scene);
view.setRenderHint(QPainter::Antialiasing, true);
-#if defined(Q_OS_WINCE)
- view.setMinimumSize(230, 200);
-#else
view.setMinimumSize(400, 300);
-#endif
view.rotate(10);
view.scale(1.7, 1.7);
view.show();
@@ -4834,5 +4816,29 @@ void tst_QGraphicsScene::taskQTBUG_16401_focusItem()
QVERIFY(!scene.focusItem());
}
+void tst_QGraphicsScene::taskQTBUG_42915_focusNextPrevChild()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ scene.setSceneRect(1, 1, 198, 198);
+ view.setFocus();
+
+ QGraphicsWidget *widget1 = new QGraphicsWidget();
+ QGraphicsRectItem *rect1 = new QGraphicsRectItem(-50, -50, 100, 100, widget1);
+ rect1->setBrush(Qt::blue);
+ scene.addItem(widget1);
+ widget1->setPos(100, 100);
+ widget1->setFlags(QGraphicsItem::ItemIsPanel);
+
+ QGraphicsWidget *widget2 = new QGraphicsWidget(widget1);
+ widget2->setFocusPolicy(Qt::NoFocus);
+
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+
+ QTest::keyEvent(QTest::Click, &view, Qt::Key_Tab);
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro
index 3b74ab0c75..42c260d480 100644
--- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qgraphicssceneindex
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
QT += widgets widgets-private testlib
QT += core-private gui-private
SOURCES += tst_qgraphicssceneindex.cpp
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 1df9a9434c..2ecc1120b9 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -57,7 +57,6 @@
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
-#include "../../../qtest-config.h"
#include "tst_qgraphicsview.h"
Q_DECLARE_METATYPE(ExpectedValueDescription)
@@ -146,7 +145,6 @@ public:
: platformName(QGuiApplication::platformName().toLower())
{ }
private slots:
- void initTestCase();
void cleanup();
void construction();
void renderHints();
@@ -202,7 +200,7 @@ private slots:
#ifndef QT_NO_WHEELEVENT
void wheelEvent();
#endif
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void cursor();
void cursor2();
#endif
@@ -266,7 +264,7 @@ private slots:
void QTBUG_4151_clipAndIgnore_data();
void QTBUG_4151_clipAndIgnore();
void QTBUG_5859_exposedRect();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void QTBUG_7438_cursor();
#endif
void hoverLeave();
@@ -279,13 +277,6 @@ private:
QString platformName;
};
-void tst_QGraphicsView::initTestCase()
-{
-#ifdef Q_OS_WINCE_WM
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QGraphicsView::cleanup()
{
// ensure not even skipped tests with custom input context leave it dangling
@@ -739,7 +730,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
for (int i = 0; i < 2; ++i) {
// ScrollHandDrag
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
Qt::CursorShape cursorShape = view.viewport()->cursor().shape();
#endif
int horizontalScrollBarValue = view.horizontalScrollBar()->value();
@@ -758,7 +749,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
QTRY_VERIFY(item->isSelected());
for (int k = 0; k < 4; ++k) {
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QCOMPARE(view.viewport()->cursor().shape(), Qt::ClosedHandCursor);
#endif
{
@@ -801,7 +792,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
QTRY_VERIFY(item->isSelected());
QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue - 10);
QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue - 10);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QCOMPARE(view.viewport()->cursor().shape(), cursorShape);
#endif
@@ -861,7 +852,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
for (int i = 0; i < 2; ++i) {
// RubberBandDrag
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
Qt::CursorShape cursorShape = view.viewport()->cursor().shape();
#endif
int horizontalScrollBarValue = view.horizontalScrollBar()->value();
@@ -875,7 +866,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
QApplication::sendEvent(view.viewport(), &event);
QVERIFY(event.isAccepted());
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QCOMPARE(view.viewport()->cursor().shape(), cursorShape);
#endif
@@ -923,7 +914,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
}
QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue);
QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QCOMPARE(view.viewport()->cursor().shape(), cursorShape);
#endif
@@ -1428,20 +1419,9 @@ void tst_QGraphicsView::fitInView()
items[0]->setTransform(QTransform().rotate(30), true);
items[1]->setTransform(QTransform().rotate(-30), true);
-#if defined(Q_OS_WINCE)
- //Is the standard scrollbar size
- int scrollbarSize = qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) - 13;
-#endif
-
QGraphicsView view(&scene);
view.setSceneRect(-400, -400, 800, 800);
-
-#if defined(Q_OS_WINCE)
- //We need to take in account the scrollbar size for the WindowsMobilStyle
- view.setFixedSize(400 + scrollbarSize, 200 + scrollbarSize);
-#else
view.setFixedSize(400, 200);
-#endif
view.showNormal();
view.fitInView(scene.itemsBoundingRect(), Qt::IgnoreAspectRatio);
@@ -1855,11 +1835,7 @@ void tst_QGraphicsView::mapToScene()
QGraphicsView view(&topLevel);
view.setScene(&scene);
view.setSceneRect(-500, -500, 1000, 1000);
-#if defined(Q_OS_WINCE)
- QSize viewSize(200,200);
-#else
QSize viewSize(300,300);
-#endif
view.setFixedSize(viewSize);
topLevel.show();
@@ -2266,7 +2242,7 @@ void tst_QGraphicsView::wheelEvent()
}
#endif // !QT_NO_WHEELEVENT
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QGraphicsView::cursor()
{
QGraphicsScene scene;
@@ -2290,7 +2266,7 @@ void tst_QGraphicsView::cursor()
}
#endif
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QGraphicsView::cursor2()
{
QGraphicsScene scene;
@@ -3785,7 +3761,7 @@ void tst_QGraphicsView::mouseTracking()
QGraphicsView view(&scene);
QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
item->setCursor(Qt::CrossCursor);
#endif
scene.addItem(item);
@@ -3795,7 +3771,7 @@ void tst_QGraphicsView::mouseTracking()
// Adding an item to the scene before the scene is set on the view.
QGraphicsScene scene(-10000, -10000, 20000, 20000);
QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
item->setCursor(Qt::CrossCursor);
#endif
scene.addItem(item);
@@ -3812,7 +3788,7 @@ void tst_QGraphicsView::mouseTracking()
QGraphicsView view3(&scene);
QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
item->setCursor(Qt::CrossCursor);
#endif
scene.addItem(item);
@@ -4573,9 +4549,6 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
{
-#if defined(Q_OS_WINCE)
- QSKIP("Qt/CE does not implement mouse tracking at this point");
-#endif
QGraphicsScene scene(-100, -100, 200, 200);
scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue));
@@ -4767,7 +4740,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect);
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QGraphicsView::QTBUG_7438_cursor()
{
QGraphicsScene scene;
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index ca9f866e81..9e390e45a6 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -42,8 +42,6 @@
#include <qstylefactory.h>
#include <qscreen.h>
-#include "../../../qtest-config.h"
-
typedef QList<QGraphicsItem *> QGraphicsItemList;
class EventSpy : public QObject
@@ -1112,9 +1110,7 @@ void tst_QGraphicsWidget::initStyleOption()
bool hasFocus = option.state & QStyle::State_HasFocus;
QCOMPARE(hasFocus, focus);
bool isUnderMouse = option.state & QStyle::State_MouseOver;
-#ifndef Q_OS_WINCE
QCOMPARE(isUnderMouse, underMouse);
-#endif
// if (layoutDirection != Qt::LeftToRight)
//QEXPECT_FAIL("", "QApplicaiton::layoutDirection doesn't propagate to QGraphicsWidget", Continue);
//QCOMPARE(option.direction, layoutDirection);
@@ -2938,8 +2934,8 @@ protected:
void tst_QGraphicsWidget::respectHFW()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_MAC)
- QSKIP("This test is platform dependent, it fails on wince and mac. Please fix.");
+#if defined(Q_OS_DARWIN)
+ QSKIP("This test is platform dependent, it fails on Apple platforms. Please fix.");
#else
QGraphicsScene scene;
HFWWidget *window = new HFWWidget;
@@ -3184,7 +3180,7 @@ void tst_QGraphicsWidget::itemChangeEvents()
valueDuringEvents.insert(QEvent::ParentChange, QVariant::fromValue(parentItem()));
break;
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
case QEvent::CursorChange: {
valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape()));
break;
@@ -3235,7 +3231,7 @@ void tst_QGraphicsWidget::itemChangeEvents()
QVERIFY(!item->isVisible());
QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool());
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
// CursorChange should be triggered after the cursor has changed
item->setCursor(Qt::PointingHandCursor);
QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape()));
diff --git a/tests/auto/widgets/itemviews/itemviews.pro b/tests/auto/widgets/itemviews/itemviews.pro
index 2bd8ec43d3..af0b6aeef0 100644
--- a/tests/auto/widgets/itemviews/itemviews.pro
+++ b/tests/auto/widgets/itemviews/itemviews.pro
@@ -17,7 +17,7 @@ SUBDIRS=\
qtreewidget \
qtreewidgetitemiterator \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qcolumnview \
qlistwidget \
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 8cb95c867c..7412637354 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -95,7 +95,6 @@ public:
void basic_tests(QAbstractItemView *view);
private slots:
- void initTestCase();
void cleanup();
void getSetCheck();
void emptyModels_data();
@@ -254,13 +253,6 @@ void tst_QAbstractItemView::getSetCheck()
QCOMPARE(16, obj1->autoScrollMargin());
}
-void tst_QAbstractItemView::initTestCase()
-{
-#ifdef Q_OS_WINCE_WM
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QAbstractItemView::cleanup()
{
QVERIFY(QApplication::topLevelWidgets().isEmpty());
@@ -1205,9 +1197,6 @@ void tst_QAbstractItemView::task250754_fontChange()
void tst_QAbstractItemView::task200665_itemEntered()
{
-#ifdef Q_OS_WINCE_WM
- QSKIP("On Windows Mobile the mouse tracking is unavailable at the moment");
-#endif
//we test that view will emit entered
//when the scrollbar move but not the mouse itself
QStandardItemModel model(1000,1);
diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
index d717278be9..e6c4ab44f8 100644
--- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
@@ -183,9 +183,6 @@ void tst_QColumnView::initTestCase()
void tst_QColumnView::init()
{
qApp->setLayoutDirection(Qt::LeftToRight);
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
}
void tst_QColumnView::rootIndex()
diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
index 5190598701..ea4e9d4620 100644
--- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
+++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro
@@ -13,7 +13,7 @@ wince* {
DEPLOYMENT += addit tests sourceFile
}
-android|wince {
+android {
DEFINES += SRCDIR=\\\"./\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
index 06019d4555..30109952c7 100644
--- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
+++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
@@ -575,7 +575,7 @@ void tst_QDirModel::filePath()
model.setResolveSymlinks(false);
QModelIndex index = model.index(SRCDIR "test.lnk");
QVERIFY(index.isValid());
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_ANDROID)
+#if !defined(Q_OS_ANDROID)
QString path = SRCDIR;
#else
QString path = QFileInfo(SRCDIR).absoluteFilePath();
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index ea065a4db4..32a324b888 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -381,9 +381,6 @@ tst_QHeaderView::tst_QHeaderView()
void tst_QHeaderView::initTestCase()
{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
m_tableview = new QTableView();
}
@@ -554,11 +551,7 @@ void tst_QHeaderView::hidden()
void tst_QHeaderView::stretch()
{
// Show before resize and setStretchLastSection
-#if defined(Q_OS_WINCE)
- QSize viewSize(200,300);
-#else
QSize viewSize(500, 500);
-#endif
view->resize(viewSize);
view->setStretchLastSection(true);
QCOMPARE(view->stretchLastSection(), true);
@@ -618,12 +611,6 @@ void tst_QHeaderView::sectionSize()
QFETCH(int, lastVisibleSectionSize);
QFETCH(int, persistentSectionSize);
-#ifdef Q_OS_WINCE
- // We test on a device with doubled pixels. Therefore we need to specify
- // different boundaries.
- initialDefaultSize = qMax(view->minimumSectionSize(), 30);
-#endif
-
// bounds check
foreach (int val, boundsCheck)
view->sectionSize(val);
@@ -693,13 +680,7 @@ void tst_QHeaderView::visualIndexAt_data()
QTest::addColumn<QList<int> >("visual");
QList<int> coordinateList;
-#ifndef Q_OS_WINCE
coordinateList << -1 << 0 << 31 << 91 << 99999;
-#else
- // We test on a device with doubled pixels. Therefore we need to specify
- // different boundaries.
- coordinateList << -1 << 0 << 33 << 97 << 99999;
-#endif
QTest::newRow("no hidden, no moved sections")
<< QList<int>()
@@ -752,10 +733,6 @@ void tst_QHeaderView::visualIndexAt()
void tst_QHeaderView::length()
{
-#if defined(Q_OS_WINCE)
- QFont font(QLatin1String("Tahoma"), 7);
- view->setFont(font);
-#endif
view->setStretchLastSection(true);
topLevel->show();
QVERIFY(QTest::qWaitForWindowExposed(topLevel));
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro
index 02a71f8101..10cd1dcc54 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro
+++ b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro
@@ -3,4 +3,4 @@ TARGET = tst_qitemdelegate
QT += widgets widgets-private testlib
SOURCES += tst_qitemdelegate.cpp
-win32:!wince:!winrt: LIBS += -luser32
+win32:!winrt: LIBS += -luser32
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 972dabdcb8..0720a4f766 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -55,7 +55,7 @@
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
#include <windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
index d3211eada8..1fd7b31e22 100644
--- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
+++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
@@ -32,42 +32,13 @@
#include "viewstotest.cpp"
#include <stdlib.h>
-#if defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX) || defined(Q_OS_WIN)
#include <time.h>
#endif
-#if defined(Q_OS_WIN)
-#include <time.h>
-#if defined(Q_OS_WINCE)
-#include <aygshell.h>
-#endif
-#define random rand
-#define srandom srand
-
-#if defined(Q_OS_WINCE)
-#ifndef SPI_GETPLATFORMTYPE
-#define SPI_GETPLATFORMTYPE 257
-#endif
-
-bool qt_wince_is_platform(const QString &platformString) {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
- sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
- return true;
- return false;
-}
-
-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());
-}
-#endif
+#if defined(Q_OS_WIN)
+# define random rand
+# define srandom srand
#endif
/*!
@@ -305,10 +276,6 @@ void tst_QItemView::nonDestructiveBasicTest_data()
*/
void tst_QItemView::nonDestructiveBasicTest()
{
-#ifdef Q_OS_WINCE
- QTest::qWait(400);
-#endif
-
QFETCH(QString, viewType);
QFETCH(int, vscroll);
QFETCH(int, hscroll);
@@ -476,11 +443,7 @@ void tst_QItemView::spider()
view->setModel(treeModel);
view->show();
QVERIFY(QTest::qWaitForWindowActive(view));
-#if defined(Q_OS_WINCE)
- srandom(0);
-#else
srandom(time(0));
-#endif
touch(view->viewport(), Qt::NoModifier, Qt::Key_Left);
touch(view->viewport(), Qt::ShiftModifier, Qt::Key_Enter);
touch(view->viewport(), Qt::ControlModifier, Qt::Key_Backspace);
diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro
index 509303b62e..44e25ded66 100644
--- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro
+++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro
@@ -2,5 +2,5 @@ CONFIG += testcase
TARGET = tst_qlistview
QT += widgets gui-private widgets-private core-private testlib
SOURCES += tst_qlistview.cpp
-win32:!wince:!winrt: LIBS += -luser32
+win32:!winrt: LIBS += -luser32
linux*: CONFIG += insignificant_test # Crashes
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 98cc9b29ed..0f1c5723d5 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -46,13 +46,13 @@
#include <QtWidgets/QStyleFactory>
#include <QtWidgets/QVBoxLayout>
-#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
# include <windows.h>
# include <QtGui/QGuiApplication>
#include <qpa/qplatformnativeinterface.h>
#endif // Q_OS_WIN
-#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
static inline HWND getHWNDForWidget(const QWidget *widget)
{
QWindow *window = widget->windowHandle();
@@ -84,7 +84,6 @@ class tst_QListView : public QObject
Q_OBJECT
private slots:
- void initTestCase();
void cleanup();
void getSetCheck();
void noDelegate();
@@ -112,7 +111,7 @@ private slots:
void scrollBarAsNeeded();
void moveItems();
void wordWrap();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void setCurrentIndexAfterAppendRowCrash();
#endif
void emptyItemSize();
@@ -293,13 +292,6 @@ public:
}
};
-void tst_QListView::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QListView::cleanup()
{
QVERIFY(QApplication::topLevelWidgets().isEmpty());
@@ -984,25 +976,6 @@ void tst_QListView::selection_data()
<< QRect(300, 0, 1, 300) // selection rectangle
<< IntList(); // expected items
-#if defined(Q_OS_WINCE)
- // depending on whether the display is double-pixeld, we need
- // to click at a different position
- bool doubledSize = false;
- int dpi = GetDeviceCaps(GetDC(0), LOGPIXELSX);
- if ((dpi < 1000) && (dpi > 0)) {
- doubledSize = true;
- }
- QTest::newRow("select inside contents, (on viewport)")
- << 35 // itemCount
- << int(QListView::ListMode)
- << int(QListView::TopToBottom)
- << true // wrapping
- << 0 // spacing
- << QSize() // gridSize
- << IntList() // hiddenRows
- << QRect(doubledSize?350:175,doubledSize?550:275, 1, 1)// selection rectangle
- << IntList(); // expected items
-#else
QTest::newRow("select inside contents, (on viewport)")
<< 35 // itemCount
<< int(QListView::ListMode)
@@ -1013,7 +986,6 @@ void tst_QListView::selection_data()
<< IntList() // hiddenRows
<< QRect(175, 275, 1, 1) // selection rectangle
<< IntList(); // expected items
-#endif
QTest::newRow("select a tall rect in LeftToRight flow, wrap items")
<< 70 // itemCount
@@ -1138,17 +1110,7 @@ void tst_QListView::selection()
v.setRowHidden(hiddenRows.at(j), true);
}
-#if defined(Q_OS_WINCE)
- // If the device is double-pixeled then the scrollbars become
- // 10 pixels wider than normal (Windows Style: 16, Windows Mobile Style: 26).
- // So we have to make the window slightly bigger to have the same count of
- // items in each row of the list view like in the other styles.
- static const int dpi = ::GetDeviceCaps(GetDC(0), LOGPIXELSX);
- if ((dpi < 1000) && (dpi > 0))
- v.resize(535,535);
-#else
v.resize(525,525);
-#endif
topLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
@@ -1450,7 +1412,7 @@ void tst_QListView::wordWrap()
QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog
{
Q_OBJECT
@@ -1501,7 +1463,7 @@ void tst_QListView::setCurrentIndexAfterAppendRowCrash()
SetCurrentIndexAfterAppendRowCrashDialog w;
w.exec();
}
-#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // Q_OS_WIN && !Q_OS_WINRT
void tst_QListView::emptyItemSize()
{
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 7258044804..cf8ee310d3 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -61,8 +61,6 @@ class tst_QTableView : public QObject
Q_OBJECT
private slots:
- void initTestCase();
-
void getSetCheck();
void noDelegate();
@@ -520,13 +518,6 @@ public:
QSize hint;
};
-void tst_QTableView::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QTableView::noDelegate()
{
QtTestTableModel model(3, 3);
@@ -3996,10 +3987,6 @@ void tst_QTableView::mouseWheel_data()
void tst_QTableView::mouseWheel()
{
-#ifdef Q_OS_WINCE
- QSKIP("Since different Windows CE versions sport different taskbars, we skip this test");
-#endif
-
QFETCH(int, scrollMode);
QFETCH(int, delta);
QFETCH(int, horizontalPositon);
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 611aaa92e6..c7b7ffaf95 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -75,8 +75,6 @@ public slots:
void selectionOrderTest();
private slots:
- void initTestCase();
-
void getSetCheck();
// one test per QTreeView property
@@ -347,13 +345,6 @@ public:
mutable QMap<QModelIndex,QModelIndex> parentHash;
};
-void tst_QTreeView::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
// Testing get/set functions
void tst_QTreeView::getSetCheck()
{
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 205067d89c..7796627bd9 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -42,15 +42,12 @@ class tst_QAction : public QObject
public:
tst_QAction();
- virtual ~tst_QAction();
-
void updateState(QActionEvent *e);
-public slots:
- void initTestCase();
- void cleanupTestCase();
private slots:
+ void init();
+ void cleanup();
void getSetCheck();
void setText_data();
void setText();
@@ -68,11 +65,26 @@ private slots:
private:
int m_lastEventType;
- int m_keyboardScheme;
+ const int m_keyboardScheme;
QAction *m_lastAction;
- QWidget *m_tstWidget;
};
+tst_QAction::tst_QAction()
+ : m_keyboardScheme(QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt())
+{
+}
+
+void tst_QAction::init()
+{
+ m_lastEventType = 0;
+ m_lastAction = nullptr;
+}
+
+void tst_QAction::cleanup()
+{
+ QVERIFY(QApplication::topLevelWidgets().isEmpty());
+}
+
// Testing get/set functions
void tst_QAction::getSetCheck()
{
@@ -104,46 +116,16 @@ class MyWidget : public QWidget
{
Q_OBJECT
public:
- MyWidget(tst_QAction *tst, QWidget *parent = 0) : QWidget(parent) { this->tst = tst; }
+ explicit MyWidget(tst_QAction *tst, QWidget *parent = nullptr) : QWidget(parent), m_test(tst)
+ { setWindowTitle(QTest::currentTestFunction()); }
protected:
- virtual void actionEvent(QActionEvent *e) { tst->updateState(e); }
+ void actionEvent(QActionEvent *e) override { m_test->updateState(e); }
private:
- tst_QAction *tst;
+ tst_QAction *m_test;
};
-tst_QAction::tst_QAction() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme)
-{
- if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
- m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
-}
-
-tst_QAction::~tst_QAction()
-{
-
-}
-
-void tst_QAction::initTestCase()
-{
- m_lastEventType = 0;
- m_lastAction = 0;
-
- MyWidget *mw = new MyWidget(this);
- m_tstWidget = mw;
- mw->show();
- qApp->setActiveWindow(mw);
-}
-
-void tst_QAction::cleanupTestCase()
-{
- QWidget *testWidget = m_tstWidget;
- if (testWidget) {
- testWidget->hide();
- delete testWidget;
- }
-}
-
void tst_QAction::setText_data()
{
QTest::addColumn<QString>("text");
@@ -208,7 +190,10 @@ void tst_QAction::actionEvent()
a.setText("action text");
// add action
- m_tstWidget->addAction(&a);
+ MyWidget testWidget(this);
+ testWidget.show();
+ QApplication::setActiveWindow(&testWidget);
+ testWidget.addAction(&a);
qApp->processEvents();
QCOMPARE(m_lastEventType, (int)QEvent::ActionAdded);
@@ -222,7 +207,7 @@ void tst_QAction::actionEvent()
QCOMPARE(m_lastAction, &a);
// remove action
- m_tstWidget->removeAction(&a);
+ testWidget.removeAction(&a);
qApp->processEvents();
QCOMPARE(m_lastEventType, (int)QEvent::ActionRemoved);
@@ -262,22 +247,24 @@ void tst_QAction::alternateShortcuts()
{
//test the alternate shortcuts (by adding more than 1 shortcut)
- QWidget *wid = m_tstWidget;
+ MyWidget testWidget(this);
+ testWidget.show();
+ QApplication::setActiveWindow(&testWidget);
{
- QAction act(wid);
- wid->addAction(&act);
+ QAction act(&testWidget);
+ testWidget.addAction(&act);
QList<QKeySequence> shlist = QList<QKeySequence>() << QKeySequence("CTRL+P") << QKeySequence("CTRL+A");
act.setShortcuts(shlist);
QSignalSpy spy(&act, SIGNAL(triggered()));
act.setAutoRepeat(true);
- QTest::keyClick(wid, Qt::Key_A, Qt::ControlModifier);
+ QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier);
QCOMPARE(spy.count(), 1); //act should have been triggered
act.setAutoRepeat(false);
- QTest::keyClick(wid, Qt::Key_A, Qt::ControlModifier);
+ QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier);
QCOMPARE(spy.count(), 2); //act should have been triggered a 2nd time
//end of the scope of the action, it will be destroyed and removed from wid
@@ -286,11 +273,15 @@ void tst_QAction::alternateShortcuts()
//this tests a crash (if the action did not unregister its alternate shortcuts)
- QTest::keyClick(wid, Qt::Key_A, Qt::ControlModifier);
+ QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier);
}
void tst_QAction::enabledVisibleInteraction()
{
+ MyWidget testWidget(this);
+ testWidget.show();
+ QApplication::setActiveWindow(&testWidget);
+
QAction act(0);
// check defaults
QVERIFY(act.isEnabled());
@@ -305,20 +296,20 @@ void tst_QAction::enabledVisibleInteraction()
QVERIFY(act.isVisible());
// check if shortcut is disabled if not visible
- m_tstWidget->addAction(&act);
+ testWidget.addAction(&act);
act.setShortcut(QKeySequence("Ctrl+T"));
QSignalSpy spy(&act, SIGNAL(triggered()));
act.setEnabled(true);
act.setVisible(false);
- QTest::keyClick(m_tstWidget, Qt::Key_T, Qt::ControlModifier);
+ QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier);
QCOMPARE(spy.count(), 0); //act is not visible, so don't trigger
act.setVisible(false);
act.setEnabled(true);
- QTest::keyClick(m_tstWidget, Qt::Key_T, Qt::ControlModifier);
+ QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier);
QCOMPARE(spy.count(), 0); //act is not visible, so don't trigger
act.setVisible(true);
act.setEnabled(true);
- QTest::keyClick(m_tstWidget, Qt::Key_T, Qt::ControlModifier);
+ QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier);
QCOMPARE(spy.count(), 1); //act is visible and enabled, so trigger
}
@@ -378,38 +369,42 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
void tst_QAction::repeat()
{
- QWidget *wid = m_tstWidget;
- QAction act(wid);
- wid->addAction(&act);
+ MyWidget testWidget(this);
+ testWidget.show();
+ QApplication::setActiveWindow(&testWidget);
+ QVERIFY(QTest::qWaitForWindowActive(&testWidget));
+
+ QAction act(&testWidget);
+ testWidget.addAction(&act);
act.setShortcut(QKeySequence(Qt::Key_F));
QSignalSpy spy(&act, SIGNAL(triggered()));
act.setAutoRepeat(true);
- QTest::keyPress(wid, Qt::Key_F);
- QTest::keyRelease(wid, Qt::Key_F);
+ QTest::keyPress(&testWidget, Qt::Key_F);
+ QTest::keyRelease(&testWidget, Qt::Key_F);
QCOMPARE(spy.count(), 1);
spy.clear();
- QTest::keyPress(wid, Qt::Key_F);
+ QTest::keyPress(&testWidget, Qt::Key_F);
// repeat event
- QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
- QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
- QTest::keyRelease(wid, Qt::Key_F);
+ QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
+ QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
+ QTest::keyRelease(&testWidget, Qt::Key_F);
QCOMPARE(spy.count(), 3);
spy.clear();
act.setAutoRepeat(false);
- QTest::keyPress(wid, Qt::Key_F);
- QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
- QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
- QTest::keyRelease(wid, Qt::Key_F);
+ QTest::keyPress(&testWidget, Qt::Key_F);
+ QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
+ QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
+ QTest::keyRelease(&testWidget, Qt::Key_F);
QCOMPARE(spy.count(), 1);
spy.clear();
act.setAutoRepeat(true);
- QTest::keyPress(wid, Qt::Key_F);
- QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
- QTest::keyRelease(wid, Qt::Key_F);
+ QTest::keyPress(&testWidget, Qt::Key_F);
+ QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true);
+ QTest::keyRelease(&testWidget, Qt::Key_F);
QCOMPARE(spy.count(), 2);
}
diff --git a/tests/auto/widgets/kernel/qapplication/test/test.pro b/tests/auto/widgets/kernel/qapplication/test/test.pro
index 908aa846c0..92409e4bfe 100644
--- a/tests/auto/widgets/kernel/qapplication/test/test.pro
+++ b/tests/auto/widgets/kernel/qapplication/test/test.pro
@@ -11,7 +11,7 @@ TESTDATA = ../test/test.pro ../tmp/README
!winrt {
SUBPROGRAMS = desktopsettingsaware modal
- win32:!wince: SUBPROGRAMS += wincmdline
+ win32:SUBPROGRAMS += wincmdline
for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
}
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index ab9729342c..411b925adb 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -52,15 +52,9 @@
#include <QtWidgets/private/qapplication_p.h>
#include <QtWidgets/QStyle>
-#ifdef Q_OS_WINCE
-#include <windows.h>
-#endif
-
#include <qpa/qwindowsysteminterface.h>
#include <private/qhighdpiscaling_p.h>
-#include "../../../qtest-config.h"
-
QT_BEGIN_NAMESPACE
static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
{
@@ -235,10 +229,6 @@ static char *argv0;
tst_QApplication::tst_QApplication()
: quitApplicationTriggered(false)
{
-#ifdef Q_OS_WINCE
- // Clean up environment previously to launching test
- qputenv("QT_PLUGIN_PATH", QByteArray());
-#endif
}
void tst_QApplication::cleanup()
@@ -897,19 +887,8 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r)
#define QT_TST_QAPP_DEBUG
void tst_QApplication::libraryPaths()
{
-#ifndef Q_OS_WINCE
const QString testDir = QFileInfo(QFINDTESTDATA("test/test.pro")).absolutePath();
QVERIFY(!testDir.isEmpty());
-#else // !Q_OS_WINCE
- // On Windows CE we need QApplication object to have valid
- // current Path. Therefore we need to identify it ourselves
- // here for the test.
- QFileInfo filePath;
- wchar_t module_name[MAX_PATH];
- GetModuleFileName(0, module_name, MAX_PATH);
- filePath = QString::fromWCharArray(module_name);
- const QString testDir = filePath.path() + "/test";
-#endif // Q_OS_WINCE
{
QApplication::setLibraryPaths(QStringList() << testDir);
QCOMPARE(QApplication::libraryPaths(), (QStringList() << testDir));
@@ -1000,11 +979,7 @@ void tst_QApplication::libraryPaths()
QString appDirPath = app.applicationDirPath();
app.addLibraryPath(appDirPath);
-#ifdef Q_OS_WINCE
- app.addLibraryPath(appDirPath + "/../..");
-#else
app.addLibraryPath(appDirPath + "/..");
-#endif
#ifdef QT_TST_QAPP_DEBUG
qDebug() << "appDirPath" << appDirPath;
qDebug() << "After adding appDirPath && appDirPath + /..:" << app.libraryPaths();
@@ -1044,15 +1019,9 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2()
QByteArray nonExistentPath = "/nonexistent";
QByteArray pluginPath = validPath + ':' + nonExistentPath;
#elif defined(Q_OS_WIN)
-# ifdef Q_OS_WINCE
- QByteArray validPath = "/Temp";
- QByteArray nonExistentPath = "/nonexistent";
- QByteArray pluginPath = validPath + ';' + nonExistentPath;
-# else
QByteArray validPath = "C:\\windows";
QByteArray nonExistentPath = "Z:\\nonexistent";
QByteArray pluginPath = validPath + ';' + nonExistentPath;
-# endif
#endif
{
@@ -1069,9 +1038,7 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2()
<< QLibraryInfo::location(QLibraryInfo::PluginsPath)
<< QDir(app.applicationDirPath()).canonicalPath()
<< QDir(QDir::fromNativeSeparators(QString::fromLatin1(validPath))).canonicalPath();
-# ifdef Q_OS_WINCE
- expected = QSet<QString>::fromList(expected).toList();
-# endif
+
QVERIFY2(isPathListIncluded(app.libraryPaths(), expected),
qPrintable("actual:\n - " + app.libraryPaths().join("\n - ") +
"\nexpected:\n - " + expected.join("\n - ")));
@@ -1091,9 +1058,6 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2()
QStringList()
<< QLibraryInfo::location(QLibraryInfo::PluginsPath)
<< app.applicationDirPath();
-# ifdef Q_OS_WINCE
- expected = QSet<QString>::fromList(expected).toList();
-# endif
QVERIFY(isPathListIncluded(app.libraryPaths(), expected));
qputenv("QT_PLUGIN_PATH", QByteArray());
@@ -1479,10 +1443,6 @@ void tst_QApplication::desktopSettingsAware()
}
QVERIFY2(!path.isEmpty(), "Cannot locate desktopsettingsaware helper application");
path += "desktopsettingsaware";
-#ifdef Q_OS_WINCE
- int argc = 0;
- QApplication tmpApp(argc, 0);
-#endif
QProcess testProcess;
testProcess.start(path);
QVERIFY2(testProcess.waitForStarted(),
@@ -1955,9 +1915,7 @@ void tst_QApplication::touchEventPropagation()
release.setState(Qt::TouchPointReleased);
releasedTouchPoints << release;
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
+ QTouchDevice *device = QTest::createTouchDevice();
{
// touch event behavior on a window
@@ -2312,7 +2270,7 @@ Q_GLOBAL_STATIC(QPixmap, tst_qapp_pixmap);
Q_GLOBAL_STATIC(QFont, tst_qapp_font);
Q_GLOBAL_STATIC(QRegion, tst_qapp_region);
Q_GLOBAL_STATIC(QFontDatabase, tst_qapp_fontDatabase);
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
Q_GLOBAL_STATIC(QCursor, tst_qapp_cursor);
#endif
@@ -2337,7 +2295,7 @@ void tst_QApplication::globalStaticObjectDestruction()
QVERIFY(tst_qapp_font());
QVERIFY(tst_qapp_region());
QVERIFY(tst_qapp_fontDatabase());
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QVERIFY(tst_qapp_cursor());
#endif
}
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index a19f4aea56..b7ca5d21c7 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -84,6 +84,12 @@ private slots:
void insertRow_QString_QLayout();
void insertRow_QWidget();
void insertRow_QLayout();
+ void removeRow();
+ void removeRow_QWidget();
+ void removeRow_QLayout();
+ void takeRow();
+ void takeRow_QWidget();
+ void takeRow_QLayout();
void setWidget();
void setLayout();
@@ -687,6 +693,237 @@ void tst_QFormLayout::insertRow_QLayout()
// ### come back to this later
}
+void tst_QFormLayout::removeRow()
+{
+ QWidget topLevel;
+ QFormLayout *layout = new QFormLayout(&topLevel);
+
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QPointer<QWidget> w1 = new QWidget;
+ QPointer<QWidget> w2 = new QWidget;
+
+ layout->addRow("test1", w1);
+ layout->addRow(w2);
+
+ QCOMPARE(layout->count(), 3);
+ QCOMPARE(layout->rowCount(), 2);
+
+ layout->removeRow(1);
+
+ QVERIFY(!w1);
+ QCOMPARE(layout->count(), 1);
+ QCOMPARE(layout->rowCount(), 1);
+
+ layout->removeRow(0);
+
+ QVERIFY(!w2);
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+}
+
+void tst_QFormLayout::removeRow_QWidget()
+{
+ QWidget topLevel;
+ QFormLayout *layout = new QFormLayout(&topLevel);
+
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QPointer<QWidget> w1 = new QWidget;
+ QPointer<QWidget> w2 = new QWidget;
+
+ layout->addRow("test1", w1);
+ layout->addRow(w2);
+
+ QCOMPARE(layout->count(), 3);
+ QCOMPARE(layout->rowCount(), 2);
+
+ layout->removeRow(w1);
+
+ QVERIFY(!w1);
+ QCOMPARE(layout->count(), 1);
+ QCOMPARE(layout->rowCount(), 1);
+
+ layout->removeRow(w2);
+
+ QVERIFY(!w2);
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QWidget *w3 = new QWidget;
+ layout->removeRow(w3);
+ delete w3;
+}
+
+void tst_QFormLayout::removeRow_QLayout()
+{
+ QWidget topLevel;
+ QFormLayout *layout = new QFormLayout(&topLevel);
+
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QPointer<QHBoxLayout> l1 = new QHBoxLayout;
+ QPointer<QWidget> w1 = new QWidget;
+ l1->addWidget(w1);
+ QPointer<QHBoxLayout> l2 = new QHBoxLayout;
+ QPointer<QWidget> w2 = new QWidget;
+ l2->addWidget(w2);
+
+ layout->addRow("test1", l1);
+ layout->addRow(l2);
+
+ QCOMPARE(layout->count(), 3);
+ QCOMPARE(layout->rowCount(), 2);
+
+ layout->removeRow(l1);
+
+ QVERIFY(!l1);
+ QVERIFY(!w1);
+ QCOMPARE(layout->count(), 1);
+ QCOMPARE(layout->rowCount(), 1);
+
+ layout->removeRow(l2);
+
+ QVERIFY(!l2);
+ QVERIFY(!w2);
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QHBoxLayout *l3 = new QHBoxLayout;
+ layout->removeRow(l3);
+ delete l3;
+}
+
+void tst_QFormLayout::takeRow()
+{
+ QWidget topLevel;
+ QFormLayout *layout = new QFormLayout(&topLevel);
+
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QPointer<QWidget> w1 = new QWidget;
+ QPointer<QWidget> w2 = new QWidget;
+
+ layout->addRow("test1", w1);
+ layout->addRow(w2);
+
+ QCOMPARE(layout->count(), 3);
+ QCOMPARE(layout->rowCount(), 2);
+
+ QFormLayout::TakeRowResult result = layout->takeRow(1);
+
+ QVERIFY(w2);
+ QVERIFY(result.fieldItem);
+ QVERIFY(result.labelItem);
+ QCOMPARE(layout->count(), 1);
+ QCOMPARE(layout->rowCount(), 1);
+
+ result = layout->takeRow(0);
+
+ QVERIFY(w1);
+ QVERIFY(result.fieldItem);
+ QVERIFY(!result.labelItem);
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ result = layout->takeRow(0);
+
+ QVERIFY(!result.fieldItem);
+ QVERIFY(!result.labelItem);
+}
+
+void tst_QFormLayout::takeRow_QWidget()
+{
+ QWidget topLevel;
+ QFormLayout *layout = new QFormLayout(&topLevel);
+
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QPointer<QWidget> w1 = new QWidget;
+ QPointer<QWidget> w2 = new QWidget;
+
+ layout->addRow("test1", w1);
+ layout->addRow(w2);
+
+ QCOMPARE(layout->count(), 3);
+ QCOMPARE(layout->rowCount(), 2);
+
+ QFormLayout::TakeRowResult result = layout->takeRow(w1);
+
+ QVERIFY(w1);
+ QVERIFY(result.fieldItem);
+ QVERIFY(result.labelItem);
+ QCOMPARE(layout->count(), 1);
+ QCOMPARE(layout->rowCount(), 1);
+
+ result = layout->takeRow(w2);
+
+ QVERIFY(w2);
+ QVERIFY(result.fieldItem);
+ QVERIFY(!result.labelItem);
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QWidget *w3 = new QWidget;
+ result = layout->takeRow(w3);
+ delete w3;
+
+ QVERIFY(!result.fieldItem);
+ QVERIFY(!result.labelItem);
+}
+
+void tst_QFormLayout::takeRow_QLayout()
+{
+ QWidget topLevel;
+ QFormLayout *layout = new QFormLayout(&topLevel);
+
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QPointer<QHBoxLayout> l1 = new QHBoxLayout;
+ QPointer<QWidget> w1 = new QWidget;
+ l1->addWidget(w1);
+ QPointer<QHBoxLayout> l2 = new QHBoxLayout;
+ QPointer<QWidget> w2 = new QWidget;
+ l2->addWidget(w2);
+
+ layout->addRow("test1", l1);
+ layout->addRow(l2);
+
+ QCOMPARE(layout->count(), 3);
+ QCOMPARE(layout->rowCount(), 2);
+
+ QFormLayout::TakeRowResult result = layout->takeRow(l1);
+
+ QVERIFY(l1);
+ QVERIFY(w1);
+ QVERIFY(result.fieldItem);
+ QVERIFY(result.labelItem);
+ QCOMPARE(layout->count(), 1);
+ QCOMPARE(layout->rowCount(), 1);
+
+ result = layout->takeRow(l2);
+
+ QVERIFY(l2);
+ QVERIFY(w2);
+ QVERIFY(result.fieldItem);
+ QVERIFY(!result.labelItem);
+ QCOMPARE(layout->count(), 0);
+ QCOMPARE(layout->rowCount(), 0);
+
+ QHBoxLayout *l3 = new QHBoxLayout;
+ result = layout->takeRow(l3);
+ delete l3;
+
+ QVERIFY(!result.fieldItem);
+ QVERIFY(!result.labelItem);
+}
+
void tst_QFormLayout::setWidget()
{
QFormLayout layout;
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index e5da83ed37..c1ab5f51be 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -56,7 +56,6 @@ class tst_QGridLayout : public QObject
Q_OBJECT
private slots:
- void initTestCase();
void cleanup();
void getItemPosition();
void itemAtPosition();
@@ -81,17 +80,11 @@ private slots:
void taskQTBUG_27420_takeAtShouldUnparentLayout();
void taskQTBUG_40609_addingWidgetToItsOwnLayout();
void taskQTBUG_40609_addingLayoutToItself();
+ void taskQTBUG_52357_spacingWhenItemIsHidden();
void replaceWidget();
void dontCrashWhenExtendsToEnd();
};
-void tst_QGridLayout::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
static inline int visibleTopLevelWidgetCount()
{
int result= 0;
@@ -605,19 +598,6 @@ void tst_QGridLayout::spacingsAndMargins_data()
<< QPoint( 20, child_offset_y)
<< QPoint( 20, child_offset_y + 100 + 6)
);
-#if defined (Q_OS_WINCE) //There is not enough screenspace to run the test in original size on Windows CE. We use smaller widgets.
- child_offset_y = 11 + 9 + 50 + 6 + 50 + 6 + 50 + 6;
- QTest::newRow("1x3 grid") << 1 << 3 << QSize(50, 50)
- << (PointList() // toplevel
- << QPoint( 11, 11)
- << QPoint( 11, 11 + 50 + 6)
- << QPoint( 11, 11 + 50 + 6 + 50 + 6)
- // children
- << QPoint( 20, child_offset_y)
- << QPoint( 20, child_offset_y + 50 + 6)
- << QPoint( 20, child_offset_y + 50 + 6 + 50 + 6)
- );
-#else
child_offset_y = 11 + 9 + 100 + 6 + 100 + 6 + 100 + 6;
QTest::newRow("1x3 grid") << 1 << 3 << QSize(100, 100)
<< (PointList() // toplevel
@@ -629,7 +609,6 @@ void tst_QGridLayout::spacingsAndMargins_data()
<< QPoint( 20, child_offset_y + 100 + 6)
<< QPoint( 20, child_offset_y + 100 + 6 + 100 + 6)
);
-#endif
child_offset_y = 11 + 9 + 100 + 6 + 100 + 6;
QTest::newRow("2x2 grid") << 2 << 2 << QSize(100, 100)
@@ -1674,6 +1653,26 @@ void tst_QGridLayout::taskQTBUG_40609_addingLayoutToItself(){
QCOMPARE(layout.count(), 0);
}
+void tst_QGridLayout::taskQTBUG_52357_spacingWhenItemIsHidden()
+{
+ QWidget widget;
+ setFrameless(&widget);
+ QGridLayout layout(&widget);
+ layout.setMargin(0);
+ layout.setSpacing(5);
+ QPushButton button1;
+ layout.addWidget(&button1, 0, 0);
+ QPushButton button2;
+ layout.addWidget(&button2, 0, 1);
+ QPushButton button3;
+ layout.addWidget(&button3, 0, 2);
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ int tempWidth = button1.width() + button2.width() + button3.width() + 2 * layout.spacing();
+ button2.hide();
+ QTRY_COMPARE_WITH_TIMEOUT(tempWidth, button1.width() + button3.width() + layout.spacing(), 1000);
+}
+
void tst_QGridLayout::replaceWidget()
{
QWidget wdg;
diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro
index 2213767950..d460785158 100644
--- a/tests/auto/widgets/kernel/qlayout/qlayout.pro
+++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro
@@ -4,13 +4,7 @@ TARGET = tst_qlayout
QT += widgets widgets-private testlib
SOURCES += tst_qlayout.cpp
-wince* {
- addFiles.files = baseline
- addFiles.path = .
- DEPLOYMENT += addFiles
-} else {
- TESTDATA += baseline/*
-}
+TESTDATA += baseline/*
android {
RESOURCES += \
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index 98a4caf49e..6fe6bd2f67 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -3,6 +3,7 @@
ubuntu-14.04
[saveRestoreGeometry]
ubuntu-14.04
+ubuntu-16.04
[restoreVersion1Geometry]
ubuntu-14.04
osx
@@ -53,6 +54,7 @@ osx
osx
[maskedUpdate]
osx
+opensuse-42.1
[hideWhenFocusWidgetIsChild]
osx-10.10
[hideOpaqueChildWhileHidden]
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro
index a3fd622896..499ca65516 100644
--- a/tests/auto/widgets/kernel/qwidget/qwidget.pro
+++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro
@@ -16,8 +16,4 @@ mac {
OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm
}
-x11 {
- LIBS += $$QMAKE_LIBS_X11
-}
-
-win32:!wince:!winrt: LIBS += -luser32 -lgdi32
+win32:!winrt: LIBS += -luser32 -lgdi32
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 272e6ef02f..5f3fed1f66 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -67,15 +67,13 @@
#include <QtGui/qwindow.h>
#include <qtimer.h>
-#include "../../../qtest-config.h"
-
#if defined(Q_OS_OSX)
#include "tst_qwidget_mac_helpers.h" // Abstract the ObjC stuff out so not everyone must run an ObjC++ compile.
#endif
#include <QtTest/QTest>
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
# include <QtCore/qt_windows.h>
# include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
@@ -91,49 +89,12 @@ static HWND winHandleOf(const QWidget *w)
return 0;
}
-# ifdef Q_OS_WINCE
-# define Q_CHECK_PAINTEVENTS
-# ifdef Q_OS_WINCE_WM
-# include <qguifunctions_wince.h>
-// taken from qguifunctions_wce.cpp
-# define SPI_GETPLATFORMTYPE 257
-static bool qt_wince_is_platform(const QString &platformString) {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
- sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
- return true;
- return false;
-}
-static inline bool qt_wince_is_smartphone() { return qt_wince_is_platform(QString::fromLatin1("Smartphone")); }
-# endif // Q_OS_WINCE_WM
-# elif !defined(Q_OS_WINRT) // Q_OS_WINCE
-# define Q_CHECK_PAINTEVENTS \
+# define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
QSKIP("desktop is not visible, this test would fail");
-# else // !Q_OS_WINCE && !Q_OS_WINRT
-# define Q_CHECK_PAINTEVENTS
-# endif // Q_OS_WINRT
-#else // Q_OS_WIN
+
+#else // Q_OS_WIN && !Q_OS_WINRT
# define Q_CHECK_PAINTEVENTS
-#endif // else Q_OS_WIN
-
-
-#if defined(Q_OS_WINCE_WM)
-#include <qguifunctions_wince.h>
-// taken from qguifunctions_wce.cpp
-#define SPI_GETPLATFORMTYPE 257
-bool qt_wince_is_platform(const QString &platformString) {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
- sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
- return true;
- return false;
-}
-bool qt_wince_is_smartphone() {
- return qt_wince_is_platform(QString::fromLatin1("Smartphone"));
-}
#endif
#ifdef Q_OS_OSX
@@ -163,7 +124,7 @@ static inline void centerOnScreen(QWidget *w)
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
static inline void setWindowsAnimationsEnabled(bool enabled)
{
ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), enabled };
@@ -176,10 +137,10 @@ static inline bool windowsAnimationsEnabled()
SystemParametersInfo(SPI_GETANIMATION, 0, &animation, 0);
return animation.iMinAnimate;
}
-#else // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+#else // Q_OS_WIN && !Q_OS_WINRT
inline void setWindowsAnimationsEnabled(bool) {}
static inline bool windowsAnimationsEnabled() { return false; }
-#endif // !Q_OS_WIN || Q_OS_WINCE || Q_OS_WINRT
+#endif // !Q_OS_WIN || Q_OS_WINRT
template <class T>
static QByteArray msgComparisonFailed(T v1, const char *op, T v2)
@@ -212,8 +173,6 @@ public:
public slots:
void initTestCase();
- void cleanupTestCase();
- void init();
void cleanup();
private slots:
void getSetCheck();
@@ -251,9 +210,7 @@ private slots:
void hideWhenFocusWidgetIsChild();
void normalGeometry();
void setGeometry();
-#ifndef Q_OS_WINCE
void windowOpacity();
-#endif
void raise();
void lower();
void stackUnder();
@@ -315,7 +272,7 @@ private slots:
void subtractOpaqueSiblings();
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
void setGeometry_win();
#endif
@@ -323,7 +280,7 @@ private slots:
void deleteStyle();
void multipleToplevelFocusCheck();
void setFocus();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void setCursor();
#endif
void setToolTip();
@@ -340,9 +297,7 @@ private slots:
void render_task188133();
void render_task211796();
void render_task217815();
-#ifndef Q_OS_WINCE
void render_windowOpacity();
-#endif
void render_systemClip();
void render_systemClip2_data();
void render_systemClip2();
@@ -358,9 +313,7 @@ private slots:
void repaintWhenChildDeleted();
void hideOpaqueChildWhileHidden();
-#if !defined(Q_OS_WINCE)
void updateWhileMinimized();
-#endif
void alienWidgets();
void adjustSize();
void adjustSize_data();
@@ -395,7 +348,7 @@ private slots:
void setClearAndResizeMask();
void maskedUpdate();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void syntheticEnterLeave();
void taskQTBUG_4055_sendSyntheticEnterLeave();
void underMouse();
@@ -407,9 +360,7 @@ private slots:
void toplevelLineEditFocus();
void focusWidget_task254563();
-#ifndef Q_OS_WINCE_WM
void rectOutsideCoordinatesLimit_task144779();
-#endif
void setGraphicsEffect();
#ifdef QT_BUILD_INTERNAL
@@ -458,13 +409,13 @@ private slots:
private:
bool ensureScreenSize(int width, int height);
- QWidget *testWidget;
const QString m_platform;
QSize m_testWidgetSize;
QPoint m_availableTopLeft;
QPoint m_safeCursorPos;
const bool m_windowsAnimationsEnabled;
+ QTouchDevice *m_touchScreen;
};
bool tst_QWidget::ensureScreenSize(int width, int height)
@@ -612,7 +563,7 @@ void tst_QWidget::getSetCheck()
QCOMPARE(true, obj1.autoFillBackground());
var1.reset();
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
const HWND handle = reinterpret_cast<HWND>(obj1.winId()); // explicitly create window handle
QVERIFY(GetWindowLong(handle, GWL_STYLE) & WS_POPUP);
@@ -623,6 +574,7 @@ tst_QWidget::tst_QWidget()
: m_platform(QGuiApplication::platformName().toLower())
, m_safeCursorPos(0, 0)
, m_windowsAnimationsEnabled(windowsAnimationsEnabled())
+ , m_touchScreen(QTest::createTouchDevice())
{
if (m_windowsAnimationsEnabled) // Disable animations which can interfere with screen grabbing in moveChild(), showAndMoveChild()
setWindowsAnimationsEnabled(false);
@@ -635,8 +587,6 @@ tst_QWidget::tst_QWidget()
palette.setColor(QPalette::ToolTipBase, QColor(12, 13, 14));
palette.setColor(QPalette::Text, QColor(21, 22, 23));
qApp->setPalette(palette, "QPropagationTestWidget");
-
- testWidget = 0;
}
tst_QWidget::~tst_QWidget()
@@ -657,9 +607,6 @@ private:
void tst_QWidget::initTestCase()
{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
// Size of reference widget, 200 for < 2000, scale up for larger screens
// to avoid Windows warnings about minimum size for decorated windows.
int width = 200;
@@ -675,122 +622,23 @@ void tst_QWidget::initTestCase()
if (screenWidth > 2000)
width = 100 * ((screenWidth + 500) / 1000);
m_testWidgetSize = QSize(width, width);
- // Create the test class
- testWidget = new BezierViewer;
- testWidget->setWindowTitle(QStringLiteral("BezierViewer"));
- testWidget->move(m_availableTopLeft + QPoint(screenWidth / 3, 50));
- testWidget->resize(m_testWidgetSize);
- testWidget->show();
- QVERIFY(QTest::qWaitForWindowExposed(testWidget));
-}
-
-void tst_QWidget::cleanupTestCase()
-{
- delete testWidget;
- testWidget = 0;
-}
-
-void tst_QWidget::init()
-{
-// TODO: Add initialization code here.
-// This will be executed immediately before each test is run.
- testWidget->setFont(QFont());
- testWidget->setPalette(QPalette());
}
void tst_QWidget::cleanup()
{
- // Only 'testwidget', do not leak any other widgets.
- QCOMPARE(QApplication::topLevelWidgets().size(), 1);
-}
-
-// Helper class...
-
-BezierViewer::BezierViewer( QWidget* parent)
- : QWidget(parent)
-{
- setObjectName(QLatin1String("TestWidget"));
- setWindowTitle(objectName());
- QPalette pal;
- pal.setColor(backgroundRole(), Qt::white);
- setPalette(pal);
-}
-
-
-void BezierViewer::setPoints( const QPolygonF& a )
-{
- points = a;
-}
-
-#include "private/qbezier_p.h"
-void BezierViewer::paintEvent( QPaintEvent* )
-{
- if ( points.size() != 4 ) {
-#if defined(QT_CHECK_RANGE)
- qWarning( "QPolygon::bezier: The array must have 4 control points" );
-#endif
- return;
- }
-
- /* Calculate Bezier curve */
- QPolygonF bezier = QBezier::fromPoints(points.at(0),points.at(1),points.at(2),points.at(3)).toPolygon();
-
- QPainter painter( this );
-
- /* Calculate scale to fit in window */
- QRectF br = bezier.boundingRect() | points.boundingRect();
- QRectF pr = rect();
- int scl = qMax( qMin(pr.width()/br.width(), pr.height()/br.height()), qreal(1.) );
- int border = scl-1;
-
- /* Scale Bezier curve vertices */
- for ( QPolygonF::Iterator it = bezier.begin(); it != bezier.end(); ++it ) {
- it->setX( (it->x()-br.x()) * scl + border );
- it->setY( (it->y()-br.y()) * scl + border );
- }
-
- /* Draw grid */
- painter.setPen( Qt::lightGray );
- int i;
- for ( i = border; i <= pr.width(); i += scl ) {
- painter.drawLine( i, 0, i, pr.height() );
- }
- for ( int j = border; j <= pr.height(); j += scl ) {
- painter.drawLine( 0, j, pr.width(), j );
- }
-
- /* Write number of vertices */
- painter.setPen( Qt::red );
- painter.setFont( QFont("Helvetica", 14, QFont::DemiBold, true ) );
- QString caption;
- caption.setNum( bezier.size() );
- caption += QString::fromLatin1( " vertices" );
- painter.drawText( 10, pr.height()-10, caption );
-
- /* Draw Bezier curve */
- painter.setPen( Qt::black );
- painter.drawPolyline( bezier );
-
- /* Scale and draw control points */
- painter.setPen( Qt::darkGreen );
- for ( QPolygonF::Iterator p1 = points.begin(); p1 != points.end(); ++p1 ) {
- int x = (p1->x()-br.x()) * scl + border;
- int y = (p1->y()-br.y()) * scl + border;
- painter.drawLine( x-4, y-4, x+4, y+4 );
- painter.drawLine( x+4, y-4, x-4, y+4 );
- }
-
- /* Draw vertices */
- painter.setPen( Qt::red );
- painter.setBrush( Qt::red );
- for ( QPolygonF::Iterator p2 = bezier.begin(); p2 != bezier.end(); ++p2 )
- painter.drawEllipse( p2->x()-1, p2->y()-1, 3, 3 );
+ QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
void tst_QWidget::fontPropagation()
{
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
+ testWidget->show();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget.data()));
QFont font = testWidget->font();
- QWidget* childWidget = new QWidget( testWidget );
+ QWidget* childWidget = new QWidget( testWidget.data() );
childWidget->show();
QCOMPARE( font, childWidget->font() );
@@ -821,7 +669,7 @@ void tst_QWidget::fontPropagation()
font.setPointSize(font.pointSize() + 2);
testWidget->setFont(font);
- QWidget *one = new QWidget(testWidget);
+ QWidget *one = new QWidget(testWidget.data());
QWidget *two = new QWidget(one);
QWidget *three = new QWidget(two);
QWidget *four = new QWidget(two);
@@ -977,8 +825,15 @@ void tst_QWidget::fontPropagation2()
void tst_QWidget::palettePropagation()
{
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
+ testWidget->show();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget.data()));
+
QPalette palette = testWidget->palette();
- QWidget* childWidget = new QWidget( testWidget );
+ QWidget* childWidget = new QWidget( testWidget.data() );
childWidget->show();
QCOMPARE( palette, childWidget->palette() );
@@ -1111,7 +966,13 @@ void tst_QWidget::palettePropagation2()
void tst_QWidget::enabledPropagation()
{
- QWidget* childWidget = new QWidget( testWidget );
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
+ testWidget->show();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget.data()));
+ QWidget* childWidget = new QWidget( testWidget.data() );
childWidget->show();
QVERIFY( testWidget->isEnabled() );
QVERIFY( childWidget->isEnabled() );
@@ -1194,7 +1055,13 @@ void tst_QWidget::properTabHandlingWhenDisabled_QTBUG27417()
#ifndef QT_NO_DRAGANDDROP
void tst_QWidget::acceptDropsPropagation()
{
- QWidget *childWidget = new QWidget(testWidget);
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
+ testWidget->show();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget.data()));
+ QWidget *childWidget = new QWidget(testWidget.data());
childWidget->show();
QVERIFY(!testWidget->acceptDrops());
QVERIFY(!childWidget->acceptDrops());
@@ -1241,32 +1108,38 @@ void tst_QWidget::acceptDropsPropagation()
void tst_QWidget::isEnabledTo()
{
- QWidget* childWidget = new QWidget( testWidget );
+ QWidget testWidget;
+ testWidget.resize(m_testWidgetSize);
+ testWidget.setWindowTitle(__FUNCTION__);
+ centerOnScreen(&testWidget);
+ testWidget.show();
+ QWidget* childWidget = new QWidget( &testWidget );
QWidget* grandChildWidget = new QWidget( childWidget );
- QVERIFY( childWidget->isEnabledTo( testWidget ) );
- QVERIFY( grandChildWidget->isEnabledTo( testWidget ) );
+ QVERIFY( childWidget->isEnabledTo( &testWidget ) );
+ QVERIFY( grandChildWidget->isEnabledTo( &testWidget ) );
childWidget->setEnabled( false );
- QVERIFY( !childWidget->isEnabledTo( testWidget ) );
+ QVERIFY( !childWidget->isEnabledTo( &testWidget ) );
QVERIFY( grandChildWidget->isEnabledTo( childWidget ) );
- QVERIFY( !grandChildWidget->isEnabledTo( testWidget ) );
+ QVERIFY( !grandChildWidget->isEnabledTo( &testWidget ) );
- QScopedPointer<QMainWindow> childDialog(new QMainWindow(testWidget));
- testWidget->setEnabled(false);
+ QScopedPointer<QMainWindow> childDialog(new QMainWindow(&testWidget));
+ testWidget.setEnabled(false);
QVERIFY(!childDialog->isEnabled());
QVERIFY(childDialog->isEnabledTo(0));
- testWidget->setEnabled(true);
}
void tst_QWidget::visible()
{
// Ensure that the testWidget is hidden for this test at the
// start
-
- testWidget->hide();
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
QVERIFY( !testWidget->isVisible() );
- QWidget* childWidget = new QWidget( testWidget );
+ QWidget* childWidget = new QWidget( testWidget.data() );
QVERIFY( !childWidget->isVisible() );
testWidget->show();
@@ -1332,11 +1205,16 @@ void tst_QWidget::setLocale()
void tst_QWidget::visible_setWindowOpacity()
{
- testWidget->hide();
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
+ testWidget->winId();
+
QVERIFY( !testWidget->isVisible() );
testWidget->setWindowOpacity(0.5);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
- QVERIFY(!::IsWindowVisible(winHandleOf(testWidget)));
+ QVERIFY(!::IsWindowVisible(winHandleOf(testWidget.data())));
#endif
testWidget->setWindowOpacity(1.0);
}
@@ -1345,35 +1223,40 @@ void tst_QWidget::isVisibleTo()
{
// Ensure that the testWidget is hidden for this test at the
// start
+ QWidget testWidget;
+ testWidget.resize(m_testWidgetSize);
+ testWidget.setWindowTitle(__FUNCTION__);
+ centerOnScreen(&testWidget);
- testWidget->hide();
- QWidget* childWidget = new QWidget( testWidget );
- QVERIFY( childWidget->isVisibleTo( testWidget ) );
+ QWidget* childWidget = new QWidget( &testWidget );
+ QVERIFY( childWidget->isVisibleTo( &testWidget ) );
childWidget->hide();
- QVERIFY( !childWidget->isVisibleTo( testWidget ) );
+ QVERIFY( !childWidget->isVisibleTo( &testWidget ) );
QWidget* grandChildWidget = new QWidget( childWidget );
- QVERIFY( !grandChildWidget->isVisibleTo( testWidget ) );
+ QVERIFY( !grandChildWidget->isVisibleTo( &testWidget ) );
QVERIFY( grandChildWidget->isVisibleTo( childWidget ) );
- testWidget->show();
+ testWidget.show();
childWidget->show();
- QVERIFY( childWidget->isVisibleTo( testWidget ) );
+ QVERIFY( childWidget->isVisibleTo( &testWidget ) );
grandChildWidget->hide();
QVERIFY( !grandChildWidget->isVisibleTo( childWidget ) );
- QVERIFY( !grandChildWidget->isVisibleTo( testWidget ) );
-
+ QVERIFY( !grandChildWidget->isVisibleTo( &testWidget ) );
}
void tst_QWidget::isHidden()
{
// Ensure that the testWidget is hidden for this test at the
// start
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
- testWidget->hide();
QVERIFY( testWidget->isHidden() );
- QWidget* childWidget = new QWidget( testWidget );
+ QWidget* childWidget = new QWidget( testWidget.data() );
QVERIFY( !childWidget->isHidden() );
testWidget->show();
@@ -1406,8 +1289,15 @@ void tst_QWidget::isHidden()
void tst_QWidget::fonts()
{
+ QWidget testWidget;
+ testWidget.resize(m_testWidgetSize);
+ testWidget.setWindowTitle(__FUNCTION__);
+ centerOnScreen(&testWidget);
+ testWidget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
+
// Tests setFont(), ownFont() and unsetFont()
- QWidget* cleanTestWidget = new QWidget( testWidget );
+ QWidget* cleanTestWidget = new QWidget( &testWidget );
QFont originalFont = cleanTestWidget->font();
QVERIFY( !cleanTestWidget->testAttribute(Qt::WA_SetFont) );
@@ -1416,7 +1306,7 @@ void tst_QWidget::fonts()
QFont newFont( "times", 18 );
cleanTestWidget->setFont( newFont );
- newFont = newFont.resolve( testWidget->font() );
+ newFont = newFont.resolve( testWidget.font() );
QVERIFY( cleanTestWidget->testAttribute(Qt::WA_SetFont) );
QVERIFY2( cleanTestWidget->font() == newFont,
@@ -1513,7 +1403,7 @@ void tst_QWidget::mapFromAndTo()
subWindow2->setGeometry(75, 75, 100, 100);
subSubWindow->setGeometry(10, 10, 10, 10);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX)
+#if !defined(Q_OS_QNX)
//update visibility
if (windowMinimized) {
if (!windowHidden) {
@@ -1693,7 +1583,6 @@ void tst_QWidget::focusChainOnReparent()
void tst_QWidget::focusChainOnHide()
{
- testWidget->hide(); // We do not want to get disturbed by other widgets
// focus should move to the next widget in the focus chain when we hide it.
QScopedPointer<QWidget> parent(new QWidget());
parent->setObjectName(QLatin1String("focusChainOnHide"));
@@ -1717,8 +1606,6 @@ void tst_QWidget::focusChainOnHide()
QTRY_COMPARE(parent->hasFocus(), true);
QCOMPARE(parent.data(), qApp->focusWidget());
-
- testWidget->show(); //don't disturb later tests
}
class Container : public QWidget
@@ -1826,15 +1713,8 @@ void tst_QWidget::activation()
{
Q_CHECK_PAINTEVENTS
-#if defined(Q_OS_WINCE)
- int waitTime = 1000;
-#else
int waitTime = 100;
-#endif
-#ifdef Q_OS_WINCE
- qApp->processEvents();
-#endif
QWidget widget1;
widget1.setObjectName("activation-Widget1");
widget1.setWindowTitle(widget1.objectName());
@@ -1886,10 +1766,6 @@ void tst_QWidget::windowState()
size = QGuiApplication::primaryScreen()->size();
} else {
pos = QPoint(10, 10);
-#ifdef Q_OS_WINCE_WM
- if (qt_wince_is_smartphone()) { //small screen
- size = QSize(100,100);
-#endif
}
QWidget widget1;
@@ -2421,11 +2297,7 @@ void tst_QWidget::reparent()
childTLW.show();
QVERIFY(QTest::qWaitForWindowExposed(&parent));
-#ifdef Q_OS_WINCE
- parent.move(50, 50);
-#else
parent.move(parentPosition);
-#endif
QPoint childPos = parent.mapToGlobal(child.pos());
QPoint tlwPos = childTLW.pos();
@@ -2454,6 +2326,12 @@ void tst_QWidget::icon()
QPixmap p(20,20);
p.fill(Qt::red);
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
+ testWidget->show();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget.data()));
testWidget->setWindowIcon(p);
QVERIFY(!testWidget->windowIcon().isNull());
@@ -2469,22 +2347,27 @@ void tst_QWidget::hideWhenFocusWidgetIsChild()
{
if (m_platform == QStringLiteral("wayland"))
QSKIP("Wayland: This fails. Figure out why.");
- testWidget->activateWindow();
- QScopedPointer<QWidget> parentWidget(new QWidget(testWidget));
+
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->setWindowTitle(__FUNCTION__);
+ testWidget->resize(m_testWidgetSize);
+ centerOnScreen(testWidget.data());
+ QWidget *parentWidget(new QWidget(testWidget.data()));
parentWidget->setObjectName("parentWidget");
parentWidget->setGeometry(0, 0, 100, 100);
- QLineEdit *edit = new QLineEdit(parentWidget.data());
+ QLineEdit *edit = new QLineEdit(parentWidget);
edit->setObjectName("edit1");
- QLineEdit *edit3 = new QLineEdit(parentWidget.data());
+ QLineEdit *edit3 = new QLineEdit(parentWidget);
edit3->setObjectName("edit3");
edit3->move(0,50);
- parentWidget->show();
- QLineEdit *edit2 = new QLineEdit(testWidget);
+ QLineEdit *edit2 = new QLineEdit(testWidget.data());
edit2->setObjectName("edit2");
- edit2->show();
edit2->move(110, 100);
edit->setFocus();
- qApp->processEvents();
+ testWidget->show();
+ testWidget->activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(testWidget.data()));
+
QString actualFocusWidget, expectedFocusWidget;
if (!qApp->focusWidget() && m_platform == QStringLiteral("xcb"))
QSKIP("X11: Your window manager is too broken for this test");
@@ -2640,8 +2523,6 @@ void tst_QWidget::setGeometry()
QCOMPARE(tlw.geometry(), tr);
}
-// Windows CE does not support windowOpacity.
-#ifndef Q_OS_WINCE
void tst_QWidget::windowOpacity()
{
QWidget widget;
@@ -2672,7 +2553,6 @@ void tst_QWidget::windowOpacity()
child.setWindowOpacity(-1.0);
QCOMPARE(child.windowOpacity(), 1.0);
}
-#endif
class UpdateWidget : public QWidget
{
@@ -2991,9 +2871,6 @@ void tst_QWidget::stackUnder()
foreach (UpdateWidget *child, allChildren) {
int expectedZOrderChangeEvents = child == child1 ? 1 : 0;
if (child == child3) {
-#ifdef Q_OS_WINCE
- qApp->processEvents();
-#endif
#ifndef Q_OS_OSX
QEXPECT_FAIL(0, "See QTBUG-493", Continue);
#endif
@@ -3385,9 +3262,6 @@ void tst_QWidget::widgetAt()
w2->setMask(rgn);
qApp->processEvents();
QTest::qWait(10);
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191
-#endif
QTRY_VERIFY((wr = QApplication::widgetAt(testPos)));
QTRY_COMPARE(wr->objectName(), w1->objectName());
@@ -3403,9 +3277,6 @@ void tst_QWidget::widgetAt()
w2->setMask(bitmap);
qApp->processEvents();
QTest::qWait(10);
-#if defined(Q_OS_WINCE)
- QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191
-#endif
QTRY_COMPARE(QApplication::widgetAt(testPos), w1.data());
QTRY_VERIFY(QApplication::widgetAt(testPos + QPoint(1, 1)) == w2.data());
}
@@ -3573,8 +3444,6 @@ bool verifyWidgetMask(QWidget *widget, QRect mask)
void tst_QWidget::setMask()
{
- testWidget->hide(); // get this out of the way.
-
{
MaskedPainter w;
w.resize(200, 200);
@@ -3730,7 +3599,7 @@ void tst_QWidget::optimizedResize_topLevel()
topLevel.partial = false;
topLevel.paintedRegion = QRegion();
-#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN32)
topLevel.resize(topLevel.size() + QSize(10, 10));
#else
// Static contents does not work when programmatically resizing
@@ -3801,7 +3670,6 @@ void tst_QWidget::setMinimumSize()
// Setting a minimum size larger than the desktop does not work on WinCE,
// so skip this part of the test.
-#ifndef Q_OS_WINCE
QSize nonDefaultSize = defaultSize + QSize(5,5);
w.setMinimumSize(nonDefaultSize);
w.showNormal();
@@ -3810,7 +3678,6 @@ void tst_QWidget::setMinimumSize()
msgComparisonFailed(w.height(), ">=", nonDefaultSize.height()));
QVERIFY2(w.width() >= nonDefaultSize.width(),
msgComparisonFailed(w.width(), ">=", nonDefaultSize.width()));
-#endif
}
void tst_QWidget::setMaximumSize()
@@ -4787,7 +4654,7 @@ void tst_QWidget::setWindowGeometry()
}
}
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
void tst_QWidget::setGeometry_win()
{
QWidget widget;
@@ -4808,7 +4675,7 @@ void tst_QWidget::setGeometry_win()
QVERIFY2(rt.top <= m_availableTopLeft.y(),
msgComparisonFailed(int(rt.top), "<=", m_availableTopLeft.y()));
}
-#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
// Since X11 WindowManager operation are all async, and we have no way to know if the window
// manager has finished playing with the window geometry, this test can't be reliable on X11.
@@ -5134,12 +5001,8 @@ void tst_QWidget::moveChild()
parent.setStyle(style.data());
ColorWidget child(&parent, Qt::Widget, Qt::blue);
-#ifndef Q_OS_WINCE
parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50),
QSize(200, 200)));
-#else
- parent.setGeometry(60, 60, 150, 150);
-#endif
child.setGeometry(25, 25, 50, 50);
#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
QCursor::setPos(parent.geometry().topRight() + QPoint(50 , 50));
@@ -5365,11 +5228,18 @@ public:
void tst_QWidget::setFocus()
{
+ QScopedPointer<QWidget> testWidget(new QWidget);
+ testWidget->resize(m_testWidgetSize);
+ testWidget->setWindowTitle(__FUNCTION__);
+ centerOnScreen(testWidget.data());
+ testWidget->show();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget.data()));
+
const QPoint windowPos = testWidget->geometry().topRight() + QPoint(50, 0);
{
// move focus to another window
testWidget->activateWindow();
- QApplication::setActiveWindow(testWidget);
+ QApplication::setActiveWindow(testWidget.data());
if (testWidget->focusWidget())
testWidget->focusWidget()->clearFocus();
else
@@ -5415,7 +5285,7 @@ void tst_QWidget::setFocus()
// note: window may be active, but we don't want it to be
testWidget->activateWindow();
- QApplication::setActiveWindow(testWidget);
+ QApplication::setActiveWindow(testWidget.data());
if (testWidget->focusWidget())
testWidget->focusWidget()->clearFocus();
else
@@ -5584,7 +5454,7 @@ private:
int m_count;
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QWidget::setCursor()
{
{
@@ -5727,8 +5597,6 @@ void tst_QWidget::setToolTip()
QCOMPARE(widget.toolTip(), QString());
QCOMPARE(spy.count(), 2);
- // Mouse over doesn't work on Windows mobile, so skip the rest of the test for that platform.
-#ifndef Q_OS_WINCE_WM
for (int pass = 0; pass < 2; ++pass) {
QCursor::setPos(m_safeCursorPos);
QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup));
@@ -5756,7 +5624,6 @@ void tst_QWidget::setToolTip()
QTest::qWait(2200); // delay is 2000
QTest::mouseMove(popupWindow);
}
-#endif
}
void tst_QWidget::testWindowIconChangeEventPropagation()
@@ -6837,7 +6704,6 @@ void tst_QWidget::render_task217815()
}
// Window Opacity is not supported on Windows CE.
-#ifndef Q_OS_WINCE
void tst_QWidget::render_windowOpacity()
{
const qreal opacity = 0.5;
@@ -6910,7 +6776,6 @@ void tst_QWidget::render_windowOpacity()
QCOMPARE(result, expected);
}
}
-#endif
void tst_QWidget::render_systemClip()
{
@@ -7368,14 +7233,10 @@ void tst_QWidget::repaintWhenChildDeleted()
}
#endif
ColorWidget w(0, Qt::FramelessWindowHint, Qt::red);
-#if !defined(Q_OS_WINCE)
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
startPoint.rx() += 50;
startPoint.ry() += 50;
w.setGeometry(QRect(startPoint, QSize(100, 100)));
-#else
- w.setGeometry(60, 60, 110, 110);
-#endif
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
QTest::qWait(10);
@@ -7399,14 +7260,10 @@ void tst_QWidget::repaintWhenChildDeleted()
void tst_QWidget::hideOpaqueChildWhileHidden()
{
ColorWidget w(0, Qt::FramelessWindowHint, Qt::red);
-#if !defined(Q_OS_WINCE)
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
startPoint.rx() += 50;
startPoint.ry() += 50;
w.setGeometry(QRect(startPoint, QSize(100, 100)));
-#else
- w.setGeometry(60, 60, 110, 110);
-#endif
ColorWidget child(&w, Qt::Widget, Qt::blue);
child.setGeometry(10, 10, 80, 80);
@@ -7435,7 +7292,6 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
}
// This test doesn't make sense without support for showMinimized().
-#if !defined(Q_OS_WINCE)
void tst_QWidget::updateWhileMinimized()
{
if (m_platform == QStringLiteral("wayland"))
@@ -7473,7 +7329,6 @@ void tst_QWidget::updateWhileMinimized()
QTRY_COMPARE(widget.numPaintEvents, 1);
QCOMPARE(widget.paintedRegion, QRegion(0, 0, 50, 50));
}
-#endif
class PaintOnScreenWidget: public QWidget
{
@@ -7840,13 +7695,6 @@ void tst_QWidget::adjustSize()
QVERIFY2(child->size().height() < sizeHint.height(),
msgComparisonFailed(child->size().height(), "<", sizeHint.height()));
} else {
-#if defined (Q_OS_WINCE)
- if (!haveParent) {
- const QRect& desktopRect = qApp->desktop()->availableGeometry();
- expectedSize.setWidth(qMin(expectedSize.width(), desktopRect.width()));
- expectedSize.setHeight(qMin(expectedSize.height(), desktopRect.height()));
- }
-#endif
QCOMPARE(child->size(), expectedSize);
}
if (!haveParent)
@@ -8916,7 +8764,7 @@ void tst_QWidget::maskedUpdate()
QTRY_COMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update.
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QWidget::syntheticEnterLeave()
{
if (m_platform == QStringLiteral("wayland"))
@@ -9022,7 +8870,7 @@ void tst_QWidget::syntheticEnterLeave()
}
#endif
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
{
if (m_platform == QStringLiteral("wayland"))
@@ -9170,8 +9018,6 @@ void tst_QWidget::updateOnDestroyedSignal()
void tst_QWidget::toplevelLineEditFocus()
{
- testWidget->hide();
-
QLineEdit w;
w.setMinimumWidth(m_testWidgetSize.width());
w.show();
@@ -9237,10 +9083,9 @@ QWidgetBackingStore* backingStore(QWidget &widget)
}
// Tables of 5000 elements do not make sense on Windows Mobile.
-#ifndef Q_OS_WINCE_WM
void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
{
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs
#endif
QWidget main(0,Qt::FramelessWindowHint); //don't get confused by the size of the window frame
@@ -9275,11 +9120,10 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
QTRY_COMPARE(mainPixmap.toImage().convertToFormat(QImage::Format_RGB32),
correct.toImage().convertToFormat(QImage::Format_RGB32));
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
#endif
}
-#endif
void tst_QWidget::setGraphicsEffect()
{
@@ -9892,25 +9736,21 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
{
// Simple case, we ignore the touch events, we get mouse events instead
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
TouchMouseWidget widget;
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(widget.windowHandle()));
QCOMPARE(widget.m_touchEventCount, 0);
QCOMPARE(widget.m_mouseEventCount, 0);
- QTest::touchEvent(&widget, device).press(0, QPoint(10, 10), &widget);
+ QTest::touchEvent(&widget, m_touchScreen).press(0, QPoint(10, 10), &widget);
QCOMPARE(widget.m_touchEventCount, 0);
QCOMPARE(widget.m_mouseEventCount, 1);
QCOMPARE(widget.m_lastMouseEventPos, QPointF(10, 10));
- QTest::touchEvent(&widget, device).move(0, QPoint(15, 15), &widget);
+ QTest::touchEvent(&widget, m_touchScreen).move(0, QPoint(15, 15), &widget);
QCOMPARE(widget.m_touchEventCount, 0);
QCOMPARE(widget.m_mouseEventCount, 2);
QCOMPARE(widget.m_lastMouseEventPos, QPointF(15, 15));
- QTest::touchEvent(&widget, device).release(0, QPoint(20, 20), &widget);
+ QTest::touchEvent(&widget, m_touchScreen).release(0, QPoint(20, 20), &widget);
QCOMPARE(widget.m_touchEventCount, 0);
QCOMPARE(widget.m_mouseEventCount, 4); // we receive extra mouse move event
QCOMPARE(widget.m_lastMouseEventPos, QPointF(20, 20));
@@ -9918,10 +9758,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
{
// We accept the touch events, no mouse event is generated
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
TouchMouseWidget widget;
widget.setAcceptTouch(true);
widget.show();
@@ -9929,13 +9765,13 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
QCOMPARE(widget.m_touchEventCount, 0);
QCOMPARE(widget.m_mouseEventCount, 0);
- QTest::touchEvent(&widget, device).press(0, QPoint(10, 10), &widget);
+ QTest::touchEvent(&widget, m_touchScreen).press(0, QPoint(10, 10), &widget);
QCOMPARE(widget.m_touchEventCount, 1);
QCOMPARE(widget.m_mouseEventCount, 0);
- QTest::touchEvent(&widget, device).move(0, QPoint(15, 15), &widget);
+ QTest::touchEvent(&widget, m_touchScreen).move(0, QPoint(15, 15), &widget);
QCOMPARE(widget.m_touchEventCount, 2);
QCOMPARE(widget.m_mouseEventCount, 0);
- QTest::touchEvent(&widget, device).release(0, QPoint(20, 20), &widget);
+ QTest::touchEvent(&widget, m_touchScreen).release(0, QPoint(20, 20), &widget);
QCOMPARE(widget.m_touchEventCount, 3);
QCOMPARE(widget.m_mouseEventCount, 0);
}
@@ -9943,10 +9779,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
{
// Parent accepts touch events, child ignore both mouse and touch
// We should see propagation of the TouchBegin
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
TouchMouseWidget parent;
parent.setAcceptTouch(true);
TouchMouseWidget child(&parent);
@@ -9959,7 +9791,7 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
QCOMPARE(child.m_touchEventCount, 0);
QCOMPARE(child.m_mouseEventCount, 0);
- QTest::touchEvent(parent.window(), device).press(0, QPoint(10, 10), &child);
+ QTest::touchEvent(parent.window(), m_touchScreen).press(0, QPoint(10, 10), &child);
QCOMPARE(parent.m_touchEventCount, 1);
QCOMPARE(parent.m_mouseEventCount, 0);
QCOMPARE(child.m_touchEventCount, 0);
@@ -9969,10 +9801,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
{
// Parent accepts mouse events, child ignore both mouse and touch
// We should see propagation of the TouchBegin into a MouseButtonPress
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
TouchMouseWidget parent;
TouchMouseWidget child(&parent);
child.move(5, 5);
@@ -9984,7 +9812,7 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
QCOMPARE(child.m_touchEventCount, 0);
QCOMPARE(child.m_mouseEventCount, 0);
- QTest::touchEvent(parent.window(), device).press(0, QPoint(10, 10), &child);
+ QTest::touchEvent(parent.window(), m_touchScreen).press(0, QPoint(10, 10), &child);
QCOMPARE(parent.m_touchEventCount, 0);
QCOMPARE(parent.m_mouseEventCount, 1);
QCOMPARE(parent.m_lastMouseEventPos, QPointF(15, 15));
@@ -9996,10 +9824,6 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
void tst_QWidget::touchUpdateOnNewTouch()
{
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
TouchMouseWidget widget;
widget.setAcceptTouch(true);
QVBoxLayout *layout = new QVBoxLayout;
@@ -10012,23 +9836,23 @@ void tst_QWidget::touchUpdateOnNewTouch()
QCOMPARE(widget.m_touchBeginCount, 0);
QCOMPARE(widget.m_touchUpdateCount, 0);
QCOMPARE(widget.m_touchEndCount, 0);
- QTest::touchEvent(window, device).press(0, QPoint(20, 20), window);
+ QTest::touchEvent(window, m_touchScreen).press(0, QPoint(20, 20), window);
QCOMPARE(widget.m_touchBeginCount, 1);
QCOMPARE(widget.m_touchUpdateCount, 0);
QCOMPARE(widget.m_touchEndCount, 0);
- QTest::touchEvent(window, device).move(0, QPoint(25, 25), window);
+ QTest::touchEvent(window, m_touchScreen).move(0, QPoint(25, 25), window);
QCOMPARE(widget.m_touchBeginCount, 1);
QCOMPARE(widget.m_touchUpdateCount, 1);
QCOMPARE(widget.m_touchEndCount, 0);
- QTest::touchEvent(window, device).stationary(0).press(1, QPoint(40, 40), window);
+ QTest::touchEvent(window, m_touchScreen).stationary(0).press(1, QPoint(40, 40), window);
QCOMPARE(widget.m_touchBeginCount, 1);
QCOMPARE(widget.m_touchUpdateCount, 2);
QCOMPARE(widget.m_touchEndCount, 0);
- QTest::touchEvent(window, device).stationary(1).release(0, QPoint(25, 25), window);
+ QTest::touchEvent(window, m_touchScreen).stationary(1).release(0, QPoint(25, 25), window);
QCOMPARE(widget.m_touchBeginCount, 1);
QCOMPARE(widget.m_touchUpdateCount, 3);
QCOMPARE(widget.m_touchEndCount, 0);
- QTest::touchEvent(window, device).release(1, QPoint(40, 40), window);
+ QTest::touchEvent(window, m_touchScreen).release(1, QPoint(40, 40), window);
QCOMPARE(widget.m_touchBeginCount, 1);
QCOMPARE(widget.m_touchUpdateCount, 3);
QCOMPARE(widget.m_touchEndCount, 1);
@@ -10036,10 +9860,6 @@ void tst_QWidget::touchUpdateOnNewTouch()
void tst_QWidget::touchEventsForGesturePendingWidgets()
{
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
-
TouchMouseWidget parent;
TouchMouseWidget child(&parent);
parent.grabGesture(Qt::TapAndHoldGesture);
@@ -10052,14 +9872,14 @@ void tst_QWidget::touchEventsForGesturePendingWidgets()
QCOMPARE(child.m_gestureEventCount, 0);
QCOMPARE(parent.m_touchEventCount, 0);
QCOMPARE(parent.m_gestureEventCount, 0);
- QTest::touchEvent(window, device).press(0, QPoint(20, 20), window);
+ QTest::touchEvent(window, m_touchScreen).press(0, QPoint(20, 20), window);
QCOMPARE(child.m_touchEventCount, 0);
QCOMPARE(child.m_gestureEventCount, 0);
QCOMPARE(parent.m_touchBeginCount, 1); // QTapAndHoldGestureRecognizer::create() sets Qt::WA_AcceptTouchEvents
QCOMPARE(parent.m_touchUpdateCount, 0);
QCOMPARE(parent.m_touchEndCount, 0);
QCOMPARE(parent.m_gestureEventCount, 0);
- QTest::touchEvent(window, device).move(0, QPoint(25, 25), window);
+ QTest::touchEvent(window, m_touchScreen).move(0, QPoint(25, 25), window);
QCOMPARE(child.m_touchEventCount, 0);
QCOMPARE(child.m_gestureEventCount, 0);
QCOMPARE(parent.m_touchBeginCount, 1);
@@ -10067,7 +9887,7 @@ void tst_QWidget::touchEventsForGesturePendingWidgets()
QCOMPARE(parent.m_touchEndCount, 0);
QCOMPARE(parent.m_gestureEventCount, 0);
QTest::qWait(1000);
- QTest::touchEvent(window, device).release(0, QPoint(25, 25), window);
+ QTest::touchEvent(window, m_touchScreen).release(0, QPoint(25, 25), window);
QCOMPARE(child.m_touchEventCount, 0);
QCOMPARE(child.m_gestureEventCount, 0);
QCOMPARE(parent.m_touchBeginCount, 1);
@@ -10184,7 +10004,7 @@ void tst_QWidget::destroyedSignal()
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QWidget::underMouse()
{
// Move the mouse cursor to a safe location
@@ -10474,7 +10294,7 @@ void tst_QWidget::taskQTBUG_27643_enterEvents()
// Must only register only single enter on modal dialog's button after all said and done
QCOMPARE(dialog.enters, 1);
}
-#endif // QTEST_NO_CURSOR
+#endif // QT_NO_CURSOR
class KeyboardWidget : public QWidget
{
diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro
index 8672c363a2..a6248dfd16 100644
--- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro
+++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro
@@ -2,8 +2,3 @@ CONFIG += testcase
TARGET = tst_qwidget_window
QT += widgets testlib core-private gui-private
SOURCES += tst_qwidget_window.cpp
-
-x11 {
- LIBS += $$QMAKE_LIBS_X11
-}
-
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 35b1596003..6aaac6d135 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -331,8 +331,10 @@ void tst_QWidget_window::tst_showWithoutActivating()
QSKIP("Cocoa: This fails. Figure out why.");
else if (platformName != QStringLiteral("xcb")
&& platformName != QStringLiteral("windows")
- && platformName != QStringLiteral("ios"))
- QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios platforms.");
+ && platformName != QStringLiteral("ios")
+ && platformName != QStringLiteral("tvos")
+ && platformName != QStringLiteral("watchos"))
+ QSKIP("Qt::WA_ShowWithoutActivating is currently supported only on xcb, windows, and ios/tvos/watchos platforms.");
QWidget w1;
w1.setAttribute(Qt::WA_ShowWithoutActivating);
diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro
index 50445b9a45..a1e5a70a08 100644
--- a/tests/auto/widgets/styles/qstyle/qstyle.pro
+++ b/tests/auto/widgets/styles/qstyle/qstyle.pro
@@ -3,12 +3,6 @@ TARGET = tst_qstyle
QT += widgets testlib
SOURCES += tst_qstyle.cpp
-wince* {
- addPixmap.files = task_25863.png
- addPixmap.path = .
- DEPLOYMENT += addPixmap
-}
-
android {
RESOURCES += \
testdata.qrc
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index 5c213fea04..5925b764dd 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -56,20 +56,6 @@
#include <qlineedit.h>
#include <qmdiarea.h>
#include <qscrollarea.h>
-
-#ifdef Q_OS_WINCE_WM
-#include <windows.h>
-
-static bool qt_wince_is_smartphone() {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
- sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (QString::fromLatin1("Smartphone").utf16()), tszPlatform))
- return true;
- return false;
-}
-#endif
-
#include <qwidget.h>
// Make a widget frameless to prevent size constraints of title bars
@@ -90,7 +76,7 @@ public:
private:
bool testAllFunctions(QStyle *);
- bool testScrollBarSubControls(QStyle *);
+ bool testScrollBarSubControls();
void testPainting(QStyle *style, const QString &platform);
private slots:
void drawItemPixmap();
@@ -109,12 +95,6 @@ private slots:
#ifdef Q_OS_MAC
void testMacStyle();
#endif
-#ifdef Q_OS_WINCE
- void testWindowsCEStyle();
-#endif
-#ifdef Q_OS_WINCE_WM
- void testWindowsMobileStyle();
-#endif
void testStyleFactory();
void testProxyStyle();
void pixelMetric();
@@ -315,19 +295,11 @@ bool tst_QStyle::testAllFunctions(QStyle *style)
style->itemPixmapRect(QRect(0, 0, 100, 100), Qt::AlignHCenter, QPixmap(200, 200));
style->itemTextRect(QFontMetrics(qApp->font()), QRect(0, 0, 100, 100), Qt::AlignHCenter, true, QString("Test"));
- return testScrollBarSubControls(style);
+ return testScrollBarSubControls();
}
-bool tst_QStyle::testScrollBarSubControls(QStyle* style)
+bool tst_QStyle::testScrollBarSubControls()
{
- // WinCE SmartPhone doesn't have scrollbar subcontrols, so skip the rest of the test.
-#ifdef Q_OS_WINCE_WM
- if (style->inherits("QWindowsMobileStyle") && qt_wince_is_smartphone())
- return true;
-#else
- Q_UNUSED(style);
-#endif
-
QScrollBar scrollBar;
setFrameless(&scrollBar);
scrollBar.show();
@@ -522,26 +494,6 @@ void tst_QStyle::testMacStyle()
}
#endif
-#ifdef Q_OS_WINCE
-// WindowsCEStyle style
-void tst_QStyle::testWindowsCEStyle()
-{
- QStyle *cstyle = QStyleFactory::create("WindowsCE");
- QVERIFY(testAllFunctions(cstyle));
- delete cstyle;
-}
-#endif
-
-#ifdef Q_OS_WINCE_WM
-// WindowsMobileStyle style
-void tst_QStyle::testWindowsMobileStyle()
-{
- QStyle *cstyle = QStyleFactory::create("WindowsMobile");
- QVERIFY(testAllFunctions(cstyle));
- delete cstyle;
-}
-#endif
-
// Helper class...
MyWidget::MyWidget( QWidget* parent, const char* name )
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST
index cf78fb47c2..61966e684f 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST
+++ b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST
@@ -1,2 +1,4 @@
[hoverColors]
ubuntu-14.04
+opensuse-13.1
+opensuse-42.1
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro
index c96004bd5d..7d9a8576d3 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro
+++ b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro
@@ -5,4 +5,4 @@ QT += widgets widgets-private gui-private testlib
SOURCES += tst_qstylesheetstyle.cpp
RESOURCES += resources.qrc
-requires(contains(QT_CONFIG,private_tests))
+requires(qtConfig(private_tests))
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index a107260d23..b95a17bd4e 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -34,8 +34,6 @@
#include <private/qstylesheetstyle_p.h>
-#include "../../../qtest-config.h"
-
static inline void centerOnScreen(QWidget *w)
{
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
@@ -76,7 +74,7 @@ private slots:
void onWidgetDestroyed();
void fontPrecedence();
void focusColors();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void hoverColors();
#endif
void background();
@@ -819,6 +817,24 @@ static bool testForColors(const QImage& image, const QColor& color, bool ensureP
return false;
}
+static const QList<QWidget*> sample_widgets() // returning const to avoid detaching when passing to range-for
+{
+ QList<QWidget *> widgets;
+ widgets << new QPushButton("TESTING TESTING");
+ widgets << new QLineEdit("TESTING TESTING");
+ widgets << new QLabel("TESTING TESTING");
+ QSpinBox *spinbox = new QSpinBox;
+ spinbox->setMaximum(1000000000);
+ spinbox->setValue(123456789);
+ widgets << spinbox;
+ QComboBox *combobox = new QComboBox;
+ combobox->setEditable(true);
+ combobox->addItems(QStringList() << "TESTING TESTING");
+ widgets << combobox;
+ widgets << new QLabel("<b>TESTING TESTING</b>");
+ return widgets;
+}
+
void tst_QStyleSheetStyle::focusColors()
{
// Tests if colors can be changed by altering the focus of the widget.
@@ -835,22 +851,9 @@ void tst_QStyleSheetStyle::focusColors()
" (for example, QTBUG-33959)."
"That doesn't mean that the feature doesn't work in practice.");
#endif
- QList<QWidget *> widgets;
- widgets << new QPushButton("TESTING TESTING");
- widgets << new QLineEdit("TESTING TESTING");
- widgets << new QLabel("TESTING TESTING");
- QSpinBox *spinbox = new QSpinBox;
- spinbox->setMaximum(1000000000);
- spinbox->setValue(123456789);
- widgets << spinbox;
- QComboBox *combobox = new QComboBox;
- combobox->setEditable(true);
- combobox->addItems(QStringList() << "TESTING TESTING");
- widgets << combobox;
- widgets << new QLabel("TESTING TESTING");
- foreach (QWidget *widget, widgets) {
+ for (QWidget *widget : sample_widgets()) {
QDialog frame;
QLayout* layout = new QGridLayout;
@@ -887,27 +890,14 @@ void tst_QStyleSheetStyle::focusColors()
}
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QStyleSheetStyle::hoverColors()
{
#ifdef Q_OS_OSX
QSKIP("This test is fragile on Mac, most likely due to QTBUG-33959.");
#endif
- QList<QWidget *> widgets;
- widgets << new QPushButton("TESTING TESTING");
- widgets << new QLineEdit("TESTING TESTING");
- widgets << new QLabel("TESTING TESTING");
- QSpinBox *spinbox = new QSpinBox;
- spinbox->setMaximum(1000000000);
- spinbox->setValue(123456789);
- widgets << spinbox;
- QComboBox *combobox = new QComboBox;
- combobox->setEditable(true);
- combobox->addItems(QStringList() << "TESTING TESTING");
- widgets << combobox;
- widgets << new QLabel("<b>TESTING TESTING</b>");
- foreach (QWidget *widget, widgets) {
+ for (QWidget *widget : sample_widgets()) {
//without Qt::X11BypassWindowManagerHint the window manager may move the window after we moved the cursor
QDialog frame(0, Qt::X11BypassWindowManagerHint);
QLayout* layout = new QGridLayout;
diff --git a/tests/auto/widgets/styles/styles.pro b/tests/auto/widgets/styles/styles.pro
index 0de9dfcdab..9d7464cb5b 100644
--- a/tests/auto/widgets/styles/styles.pro
+++ b/tests/auto/widgets/styles/styles.pro
@@ -5,12 +5,12 @@ SUBDIRS=\
qstyleoption \
qstylesheetstyle \
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qstylesheetstyle \
# This test can only be run on Mac OS:
!mac:SUBDIRS -= \
qmacstyle \
-ios|android|qnx|wince: SUBDIRS -= \
+uikit|android|qnx: SUBDIRS -= \
qstylesheetstyle \
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index ff71a6d56b..0098c5d884 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -600,10 +600,7 @@ void tst_QCompleter::directoryModel_data()
if (i == 1)
QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << "";
-#if defined(Q_OS_WINCE)
- QTest::newRow("()") << "" << "" << "/" << "/";
- QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files";
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
QTest::newRow("()") << "C" << "" << "C:" << "C:";
QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files";
#elif defined (Q_OS_MAC)
@@ -649,10 +646,7 @@ void tst_QCompleter::fileSystemModel_data()
if (i == 1)
QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << "";
-#if defined(Q_OS_WINCE)
- QTest::newRow("()") << "" << "" << "/" << "/";
- QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files";
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
QTest::newRow("()") << "C" << "" << "C:" << "C:";
QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files";
#elif defined (Q_OS_MAC)
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index 2c398e1b2f..67bae43c9d 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -125,6 +125,9 @@ private slots:
void scrollTo();
void scroll();
void overshoot();
+
+private:
+ QTouchDevice *m_touchScreen = QTest::createTouchDevice();
};
/*! \internal
@@ -150,11 +153,8 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
touchPoint.setPos(touchStart);
touchPoint.setScenePos(touchStart);
touchPoint.setScreenPos(touchStart);
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
QTouchEvent touchEvent1(QEvent::TouchBegin,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -168,7 +168,7 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
touchPoint.setScenePos(touchUpdate);
touchPoint.setScreenPos(touchUpdate);
QTouchEvent touchEvent2(QEvent::TouchUpdate,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointMoved,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -192,7 +192,7 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
touchPoint.setScenePos(touchEnd);
touchPoint.setScreenPos(touchEnd);
QTouchEvent touchEvent5(QEvent::TouchEnd,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointReleased,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -223,11 +223,8 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from,
touchPoint.setPos(touchStart);
touchPoint.setScenePos(touchStart);
touchPoint.setScreenPos(touchStart);
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
QTouchEvent touchEvent1(QEvent::TouchBegin,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -239,7 +236,7 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from,
touchPoint.setScenePos(touchUpdate);
touchPoint.setScreenPos(touchUpdate);
QTouchEvent touchEvent2(QEvent::TouchUpdate,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointMoved,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -252,7 +249,7 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from,
touchPoint.setScenePos(touchEnd);
touchPoint.setScreenPos(touchEnd);
QTouchEvent touchEvent5(QEvent::TouchEnd,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointReleased,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
diff --git a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
index a932cf5984..616898c4c5 100644
--- a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
+++ b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
@@ -107,9 +107,6 @@ void tst_QSystemTrayIcon::getSetCheck()
void tst_QSystemTrayIcon::supportsMessages()
{
// ### fixme: Check platforms.
-#if defined(Q_OS_WINCE)
- QCOMPARE(QSystemTrayIcon::supportsMessages(), false);
-#else
const QString platform = QGuiApplication::platformName();
if (platform.compare(QStringLiteral("xcb"), Qt::CaseInsensitive)
&& platform.compare(QStringLiteral("windows"), Qt::CaseInsensitive)
@@ -117,7 +114,6 @@ void tst_QSystemTrayIcon::supportsMessages()
QEXPECT_FAIL("", "QTBUG-20978 QSystemTrayIcon is unimplemented for this platform", Abort);
}
QCOMPARE(QSystemTrayIcon::supportsMessages(), true);
-#endif
}
void tst_QSystemTrayIcon::lastWindowClosed()
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 50024460fc..816fe1faba 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -78,9 +78,6 @@ class tst_QComboBox : public QObject
public:
tst_QComboBox() {}
-public slots:
- void init();
-
private slots:
void getSetCheck();
void ensureReturnIsIgnored();
@@ -396,13 +393,6 @@ private:
};
-void tst_QComboBox::init()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QComboBox::setEditable()
{
TestWidget topLevel;
@@ -2753,7 +2743,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
QCOMPARE(combo.currentText(), QLatin1String("0"));
// When calling cursor function, Windows CE responds with: This function is not supported on this system.
-#if !defined Q_OS_WINCE && !defined Q_OS_QNX
+#if !defined Q_OS_QNX
// Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA:
centerCursor(combo.view());
QTest::qWait(200);
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro
index 411185ae2a..c4bc1cab21 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro
+++ b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro
@@ -2,5 +2,3 @@ CONFIG += testcase
TARGET = tst_qdatetimeedit
QT += widgets testlib core-private widgets-private
SOURCES += tst_qdatetimeedit.cpp
-
-wincewm50smart-msvc2005: DEFINES += WINCE_NO_MODIFIER_KEYS
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 31eb05a957..09ab20f7ca 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -84,30 +84,6 @@ Q_DECLARE_METATYPE(Qt::Key);
Q_DECLARE_METATYPE(Qt::KeyboardModifiers);
Q_DECLARE_METATYPE(Qt::KeyboardModifier);
-#if defined(Q_OS_WINCE)
-#ifndef SPI_GETPLATFORMTYPE
-#define SPI_GETPLATFORMTYPE 257
-#endif
-
-bool qt_wince_is_platform(const QString &platformString) {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE,
- sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
- return true;
- return false;
-}
-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());
-}
-#endif
-
class EditorDateEdit : public QDateTimeEdit
{
Q_OBJECT
@@ -332,7 +308,7 @@ void tst_QDateTimeEdit::cleanupTestCase()
void tst_QDateTimeEdit::init()
{
QLocale::setDefault(QLocale(QLocale::C));
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
#endif
testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have
@@ -3108,7 +3084,7 @@ void tst_QDateTimeEdit::nextPrevSection_data()
// 1. mac doesn't do these,
// 2. some WinCE devices do not have modifiers
-#if !defined(Q_OS_MAC) && !defined(WINCE_NO_MODIFIER_KEYS)
+#if !defined(Q_OS_DARWIN)
QTest::newRow("ctrl-right") << Qt::Key_Right << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("56");
QTest::newRow("ctrl-left") << Qt::Key_Left << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("12");
#endif
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 598b518810..a4614d0a9d 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -70,8 +70,6 @@
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
-#include "../../../qtest-config.h"
-
QT_BEGIN_NAMESPACE
class QPainter;
QT_END_NAMESPACE
@@ -252,7 +250,7 @@ private slots:
void noTextEditedOnClear();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void cursor();
#endif
@@ -3484,7 +3482,7 @@ void tst_QLineEdit::textMargin()
QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition);
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QLineEdit::cursor()
{
QLineEdit *testWidget = ensureTestWidget();
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 5bd26c632c..30e4f63aa1 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -45,7 +45,9 @@
#include <private/qmainwindowlayout_p.h>
#include <private/qdockarealayout_p.h>
-#include "../../../qtest-config.h"
+#ifndef QT_NO_TABBAR
+#include <qtabbar.h>
+#endif
static uchar restoreData41[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xc1, 0x0, 0x0, 0x1, 0x19};
static uchar restoreData42[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x98, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3, 0x8a, 0x0, 0x0, 0x2, 0x2b, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8};
@@ -131,7 +133,7 @@ private slots:
void contentsMargins_data();
void contentsMargins();
void isSeparator();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void setCursor();
#endif
void addToolbarAfterShow();
@@ -146,6 +148,9 @@ private slots:
void QTBUG21378_animationFinished();
void resizeDocks();
void resizeDocks_data();
+#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR)
+ void QTBUG52175_tabifiedDockWidgetActivated();
+#endif
};
@@ -595,9 +600,6 @@ void tst_QMainWindow::menuBar()
mw.setMenuBar(mb1);
QVERIFY(mw.menuBar() != 0);
QCOMPARE(mw.menuBar(), (QMenuBar *)mb1);
-#ifdef Q_OS_WINCE_WM
- QSKIP("With native menubar integration the menubar is not a child");
-#endif
QCOMPARE(mb1->parentWidget(), (QWidget *)&mw);
mw.setMenuBar(0);
@@ -1728,7 +1730,7 @@ class MainWindow : public QMainWindow {
using QMainWindow::event;
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QMainWindow::setCursor()
{
MainWindow mw;
@@ -2038,5 +2040,52 @@ void tst_QMainWindow::resizeDocks()
}
}
+#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR)
+void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated()
+{
+ QMainWindow w;
+
+ QDockWidget *dwFirst = new QDockWidget(&w);
+ dwFirst->setWidget(new QWidget(dwFirst));
+ w.addDockWidget(Qt::LeftDockWidgetArea, dwFirst);
+
+ QDockWidget *dwSecond = new QDockWidget(&w);
+ dwSecond->setWidget(new QWidget(dwSecond));
+ w.addDockWidget(Qt::LeftDockWidgetArea, dwSecond);
+
+ w.tabifyDockWidget(dwFirst, dwSecond);
+ w.show();
+ QVERIFY(QTest::qWaitForWindowActive(&w));
+
+ QTabBar *tabBar = w.findChild<QTabBar *>();
+ QVERIFY(tabBar);
+
+ QDockWidget *activated = nullptr;
+ connect(&w, &QMainWindow::tabifiedDockWidgetActivated, [&activated](QDockWidget *dockWidget)
+ {
+ activated = dockWidget;
+ });
+
+ w.hide();
+ QCoreApplication::processEvents();
+ QCOMPARE(activated, nullptr);
+
+ w.show();
+ QCoreApplication::processEvents();
+ QCOMPARE(activated, nullptr);
+
+ tabBar->setCurrentIndex(1);
+ QCoreApplication::processEvents();
+ QCOMPARE(activated, nullptr);
+
+ tabBar->setCurrentIndex(0);
+ QTRY_COMPARE(activated, dwFirst);
+ activated = nullptr;
+
+ tabBar->setCurrentIndex(1);
+ QTRY_COMPARE(activated, dwSecond);
+}
+#endif
+
QTEST_MAIN(tst_QMainWindow)
#include "tst_qmainwindow.moc"
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 809fa56a61..2b8f3032bf 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -228,7 +228,6 @@ class tst_QMdiArea : public QObject
public:
tst_QMdiArea();
public slots:
- void initTestCase();
void cleanup();
protected slots:
@@ -293,13 +292,6 @@ tst_QMdiArea::tst_QMdiArea()
qRegisterMetaType<QMdiSubWindow *>();
}
-void tst_QMdiArea::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QMdiArea::cleanup()
{
QVERIFY(QApplication::topLevelWidgets().isEmpty());
@@ -509,9 +501,6 @@ void tst_QMdiArea::subWindowActivated2()
if (!macHasAccessToWindowsServer())
QEXPECT_FAIL("", "showMinimized doesn't really minimize if you don't have access to the server", Abort);
#endif
-#ifdef Q_OS_WINCE
- QSKIP("Not fixed yet. See Task 197453");
-#endif
#ifdef Q_OS_MAC
QSKIP("QTBUG-25298: This test is unstable on Mac.");
#endif
@@ -649,7 +638,7 @@ void tst_QMdiArea::changeWindowTitle()
#else
widget->setWindowState(Qt::WindowMaximized);
#endif
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) );
#endif
@@ -658,7 +647,7 @@ void tst_QMdiArea::changeWindowTitle()
mw->show();
QVERIFY(QTest::qWaitForWindowExposed(mw));
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) );
#endif
@@ -676,7 +665,7 @@ void tst_QMdiArea::changeWindowTitle()
widget->setWindowState(Qt::WindowMaximized);
#endif
qApp->processEvents();
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) );
widget->setWindowTitle( wc2 );
QCOMPARE( mw->windowTitle(), windowTitle(mwc, wc2) );
@@ -694,7 +683,7 @@ void tst_QMdiArea::changeWindowTitle()
#endif
qApp->processEvents();
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) );
#endif
#ifdef USE_SHOW
@@ -703,7 +692,7 @@ void tst_QMdiArea::changeWindowTitle()
widget->setWindowState(Qt::WindowNoState);
#endif
qApp->processEvents();
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_OS_DARWIN)
QCOMPARE(mw->windowTitle(), mwc);
#else
QCOMPARE( mw->windowTitle(), mwc2 );
@@ -715,7 +704,7 @@ void tst_QMdiArea::changeWindowTitle()
widget->setWindowState(Qt::WindowMaximized);
#endif
qApp->processEvents();
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) );
#endif
@@ -764,7 +753,7 @@ void tst_QMdiArea::changeModified()
QCOMPARE( mw->isWindowModified(), false);
QCOMPARE( widget->isWindowModified(), true);
widget->setWindowState(Qt::WindowMaximized);
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QCOMPARE( mw->isWindowModified(), true);
#endif
QCOMPARE( widget->isWindowModified(), true);
@@ -774,7 +763,7 @@ void tst_QMdiArea::changeModified()
QCOMPARE( widget->isWindowModified(), true);
widget->setWindowState(Qt::WindowMaximized);
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QCOMPARE( mw->isWindowModified(), true);
#endif
QCOMPARE( widget->isWindowModified(), true);
@@ -784,7 +773,7 @@ void tst_QMdiArea::changeModified()
QCOMPARE( widget->isWindowModified(), false);
widget->setWindowModified(true);
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QCOMPARE( mw->isWindowModified(), true);
#endif
QCOMPARE( widget->isWindowModified(), true);
@@ -1598,9 +1587,7 @@ void tst_QMdiArea::tileSubWindows()
qApp->processEvents();
}
workspace.setActiveSubWindow(0);
-#ifndef Q_OS_WINCE //See Task 197453 ToDo
QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect());
-#endif
QMdiSubWindow *window = windows.at(0);
@@ -1724,9 +1711,6 @@ void tst_QMdiArea::tileSubWindows()
frameWidth = workspace.style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
const int spacing = 2 * frameWidth + 2;
const QSize expectedViewportSize(3 * minSize.width() + spacing, 3 * minSize.height() + spacing);
-#ifdef Q_OS_WINCE
- QSKIP("Not fixed yet! See task 197453");
-#endif
QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize);
// Restore original scrollbar behavior for test below
@@ -2005,7 +1989,7 @@ void tst_QMdiArea::delayedPlacement()
void tst_QMdiArea::iconGeometryInMenuBar()
{
-#if !defined (Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QMainWindow mainWindow;
QMenuBar *menuBar = mainWindow.menuBar();
menuBar->setNativeMenuBar(false);
@@ -2063,11 +2047,7 @@ void tst_QMdiArea::resizeTimer()
mdiArea.show();
QVERIFY(QTest::qWaitForWindowActive(&mdiArea));
-#ifndef Q_OS_WINCE
int time = 250;
-#else
- int time = 1000;
-#endif
EventSpy timerEventSpy(subWindow, QEvent::Timer);
QCOMPARE(timerEventSpy.count(), 0);
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
index 3fbb9a3f3f..76c3ac4143 100644
--- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -48,8 +48,6 @@
#include <QScreen>
#include <QSizeGrip>
-#include "../../../qtest-config.h"
-
QT_BEGIN_NAMESPACE
#if !defined(Q_DEAD_CODE_FROM_QT4_WIN)
extern bool qt_tab_all_widgets();
@@ -161,7 +159,7 @@ private slots:
void showShaded();
void showNormal_data();
void showNormal();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void setOpaqueResizeAndMove_data();
void setOpaqueResizeAndMove();
#endif
@@ -184,7 +182,7 @@ private slots:
void explicitlyHiddenWidget();
void resizeTimer();
void fixedMinMaxSize();
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
void replaceMenuBarWhileMaximized();
void closeOnDoubleClick_data();
void closeOnDoubleClick();
@@ -575,10 +573,6 @@ void tst_QMdiSubWindow::showShaded()
window->showNormal();
QTest::qWait(250);
-#ifdef Q_OS_WINCE
- QSKIP("Until we have a QEvent::WindowFlagsChange event, this will skip");
-#endif
-
const QSize minimumSizeHint = window->minimumSizeHint();
QVERIFY(minimumSizeHint.height() < 300);
const int maxHeightDiff = 300 - minimumSizeHint.height();
@@ -669,7 +663,7 @@ private:
int _count;
};
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QMdiSubWindow::setOpaqueResizeAndMove_data()
{
QTest::addColumn<bool>("opaqueMode");
@@ -1010,7 +1004,7 @@ void tst_QMdiSubWindow::setSystemMenu()
systemMenu->hide();
QVERIFY(!qApp->activePopupWidget());
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
// System menu in menu bar.
subWindow->showMaximized();
QVERIFY(subWindow->isMaximized());
@@ -1043,7 +1037,7 @@ void tst_QMdiSubWindow::setSystemMenu()
systemMenu->hide();
QVERIFY(!qApp->activePopupWidget());
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
// System menu in menu bar in reverse mode.
subWindow->showMaximized();
QVERIFY(subWindow->isMaximized());
@@ -1474,7 +1468,7 @@ void tst_QMdiSubWindow::hideAndShow()
QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner));
QMdiSubWindow *subWindow = mdiArea->addSubWindow(new QTextEdit);
subWindow->showMaximized();
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner));
QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget());
#endif
@@ -1489,7 +1483,7 @@ void tst_QMdiSubWindow::hideAndShow()
// Show QMdiArea.
tabWidget->setCurrentIndex(0);
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner));
QVERIFY(subWindow->maximizedButtonsWidget());
QVERIFY(subWindow->maximizedSystemMenuIconWidget());
@@ -1511,7 +1505,7 @@ void tst_QMdiSubWindow::hideAndShow()
QVERIFY(subWindow);
QCOMPARE(mdiArea->activeSubWindow(), subWindow);
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner));
#if defined Q_OS_QNX
QEXPECT_FAIL("", "QTBUG-38231", Abort);
@@ -1539,7 +1533,7 @@ void tst_QMdiSubWindow::hideAndShow()
QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner));
subWindow->show();
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QVERIFY(subWindow->maximizedButtonsWidget());
QVERIFY(subWindow->maximizedSystemMenuIconWidget());
QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget());
@@ -1553,7 +1547,7 @@ void tst_QMdiSubWindow::hideAndShow()
// Show QMainWindow.
mainWindow.show();
-#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE)
+#if !defined (Q_OS_DARWIN)
QVERIFY(subWindow->maximizedButtonsWidget());
QVERIFY(subWindow->maximizedSystemMenuIconWidget());
QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget());
@@ -1723,7 +1717,7 @@ void tst_QMdiSubWindow::fixedMinMaxSize()
QCOMPARE(subWindow->size(), minimumSize);
}
-#if !defined( Q_OS_MAC) && !defined( Q_OS_WINCE)
+#if !defined( Q_OS_DARWIN)
void tst_QMdiSubWindow::replaceMenuBarWhileMaximized()
{
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 741d6839db..cb7643d1ac 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -81,9 +81,7 @@ private slots:
void overrideMenuAction();
void statusTip();
void widgetActionFocus();
-#ifndef Q_OS_WINCE
void mouseActivation();
-#endif
void tearOff();
void submenuTearOffDontClose();
void layoutDirection();
@@ -96,9 +94,7 @@ private slots:
void task250673_activeMultiColumnSubMenuPosition();
void task256918_setFont();
void menuSizeHint();
-#ifndef Q_OS_WINCE
void task258920_mouseBorder();
-#endif
void setFixedWidth();
void deleteActionInTriggered();
void pushButtonPopulateOnAboutToShow();
@@ -293,8 +289,6 @@ void tst_QMenu::addActionsConnect()
#endif // !QT_NO_SHORTCUT
}
-// We have a separate mouseActivation test for Windows mobile
-#ifndef Q_OS_WINCE
void tst_QMenu::mouseActivation()
{
QWidget topLevel;
@@ -334,7 +328,6 @@ void tst_QMenu::mouseActivation()
QVERIFY(submenu.isVisible());
#endif
}
-#endif
void tst_QMenu::keyboardNavigation_data()
{
@@ -465,7 +458,7 @@ void tst_QMenu::overrideMenuAction()
// On Mac and Windows CE, we need to create native key events to test menu
// action activation, so skip this part of the test.
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
QAction *aQuit = new QAction("Quit", &w);
aQuit->setShortcut(QKeySequence("Ctrl+X"));
m->addAction(aQuit);
@@ -762,10 +755,8 @@ void tst_QMenu::activeSubMenuPosition()
QVERIFY(sub->pos() != QPoint(0,0));
// well, it's enough to check the pos is not (0,0) but it's more safe
// to check that submenu is to the right of the main menu too.
-#ifndef Q_OS_WINCE_WM
QVERIFY(sub->pos().x() > main->pos().x());
QCOMPARE(sub->activeAction(), subAction);
-#endif
}
// QTBUG-49588, QTBUG-48396: activeSubMenuPositionExec() is the same as
@@ -817,10 +808,8 @@ private:
void tst_QMenu::activeSubMenuPositionExec()
{
-#ifndef Q_OS_WINCE
SubMenuPositionExecMenu menu;
menu.exec(QGuiApplication::primaryScreen()->availableGeometry().center());
-#endif // !Q_OS_WINCE
}
void tst_QMenu::task242454_sizeHint()
@@ -954,7 +943,6 @@ public:
};
// Mouse move related signals for Windows Mobile unavailable
-#ifndef Q_OS_WINCE
void tst_QMenu::task258920_mouseBorder()
{
Menu258920 menu;
@@ -983,7 +971,6 @@ void tst_QMenu::task258920_mouseBorder()
QTRY_COMPARE(static_cast<QAction*>(0), menu.activeAction());
QTRY_VERIFY(menu.painted);
}
-#endif
void tst_QMenu::setFixedWidth()
{
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 185bfc02a0..ca58dc1247 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -90,7 +90,7 @@ private slots:
void count();
void insertItem_QString_QObject();
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void accel();
void activatedCount();
@@ -115,7 +115,7 @@ private slots:
void check_altPress();
void check_altClosePress();
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void check_shortcutPress();
void check_menuPosition();
#endif
@@ -311,7 +311,7 @@ inline TestMenu tst_QMenuBar::initWindowWithComplexMenuBar(QMainWindow &w)
}
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::accel()
{
// create a popup menu with menu items set the accelerators later...
@@ -329,7 +329,7 @@ void tst_QMenuBar::accel()
#endif
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::activatedCount()
{
// create a popup menu with menu items set the accelerators later...
@@ -520,7 +520,7 @@ void tst_QMenuBar::insertItem_QString_QObject()
}
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_accelKeys()
{
QMainWindow w;
@@ -593,7 +593,7 @@ void tst_QMenuBar::check_accelKeys()
#endif
// On Mac/WinCE, native key events are needed to test menu action activation
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_cursorKeys1()
{
QMainWindow w;
@@ -627,7 +627,7 @@ void tst_QMenuBar::check_cursorKeys1()
#endif
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_cursorKeys2()
{
QMainWindow w;
@@ -660,7 +660,7 @@ void tst_QMenuBar::check_cursorKeys2()
If a popupmenu is active you can use Left to move to the menu to the left of it.
*/
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_cursorKeys3()
{
QMainWindow w;
@@ -775,7 +775,7 @@ void tst_QMenuBar::check_endKey()
*/
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_escKey()
{
QMainWindow w;
@@ -920,7 +920,6 @@ void tst_QMenuBar::check_escKey()
// QCOMPARE(m_complexActionTriggerCount['h'], (uint)itemH_count);
// }
-#ifndef Q_OS_WINCE
void tst_QMenuBar::allowActiveAndDisabled()
{
QMenuBar menuBar;
@@ -960,7 +959,6 @@ void tst_QMenuBar::allowActiveAndDisabled()
else
QCOMPARE(menuBar.activeAction()->text(), fileMenu.title());
}
-#endif
void tst_QMenuBar::check_altPress()
{
@@ -1011,7 +1009,7 @@ void tst_QMenuBar::check_altClosePress()
}
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_shortcutPress()
{
QMainWindow w;
@@ -1054,7 +1052,7 @@ private:
};
// Qt/Mac,WinCE does not use the native popups/menubar
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_DARWIN)
void tst_QMenuBar::check_menuPosition()
{
QMainWindow w;
@@ -1123,7 +1121,7 @@ void tst_QMenuBar::check_menuPosition()
menu.close();
}
-# ifndef QTEST_NO_CURSOR
+# ifndef QT_NO_CURSOR
// QTBUG-28031: Click at bottom-right corner.
{
w.move(400, 200);
@@ -1137,7 +1135,7 @@ void tst_QMenuBar::check_menuPosition()
QCOMPARE(menu.geometry().right() - 1, globalPos.x());
menu.close();
}
-# endif // QTEST_NO_CURSOR
+# endif // QT_NO_CURSOR
}
#endif
@@ -1210,7 +1208,7 @@ void tst_QMenuBar::task256322_highlight()
QTRY_VERIFY(!menu2.isVisible());
QVERIFY(!menu.isVisible());
#ifdef Q_OS_MAC
- if ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) && (win.menuBar()->activeAction() != nothing))
+ if (win.menuBar()->activeAction() != nothing)
QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue);
#endif
QTRY_COMPARE(win.menuBar()->activeAction(), nothing);
@@ -1393,7 +1391,7 @@ void tst_QMenuBar::cornerWidgets()
QFETCH(Qt::Corner, corner);
-#if defined(Q_OS_OSX) || defined(Q_OS_WINCE)
+#if defined(Q_OS_OSX)
QSKIP("Test interferes with native menu bars on this platform");
#endif
diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
index b58d236a91..31bbcf9c7f 100644
--- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
@@ -48,8 +48,6 @@
#include "qplaintextedit.h"
#include "../../../shared/platformclipboard.h"
-#include "../../../qtest-config.h"
-
//Used in copyAvailable
typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType;
typedef QList<keyPairType> pairListType;
@@ -64,7 +62,6 @@ public:
tst_QPlainTextEdit();
public slots:
- void initTestCase();
void init();
void cleanup();
private slots:
@@ -104,7 +101,7 @@ private slots:
void shiftDownInLineLastShouldSelectToEnd();
void undoRedoShouldRepositionTextEditCursor();
void lineWrapModes();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void mouseCursorShape();
#endif
void implicitClear();
@@ -208,16 +205,8 @@ void tst_QPlainTextEdit::getSetCheck()
QCOMPARE(0, obj1.tabStopWidth());
obj1.setTabStopWidth(INT_MIN);
QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value
-#if defined(Q_OS_WINCE)
- // due to rounding error in qRound when qreal==float
- // we cannot use INT_MAX for this check
- obj1.setTabStopWidth(SHRT_MAX*2);
- QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth());
-#else
obj1.setTabStopWidth(INT_MAX);
QCOMPARE(INT_MAX, obj1.tabStopWidth());
-#endif
-
}
class QtTestDocumentLayout : public QAbstractTextDocumentLayout
@@ -251,13 +240,6 @@ public:
tst_QPlainTextEdit::tst_QPlainTextEdit()
{}
-void tst_QPlainTextEdit::initTestCase()
-{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-}
-
void tst_QPlainTextEdit::init()
{
ed = new QPlainTextEdit(0);
@@ -896,7 +878,7 @@ void tst_QPlainTextEdit::lineWrapModes()
delete window;
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QPlainTextEdit::mouseCursorShape()
{
// always show an IBeamCursor, see change 170146
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 302d290c72..7bbbc46b5a 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -526,12 +526,6 @@ void tst_QPushButton::sizeHint_data()
#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA)
QTest::newRow("windowsvista") << QString::fromLatin1("windowsvista");
#endif
-#if defined(Q_OS_WINCE) && !defined(QT_NO_STYLE_WINDOWSCE)
- QTest::newRow("windowsce") << QString::fromLatin1("windowsce");
-#endif
-#if defined(Q_OS_WINCE_WM) && !defined(QT_NO_STYLE_WINDOWSCE)
- QTest::newRow("windowsmobile") << QString::fromLatin1("windowsmobile");
-#endif
}
void tst_QPushButton::sizeHint()
diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro
index 92c2f6cb7e..6523209c32 100644
--- a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro
+++ b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro
@@ -8,4 +8,4 @@ INCLUDEPATH += ../
HEADERS +=
SOURCES += tst_qtabwidget.cpp
-win32:!wince:!winrt: LIBS += -luser32
+win32:!winrt: LIBS += -luser32
diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
index f8125bf749..2a2331c3bf 100644
--- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
@@ -35,7 +35,7 @@
#include <qlabel.h>
#include <QtWidgets/qboxlayout.h>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
# include <qt_windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
@@ -553,9 +553,7 @@ void tst_QTabWidget::paintEventCount()
// Mac, Windows and Windows CE get multiple repaints on the first show, so use those as a starting point.
static const int MaxInitialPaintCount =
-#if defined(Q_OS_WINCE)
- 4;
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
2;
#elif defined(Q_OS_MAC)
5;
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 69f0ff0f7e..cecec48113 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -55,8 +55,6 @@
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
-#include "../../../qtest-config.h"
-
//Used in copyAvailable
typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType;
typedef QList<keyPairType> pairListType;
@@ -125,7 +123,7 @@ private slots:
void shiftDownInLineLastShouldSelectToEnd();
void undoRedoShouldRepositionTextEditCursor();
void lineWrapModes();
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void mouseCursorShape();
#endif
void implicitClear();
@@ -276,15 +274,8 @@ void tst_QTextEdit::getSetCheck()
QCOMPARE(0, obj1.tabStopWidth());
obj1.setTabStopWidth(INT_MIN);
QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value
-#if defined(Q_OS_WINCE)
- // due to rounding error in qRound when qreal==float
- // we cannot use INT_MAX for this check
- obj1.setTabStopWidth(SHRT_MAX*2);
- QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth());
-#else
obj1.setTabStopWidth(INT_MAX);
QCOMPARE(INT_MAX, obj1.tabStopWidth());
-#endif
// bool QTextEdit::acceptRichText()
// void QTextEdit::setAcceptRichText(bool)
@@ -378,10 +369,6 @@ void tst_QTextEdit::cleanupTestCase()
void tst_QTextEdit::init()
{
-#ifdef Q_OS_WINCE //disable magic for WindowsCE
- qApp->setAutoMaximizeThreshold(-1);
-#endif
-
ed = new QTextEdit(0);
rootFrameMargin = ed->document()->documentMargin();
}
@@ -1230,7 +1217,7 @@ void tst_QTextEdit::lineWrapModes()
QCOMPARE(ed->document()->pageSize().width(), qreal(1000));
}
-#ifndef QTEST_NO_CURSOR
+#ifndef QT_NO_CURSOR
void tst_QTextEdit::mouseCursorShape()
{
// always show an IBeamCursor, see change 170146
diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro
index 0651583867..a8e8f6d865 100644
--- a/tests/auto/widgets/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets/widgets.pro
@@ -48,10 +48,10 @@ SUBDIRS=\
qtoolbutton \
# The following tests depend on private API:
-!contains(QT_CONFIG, private_tests): SUBDIRS -= \
+!qtConfig(private_tests): SUBDIRS -= \
qcombobox \
qmainwindow \
qtextedit \
qtoolbar \
-contains(QT_CONFIG, opengl): SUBDIRS += qopenglwidget
+qtConfig(opengl): SUBDIRS += qopenglwidget
diff --git a/tests/auto/xml/dom/qdom/qdom.pro b/tests/auto/xml/dom/qdom/qdom.pro
index 3248b8e0e2..dd1fa1a75b 100644
--- a/tests/auto/xml/dom/qdom/qdom.pro
+++ b/tests/auto/xml/dom/qdom/qdom.pro
@@ -4,9 +4,4 @@ SOURCES += tst_qdom.cpp
QT = core xml testlib
-wince* {
- wince*|qt_not_deployed {
- DEPLOYMENT_PLUGIN += qcncodecs qjpcodecs qkrcodecs qtwcodecs
- }
-}
TESTDATA += testdata/* doubleNamespaces.xml umlaut.xml
diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
index 5d5e00ac42..da38ed254b 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
+++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
@@ -257,6 +257,7 @@ static QStringList findXmlFiles(QString dir_name)
{
QStringList result;
+ dir_name = QFINDTESTDATA(dir_name);
QDir dir(dir_name);
QFileInfoList file_list = dir.entryInfoList(QStringList("*.xml"), QDir::Files, QDir::Name);
@@ -300,7 +301,7 @@ void tst_QXmlSimpleReader::testGoodXmlFile()
QVERIFY(file.open(QIODevice::ReadOnly));
Parser parser;
- QEXPECT_FAIL("xmldocs/valid/sa/089.xml", "a form feed character is not accepted in XML", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/valid/sa/089.xml").toLocal8Bit().constData(), "a form feed character is not accepted in XML", Continue);
QVERIFY(parser.parseFile(&file));
QFile ref_file(file_name + ".ref");
@@ -337,46 +338,46 @@ void tst_QXmlSimpleReader::testBadXmlFile()
QVERIFY(file.open(QIODevice::ReadOnly));
Parser parser;
- QEXPECT_FAIL("xmldocs/not-wf/sa/030.xml", "a form feed character is not accepted in XML", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/031.xml", "a form feed character is not accepted in a processing instruction", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/032.xml", "a form feed character is not accepted in a comment", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/033.xml", "overlong sequence - small latin letter d should be rejected", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/038.xml", "attribute x redefined; should be rejected", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/072.xml", "entity foo not defined", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/073.xml", "entity f not defined", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/074.xml", "entity e is not well-formed (</foo><foo>)", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/076.xml", "entity foo is not defined", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/077.xml", "entity bar is not defined within the definition of entity foo", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/078.xml", "entity foo not defined", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/085.xml", "Unfinished Public or System Id", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/086.xml", "Unfinished Public or System Id", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/087.xml", "Unfinished Public or System Id", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/101.xml", "Invalid XML encoding name (space before utf-8)", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/102.xml", "Invalid version specification (1.0 followed by space)", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/104.xml", "Premature end of data in tag foo", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/116.xml", "Invalid decimal value", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/117.xml", "No name", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/119.xml", "No name", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/122.xml", "; expected in declaration of element", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/132.xml", "; expected in declaration of element", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/142.xml", "Invalid value '0'", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/143.xml", "Invalid value '31'", Continue);
-
- QEXPECT_FAIL("xmldocs/not-wf/sa/144.xml", "noncharacter code 0xFFFF should be rejected", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/145.xml", "surrogate code point 0xD800 should be rejected", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/146.xml", "code point out-of-range 0x110000 (must be < 0x10FFFE)", Abort);
- QEXPECT_FAIL("xmldocs/not-wf/sa/160.xml", "Parameter references forbidden in internal subset", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/162.xml", "Parameter references forbidden in internal subset", Continue);
-
- QEXPECT_FAIL("xmldocs/not-wf/sa/168.xml", "Surrogate code point 0xEDA080 should be rejected", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/169.xml", "Surrogate code point 0xEDB080 should be rejected", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/170.xml", "Code point 0xF7808080 should be rejected", Continue);
-
- QEXPECT_FAIL("xmldocs/not-wf/sa/180.xml", "Entity e is not defined", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/181.xml", "Unregistered error message", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/182.xml", "Comment not terminated", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/185.xml", "Entity e not defined", Continue);
- QEXPECT_FAIL("xmldocs/not-wf/sa/186.xml", "Attributes constructs error", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/030.xml").toLocal8Bit().constData(), "a form feed character is not accepted in XML", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/031.xml").toLocal8Bit().constData(), "a form feed character is not accepted in a processing instruction", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/032.xml").toLocal8Bit().constData(), "a form feed character is not accepted in a comment", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/033.xml").toLocal8Bit().constData(), "overlong sequence - small latin letter d should be rejected", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/038.xml").toLocal8Bit().constData(), "attribute x redefined; should be rejected", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/072.xml").toLocal8Bit().constData(), "entity foo not defined", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/073.xml").toLocal8Bit().constData(), "entity f not defined", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/074.xml").toLocal8Bit().constData(), "entity e is not well-formed (</foo><foo>)", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/076.xml").toLocal8Bit().constData(), "entity foo is not defined", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/077.xml").toLocal8Bit().constData(), "entity bar is not defined within the definition of entity foo", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/078.xml").toLocal8Bit().constData(), "entity foo not defined", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/085.xml").toLocal8Bit().constData(), "Unfinished Public or System Id", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/086.xml").toLocal8Bit().constData(), "Unfinished Public or System Id", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/087.xml").toLocal8Bit().constData(), "Unfinished Public or System Id", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/101.xml").toLocal8Bit().constData(), "Invalid XML encoding name (space before utf-8)", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/102.xml").toLocal8Bit().constData(), "Invalid version specification (1.0 followed by space)", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/104.xml").toLocal8Bit().constData(), "Premature end of data in tag foo", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/116.xml").toLocal8Bit().constData(), "Invalid decimal value", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/117.xml").toLocal8Bit().constData(), "No name", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/119.xml").toLocal8Bit().constData(), "No name", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/122.xml").toLocal8Bit().constData(), "; expected in declaration of element", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/132.xml").toLocal8Bit().constData(), "; expected in declaration of element", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/142.xml").toLocal8Bit().constData(), "Invalid value '0'", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/143.xml").toLocal8Bit().constData(), "Invalid value '31'", Continue);
+
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/144.xml").toLocal8Bit().constData(), "noncharacter code 0xFFFF should be rejected", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/145.xml").toLocal8Bit().constData(), "surrogate code point 0xD800 should be rejected", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/146.xml").toLocal8Bit().constData(), "code point out-of-range 0x110000 (must be < 0x10FFFE)", Abort);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/160.xml").toLocal8Bit().constData(), "Parameter references forbidden in internal subset", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/162.xml").toLocal8Bit().constData(), "Parameter references forbidden in internal subset", Continue);
+
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/168.xml").toLocal8Bit().constData(), "Surrogate code point 0xEDA080 should be rejected", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/169.xml").toLocal8Bit().constData(), "Surrogate code point 0xEDB080 should be rejected", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/170.xml").toLocal8Bit().constData(), "Code point 0xF7808080 should be rejected", Continue);
+
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/180.xml").toLocal8Bit().constData(), "Entity e is not defined", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/181.xml").toLocal8Bit().constData(), "Unregistered error message", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/182.xml").toLocal8Bit().constData(), "Comment not terminated", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/185.xml").toLocal8Bit().constData(), "Entity e not defined", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/186.xml").toLocal8Bit().constData(), "Attributes constructs error", Continue);
QVERIFY(!parser.parseFile(&file));
@@ -386,7 +387,7 @@ void tst_QXmlSimpleReader::testBadXmlFile()
ref_stream.setCodec("UTF-8");
QString ref_file_contents = ref_stream.readAll();
- QEXPECT_FAIL("xmldocs/not-wf/sa/145.xml", "Surrogate code point 0xD800 should be rejected", Continue);
+ QEXPECT_FAIL(QFINDTESTDATA("xmldocs/not-wf/sa/145.xml").toLocal8Bit().constData(), "Surrogate code point 0xD800 should be rejected", Continue);
QCOMPARE(parser.result(), ref_file_contents);
}
@@ -410,14 +411,20 @@ void tst_QXmlSimpleReader::testIncrementalParsing_data()
for (int i=1; i<10; ++i) {
QStringList::const_iterator it = good_file_list.begin();
+ const QString skip49 = QFINDTESTDATA("xmldocs/valid/sa/049.xml");
+ const QString skip50 = QFINDTESTDATA("xmldocs/valid/sa/050.xml");
+ const QString skip51 = QFINDTESTDATA("xmldocs/valid/sa/051.xml");
+ const QString skip52 = QFINDTESTDATA("xmldocs/valid/sa/052.xml");
+ const QString skip89 = QFINDTESTDATA("xmldocs/valid/sa/089.xml");
+
for (; it != good_file_list.end(); ++it) {
- if ( *it == "xmldocs/valid/sa/089.xml" )
+ if ( *it == skip89 )
continue;// TODO: fails at the moment -- don't bother
if ( i==1 && (
- *it == "xmldocs/valid/sa/049.xml" ||
- *it == "xmldocs/valid/sa/050.xml" ||
- *it == "xmldocs/valid/sa/051.xml" ||
- *it == "xmldocs/valid/sa/052.xml" ) ) {
+ *it == skip49 ||
+ *it == skip50 ||
+ *it == skip51 ||
+ *it == skip52 ) ) {
continue; // TODO: fails at the moment -- don't bother
}
QTest::newRow(QString("%1 %2").arg(*it).arg(i).toLatin1()) << *it << i;
@@ -551,6 +558,9 @@ void tst_QXmlSimpleReader::inputFromSocket_data()
void tst_QXmlSimpleReader::inputFromSocket()
{
QFETCH(QString, file_name);
+#ifdef Q_OS_WINRT
+ QSKIP("WinRT does not support connecting to localhost");
+#endif
QTRY_VERIFY(server->listening);
@@ -756,7 +766,7 @@ public:
void tst_QXmlSimpleReader::dtdRecursionLimit()
{
- QFile file("xmldocs/2-levels-nested-dtd.xml");
+ QFile file(QFINDTESTDATA("xmldocs/2-levels-nested-dtd.xml"));
QVERIFY(file.open(QIODevice::ReadOnly));
QXmlSimpleReader xmlReader;
{
@@ -768,7 +778,7 @@ void tst_QXmlSimpleReader::dtdRecursionLimit()
}
file.close();
- file.setFileName("xmldocs/1-levels-nested-dtd.xml");
+ file.setFileName(QFINDTESTDATA("xmldocs/1-levels-nested-dtd.xml"));
QVERIFY(file.open(QIODevice::ReadOnly));
{
QXmlInputSource *source = new QXmlInputSource(&file);
@@ -782,7 +792,7 @@ void tst_QXmlSimpleReader::dtdRecursionLimit()
}
file.close();
- file.setFileName("xmldocs/internal-entity-polynomial-attribute.xml");
+ file.setFileName(QFINDTESTDATA("xmldocs/internal-entity-polynomial-attribute.xml"));
QVERIFY(file.open(QIODevice::ReadOnly));
{
QXmlInputSource *source = new QXmlInputSource(&file);
diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp
index 305f7318a4..3335ff8ffc 100644
--- a/tests/baselineserver/shared/baselineprotocol.cpp
+++ b/tests/baselineserver/shared/baselineprotocol.cpp
@@ -94,9 +94,6 @@ PlatformInfo PlatformInfo::localHostInfo()
uname.start(QLS("uname"), QStringList() << QLS("-r"));
if (uname.waitForFinished(3000))
pi.insert(PI_OSVersion, QString::fromLocal8Bit(uname.readAllStandardOutput().constData()).simplified());
-#elif defined(Q_OS_WINCE)
- pi.insert(PI_OSName, QLS("WinCE"));
- pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion()));
#elif defined(Q_OS_WIN)
pi.insert(PI_OSName, QLS("Windows"));
pi.insert(PI_OSVersion, QString::number(QSysInfo::windowsVersion()));
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 8ee8d017ab..9e288f7aa2 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -7,6 +7,7 @@ SUBDIRS = \
qtHaveModule(dbus): SUBDIRS += dbus
qtHaveModule(network): SUBDIRS += network
qtHaveModule(gui): SUBDIRS += gui
+qtHaveModule(widgets): SUBDIRS += widgets
check-trusted.CONFIG += recursive
QMAKE_EXTRA_TARGETS += check-trusted
diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
index a9fd7fd5ec..cd5a83e547 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp
@@ -59,10 +59,6 @@ private slots:
void tst_qdiriterator::data()
{
-#if defined(Q_OS_WINCE)
- QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath());
- qtdir += "/depot";
-#else
#if defined(Q_OS_WIN)
const char *qtdir = "C:\\depot\\qt\\main";
#else
@@ -72,7 +68,6 @@ void tst_qdiriterator::data()
fprintf(stderr, "QTDIR not set\n");
exit(1);
}
-#endif
QTest::addColumn<QByteArray>("dirpath");
QByteArray ba = QByteArray(qtdir) + "/src/corelib";
diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
index 3cfb0b44de..061b22a5d1 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
+++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
@@ -6,10 +6,3 @@ CONFIG += release
SOURCES += main.cpp qfilesystemiterator.cpp
HEADERS += qfilesystemiterator.h
-
-wince* {
- corelibdir.files = $$QT_SOURCE_TREE/src/corelib
- corelibdir.path = ./depot/src
- DEPLOYMENT += corelibdir
-}
-
diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp
index 175dc74074..1966b30773 100644
--- a/tests/benchmarks/corelib/io/qfile/main.cpp
+++ b/tests/benchmarks/corelib/io/qfile/main.cpp
@@ -591,12 +591,7 @@ void tst_qfile::createSmallFiles()
dir.cd("tst");
tmpDirName = dir.absolutePath();
-#if defined(Q_OS_WINCE)
- for (int i = 0; i < 100; ++i)
-#else
- for (int i = 0; i < 1000; ++i)
-#endif
- {
+ for (int i = 0; i < 1000; ++i) {
QFile f(tmpDirName + QLatin1Char('/') + QString::number(i));
f.open(QIODevice::WriteOnly);
f.seek(511);
diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
index 24a32a7c72..5180e7c29e 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp
+++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp
@@ -41,7 +41,7 @@ class qfileinfo : public QObject
private slots:
void existsTemporary();
void existsStatic();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void symLinkTargetPerformanceLNK();
void symLinkTargetPerformanceMounpoint();
#endif
@@ -71,7 +71,7 @@ void qfileinfo::existsStatic()
QBENCHMARK { QFileInfo::exists(appPath); }
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void qfileinfo::symLinkTargetPerformanceLNK()
{
QVERIFY(QFile::link("file","link.lnk"));
diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
index d8792ed7ef..782cad94a1 100644
--- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
+++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
@@ -33,7 +33,7 @@ class tst_QProcess : public QObject
{
Q_OBJECT
-#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_PROCESS)
private slots:
void echoTest_performance();
@@ -41,8 +41,7 @@ private slots:
#endif // QT_NO_PROCESS
};
-#if !defined(QT_NO_PROCESS) && !defined(Q_OS_WINCE)
-// Reading and writing to a process is not supported on Qt/CE
+#if !defined(QT_NO_PROCESS)
void tst_QProcess::echoTest_performance()
{
QProcess process;
@@ -88,7 +87,7 @@ void tst_QProcess::echoTest_performance()
QVERIFY(process.waitForFinished());
}
-#endif // QT_NO_PROCESS && Q_OS_WINCE
+#endif // QT_NO_PROCESS
QTEST_MAIN(tst_QProcess)
#include "tst_bench_qprocess.moc"
diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
index 9abb9466df..287afff089 100644
--- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -37,6 +37,15 @@
class tst_qvariant : public QObject
{
Q_OBJECT
+
+public:
+ enum ABenchmarkEnum {
+ FirstEnumValue,
+ SecondEnumValue,
+ ThirdEnumValue
+ };
+ Q_ENUM(ABenchmarkEnum)
+
private slots:
void testBound();
@@ -50,6 +59,7 @@ private slots:
void stringListVariantCreation();
void bigClassVariantCreation();
void smallClassVariantCreation();
+ void enumVariantCreation();
void doubleVariantSetValue();
void floatVariantSetValue();
@@ -58,6 +68,7 @@ private slots:
void stringListVariantSetValue();
void bigClassVariantSetValue();
void smallClassVariantSetValue();
+ void enumVariantSetValue();
void doubleVariantAssignment();
void floatVariantAssignment();
@@ -136,6 +147,16 @@ void variantCreation<SmallClass>(SmallClass val)
}
}
+template <>
+void variantCreation<tst_qvariant::ABenchmarkEnum>(tst_qvariant::ABenchmarkEnum val)
+{
+ QBENCHMARK {
+ for (int i = 0; i < ITERATION_COUNT; ++i) {
+ QVariant::fromValue(val);
+ }
+ }
+}
+
void tst_qvariant::doubleVariantCreation()
{
@@ -179,6 +200,12 @@ void tst_qvariant::smallClassVariantCreation()
variantCreation<SmallClass>(SmallClass());
}
+void tst_qvariant::enumVariantCreation()
+{
+ variantCreation<ABenchmarkEnum>(FirstEnumValue);
+}
+
+
template <typename T>
static void variantSetValue(T d)
{
@@ -225,6 +252,11 @@ void tst_qvariant::smallClassVariantSetValue()
variantSetValue<SmallClass>(SmallClass());
}
+void tst_qvariant::enumVariantSetValue()
+{
+ variantSetValue<ABenchmarkEnum>(FirstEnumValue);
+}
+
template <typename T>
static void variantAssignment(T d)
{
diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro b/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro
new file mode 100644
index 0000000000..86102adecd
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qreadwritelock/qreadwritelock.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+TARGET = tst_bench_qreadwritelock
+QT = core testlib
+SOURCES += tst_qreadwritelock.cpp
+CONFIG += c++14 # for std::shared_timed_mutex
+
diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
new file mode 100644
index 0000000000..bdec6c3a0a
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtCore>
+#include <QtTest/QtTest>
+#include <mutex>
+#if QT_HAS_INCLUDE(<shared_mutex>)
+#if __cplusplus > 201103L
+#include <shared_mutex>
+#endif
+#endif
+
+// Wrapers that take pointers instead of reference to have the same interface as Qt
+template <typename T>
+struct LockerWrapper : T
+{
+ LockerWrapper(typename T::mutex_type *mtx)
+ : T(*mtx)
+ {
+ }
+};
+
+int threadCount;
+
+class tst_QReadWriteLock : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QReadWriteLock()
+ {
+ // at least 2 threads, even on single cpu/core machines
+ threadCount = qMax(2, QThread::idealThreadCount());
+ qDebug("thread count: %d", threadCount);
+ }
+
+private slots:
+ void uncontended_data();
+ void uncontended();
+ void readOnly_data();
+ void readOnly();
+ // void readWrite();
+};
+
+struct FunctionPtrHolder
+{
+ FunctionPtrHolder(QFunctionPointer value = nullptr)
+ : value(value)
+ {
+ }
+ QFunctionPointer value;
+};
+Q_DECLARE_METATYPE(FunctionPtrHolder)
+
+struct FakeLock
+{
+ FakeLock(volatile int *i) { *i = 0; }
+};
+
+enum { Iterations = 1000000 };
+
+template <typename Mutex, typename Locker>
+void testUncontended()
+{
+ Mutex lock;
+ QBENCHMARK {
+ for (int i = 0; i < Iterations; ++i) {
+ Locker locker(&lock);
+ }
+ }
+}
+
+void tst_QReadWriteLock::uncontended_data()
+{
+ QTest::addColumn<FunctionPtrHolder>("holder");
+
+ QTest::newRow("nothing") << FunctionPtrHolder(testUncontended<int, FakeLock>);
+ QTest::newRow("QMutex") << FunctionPtrHolder(testUncontended<QMutex, QMutexLocker>);
+ QTest::newRow("QReadWriteLock, read")
+ << FunctionPtrHolder(testUncontended<QReadWriteLock, QReadLocker>);
+ QTest::newRow("QReadWriteLock, write")
+ << FunctionPtrHolder(testUncontended<QReadWriteLock, QWriteLocker>);
+ QTest::newRow("std::mutex") << FunctionPtrHolder(
+ testUncontended<std::mutex, LockerWrapper<std::unique_lock<std::mutex>>>);
+#if defined __cpp_lib_shared_timed_mutex
+ QTest::newRow("std::shared_timed_mutex, read") << FunctionPtrHolder(
+ testUncontended<std::shared_timed_mutex,
+ LockerWrapper<std::shared_lock<std::shared_timed_mutex>>>);
+ QTest::newRow("std::shared_timed_mutex, write") << FunctionPtrHolder(
+ testUncontended<std::shared_timed_mutex,
+ LockerWrapper<std::unique_lock<std::shared_timed_mutex>>>);
+#endif
+}
+
+void tst_QReadWriteLock::uncontended()
+{
+ QFETCH(FunctionPtrHolder, holder);
+ holder.value();
+}
+
+static QHash<QString, QString> global_hash;
+
+template <typename Mutex, typename Locker>
+void testReadOnly()
+{
+ struct Thread : QThread
+ {
+ Mutex *lock;
+ void run()
+ {
+ for (int i = 0; i < Iterations; ++i) {
+ QString s = QString::number(i); // Do something outside the lock
+ Locker locker(lock);
+ global_hash.contains(s);
+ }
+ }
+ };
+ Mutex lock;
+ QVector<QThread *> threads;
+ for (int i = 0; i < threadCount; ++i) {
+ auto t = new Thread;
+ t->lock = &lock;
+ threads.append(t);
+ }
+ QBENCHMARK {
+ for (auto t : threads) {
+ t->start();
+ }
+ for (auto t : threads) {
+ t->wait();
+ }
+ }
+ qDeleteAll(threads);
+}
+
+void tst_QReadWriteLock::readOnly_data()
+{
+ QTest::addColumn<FunctionPtrHolder>("holder");
+
+ QTest::newRow("nothing") << FunctionPtrHolder(testReadOnly<int, FakeLock>);
+ QTest::newRow("QMutex") << FunctionPtrHolder(testReadOnly<QMutex, QMutexLocker>);
+ QTest::newRow("QReadWriteLock") << FunctionPtrHolder(testReadOnly<QReadWriteLock, QReadLocker>);
+ QTest::newRow("std::mutex") << FunctionPtrHolder(
+ testReadOnly<std::mutex, LockerWrapper<std::unique_lock<std::mutex>>>);
+#if defined __cpp_lib_shared_timed_mutex
+ QTest::newRow("std::shared_timed_mutex") << FunctionPtrHolder(
+ testReadOnly<std::shared_timed_mutex,
+ LockerWrapper<std::shared_lock<std::shared_timed_mutex>>>);
+#endif
+}
+
+void tst_QReadWriteLock::readOnly()
+{
+ QFETCH(FunctionPtrHolder, holder);
+ holder.value();
+}
+
+QTEST_MAIN(tst_QReadWriteLock)
+#include "tst_qreadwritelock.moc"
diff --git a/tests/benchmarks/corelib/thread/thread.pro b/tests/benchmarks/corelib/thread/thread.pro
index 4e602ceb4e..6b3009bd0c 100644
--- a/tests/benchmarks/corelib/thread/thread.pro
+++ b/tests/benchmarks/corelib/thread/thread.pro
@@ -1,6 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = \
qmutex \
+ qreadwritelock \
qthreadstorage \
qthreadpool \
qwaitcondition \
diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
index 9ce8fffa8e..64d3dd5733 100644
--- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
+++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
@@ -119,12 +119,7 @@ struct Large { // A "large" item type
int x[1000];
};
-// Embedded devices typically have limited memory
-#if defined(Q_OS_WINCE)
-# define LARGE_MAX_SIZE 2000
-#else
-# define LARGE_MAX_SIZE 20000
-#endif
+#define LARGE_MAX_SIZE 20000
class tst_vector_vs_std : public QObject
{
diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
index 045beb17f3..5799b32b1c 100644
--- a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
+++ b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
@@ -34,15 +34,6 @@
#include <time.h>
-#ifdef Q_OS_WINCE
-// no C89 time() on Windows CE:
-// http://blogs.msdn.com/b/cenet/archive/2006/04/29/time-h-on-windows-ce.aspx
-uint time(void *)
-{
- return uint(-1);
-}
-#endif
-
class tst_bench_QCryptographicHash : public QObject
{
Q_OBJECT
diff --git a/tests/benchmarks/dbus/qdbustype/qdbustype.pro b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
index d30bad8ce7..70f803f56f 100644
--- a/tests/benchmarks/dbus/qdbustype/qdbustype.pro
+++ b/tests/benchmarks/dbus/qdbustype/qdbustype.pro
@@ -1,10 +1,9 @@
TARGET = tst_bench_qdbustype
QT -= gui
QT += core-private dbus-private testlib
-contains(QT_CONFIG, dbus-linked) {
+qtConfig(dbus-linked) {
DEFINES += QT_LINKED_LIBDBUS
- LIBS += $$QT_LIBS_DBUS
- QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+ QMAKE_USE += dbus
} else {
SOURCES += ../../../../src/dbus/qdbus_symbols.cpp
}
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 7f52bb0eba..0064ecbaaf 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -401,9 +401,6 @@ void tst_QGraphicsView::chipTester_data()
void tst_QGraphicsView::chipTester()
{
-#ifdef Q_OS_WINCE_WM
- QSKIP("WinCE WM: Fails on Windows Mobile w/o OpenGL");
-#endif
QFETCH(bool, antialias);
QFETCH(bool, opengl);
QFETCH(int, operation);
diff --git a/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
index 9e47f979e1..e152ac8200 100644
--- a/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
+++ b/tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro
@@ -1,8 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_imageConversion
QT += testlib
+QT_FOR_CONFIG += gui-private
SOURCES += tst_qimageconversion.cpp
-!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
-contains(QT_CONFIG, c++11): CONFIG += c++11
+qtConfig(gif): DEFINES += QTEST_HAVE_GIF
+qtConfig(jpeg): DEFINES += QTEST_HAVE_JPEG
+qtConfig(c++11): CONFIG += c++11
diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
index e54e2ffce5..33e0c50bba 100644
--- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
+++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro
@@ -1,26 +1,11 @@
QT += testlib
+QT_FOR_CONFIG += gui-private
TEMPLATE = app
TARGET = tst_bench_qimagereader
SOURCES += tst_qimagereader.cpp
-!contains(QT_CONFIG, no-gif):DEFINES += QTEST_HAVE_GIF
-!contains(QT_CONFIG, no-jpeg):DEFINES += QTEST_HAVE_JPEG
+qtConfig(gif): DEFINES += QTEST_HAVE_GIF
+qtConfig(jpeg): DEFINES += QTEST_HAVE_JPEG
QT += network
-
-wince {
- addFiles.files = images
- addFiles.path = .
-
- CONFIG(debug, debug|release):{
- imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*d4.dll
- }
-
- CONFIG(release, debug|release):{
- imageFormatsPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*[^d]4.dll
- }
- imageFormatsPlugins.path = imageformats
- DEPLOYMENT += addFiles imageFormatsPlugins
-}
-
diff --git a/tests/benchmarks/gui/text/qtextdocument/main.cpp b/tests/benchmarks/gui/text/qtextdocument/main.cpp
new file mode 100644
index 0000000000..17fee3b2eb
--- /dev/null
+++ b/tests/benchmarks/gui/text/qtextdocument/main.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <QTextDocument>
+#include <qtest.h>
+
+class tst_QTextDocument : public QObject
+{
+ Q_OBJECT
+private slots:
+ void mightBeRichText_data();
+ void mightBeRichText();
+};
+
+void tst_QTextDocument::mightBeRichText_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<bool>("isMaybeRichText");
+ QTest::newRow("empty") << QString() << false;
+ QTest::newRow("simple") << QString::fromLatin1("<html><b>Foo</b></html>") << true;
+ QTest::newRow("simple2") << QString::fromLatin1("<b>Foo</b>") << true;
+ QTest::newRow("documentation-header") << QString("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
+ "<!DOCTYPE html\n"
+ " PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">")
+ << true;
+ QTest::newRow("br-nospace") << QString("Test <br/> new line") << true;
+ QTest::newRow("br-space") << QString("Test <br /> new line") << true;
+ QTest::newRow("br-invalidspace") << QString("Test <br/ > new line") << false;
+ QTest::newRow("invalid closing tag") << QString("Test <br/ line") << false;
+ QTest::newRow("no tags") << QString("Test line") << false;
+}
+
+void tst_QTextDocument::mightBeRichText()
+{
+ QFETCH(QString, source);
+ QFETCH(bool, isMaybeRichText);
+ QBENCHMARK {
+ QCOMPARE(isMaybeRichText, Qt::mightBeRichText(source));
+ }
+}
+
+QTEST_MAIN(tst_QTextDocument)
+
+#include "main.moc"
diff --git a/tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro b/tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro
new file mode 100644
index 0000000000..67cef8b25c
--- /dev/null
+++ b/tests/benchmarks/gui/text/qtextdocument/qtextdocument.pro
@@ -0,0 +1,7 @@
+QT += testlib
+QT += gui-private
+
+TEMPLATE = app
+TARGET = tst_bench_QTextDocument
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/gui/text/text.pro b/tests/benchmarks/gui/text/text.pro
index 34e548b4d3..6dc4f5d16e 100644
--- a/tests/benchmarks/gui/text/text.pro
+++ b/tests/benchmarks/gui/text/text.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
qfontmetrics \
- qtext
+ qtext \
+ qtextdocument
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 73035be14f..dfa658df11 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -668,12 +668,8 @@ void tst_qnetworkreply::uploadPerformance()
void tst_qnetworkreply::httpUploadPerformance()
{
-#if defined(Q_OS_WINCE_WM)
- // Show some mercy for non-desktop platform/s
- enum {UploadSize = 4*1024*1024}; // 4 MB
-#else
enum {UploadSize = 128*1024*1024}; // 128 MB
-#endif
+
ThreadedDataReaderHttpServer reader;
FixedSizeDataGenerator generator(UploadSize);
@@ -739,12 +735,9 @@ void tst_qnetworkreply::httpDownloadPerformance()
{
QFETCH(bool, serverSendsContentLength);
QFETCH(bool, chunkedEncoding);
-#if defined(Q_OS_WINCE_WM)
- // Show some mercy to non-desktop platform/s
- enum {UploadSize = 4*1024*1024}; // 4 MB
-#else
+
enum {UploadSize = 128*1024*1024}; // 128 MB
-#endif
+
HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding);
QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1"));
@@ -823,12 +816,7 @@ void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer()
QFETCH(HttpDownloadPerformanceDownloadBufferTestType, testType);
// On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results.
-#if defined(Q_OS_WINCE_WM)
- // Show some mercy to non-desktop platform/s
- enum {UploadSize = 4*1024*1024}; // 4 MB
-#else
enum {UploadSize = 32*1024*1024}; // 32 MB
-#endif
HttpDownloadPerformanceServer server(UploadSize, true, false);
diff --git a/tests/benchmarks/network/kernel/kernel.pro b/tests/benchmarks/network/kernel/kernel.pro
index 53ec370d60..7b18eefda2 100644
--- a/tests/benchmarks/network/kernel/kernel.pro
+++ b/tests/benchmarks/network/kernel/kernel.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-contains(QT_CONFIG,private_tests):SUBDIRS += \
+qtConfig(private_tests): SUBDIRS += \
qhostinfo
diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro
index ec812407f7..d53041eb61 100644
--- a/tests/benchmarks/network/network.pro
+++ b/tests/benchmarks/network/network.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
+QT_FOR_CONFIG += network-private
+
SUBDIRS = \
access \
kernel \
@@ -8,7 +10,7 @@ TRUSTED_BENCHMARKS += \
kernel/qhostinfo \
socket/qtcpserver
-contains(QT_CONFIG, openssl) {
+qtConfig(openssl) {
SUBDIRS += ssl
TRUSTED_BENCHMARKS += ssl/qsslsocket
}
diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
index 2e4a3b3fcd..3e731bec96 100644
--- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
@@ -166,9 +166,6 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
return;
-#if defined(Q_OS_WINCE_WM)
- QSKIP("WinCE WM: Not yet supported");
-#endif
QTcpServer server;
if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
diff --git a/tests/benchmarks/widgets/widgets.pro b/tests/benchmarks/widgets/widgets.pro
new file mode 100644
index 0000000000..8fe49ff2c6
--- /dev/null
+++ b/tests/benchmarks/widgets/widgets.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ widgets \
diff --git a/tests/auto/other/windowsmobile/test/ddhelper.h b/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp
index ce68654b76..e469ddcb5b 100644
--- a/tests/auto/other/windowsmobile/test/ddhelper.h
+++ b/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp
@@ -26,24 +26,31 @@
**
****************************************************************************/
-#ifndef __DDHELPER__
-#define __DDHELPER__
-
-extern uchar* q_frameBuffer();
-
-extern int q_screenDepth();
-
-extern int q_screenWidth();
-
-extern int q_screenHeight();
-
-extern int q_linestep();
-
-extern void q_initDD();
-
-extern void q_unlock();
-
-extern void q_lock();
-
-#endif //__DDHELPER__
-
+#include <QDebug>
+#include <QTextBrowser>
+#include <qtest.h>
+
+class tst_QTextBrowser : public QObject
+{
+ Q_OBJECT
+private slots:
+ void largeDocumentsLazyLayout();
+};
+
+void tst_QTextBrowser::largeDocumentsLazyLayout()
+{
+ QString sl;
+ for (int i = 0; i < 150000; ++i) {
+ sl.append("long long text\n");
+ }
+
+ QBENCHMARK {
+ QTextBrowser browser;
+ browser.setPlainText(sl);
+ browser.show();
+ }
+}
+
+QTEST_MAIN(tst_QTextBrowser)
+
+#include "main.moc"
diff --git a/tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro b/tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro
new file mode 100644
index 0000000000..d4a533b335
--- /dev/null
+++ b/tests/benchmarks/widgets/widgets/qtextbrowser/qtextbrowser.pro
@@ -0,0 +1,6 @@
+QT += testlib widgets
+
+TEMPLATE = app
+TARGET = tst_bench_QTextBrowser
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/widgets/widgets/widgets.pro b/tests/benchmarks/widgets/widgets/widgets.pro
new file mode 100644
index 0000000000..593413a770
--- /dev/null
+++ b/tests/benchmarks/widgets/widgets/widgets.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ qtextbrowser \
diff --git a/tests/manual/diaglib/debugproxystyle.cpp b/tests/manual/diaglib/debugproxystyle.cpp
index 667ec403b7..d4e62f5dd6 100644
--- a/tests/manual/diaglib/debugproxystyle.cpp
+++ b/tests/manual/diaglib/debugproxystyle.cpp
@@ -45,13 +45,36 @@ QDebug operator<<(QDebug debug, const QStyleOption *option)
{
#if QT_VERSION >= 0x050000
QDebugStateSaver saver(debug);
+# if QT_VERSION >= 0x050400
+ debug.noquote();
+# endif
debug.nospace();
#endif
- debug << "QStyleOption(";
- if (option)
- debug << "rec=" << option->rect;
- else
- debug << '0';
+ if (!option) {
+ debug << "QStyleOption(0)";
+ return debug;
+ }
+ if (const QStyleOptionViewItem *ivo = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
+ debug << "QStyleOptionViewItem(";
+#if QT_VERSION >= 0x050000
+ debug << ivo->index;
+ if (const int textSize = ivo->text.size())
+ debug << ", \"" << (textSize < 20 ? ivo->text : ivo->text.left(20) + QLatin1String("...")) << '"';
+ debug << ", ";
+#else // Qt 5
+ Q_UNUSED(ivo)
+#endif
+ } else {
+ debug << "QStyleOption(";
+ }
+ debug << "rect=" << option->rect.width() << 'x' << option->rect.height()
+ << forcesign << option->rect.x() << option->rect.y() << noforcesign;
+ if (option->state != QStyle::State_None)
+ debug << ", state=" << option->state;
+#if QT_VERSION >= 0x050000
+ if (option->styleObject && !option->styleObject->isWidgetType())
+ debug << ", styleObject=" << option->styleObject;
+#endif
debug << ')';
return debug;
}
@@ -132,6 +155,15 @@ QRect DebugProxyStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &
return result;
}
+int DebugProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
+ QStyleHintReturn *returnData) const
+{
+ const int result = QProxyStyle::styleHint(hint, option, widget, returnData);
+ qDebug() << __FUNCTION__ << hint << option << widget << "returnData="
+ << returnData << "returns" << result;
+ return result;
+}
+
int DebugProxyStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
const int result = QProxyStyle::pixelMetric(metric, option, widget);
diff --git a/tests/manual/diaglib/debugproxystyle.h b/tests/manual/diaglib/debugproxystyle.h
index 74407e7f3e..01e1e6b6d1 100644
--- a/tests/manual/diaglib/debugproxystyle.h
+++ b/tests/manual/diaglib/debugproxystyle.h
@@ -48,6 +48,7 @@ public:
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const;
QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const;
QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
+ int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const;
diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp
index 19c9ca30e9..4adb1da5f1 100644
--- a/tests/manual/diaglib/qwindowdump.cpp
+++ b/tests/manual/diaglib/qwindowdump.cpp
@@ -113,8 +113,6 @@ void formatWindowFlags(QTextStream &str, const Qt::WindowFlags flags)
debugFlag(str, flags, Qt::WindowStaysOnBottomHint)
debugFlag(str, flags, Qt::MacWindowToolBarButtonHint)
debugFlag(str, flags, Qt::BypassGraphicsProxyWidget)
- debugFlag(str, flags, Qt::WindowOkButtonHint)
- debugFlag(str, flags, Qt::WindowCancelButtonHint)
}
#if QT_VERSION > 0x050000
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index f8287f7d19..2fe96c2f93 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -53,18 +53,14 @@ dialogs \
windowtransparency \
unc
-!contains(QT_CONFIG, openssl):!contains(QT_CONFIG, openssl-linked):SUBDIRS -= qssloptions
+!qtConfig(openssl):!qtConfig(openssl-linked): SUBDIRS -= qssloptions
-contains(QT_CONFIG, opengl) {
+qtConfig(opengl) {
SUBDIRS += qopengltextureblitter
- contains(QT_CONFIG, egl): SUBDIRS += qopenglcontext
+ qtConfig(egl): SUBDIRS += qopenglcontext
}
-win32 {
- SUBDIRS -= network_remote_stresstest network_stresstest
- # disable some tests on wince because of missing dependencies
- wince: SUBDIRS -= lance windowmodality
-}
+win32: SUBDIRS -= network_remote_stresstest network_stresstest
lessThan(QT_MAJOR_VERSION, 5): SUBDIRS -= bearerex lance qnetworkaccessmanager/qget qmimedatabase qnetworkreply \
qpainfo qscreen socketengine xembed-raster xembed-widgets windowtransparency \
diff --git a/tests/manual/qopenglcontext/qopenglcontextwindow.h b/tests/manual/qopenglcontext/qopenglcontextwindow.h
index f436d1af0e..37ff1b2082 100644
--- a/tests/manual/qopenglcontext/qopenglcontextwindow.h
+++ b/tests/manual/qopenglcontext/qopenglcontextwindow.h
@@ -31,9 +31,9 @@
#include <QtGui/QWindow>
#include <QtGui/QOpenGLContext>
+#include <QtGui/QOpenGLTextureBlitter>
#include <QtGui/QImage>
#include <QtCore/QVariant>
-#include <QtGui/private/qopengltextureblitter_p.h>
class QOpenGLContextWindow : public QWindow
{
diff --git a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp
index 63ac1e4e66..f4e093a967 100644
--- a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp
+++ b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.cpp
@@ -123,9 +123,9 @@ void QOpenGLTextureBlitWindow::render()
m_blitter.blit(texture.textureId(), topRightOriginTopLeftVertex, topLeftOrigin);
m_blitter.blit(texture_mirrored.textureId(), bottomLeftOriginTopLeftVertex, topLeftOrigin);
- m_blitter.setSwizzleRB(true);
+ m_blitter.setRedBlueSwizzle(true);
m_blitter.blit(texture.textureId(), bottomRightOriginTopLeftVertex, texTopLeftOriginTopLeft);
- m_blitter.setSwizzleRB(false);
+ m_blitter.setRedBlueSwizzle(false);
m_blitter.release();
if (m_blitter.supportsExternalOESTarget()) {
diff --git a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.h b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.h
index 957d833ef3..0912f096e4 100644
--- a/tests/manual/qopengltextureblitter/qopengltextureblitwindow.h
+++ b/tests/manual/qopengltextureblitter/qopengltextureblitwindow.h
@@ -31,7 +31,7 @@
#include <QtGui/QWindow>
#include <QtGui/QOpenGLContext>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/QOpenGLTextureBlitter>
class QOpenGLTextureBlitWindow : public QWindow
{
diff --git a/tests/manual/qsysinfo/main.cpp b/tests/manual/qsysinfo/main.cpp
index 13458d27e5..5add1e4f74 100644
--- a/tests/manual/qsysinfo/main.cpp
+++ b/tests/manual/qsysinfo/main.cpp
@@ -57,13 +57,6 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v)
CASE_VERSION(WV_WINDOWS10);
case QSysInfo::WV_NT_based: // shouldn't happen
break;
-
- CASE_VERSION(WV_CE);
- CASE_VERSION(WV_CENET);
- CASE_VERSION(WV_CE_5);
- CASE_VERSION(WV_CE_6);
- case QSysInfo::WV_CE_based: // shouldn't happen
- break;
}
return "WinVersion(0x" + QByteArray::number(v, 16) + ')';
@@ -87,6 +80,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_10_8);
CASE_VERSION(MV_10_9);
CASE_VERSION(MV_10_10);
+ CASE_VERSION(MV_10_11);
CASE_VERSION(MV_IOS_4_3);
CASE_VERSION(MV_IOS_5_0);
@@ -96,6 +90,11 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_IOS_7_0);
CASE_VERSION(MV_IOS_7_1);
CASE_VERSION(MV_IOS_8_0);
+ CASE_VERSION(MV_IOS_8_1);
+ CASE_VERSION(MV_IOS_8_2);
+ CASE_VERSION(MV_IOS_8_3);
+ CASE_VERSION(MV_IOS_8_4);
+ CASE_VERSION(MV_IOS_9_0);
case QSysInfo::MV_IOS: // shouldn't happen:
break;
}
diff --git a/tests/shared/filesystem.h b/tests/shared/filesystem.h
index 82c807b3e3..73d7d6523c 100644
--- a/tests/shared/filesystem.h
+++ b/tests/shared/filesystem.h
@@ -36,7 +36,7 @@
#include <QDir>
#include <QFile>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
#include <windows.h>
#include <winioctl.h>
#ifndef IO_REPARSE_TAG_MOUNT_POINT
diff --git a/tests/tests.pro b/tests/tests.pro
index 79bee02b65..346102ab7b 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -4,4 +4,4 @@ SUBDIRS = auto
# benchmarks in debug mode is rarely sensible
# benchmarks are not sensible for code coverage (here with tool testcocoon)
-!ios:!testcocoon:contains(QT_CONFIG,release):SUBDIRS += benchmarks
+!uikit:!testcocoon:contains(QT_CONFIG, release): SUBDIRS += benchmarks
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 263cd6e78c..bf2d7aa8a7 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -66,9 +66,6 @@ std::ostream &operator<<(std::ostream &s, const QString &val) {
using namespace std;
-// Macros to simplify options marking
-#define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " )
-
static inline void promptKeyPress()
{
cout << "(Press any key to continue...)";
@@ -76,27 +73,10 @@ static inline void promptKeyPress()
exit(0); // Exit cleanly for Ctrl+C
}
-Configure::Configure(int& argc, char** argv) : verbose(0)
+Configure::Configure(int& argc, char** argv)
{
- // Default values for indentation
- optionIndent = 4;
- descIndent = 25;
- outputWidth = 0;
- // Get console buffer output width
- CONSOLE_SCREEN_BUFFER_INFO info;
- HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
- if (GetConsoleScreenBufferInfo(hStdout, &info))
- outputWidth = info.dwSize.X - 1;
- outputWidth = qMin(outputWidth, 79); // Anything wider gets unreadable
- if (outputWidth < 35) // Insanely small, just use 79
- outputWidth = 79;
int i;
- /*
- ** Set up the initial state, the default
- */
- dictionary[ "CONFIGCMD" ] = argv[ 0 ];
-
for (i = 1; i < argc; i++)
configCmdLine += argv[ i ];
@@ -122,11 +102,9 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
QDir(buildPath).mkpath("bin");
buildDir.mkpath("mkspecs");
+ buildDir.mkpath("config.tests");
}
- defaultBuildParts << QStringLiteral("libs") << QStringLiteral("tools") << QStringLiteral("examples");
- allBuildParts = defaultBuildParts;
- allBuildParts << QStringLiteral("tests");
dictionary[ "QT_INSTALL_PREFIX" ] = installPath;
dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC");
@@ -137,55 +115,7 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
dictionary[ "QMAKESPEC_FROM" ] = "env";
}
- dictionary[ "QCONFIG" ] = "full";
- dictionary[ "EMBEDDED" ] = "no";
- dictionary[ "BUILD_QMAKE" ] = "yes";
- dictionary[ "QMAKE_INTERNAL" ] = "no";
- dictionary[ "WIDGETS" ] = "yes";
- dictionary[ "GUI" ] = "yes";
- dictionary[ "RTTI" ] = "yes";
- dictionary[ "STRIP" ] = "yes";
- dictionary[ "PCH" ] = "yes";
- dictionary[ "SEPARATE_DEBUG_INFO" ] = "no";
- dictionary[ "SSE2" ] = "auto";
- dictionary[ "SSE3" ] = "auto";
- dictionary[ "SSSE3" ] = "auto";
- dictionary[ "SSE4_1" ] = "auto";
- dictionary[ "SSE4_2" ] = "auto";
- dictionary[ "AVX" ] = "auto";
- dictionary[ "AVX2" ] = "auto";
- dictionary[ "AVX512" ] = "auto";
dictionary[ "SYNCQT" ] = "auto";
- dictionary[ "AUDIO_BACKEND" ] = "auto";
- dictionary[ "WMF_BACKEND" ] = "no";
- dictionary[ "WMSDK" ] = "auto";
- dictionary[ "QML_DEBUG" ] = "yes";
- dictionary[ "PLUGIN_MANIFESTS" ] = "no";
- dictionary[ "DIRECTWRITE" ] = "auto";
- dictionary[ "DIRECTWRITE2" ] = "auto";
- dictionary[ "DIRECT2D" ] = "no";
- dictionary[ "NIS" ] = "no";
- dictionary[ "NEON" ] = "auto";
- dictionary[ "LARGE_FILE" ] = "yes";
- dictionary[ "FONT_CONFIG" ] = "no";
- dictionary[ "POSIX_IPC" ] = "no";
- dictionary[ "QT_GLIB" ] = "no";
- dictionary[ "QT_ICONV" ] = "auto";
- dictionary[ "QT_EVDEV" ] = "auto";
- dictionary[ "QT_MTDEV" ] = "auto";
- dictionary[ "QT_TSLIB" ] = "auto";
- dictionary[ "QT_INOTIFY" ] = "auto";
- dictionary[ "QT_EVENTFD" ] = "auto";
- dictionary[ "QT_CUPS" ] = "auto";
- dictionary[ "CFG_GCC_SYSROOT" ] = "yes";
- dictionary[ "SLOG2" ] = "no";
- dictionary[ "QNX_IMF" ] = "no";
- dictionary[ "PPS" ] = "no";
- dictionary[ "LGMON" ] = "no";
- dictionary[ "SYSTEM_PROXIES" ] = "no";
- dictionary[ "WERROR" ] = "auto";
- dictionary[ "QREAL" ] = "double";
- dictionary[ "ATOMIC64" ] = "auto";
//Only used when cross compiling.
dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
@@ -220,71 +150,8 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
dictionary[ "REDO" ] = "no";
- dictionary[ "BUILD" ] = "debug";
- dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
- dictionary[ "FORCEDEBUGINFO" ] = "no";
- dictionary[ "RELEASE_TOOLS" ] = "no";
-
dictionary[ "BUILDTYPE" ] = "none";
- dictionary[ "BUILDDEV" ] = "no";
-
- dictionary[ "COMPILE_EXAMPLES" ] = "yes";
-
- dictionary[ "C++STD" ] = "auto";
-
- dictionary[ "USE_GOLD_LINKER" ] = "no";
-
- dictionary[ "ENABLE_NEW_DTAGS" ] = "no";
-
- dictionary[ "SHARED" ] = "yes";
-
- dictionary[ "STATIC_RUNTIME" ] = "no";
-
- dictionary[ "ZLIB" ] = "auto";
-
- dictionary[ "PCRE" ] = "auto";
-
- dictionary[ "ICU" ] = "no";
-
- dictionary[ "ANGLE" ] = "auto";
- dictionary[ "DYNAMICGL" ] = "auto";
-
- dictionary[ "GIF" ] = "auto";
- dictionary[ "JPEG" ] = "auto";
- dictionary[ "PNG" ] = "auto";
- dictionary[ "LIBJPEG" ] = "auto";
- dictionary[ "LIBPNG" ] = "auto";
- dictionary[ "DOUBLECONVERSION" ] = "auto";
- dictionary[ "FREETYPE" ] = "yes";
- dictionary[ "FREETYPE_FROM" ] = "default";
- dictionary[ "HARFBUZZ" ] = "qt";
-
- dictionary[ "ACCESSIBILITY" ] = "yes";
- dictionary[ "OPENGL" ] = "yes";
- dictionary[ "OPENGL_ES_2" ] = "yes";
- dictionary[ "OPENVG" ] = "no";
- dictionary[ "SSL" ] = "auto";
- dictionary[ "OPENSSL" ] = "auto";
- dictionary[ "LIBPROXY" ] = "auto";
- dictionary[ "DBUS" ] = "auto";
-
- dictionary[ "STYLE_WINDOWS" ] = "yes";
- dictionary[ "STYLE_WINDOWSXP" ] = "auto";
- dictionary[ "STYLE_WINDOWSVISTA" ] = "auto";
- dictionary[ "STYLE_FUSION" ] = "yes";
-
- dictionary[ "SQL_MYSQL" ] = "no";
- dictionary[ "SQL_ODBC" ] = "no";
- dictionary[ "SQL_OCI" ] = "no";
- dictionary[ "SQL_PSQL" ] = "no";
- dictionary[ "SQL_TDS" ] = "no";
- dictionary[ "SQL_DB2" ] = "no";
- dictionary[ "SQL_SQLITE" ] = "auto";
- dictionary[ "SQL_SQLITE_LIB" ] = "qt";
- dictionary[ "SQL_SQLITE2" ] = "no";
- dictionary[ "SQL_IBASE" ] = "no";
-
QString tmp = dictionary[ "QMAKESPEC" ];
if (tmp.contains("\\")) {
tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
@@ -292,25 +159,6 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
tmp = tmp.mid(tmp.lastIndexOf("/") + 1);
}
dictionary[ "QMAKESPEC" ] = tmp;
-
- dictionary[ "INCREDIBUILD_XGE" ] = "auto";
- dictionary[ "LTCG" ] = "no";
- dictionary[ "NATIVE_GESTURES" ] = "yes";
- dictionary[ "MSVC_MP" ] = "no";
-
- if (dictionary["QMAKESPEC"].startsWith("win32-g++")) {
- const QString zero = QStringLiteral("0");
- const QStringList parts = Environment::gccVersion().split(QLatin1Char('.'));
- dictionary["QT_GCC_MAJOR_VERSION"] = parts.value(0, zero);
- dictionary["QT_GCC_MINOR_VERSION"] = parts.value(1, zero);
- dictionary["QT_GCC_PATCH_VERSION"] = parts.value(2, zero);
- } else if (dictionary["QMAKESPEC"].contains(QString("msvc"))) {
- const QString zero = QStringLiteral("0");
- const QStringList parts = Environment::msvcVersion().split(QLatin1Char('.'));
- dictionary["QT_CL_MAJOR_VERSION"] = parts.value(0, zero);
- dictionary["QT_CL_MINOR_VERSION"] = parts.value(1, zero);
- dictionary["QT_CL_PATCH_VERSION"] = parts.value(2, zero);
- }
}
Configure::~Configure()
@@ -328,34 +176,6 @@ QString Configure::formatPath(const QString &path)
return ret;
}
-QString Configure::formatPaths(const QStringList &paths)
-{
- QString ret;
- foreach (const QString &path, paths) {
- if (!ret.isEmpty())
- ret += QLatin1Char(' ');
- ret += formatPath(path);
- }
- return ret;
-}
-
-// We could use QDir::homePath() + "/.qt-license", but
-// that will only look in the first of $HOME,$USERPROFILE
-// or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be
-// more forgiving for the end user..
-QString Configure::firstLicensePath()
-{
- QStringList allPaths;
- allPaths << "./.qt-license"
- << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license"
- << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license"
- << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license";
- for (int i = 0; i< allPaths.count(); ++i)
- if (QFile::exists(allPaths.at(i)))
- return allPaths.at(i);
- return QString();
-}
-
// #### somehow I get a compiler error about vc++ reaching the nesting limit without
// undefining the ansi for scoping.
#ifdef for
@@ -364,40 +184,34 @@ QString Configure::firstLicensePath()
void Configure::parseCmdLine()
{
+ sourcePathMangled = sourcePath;
+ buildPathMangled = buildPath;
if (configCmdLine.size() && configCmdLine.at(0) == "-top-level") {
dictionary[ "TOPLEVEL" ] = "yes";
configCmdLine.removeAt(0);
+ sourcePathMangled = QFileInfo(sourcePath).path();
+ buildPathMangled = QFileInfo(buildPath).path();
}
int argCount = configCmdLine.size();
int i = 0;
- const QStringList imageFormats = QStringList() << "gif" << "png" << "jpeg";
-
- if (argCount < 1) // skip rest if no arguments
- ;
- else if (configCmdLine.at(i) == "-redo") {
- dictionary[ "REDO" ] = "yes";
- configCmdLine.clear();
- reloadCmdLine();
- }
- else if (configCmdLine.at(i) == "-loadconfig") {
- ++i;
- if (i != argCount) {
- dictionary[ "REDO" ] = "yes";
- dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
- configCmdLine.clear();
- reloadCmdLine();
- } else {
- dictionary[ "DONE" ] = "error";
+ // Look first for -redo
+ for (int k = 0 ; k < argCount; ++k) {
+ if (configCmdLine.at(k) == "-redo") {
+ dictionary["REDO"] = "yes";
+ configCmdLine.removeAt(k);
+ if (!reloadCmdLine(k)) {
+ dictionary["DONE"] = "error";
+ return;
+ }
+ argCount = configCmdLine.size();
+ break;
}
- i = 0;
}
- argCount = configCmdLine.size();
+ // Then look for XQMAKESPEC
bool isDeviceMkspec = false;
-
- // Look first for XQMAKESPEC
for (int j = 0 ; j < argCount; ++j)
{
if ((configCmdLine.at(j) == "-xplatform") || (configCmdLine.at(j) == "-device")) {
@@ -412,152 +226,18 @@ void Configure::parseCmdLine()
}
for (; i<configCmdLine.size(); ++i) {
- bool continueElse[] = {false, false};
- if (configCmdLine.at(i) == "-help"
- || configCmdLine.at(i) == "-h"
- || configCmdLine.at(i) == "-?")
- dictionary[ "HELP" ] = "yes";
-
- else if (configCmdLine.at(i) == "-v" || configCmdLine.at(i) == "-verbose") {
- ++verbose;
- }
-
- else if (configCmdLine.at(i) == "-qconfig") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QCONFIG" ] = configCmdLine.at(i);
- }
- else if (configCmdLine.at(i) == "-qreal") {
- ++i;
- if (i == argCount)
- break;
- QString s = dictionary[ "QREAL" ] = configCmdLine.at(i);
- if (s == "float") {
- dictionary[ "QREAL_STRING" ] = "\"float\"";
- } else {
- // escape
- s = s.simplified();
- s = '"' + s.toLatin1().toPercentEncoding(QByteArray(), "-._~", '_') + '"';
- dictionary[ "QREAL_STRING" ] = s;
- }
- }
-
- else if (configCmdLine.at(i) == "-release") {
- dictionary[ "BUILD" ] = "release";
- if (dictionary[ "BUILDALL" ] == "auto")
- dictionary[ "BUILDALL" ] = "no";
- } else if (configCmdLine.at(i) == "-debug") {
- dictionary[ "BUILD" ] = "debug";
- if (dictionary[ "BUILDALL" ] == "auto")
- dictionary[ "BUILDALL" ] = "no";
- } else if (configCmdLine.at(i) == "-debug-and-release")
- dictionary[ "BUILDALL" ] = "yes";
- else if (configCmdLine.at(i) == "-force-debug-info")
- dictionary[ "FORCEDEBUGINFO" ] = "yes";
- else if (configCmdLine.at(i) == "-no-separate-debug-info")
- dictionary[ "SEPARATE_DEBUG_INFO" ] = "no";
- else if (configCmdLine.at(i) == "-separate-debug-info")
- dictionary[ "SEPARATE_DEBUG_INFO" ] = "yes";
- else if (configCmdLine.at(i) == "-optimized-tools")
- dictionary[ "RELEASE_TOOLS" ] = "yes";
- else if (configCmdLine.at(i) == "-no-optimized-tools")
- dictionary[ "RELEASE_TOOLS" ] = "no";
-
- else if (configCmdLine.at(i) == "-compile-examples") {
- dictionary[ "COMPILE_EXAMPLES" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-compile-examples") {
- dictionary[ "COMPILE_EXAMPLES" ] = "no";
- }
-
- else if (configCmdLine.at(i) == "-c++std") {
- ++i;
- if (i == argCount)
- break;
-
- QString level = configCmdLine.at(i);
- if (level == "c++11" || level == "c++14" || level == "c++1z"
- || level == "auto") {
- dictionary[ "C++STD" ] = level;
- } else if (level == "11" || level == "14" || level == "1z") {
- dictionary[ "C++STD" ] = "c++" + level;
- } else {
- dictionary[ "DONE" ] = "error";
- cout << "ERROR: invalid C++ standard " << level
- << "; valid options are: c++11 c++14 c++1z auto" << endl;
- return;
- }
- }
-
-
- else if (configCmdLine.at(i) == "-use-gold-linker")
- dictionary[ "USE_GOLD_LINKER" ] = "yes";
- else if (configCmdLine.at(i) == "-no-use-gold-linker")
- dictionary[ "USE_GOLD_LINKER" ] = "no";
- else if (configCmdLine.at(i) == "-enable-new-dtags")
- dictionary[ "ENABLE_NEW_DTAGS" ] = "yes";
- else if (configCmdLine.at(i) == "-disable-new-dtags")
- dictionary[ "ENABLE_NEW_DTAGS" ] = "no";
- else if (configCmdLine.at(i) == "-shared")
- dictionary[ "SHARED" ] = "yes";
- else if (configCmdLine.at(i) == "-static")
- dictionary[ "SHARED" ] = "no";
- else if (configCmdLine.at(i) == "-static-runtime")
- dictionary[ "STATIC_RUNTIME" ] = "yes";
- else if (configCmdLine.at(i) == "-developer-build")
- dictionary[ "BUILDDEV" ] = "yes";
- else if (configCmdLine.at(i) == "-opensource") {
+ if (configCmdLine.at(i) == "-opensource") {
dictionary[ "BUILDTYPE" ] = "opensource";
}
else if (configCmdLine.at(i) == "-commercial") {
dictionary[ "BUILDTYPE" ] = "commercial";
}
- else if (configCmdLine.at(i) == "-ltcg") {
- dictionary[ "LTCG" ] = "yes";
- }
- else if (configCmdLine.at(i) == "-no-ltcg") {
- dictionary[ "LTCG" ] = "no";
- }
- else if (configCmdLine.at(i) == "-mp") {
- dictionary[ "MSVC_MP" ] = "yes";
- }
- else if (configCmdLine.at(i) == "-no-mp") {
- dictionary[ "MSVC_MP" ] = "no";
- }
- else if (configCmdLine.at(i) == "-force-asserts") {
- dictionary[ "FORCE_ASSERTS" ] = "yes";
- }
- else if (configCmdLine.at(i) == "-target") {
- ++i;
- if (i == argCount)
- break;
- const QString option = configCmdLine.at(i);
- if (option == "xp") {
- cout << "ERROR: option \"-target xp\" is no longer valid" << endl;
- dictionary["DONE"] = "error";
- return;
- }
-
- if (option != "xp") {
- cout << "ERROR: invalid argument for -target option" << endl;
- dictionary["DONE"] = "error";
- return;
- }
- dictionary["TARGET_OS"] = option;
- }
else if (configCmdLine.at(i) == "-platform") {
++i;
if (i == argCount)
break;
dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
dictionary[ "QMAKESPEC_FROM" ] = "commandline";
- } else if (configCmdLine.at(i) == "-arch") {
- ++i;
- if (i == argCount)
- break;
- dictionary["OBSOLETE_ARCH_ARG"] = "yes";
- } else if (configCmdLine.at(i) == "-embedded") {
- dictionary[ "EMBEDDED" ] = "yes";
} else if (configCmdLine.at(i) == "-xplatform"
|| configCmdLine.at(i) == "-device") {
++i;
@@ -572,514 +252,13 @@ void Configure::parseCmdLine()
devOpt = option;
}
- else if (configCmdLine.at(i) == "-no-zlib") {
- // No longer supported since Qt 4.4.0
- // But save the information for later so that we can print a warning
- //
- // If you REALLY really need no zlib support, you can still disable
- // it by doing the following:
- // add "no-zlib" to mkspecs/qconfig.pri
- // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
- //
- // There's no guarantee that Qt will build under those conditions
-
- dictionary[ "ZLIB_FORCED" ] = "yes";
- } else if (configCmdLine.at(i) == "-qt-zlib") {
- dictionary[ "ZLIB" ] = "qt";
- } else if (configCmdLine.at(i) == "-system-zlib") {
- dictionary[ "ZLIB" ] = "system";
- }
-
- else if (configCmdLine.at(i) == "-qt-pcre") {
- dictionary[ "PCRE" ] = "qt";
- } else if (configCmdLine.at(i) == "-system-pcre") {
- dictionary[ "PCRE" ] = "system";
- }
-
- else if (configCmdLine.at(i) == "-icu") {
- dictionary[ "ICU" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-icu") {
- dictionary[ "ICU" ] = "no";
- }
-
- else if (configCmdLine.at(i) == "-angle") {
- dictionary[ "ANGLE" ] = "yes";
- dictionary[ "ANGLE_FROM" ] = "commandline";
- } else if (configCmdLine.at(i) == "-no-angle") {
- dictionary[ "ANGLE" ] = "no";
- dictionary[ "ANGLE_FROM" ] = "commandline";
- }
-
- // Image formats --------------------------------------------
- else if (configCmdLine.at(i) == "-no-gif")
- dictionary[ "GIF" ] = "no";
-
- else if (configCmdLine.at(i) == "-no-libjpeg") {
- dictionary[ "JPEG" ] = "no";
- dictionary[ "LIBJPEG" ] = "no";
- } else if (configCmdLine.at(i) == "-qt-libjpeg") {
- dictionary[ "LIBJPEG" ] = "qt";
- } else if (configCmdLine.at(i) == "-system-libjpeg") {
- dictionary[ "LIBJPEG" ] = "system";
- }
-
- else if (configCmdLine.at(i) == "-no-libpng") {
- dictionary[ "PNG" ] = "no";
- dictionary[ "LIBPNG" ] = "no";
- } else if (configCmdLine.at(i) == "-qt-libpng") {
- dictionary[ "LIBPNG" ] = "qt";
- } else if (configCmdLine.at(i) == "-system-libpng") {
- dictionary[ "LIBPNG" ] = "system";
- }
-
- // Double Conversion -----------------------------------------
- else if (configCmdLine.at(i) == "-no-doubleconversion")
- dictionary[ "DOUBLECONVERSION" ] = "no";
- else if (configCmdLine.at(i) == "-qt-doubleconversion")
- dictionary[ "DOUBLECONVERSION" ] = "qt";
- else if (configCmdLine.at(i) == "-system-doubleconversion")
- dictionary[ "DOUBLECONVERSION" ] = "system";
-
- // Text Rendering --------------------------------------------
- else if (configCmdLine.at(i) == "-no-freetype") {
- dictionary[ "FREETYPE" ] = "no";
- dictionary[ "FREETYPE_FROM" ] = "commandline";
- } else if (configCmdLine.at(i) == "-qt-freetype") {
- dictionary[ "FREETYPE" ] = "yes";
- dictionary[ "FREETYPE_FROM" ] = "commandline";
- } else if (configCmdLine.at(i) == "-system-freetype") {
- dictionary[ "FREETYPE" ] = "system";
- dictionary[ "FREETYPE_FROM" ] = "commandline";
- }
-
- else if (configCmdLine.at(i) == "-no-harfbuzz")
- dictionary[ "HARFBUZZ" ] = "no";
- else if (configCmdLine.at(i) == "-qt-harfbuzz")
- dictionary[ "HARFBUZZ" ] = "qt";
- else if (configCmdLine.at(i) == "-system-harfbuzz")
- dictionary[ "HARFBUZZ" ] = "system";
-
- // Styles ---------------------------------------------------
- else if (configCmdLine.at(i) == "-qt-style-windows")
- dictionary[ "STYLE_WINDOWS" ] = "yes";
- else if (configCmdLine.at(i) == "-no-style-windows")
- dictionary[ "STYLE_WINDOWS" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-style-windowsxp")
- dictionary[ "STYLE_WINDOWSXP" ] = "yes";
- else if (configCmdLine.at(i) == "-no-style-windowsxp")
- dictionary[ "STYLE_WINDOWSXP" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-style-windowsvista")
- dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
- else if (configCmdLine.at(i) == "-no-style-windowsvista")
- dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-style-fusion")
- dictionary[ "STYLE_FUSION" ] = "yes";
- else if (configCmdLine.at(i) == "-no-style-fusion")
- dictionary[ "STYLE_FUSION" ] = "no";
-
- // Work around compiler nesting limitation
- else
- continueElse[1] = true;
- if (!continueElse[1]) {
- }
-
- // OpenGL Support -------------------------------------------
- else if (configCmdLine.at(i) == "-no-opengl") {
- dictionary[ "OPENGL" ] = "no";
- dictionary[ "OPENGL_ES_2" ] = "no";
- } else if (configCmdLine.at(i) == "-opengl-es-2") {
- dictionary[ "OPENGL" ] = "yes";
- dictionary[ "OPENGL_ES_2" ] = "yes";
- } else if (configCmdLine.at(i) == "-opengl") {
- dictionary[ "OPENGL" ] = "yes";
- i++;
- if (i == argCount)
- break;
-
- dictionary[ "OPENGL_ES_2" ] = "no";
- if ( configCmdLine.at(i) == "es2" ) {
- dictionary[ "OPENGL_ES_2" ] = "yes";
- } else if ( configCmdLine.at(i) == "desktop" ) {
- // OPENGL=yes suffices
- } else if ( configCmdLine.at(i) == "dynamic" ) {
- dictionary[ "DYNAMICGL" ] = "yes";
- } else {
- cout << "Argument passed to -opengl option is not valid." << endl;
- dictionary[ "DONE" ] = "error";
- break;
- }
- }
-
- // OpenVG Support -------------------------------------------
- else if (configCmdLine.at(i) == "-openvg") {
- dictionary[ "OPENVG" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-openvg") {
- dictionary[ "OPENVG" ] = "no";
- }
-
- // Databases ------------------------------------------------
- else if (configCmdLine.at(i) == "-qt-sql-mysql")
- dictionary[ "SQL_MYSQL" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-mysql")
- dictionary[ "SQL_MYSQL" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-mysql")
- dictionary[ "SQL_MYSQL" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-sql-odbc")
- dictionary[ "SQL_ODBC" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-odbc")
- dictionary[ "SQL_ODBC" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-odbc")
- dictionary[ "SQL_ODBC" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-sql-oci")
- dictionary[ "SQL_OCI" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-oci")
- dictionary[ "SQL_OCI" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-oci")
- dictionary[ "SQL_OCI" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-sql-psql")
- dictionary[ "SQL_PSQL" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-psql")
- dictionary[ "SQL_PSQL" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-psql")
- dictionary[ "SQL_PSQL" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-sql-tds")
- dictionary[ "SQL_TDS" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-tds")
- dictionary[ "SQL_TDS" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-tds")
- dictionary[ "SQL_TDS" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-sql-db2")
- dictionary[ "SQL_DB2" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-db2")
- dictionary[ "SQL_DB2" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-db2")
- dictionary[ "SQL_DB2" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-sql-sqlite")
- dictionary[ "SQL_SQLITE" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-sqlite")
- dictionary[ "SQL_SQLITE" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-sqlite")
- dictionary[ "SQL_SQLITE" ] = "no";
- else if (configCmdLine.at(i) == "-system-sqlite")
- dictionary[ "SQL_SQLITE_LIB" ] = "system";
- else if (configCmdLine.at(i) == "-qt-sql-sqlite2")
- dictionary[ "SQL_SQLITE2" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-sqlite2")
- dictionary[ "SQL_SQLITE2" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-sqlite2")
- dictionary[ "SQL_SQLITE2" ] = "no";
-
- else if (configCmdLine.at(i) == "-qt-sql-ibase")
- dictionary[ "SQL_IBASE" ] = "yes";
- else if (configCmdLine.at(i) == "-plugin-sql-ibase")
- dictionary[ "SQL_IBASE" ] = "plugin";
- else if (configCmdLine.at(i) == "-no-sql-ibase")
- dictionary[ "SQL_IBASE" ] = "no";
-
- // Image formats --------------------------------------------
- else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
- imageFormats.contains(configCmdLine.at(i).section('-', 3)))
- dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
- else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
- imageFormats.contains(configCmdLine.at(i).section('-', 3)))
- dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
- else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
- imageFormats.contains(configCmdLine.at(i).section('-', 3)))
- dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
-
- else if (configCmdLine.at(i) == "-no-incredibuild-xge")
- dictionary[ "INCREDIBUILD_XGE" ] = "no";
- else if (configCmdLine.at(i) == "-incredibuild-xge")
- dictionary[ "INCREDIBUILD_XGE" ] = "yes";
- else if (configCmdLine.at(i) == "-native-gestures")
- dictionary[ "NATIVE_GESTURES" ] = "yes";
- else if (configCmdLine.at(i) == "-no-native-gestures")
- dictionary[ "NATIVE_GESTURES" ] = "no";
- // Others ---------------------------------------------------
- else if (configCmdLine.at(i) == "-widgets")
- dictionary[ "WIDGETS" ] = "yes";
- else if (configCmdLine.at(i) == "-no-widgets")
- dictionary[ "WIDGETS" ] = "no";
-
- else if (configCmdLine.at(i) == "-gui")
- dictionary[ "GUI" ] = "yes";
- else if (configCmdLine.at(i) == "-no-gui")
- dictionary[ "GUI" ] = "no";
-
- else if (configCmdLine.at(i) == "-rtti")
- dictionary[ "RTTI" ] = "yes";
- else if (configCmdLine.at(i) == "-no-rtti")
- dictionary[ "RTTI" ] = "no";
-
- else if (configCmdLine.at(i) == "-strip")
- dictionary[ "STRIP" ] = "yes";
- else if (configCmdLine.at(i) == "-no-strip")
- dictionary[ "STRIP" ] = "no";
-
- else if (configCmdLine.at(i) == "-pch")
- dictionary[ "PCH" ] = "yes";
- else if (configCmdLine.at(i) == "-no-pch")
- dictionary[ "PCH" ] = "no";
-
- else if (configCmdLine.at(i) == "-accessibility")
- dictionary[ "ACCESSIBILITY" ] = "yes";
- else if (configCmdLine.at(i) == "-no-accessibility") {
- dictionary[ "ACCESSIBILITY" ] = "no";
- cout << "Setting accessibility to NO" << endl;
- }
-
- else if (configCmdLine.at(i) == "-no-sse2")
- dictionary[ "SSE2" ] = "no";
- else if (configCmdLine.at(i) == "-sse2")
- dictionary[ "SSE2" ] = "yes";
- else if (configCmdLine.at(i) == "-no-sse3")
- dictionary[ "SSE3" ] = "no";
- else if (configCmdLine.at(i) == "-sse3")
- dictionary[ "SSE3" ] = "yes";
- else if (configCmdLine.at(i) == "-no-ssse3")
- dictionary[ "SSSE3" ] = "no";
- else if (configCmdLine.at(i) == "-ssse3")
- dictionary[ "SSSE3" ] = "yes";
- else if (configCmdLine.at(i) == "-no-sse4.1")
- dictionary[ "SSE4_1" ] = "no";
- else if (configCmdLine.at(i) == "-sse4.1")
- dictionary[ "SSE4_1" ] = "yes";
- else if (configCmdLine.at(i) == "-no-sse4.2")
- dictionary[ "SSE4_2" ] = "no";
- else if (configCmdLine.at(i) == "-sse4.2")
- dictionary[ "SSE4_2" ] = "yes";
- else if (configCmdLine.at(i) == "-no-avx")
- dictionary[ "AVX" ] = "no";
- else if (configCmdLine.at(i) == "-avx")
- dictionary[ "AVX" ] = "yes";
- else if (configCmdLine.at(i) == "-no-avx2")
- dictionary[ "AVX2" ] = "no";
- else if (configCmdLine.at(i) == "-avx2")
- dictionary[ "AVX2" ] = "yes";
- else if (configCmdLine.at(i) == "-no-avx512")
- dictionary[ "AVX512" ] = "";
- else if (configCmdLine.at(i) == "-avx512")
- dictionary[ "AVX512" ] = "auto";
-
- else if (configCmdLine.at(i) == "-no-ssl") {
- dictionary[ "SSL"] = "no";
- } else if (configCmdLine.at(i) == "-ssl") {
- dictionary[ "SSL" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-openssl") {
- dictionary[ "OPENSSL"] = "no";
- } else if (configCmdLine.at(i) == "-openssl") {
- dictionary[ "OPENSSL" ] = "yes";
- dictionary[ "SSL" ] = "yes";
- } else if (configCmdLine.at(i) == "-openssl-linked") {
- dictionary[ "OPENSSL" ] = "linked";
- dictionary[ "SSL" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-libproxy") {
- dictionary[ "LIBPROXY"] = "no";
- } else if (configCmdLine.at(i) == "-libproxy") {
- dictionary[ "LIBPROXY" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-qdbus") {
- dictionary[ "DBUS" ] = "no";
- } else if (configCmdLine.at(i) == "-qdbus") {
- dictionary[ "DBUS" ] = "auto";
- } else if (configCmdLine.at(i) == "-no-dbus") {
- dictionary[ "DBUS" ] = "no";
- } else if (configCmdLine.at(i) == "-dbus") {
- dictionary[ "DBUS" ] = "auto";
- } else if (configCmdLine.at(i) == "-dbus-linked") {
- dictionary[ "DBUS" ] = "linked";
- } else if (configCmdLine.at(i) == "-dbus-runtime") {
- dictionary[ "DBUS" ] = "runtime";
- } else if (configCmdLine.at(i) == "-audio-backend") {
- dictionary[ "AUDIO_BACKEND" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-audio-backend") {
- dictionary[ "AUDIO_BACKEND" ] = "no";
- } else if (configCmdLine.at(i) == "-wmf-backend") {
- dictionary[ "WMF_BACKEND" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-wmf-backend") {
- dictionary[ "WMF_BACKEND" ] = "no";
- } else if (configCmdLine.at(i) == "-no-qml-debug") {
- dictionary[ "QML_DEBUG" ] = "no";
- } else if (configCmdLine.at(i) == "-qml-debug") {
- dictionary[ "QML_DEBUG" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-plugin-manifests") {
- dictionary[ "PLUGIN_MANIFESTS" ] = "no";
- } else if (configCmdLine.at(i) == "-plugin-manifests") {
- dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-slog2") {
- dictionary[ "SLOG2" ] = "no";
- } else if (configCmdLine.at(i) == "-slog2") {
- dictionary[ "SLOG2" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-imf") {
- dictionary[ "QNX_IMF" ] = "no";
- } else if (configCmdLine.at(i) == "-imf") {
- dictionary[ "QNX_IMF" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-pps") {
- dictionary[ "PPS" ] = "no";
- } else if (configCmdLine.at(i) == "-pps") {
- dictionary[ "PPS" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-lgmon") {
- dictionary[ "LGMON" ] = "no";
- } else if (configCmdLine.at(i) == "-lgmon") {
- dictionary[ "LGMON" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-system-proxies") {
- dictionary[ "SYSTEM_PROXIES" ] = "no";
- } else if (configCmdLine.at(i) == "-system-proxies") {
- dictionary[ "SYSTEM_PROXIES" ] = "yes";
- } else if (configCmdLine.at(i) == "-warnings-are-errors" ||
- configCmdLine.at(i) == "-Werror") {
- dictionary[ "WERROR" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-warnings-are-errors") {
- dictionary[ "WERROR" ] = "no";
- } else if (configCmdLine.at(i) == "-no-headersclean") {
- dictionary[ "HEADERSCLEAN" ] = "no";
- } else if (configCmdLine.at(i) == "-headersclean") {
- dictionary[ "HEADERSCLEAN" ] = "yes";
- } else if (configCmdLine.at(i) == "-no-eventfd") {
- dictionary[ "QT_EVENTFD" ] = "no";
- } else if (configCmdLine.at(i) == "-eventfd") {
- dictionary[ "QT_EVENTFD" ] = "yes";
- }
-
- // Work around compiler nesting limitation
- else
- continueElse[0] = true;
- if (!continueElse[0]) {
- }
-
- else if (configCmdLine.at(i) == "-internal")
- dictionary[ "QMAKE_INTERNAL" ] = "yes";
-
else if (configCmdLine.at(i) == "-no-syncqt")
dictionary[ "SYNCQT" ] = "no";
- else if (configCmdLine.at(i) == "-no-qmake")
- dictionary[ "BUILD_QMAKE" ] = "no";
- else if (configCmdLine.at(i) == "-qmake")
- dictionary[ "BUILD_QMAKE" ] = "yes";
-
- else if (configCmdLine.at(i) == "-qtnamespace") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
- } else if (configCmdLine.at(i) == "-qtlibinfix") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
- } else if (configCmdLine.at(i) == "-D") {
- ++i;
- if (i == argCount)
- break;
- qmakeDefines += configCmdLine.at(i);
- } else if (configCmdLine.at(i) == "-I") {
- ++i;
- if (i == argCount)
- break;
- qmakeIncludes += configCmdLine.at(i);
- } else if (configCmdLine.at(i) == "-L") {
- ++i;
- if (i == argCount)
- break;
- QFileInfo checkDirectory(configCmdLine.at(i));
- if (!checkDirectory.isDir()) {
- cout << "Argument passed to -L option is not a directory path. Did you mean the -l option?" << endl;
- dictionary[ "DONE" ] = "error";
- break;
- }
- qmakeLibs += QString("-L" + configCmdLine.at(i));
- } else if (configCmdLine.at(i) == "-l") {
- ++i;
- if (i == argCount)
- break;
- qmakeLibs += QString("-l" + configCmdLine.at(i));
- } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
- opensslLibs = configCmdLine.at(i);
- } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS_DEBUG=")) {
- opensslLibsDebug = configCmdLine.at(i);
- } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS_RELEASE=")) {
- opensslLibsRelease = configCmdLine.at(i);
- } else if (configCmdLine.at(i).startsWith("OPENSSL_PATH=")) {
- opensslPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
- } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
- psqlLibs = configCmdLine.at(i);
- } else if (configCmdLine.at(i).startsWith("SYBASE=")) {
- sybase = configCmdLine.at(i);
- } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
- sybaseLibs = configCmdLine.at(i);
- } else if (configCmdLine.at(i).startsWith("DBUS_PATH=")) {
- dbusPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
- } else if (configCmdLine.at(i).startsWith("DBUS_HOST_PATH=")) {
- dbusHostPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
- } else if (configCmdLine.at(i).startsWith("MYSQL_PATH=")) {
- mysqlPath = QDir::fromNativeSeparators(configCmdLine.at(i).section("=", 1));
- } else if (configCmdLine.at(i).startsWith("ZLIB_LIBS=")) {
- zlibLibs = QDir::fromNativeSeparators(configCmdLine.at(i));
- }
-
- else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){
- ++i;
- if (i == argCount)
- break;
- dictionary[ "VERSION" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-saveconfig") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
- }
-
else if (configCmdLine.at(i) == "-confirm-license") {
dictionary["LICENSE_CONFIRMED"] = "yes";
}
- else if (configCmdLine.at(i) == "-make") {
- ++i;
- if (i == argCount)
- break;
- QString part = configCmdLine.at(i);
- if (!allBuildParts.contains(part)) {
- cout << "Unknown part " << part << " passed to -make." << endl;
- dictionary["DONE"] = "error";
- }
- buildParts += part;
- } else if (configCmdLine.at(i) == "-nomake") {
- ++i;
- if (i == argCount)
- break;
- QString part = configCmdLine.at(i);
- if (!allBuildParts.contains(part)) {
- cout << "Unknown part " << part << " passed to -nomake." << endl;
- dictionary["DONE"] = "error";
- }
- nobuildParts += part;
- }
-
- else if (configCmdLine.at(i) == "-skip") {
- ++i;
- if (i == argCount)
- break;
- QString mod = configCmdLine.at(i);
- if (!mod.startsWith(QLatin1String("qt")))
- mod.insert(0, QStringLiteral("qt"));
- if (!QFileInfo(sourcePath + "/../" + mod).isDir()) {
- cout << "Attempting to skip non-existent module " << mod << "." << endl;
- dictionary["DONE"] = "error";
- }
- skipModules += mod;
- }
-
// Directories ----------------------------------------------
else if (configCmdLine.at(i) == "-prefix") {
++i;
@@ -1185,9 +364,6 @@ void Configure::parseCmdLine()
break;
dictionary[ "CFG_SYSROOT" ] = configCmdLine.at(i);
}
- else if (configCmdLine.at(i) == "-no-gcc-sysroot") {
- dictionary[ "CFG_GCC_SYSROOT" ] = "no";
- }
else if (configCmdLine.at(i) == "-hostprefix") {
++i;
@@ -1232,95 +408,10 @@ void Configure::parseCmdLine()
dictionary[ "MAKE" ] = configCmdLine.at(i);
}
- else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) {
- // Scan to see if any specific modules and drivers are enabled or disabled
- for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) {
- if (configCmdLine.at(i) == QString("-enable-") + (*module)) {
- enabledModules += (*module);
- break;
- }
- else if (configCmdLine.at(i) == QString("-disable-") + (*module)) {
- disabledModules += (*module);
- break;
- }
- }
- }
-
- else if (configCmdLine.at(i) == "-directwrite") {
- dictionary["DIRECTWRITE"] = "yes";
- } else if (configCmdLine.at(i) == "-no-directwrite") {
- dictionary["DIRECTWRITE"] = "no";
- }
-
- else if (configCmdLine.at(i) == "-direct2d") {
- dictionary["DIRECT2D"] = "yes";
- } else if (configCmdLine.at(i) == "-no-direct2d") {
- dictionary["DIRECT2D"] = "no";
- }
-
- else if (configCmdLine.at(i) == "-nis") {
- dictionary["NIS"] = "yes";
- } else if (configCmdLine.at(i) == "-no-nis") {
- dictionary["NIS"] = "no";
- }
-
- else if (configCmdLine.at(i) == "-cups") {
- dictionary["QT_CUPS"] = "yes";
- } else if (configCmdLine.at(i) == "-no-cups") {
- dictionary["QT_CUPS"] = "no";
- }
-
- else if (configCmdLine.at(i) == "-iconv") {
- dictionary["QT_ICONV"] = "yes";
- } else if (configCmdLine.at(i) == "-no-iconv") {
- dictionary["QT_ICONV"] = "no";
- } else if (configCmdLine.at(i) == "-sun-iconv") {
- dictionary["QT_ICONV"] = "sun";
- } else if (configCmdLine.at(i) == "-gnu-iconv") {
- dictionary["QT_ICONV"] = "gnu";
- }
-
- else if (configCmdLine.at(i) == "-no-evdev") {
- dictionary[ "QT_EVDEV" ] = "no";
- } else if (configCmdLine.at(i) == "-evdev") {
- dictionary[ "QT_EVDEV" ] = "yes";
- }
-
- else if (configCmdLine.at(i) == "-no-mtdev") {
- dictionary[ "QT_MTDEV" ] = "no";
- } else if (configCmdLine.at(i) == "-mtdev") {
- dictionary[ "QT_MTDEV" ] = "yes";
- }
-
- else if (configCmdLine.at(i) == "-inotify") {
- dictionary["QT_INOTIFY"] = "yes";
- } else if (configCmdLine.at(i) == "-no-inotify") {
- dictionary["QT_INOTIFY"] = "no";
- }
-
- else if (configCmdLine.at(i) == "-largefile") {
- dictionary["LARGE_FILE"] = "yes";
- }
-
- else if (configCmdLine.at(i) == "-fontconfig") {
- dictionary["FONT_CONFIG"] = "yes";
- } else if (configCmdLine.at(i) == "-no-fontconfig") {
- dictionary["FONT_CONFIG"] = "no";
- }
-
- else if (configCmdLine.at(i) == "-posix-ipc") {
- dictionary["POSIX_IPC"] = "yes";
- }
-
- else if (configCmdLine.at(i) == "-glib") {
- dictionary["QT_GLIB"] = "yes";
- }
-
else if (configCmdLine.at(i) == "-sysconfdir") {
++i;
if (i == argCount)
break;
-
dictionary["QT_INSTALL_SETTINGS"] = configCmdLine.at(i);
}
@@ -1349,7 +440,6 @@ void Configure::parseCmdLine()
++i;
if (i == argCount)
break;
-
dictionary[ "ANDROID_HOST" ] = configCmdLine.at(i);
}
@@ -1372,12 +462,6 @@ void Configure::parseCmdLine()
} else if (configCmdLine.at(i) == "-android-style-assets") {
dictionary[ "ANDROID_STYLE_ASSETS" ] = "yes";
}
-
- else {
- dictionary[ "DONE" ] = "error";
- cout << "Unknown option " << configCmdLine.at(i) << endl;
- break;
- }
}
// Ensure that QMAKESPEC exists in the mkspecs folder
@@ -1448,173 +532,6 @@ void Configure::parseCmdLine()
cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
}
}
-
- // Allow tests for private classes to be compiled against internal builds
- if (dictionary["BUILDDEV"] == "yes") {
- qtConfig << "private_tests";
- if (dictionary["WERROR"] != "no")
- qmakeConfig << "warnings_are_errors";
- if (dictionary["HEADERSCLEAN"] != "no")
- qmakeConfig << "headersclean";
- } else {
- if (dictionary["WERROR"] == "yes")
- qmakeConfig << "warnings_are_errors";
- if (dictionary["HEADERSCLEAN"] == "yes")
- qmakeConfig << "headersclean";
- }
-
- if (dictionary["FORCE_ASSERTS"] == "yes")
- qtConfig += "force_asserts";
-
- for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) {
- modules.removeAll((*dis));
- }
- for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) {
- if (modules.indexOf((*ena)) == -1)
- modules += (*ena);
- }
- qtConfig += modules;
-
- for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
- qtConfig.removeAll(*it);
-
- if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes")
- && (dictionary[ "DONE" ] != "error"))
- saveCmdLine();
-}
-
-void Configure::validateArgs()
-{
- // Validate the specified config
- QString cfgpath = sourcePath + "/src/corelib/global/qconfig-" + dictionary["QCONFIG"] + ".h";
-
- // Try internal configurations first.
- QStringList possible_configs = QStringList()
- << "minimal"
- << "small"
- << "medium"
- << "large"
- << "full";
- int index = possible_configs.indexOf(dictionary["QCONFIG"]);
- if (index >= 0) {
- for (int c = 0; c <= index; c++) {
- qtConfig += possible_configs[c] + "-config";
- }
- if (dictionary["QCONFIG"] != "full")
- dictionary["QCONFIG_PATH"] = cfgpath;
- return;
- }
-
- if (!QFileInfo::exists(cfgpath)) {
- cfgpath = QFileInfo(dictionary["QCONFIG"]).absoluteFilePath();
- if (!QFileInfo::exists(cfgpath)) {
- dictionary[ "DONE" ] = "error";
- cout << "No such configuration \"" << qPrintable(dictionary["QCONFIG"]) << "\"" << endl ;
- return;
- }
- }
- dictionary["QCONFIG_PATH"] = cfgpath;
-}
-
-// Output helper functions --------------------------------[ Start ]-
-/*!
- Determines the length of a string token.
-*/
-static int tokenLength(const char *str)
-{
- if (*str == 0)
- return 0;
-
- const char *nextToken = strpbrk(str, " _/\n\r");
- if (nextToken == str || !nextToken)
- return 1;
-
- return int(nextToken - str);
-}
-
-/*!
- Prints out a string which starts at position \a startingAt, and
- indents each wrapped line with \a wrapIndent characters.
- The wrap point is set to the console width, unless that width
- cannot be determined, or is too small.
-*/
-void Configure::desc(const char *description, int startingAt, int wrapIndent)
-{
- int linePos = startingAt;
-
- bool firstLine = true;
- const char *nextToken = description;
- while (*nextToken) {
- int nextTokenLen = tokenLength(nextToken);
- if (*nextToken == '\n' // Wrap on newline, duh
- || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth
- {
- printf("\n");
- linePos = 0;
- firstLine = false;
- if (*nextToken == '\n')
- ++nextToken;
- continue;
- }
- if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
- printf("%*s", wrapIndent , "");
- linePos = wrapIndent;
- if (*nextToken == ' ') {
- ++nextToken;
- continue;
- }
- }
- printf("%.*s", nextTokenLen, nextToken);
- linePos += nextTokenLen;
- nextToken += nextTokenLen;
- }
-}
-
-/*!
- Prints out an option with its description wrapped at the
- description starting point. If \a skipIndent is true, the
- indentation to the option is not outputted (used by marked option
- version of desc()). Extra spaces between option and its
- description is filled with\a fillChar, if there's available
- space.
-*/
-void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
-{
- if (!skipIndent)
- printf("%*s", optionIndent, "");
-
- int remaining = descIndent - optionIndent - int(strlen(option));
- int wrapIndent = descIndent + qMax(0, 1 - remaining);
- printf("%s", option);
-
- if (remaining > 2) {
- printf(" "); // Space in front
- for (int i = remaining; i > 2; --i)
- printf("%c", fillChar); // Fill, if available space
- }
- printf(" "); // Space between option and description
-
- desc(description, wrapIndent, wrapIndent);
- printf("\n");
-}
-
-/*!
- Same as above, except it also marks an option with an '*', if
- the option is default action.
-*/
-void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
-{
- const QString markedAs = dictionary.value(mark_option);
- if (markedAs == "auto" && markedAs == mark) // both "auto", always => +
- printf(" + ");
- else if (markedAs == "auto") // setting marked as "auto" and option is default => +
- printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' ');
- else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => +
- printf(" %c " , checkAvailability(mark_option) ? '+' : ' ');
- else // None are "auto", (markedAs == mark) => *
- printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' ');
-
- desc(option, description, true, fillChar);
}
/*!
@@ -1623,1061 +540,8 @@ void Configure::desc(const char *mark_option, const char *mark, const char *opti
*/
void Configure::applySpecSpecifics()
{
- if (dictionary.contains("XQMAKESPEC")) {
- //Disable building tools when cross compiling.
- nobuildParts << "tools";
- }
-
- if (dictionary.value("XQMAKESPEC").startsWith("winphone") || dictionary.value("XQMAKESPEC").startsWith("winrt")) {
- dictionary[ "STYLE_WINDOWSXP" ] = "no";
- dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
- dictionary[ "GIF" ] = "qt";
- dictionary[ "JPEG" ] = "qt";
- dictionary[ "LIBJPEG" ] = "qt";
- dictionary[ "LIBPNG" ] = "qt";
- dictionary[ "FREETYPE" ] = "yes";
- dictionary[ "OPENGL" ] = "yes";
- dictionary[ "OPENGL_ES_2" ] = "yes";
- dictionary[ "OPENVG" ] = "no";
- dictionary[ "SSL" ] = "yes";
- dictionary[ "OPENSSL" ] = "no";
- dictionary[ "DBUS" ] = "no";
- dictionary[ "ZLIB" ] = "qt";
- dictionary[ "PCRE" ] = "qt";
- dictionary[ "ICU" ] = "qt";
- dictionary[ "LARGE_FILE" ] = "no";
- dictionary[ "ANGLE" ] = "yes";
- dictionary[ "DYNAMICGL" ] = "no";
- } else if (dictionary.value("XQMAKESPEC").startsWith("linux")) { //TODO actually wrong.
- //TODO
- dictionary[ "STYLE_WINDOWSXP" ] = "no";
- dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
- dictionary[ "KBD_DRIVERS" ] = "tty";
- dictionary[ "GFX_DRIVERS" ] = "linuxfb";
- dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
- dictionary[ "OPENGL" ] = "no";
- dictionary[ "DBUS"] = "no";
- dictionary[ "QT_INOTIFY" ] = "no";
- dictionary[ "QT_CUPS" ] = "no";
- dictionary[ "QT_GLIB" ] = "no";
- dictionary[ "QT_ICONV" ] = "no";
- dictionary[ "QT_EVDEV" ] = "no";
- dictionary[ "QT_MTDEV" ] = "no";
- dictionary[ "FONT_CONFIG" ] = "auto";
- dictionary[ "ANGLE" ] = "no";
-
- dictionary["DECORATIONS"] = "default windows styled";
- } else if (platform() == QNX) {
- dictionary[ "REDUCE_EXPORTS" ] = "yes";
- dictionary["STACK_PROTECTOR_STRONG"] = "auto";
- dictionary["SLOG2"] = "auto";
- dictionary["QNX_IMF"] = "auto";
- dictionary["PPS"] = "auto";
- dictionary["LGMON"] = "auto";
- dictionary["QT_XKBCOMMON"] = "no";
- dictionary[ "ANGLE" ] = "no";
- dictionary[ "DYNAMICGL" ] = "no";
- dictionary[ "FONT_CONFIG" ] = "auto";
- dictionary[ "ICU" ] = "auto";
- dictionary[ "POLL" ] = "poll";
- dictionary[ "ZLIB" ] = "system";
- } else if (platform() == ANDROID) {
- dictionary[ "REDUCE_EXPORTS" ] = "yes";
- dictionary[ "BUILD" ] = "release";
- dictionary[ "BUILDALL" ] = "no";
- dictionary[ "LARGE_FILE" ] = "no";
- dictionary[ "ANGLE" ] = "no";
- dictionary[ "DYNAMICGL" ] = "no";
- dictionary[ "REDUCE_RELOCATIONS" ] = "yes";
- dictionary[ "QT_GETIFADDRS" ] = "no";
- dictionary[ "QT_XKBCOMMON" ] = "no";
+ if (platform() == ANDROID)
dictionary["ANDROID_STYLE_ASSETS"] = "yes";
- dictionary[ "STYLE_ANDROID" ] = "yes";
- dictionary[ "POLL" ] = "poll";
- dictionary[ "ZLIB" ] = "system";
- }
-}
-
-// Output helper functions ---------------------------------[ Stop ]-
-
-
-bool Configure::displayHelp()
-{
- if (dictionary[ "HELP" ] == "yes") {
- desc("Usage: configure [options]\n\n", 0, 7);
-
- desc("Installation options:\n\n");
-
- desc("These are optional, but you may specify install directories.\n\n", 0, 1);
-
- desc( "-prefix <dir>", "The deployment directory, as seen on the target device.\n"
- "(default %CD%)\n");
-
- desc( "-extprefix <dir>", "The installation directory, as seen on the host machine.\n"
- "(default SYSROOT/PREFIX)\n");
-
- desc( "-hostprefix [dir]", "The installation directory for build tools running on the\n"
- "host machine. If [dir] is not given, the current build\n"
- "directory will be used. (default EXTPREFIX)\n");
-
- desc("You may use these to change the layout of the install. Note that all directories\n"
- "except -sysconfdir should be located under -prefix/-hostprefix:\n\n");
-
- desc( "-bindir <dir>", "User executables will be installed to <dir>\n(default PREFIX/bin)");
- desc( "-libdir <dir>", "Libraries will be installed to <dir>\n(default PREFIX/lib)");
- desc( "-headerdir <dir>", "Headers will be installed to <dir>\n(default PREFIX/include)");
- desc( "-archdatadir <dir>", "Architecture-dependent data used by Qt will be installed to <dir>\n(default PREFIX)");
- desc( "-libexecdir <dir>", "Program executables will be installed to <dir>\n(default ARCHDATADIR/bin)");
- desc( "-plugindir <dir>", "Plugins will be installed to <dir>\n(default ARCHDATADIR/plugins)");
- desc( "-importdir <dir>", "Imports for QML1 will be installed to <dir>\n(default ARCHDATADIR/imports)");
- desc( "-qmldir <dir>", "Imports for QML2 will be installed to <dir>\n(default ARCHDATADIR/qml)");
- desc( "-datadir <dir>", "Data used by Qt programs will be installed to <dir>\n(default PREFIX)");
- desc( "-docdir <dir>", "Documentation will be installed to <dir>\n(default DATADIR/doc)");
- desc( "-translationdir <dir>", "Translations of Qt programs will be installed to <dir>\n(default DATADIR/translations)");
- desc( "-examplesdir <dir>", "Examples will be installed to <dir>\n(default PREFIX/examples)");
- desc( "-testsdir <dir>", "Tests will be installed to <dir>\n(default PREFIX/tests)\n");
-
- desc( "-hostbindir <dir>", "Host executables will be installed to <dir>\n(default HOSTPREFIX/bin)");
- desc( "-hostlibdir <dir>", "Host libraries will be installed to <dir>\n(default HOSTPREFIX/lib)");
- desc( "-hostdatadir <dir>", "Data used by qmake will be installed to <dir>\n(default HOSTPREFIX)");
-
- desc("\nConfigure options:\n\n");
-
- desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value"
- " that needs to be evaluated. If the evaluation succeeds, the feature is"
- " included. Here is a short explanation of each option:\n\n", 0, 1);
-
- desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off.");
- desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on.");
- desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n");
-
- desc("FORCEDEBUGINFO", "yes","-force-debug-info", "Create symbol files for release builds.");
- desc("SEPARATE_DEBUG_INFO", "yes","-separate-debug-info", "Strip debug information into a separate file.\n");
-
- desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
-
- desc("RELEASE_TOOLS", "yes", "-optimized-tools", "Build optimized host tools even in debug build.");
- desc("RELEASE_TOOLS", "no", "-no-optimized-tools", "Do not build optimized host tools even in debug build.\n");
-
- desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt.");
- desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n");
-
- desc( "-c++std <edition>", "Compile Qt with C++ standard edition (c++11, c++14, c++1z)\n"
- "Default: highest supported. This option is not supported for MSVC.\n");
-
- desc("USE_GOLD_LINKER", "yes", "-use-gold-linker", "Link using the GNU gold linker (gcc only).");
- desc("USE_GOLD_LINKER", "no", "-no-use-gold-linker", "Do not link using the GNU gold linker.\n");
-
- desc("ENABLE_NEW_DTAGS", "yes", "-enable-new-dtags", "Use new DTAGS for RPATH (Linux only).");
- desc("ENABLE_NEW_DTAGS", "no", "-disable-new-dtags", "Do not use new DTAGS for RPATH.\n");
-
- desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
- desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
-
- desc("STATIC_RUNTIME", "no", "-static-runtime","Statically link the C/C++ runtime library.\n");
-
- desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
- desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
-
- desc( "-make <part>", "Add part to the list of parts to be built at make time");
- for (int i=0; i<defaultBuildParts.size(); ++i)
- desc( "", qPrintable(QString(" %1").arg(defaultBuildParts.at(i))), false, ' ');
- desc( "-nomake <part>", "Exclude part from the list of parts to be built.\n");
-
- desc( "-skip <module>", "Exclude an entire module from the build.\n");
-
- desc( "-no-compile-examples", "Install only the sources of examples.\n");
-
- desc("WIDGETS", "no", "-no-widgets", "Disable Qt Widgets module.\n");
- desc("GUI", "no", "-no-gui", "Disable Qt GUI module.\n");
-
- desc("ACCESSIBILITY", "no", "-no-accessibility", "Disable accessibility support.\n");
- desc( "", "Disabling accessibility is not recommended, as it will break QStyle\n"
- "and may break other internal parts of Qt.\n"
- "With this switch you create a source incompatible version of Qt,\n"
- "which is unsupported.\n");
- desc("ACCESSIBILITY", "yes", "-accessibility", "Enable accessibility support.\n");
-
- desc( "-no-sql-<driver>", "Disable SQL <driver> entirely, by default none are turned on.");
- desc( "-qt-sql-<driver>", "Enable a SQL <driver> in the Qt Library.");
- desc( "-plugin-sql-<driver>", "Enable SQL <driver> as a plugin to be linked to at run time.\n"
- "Available values for <driver>:");
- desc("SQL_MYSQL", "auto", "", " mysql", ' ');
- desc("SQL_PSQL", "auto", "", " psql", ' ');
- desc("SQL_OCI", "auto", "", " oci", ' ');
- desc("SQL_ODBC", "auto", "", " odbc", ' ');
- desc("SQL_TDS", "auto", "", " tds", ' ');
- desc("SQL_DB2", "auto", "", " db2", ' ');
- desc("SQL_SQLITE", "auto", "", " sqlite", ' ');
- desc("SQL_SQLITE2", "auto", "", " sqlite2", ' ');
- desc("SQL_IBASE", "auto", "", " ibase", ' ');
- desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' ');
-
- desc( "-system-sqlite", "Use sqlite from the operating system.\n");
-
- desc("OPENGL", "no","-no-opengl", "Do not support OpenGL.");
- desc("OPENGL", "no","-opengl <api>", "Enable OpenGL support with specified API version.\n"
- "Available values for <api>:");
- desc("", "no", "", " desktop - Enable support for Desktop OpenGL", ' ');
- desc("", "no", "", " dynamic - Enable support for dynamically loaded OpenGL (either desktop or ES)", ' ');
- desc("OPENGL_ES_2", "yes", "", " es2 - Enable support for OpenGL ES 2.0\n", ' ');
-
- desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality.");
- desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality.\n");
- desc( "-force-asserts", "Activate asserts in release mode.\n");
- desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
- desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
- desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
-
- desc( "-sysroot <dir>", "Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.");
- desc( "-no-gcc-sysroot", "When using -sysroot, it disables the passing of --sysroot to the compiler.\n");
-
- desc( "-qconfig <local>", "Use src/corelib/global/qconfig-<local>.h rather than the\n"
- "default 'full'.\n");
-
- desc("NIS", "no", "-no-nis", "Do not compile NIS support.");
- desc("NIS", "yes", "-nis", "Compile NIS support.\n");
-
- desc("QT_ICONV", "disable", "-no-iconv", "Do not enable support for iconv(3).");
- desc("QT_ICONV", "yes", "-iconv", "Enable support for iconv(3).");
- desc("QT_ICONV", "yes", "-sun-iconv", "Enable support for iconv(3) using sun-iconv.");
- desc("QT_ICONV", "yes", "-gnu-iconv", "Enable support for iconv(3) using gnu-libiconv.\n");
-
- desc("QT_EVDEV", "no", "-no-evdev", "Do not enable support for evdev.");
- desc("QT_EVDEV", "yes", "-evdev", "Enable support for evdev.");
-
- desc("QT_MTDEV", "no", "-no-mtdev", "Do not enable support for mtdev.");
- desc("QT_MTDEV", "yes", "-mtdev", "Enable support for mtdev.");
-
- desc("QT_INOTIFY", "yes", "-inotify", "Explicitly enable Qt inotify(7) support.");
- desc("QT_INOTIFY", "no", "-no-inotify", "Explicitly disable Qt inotify(7) support.\n");
-
- desc("QT_EVENTFD", "yes", "-eventfd", "Enable eventfd(7) support in the UNIX event loop.");
- desc("QT_EVENTFD", "no", "-no-eventfd", "Disable eventfd(7) support in the UNIX event loop.\n");
-
- desc("LARGE_FILE", "yes", "-largefile", "Enables Qt to access files larger than 4 GB.\n");
-
- desc("POSIX_IPC", "yes", "-posix-ipc", "Enable POSIX IPC.\n");
-
- desc("QT_GLIB", "yes", "-glib", "Compile Glib support.\n");
-
- desc("QT_INSTALL_SETTINGS", "auto", "-sysconfdir <dir>", "Settings used by Qt programs will be looked for in\n<dir>.\n");
-
- desc("SYSTEM_PROXIES", "yes", "-system-proxies", "Use system network proxies by default.");
- desc("SYSTEM_PROXIES", "no", "-no-system-proxies", "Do not use system network proxies by default.\n");
-
- desc("WERROR", "yes", "-warnings-are-errors", "Make warnings be treated as errors.");
- desc("WERROR", "no", "-no-warnings-are-errors","Make warnings be treated normally.");
-
- desc( "-qtnamespace <name>", "Wraps all Qt library code in 'namespace name {...}'.");
- desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>.\n");
- desc( "-D <define>", "Add an explicit define to the preprocessor.");
- desc( "-I <includepath>", "Add an explicit include path.");
- desc( "-L <librarypath>", "Add an explicit library path.");
- desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
-
- desc("PCH", "no", "-no-pch", "Do not use precompiled header support.");
- desc("PCH", "yes", "-pch", "Use precopmiled header support.\n");
-
- desc( "-help, -h, -?", "Display this information.\n");
-
- // 3rd party stuff options go below here --------------------------------------------------------------------------------
- desc("Third Party Libraries:\n\n");
-
- desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
- desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
-
- desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt.");
- desc("PCRE", "system", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n");
-
- desc("ICU", "yes", "-icu", "Use the ICU library.");
- desc("ICU", "no", "-no-icu", "Do not use the ICU library.\nSee http://site.icu-project.org/\n");
-
- desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.\n");
-
- desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
- desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
- desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
-
- desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support.");
- desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
- desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
-
- desc("DOUBLECONVERSION", "no", "-no-doubleconversion", "Use sscanf_l and snprintf_l for (imprecise) double conversion.");
- desc("DOUBLECONVERSION", "qt", "-qt-doubleconversion", "Use the libdouble-conversion bundled with Qt.");
- desc("DOUBLECONVERSION", "system", "-system-doubleconversion", "Use the libdouble-conversion provided by the system.");
-
- desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support.");
- desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
- desc("FREETYPE", "system","-system-freetype", "Use the libfreetype provided by the system.\n");
-
- desc("FONT_CONFIG", "yes", "-fontconfig", "Build with FontConfig support.");
- desc("FONT_CONFIG", "no", "-no-fontconfig", "Do not build with FontConfig support.\n");
-
- desc("HARFBUZZ", "no", "-no-harfbuzz", "Do not compile in HarfBuzz-NG support.");
- desc("HARFBUZZ", "qt", "-qt-harfbuzz", "Use HarfBuzz-NG bundled with Qt to do text shaping.\n"
- "It can still be disabled by setting\n"
- "the QT_HARFBUZZ environment variable to \"old\".");
- desc("HARFBUZZ", "system","-system-harfbuzz", "Use HarfBuzz-NG from the operating system\n"
- "to do text shaping. It can still be disabled\n"
- "by setting the QT_HARFBUZZ environment variable to \"old\".\n"
- "See http://www.harfbuzz.org\n");
-
- if (platform() == QNX) {
- desc("SLOG2", "yes", "-slog2", "Compile with slog2 support.");
- desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support.");
- desc("QNX_IMF", "yes", "-imf", "Compile with imf support.");
- desc("QNX_IMF", "no", "-no-imf", "Do not compile with imf support.");
- desc("PPS", "yes", "-pps", "Compile with PPS support.");
- desc("PPS", "no", "-no-pps", "Do not compile with PPS support.");
- desc("LGMON", "yes", "-lgmon", "Compile with lgmon support.");
- desc("LGMON", "no", "-no-lgmon", "Do not compile with lgmon support.\n");
- }
-
- desc("ANGLE", "yes", "-angle", "Use the ANGLE implementation of OpenGL ES 2.0.");
- desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee https://chromium.googlesource.com/angle/angle/+/master/README.md\n");
- // Qt\Windows only options go below here --------------------------------------------------------------------------------
- desc("\nQt for Windows only:\n\n");
-
- desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps.");
- desc("INCREDIBUILD_XGE", "yes", "-incredibuild-xge", "Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.\n(The IncrediBuild distribution commands are only added to Visual Studio projects)\n");
-
- desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins.");
- desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n");
- desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
- desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
-
- desc( "-qreal [double|float]", "typedef qreal to the specified type. The default is double.\n"
- "Note that changing this flag affects binary compatibility.\n");
-
- desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
- desc("RTTI", "yes", "-rtti", "Compile runtime type information.");
- desc("STRIP", "no", "-no-strip", "Do not strip libraries and executables of debug info when installing.");
- desc("STRIP", "yes", "-strip", "Strip libraries and executables of debug info when installing.\n");
-
- desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions.");
- desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions.");
- desc("SSE3", "no", "-no-sse3", "Do not compile with use of SSE3 instructions.");
- desc("SSE3", "yes", "-sse3", "Compile with use of SSE3 instructions.");
- desc("SSSE3", "no", "-no-ssse3", "Do not compile with use of SSSE3 instructions.");
- desc("SSSE3", "yes", "-ssse3", "Compile with use of SSSE3 instructions.");
- desc("SSE4_1", "no", "-no-sse4.1", "Do not compile with use of SSE4.1 instructions.");
- desc("SSE4_1", "yes", "-sse4.1", "Compile with use of SSE4.1 instructions.");
- desc("SSE4_2", "no", "-no-sse4.2", "Do not compile with use of SSE4.2 instructions.");
- desc("SSE4_2", "yes", "-sse4.2", "Compile with use of SSE4.2 instructions.");
- desc("AVX", "no", "-no-avx", "Do not compile with use of AVX instructions.");
- desc("AVX", "yes", "-avx", "Compile with use of AVX instructions.");
- desc("AVX2", "no", "-no-avx2", "Do not compile with use of AVX2 instructions.");
- desc("AVX2", "yes", "-avx2", "Compile with use of AVX2 instructions.\n");
- desc("AVX512", "no", "-no-avx512", "Do not compile with use of AVX512 instructions.");
- desc("AVX512", "yes", "-avx512", "Compile with use of AVX512 instructions.\n");
- desc("SSL", "no", "-no-ssl", "Do not compile support for SSL.");
- desc("SSL", "yes", "-ssl", "Enable run-time SSL support.");
- desc("OPENSSL", "no", "-no-openssl", "Do not compile support for OpenSSL.");
- desc("OPENSSL", "yes", "-openssl", "Enable run-time OpenSSL support.");
- desc("OPENSSL", "linked","-openssl-linked", "Enable linked OpenSSL support.\n");
- desc("LIBPROXY", "no", "-no-libproxy", "Do not compile in libproxy support.");
- desc("LIBPROXY", "yes", "-libproxy", "Compile in libproxy support (for cross compilation targets).\n");
- desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support.");
- desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1.\n");
- desc("DBUS", "runtime", "-dbus-runtime", "Compile in D-Bus support and load libdbus-1\ndynamically.");
- desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into\nQt Multimedia.");
- desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into Qt Multimedia.\n");
- desc("WMF_BACKEND", "no","-no-wmf-backend", "Do not compile in the windows media foundation backend\ninto Qt Multimedia.");
- desc("WMF_BACKEND", "yes","-wmf-backend", "Compile in the windows media foundation backend into Qt Multimedia.\n");
- desc("QML_DEBUG", "no", "-no-qml-debug", "Do not build the in-process QML debugging support.");
- desc("QML_DEBUG", "yes", "-qml-debug", "Build the in-process QML debugging support.\n");
- desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering.");
- desc("DIRECTWRITE", "yes", "-directwrite", "Build support for DirectWrite font rendering.\n");
-
- desc("DIRECT2D", "no", "-no-direct2d", "Do not build the Direct2D platform plugin.");
- desc("DIRECT2D", "yes", "-direct2d", "Build the Direct2D platform plugin (experimental,\n"
- "requires Direct2D availability on target systems,\n"
- "e.g. Windows 7 with Platform Update, Windows 8, etc.)\n");
-
- desc( "-no-style-<style>", "Disable <style> entirely.");
- desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
-
- desc("STYLE_WINDOWS", "yes", "", " windows", ' ');
- desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' ');
- desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' ');
- desc("STYLE_FUSION", "yes", "", " fusion", ' ');
- desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7.");
- desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.\n");
- desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC");
- desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP).\n");
-
- desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
- desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
- desc( "-redo", "Run configure with the same parameters as last time.\n");
- desc( "-v, -verbose", "Run configure tests with verbose output.\n");
- return true;
- }
- return false;
-}
-
-// Locate a file and return its containing directory.
-QString Configure::locateFile(const QString &fileName) const
-{
- const QString mkspec = dictionary.contains(QStringLiteral("XQMAKESPEC"))
- ? dictionary[QStringLiteral("XQMAKESPEC")] : dictionary[QStringLiteral("QMAKESPEC")];
- const QString file = fileName.toLower();
- QStringList pathList;
- if (file.endsWith(".h")) {
- static const QStringList headerPaths =
- Environment::headerPaths(Environment::compilerFromQMakeSpec(mkspec));
- pathList = qmakeIncludes;
- pathList += headerPaths;
- } else if (file.endsWith(".lib") || file.endsWith(".a")) {
- static const QStringList libPaths =
- Environment::libraryPaths(Environment::compilerFromQMakeSpec(mkspec));
- pathList = libPaths;
- } else {
- // Fallback for .exe and .dll (latter are not covered by QStandardPaths).
- static const QStringList exePaths = Environment::path();
- pathList = exePaths;
- }
- return Environment::findFileInPaths(file, pathList);
-}
-
-/*!
- Default value for options marked as "auto" if the test passes.
- (Used both by the autoDetection() below, and the desc() function
- to mark (+) the default option of autodetecting options.
-*/
-QString Configure::defaultTo(const QString &option)
-{
- // We prefer using the system version of the 3rd party libs
- if (option == "ZLIB"
- || option == "PCRE"
- || option == "LIBJPEG"
- || option == "LIBPNG")
- return "system";
-
- // PNG is always built-in, never a plugin
- if (option == "PNG")
- return "yes";
-
- // These database drivers and image formats can be built-in or plugins.
- // Prefer plugins when Qt is shared.
- if (dictionary[ "SHARED" ] == "yes") {
- if (option == "SQL_MYSQL"
- || option == "SQL_MYSQL"
- || option == "SQL_ODBC"
- || option == "SQL_OCI"
- || option == "SQL_PSQL"
- || option == "SQL_TDS"
- || option == "SQL_DB2"
- || option == "SQL_SQLITE"
- || option == "SQL_SQLITE2"
- || option == "SQL_IBASE"
- || option == "JPEG"
- || option == "GIF")
- return "plugin";
- }
-
- // By default we do not want to compile OCI driver when compiling with
- // MinGW, due to lack of such support from Oracle. It prob. won't work.
- // (Customer may force the use though)
- if (dictionary["QMAKESPEC"].endsWith("-g++")
- && option == "SQL_OCI")
- return "no";
-
- // keep 'auto' default for msvc, since we can't set the language supported
- if (option == "C++STD"
- && dictionary["QMAKESPEC"].contains("msvc"))
- return "auto";
-
- if (option == "SYNCQT"
- && (!QFile::exists(sourcePath + "/.git")))
- return "no";
-
- return "yes";
-}
-
-bool Configure::checkAngleAvailability(QString *errorMessage /* = 0 */) const
-{
- // Check for Direct X SDK (include lib and direct shader compiler 'fxc').
- // Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
- // DXSDK_DIR variable. Starting with Windows Kit 8, it is included
- // in the Windows SDK. Checking for the header is not sufficient since
- // it is also present in MinGW.
- const QString directXSdk = Environment::detectDirectXSdk();
- const Compiler compiler = Environment::compilerFromQMakeSpec(dictionary[QStringLiteral("QMAKESPEC")]);
- if (compiler < CC_MSVC2012 && directXSdk.isEmpty()) {
- if (errorMessage)
- *errorMessage = QStringLiteral("There is no Direct X SDK installed or the environment variable \"DXSDK_DIR\" is not set.");
- return false;
- }
- const QString compilerHeader = QStringLiteral("d3dcompiler.h");
- if (!findFile(compilerHeader)) {
- if (errorMessage)
- *errorMessage = QString::fromLatin1("The header '%1' could not be found.").arg(compilerHeader);
- return false;
- }
- if (dictionary["SSE2"] != "no") {
- const QString intrinHeader = QStringLiteral("intrin.h"); // Not present on MinGW-32
- if (!findFile(intrinHeader)) {
- if (errorMessage)
- *errorMessage = QString::fromLatin1("The header '%1' required for SSE2 could not be found.").arg(intrinHeader);
- return false;
- }
- }
-
- const QString directXLibrary = QStringLiteral("d3d11.lib"); // Ensures at least the June 2010 DXSDK is present
- if (!findFile(directXLibrary)) {
- if (errorMessage)
- *errorMessage = QString::fromLatin1("The library '%1' could not be found.").arg(directXLibrary);
- return false;
- }
- const QString fxcBinary = QStringLiteral("fxc.exe");
- QStringList additionalPaths;
- if (!directXSdk.isEmpty())
- additionalPaths.push_back(directXSdk + QStringLiteral("/Utilities/bin/x86"));
- QString fxcPath = QStandardPaths::findExecutable(fxcBinary, additionalPaths);
- if (fxcPath.isEmpty()) {
- if (errorMessage)
- *errorMessage = QString::fromLatin1("The shader compiler '%1' could not be found.").arg(fxcBinary);
- return false;
- }
- return true;
-}
-
-QString Configure::checkAvx512Availability()
-{
- static const char avx512features[][5] = { "cd", "er", "pf", "bw", "dq", "vl", "ifma", "vbmi" };
-
- // try AVX512 Foundation. No Foundation, nothing else works.
- if (!tryCompileProject("common/avx512", "AVX512=F"))
- return QString();
-
- QString available = "avx512f";
- for (size_t i = 0; i < sizeof(avx512features)/sizeof(avx512features[0]); ++i) {
- if (tryCompileProject("common/avx512", QStringLiteral("AVX512=%0").arg(avx512features[i]).toUpper())) {
- available += " avx512";
- available += avx512features[i];
- }
- }
- return available;
-}
-
-/*!
- Checks the system for the availability of a feature.
- Returns true if the feature is available, else false.
-*/
-
-bool Configure::checkAvailability(const QString &part)
-{
- bool available = false;
- if (part == "STYLE_WINDOWSXP")
- available = (platform() == WINDOWS) && findFile("uxtheme.h");
-
- else if (part == "OBJCOPY")
- available = tryCompileProject("unix/objcopy");
-
- else if (part == "ATOMIC64")
- available = tryCompileProject("common/atomic64");
-
- else if (part == "ATOMIC64-LIBATOMIC")
- available = tryCompileProject("common/atomic64", "LIBS+=-latomic");
-
- else if (part == "ATOMICFPTR")
- available = tryCompileProject("common/atomicfptr");
-
- else if (part == "ZLIB")
- available = findFile("zlib.h");
-
- else if (part == "PCRE")
- available = findFile("pcre.h");
-
- else if (part == "ICU")
- available = tryCompileProject("unix/icu");
-
- else if (part == "ANGLE") {
- available = checkAngleAvailability();
- }
-
- else if (part == "HARFBUZZ")
- available = tryCompileProject("unix/harfbuzz");
-
- else if (part == "LIBJPEG")
- available = findFile("jpeglib.h");
- else if (part == "LIBPNG")
- available = findFile("png.h");
- else if (part == "SQL_MYSQL")
- available = findFile("mysql.h") && findFile("libmySQL.lib");
- else if (part == "SQL_ODBC")
- available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
- else if (part == "SQL_OCI")
- available = findFile("oci.h") && findFile("oci.lib");
- else if (part == "SQL_PSQL")
- available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
- else if (part == "SQL_TDS")
- available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
- else if (part == "SQL_DB2")
- available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
- else if (part == "SQL_SQLITE")
- available = true; // Built in, we have a fork
- else if (part == "SQL_SQLITE_LIB") {
- if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
- if (platform() == QNX) {
- available = true;
- dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3 -lz";
- } else {
- available = findFile("sqlite3.h") && findFile("sqlite3.lib");
- if (available)
- dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
- }
- } else {
- available = true;
- }
- } else if (part == "SQL_SQLITE2")
- available = findFile("sqlite.h") && findFile("sqlite.lib");
- else if (part == "SQL_IBASE")
- available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
- else if (part == "SSE2")
- available = tryCompileProject("common/sse2");
- else if (part == "SSE3")
- available = tryCompileProject("common/sse3");
- else if (part == "SSSE3")
- available = tryCompileProject("common/ssse3");
- else if (part == "SSE4_1")
- available = tryCompileProject("common/sse4_1");
- else if (part == "SSE4_2")
- available = tryCompileProject("common/sse4_2");
- else if (part == "AVX")
- available = tryCompileProject("common/avx");
- else if (part == "AVX2")
- available = tryCompileProject("common/avx2");
- else if (part == "OPENSSL")
- available = findFile("openssl\\ssl.h");
- else if (part == "LIBPROXY")
- available = dictionary.contains("XQMAKESPEC") && tryCompileProject("common/libproxy");
- else if (part == "DBUS")
- available = findFile("dbus\\dbus.h");
- else if (part == "INCREDIBUILD_XGE") {
- available = !QStandardPaths::findExecutable(QStringLiteral("BuildConsole.exe")).isEmpty()
- && !QStandardPaths::findExecutable(QStringLiteral("xgConsole.exe")).isEmpty();
- } else if (part == "WMSDK") {
- available = findFile("wmsdk.h");
- } else if (part == "AUDIO_BACKEND") {
- available = true;
- } else if (part == "WMF_BACKEND") {
- available = findFile("mfapi.h") && findFile("mf.lib");
- } else if (part == "DIRECTWRITE") {
- available = tryCompileProject("win/directwrite");
- } else if (part == "DIRECTWRITE2") {
- available = tryCompileProject("win/directwrite2");
- } else if (part == "DIRECT2D") {
- available = tryCompileProject("qpa/direct2d");
- } else if (part == "ICONV") {
- available = tryCompileProject("unix/iconv") || tryCompileProject("unix/gnu-libiconv");
- } else if (part == "EVDEV") {
- available = tryCompileProject("unix/evdev");
- } else if (part == "MTDEV") {
- available = tryCompileProject("unix/mtdev");
- } else if (part == "TSLIB") {
- available = tryCompileProject("unix/tslib");
- } else if (part == "INOTIFY") {
- available = tryCompileProject("unix/inotify");
- } else if (part == "QT_EVENTFD") {
- available = tryCompileProject("unix/eventfd");
- } else if (part == "CUPS") {
- available = (platform() != WINDOWS) && (platform() != WINDOWS_RT) && tryCompileProject("unix/cups");
- } else if (part == "STACK_PROTECTOR_STRONG") {
- available = (platform() == QNX) && compilerSupportsFlag("qcc -fstack-protector-strong");
- } else if (part == "SLOG2") {
- available = tryCompileProject("unix/slog2");
- } else if (part == "QNX_IMF") {
- available = tryCompileProject("unix/qqnx_imf");
- } else if (part == "PPS") {
- available = (platform() == QNX) && tryCompileProject("unix/pps");
- } else if (part == "LGMON") {
- available = (platform() == QNX) && tryCompileProject("unix/lgmon");
- } else if (part == "NEON") {
- available = dictionary["QT_CPU_FEATURES"].contains("neon");
- } else if (part == "FONT_CONFIG") {
- available = tryCompileProject("unix/fontconfig");
- } else if (part == "DOUBLECONVERSION") {
- available = tryCompileProject("unix/doubleconversion");
- }
-
- return available;
-}
-
-/*
- Autodetect options marked as "auto".
-*/
-void Configure::autoDetection()
-{
- cout << "Running configuration tests..." << endl;
-
- // Auto-detect CPU architectures.
- detectArch();
-
- if (dictionary["C++STD"] == "auto" && !dictionary["QMAKESPEC"].contains("msvc")) {
- if (!tryCompileProject("common/c++14")) {
- dictionary["C++STD"] = "c++11";
- } else if (!tryCompileProject("common/c++1z")) {
- dictionary["C++STD"] = "c++14";
- } else {
- dictionary["C++STD"] = "c++1z";
- }
- }
-
- if (!dictionary["QMAKESPEC"].contains("msvc")) {
- if (tryCompileProject("common/c++default", QString(), false)) {
- QFile iiFile(buildPath + "/config.tests/common/c++default/c++default.ii");
- if (iiFile.open(QIODevice::ReadOnly)) {
- QString content = QString::fromUtf8(iiFile.readAll());
- QRegExp expr("\\b([0-9]+)L\\b");
- if (expr.indexIn(content) != -1)
- dictionary["CFG_STDCXX_DEFAULT"] = expr.cap(1);
- }
- }
- if (dictionary["CFG_STDCXX_DEFAULT"].isEmpty()) {
- cout << "Could not determine the C++ standard the compiler uses by default, assuming C++98." << endl;
- dictionary["CFG_STDCXX_DEFAULT"] = "199711";
- }
- }
-
- if (dictionary["ATOMIC64"] == "auto")
- dictionary["ATOMIC64"] = checkAvailability("ATOMIC64") ? "yes" :
- checkAvailability("ATOMIC64-LIBATOMIC") ? "libatomic" : "no";
-
- // special case:
- if (!checkAvailability("ATOMICFPTR")) {
- dictionary["DONE"] = "error";
- cout << "ERROR: detected an std::atomic implementation that fails for function pointers." << endl
- << "Please apply the patch corresponding to your Standard Library vendor, found in" << endl
- << sourcePath << "/config.tests/common/atomicfptr" << endl;
- return;
- }
-
- // Style detection
- if (dictionary["STYLE_WINDOWSXP"] == "auto")
- dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
- if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
- dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
-
- // Compression detection
- if (dictionary["ZLIB"] == "auto")
- dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
-
- // PCRE detection
- if (dictionary["PCRE"] == "auto")
- dictionary["PCRE"] = checkAvailability("PCRE") ? defaultTo("PCRE") : "qt";
-
- // ICU detection
- if (dictionary["ICU"] == "auto")
- dictionary["ICU"] = checkAvailability("ICU") ? "yes" : "no";
-
- // ANGLE detection
- if (dictionary["ANGLE"] == "auto") {
- if (dictionary["OPENGL_ES_2"] == "yes") {
- dictionary["ANGLE"] = checkAngleAvailability() ? "yes" : "no";
- dictionary["ANGLE_FROM"] = "detected";
- } else {
- dictionary["ANGLE"] = "no";
- }
- }
-
- // Dynamic GL. This must be explicitly requested, no autodetection.
- if (dictionary["DYNAMICGL"] == "auto")
- dictionary["DYNAMICGL"] = "no";
-
- // Image format detection
- if (dictionary["GIF"] == "auto")
- dictionary["GIF"] = defaultTo("GIF");
- if (dictionary["JPEG"] == "auto")
- dictionary["JPEG"] = defaultTo("JPEG");
- if (dictionary["PNG"] == "auto")
- dictionary["PNG"] = defaultTo("PNG");
- if (dictionary["LIBJPEG"] == "auto")
- dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
- if (dictionary["LIBPNG"] == "auto")
- dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
-
- // SQL detection (not on by default)
- if (dictionary["SQL_MYSQL"] == "auto")
- dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
- if (dictionary["SQL_ODBC"] == "auto")
- dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
- if (dictionary["SQL_OCI"] == "auto")
- dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
- if (dictionary["SQL_PSQL"] == "auto")
- dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
- if (dictionary["SQL_TDS"] == "auto")
- dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
- if (dictionary["SQL_DB2"] == "auto")
- dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
- if (dictionary["SQL_SQLITE"] == "auto")
- dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
- if (dictionary["SQL_SQLITE_LIB"] == "system")
- if (!checkAvailability("SQL_SQLITE_LIB"))
- dictionary["SQL_SQLITE_LIB"] = "no";
- if (dictionary["SQL_SQLITE2"] == "auto")
- dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
- if (dictionary["SQL_IBASE"] == "auto")
- dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
- if (dictionary["SSE2"] == "auto")
- dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
- if (dictionary["SSE3"] == "auto")
- dictionary["SSE3"] = checkAvailability("SSE3") ? "yes" : "no";
- if (dictionary["SSSE3"] == "auto")
- dictionary["SSSE3"] = checkAvailability("SSSE3") ? "yes" : "no";
- if (dictionary["SSE4_1"] == "auto")
- dictionary["SSE4_1"] = checkAvailability("SSE4_1") ? "yes" : "no";
- if (dictionary["SSE4_2"] == "auto")
- dictionary["SSE4_2"] = checkAvailability("SSE4_2") ? "yes" : "no";
- if (dictionary["AVX"] == "auto")
- dictionary["AVX"] = checkAvailability("AVX") ? "yes" : "no";
- if (dictionary["AVX2"] == "auto")
- dictionary["AVX2"] = checkAvailability("AVX2") ? "yes" : "no";
- if (dictionary["AVX512"] == "auto")
- dictionary["AVX512"] = checkAvx512Availability();
- if (dictionary["NEON"] == "auto")
- dictionary["NEON"] = checkAvailability("NEON") ? "yes" : "no";
- if (dictionary["SSL"] == "auto") {
- if (platform() == WINDOWS_RT) {
- dictionary["SSL"] = "yes";
- } else {
- // On Desktop Windows openssl and ssl always have the same value (for now). OpenSSL is
- // the only backend and if it is available and should be built, that also means that
- // SSL support in general is enabled.
- if (dictionary["OPENSSL"] == "auto")
- dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
- dictionary["SSL"] = dictionary["OPENSSL"];
- }
- }
- if (dictionary["OPENSSL"] == "auto")
- dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
- if (dictionary["LIBPROXY"] == "auto")
- dictionary["LIBPROXY"] = checkAvailability("LIBPROXY") ? "yes" : "no";
- if (dictionary["DBUS"] == "auto")
- dictionary["DBUS"] = checkAvailability("DBUS") ? "linked" : "runtime";
- if (dictionary["QML_DEBUG"] == "auto")
- dictionary["QML_DEBUG"] = dictionary["QML"] == "yes" ? "yes" : "no";
- if (dictionary["AUDIO_BACKEND"] == "auto")
- dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
- if (dictionary["WMF_BACKEND"] == "auto")
- dictionary["WMF_BACKEND"] = checkAvailability("WMF_BACKEND") ? "yes" : "no";
- if (dictionary["WMSDK"] == "auto")
- dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no";
-
- // Detection of IncrediBuild buildconsole
- if (dictionary["INCREDIBUILD_XGE"] == "auto")
- dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
-
- // Detection of iconv support
- if (dictionary["QT_ICONV"] == "auto")
- dictionary["QT_ICONV"] = checkAvailability("ICONV") ? "yes" : "no";
-
- // Detection of evdev support
- if (dictionary["QT_EVDEV"] == "auto")
- dictionary["QT_EVDEV"] = checkAvailability("EVDEV") ? "yes" : "no";
-
- // Detection of mtdev support
- if (dictionary["QT_MTDEV"] == "auto")
- dictionary["QT_MTDEV"] = checkAvailability("MTDEV") ? "yes" : "no";
-
- // Detection of tslib support
- if (dictionary["QT_TSLIB"] == "auto")
- dictionary["QT_TSLIB"] = checkAvailability("TSLIB") ? "yes" : "no";
-
- // Detection of inotify
- if (dictionary["QT_INOTIFY"] == "auto")
- dictionary["QT_INOTIFY"] = checkAvailability("INOTIFY") ? "yes" : "no";
-
- // Detection of cups support
- if (dictionary["QT_CUPS"] == "auto")
- dictionary["QT_CUPS"] = checkAvailability("CUPS") ? "yes" : "no";
-
- // Detection of -fstack-protector-strong support
- if (dictionary["STACK_PROTECTOR_STRONG"] == "auto")
- dictionary["STACK_PROTECTOR_STRONG"] = checkAvailability("STACK_PROTECTOR_STRONG") ? "yes" : "no";
-
- if (platform() == QNX && dictionary["SLOG2"] == "auto") {
- dictionary["SLOG2"] = checkAvailability("SLOG2") ? "yes" : "no";
- }
-
- if (platform() == QNX && dictionary["QNX_IMF"] == "auto") {
- dictionary["QNX_IMF"] = checkAvailability("QNX_IMF") ? "yes" : "no";
- }
-
- if (dictionary["PPS"] == "auto") {
- dictionary["PPS"] = checkAvailability("PPS") ? "yes" : "no";
- }
-
- if (platform() == QNX && dictionary["LGMON"] == "auto") {
- dictionary["LGMON"] = checkAvailability("LGMON") ? "yes" : "no";
- }
-
- if (dictionary["QT_EVENTFD"] == "auto")
- dictionary["QT_EVENTFD"] = checkAvailability("QT_EVENTFD") ? "yes" : "no";
-
- if (dictionary["FONT_CONFIG"] == "auto")
- dictionary["FONT_CONFIG"] = checkAvailability("FONT_CONFIG") ? "yes" : "no";
-
- if ((dictionary["FONT_CONFIG"] == "yes") && (dictionary["FREETYPE_FROM"] == "default"))
- dictionary["FREETYPE"] = "system";
-
- if (dictionary["DOUBLECONVERSION"] == "auto")
- dictionary["DOUBLECONVERSION"] = checkAvailability("DOUBLECONVERSION") ? "system" : "qt";
-
- if (dictionary["DIRECTWRITE"] == "auto")
- dictionary["DIRECTWRITE"] = checkAvailability("DIRECTWRITE") ? "yes" : "no";
-
- if (dictionary["DIRECTWRITE"] == "no")
- dictionary["DIRECTWRITE2"] = "no";
- else if (dictionary["DIRECTWRITE2"] == "auto")
- dictionary["DIRECTWRITE2"] = checkAvailability("DIRECTWRITE2") ? "yes" : "no";
-
- // Mark all unknown "auto" to the default value..
- for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
- if (i.value() == "auto")
- i.value() = defaultTo(i.key());
- }
-
- cout << "Done running configuration tests." << endl;
-}
-
-bool Configure::verifyConfiguration()
-{
- bool prompt = false;
- if (dictionary["C++STD"] != "auto"
- && dictionary["QMAKESPEC"].contains("msvc")) {
- cout << "WARNING: It is not possible to change the C++ standard edition with MSVC compilers. "
- "Therefore, the option -c++std " << dictionary["C++STD"] << " was ignored." << endl << endl;
- dictionary["C++STD"] = "auto";
- }
-
- if (dictionary["STATIC_RUNTIME"] == "yes" && dictionary["SHARED"] == "yes") {
- cout << "ERROR: -static-runtime requires -static" << endl << endl;
- dictionary[ "DONE" ] = "error";
- }
-
- if (dictionary["SEPARATE_DEBUG_INFO"] == "yes") {
- if (dictionary[ "SHARED" ] == "no") {
- cout << "ERROR: -separate-debug-info is incompatible with -static" << endl << endl;
- dictionary[ "DONE" ] = "error";
- } else if (dictionary[ "BUILD" ] != "debug"
- && dictionary[ "BUILDALL" ] == "no"
- && dictionary[ "FORCEDEBUGINFO" ] == "no") {
- cout << "ERROR: -separate-debug-info needs -debug, -debug-and-release, or -force-debug-info" << endl << endl;
- dictionary[ "DONE" ] = "error";
- } else if (dictionary["SEPARATE_DEBUG_INFO"] == "yes" && !checkAvailability("OBJCOPY")) {
- cout << "ERROR: -separate-debug-info was requested but this binutils does not support it." << endl;
- dictionary[ "DONE" ] = "error";
- }
- }
-
- if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
- cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
- << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl;
- dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
- prompt = true;
- }
- if (dictionary["QMAKESPEC"].endsWith("-g++")
- && dictionary["SQL_OCI"] != "no") {
- cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
- << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
- << "Oracle driver, as the current build will most likely fail." << endl;
- prompt = true;
- }
- if (dictionary["QMAKESPEC"].endsWith("win32-msvc2008") || dictionary["QMAKESPEC"].endsWith("win32-msvc2010")) {
- cout << "ERROR: Qt cannot be compiled with Visual Studio 2008 or 2010." << endl;
- prompt = true;
- }
- if (0 != dictionary["ARM_FPU_TYPE"].size()) {
- QStringList l= QStringList()
- << "softvfp"
- << "softvfp+vfpv2"
- << "vfpv2";
- if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
- cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
- }
- if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) {
- cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl
- << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl
- << "files such as headers and libraries." << endl;
- prompt = true;
- }
-#if WINVER > 0x0601
- if (dictionary["TARGET_OS"] == "xp") {
- cout << "WARNING: Cannot use Windows Kit 8 to build Qt for Windows XP.\n"
- "WARNING: Windows SDK v7.1A is recommended.\n";
- }
-#endif
-
- if (dictionary["DIRECT2D"] == "yes" && !checkAvailability("DIRECT2D")) {
- cout << "WARNING: To be able to build the Direct2D platform plugin you will" << endl
- << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl
- << "files such as headers and libraries." << endl;
- prompt = true;
- }
-
- // -angle given on command line, but Direct X cannot be found.
- if (dictionary["ANGLE"] != "no") {
- QString errorMessage;
- if (!checkAngleAvailability(&errorMessage)) {
- cout << "WARNING: ANGLE specified, but the DirectX SDK could not be detected:" << endl
- << " " << qPrintable(errorMessage) << endl
- << "The build will most likely fail." << endl;
- prompt = true;
- }
- } else if (dictionary["ANGLE"] == "no") {
- if (dictionary["ANGLE_FROM"] == "detected") {
- QString errorMessage;
- checkAngleAvailability(&errorMessage);
- cout << "WARNING: The DirectX SDK could not be detected:" << endl
- << " " << qPrintable(errorMessage) << endl
- << "Disabling the ANGLE backend." << endl;
- prompt = true;
- }
- if ((dictionary["OPENGL_ES_2"] == "yes") && !dictionary.contains("XQMAKESPEC")) {
- cout << endl << "WARNING: Using OpenGL ES 2.0 without ANGLE." << endl
- << "Specify -opengl desktop to use Open GL." << endl
- << "The build will most likely fail." << endl;
- prompt = true;
- }
- }
-
- if (dictionary["DYNAMICGL"] == "yes") {
- if (dictionary["OPENGL_ES_2"] == "yes" || dictionary["ANGLE"] != "no") {
- cout << "ERROR: Dynamic OpenGL cannot be used with -angle." << endl;
- dictionary[ "DONE" ] = "error";
- }
- }
-
- if (dictionary["OPENGL"] == "no" || dictionary["OPENGL_ES_2"] == "no") {
- if (dictionary.value("XQMAKESPEC").startsWith("winphone") ||
- dictionary.value("XQMAKESPEC").startsWith("winrt")) {
- cout << "ERROR: Option -no-opengl is not valid for WinRT." << endl;
- dictionary[ "DONE" ] = "error";
- }
- }
-
- if ((dictionary["FONT_CONFIG"] == "yes") && (dictionary["FREETYPE_FROM"] == "commandline")) {
- if (dictionary["FREETYPE"] == "yes") {
- cout << "WARNING: Bundled FreeType can't be used."
- " FontConfig use requires system FreeType." << endl;
- dictionary["FREETYPE"] = "system";
- dictionary["FREETYPE_FROM"] = "override";
- prompt = true;
- } else if (dictionary["FREETYPE"] == "no") {
- cout << "WARNING: FreeType can't be disabled."
- " FontConfig use requires system FreeType." << endl;
- dictionary["FREETYPE"] = "system";
- dictionary["FREETYPE_FROM"] = "override";
- prompt = true;
- }
- }
-
- if (prompt)
- promptKeyPress();
-
- return true;
}
void Configure::prepareConfigTests()
@@ -2699,726 +563,6 @@ void Configure::prepareConfigTests()
}
}
-void Configure::generateOutputVars()
-{
- // Generate variables for output
- QString build = dictionary[ "BUILD" ];
- bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
- if (build == "debug") {
- if (buildAll)
- qtConfig += "debug_and_release build_all release";
- qtConfig += "debug";
- } else if (build == "release") {
- if (buildAll)
- qtConfig += "debug_and_release build_all debug";
- qtConfig += "release";
- }
- if (dictionary[ "RELEASE_TOOLS" ] == "yes")
- qtConfig += "release_tools";
-
- if (dictionary[ "PCH" ] == "yes")
- qmakeConfig += "precompile_header";
- else
- qmakeVars += "CONFIG -= precompile_header";
-
- if (dictionary[ "C++STD" ] == "c++11")
- qtConfig += "c++11";
- else if (dictionary[ "C++STD" ] == "c++14")
- qtConfig += "c++11 c++14";
- else if (dictionary[ "C++STD" ] == "c++1z")
- qtConfig += "c++11 c++14 c++1z";
- if (!dictionary[ "CFG_STDCXX_DEFAULT" ].isEmpty())
- qmakeVars += "QT_COMPILER_STDCXX = " + dictionary[ "CFG_STDCXX_DEFAULT" ];
-
- if (dictionary[ "USE_GOLD_LINKER" ] == "yes")
- qmakeConfig += "use_gold_linker";
-
- if (dictionary[ "ENABLE_NEW_DTAGS" ] == "yes")
- qmakeConfig += "enable_new_dtags";
-
- if (dictionary[ "SHARED" ] == "no")
- qtConfig += "static";
- else
- qtConfig += "shared";
-
- if (dictionary[ "STATIC_RUNTIME" ] == "yes")
- qtConfig += "static_runtime";
-
- if (dictionary[ "GUI" ] == "no") {
- qtConfig += "no-gui";
- dictionary [ "WIDGETS" ] = "no";
- }
-
- if (dictionary[ "WIDGETS" ] == "no")
- qtConfig += "no-widgets";
-
- // Compression --------------------------------------------------
- if (dictionary[ "ZLIB" ] == "qt")
- qtConfig += "zlib";
- else if (dictionary[ "ZLIB" ] == "system")
- qtConfig += "system-zlib";
-
- // PCRE ---------------------------------------------------------
- if (dictionary[ "PCRE" ] == "qt")
- qmakeConfig += "pcre";
-
- // ICU ---------------------------------------------------------
- if (dictionary[ "ICU" ] == "yes")
- qtConfig += "icu";
-
- // ANGLE --------------------------------------------------------
- if (dictionary[ "ANGLE" ] != "no") {
- qtConfig += "angle";
- }
-
- // Dynamic OpenGL loading ---------------------------------------
- if (dictionary[ "DYNAMICGL" ] != "no") {
- qtConfig += "dynamicgl";
- }
-
- // Image formates -----------------------------------------------
- if (dictionary[ "GIF" ] == "no")
- qtConfig += "no-gif";
- else if (dictionary[ "GIF" ] == "yes")
- qtConfig += "gif";
-
- if (dictionary[ "JPEG" ] == "no")
- qtConfig += "no-jpeg";
- else if (dictionary[ "JPEG" ] == "yes")
- qtConfig += "jpeg";
- if (dictionary[ "LIBJPEG" ] == "system")
- qtConfig += "system-jpeg";
-
- if (dictionary[ "PNG" ] == "no")
- qtConfig += "no-png";
- else if (dictionary[ "PNG" ] == "yes")
- qtConfig += "png";
- if (dictionary[ "LIBPNG" ] == "system")
- qtConfig += "system-png";
-
- // Double conversion -----------------------------------------------
- if (dictionary[ "DOUBLECONVERSION" ] == "qt")
- qtConfig += "doubleconversion";
- else if (dictionary[ "DOUBLECONVERSION" ] == "system")
- qtConfig += "system-doubleconversion";
- else if (dictionary[ "DOUBLECONVERSION" ] == "no")
- qtConfig += "no-doubleconversion";
-
- // Text rendering --------------------------------------------------
- if (dictionary[ "FREETYPE" ] == "yes")
- qtConfig += "freetype";
- else if (dictionary[ "FREETYPE" ] == "system")
- qtConfig += "system-freetype";
-
- if (dictionary[ "HARFBUZZ" ] == "qt")
- qtConfig += "harfbuzz";
- else if (dictionary[ "HARFBUZZ" ] == "system")
- qtConfig += "system-harfbuzz";
-
- // Styles -------------------------------------------------------
- if (dictionary[ "STYLE_WINDOWS" ] == "yes")
- qmakeStyles += "windows";
-
- if (dictionary[ "STYLE_FUSION" ] == "yes")
- qmakeStyles += "fusion";
-
- if (dictionary[ "STYLE_WINDOWSXP" ] == "yes")
- qmakeStyles += "windowsxp";
-
- if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes")
- qmakeStyles += "windowsvista";
-
- if (dictionary[ "STYLE_ANDROID" ] == "yes")
- qmakeStyles += "android";
-
- // Databases ----------------------------------------------------
- if (dictionary[ "SQL_MYSQL" ] == "yes")
- qmakeSql += "mysql";
- else if (dictionary[ "SQL_MYSQL" ] == "plugin")
- qmakeSqlPlugins += "mysql";
-
- if (dictionary[ "SQL_ODBC" ] == "yes")
- qmakeSql += "odbc";
- else if (dictionary[ "SQL_ODBC" ] == "plugin")
- qmakeSqlPlugins += "odbc";
-
- if (dictionary[ "SQL_OCI" ] == "yes")
- qmakeSql += "oci";
- else if (dictionary[ "SQL_OCI" ] == "plugin")
- qmakeSqlPlugins += "oci";
-
- if (dictionary[ "SQL_PSQL" ] == "yes")
- qmakeSql += "psql";
- else if (dictionary[ "SQL_PSQL" ] == "plugin")
- qmakeSqlPlugins += "psql";
-
- if (dictionary[ "SQL_TDS" ] == "yes")
- qmakeSql += "tds";
- else if (dictionary[ "SQL_TDS" ] == "plugin")
- qmakeSqlPlugins += "tds";
-
- if (dictionary[ "SQL_DB2" ] == "yes")
- qmakeSql += "db2";
- else if (dictionary[ "SQL_DB2" ] == "plugin")
- qmakeSqlPlugins += "db2";
-
- if (dictionary[ "SQL_SQLITE" ] == "yes")
- qmakeSql += "sqlite";
- else if (dictionary[ "SQL_SQLITE" ] == "plugin")
- qmakeSqlPlugins += "sqlite";
-
- if (dictionary[ "SQL_SQLITE_LIB" ] == "system")
- qmakeConfig += "system-sqlite";
-
- if (dictionary[ "SQL_SQLITE2" ] == "yes")
- qmakeSql += "sqlite2";
- else if (dictionary[ "SQL_SQLITE2" ] == "plugin")
- qmakeSqlPlugins += "sqlite2";
-
- if (dictionary[ "SQL_IBASE" ] == "yes")
- qmakeSql += "ibase";
- else if (dictionary[ "SQL_IBASE" ] == "plugin")
- qmakeSqlPlugins += "ibase";
-
- // Other options ------------------------------------------------
- if (dictionary[ "BUILDALL" ] == "yes") {
- qtConfig += "build_all";
- }
- if (dictionary[ "SEPARATE_DEBUG_INFO" ] == "yes")
- qtConfig += "separate_debug_info";
- if (dictionary[ "FORCEDEBUGINFO" ] == "yes")
- qmakeConfig += "force_debug_info";
- qmakeConfig += dictionary[ "BUILD" ];
-
- if (buildParts.isEmpty()) {
- buildParts = defaultBuildParts;
-
- if (dictionary["BUILDDEV"] == "yes")
- buildParts += "tests";
- }
- while (!nobuildParts.isEmpty())
- buildParts.removeAll(nobuildParts.takeFirst());
- if (!buildParts.contains("libs"))
- buildParts += "libs";
- buildParts.removeDuplicates();
- if (dictionary[ "COMPILE_EXAMPLES" ] == "yes")
- qmakeConfig += "compile_examples";
-
- if (dictionary["MSVC_MP"] == "yes")
- qmakeConfig += "msvc_mp";
-
- if (dictionary[ "SHARED" ] == "yes") {
- QString version = dictionary[ "VERSION" ];
- if (!version.isEmpty()) {
- qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf('.'));
- version.remove(QLatin1Char('.'));
- }
- }
-
- if (dictionary["ATOMIC64"] == "libatomic")
- qmakeConfig += "atomic64-libatomic";
-
- if (dictionary[ "ACCESSIBILITY" ] == "yes")
- qtConfig += "accessibility";
-
- if (!qmakeLibs.isEmpty())
- qmakeVars += "EXTRA_LIBS += " + formatPaths(qmakeLibs);
-
- if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty())
- qmakeVars += "QT_LFLAGS_SQLITE += " + dictionary["QT_LFLAGS_SQLITE"];
-
- if (dictionary[ "OPENGL" ] == "yes")
- qtConfig += "opengl";
-
- if (dictionary["OPENGL_ES_2"] == "yes") {
- qtConfig += "opengles2";
- qtConfig += "egl";
- }
-
- if (dictionary["OPENVG"] == "yes") {
- qtConfig += "openvg";
- qtConfig += "egl";
- }
-
- if (dictionary[ "SSL" ] == "yes")
- qtConfig += "ssl";
-
- if (dictionary[ "OPENSSL" ] == "yes")
- qtConfig += "openssl";
- else if (dictionary[ "OPENSSL" ] == "linked")
- qtConfig += "openssl-linked";
-
- if (dictionary[ "LIBPROXY" ] == "yes")
- qtConfig += "libproxy";
-
- if (dictionary[ "DBUS" ] == "runtime")
- qtConfig += "dbus";
- else if (dictionary[ "DBUS" ] == "linked")
- qtConfig += "dbus dbus-linked";
-
- // ### Vestige
- if (dictionary["AUDIO_BACKEND"] == "yes")
- qtConfig += "audio-backend";
-
- if (dictionary["QML_DEBUG"] == "no")
- qtConfig += "no-qml-debug";
-
- if (dictionary["WMF_BACKEND"] == "yes")
- qtConfig += "wmf-backend";
-
- if (dictionary["DIRECTWRITE"] == "yes")
- qtConfig += "directwrite";
-
- if (dictionary["DIRECTWRITE2"] == "yes")
- qtConfig += "directwrite2";
-
- if (dictionary["DIRECT2D"] == "yes")
- qtConfig += "direct2d";
-
- if (dictionary[ "NATIVE_GESTURES" ] == "yes")
- qtConfig += "native-gestures";
-
- qtConfig += "qpa";
-
- if (dictionary["NIS"] == "yes")
- qtConfig += "nis";
-
- if (dictionary["QT_CUPS"] == "yes")
- qtConfig += "cups";
-
- if (dictionary["QT_ICONV"] == "yes")
- qtConfig += "iconv";
- else if (dictionary["QT_ICONV"] == "sun")
- qtConfig += "sun-libiconv";
- else if (dictionary["QT_ICONV"] == "gnu")
- qtConfig += "gnu-libiconv";
-
- if (dictionary["QT_EVDEV"] == "yes")
- qtConfig += "evdev";
-
- if (dictionary["QT_MTDEV"] == "yes")
- qtConfig += "mtdev";
-
- if (dictionary[ "QT_TSLIB" ] == "yes")
- qtConfig += "tslib";
-
- if (dictionary["QT_INOTIFY"] == "yes")
- qtConfig += "inotify";
-
- if (dictionary["QT_EVENTFD"] == "yes")
- qtConfig += "eventfd";
-
- if (dictionary["FONT_CONFIG"] == "yes") {
- qtConfig += "fontconfig";
- qmakeVars += "QMAKE_CFLAGS_FONTCONFIG =";
- qmakeVars += "QMAKE_LIBS_FONTCONFIG = -lfreetype -lfontconfig";
- }
-
- if (dictionary["QT_GLIB"] == "yes")
- qtConfig += "glib";
-
- if (dictionary["STACK_PROTECTOR_STRONG"] == "yes")
- qtConfig += "stack-protector-strong";
-
- if (dictionary["REDUCE_EXPORTS"] == "yes")
- qtConfig += "reduce_exports";
-
- if (!dictionary["POLL"].isEmpty())
- qtConfig += "poll_" + dictionary["POLL"];
-
- // We currently have no switch for QtConcurrent, so add it unconditionally.
- qtConfig += "concurrent";
-
- if (dictionary[ "SYSTEM_PROXIES" ] == "yes")
- qtConfig += "system-proxies";
-
- if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"])) {
- qmakeConfig += "cross_compile";
- dictionary["CROSS_COMPILE"] = "yes";
- }
-
- // Directories and settings for .qmake.cache --------------------
-
- if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
- qtConfig += "rpath";
-
- if (!qmakeDefines.isEmpty())
- qmakeVars += QString("EXTRA_DEFINES += ") + qmakeDefines.join(' ');
- if (!qmakeIncludes.isEmpty())
- qmakeVars += QString("EXTRA_INCLUDEPATH += ") + formatPaths(qmakeIncludes);
- if (!opensslLibs.isEmpty())
- qmakeVars += opensslLibs;
- if (dictionary[ "OPENSSL" ] == "linked") {
- if (!opensslLibsDebug.isEmpty() || !opensslLibsRelease.isEmpty()) {
- if (opensslLibsDebug.isEmpty() || opensslLibsRelease.isEmpty()) {
- cout << "Error: either both or none of OPENSSL_LIBS_DEBUG/_RELEASE must be defined." << endl;
- exit(1);
- }
- qmakeVars += opensslLibsDebug;
- qmakeVars += opensslLibsRelease;
- } else if (opensslLibs.isEmpty()) {
- qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
- }
- if (!opensslPath.isEmpty()) {
- qmakeVars += QString("OPENSSL_CFLAGS += -I%1/include").arg(opensslPath);
- qmakeVars += QString("OPENSSL_LIBS += -L%1/lib").arg(opensslPath);
- }
- }
- if (dictionary[ "DBUS" ] == "linked") {
- if (!dbusPath.isEmpty()) {
- qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
- qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);
- if (dbusHostPath.isEmpty())
- qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
- }
- if (!dbusHostPath.isEmpty())
- qmakeVars += QString("QT_HOST_CFLAGS_DBUS = -I%1/include").arg(dbusHostPath);
- }
- if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty()) {
- qmakeVars += QString("QT_CFLAGS_MYSQL = -I%1/include").arg(mysqlPath);
- qmakeVars += QString("QT_LFLAGS_MYSQL = -L%1/lib").arg(mysqlPath);
- }
- if (!psqlLibs.isEmpty())
- qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
- if (!zlibLibs.isEmpty())
- qmakeVars += zlibLibs;
-
- {
- QStringList lflagsTDS;
- if (!sybase.isEmpty())
- lflagsTDS += QString("-L") + formatPath(sybase.section("=", 1) + "/lib");
- if (!sybaseLibs.isEmpty())
- lflagsTDS += sybaseLibs.section("=", 1);
- if (!lflagsTDS.isEmpty())
- qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(' ');
- }
-
- if (!qmakeSql.isEmpty())
- qmakeVars += QString("sql-drivers += ") + qmakeSql.join(' ');
- if (!qmakeSqlPlugins.isEmpty())
- qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join(' ');
- if (!qmakeStyles.isEmpty())
- qmakeVars += QString("styles += ") + qmakeStyles.join(' ');
- if (!qmakeStylePlugins.isEmpty())
- qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join(' ');
-
- if (!dictionary[ "QMAKESPEC" ].length()) {
- cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
- << "be defined as an environment variable, or specified as an" << endl
- << "argument with -platform" << endl;
-
- QStringList winPlatforms;
- QDir mkspecsDir(sourcePath + "/mkspecs");
- const QFileInfoList &specsList = mkspecsDir.entryInfoList();
- for (int i = 0; i < specsList.size(); ++i) {
- const QFileInfo &fi = specsList.at(i);
- if (fi.fileName().left(5) == "win32") {
- winPlatforms += fi.fileName();
- }
- }
- cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl;
- dictionary[ "DONE" ] = "error";
- }
-}
-
-void Configure::generateCachefile()
-{
- // Generate qmodule.pri, which is loaded only by Qt modules
- {
- FileWriter moduleStream(buildPath + "/mkspecs/qmodule.pri");
-
- moduleStream << "QT_BUILD_PARTS += " << buildParts.join(' ') << endl;
- if (!skipModules.isEmpty())
- moduleStream << "QT_SKIP_MODULES += " << skipModules.join(' ') << endl;
- QString qcpath = dictionary["QCONFIG_PATH"];
- QString qlpath = sourcePath + "/src/corelib/global/";
- if (qcpath.startsWith(qlpath))
- qcpath.remove(0, qlpath.length());
- moduleStream << "QT_QCONFIG_PATH = " << qcpath << endl;
- moduleStream << endl;
-
- moduleStream << "host_build {" << endl;
- moduleStream << " QT_CPU_FEATURES." << dictionary["QT_HOST_ARCH"] <<
- " = " << dictionary["QT_HOST_CPU_FEATURES"] << endl;
- moduleStream << "} else {" << endl;
- moduleStream << " QT_CPU_FEATURES." << dictionary["QT_ARCH"] <<
- " = " << dictionary["QT_CPU_FEATURES"] << endl;
- moduleStream << "}" << endl;
- moduleStream << "QT_COORD_TYPE += " << dictionary["QREAL"] << endl;
-
- if (dictionary["QT_XKBCOMMON"] == "no")
- moduleStream << "DEFINES += QT_NO_XKBCOMMON" << endl;
-
- // embedded
- if (!dictionary["KBD_DRIVERS"].isEmpty())
- moduleStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
- if (!dictionary["GFX_DRIVERS"].isEmpty())
- moduleStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
- if (!dictionary["MOUSE_DRIVERS"].isEmpty())
- moduleStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
- if (!dictionary["DECORATIONS"].isEmpty())
- moduleStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
-
- moduleStream << "CONFIG += " << qmakeConfig.join(' ');
- if (dictionary[ "SSE2" ] == "yes")
- moduleStream << " sse2";
- if (dictionary[ "SSE3" ] == "yes")
- moduleStream << " sse3";
- if (dictionary[ "SSSE3" ] == "yes")
- moduleStream << " ssse3";
- if (dictionary[ "SSE4_1" ] == "yes")
- moduleStream << " sse4_1";
- if (dictionary[ "SSE4_2" ] == "yes")
- moduleStream << " sse4_2";
- if (dictionary[ "AVX" ] == "yes")
- moduleStream << " avx";
- if (dictionary[ "AVX2" ] == "yes")
- moduleStream << " avx2";
- if (!dictionary[ "AVX512" ].isEmpty())
- moduleStream << ' ' << dictionary[ "AVX512" ];
- if (dictionary[ "NEON" ] == "yes")
- moduleStream << " neon";
- if (dictionary[ "LARGE_FILE" ] == "yes")
- moduleStream << " largefile";
- if (dictionary[ "STRIP" ] == "no")
- moduleStream << " nostrip";
- if (dictionary[ "LTCG" ] == "yes")
- moduleStream << " ltcg";
- moduleStream << endl;
-
- for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var)
- moduleStream << (*var) << endl;
-
- if (!moduleStream.flush())
- dictionary[ "DONE" ] = "error";
- }
-}
-
-void Configure::addSysroot(QString *command)
-{
- const QString &sysroot = dictionary["CFG_SYSROOT"];
- if (!sysroot.isEmpty() && dictionary["CFG_GCC_SYSROOT"] == "yes") {
- command->append(" QMAKE_LFLAGS+=--sysroot=" + sysroot);
- command->append(" QMAKE_CXXFLAGS+=--sysroot=" + sysroot);
- }
-}
-
-struct ArchData {
- bool isHost;
- const char *qmakespec;
- const char *key;
- const char *subarchKey;
- const char *type;
- ArchData() {}
- ArchData(bool h, const char *t, const char *qm, const char *k, const char *sak)
- : isHost(h), qmakespec(qm), key(k), subarchKey(sak), type(t)
- {}
-};
-
-/*
- Runs qmake on config.tests/arch/arch.pro, which will detect the target arch
- for the compiler we are using
-*/
-void Configure::detectArch()
-{
- QString oldpwd = QDir::currentPath();
-
- QString newpwd = QString("%1/config.tests/arch").arg(buildPath);
- if (!QDir().exists(newpwd) && !QDir().mkpath(newpwd)) {
- cout << "Failed to create directory " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
- dictionary["DONE"] = "error";
- return;
- }
- if (!QDir::setCurrent(newpwd)) {
- cout << "Failed to change working directory to " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
- dictionary["DONE"] = "error";
- return;
- }
-
- QVector<ArchData> qmakespecs;
- if (dictionary.contains("XQMAKESPEC"))
- qmakespecs << ArchData(false, "target", "XQMAKESPEC", "QT_ARCH", "QT_CPU_FEATURES");
- qmakespecs << ArchData(true, "host", "QMAKESPEC", "QT_HOST_ARCH", "QT_HOST_CPU_FEATURES");
-
- for (int i = 0; i < qmakespecs.count(); ++i) {
- const ArchData &data = qmakespecs.at(i);
- QString qmakespec = dictionary.value(data.qmakespec);
- QString key = data.key;
- QString subarchKey = data.subarchKey;
-
- // run qmake
- QString command = QString("%1 -spec %2 %3")
- .arg(QDir::toNativeSeparators(QDir(newpwd).relativeFilePath(buildPath + "/bin/qmake.exe")),
- QDir::toNativeSeparators(qmakespec),
- QDir::toNativeSeparators(sourcePath + "/config.tests/arch/arch"
- + (data.isHost ? "_host" : "") + ".pro"));
-
- if (!data.isHost) {
- if (qmakespec.startsWith("winrt") || qmakespec.startsWith("winphone"))
- command.append(" QMAKE_LFLAGS+=/ENTRY:main");
- addSysroot(&command);
- }
-
- int returnValue = 0;
- Environment::execute(command, &returnValue);
- if (returnValue != 0) {
- cout << "QMake failed!" << endl;
- dictionary["DONE"] = "error";
- return;
- }
-
- // compile
- command = dictionary[ "MAKE" ];
- if (command.contains("nmake") || command.contains("jom"))
- command += " /NOLOGO";
- command += " -s";
- Environment::execute(command);
-
- // find the executable that was generated
- QString arch_exe;
- if (qmakespec.startsWith("android")) {
- arch_exe = "libarch.so";
- } else {
- arch_exe = "arch.exe";
- }
- QFile exe(arch_exe);
- if (!exe.open(QFile::ReadOnly)) { // no Text, this is binary
- exe.setFileName("arch");
- if (!exe.open(QFile::ReadOnly)) {
- cout << "Could not find output file '" << qPrintable(arch_exe) << "' or 'arch' in " << qPrintable(newpwd) << " : " << qPrintable(exe.errorString()) << endl;
- dictionary["DONE"] = "error";
- return;
- }
- }
- QByteArray exeContents = exe.readAll();
- exe.close();
-
- static const char archMagic[] = "==Qt=magic=Qt== Architecture:";
- int magicPos = exeContents.indexOf(archMagic);
- if (magicPos == -1) {
- cout << "Internal error, could not find the architecture of the "
- << data.type << " executable" << endl;
- dictionary["DONE"] = "error";
- return;
- }
- //cout << "Found magic at offset 0x" << hex << magicPos << endl;
-
- // the conversion from QByteArray will stop at the ending NUL anyway
- QString arch = QString::fromLatin1(exeContents.constData() + magicPos
- + sizeof(archMagic) - 1);
- dictionary[key] = arch;
-
- static const char subarchMagic[] = "==Qt=magic=Qt== Sub-architecture:";
- magicPos = exeContents.indexOf(subarchMagic);
- if (magicPos == -1) {
- cout << "Internal error, could not find the sub-architecture of the "
- << data.type << " executable" << endl;
- dictionary["DONE"] = "error";
- return;
- }
-
- QString subarch = QString::fromLatin1(exeContents.constData() + magicPos
- + sizeof(subarchMagic) - 1);
- dictionary[subarchKey] = subarch;
-
- //cout << "Detected arch '" << qPrintable(arch) << "'\n";
- //cout << "Detected sub-arch '" << qPrintable(subarch) << "'\n";
-
- // clean up
- Environment::execute(command + " distclean");
- }
-
- if (!dictionary.contains("QT_HOST_ARCH"))
- dictionary["QT_HOST_ARCH"] = "unknown";
- if (!dictionary.contains("QT_ARCH")) {
- dictionary["QT_ARCH"] = dictionary["QT_HOST_ARCH"];
- dictionary["QT_CPU_FEATURES"] = dictionary["QT_HOST_CPU_FEATURES"];
- }
-
- QDir::setCurrent(oldpwd);
-}
-
-bool Configure::tryCompileProject(const QString &projectPath, const QString &extraOptions,
- bool distClean)
-{
- QString oldpwd = QDir::currentPath();
-
- QString newpwd = QString("%1/config.tests/%2").arg(buildPath, projectPath);
- if (!QDir().exists(newpwd) && !QDir().mkpath(newpwd)) {
- cout << "Failed to create directory " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
- dictionary["DONE"] = "error";
- return false;
- }
- if (!QDir::setCurrent(newpwd)) {
- cout << "Failed to change working directory to " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
- dictionary["DONE"] = "error";
- return false;
- }
-
- // run qmake
- QString command = QString("%1 %2 %3")
- .arg(QDir::toNativeSeparators(QDir(newpwd).relativeFilePath(buildPath + "/bin/qmake.exe")),
- QDir::toNativeSeparators(sourcePath + "/config.tests/" + projectPath),
- extraOptions);
-
- if (dictionary.contains("XQMAKESPEC")) {
- const QString qmakespec = dictionary["XQMAKESPEC"];
- if (qmakespec.startsWith("winrt") || qmakespec.startsWith("winphone"))
- command.append(" QMAKE_LFLAGS+=/ENTRY:main");
- addSysroot(&command);
- }
-
- if (verbose)
- cout << qPrintable(command) << endl;
- else
- command += " 2>&1";
-
- int code = 0;
- QString output = Environment::execute(command, &code);
- //cout << output << endl;
-
- if (code == 0) {
- // compile
- command = dictionary[ "MAKE" ];
- if (command.contains("nmake") || command.contains("jom"))
- command += " /NOLOGO";
- if (verbose)
- cout << qPrintable(command) << endl;
- else
- command += " -s 2>&1";
- output = Environment::execute(command, &code);
- //cout << output << endl;
-
- // clean up
- if (distClean)
- Environment::execute(command + " distclean 2>&1");
- }
-
- QDir::setCurrent(oldpwd);
- return code == 0;
-}
-
-bool Configure::compilerSupportsFlag(const QString &compilerAndArgs)
-{
- QFile file("conftest.cpp");
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- cout << "could not open temp file for writing" << endl;
- return false;
- }
- if (!file.write("int main() { return 0; }\r\n")) {
- cout << "could not write to temp file" << endl;
- return false;
- }
- file.close();
- // compilerAndArgs contains compiler because there is no way to query it
- QString command = compilerAndArgs + " -o conftest-out.o conftest.cpp";
- int code = 0;
- QString output = Environment::execute(command, &code);
- file.remove();
- QFile::remove("conftest-out.o");
- return code == 0;
-}
-
void Configure::generateQDevicePri()
{
FileWriter deviceStream(buildPath + "/mkspecs/qdevice.pri");
@@ -3461,299 +605,6 @@ void Configure::generateQDevicePri()
dictionary[ "DONE" ] = "error";
}
-void Configure::generateQConfigPri()
-{
- // Generate qconfig.pri
- {
- FileWriter configStream(buildPath + "/mkspecs/qconfig.pri");
-
- configStream << "CONFIG+= ";
- configStream << dictionary[ "BUILD" ];
- configStream << (dictionary[ "SHARED" ] == "no" ? " static" : " shared");
-
- if (dictionary["STATIC_RUNTIME"] == "yes")
- configStream << " static_runtime";
- if (dictionary[ "RTTI" ] == "yes")
- configStream << " rtti";
- if (dictionary["INCREDIBUILD_XGE"] == "yes")
- configStream << " incredibuild_xge";
- if (dictionary["PLUGIN_MANIFESTS"] == "no")
- configStream << " no_plugin_manifest";
- if (dictionary["CROSS_COMPILE"] == "yes")
- configStream << " cross_compile";
-
- if (dictionary[ "SLOG2" ] == "yes")
- configStream << " slog2";
-
- if (dictionary[ "QNX_IMF" ] == "yes")
- configStream << " qqnx_imf";
-
- if (dictionary[ "PPS" ] == "yes")
- configStream << " qqnx_pps";
-
- if (dictionary[ "LGMON" ] == "yes")
- configStream << " lgmon";
-
- if (dictionary["DIRECTWRITE"] == "yes")
- configStream << " directwrite";
-
- if (dictionary["DIRECTWRITE2"] == "yes")
- configStream << " directwrite2";
-
- if (dictionary["ANDROID_STYLE_ASSETS"] == "yes")
- configStream << " android-style-assets";
-
- // ### For compatibility only, should be removed later.
- configStream << " qpa";
-
- configStream << endl;
- configStream << "host_build {" << endl;
- configStream << " QT_ARCH = " << dictionary["QT_HOST_ARCH"] << endl;
- configStream << " QT_TARGET_ARCH = " << dictionary["QT_ARCH"] << endl;
- configStream << "} else {" << endl;
- configStream << " QT_ARCH = " << dictionary["QT_ARCH"] << endl;
- configStream << "}" << endl;
- configStream << "QT_CONFIG += " << qtConfig.join(' ') << endl;
-
- configStream << "#versioning " << endl
- << "QT_VERSION = " << dictionary["VERSION"] << endl
- << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
- << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
- << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
-
- configStream << endl
- << "QT_EDITION = " << dictionary["EDITION"] << endl;
-
- if (dictionary["EDITION"] != "OpenSource" && dictionary["EDITION"] != "Preview") {
- configStream << "QT_LICHECK = " << dictionary["LICHECK"] << endl;
- configStream << "QT_RELEASE_DATE = " << dictionary["RELEASEDATE"] << endl;
- }
-
- if (!dictionary["CFG_SYSROOT"].isEmpty() && dictionary["CFG_GCC_SYSROOT"] == "yes") {
- configStream << endl
- << "# sysroot" << endl
- << "!host_build {" << endl
- << " QMAKE_CFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
- << " QMAKE_CXXFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
- << " QMAKE_LFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
- << "}" << endl;
- }
-
- const QString targetOS = dictionary.value("TARGET_OS");
- if (!targetOS.isEmpty())
- configStream << "QMAKE_TARGET_OS = " << targetOS << endl;
-
- if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
- configStream << "QMAKE_RPATHDIR += " << formatPath(dictionary["QMAKE_RPATHDIR"]) << endl;
-
- if (!dictionary["QT_LIBINFIX"].isEmpty())
- configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
-
- if (!dictionary["QT_NAMESPACE"].isEmpty())
- configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
-
- if (dictionary[ "SHARED" ] == "no")
- configStream << "QT_DEFAULT_QPA_PLUGIN = q" << qpaPlatformName() << endl;
-
- if (!dictionary["QT_GCC_MAJOR_VERSION"].isEmpty()) {
- configStream << "QT_GCC_MAJOR_VERSION = " << dictionary["QT_GCC_MAJOR_VERSION"] << endl
- << "QT_GCC_MINOR_VERSION = " << dictionary["QT_GCC_MINOR_VERSION"] << endl
- << "QT_GCC_PATCH_VERSION = " << dictionary["QT_GCC_PATCH_VERSION"] << endl;
- } else if (!dictionary["QT_CL_MAJOR_VERSION"].isEmpty()) {
- configStream << "QT_CL_MAJOR_VERSION = " << dictionary["QT_CL_MAJOR_VERSION"] << endl
- << "QT_CL_MINOR_VERSION = " << dictionary["QT_CL_MINOR_VERSION"] << endl
- << "QT_CL_PATCH_VERSION = " << dictionary["QT_CL_PATCH_VERSION"] << endl;
- }
-
- if (dictionary.value("XQMAKESPEC").startsWith("wince")) {
- configStream << "#Qt for Windows CE c-runtime deployment" << endl
- << "QT_CE_C_RUNTIME = " << formatPath(dictionary["CE_CRT"]) << endl;
- }
-
- if (!configStream.flush())
- dictionary[ "DONE" ] = "error";
- }
-}
-
-QString Configure::addDefine(QString def)
-{
- QString result, defNeg, defD = def;
-
- defD.replace(QRegExp("=.*"), "");
- def.replace(QRegExp("="), " ");
-
- if (def.startsWith("QT_NO_")) {
- defNeg = defD;
- defNeg.replace("QT_NO_", "QT_");
- } else if (def.startsWith("QT_")) {
- defNeg = defD;
- defNeg.replace("QT_", "QT_NO_");
- }
-
- if (defNeg.isEmpty()) {
- result = "#ifndef $DEFD\n"
- "# define $DEF\n"
- "#endif\n\n";
- } else {
- result = "#if defined($DEFD) && defined($DEFNEG)\n"
- "# undef $DEFD\n"
- "#elif !defined($DEFD)\n"
- "# define $DEF\n"
- "#endif\n\n";
- }
- result.replace("$DEFNEG", defNeg);
- result.replace("$DEFD", defD);
- result.replace("$DEF", def);
- return result;
-}
-
-void Configure::generateConfigfiles()
-{
- {
- FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig.h");
-
- tmpStream << "#define QT_VERSION_MAJOR " << dictionary["VERSION_MAJOR"] << endl
- << "#define QT_VERSION_MINOR " << dictionary["VERSION_MINOR"] << endl
- << "#define QT_VERSION_PATCH " << dictionary["VERSION_PATCH"] << endl
- << "#define QT_VERSION_STR \"" << dictionary["VERSION"] << "\"\n"
- << endl;
-
- if (dictionary[ "QCONFIG" ] == "full") {
- tmpStream << "/* Everything */" << endl;
- } else {
- tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
- QFile inFile(dictionary["QCONFIG_PATH"]);
- if (inFile.open(QFile::ReadOnly)) {
- tmpStream << QTextStream(&inFile).readAll();
- inFile.close();
- }
- tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
- }
- tmpStream << endl;
-
- if (dictionary[ "SHARED" ] == "no") {
- tmpStream << "/* Qt was configured for a static build */" << endl
- << "#if !defined(QT_SHARED) && !defined(QT_STATIC)" << endl
- << "# define QT_STATIC" << endl
- << "#endif" << endl
- << endl;
- }
- tmpStream << "/* License information */" << endl;
- tmpStream << "#define QT_PRODUCT_LICENSEE \"" << dictionary[ "LICENSEE" ] << "\"" << endl;
- tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
- tmpStream << endl;
- if (dictionary["BUILDDEV"] == "yes") {
- dictionary["QMAKE_INTERNAL"] = "yes";
- tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
- tmpStream << "#define QT_BUILD_INTERNAL" << endl;
- tmpStream << endl;
- }
-
- tmpStream << endl << "// Compiler sub-arch support" << endl;
- if (dictionary[ "SSE2" ] == "yes")
- tmpStream << "#define QT_COMPILER_SUPPORTS_SSE2 1" << endl;
- if (dictionary[ "SSE3" ] == "yes")
- tmpStream << "#define QT_COMPILER_SUPPORTS_SSE3 1" << endl;
- if (dictionary[ "SSSE3" ] == "yes")
- tmpStream << "#define QT_COMPILER_SUPPORTS_SSSE3 1" << endl;
- if (dictionary[ "SSE4_1" ] == "yes")
- tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_1 1" << endl;
- if (dictionary[ "SSE4_2" ] == "yes")
- tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_2 1" << endl;
- if (dictionary[ "AVX" ] == "yes")
- tmpStream << "#define QT_COMPILER_SUPPORTS_AVX 1" << endl;
- if (dictionary[ "AVX2" ] == "yes")
- tmpStream << "#define QT_COMPILER_SUPPORTS_AVX2 1" << endl;
- foreach (const QString &avx512feature, dictionary[ "AVX512" ].split(' ', QString::SkipEmptyParts))
- tmpStream << "#define QT_COMPILER_SUPPRTS_" << avx512feature.toUpper() << " 1" << endl;
-
- if (dictionary["QREAL"] != "double") {
- tmpStream << "#define QT_COORD_TYPE " << dictionary["QREAL"] << endl;
- tmpStream << "#define QT_COORD_TYPE_STRING " << dictionary["QREAL_STRING"] << endl;
- }
-
- tmpStream << endl << "// Compile time features" << endl;
-
- QStringList qconfigList;
- if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
- if (dictionary["STYLE_FUSION"] != "yes") qconfigList += "QT_NO_STYLE_FUSION";
- if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
- qconfigList += "QT_NO_STYLE_WINDOWSXP";
- if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
-
- if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
- if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
- if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
- if (dictionary["ZLIB"] == "no") {
- qconfigList += "QT_NO_ZLIB";
- qconfigList += "QT_NO_COMPRESS";
- }
-
- if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
- if (dictionary["WIDGETS"] == "no") qconfigList += "QT_NO_WIDGETS";
- if (dictionary["GUI"] == "no") qconfigList += "QT_NO_GUI";
- if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
- if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG";
- if (dictionary["SSL"] == "no") qconfigList += "QT_NO_SSL";
- if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL";
- if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
- if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
- if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
- if (dictionary["HARFBUZZ"] == "no") qconfigList += "QT_NO_HARFBUZZ";
- if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
-
- if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
- if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
- if (dictionary["DYNAMICGL"] == "yes") qconfigList += "QT_OPENGL_DYNAMIC";
- if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
- if (dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
- if (dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
- if (dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
- if (dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
- if (dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
- if (dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
- if (dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
- if (dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
-
- if (dictionary["POSIX_IPC"] == "yes")
- qconfigList += "QT_POSIX_IPC";
- else if ((platform() != ANDROID) && (platform() != WINDOWS) && (platform() != WINDOWS_RT))
- qconfigList << "QT_NO_SYSTEMSEMAPHORE" << "QT_NO_SHAREDMEMORY";
-
- if (dictionary["FONT_CONFIG"] == "no") qconfigList += "QT_NO_FONTCONFIG";
-
- if (dictionary["NIS"] == "yes")
- qconfigList += "QT_NIS";
- else
- qconfigList += "QT_NO_NIS";
-
- if (dictionary["LARGE_FILE"] == "yes") qconfigList += "QT_LARGEFILE_SUPPORT=64";
- if (dictionary["QT_CUPS"] == "no") qconfigList += "QT_NO_CUPS";
- if (dictionary["QT_ICONV"] == "no") qconfigList += "QT_NO_ICONV";
- if (dictionary["QT_EVDEV"] == "no") qconfigList += "QT_NO_EVDEV";
- if (dictionary["QT_MTDEV"] == "no") qconfigList += "QT_NO_MTDEV";
- if (dictionary["QT_TSLIB"] == "no") qconfigList += "QT_NO_TSLIB";
- if (dictionary["QT_GLIB"] == "no") qconfigList += "QT_NO_GLIB";
- if (dictionary["QT_INOTIFY"] == "no") qconfigList += "QT_NO_INOTIFY";
- if (dictionary["QT_EVENTFD"] == "no") qconfigList += "QT_NO_EVENTFD";
- if (dictionary["ATOMIC64"] == "no") qconfigList += "QT_NO_STD_ATOMIC64";
-
- if (dictionary["REDUCE_EXPORTS"] == "yes") qconfigList += "QT_VISIBILITY_AVAILABLE";
- if (dictionary["REDUCE_RELOCATIONS"] == "yes") qconfigList += "QT_REDUCE_RELOCATIONS";
- if (dictionary["QT_GETIFADDRS"] == "no") qconfigList += "QT_NO_GETIFADDRS";
-
- qconfigList.sort();
- for (int i = 0; i < qconfigList.count(); ++i)
- tmpStream << addDefine(qconfigList.at(i));
-
- tmpStream<<"#define QT_QPA_DEFAULT_PLATFORM_NAME \"" << qpaPlatformName() << "\""<<endl;
-
- if (!tmpStream.flush())
- dictionary[ "DONE" ] = "error";
- }
-
-}
-
QString Configure::formatConfigPath(const char *var)
{
QString val = dictionary[var];
@@ -3764,254 +615,10 @@ QString Configure::formatConfigPath(const char *var)
return QDir::toNativeSeparators(val);
}
-void Configure::displayConfig()
-{
- fstream sout;
- sout.open(QString(buildPath + "/config.summary").toLocal8Bit().constData(),
- ios::in | ios::out | ios::trunc);
-
- // Give some feedback
- sout << "Environment:" << endl;
- QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\n ");
- if (env.isEmpty())
- env = "Unset";
- sout << " INCLUDE=\n " << env << endl;
- env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\n ");
- if (env.isEmpty())
- env = "Unset";
- sout << " LIB=\n " << env << endl;
- env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\n ");
- if (env.isEmpty())
- env = "Unset";
- sout << " PATH=\n " << env << endl;
-
- if (dictionary[QStringLiteral("EDITION")] != QLatin1String("OpenSource")) {
- QString l1 = dictionary[ "LICENSEE" ];
- QString l2 = dictionary[ "LICENSEID" ];
- QString l3 = dictionary["EDITION"] + ' ' + "Edition";
- QString l4 = dictionary[ "EXPIRYDATE" ];
- sout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
- sout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
- sout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
- sout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl;
- sout << endl;
- }
-
- sout << "Configuration:" << endl;
- sout << " " << qmakeConfig.join("\n ") << endl;
- sout << "Qt Configuration:" << endl;
- sout << " " << qtConfig.join("\n ") << endl;
- sout << endl;
-
- if (dictionary.contains("XQMAKESPEC"))
- sout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
- else
- sout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
- if (!dictionary["TARGET_OS"].isEmpty())
- sout << "Target OS..................." << dictionary["TARGET_OS"] << endl;
- sout << "Architecture................" << dictionary["QT_ARCH"]
- << ", features:" << dictionary["QT_CPU_FEATURES"] << endl;
- sout << "Host Architecture..........." << dictionary["QT_HOST_ARCH"]
- << ", features:" << dictionary["QT_HOST_CPU_FEATURES"] << endl;
- sout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
- if (dictionary[ "BUILDALL" ] == "yes") {
- sout << "Debug build................." << "yes (combined)" << endl;
- sout << "Default build..............." << dictionary[ "BUILD" ] << endl;
- } else {
- sout << "Debug......................." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
- }
- if (dictionary[ "BUILD" ] == "release" || dictionary[ "BUILDALL" ] == "yes")
- sout << "Force debug info............" << dictionary[ "FORCEDEBUGINFO" ] << endl;
- if (dictionary[ "BUILD" ] == "debug")
- sout << "Force optimized tools......." << dictionary[ "RELEASE_TOOLS" ] << endl;
- sout << "C++ language standard......." << dictionary[ "C++STD" ] << endl;
- sout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
- sout << "Using PCH .................." << dictionary[ "PCH" ] << endl;
- sout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
- sout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
- sout << "SSE support................."
- << (dictionary[ "SSE2" ] == "no" ? "<none>" : "SSE2")
- << (dictionary[ "SSE3" ] == "no" ? "" : " SSE3")
- << (dictionary[ "SSSE3" ] == "no" ? "" : " SSSE3")
- << (dictionary[ "SSE4_1" ] == "no" ? "" : " SSE4.1")
- << (dictionary[ "SSE4_2" ] == "no" ? "" : " SSE4.2")
- << endl;
- sout << "AVX support................."
- << (dictionary[ "AVX" ] == "no" ? "<none>" : "AVX")
- << (dictionary[ "AVX2" ] == "no" ? "" : " AVX2")
- << endl;
- sout << "AVX512 support.............."
- << (dictionary[ "AVX512" ].isEmpty() ? QString("<none>") : dictionary[ "AVX512" ].toUpper()) << endl;
- sout << "NEON support................" << dictionary[ "NEON" ] << endl;
- sout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
- sout << "Large File support.........." << dictionary[ "LARGE_FILE" ] << endl;
- sout << "NIS support................." << dictionary[ "NIS" ] << endl;
- sout << "Iconv support..............." << dictionary[ "QT_ICONV" ] << endl;
- sout << "Evdev support..............." << dictionary[ "QT_EVDEV" ] << endl;
- sout << "Mtdev support..............." << dictionary[ "QT_MTDEV" ] << endl;
- sout << "Inotify support............." << dictionary[ "QT_INOTIFY" ] << endl;
- sout << "eventfd(7) support.........." << dictionary[ "QT_EVENTFD" ] << endl;
- sout << "Glib support................" << dictionary[ "QT_GLIB" ] << endl;
- sout << "CUPS support................" << dictionary[ "QT_CUPS" ] << endl;
- sout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl;
- sout << "SSL support................." << dictionary[ "SSL" ] << endl;
- sout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
- sout << "libproxy support............" << dictionary[ "LIBPROXY" ] << endl;
- sout << "Qt D-Bus support............" << dictionary[ "DBUS" ] << endl;
- sout << "Qt Widgets module support..." << dictionary[ "WIDGETS" ] << endl;
- sout << "Qt GUI module support......." << dictionary[ "GUI" ] << endl;
- sout << "QML debugging..............." << dictionary[ "QML_DEBUG" ] << endl;
- sout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl;
- sout << "DirectWrite 2 support......." << dictionary[ "DIRECTWRITE2" ] << endl;
- sout << "Use system proxies.........." << dictionary[ "SYSTEM_PROXIES" ] << endl;
- sout << endl;
-
- sout << "QPA Backends:" << endl;
- sout << " GDI....................." << "yes" << endl;
- sout << " Direct2D................" << dictionary[ "DIRECT2D" ] << endl;
- sout << endl;
-
- sout << "Third Party Libraries:" << endl;
- sout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
- sout << " GIF support............." << dictionary[ "GIF" ] << endl;
- sout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
- sout << " PNG support............." << dictionary[ "PNG" ] << endl;
- sout << " DoubleConversion........" << dictionary[ "DOUBLECONVERSION" ] << endl;
- sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl;
- sout << " Fontconfig support......" << dictionary[ "FONT_CONFIG" ] << endl;
- sout << " HarfBuzz support........" << dictionary[ "HARFBUZZ" ] << endl;
- sout << " PCRE support............" << dictionary[ "PCRE" ] << endl;
- sout << " ICU support............." << dictionary[ "ICU" ] << endl;
- if (platform() == QNX) {
- sout << " SLOG2 support..........." << dictionary[ "SLOG2" ] << endl;
- sout << " IMF support............." << dictionary[ "QNX_IMF" ] << endl;
- sout << " PPS support............." << dictionary[ "PPS" ] << endl;
- sout << " LGMON support..........." << dictionary[ "LGMON" ] << endl;
- }
- sout << " ANGLE..................." << dictionary[ "ANGLE" ] << endl;
- sout << " Dynamic OpenGL.........." << dictionary[ "DYNAMICGL" ] << endl;
- sout << endl;
-
- sout << "Styles:" << endl;
- sout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
- sout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
- sout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
- sout << " Fusion.................." << dictionary[ "STYLE_FUSION" ] << endl;
- sout << endl;
-
- sout << "Sql Drivers:" << endl;
- sout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
- sout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
- sout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
- sout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
- sout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
- sout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
- sout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
- sout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
- sout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl;
- sout << endl;
-
- sout << "Sources are in.............." << QDir::toNativeSeparators(sourcePath) << endl;
- sout << "Build is done in............" << QDir::toNativeSeparators(buildPath) << endl;
- sout << "Install prefix.............." << QDir::toNativeSeparators(dictionary["QT_INSTALL_PREFIX"]) << endl;
- sout << "Headers installed to........" << formatConfigPath("QT_REL_INSTALL_HEADERS") << endl;
- sout << "Libraries installed to......" << formatConfigPath("QT_REL_INSTALL_LIBS") << endl;
- sout << "Arch-dep. data to..........." << formatConfigPath("QT_REL_INSTALL_ARCHDATA") << endl;
- sout << "Plugins installed to........" << formatConfigPath("QT_REL_INSTALL_PLUGINS") << endl;
- sout << "Library execs installed to.." << formatConfigPath("QT_REL_INSTALL_LIBEXECS") << endl;
- sout << "QML1 imports installed to..." << formatConfigPath("QT_REL_INSTALL_IMPORTS") << endl;
- sout << "QML2 imports installed to..." << formatConfigPath("QT_REL_INSTALL_QML") << endl;
- sout << "Binaries installed to......." << formatConfigPath("QT_REL_INSTALL_BINS") << endl;
- sout << "Arch-indep. data to........." << formatConfigPath("QT_REL_INSTALL_DATA") << endl;
- sout << "Docs installed to..........." << formatConfigPath("QT_REL_INSTALL_DOCS") << endl;
- sout << "Translations installed to..." << formatConfigPath("QT_REL_INSTALL_TRANSLATIONS") << endl;
- sout << "Examples installed to......." << formatConfigPath("QT_REL_INSTALL_EXAMPLES") << endl;
- sout << "Tests installed to.........." << formatConfigPath("QT_REL_INSTALL_TESTS") << endl;
-
- if (checkAvailability("INCREDIBUILD_XGE"))
- sout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
- if (!qmakeDefines.isEmpty()) {
- sout << "Defines.....................";
- for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs)
- sout << (*defs) << " ";
- sout << endl;
- }
- if (!qmakeIncludes.isEmpty()) {
- sout << "Include paths...............";
- for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs)
- sout << (*incs) << " ";
- sout << endl;
- }
- if (!qmakeLibs.isEmpty()) {
- sout << "Additional libraries........";
- for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs)
- sout << (*libs) << " ";
- sout << endl;
- }
- if (dictionary[ "QMAKE_INTERNAL" ] == "yes") {
- sout << "Using internal configuration." << endl;
- }
- if (dictionary[ "SHARED" ] == "no") {
- sout << "WARNING: Using static linking will disable the use of plugins." << endl;
- sout << " Make sure you compile ALL needed modules into the library." << endl;
- }
- if (dictionary[ "OPENSSL" ] == "linked") {
- if (!opensslLibsDebug.isEmpty() || !opensslLibsRelease.isEmpty()) {
- sout << "Using OpenSSL libraries:" << endl;
- sout << " debug : " << opensslLibsDebug << endl;
- sout << " release: " << opensslLibsRelease << endl;
- sout << " both : " << opensslLibs << endl;
- } else if (opensslLibs.isEmpty()) {
- sout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
- sout << "library names through OPENSSL_LIBS and optionally OPENSSL_LIBS_DEBUG/OPENSSL_LIBS_RELEASE" << endl;
- sout << "For example:" << endl;
- sout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl;
- }
- }
- if (dictionary[ "ZLIB_FORCED" ] == "yes") {
- QString which_zlib = "supplied";
- if (dictionary[ "ZLIB" ] == "system")
- which_zlib = "system";
-
- sout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
- << endl
- << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
- << "option was ignored. Qt will be built using the " << which_zlib
- << "zlib" << endl;
- }
- if (dictionary["OBSOLETE_ARCH_ARG"] == "yes") {
- sout << endl
- << "NOTE: The -arch option is obsolete." << endl
- << endl
- << "Qt now detects the target and host architectures based on compiler" << endl
- << "output. Qt will be built using " << dictionary["QT_ARCH"] << " for the target architecture" << endl
- << "and " << dictionary["QT_HOST_ARCH"] << " for the host architecture (note that these two" << endl
- << "will be the same unless you are cross-compiling)." << endl
- << endl;
- }
- if (dictionary["RELEASE_TOOLS"] == "yes" && dictionary["BUILD"] != "debug" ) {
- sout << endl
- << "NOTE: -optimized-tools is not useful in -release mode." << endl;
- }
- if (!dictionary["PREFIX_COMPLAINTS"].isEmpty()) {
- sout << endl
- << dictionary["PREFIX_COMPLAINTS"] << endl
- << endl;
- }
-
- // display config.summary
- sout.seekg(0, ios::beg);
- while (sout.good()) {
- string str;
- getline(sout, str);
- cout << str << endl;
- }
-}
-
void Configure::generateHeaders()
{
if (dictionary["SYNCQT"] == "auto")
- dictionary["SYNCQT"] = defaultTo("SYNCQT");
+ dictionary["SYNCQT"] = QFile::exists(sourcePath + "/.git") ? "yes" : "no";
if (dictionary["SYNCQT"] == "yes") {
if (!QStandardPaths::findExecutable(QStringLiteral("perl.exe")).isEmpty()) {
@@ -4206,11 +813,7 @@ void Configure::generateQConfigCpp()
// Generate the new qconfig.cpp file
{
FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig.cpp");
- tmpStream << "/* Licensed */" << endl
- << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << dictionary["LICENSEE"] << "\";" << endl
- << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
- << endl
- << "/* Build date */" << endl
+ tmpStream << "/* Build date */" << endl
<< "static const char qt_configure_installation [11 + 12] = \"qt_instdate=2012-12-20\";" << endl
<< endl
<< "/* Installation Info */" << endl
@@ -4238,9 +841,6 @@ void Configure::generateQConfigCpp()
<< "#ifdef QT_BUILD_QMAKE\n"
<< "# define QT_CONFIGURE_SYSROOTIFY_PREFIX " << (sysrootifyPrefix ? "true" : "false") << endl
<< "#endif\n\n"
- << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
- << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12" << endl
- << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12" << endl
<< endl
<< "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12\n"
<< "#ifdef QT_BUILD_QMAKE\n"
@@ -4255,7 +855,7 @@ void Configure::generateQConfigCpp()
void Configure::buildQmake()
{
- if (dictionary[ "BUILD_QMAKE" ] == "yes") {
+ {
QStringList args;
// Build qmake
@@ -4401,63 +1001,33 @@ void Configure::buildQmake()
}
-void Configure::generateMakefiles()
+void Configure::configure()
{
- QString pwd = QDir::currentPath();
- {
- QString sourcePathMangled = sourcePath;
- QString buildPathMangled = buildPath;
- if (dictionary.contains("TOPLEVEL")) {
- sourcePathMangled = QFileInfo(sourcePath).path();
- buildPathMangled = QFileInfo(buildPath).path();
- }
- QStringList args;
- args << buildPath + "/bin/qmake" << sourcePathMangled;
-
- QDir::setCurrent(buildPathMangled);
- if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
- cout << "Qmake failed, return code " << exitCode << endl << endl;
- dictionary[ "DONE" ] = "error";
- }
- }
- QDir::setCurrent(pwd);
-}
+ FileWriter ci(buildPath + "/config.tests/configure.cfg");
+ ci << "# Feature defaults set by configure command line\n"
+ << "config.input.qt_edition = " << dictionary["EDITION"] << "\n"
+ << "config.input.qt_licheck = " << dictionary["LICHECK"] << "\n"
+ << "config.input.qt_release_date = " << dictionary["RELEASEDATE"];
+ if (!ci.flush()) {
+ dictionary[ "DONE" ] = "error";
+ return;
+ }
-void Configure::showSummary()
-{
- QString make = dictionary[ "MAKE" ];
- cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
- cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
-}
+ QStringList args;
+ args << buildPath + "/bin/qmake"
+ << sourcePathMangled
+ << "--" << configCmdLine;
-Configure::ProjectType Configure::projectType(const QString& proFileName)
-{
- QFile proFile(proFileName);
- if (proFile.open(QFile::ReadOnly)) {
- QString buffer = proFile.readLine(1024);
- while (!buffer.isEmpty()) {
- QStringList segments = buffer.split(QRegExp("\\s"));
- QStringList::Iterator it = segments.begin();
-
- if (segments.size() >= 3) {
- QString keyword = (*it++);
- QString operation = (*it++);
- QString value = (*it++);
-
- if (keyword == "TEMPLATE") {
- if (value == "lib")
- return Lib;
- else if (value == "subdirs")
- return Subdirs;
- }
- }
- // read next line
- buffer = proFile.readLine(1024);
- }
- proFile.close();
+ QString pwd = QDir::currentPath();
+ QDir::setCurrent(buildPathMangled);
+ if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
+ cout << "Qmake failed, return code " << exitCode << endl << endl;
+ dictionary[ "DONE" ] = "error";
}
- // Default to app handling
- return App;
+ QDir::setCurrent(pwd);
+
+ if ((dictionary["REDO"] != "yes") && (dictionary["DONE"] != "error"))
+ saveCmdLine();
}
bool Configure::showLicense(QString orgLicenseFile)
@@ -4509,6 +1079,7 @@ bool Configure::showLicense(QString orgLicenseFile)
accept = tolower(accept);
if (accept == 'y') {
+ configCmdLine << "-confirm-license";
return true;
} else if (accept == 'n') {
return false;
@@ -4588,29 +1159,42 @@ void Configure::readLicense()
} else if (openSource) {
cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
dictionary["DONE"] = "error";
+ return;
}
else {
Tools::checkLicense(dictionary, sourcePath, buildPath);
}
+ if (dictionary["BUILDTYPE"] == "none") {
+ if (openSource)
+ configCmdLine << "-opensource";
+ else
+ configCmdLine << "-commercial";
+ }
}
-void Configure::reloadCmdLine()
+bool Configure::reloadCmdLine(int idx)
{
- if (dictionary[ "REDO" ] == "yes") {
- QFile inFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
- if (inFile.open(QFile::ReadOnly)) {
- QTextStream inStream(&inFile);
- while (!inStream.atEnd())
- configCmdLine += inStream.readLine().trimmed();
- inFile.close();
+ QFile inFile(buildPathMangled + "/config.opt");
+ if (!inFile.open(QFile::ReadOnly)) {
+ inFile.setFileName(buildPath + "/config.opt");
+ if (!inFile.open(QFile::ReadOnly)) {
+ inFile.setFileName(buildPath + "/configure.cache");
+ if (!inFile.open(QFile::ReadOnly)) {
+ cout << "No config.opt present - cannot redo configuration." << endl;
+ return false;
+ }
+ }
}
- }
+ QTextStream inStream(&inFile);
+ while (!inStream.atEnd())
+ configCmdLine.insert(idx++, inStream.readLine().trimmed());
+ return true;
}
void Configure::saveCmdLine()
{
if (dictionary[ "REDO" ] != "yes") {
- QFile outFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
+ QFile outFile(buildPathMangled + "/config.opt");
if (outFile.open(QFile::WriteOnly | QFile::Text)) {
QTextStream outStream(&outFile);
for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
@@ -4649,26 +1233,8 @@ QString Configure::platformName() const
}
}
-QString Configure::qpaPlatformName() const
-{
- switch (platform()) {
- default:
- case WINDOWS:
- return QStringLiteral("windows");
- case WINDOWS_RT:
- return QStringLiteral("winrt");
- case QNX:
- return QStringLiteral("qnx");
- case ANDROID:
- return QStringLiteral("android");
- case OTHER:
- return QStringLiteral("xcb");
- }
-}
-
int Configure::platform() const
{
- const QString qMakeSpec = dictionary.value("QMAKESPEC");
const QString xQMakeSpec = dictionary.value("XQMAKESPEC");
if ((xQMakeSpec.startsWith("winphone") || xQMakeSpec.startsWith("winrt")))
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index bd90ead703..b1c6ea9181 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -43,126 +43,50 @@ public:
~Configure();
void parseCmdLine();
- void validateArgs();
- bool displayHelp();
- QString defaultTo(const QString &option);
- bool checkAvailability(const QString &part);
void generateQConfigCpp();
void buildQmake();
- void autoDetection();
- bool verifyConfiguration();
- void generateOutputVars();
+ void prepareConfigureInput();
+ void configure();
+
void generateHeaders();
- void generateCachefile();
- void displayConfig();
- void generateMakefiles();
- void generateConfigfiles();
- void detectArch();
- void generateQConfigPri();
void generateQDevicePri();
void prepareConfigTests();
- void showSummary();
- QString firstLicensePath();
bool showLicense(QString licenseFile);
void readLicense();
- QString addDefine(QString def);
-
- enum ProjectType {
- App,
- Lib,
- Subdirs
- };
-
- ProjectType projectType( const QString& proFileName );
bool isDone();
bool isOk();
int platform() const;
QString platformName() const;
- QString qpaPlatformName() const;
private:
- bool checkAngleAvailability(QString *errorMessage = 0) const;
- QString checkAvx512Availability();
-
int verbose;
// Our variable dictionaries
QMap<QString,QString> dictionary;
- QStringList allBuildParts;
- QStringList defaultBuildParts;
- QStringList buildParts;
- QStringList nobuildParts;
- QStringList skipModules;
- QStringList licensedModules;
- QStringList allSqlDrivers;
- QStringList disabledModules;
- QStringList enabledModules;
- QStringList modules;
-// QStringList sqlDrivers;
QStringList configCmdLine;
- QStringList qmakeConfig;
- QStringList qtConfig;
-
- QStringList qmakeSql;
- QStringList qmakeSqlPlugins;
-
- QStringList qmakeStyles;
- QStringList qmakeStylePlugins;
-
- QStringList qmakeVars;
- QStringList qmakeDefines;
- QStringList qmakeIncludes;
- QStringList qmakeLibs;
- QString opensslLibs;
- QString opensslLibsDebug;
- QString opensslLibsRelease;
- QString opensslPath;
- QString dbusPath;
- QString dbusHostPath;
- QString mysqlPath;
- QString psqlLibs;
- QString zlibLibs;
- QString sybase;
- QString sybaseLibs;
QString outputLine;
QTextStream outStream;
QString sourcePath, buildPath;
+ QString sourcePathMangled, buildPathMangled;
QDir sourceDir, buildDir;
- // Variables for usage output
- int optionIndent;
- int descIndent;
- int outputWidth;
-
QString confStrOffsets[2];
QString confStrings[2];
int confStringOff;
void addConfStr(int group, const QString &val);
QString formatPath(const QString &path);
- QString formatPaths(const QStringList &paths);
- QString locateFile(const QString &fileName) const;
- bool findFile(const QString &fileName) const { return !locateFile(fileName).isEmpty(); }
- static QString findFileInPaths(const QString &fileName, const QStringList &paths);
- void reloadCmdLine();
+ bool reloadCmdLine(int idx);
void saveCmdLine();
- void addSysroot(QString *command);
- bool tryCompileProject(const QString &projectPath, const QString &extraOptions = QString(),
- bool distClean = true);
- bool compilerSupportsFlag(const QString &compilerAndArgs);
-
- void desc(const char *description, int startingAt = 0, int wrapIndent = 0);
- void desc(const char *option, const char *description, bool skipIndent = false, char fillChar = '.');
- void desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar = '.');
void applySpecSpecifics();
QString formatConfigPath(const char *var);
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index 1a05c9ce62..78298f1068 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -118,59 +118,6 @@ QString Environment::detectQMakeSpec()
return spec;
}
-Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec)
-{
- if (qmakeSpec == QLatin1String("win32-msvc2015"))
- return CC_MSVC2015;
- if (qmakeSpec == QLatin1String("win32-msvc2013"))
- return CC_MSVC2013;
- if (qmakeSpec == QLatin1String("win32-msvc2012"))
- return CC_MSVC2012;
- if (qmakeSpec == QLatin1String("win32-icc"))
- return CC_INTEL;
- if (qmakeSpec == QLatin1String("win32-g++"))
- return CC_MINGW;
- if (qmakeSpec == QLatin1String("win32-borland"))
- return CC_BORLAND;
- return CC_UNKNOWN;
-}
-
-QString Environment::gccVersion()
-{
- CompilerInfo *info = compilerInfo(CC_MINGW);
- int returnValue = 0;
- QString version = execute(QStringLiteral("%1 -dumpversion").arg(info->executable), &returnValue);
- if (returnValue != 0) {
- cout << "Could not get mingw version" << returnValue << qPrintable(version);
- version.resize(0);
- }
- return version;
-}
-
-QString Environment::msvcVersion()
-{
- int returnValue = 0;
- // Extract version from standard error output of "cl /?"
- const QString command = QFile::decodeName(qgetenv("ComSpec"))
- + QLatin1String(" /c ") + QLatin1String(compilerInfo(CC_MSVC2015)->executable)
- + QLatin1String(" /? 2>&1");
- QString version = execute(command, &returnValue);
- if (returnValue != 0) {
- cout << "Could not get cl version" << returnValue << qPrintable(version) << '\n';;
- version.clear();
- } else {
- QRegExp versionRegexp(QStringLiteral("^.*Compiler Version ([0-9.]+) for.*$"));
- Q_ASSERT(versionRegexp.isValid());
- if (versionRegexp.exactMatch(version)) {
- version = versionRegexp.cap(1);
- } else {
- cout << "Unable to determine cl version from the output of \""
- << qPrintable(command) << "\"\n";
- }
- }
- return version;
-}
-
/*!
Returns the enum of the compiler which was detected on the system.
The compilers are detected in the order as entered into the
@@ -455,189 +402,4 @@ QString Environment::execute(const QString &command, int *returnCode)
return output;
}
-/*!
- Copies the \a srcDir contents into \a destDir.
-
- Returns true if copying was successful.
-*/
-bool Environment::cpdir(const QString &srcDir, const QString &destDir)
-{
- QString cleanSrcName = QDir::cleanPath(srcDir);
- QString cleanDstName = QDir::cleanPath(destDir);
-
-#ifdef CONFIGURE_DEBUG_CP_DIR
- qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
-#endif
- if(!QFile::exists(cleanDstName) && !QDir().mkpath(cleanDstName)) {
- qDebug() << "cpdir: Failure to create " << cleanDstName;
- return false;
- }
-
- bool result = true;
- QDir dir = QDir(cleanSrcName);
- QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
- for (int i = 0; result && (i < allEntries.count()); ++i) {
- QFileInfo entry = allEntries.at(i);
- bool intermediate = true;
- if (entry.isDir()) {
- intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
- QString("%1/%2").arg(cleanDstName).arg(entry.fileName()));
- } else {
- QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
-#ifdef CONFIGURE_DEBUG_CP_DIR
- qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile;
-#endif
- QFile::remove(destFile);
- intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
- SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
- }
- if (!intermediate) {
- qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir();
- result = false;
- }
- }
- return result;
-}
-
-bool Environment::rmdir(const QString &name)
-{
- bool result = true;
- QString cleanName = QDir::cleanPath(name);
-
- QDir dir = QDir(cleanName);
- QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
- for (int i = 0; result && (i < allEntries.count()); ++i) {
- QFileInfo entry = allEntries.at(i);
- if (entry.isDir()) {
- result &= rmdir(entry.absoluteFilePath());
- } else {
- result &= QFile::remove(entry.absoluteFilePath());
- }
- }
- result &= dir.rmdir(cleanName);
- return result;
-}
-
-static QStringList splitPathList(const QString &path)
-{
-#if defined(Q_OS_WIN)
- QRegExp splitReg(QStringLiteral("[;,]"));
-#else
- QRegExp splitReg(QStringLiteral("[:]"));
-#endif
- QStringList result = path.split(splitReg, QString::SkipEmptyParts);
- const QStringList::iterator end = result.end();
- for (QStringList::iterator it = result.begin(); it != end; ++it) {
- // Remove any leading or trailing ", this is commonly used in the environment
- // variables
- if (it->startsWith('"'))
- it->remove(0, 1);
- if (it->endsWith('"'))
- it->chop(1);
- *it = QDir::cleanPath(*it);
- if (it->endsWith(QLatin1Char('/')))
- it->chop(1);
- }
- return result;
-}
-
-QString Environment::findFileInPaths(const QString &fileName, const QStringList &paths)
-{
- if (!paths.isEmpty()) {
- QDir d;
- const QChar separator = QDir::separator();
- foreach (const QString &path, paths)
- if (d.exists(path + separator + fileName))
- return path;
- }
- return QString();
-}
-
-QStringList Environment::path()
-{
- return splitPathList(QString::fromLocal8Bit(qgetenv("PATH")));
-}
-
-static QStringList mingwPaths(const QString &mingwPath, const QString &pathName)
-{
- QStringList ret;
- QDir mingwDir(mingwPath);
- const QFileInfoList subdirs = mingwDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
- for (int i = 0 ;i < subdirs.length(); ++i) {
- const QFileInfo &fi = subdirs.at(i);
- const QString name = fi.fileName();
- if (name == pathName)
- ret += fi.absoluteFilePath();
- else if (name.contains(QLatin1String("mingw"))) {
- ret += fi.absoluteFilePath() + QLatin1Char('/') + pathName;
- }
- }
- return ret;
-}
-
-// Return MinGW location from "c:\mingw\bin" -> "c:\mingw"
-static inline QString detectMinGW()
-{
- const QString gcc = QStandardPaths::findExecutable(QLatin1String("g++.exe"));
- return gcc.isEmpty() ?
- gcc : QFileInfo(QFileInfo(gcc).absolutePath()).absolutePath();
-}
-
-// Detect Direct X SDK up tp June 2010. Included in Windows Kit 8.
-QString Environment::detectDirectXSdk()
-{
- const QByteArray directXSdkEnv = qgetenv("DXSDK_DIR");
- if (directXSdkEnv.isEmpty())
- return QString();
- QString directXSdk = QDir::cleanPath(QString::fromLocal8Bit(directXSdkEnv));
- if (directXSdk.endsWith(QLatin1Char('/')))
- directXSdk.truncate(directXSdk.size() - 1);
- return directXSdk;
-}
-
-QStringList Environment::headerPaths(Compiler compiler)
-{
- QStringList headerPaths;
- if (compiler == CC_MINGW) {
- const QString mingwPath = detectMinGW();
- headerPaths = mingwPaths(mingwPath, QLatin1String("include"));
- // Additional compiler paths
- const QFileInfoList mingwConfigs = QDir(mingwPath + QLatin1String("/lib/gcc")).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
- for (int i = 0; i < mingwConfigs.length(); ++i) {
- const QDir mingwLibDir = mingwConfigs.at(i).absoluteFilePath();
- foreach (const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
- headerPaths += version.absoluteFilePath() + QLatin1String("/include");
- }
- } else {
- headerPaths = splitPathList(QString::fromLocal8Bit(getenv("INCLUDE")));
- }
-
- // Add Direct X SDK for ANGLE
- const QString directXSdk = detectDirectXSdk();
- if (!directXSdk.isEmpty()) // Add Direct X SDK for ANGLE
- headerPaths += directXSdk + QLatin1String("/include");
- return headerPaths;
-}
-
-QStringList Environment::libraryPaths(Compiler compiler)
-{
- QStringList libraryPaths;
- if (compiler == CC_MINGW) {
- libraryPaths = mingwPaths(detectMinGW(), "lib");
- } else {
- libraryPaths = splitPathList(QString::fromLocal8Bit(qgetenv("LIB")));
- }
-
- // Add Direct X SDK for ANGLE
- const QString directXSdk = detectDirectXSdk();
- if (!directXSdk.isEmpty()) {
-#ifdef Q_OS_WIN64
- libraryPaths += directXSdk + QLatin1String("/lib/x64");
-#else
- libraryPaths += directXSdk + QLatin1String("/lib/x86");
-#endif
- }
- return libraryPaths;
-}
-
QT_END_NAMESPACE
diff --git a/tools/configure/environment.h b/tools/configure/environment.h
index 344404505e..d14961b5ac 100644
--- a/tools/configure/environment.h
+++ b/tools/configure/environment.h
@@ -50,21 +50,9 @@ class Environment
public:
static Compiler detectCompiler();
static QString detectQMakeSpec();
- static Compiler compilerFromQMakeSpec(const QString &qmakeSpec);
- static QString gccVersion();
- static QString msvcVersion();
static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
static QString execute(const QString &command, int *returnCode = 0);
- static bool cpdir(const QString &srcDir, const QString &destDir);
- static bool rmdir(const QString &name);
-
- static QString findFileInPaths(const QString &fileName, const QStringList &paths);
- static QStringList path();
-
- static QString detectDirectXSdk();
- static QStringList headerPaths(Compiler compiler);
- static QStringList libraryPaths(Compiler compiler);
private:
static Compiler detectedCompiler;
diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp
index d4f654150e..91a99c16c2 100644
--- a/tools/configure/main.cpp
+++ b/tools/configure/main.cpp
@@ -42,11 +42,8 @@ int runConfigure( int argc, char** argv )
return 3;
app.parseCmdLine();
- app.validateArgs();
if (!app.isOk())
return 3;
- if( app.displayHelp() )
- return 1;
// Read license now, and exit if it doesn't pass.
// This lets the user see the command-line options of configure
@@ -78,32 +75,11 @@ int runConfigure( int argc, char** argv )
if (!app.isOk())
return 3;
- // Auto-detect modules and settings.
- app.autoDetection();
-
- // After reading all command-line arguments, and doing all the
- // auto-detection, it's time to do some last minute validation.
- // If the validation fails, we cannot continue.
- if (!app.verifyConfiguration())
+ // run qmake based configure
+ app.configure();
+ if (!app.isOk())
return 3;
- app.generateOutputVars();
-
- if( !app.isDone() )
- app.generateCachefile();
- if( !app.isDone() )
- app.generateConfigfiles();
- if (!app.isDone())
- app.generateQConfigPri();
- if (!app.isDone())
- app.displayConfig();
- if( !app.isDone() )
- app.generateMakefiles();
- if( !app.isDone() )
- app.showSummary();
- if( !app.isOk() )
- return 2;
-
return 0;
}
diff --git a/util/lexgen/configfile.h b/util/lexgen/configfile.h
index 1bba26e980..da891ea836 100644
--- a/util/lexgen/configfile.h
+++ b/util/lexgen/configfile.h
@@ -31,6 +31,7 @@
#include <QStringList>
#include <QMap>
#include <QVector>
+#include <QIODevice>
struct ConfigFile
{
diff --git a/util/lexgen/css2-simplified.lexgen b/util/lexgen/css3-simplified.lexgen
index 53facb1d4a..99463d524e 100644
--- a/util/lexgen/css2-simplified.lexgen
+++ b/util/lexgen/css3-simplified.lexgen
@@ -5,7 +5,7 @@ classname = QCssScanner_Generated
[Code Generator Options]
MapToCode[a-z] = (ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256
TokenPrefix = QCss::
-FileHeader = ../moc/licenseheader.txt
+FileHeader = ../../src/tools/moc/util/licenseheader.txt
[Macros]
escape = \\[^\r\n\f0-9a-f]
@@ -36,11 +36,15 @@ CDO = "<!--"
CDC = "-->"
INCLUDES = "~="
DASHMATCH = "|="
+BEGINSWITH = "^="
+ENDSWITH = "$="
+CONTAINS = "*="
LBRACE = {w}"{"
PLUS = {w}"+"
GREATER = {w}">"
COMMA = {w}","
+TILDE= {w}"~"
STRING = {string}
INVALID = {invalid}