summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xbin/syncqt4
-rw-r--r--config.tests/qws/ahi/ahi.pro3
-rw-r--r--config.tests/qws/directfb/directfb.pro5
-rw-r--r--config.tests/qws/sound/sound.pro2
-rw-r--r--config.tests/qws/svgalib/svgalib.pro3
-rwxr-xr-xconfig.tests/unix/endian.test6
-rwxr-xr-xconfigure552
-rw-r--r--dist/changes-5.0.05
-rw-r--r--doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp2
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qevent.cpp14
-rw-r--r--examples/animation/sub-attaq/mainwindow.cpp12
-rw-r--r--examples/animation/sub-attaq/pixmapitem.cpp4
-rw-r--r--examples/animation/sub-attaq/sub-attaq.pro3
-rw-r--r--examples/dbus/complexpingpong/complexping.pro5
-rw-r--r--examples/dbus/complexpingpong/complexpong.pro5
-rw-r--r--examples/dbus/dbus-chat/dbus-chat.pro6
-rw-r--r--examples/dbus/listnames/listnames.pro5
-rw-r--r--examples/dbus/pingpong/ping.pro6
-rw-r--r--examples/dbus/pingpong/pong.pro6
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.pro10
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.pro10
-rw-r--r--examples/embedded/styleexample/styleexample.pro5
-rw-r--r--examples/graphicsview/boxes/boxes.pro12
-rw-r--r--examples/graphicsview/flowlayout/flowlayout.pro6
-rw-r--r--examples/graphicsview/padnavigator/padnavigator.pro3
-rw-r--r--examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro6
-rw-r--r--examples/itemviews/interview/model.cpp2
-rw-r--r--examples/itemviews/spreadsheet/spreadsheet.pro12
-rw-r--r--examples/network/download/download.pro9
-rw-r--r--examples/network/downloadmanager/downloadmanager.pro10
-rw-r--r--examples/network/torrent/trackerclient.cpp4
-rw-r--r--examples/opengl/hellogl_es/hellogl_es.pro7
-rw-r--r--examples/opengl/hellogl_es2/hellogl_es2.pro11
-rw-r--r--examples/opengl/hellowindow/hellowindow.pro9
-rw-r--r--examples/opengl/paintedwindow/paintedwindow.pro10
-rw-r--r--examples/opengl/pbuffers2/pbuffers2.pro10
-rw-r--r--examples/painting/affine/affine.pro3
-rw-r--r--examples/painting/composition/composition.pro3
-rw-r--r--examples/painting/deform/deform.pro3
-rw-r--r--examples/painting/gradients/gradients.pro3
-rw-r--r--examples/painting/pathstroke/pathstroke.pro3
-rw-r--r--examples/qpa/windows/windows.pro14
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.pro9
-rw-r--r--examples/qtconcurrent/map/map.pro6
-rw-r--r--examples/qtconcurrent/progressdialog/progressdialog.pro10
-rw-r--r--examples/qtconcurrent/runfunction/runfunction.pro10
-rw-r--r--examples/qtconcurrent/wordcount/wordcount.pro10
-rw-r--r--examples/threads/waitconditions/waitconditions.pro11
-rw-r--r--examples/tools/echoplugin/echowindow/echointerface.h6
-rw-r--r--examples/tools/echoplugin/plugin/echoplugin.cpp4
-rw-r--r--examples/tools/echoplugin/plugin/echoplugin.h2
-rw-r--r--examples/tools/echoplugin/plugin/echoplugin.json1
-rw-r--r--examples/tools/echoplugin/plugin/plugin.pro1
-rw-r--r--examples/tools/plugandpaint/interfaces.h16
-rw-r--r--examples/tools/plugandpaint/main.cpp4
-rw-r--r--examples/tools/plugandpaintplugins/basictools/basictools.json1
-rw-r--r--examples/tools/plugandpaintplugins/basictools/basictools.pro1
-rw-r--r--examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp6
-rw-r--r--examples/tools/plugandpaintplugins/basictools/basictoolsplugin.h2
-rw-r--r--examples/tools/plugandpaintplugins/extrafilters/extrafilters.json1
-rw-r--r--examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro1
-rw-r--r--examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp2
-rw-r--r--examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h2
-rw-r--r--examples/tools/styleplugin/plugin/plugin.pro1
-rw-r--r--examples/tools/styleplugin/plugin/simplestyle.json3
-rw-r--r--examples/tools/styleplugin/plugin/simplestyleplugin.cpp4
-rw-r--r--examples/tools/styleplugin/plugin/simplestyleplugin.h3
-rw-r--r--examples/widgets/validators/validators.pro12
-rw-r--r--mkspecs/cmake/Qt5BasicConfig.cmake.in95
-rw-r--r--mkspecs/common/qcc-base.conf2
-rw-r--r--mkspecs/features/create_cmake.prf74
-rw-r--r--mkspecs/features/opengles1.prf2
-rw-r--r--mkspecs/features/qt.prf2
-rw-r--r--mkspecs/features/qt_config.prf7
-rw-r--r--mkspecs/features/qt_targets.prf2
-rw-r--r--qmake/generators/makefile.cpp9
-rw-r--r--qmake/generators/projectgenerator.cpp12
-rw-r--r--qmake/generators/win32/winmakefile.cpp6
-rw-r--r--qmake/main.cpp5
-rw-r--r--qmake/option.cpp39
-rw-r--r--qmake/option.h2
-rw-r--r--qmake/project.cpp58
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp28
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-thai.c15
-rw-r--r--src/3rdparty/rfc6234/sha-private.h28
-rw-r--r--src/3rdparty/rfc6234/sha.h357
-rw-r--r--src/3rdparty/rfc6234/sha224-256.c583
-rw-r--r--src/3rdparty/rfc6234/sha384-512.c1034
-rw-r--r--src/concurrent/qfuturewatcher.h6
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in64
-rw-r--r--src/corelib/Qt5CoreMacros.cmake2
-rw-r--r--src/corelib/codecs/qtextcodec.cpp30
-rw-r--r--src/corelib/codecs/qtextcodec.h5
-rw-r--r--src/corelib/global/qcompilerdetection.h77
-rw-r--r--src/corelib/global/qglobal.h45
-rw-r--r--src/corelib/global/qlibraryinfo.cpp67
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/global/qnamespace.qdoc3
-rw-r--r--src/corelib/io/qsettings_p.h2
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp2
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp6
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp6
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp5
-rw-r--r--src/corelib/kernel/qeventloop.cpp41
-rw-r--r--src/corelib/kernel/qeventloop.h1
-rw-r--r--src/corelib/kernel/qmetatype.cpp20
-rw-r--r--src/corelib/kernel/qmetatype.h75
-rw-r--r--src/corelib/kernel/qmetatype_p.h47
-rw-r--r--src/corelib/kernel/qmetatypeswitcher_p.h31
-rw-r--r--src/corelib/kernel/qobject.cpp6
-rw-r--r--src/corelib/kernel/qobject_impl.h1
-rw-r--r--src/corelib/kernel/qobjectdefs.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp98
-rw-r--r--src/corelib/kernel/qvariant.h20
-rw-r--r--src/corelib/kernel/qvariant_p.h11
-rw-r--r--src/corelib/mimetypes/qmimemagicrule_p.h1
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp1
-rw-r--r--src/corelib/mimetypes/qmimetypeparser.cpp42
-rw-r--r--src/corelib/mimetypes/qmimetypeparser_p.h24
-rw-r--r--src/corelib/thread/qthread.cpp9
-rw-r--r--src/corelib/thread/qthread.h2
-rw-r--r--src/corelib/thread/qthread_p.h17
-rw-r--r--src/corelib/thread/qthread_win.cpp27
-rw-r--r--src/corelib/tools/qchar.cpp63
-rw-r--r--src/corelib/tools/qchar.h13
-rw-r--r--src/corelib/tools/qcryptographichash.cpp106
-rw-r--r--src/corelib/tools/qcryptographichash.h6
-rw-r--r--src/corelib/tools/qeasingcurve.cpp1
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qlocale.qdoc4
-rw-r--r--src/corelib/tools/qlocale_win.cpp2
-rw-r--r--src/corelib/tools/qregexp.cpp2
-rw-r--r--src/corelib/tools/qstring.cpp76
-rw-r--r--src/corelib/tools/qstring.h13
-rw-r--r--src/corelib/tools/qstringbuilder.cpp29
-rw-r--r--src/corelib/tools/qstringbuilder.h44
-rw-r--r--src/dbus/qdbusargument.cpp6
-rw-r--r--src/gui/accessible/qaccessible.cpp6
-rw-r--r--src/gui/accessible/qaccessible.h8
-rw-r--r--src/gui/accessible/qaccessible2.cpp8
-rw-r--r--src/gui/accessible/qaccessiblebridge.cpp2
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp1
-rw-r--r--src/gui/accessible/qaccessibleplugin.cpp1
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qevent.cpp78
-rw-r--r--src/gui/kernel/qevent.h24
-rw-r--r--src/gui/kernel/qguiapplication.cpp330
-rw-r--r--src/gui/kernel/qguiapplication_p.h16
-rw-r--r--src/gui/kernel/qguivariant.cpp11
-rw-r--r--src/gui/kernel/qinputmethod.cpp4
-rw-r--r--src/gui/kernel/qkeysequence.cpp322
-rw-r--r--src/gui/kernel/qkeysequence_p.h1
-rw-r--r--src/gui/kernel/qopenglcontext.cpp276
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h2
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.cpp24
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h17
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp151
-rw-r--r--src/gui/kernel/qwindow.cpp596
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp49
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h3
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h12
-rw-r--r--src/gui/opengl/qopengl.cpp3
-rw-r--r--src/gui/opengl/qopenglbuffer.cpp44
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp22
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp6
-rw-r--r--src/gui/painting/qbrush.cpp6
-rw-r--r--src/gui/painting/qcolor.cpp6
-rw-r--r--src/gui/painting/qfixed_p.h139
-rw-r--r--src/gui/painting/qpen.cpp6
-rw-r--r--src/gui/painting/qpolygon.cpp12
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp40
-rw-r--r--src/gui/text/qcssparser_p.h21
-rw-r--r--src/gui/text/qtextengine.cpp17
-rw-r--r--src/network/ssl/qsslerror.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp4
-rw-r--r--src/opengl/qgl.cpp2
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/fontconfig.pri4
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp19
-rw-r--r--src/platformsupport/udev/qudevhelper_p.h1
-rw-r--r--src/platformsupport/udev/qudevicehelper.cpp235
-rw-r--r--src/platformsupport/udev/qudevicehelper_p.h98
-rw-r--r--src/platformsupport/udev/udev.pri4
-rw-r--r--src/plugins/accessible/widgets/main.cpp10
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp2
-rw-r--r--src/plugins/accessible/widgets/widgets.json52
-rw-r--r--src/plugins/bearer/connman/connman.json3
-rw-r--r--src/plugins/bearer/connman/connman.pro2
-rw-r--r--src/plugins/bearer/connman/main.cpp8
-rw-r--r--src/plugins/bearer/corewlan/corewlan.json3
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro2
-rw-r--r--src/plugins/bearer/corewlan/main.cpp8
-rw-r--r--src/plugins/bearer/generic/generic.json3
-rw-r--r--src/plugins/bearer/generic/generic.pro2
-rw-r--r--src/plugins/bearer/generic/main.cpp8
-rw-r--r--src/plugins/bearer/nativewifi/main.cpp8
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.json3
-rw-r--r--src/plugins/bearer/nativewifi/nativewifi.pro2
-rw-r--r--src/plugins/bearer/networkmanager/main.cpp8
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.json3
-rw-r--r--src/plugins/bearer/networkmanager/networkmanager.pro2
-rw-r--r--src/plugins/bearer/nla/main.cpp8
-rw-r--r--src/plugins/bearer/nla/nla.json3
-rw-r--r--src/plugins/bearer/nla/nla.pro4
-rw-r--r--src/plugins/generic/evdevkeyboard/evdevkeyboard.json3
-rw-r--r--src/plugins/generic/evdevkeyboard/evdevkeyboard.pro5
-rw-r--r--src/plugins/generic/evdevkeyboard/main.cpp7
-rw-r--r--src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp188
-rw-r--r--src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h21
-rw-r--r--src/plugins/generic/evdevmouse/evdevmouse.json3
-rw-r--r--src/plugins/generic/evdevmouse/evdevmouse.pro3
-rw-r--r--src/plugins/generic/evdevmouse/main.cpp7
-rw-r--r--src/plugins/generic/evdevtouch/evdevtouch.json3
-rw-r--r--src/plugins/generic/evdevtouch/evdevtouch.pro3
-rw-r--r--src/plugins/generic/evdevtouch/main.cpp7
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h2
-rw-r--r--src/plugins/platforminputcontexts/maliit/qmaliitplatforminputcontext.h2
-rw-r--r--src/plugins/platforms/blackberry/blackberry.pro71
-rw-r--r--src/plugins/platforms/blackberry/main.cpp72
-rw-r--r--src/plugins/platforms/blackberry/qbbbuffer.cpp165
-rw-r--r--src/plugins/platforms/blackberry/qbbbuffer.h74
-rw-r--r--src/plugins/platforms/blackberry/qbbclipboard.cpp132
-rw-r--r--src/plugins/platforms/blackberry/qbbclipboard.h (renamed from config.tests/qws/svgalib/svgalib.cpp)36
-rw-r--r--src/plugins/platforms/blackberry/qbbeventthread.cpp559
-rw-r--r--src/plugins/platforms/blackberry/qbbeventthread.h90
-rw-r--r--src/plugins/platforms/blackberry/qbbglbackingstore.cpp189
-rw-r--r--src/plugins/platforms/blackberry/qbbglbackingstore.h95
-rw-r--r--src/plugins/platforms/blackberry/qbbglcontext.cpp356
-rw-r--r--src/plugins/platforms/blackberry/qbbglcontext.h93
-rw-r--r--src/plugins/platforms/blackberry/qbbinputcontext_imf.cpp1696
-rw-r--r--src/plugins/platforms/blackberry/qbbinputcontext_imf.h132
-rw-r--r--src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp187
-rw-r--r--src/plugins/platforms/blackberry/qbbinputcontext_noimf.h84
-rw-r--r--src/plugins/platforms/blackberry/qbbintegration.cpp293
-rw-r--r--src/plugins/platforms/blackberry/qbbintegration.h119
-rw-r--r--src/plugins/platforms/blackberry/qbbkeytranslator.h269
-rw-r--r--src/plugins/platforms/blackberry/qbbnavigatorthread.cpp279
-rw-r--r--src/plugins/platforms/blackberry/qbbnavigatorthread.h78
-rw-r--r--src/plugins/platforms/blackberry/qbbrasterbackingstore.cpp166
-rw-r--r--src/plugins/platforms/blackberry/qbbrasterbackingstore.h81
-rw-r--r--src/plugins/platforms/blackberry/qbbrootwindow.cpp257
-rw-r--r--src/plugins/platforms/blackberry/qbbrootwindow.h81
-rw-r--r--src/plugins/platforms/blackberry/qbbscreen.cpp315
-rw-r--r--src/plugins/platforms/blackberry/qbbscreen.h121
-rw-r--r--src/plugins/platforms/blackberry/qbbvirtualkeyboard.cpp500
-rw-r--r--src/plugins/platforms/blackberry/qbbvirtualkeyboard.h130
-rw-r--r--src/plugins/platforms/blackberry/qbbwindow.cpp665
-rw-r--r--src/plugins/platforms/blackberry/qbbwindow.h133
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm21
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm13
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm48
-rw-r--r--src/plugins/platforms/directfb/directfb.json3
-rw-r--r--src/plugins/platforms/directfb/directfb.pro2
-rw-r--r--src/plugins/platforms/directfb/main.cpp6
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.cpp62
-rw-r--r--src/plugins/platforms/platforms.pro4
-rw-r--r--src/plugins/platforms/vnc/qvncserver.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp179
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp181
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp18
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp24
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h1
-rw-r--r--src/plugins/platforms/xlib/qxlibclipboard.cpp1
-rw-r--r--src/plugins/printsupport/windows/main.cpp4
-rw-r--r--src/plugins/printsupport/windows/windows.json3
-rw-r--r--src/plugins/printsupport/windows/windows.pro2
-rw-r--r--src/plugins/sqldrivers/db2/db2.json3
-rw-r--r--src/plugins/sqldrivers/db2/db2.pro1
-rw-r--r--src/plugins/sqldrivers/db2/main.cpp12
-rw-r--r--src/plugins/sqldrivers/ibase/ibase.json3
-rw-r--r--src/plugins/sqldrivers/ibase/ibase.pro1
-rw-r--r--src/plugins/sqldrivers/ibase/main.cpp12
-rw-r--r--src/plugins/sqldrivers/mysql/main.cpp8
-rw-r--r--src/plugins/sqldrivers/mysql/mysql.json3
-rw-r--r--src/plugins/sqldrivers/mysql/mysql.pro1
-rw-r--r--src/plugins/sqldrivers/oci/main.cpp8
-rw-r--r--src/plugins/sqldrivers/oci/oci.json3
-rw-r--r--src/plugins/sqldrivers/oci/oci.pro1
-rw-r--r--src/plugins/sqldrivers/odbc/main.cpp8
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.json3
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro1
-rw-r--r--src/plugins/sqldrivers/psql/main.cpp8
-rw-r--r--src/plugins/sqldrivers/psql/psql.json3
-rw-r--r--src/plugins/sqldrivers/psql/psql.pro1
-rw-r--r--src/plugins/sqldrivers/sqlite/smain.cpp12
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.json3
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.pro1
-rw-r--r--src/plugins/sqldrivers/sqlite2/smain.cpp12
-rw-r--r--src/plugins/sqldrivers/sqlite2/sqlite2.json3
-rw-r--r--src/plugins/sqldrivers/sqlite2/sqlite2.pro1
-rw-r--r--src/plugins/sqldrivers/tds/main.cpp8
-rw-r--r--src/plugins/sqldrivers/tds/tds.json3
-rw-r--r--src/plugins/sqldrivers/tds/tds.pro1
-rw-r--r--src/printsupport/kernel/qprinterinfo_unix.cpp1
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.cpp4
-rw-r--r--src/sql/kernel/qsqlfield.cpp6
-rw-r--r--src/sql/models/qsqltablemodel.cpp99
-rw-r--r--src/src.pro4
-rw-r--r--src/testlib/qplaintestlogger.cpp16
-rw-r--r--src/testlib/qtestcase.cpp8
-rw-r--r--src/testlib/testlib.pro1
-rw-r--r--src/tools/moc/generator.cpp12
-rw-r--r--src/tools/moc/outputrevision.h2
-rw-r--r--src/tools/moc/util/generate_keywords.pro8
-rw-r--r--src/tools/rcc/rcc.cpp2
-rw-r--r--src/tools/tools.pro4
-rw-r--r--src/tools/uic/driver.cpp1
-rw-r--r--src/tools/uic/uic.cpp1
-rw-r--r--src/widgets/Qt5WidgetsConfigExtras.cmake.in7
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp2
-rw-r--r--src/widgets/dialogs/qdialog.cpp10
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp10
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp6
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp2
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp8
-rw-r--r--src/widgets/itemviews/qheaderview.cpp20
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp3
-rw-r--r--src/widgets/itemviews/qstandarditemmodel.cpp3
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp3
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp3
-rw-r--r--src/widgets/kernel/qaction.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp664
-rw-r--r--src/widgets/kernel/qapplication.h52
-rw-r--r--src/widgets/kernel/qapplication_p.h4
-rw-r--r--src/widgets/kernel/qicon.cpp5
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp2
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp8
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp19
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp19
-rw-r--r--src/widgets/util/qcompleter.cpp3
-rw-r--r--src/widgets/util/qscrollerproperties.cpp2
-rw-r--r--src/widgets/util/qundoview.cpp3
-rw-r--r--src/widgets/widgets/qcombobox.cpp21
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp3
-rw-r--r--src/widgets/widgets/qlineedit.cpp3
-rw-r--r--src/widgets/widgets/qmenu.cpp46
-rw-r--r--src/widgets/widgets/qmenubar.cpp6
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp49
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h3
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp4
-rw-r--r--src/widgets/widgets/qworkspace.cpp11
-rw-r--r--src/xml/dom/qdom.cpp12
-rw-r--r--tests/auto/corelib/io/qresourceengine/qresourceengine.pro1
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp19
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp9
-rw-r--r--tests/auto/corelib/kernel/qobject/qobject.pro8
-rw-r--r--tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro5
-rw-r--r--tests/auto/corelib/kernel/qobject/test/test.pro (renamed from tests/auto/corelib/kernel/qobject/tst_qobject.pro)6
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/lib.pro8
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro11
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst/tst.pro2
-rw-r--r--tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp11
-rw-r--r--tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp11
-rw-r--r--tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp10
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp2
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h2
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/empty.json1
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h8
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp3
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h2
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp49
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/crashOnExit.pro8
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/crashonexit/crashOnExit.cpp (renamed from tests/auto/corelib/thread/qthreadstorage/crashOnExit.cpp)0
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro9
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro6
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/test/test.pro6
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp54
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.pro4
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp16
-rw-r--r--tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro1
-rw-r--r--tests/auto/corelib/tools/qlocale/test/test.pro5
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp120
-rw-r--r--tests/auto/corelib/tools/qregexp/tst_qregexp.cpp29
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp18
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp16
-rw-r--r--tests/auto/dbus/qdbusmarshall/common.h2
-rw-r--r--tests/auto/gui/kernel/qclipboard/copier/copier.pro7
-rw-r--r--tests/auto/gui/kernel/qclipboard/paster/paster.pro8
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp44
-rw-r--r--tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp116
-rw-r--r--tests/auto/gui/kernel/qkeysequence/qkeysequence.pro2
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp59
-rw-r--r--tests/auto/gui/painting/qpainter/utils/createImages/createImages.pro8
-rw-r--r--tests/auto/gui/text/qtextscriptengine/generate/generate.pro9
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp42
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp17
-rw-r--r--tests/auto/network/socket/qlocalsocket/example/client/client.pro6
-rw-r--r--tests/auto/network/socket/qlocalsocket/example/server/server.pro8
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp1
-rw-r--r--tests/auto/other/atwrapper/atWrapper.pro4
-rw-r--r--tests/auto/other/collections/tst_collections.cpp7
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp4
-rw-r--r--tests/auto/other/languagechange/languagechange.pro2
-rw-r--r--tests/auto/other/languagechange/tst_languagechange.cpp14
-rw-r--r--tests/auto/other/macgui/macgui.pro4
-rw-r--r--tests/auto/other/macnativeevents/macnativeevents.pro4
-rw-r--r--tests/auto/other/macplist/app/app.pro11
-rw-r--r--tests/auto/other/other.pro2
-rw-r--r--tests/auto/shared/platforminputcontext.h (renamed from tests/auto/widgets/shared/platforminputcontext.h)20
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp3
-rw-r--r--tests/auto/testlib/selftests/expected_silent.txt9
-rw-r--r--tests/auto/testlib/selftests/selftests.pri1
-rw-r--r--tests/auto/testlib/selftests/selftests.qrc1
-rw-r--r--tests/auto/testlib/selftests/silent/silent.pro7
-rw-r--r--tests/auto/testlib/selftests/silent/tst_silent.cpp99
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp9
-rw-r--r--tests/auto/tools/qmake/testcompiler.cpp40
-rw-r--r--tests/auto/tools/qmake/testcompiler.h14
-rw-r--r--tests/auto/tools/qmake/testdata/bundle-spaces/bundle-spaces.pro6
-rw-r--r--tests/auto/tools/qmake/testdata/findDeps/findDeps.pro5
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/findMocs.pro5
-rw-r--r--tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro4
-rw-r--r--tests/auto/tools/qmake/tst_qmake.cpp22
-rw-r--r--tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro3
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp6
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro7
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp15
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp28
-rw-r--r--tests/auto/widgets/itemviews/qtableview/qtableview.pro2
-rw-r--r--tests/auto/widgets/kernel/qaction/qaction.pro2
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp29
-rw-r--r--tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro13
-rw-r--r--tests/auto/widgets/styles/qstyle/qstyle.pro1
-rw-r--r--tests/auto/widgets/styles/qstyleoption/qstyleoption.pro11
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro6
-rw-r--r--tests/auto/widgets/util/qcompleter/qcompleter.pro3
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp22
-rw-r--r--tests/auto/widgets/widgets/qlineedit/qlineedit.pro5
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp85
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp36
-rw-r--r--tests/auto/widgets/widgets/qmenu/qmenu.pro1
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp4
-rw-r--r--tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.pngbin1232 -> 1247 bytes
-rw-r--r--tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.pngbin1231 -> 1246 bytes
-rw-r--r--tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.pngbin1226 -> 1241 bytes
-rw-r--r--tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.pngbin1223 -> 1238 bytes
-rw-r--r--tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.pngbin1236 -> 1250 bytes
-rw-r--r--tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.pngbin1199 -> 1214 bytes
-rw-r--r--tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.pngbin1225 -> 1240 bytes
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp2
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/parser/parser.pro13
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro1
-rw-r--r--tests/benchmarks/corelib/io/qdir/10000/10000.pro3
-rw-r--r--tests/benchmarks/corelib/io/qdir/tree/tree.pro3
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro4
-rw-r--r--tests/benchmarks/corelib/io/qiodevice/qiodevice.pro3
-rw-r--r--tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro3
-rw-r--r--tests/benchmarks/corelib/kernel/events/events.pro7
-rw-r--r--tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro3
-rw-r--r--tests/benchmarks/corelib/kernel/qobject/qobject.pro3
-rw-r--r--tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro6
-rw-r--r--tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro6
-rw-r--r--tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro4
-rw-r--r--tests/benchmarks/corelib/tools/qrect/qrect.pro4
-rw-r--r--tests/benchmarks/corelib/tools/qregexp/qregexp.pro6
-rw-r--r--tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro3
-rw-r--r--tests/benchmarks/gui/image/blendbench/blendbench.pro4
-rw-r--r--tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro2
-rw-r--r--tests/benchmarks/gui/kernel/qapplication/qapplication.pro3
-rw-r--r--tests/benchmarks/gui/painting/qregion/qregion.pro3
-rw-r--r--tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro4
-rw-r--r--tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro3
-rw-r--r--tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro5
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro3
-rw-r--r--tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro3
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro3
-rw-r--r--tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro3
-rw-r--r--tests/benchmarks/opengl/opengl.pro3
-rw-r--r--tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro3
-rw-r--r--tests/manual/cmake/CMakeLists.txt1
-rw-r--r--tests/manual/cmake/pass8/CMakeLists.txt20
-rw-r--r--tests/manual/cmake/pass8/myobject.cpp (renamed from config.tests/qws/sound/sound.cpp)15
-rw-r--r--tests/manual/cmake/pass8/myobject.h (renamed from config.tests/qws/directfb/directfb.cpp)23
-rw-r--r--tests/manual/cocoa/wheelevent/main.cpp (renamed from config.tests/qws/ahi/ahi.cpp)21
-rw-r--r--tests/manual/cocoa/wheelevent/wheelevent.pro6
-rw-r--r--tests/manual/cocoa/wheelevent/window.cpp240
-rw-r--r--tests/manual/cocoa/wheelevent/window.h76
-rw-r--r--tests/manual/gestures/graphicsview/graphicsview.pro9
-rw-r--r--tests/manual/lance/lance.pro1
-rw-r--r--tests/manual/qgraphicslayout/flicker/flicker.pro6
-rw-r--r--tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro3
-rw-r--r--tests/manual/qimagereader/qimagereader.pro7
-rw-r--r--tests/manual/qlocale/qlocale.pro6
-rw-r--r--tests/manual/qnetworkaccessmanager/qget/qget.pro1
-rw-r--r--tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro3
-rw-r--r--tests/manual/qnetworkreply/qnetworkreply.pro3
-rw-r--r--tests/manual/qtabletevent/device_information/qtabletevent.pro16
-rw-r--r--tests/manual/qtabletevent/event_compression/event_compression.pro2
-rw-r--r--tests/manual/qwidget_zorder/qwidget_zorder.pro5
-rw-r--r--tests/manual/repaint/mainwindow/mainwindow.pro13
-rw-r--r--tests/manual/repaint/scrollarea/scrollarea.pro13
-rw-r--r--tests/manual/repaint/splitter/splitter.pro13
-rw-r--r--tests/manual/repaint/tableview/tableview.pro6
-rw-r--r--tests/manual/repaint/task141091/task141091.pro11
-rw-r--r--tests/manual/repaint/toplevel/toplevel.pro12
-rw-r--r--tests/manual/repaint/widget/widget.pro13
-rw-r--r--tests/manual/socketengine/socketengine.pro3
-rw-r--r--tools/configure/Makefile.mingw34
-rw-r--r--tools/configure/environment.cpp32
-rw-r--r--util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro6
-rw-r--r--util/unicode/codecs/big5/big5.pro2
513 files changed, 14716 insertions, 4321 deletions
diff --git a/.gitignore b/.gitignore
index 3aeefbafe9..33387c5bc4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -122,6 +122,7 @@ translations/*.qm
translations/*_untranslated.ts
qrc_*.cpp
+src/concurrent/qtconcurrentversion.h
src/corelib/qtcoreversion.h
src/dbus/qtdbusversion.h
src/gui/qtguiversion.h
diff --git a/bin/syncqt b/bin/syncqt
index 9129de053a..581233a162 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -351,7 +351,7 @@ sub syncHeader {
#write it
my $iheader_out = fixPaths($iheader, $header_dir);
- open HEADER, ">$header" || die "Could not open $header for writing!\n";
+ open(HEADER, ">$header") || die "Could not open $header for writing: $!\n";
print HEADER "#include \"$iheader_out\"\n";
close HEADER;
if(defined($ts)) {
@@ -1133,7 +1133,7 @@ foreach my $lib (@modules_to_sync) {
my $header_dir = dirname($header_path);
make_path($header_dir, $lib, $verbose_level);
- open HEADER, ">$header_path" || die "Could not open $header_path for writing!\n";
+ open(HEADER, ">$header_path") || die "Could not open $header_path for writing: $!\n";
print HEADER "#ifndef $guard\n";
print HEADER "#define $guard\n";
my $warning = "Header <$lib/";
diff --git a/config.tests/qws/ahi/ahi.pro b/config.tests/qws/ahi/ahi.pro
deleted file mode 100644
index 532a565bc4..0000000000
--- a/config.tests/qws/ahi/ahi.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = ahi.cpp
-CONFIG -= qt
-LIBS += -lahi -lahioem
diff --git a/config.tests/qws/directfb/directfb.pro b/config.tests/qws/directfb/directfb.pro
deleted file mode 100644
index db14d3ba48..0000000000
--- a/config.tests/qws/directfb/directfb.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCES = directfb.cpp
-CONFIG -= qt
-
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
-LIBS += $$QT_LIBS_DIRECTFB
diff --git a/config.tests/qws/sound/sound.pro b/config.tests/qws/sound/sound.pro
deleted file mode 100644
index 4ad3376dca..0000000000
--- a/config.tests/qws/sound/sound.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = sound.cpp
-CONFIG -= qt
diff --git a/config.tests/qws/svgalib/svgalib.pro b/config.tests/qws/svgalib/svgalib.pro
deleted file mode 100644
index 169065239b..0000000000
--- a/config.tests/qws/svgalib/svgalib.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = svgalib.cpp
-CONFIG -= qt
-LIBS += -lvgagl -lvga
diff --git a/config.tests/unix/endian.test b/config.tests/unix/endian.test
index 6c5c311888..a662011a27 100755
--- a/config.tests/unix/endian.test
+++ b/config.tests/unix/endian.test
@@ -41,7 +41,11 @@ elif strings - $binary | grep MostSignificantByteFirst >/dev/null 2>&1; then
fi
# make clean as this tests is compiled for both the host and the target
-$MAKE distclean
+if [ "$VERBOSE" = "yes" ]; then
+ $MAKE distclean
+else
+ $MAKE distclean >/dev/null 2>&1
+fi
# done
if [ "$ENDIAN" = "LITTLE" ]; then
diff --git a/configure b/configure
index 5df1edf6a3..8b8fc7d008 100755
--- a/configure
+++ b/configure
@@ -134,7 +134,7 @@ BEGIN {
values["LITERAL_WHITESPACE"] = " "
values["LITERAL_DOLLAR"] = "$"
}
-/^[_A-Z0-9.]+ *\+?=/ {
+/^[_A-Z0-9.]+[ \t]*\+?=/ {
valStart = index($0, "=") + 1
append = 0
@@ -245,7 +245,6 @@ fi
#-------------------------------------------------------------------------------
PLATFORM_X11=no
-PLATFORM_QWS=no
PLATFORM_QPA=yes
BUILD_ON_MAC=no
PLATFORM_MAC=no
@@ -290,7 +289,6 @@ fi
#-------------------------------------------------------------------------------
COMMERCIAL_USER=ask
CFG_DEV=no
-CFG_EMBEDDED=no
CFG_RTOS_ENABLED=yes
EditionString=Commercial
@@ -318,16 +316,6 @@ earlyArgParse()
VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
VAL=no
;;
- -embedded)
- VAR=embedded
- # this option may or may not be followed by an argument
- if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
- VAL=auto
- else
- shift;
- VAL=$1
- fi
- ;;
-embedded-lite|-qpa)
VAR=qpa
# this option may or may not be followed by an argument
@@ -367,25 +355,15 @@ earlyArgParse()
UNKNOWN_OPT=no
case "$VAR" in
- embedded)
- CFG_EMBEDDED="$VAL"
- PLATFORM_X11=no
- PLATFORM_MAC=no
- PLATFORM_QWS=yes
- PLATFORM_QPA=no
- ;;
qpa)
- CFG_EMBEDDED="no"
if [ "$PLATFORM_QPA" != "no" ]; then
if [ "$PLATFORM_QPA" = "maybe" ]; then
PLATFORM_X11=no
PLATFORM_MAC=no
- PLATFORM_QWS=no
PLATFORM_QPA=yes
fi
else
echo "No license exists to enable Qt QPA. Disabling."
- CFG_EMBEDDED=no
fi
;;
developer-build)
@@ -436,7 +414,6 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
# one of commercial editions
[ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
[ "$PLATFORM_QPA" = "maybe" ] && PLATFORM_QPA=no
- [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=no
# read in the license file
if [ -f "$LICENSE_FILE" ]; then
@@ -549,7 +526,6 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
*)
Platform=Linux/X11
[ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
- [ "$PLATFORM_QWS" = "yes" ] && Platform='Embedded Linux'
echo
echo "You are not licensed for the $Platform platform."
echo
@@ -719,7 +695,6 @@ CFG_EGL=no
CFG_EGL_GLES_INCLUDES=no
CFG_SSE=auto
CFG_FONTCONFIG=auto
-CFG_QWS_FREETYPE=auto
CFG_LIBFREETYPE=auto
CFG_SQL_AVAILABLE=
QT_DEFAULT_BUILD_PARTS="libs examples tests"
@@ -741,17 +716,6 @@ CFG_KBD_ON="tty" #default, see QMakeVar above
CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
CFG_MOUSE_ON="pc linuxtp" #default, see QMakeVar above
-if [ -f "$relpath/src/gui/embedded/qscreenqnx_qws.cpp" ]; then
- CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} qnx"
- CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} qnx"
- CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} qnx"
-fi
-if [ -f "$relpath/src/gui/embedded/qscreenintegrityfb_qws.cpp" ]; then
- CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} integrity"
- CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} integrity"
- CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} integrityfb"
-fi
-
CFG_ARCH=
CFG_HOST_ARCH=
CFG_KBD_PLUGIN_AVAILABLE=
@@ -799,7 +763,6 @@ CFG_SSE4_2=auto
CFG_AVX=auto
CFG_REDUCE_RELOCATIONS=auto
CFG_NAS=no
-CFG_QWS_DEPTHS=all
CFG_ACCESSIBILITY=auto
CFG_ENDIAN=auto
CFG_HOST_ENDIAN=auto
@@ -1005,7 +968,7 @@ while [ "$#" -gt 0 ]; do
;;
#Qt style options that pass an argument
-qconfig)
- if [ "$PLATFORM_QWS" != "yes" -a "$PLATFORM_QPA" != "yes" ]; then
+ if [ "$PLATFORM_QPA" != "yes" ]; then
echo
echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux."
echo
@@ -1035,16 +998,6 @@ while [ "$#" -gt 0 ]; do
VAR=fatal_error
VAL=no
;;
- -embedded)
- VAR=embedded
- # this option may or may not be followed by an argument
- if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
- VAL=auto
- else
- shift;
- VAL=$1
- fi
- ;;
-embedded-lite|-qpa)
VAR=qpa
# this option may or may not be followed by an argument
@@ -1267,18 +1220,9 @@ while [ "$#" -gt 0 ]; do
sxe)
CFG_SXE="$VAL"
;;
- embedded)
- CFG_EMBEDDED="$VAL"
- PLATFORM_X11=no
- PLATFORM_MAC=no
- PLATFORM_QWS=yes
- PLATFORM_QPA=no
- ;;
embedded-lite|qpa)
- CFG_EMBEDDED="no"
PLATFORM_X11=no
PLATFORM_MAC=no
- PLATFORM_QWS=no
PLATFORM_QPA=yes
;;
sse)
@@ -1313,9 +1257,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
- depths)
- CFG_QWS_DEPTHS="$VAL"
- ;;
opengl)
if [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
[ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
@@ -1361,7 +1302,6 @@ while [ "$#" -gt 0 ]; do
x11)
PLATFORM_QPA=no
PLATFORM_MAC=no
- PLATFORM_QWS=no
PLATFORM_X11=yes
;;
sdk)
@@ -1742,14 +1682,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
- freetype)
- [ "$VAL" = "qt" ] && VAL=yes
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
- CFG_QWS_FREETYPE="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
zlib)
[ "$VAL" = "qt" ] && VAL=yes
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
@@ -2293,7 +2225,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then
[ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
fi
-if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
+if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
echo
echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
echo "Qt can be built in release mode with separate debug information, so"
@@ -2389,7 +2321,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then
fi
# symlink fonts to be able to run application from build directory
-if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then
+if [ "$PLATFORM_QPA" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then
if [ "$PLATFORM" = "$XPLATFORM" ]; then
mkdir -p "${outpath}/lib"
ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
@@ -2428,85 +2360,6 @@ fi ### help
# auto-detect all that hasn't been specified in the arguments
#-------------------------------------------------------------------------------
-[ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto
-if [ "$CFG_EMBEDDED" != "no" ]; then
- case "$UNAME_SYSTEM:$UNAME_RELEASE" in
- Darwin:*)
- [ -z "$PLATFORM" ] && PLATFORM=qws/macx-generic-g++
- if [ -z "$XPLATFORM" ]; then
- [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
- XPLATFORM="qws/macx-$CFG_EMBEDDED-g++"
- fi
- ;;
- FreeBSD:*)
- [ -z "$PLATFORM" ] && PLATFORM=qws/freebsd-generic-g++
- if [ -z "$XPLATFORM" ]; then
- [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
- XPLATFORM="qws/freebsd-$CFG_EMBEDDED-g++"
- fi
- ;;
- SunOS:5*)
- [ -z "$PLATFORM" ] && PLATFORM=qws/solaris-generic-g++
- if [ -z "$XPLATFORM" ]; then
- [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
- XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
- fi
- ;;
- Linux:*)
- if [ -z "$PLATFORM" ]; then
- case "$UNAME_MACHINE" in
- *86)
- PLATFORM=qws/linux-x86-g++
- ;;
- *86_64)
- PLATFORM=qws/linux-x86_64-g++
- ;;
- *)
- PLATFORM=qws/linux-generic-g++
- ;;
- esac
- fi
- if [ -z "$XPLATFORM" ]; then
- if [ "$CFG_EMBEDDED" = "auto" ]; then
- if [ -n "$CFG_ARCH" ]; then
- CFG_EMBEDDED=$CFG_ARCH
- else
- case "$UNAME_MACHINE" in
- *86)
- CFG_EMBEDDED=x86
- ;;
- *86_64)
- CFG_EMBEDDED=x86_64
- ;;
- *)
- CFG_EMBEDDED=generic
- ;;
- esac
- fi
- fi
- XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
- fi
- ;;
- QNX:*)
- [ -z "$PLATFORM" ] && PLATFORM=unsupported/qws/qnx-generic-g++
- if [ -z "$XPLATFORM" ]; then
- [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
- XPLATFORM="unsupported/qws/qnx-$CFG_EMBEDDED-g++"
- fi
- ;;
- CYGWIN*:*)
- if [ -z "$XPLATFORM" ]; then
- CFG_EMBEDDED=x86
- fi
- ;;
- *)
- echo "Qt for Embedded Linux is not supported on this platform. Disabling."
- CFG_EMBEDDED=no
- PLATFORM_QWS=no
- PLATFORM_QPA=no
- ;;
- esac
-fi
if [ -z "$PLATFORM" ]; then
PLATFORM_NOTES=
case "$UNAME_SYSTEM:$UNAME_RELEASE" in
@@ -2685,12 +2538,7 @@ if [ -z "$PLATFORM" ]; then
esac
fi
-if [ "$PLATFORM_QWS" = "yes" ]; then
- CFG_SM=no
- PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"`
-else
- PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
-fi
+PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
@@ -2757,7 +2605,7 @@ if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
fi
# now look at the configs and figure out what platform we are config'd for
-[ "$CFG_EMBEDDED" = "no" ] && [ "$PLATFORM_QPA" != "yes" ] \
+[ "$PLATFORM_QPA" != "yes" ] \
&& [ -n "`getXQMakeConf QMAKE_LIBS_X11`" ] \
&& PLATFORM_X11=yes
### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
@@ -2777,17 +2625,6 @@ if [ "$OPT_VERBOSE" = "yes" ]; then
echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
fi
-if [ "$CFG_EMBEDDED" != "no" -a "$CFG_EMBEDDED" != "auto" ] && [ -n "$CFG_ARCH" ]; then
- if [ "$CFG_ARCH" != "$CFG_EMBEDDED" ]; then
- echo ""
- echo "You have specified a target architecture with -embedded and -arch."
- echo "The two architectures you have specified are different, so we can"
- echo "not proceed. Either set both to be the same, or only use -embedded."
- echo ""
- exit 1
- fi
-fi
-
if [ "$CFG_RTOS_ENABLED" = "no" ]; then
case `basename "$XPLATFORM"` in
qnx-* | vxworks-*)
@@ -2926,38 +2763,7 @@ if [ -z "${CFG_HOST_ARCH}" ]; then
esac
fi
-if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
- if [ -n "$CFG_ARCH" ]; then
- CFG_EMBEDDED=$CFG_ARCH
- fi
-
- case "$CFG_EMBEDDED" in
- x86)
- CFG_ARCH=i386
- ;;
- x86_64)
- CFG_ARCH=x86_64
- ;;
- ipaq|sharp)
- CFG_ARCH=arm
- ;;
- dm7000)
- CFG_ARCH=powerpc
- ;;
- dm800)
- CFG_ARCH=mips
- ;;
- sh4al)
- CFG_ARCH=sh4a
- ;;
- arm*)
- CFG_ARCH=arm
- ;;
- *)
- CFG_ARCH="$CFG_EMBEDDED"
- ;;
- esac
-elif [ "$XPLATFORM_MINGW" = "yes" ]; then
+if [ "$XPLATFORM_MINGW" = "yes" ]; then
[ -z "$CFG_ARCH" ] && CFG_ARCH="windows"
elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
CFG_ARCH=$CFG_HOST_ARCH
@@ -2975,7 +2781,7 @@ esac
if [ "$OPT_VERBOSE" = "yes" ]; then
echo "System architecture: '$CFG_ARCH'"
- if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+ if [ "$PLATFORM_QPA" = "yes" ]; then
echo "Host architecture: '$CFG_HOST_ARCH'"
fi
fi
@@ -3155,11 +2961,6 @@ if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>
CFG_USE_GNUMAKE=yes
fi
-# If -opengl wasn't specified, don't try to auto-detect
-if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then
- CFG_OPENGL=no
-fi
-
# find the default framework value
if [ "$BUILD_ON_MAC" = "yes" ]; then
if [ "$CFG_FRAMEWORK" = "auto" ]; then
@@ -3426,7 +3227,7 @@ Installation options:
-prefix <dir> ...... This will install everything relative to <dir>
(default $QT_INSTALL_PREFIX)
EOF
-if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+if [ "$PLATFORM_QPA" = "yes" ]; then
cat <<EOF
-hostprefix [dir] .. Tools and libraries needed when developing
@@ -3499,7 +3300,7 @@ Configure options:
+ -largefile ......... Enables Qt to access files larger than 4 GB.
EOF
-if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+if [ "$PLATFORM_QPA" = "yes" ]; then
EXCN="*"
EXCY=" "
else
@@ -3551,7 +3352,7 @@ fi
operating systems and compilers.
EOF
-if [ "${PLATFORM_QWS}" != "yes" -a "${PLATFORM_QPA}" != "yes" ]; then
+if [ "${PLATFORM_QPA}" != "yes" ]; then
cat << EOF
-graphicssystem <sys> Sets an alternate graphics system. Available options are:
raster - Software rasterizer
@@ -3680,7 +3481,7 @@ else
SBN="*"
fi
-if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
cat << EOF
@@ -3695,7 +3496,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "ye
EOF
-fi # X11/QWS
+fi # X11
if [ "$XPLATFORM_MAEMO" = "yes" ]; then
@@ -3922,23 +3723,13 @@ Qt/Mac only:
EOF
fi
-if [ "$PLATFORM_QWS" = "yes" ]; then
- cat << EOF
-Qt for Embedded Linux:
-
- -embedded <arch> .... This will enable the embedded build, you must have a
- proper license for this switch to work.
- Example values for <arch>: arm mips x86 generic
-EOF
-fi
-
if [ "$PLATFORM_QPA" = "yes" ]; then
cat << EOF
Qt for QPA only:
EOF
fi
-if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+if [ "$PLATFORM_QPA" = "yes" ]; then
cat << EOF
-xplatform target ... The target platform when cross-compiling.
@@ -3979,53 +3770,7 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
EOF
fi
-if [ "$PLATFORM_QWS" = "yes" ]; then
- cat << EOF
-
- -depths <list> ...... Comma-separated list of supported bit-per-pixel
- depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'.
-
- -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library,
- by default all available decorations are on.
- Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
- -plugin-decoration-<style> Enable decoration <style> as a plugin to be
- linked to at run time.
- Possible values for <style>: [ $CFG_DECORATION_PLUGIN_AVAILABLE ]
- -no-decoration-<style> ....Disable decoration <style> entirely.
- Possible values for <style>: [ $CFG_DECORATION_AVAILABLE ]
-
- -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library.
- Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
- -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be
- linked to at run time.
- Possible values for <driver>: [ $CFG_GFX_PLUGIN_AVAILABLE ]
- -no-gfx-<driver> ... Disable graphics <driver> entirely.
- Possible values for <driver>: [ $CFG_GFX_AVAILABLE ]
-
- -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library.
- Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
-
- -plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to
- at runtime.
- Possible values for <driver>: [ $CFG_KBD_PLUGIN_AVAILABLE ]
-
- -no-kbd-<driver> ... Disable keyboard <driver> entirely.
- Possible values for <driver>: [ $CFG_KBD_AVAILABLE ]
-
- -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library.
- Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
- -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to
- at runtime.
- Possible values for <driver>: [ $CFG_MOUSE_PLUGIN_AVAILABLE ]
- -no-mouse-<driver> ... Disable mouse <driver> entirely.
- Possible values for <driver>: [ $CFG_MOUSE_AVAILABLE ]
-
- -iwmmxt ............ Compile using the iWMMXt instruction set
- (available on some XScale CPUs).
-EOF
-fi
-
-if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
+if [ "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
if [ "$CFG_GLIB" = "no" ]; then
GBY=" "
GBN="+"
@@ -4049,9 +3794,7 @@ fi # Help
# LICENSING, INTERACTIVE PART
# -----------------------------------------------------------------------------
-if [ "$PLATFORM_QWS" = "yes" ]; then
- Platform="Qt for Embedded Linux"
-elif [ "$PLATFORM_QPA" = "yes" ]; then
+if [ "$PLATFORM_QPA" = "yes" ]; then
Platform="Qt Lighthouse"
elif [ "$XPLATFORM_MINGW" = "yes" ]; then
Platform="Qt for Windows"
@@ -4493,7 +4236,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
EXTRA_LFLAGS="$EXTRA_LFLAGS \$(SDK_LFLAGS)"
fi
fi
- [ "$CFG_EMBEDDED" != "no" ] && EXTRA_CFLAGS="$EXTRA_CFLAGS -DQWS"
if [ '!' -z "$D_FLAGS" ]; then
for DEF in $D_FLAGS; do
EXTRA_CFLAGS="$EXTRA_CFLAGS \"-D${DEF}\""
@@ -4996,7 +4738,7 @@ fi
# auto-detect iconv(3) support
if [ "$CFG_ICONV" != "no" ]; then
- if [ "$PLATFORM_QWS" = "yes" -o "$XPLATFORM_MINGW" = "yes" ] || [ "$PLATFORM_QPA" = "yes" -a "$CFG_ICONV" = "auto" ]; then
+ if [ "$XPLATFORM_MINGW" = "yes" ] || [ "$PLATFORM_QPA" = "yes" -a "$CFG_ICONV" = "auto" ]; then
CFG_ICONV=no
elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
CFG_ICONV=yes
@@ -5042,8 +4784,8 @@ if [ "$CFG_DBUS" != "no" ]; then
fi
fi
-# X11/QWS/Lighthouse
-if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+# X11/Lighthouse
+if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
# auto-detect Glib support
if [ "$CFG_GLIB" != "no" ]; then
@@ -5134,7 +4876,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "ye
fi
fi
fi
-fi # X11/QWS/Lighthouse
+fi # X11/Lighthouse
# X11
if [ "$PLATFORM_X11" = "yes" -a "$CFG_GUI" != "no" ]; then
@@ -5764,124 +5506,9 @@ if [ "$PLATFORM_QPA" = "yes" ]; then
fi
-
-# QWS
-if [ "$PLATFORM_QWS" = "yes" ]; then
-
- # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
- 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" = "yes" ]; then
- CFG_EGL=auto
- if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
- CFG_OPENGL=es2
- fi
- elif [ "$CFG_OPENGL" = "es2" ]; then
- #OpenGL ES 2.x
- "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
- 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, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- CFG_EGL=yes
- elif [ "$CFG_OPENGL" = "desktop" ]; then
- # Desktop OpenGL support
- echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux"
- exit 1
- fi
-fi
-
-if [ "$PLATFORM_QWS" = "yes" ]; then
-
- # screen drivers
- for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do
- if [ "${screen}" = "ahi" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
- "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS
- if [ $? != "0" ]; then
- echo "The Ahi screen driver functionality test failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- fi
-
- if [ "${screen}" = "svgalib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
- "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS
- if [ $? != "0" ]; then
- echo "The SVGAlib screen driver functionality test failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- fi
-
- if [ "${screen}" = "directfb" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
- if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists directfb 2>/dev/null; then
- QT_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
- QT_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
- elif directfb-config --version >/dev/null 2>&1; then
- QT_CFLAGS_DIRECTFB=`directfb-config --cflags 2>/dev/null`
- QT_LIBS_DIRECTFB=`directfb-config --libs 2>/dev/null`
- fi
-
- # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
- if [ -n "$QT_CFLAGS_DIRECTFB" ] || [ -n "$QT_LIBS_DIRECTFB" ]; then
- QMakeVar set QT_CFLAGS_DIRECTFB "$QT_CFLAGS_DIRECTFB"
- QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB"
- fi
-
- "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/directfb "DirectFB" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DIRECTFB $QT_LIBS_DIRECTFB
- if [ $? != "0" ]; then
- echo "The DirectFB screen driver functionality test failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QT_CFLAGS_DIRECTFB and QT_LIBS_DIRECTFB in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- fi
-
- done
-
- # mouse drivers
- for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do
- if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
- "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS
- if [ $? != "0" ]; then
- echo "The tslib functionality test failed!"
- echo " You might need to modify the include and library search paths by editing"
- echo " QMAKE_INCDIR and QMAKE_LIBDIR in"
- echo " ${XQMAKESPEC}."
- exit 1
- fi
- fi
- done
-
- CFG_QGTKSTYLE=no
-
- # sound
- "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS
- if [ $? != "0" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SOUND"
- fi
-
-fi # QWS
-
EGL_VARIANT=none
# EGL Support
-if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
+if [ "$PLATFORM_X11" = "yes" ]; then
if [ "$CFG_EGL" != "no" ]; then
# detect EGL support
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then
@@ -5911,7 +5538,6 @@ fi
[ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
# freetype support
-[ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
[ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no
if [ "$CFG_LIBFREETYPE" = "auto" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
@@ -5977,7 +5603,7 @@ fi
if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
- if [ "$PLATFORM_QWS" != "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+ if [ "$PLATFORM_QPA" = "yes" ]; then
CFG_DOUBLEFORMAT=normal
else
"$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath"
@@ -6242,45 +5868,6 @@ fi
# ask for all that hasn't been auto-detected or specified in the arguments
#-------------------------------------------------------------------------------
-### fix this: user input should be validated in a loop
-if [ "$PLATFORM_QWS" = "yes" ]; then
- PROMPT_FOR_DEPTHS="yes"
-else
- PROMPT_FOR_DEPTHS="no"
-fi
-if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PROMPT_FOR_DEPTHS" = "yes" ]; then
- echo
- echo "Choose pixel-depths to support:"
- echo
- echo " 1. 1bpp, black/white"
- echo " 4. 4bpp, grayscale"
- echo " 8. 8bpp, paletted"
- echo " 12. 12bpp, rgb 4-4-4"
- echo " 15. 15bpp, rgb 5-5-5"
- echo " 16. 16bpp, rgb 5-6-5"
- echo " 18. 18bpp, rgb 6-6-6"
- echo " 24. 24bpp, rgb 8-8-8"
- echo " 32. 32bpp, argb 8-8-8-8 and rgb 8-8-8"
- echo " all. All supported depths"
- echo
- echo "Your choices (default 8,16,32):"
- read CFG_QWS_DEPTHS
- if [ -z "$CFG_QWS_DEPTHS" ] || [ "$CFG_QWS_DEPTHS" = "yes" ]; then
- CFG_QWS_DEPTHS=8,16,32
- fi
-fi
-if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then
- if [ "$CFG_QWS_DEPTHS" = "all" ]; then
- CFG_QWS_DEPTHS="1 4 8 12 15 16 18 24 32 generic"
- fi
- for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do
- case $D in
- 1|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
- generic) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_GENERIC";;
- esac
- done
-fi
-
# enable dwarf2 support on Mac
if [ "$CFG_MAC_DWARF2" = "yes" ]; then
QT_CONFIG="$QT_CONFIG dwarf2"
@@ -6392,12 +5979,6 @@ elif [ "$CFG_SHARED" = "no" ]; then
QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
QMAKE_CONFIG="$QMAKE_CONFIG static"
fi
-if [ "$PLATFORM_QWS" = "yes" ]; then
- QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED"
- QMAKE_CONFIG="$QMAKE_CONFIG embedded"
- QT_CONFIG="$QT_CONFIG embedded"
- rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
-fi
if [ "$PLATFORM_QPA" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG qpa"
QT_CONFIG="$QT_CONFIG qpa"
@@ -6639,16 +6220,11 @@ if [ '!' -z "$W_FLAGS" ]; then
fi
# turn off exceptions for the compilers that support it
-if [ "$PLATFORM_QWS" = "yes" ]; then
- COMPILER=`echo $XPLATFORM | cut -f 3- -d-`
-elif [ "$XPLATFORM" != "$PLATFORM" ]; then
+if [ "$XPLATFORM" != "$PLATFORM" ]; then
COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
else
COMPILER=`echo $PLATFORM | cut -f 2- -d-`
fi
-if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then
- CFG_EXCEPTIONS=no
-fi
if [ "$CFG_EXCEPTIONS" != "no" ]; then
QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
@@ -7036,54 +6612,6 @@ if [ "$CFG_DEV" = "yes" ]; then
echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
fi
-# Embedded compile time options
-if [ "$PLATFORM_QWS" = "yes" ]; then
- # Add QWS to config.h
- QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QWS"
-
- # Add excluded decorations to $QCONFIG_FLAGS
- decors=`grep '^decorations -= ' "$QMAKE_VARS_FILE" | ${AWK} '{print $3}'`
- for decor in $decors; do
- NODECORATION=`echo $decor | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_NO_QWS_DECORATION_${NODECORATION}"
- done
-
- # Figure which embedded drivers which are turned off
- CFG_GFX_OFF="$CFG_GFX_AVAILABLE"
- for ADRIVER in $CFG_GFX_ON; do
- CFG_GFX_OFF=`echo "${CFG_GFX_OFF} " | sed "s,${ADRIVER} ,,g"`
- done
-
- CFG_KBD_OFF="$CFG_KBD_AVAILABLE"
- # the um driver is currently not in the available list for external builds
- if [ "$CFG_DEV" = "no" ]; then
- CFG_KBD_OFF="$CFG_KBD_OFF um"
- fi
- for ADRIVER in $CFG_KBD_ON; do
- CFG_KBD_OFF=`echo "${CFG_KBD_OFF} " | sed "s,${ADRIVER} ,,g"`
- done
-
- CFG_MOUSE_OFF="$CFG_MOUSE_AVAILABLE"
- for ADRIVER in $CFG_MOUSE_ON; do
- CFG_MOUSE_OFF=`echo "${CFG_MOUSE_OFF} " | sed "s,${ADRIVER} ,,g"`
- done
-
- for DRIVER in $CFG_GFX_OFF; do
- NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_$NODRIVER"
- done
-
- for DRIVER in $CFG_KBD_OFF; do
- NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_KBD_$NODRIVER"
- done
-
- for DRIVER in $CFG_MOUSE_OFF; do
- NODRIVER=`echo $DRIVER | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_QWS_MOUSE_$NODRIVER"
- done
-fi # QWS
-
if [ "$PLATFORM_QPA" = "yes" ]; then
# Add QPA to config.h
QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
@@ -7229,9 +6757,9 @@ else
[ -f "$outpath/src/corelib/global/qconfig.h" ] && chmod +w "$outpath/src/corelib/global/qconfig.h"
mv "$outpath/src/corelib/global/qconfig.h.new" "$outpath/src/corelib/global/qconfig.h"
chmod -w "$outpath/src/corelib/global/qconfig.h"
- for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do
- ln -s "$outpath/src/corelib/global/qconfig.h" "$conf"
- done
+ if [ ! -f "$outpath/include/QtCore/qconfig.h" ]; then
+ ln -s "$outpath/src/corelib/global/qconfig.h" "$outpath/include/QtCore/qconfig.h"
+ fi
fi
#-------------------------------------------------------------------------------
@@ -7491,7 +7019,7 @@ else
echo "Architecture: $CFG_ARCH"
fi
-if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+if [ "$PLATFORM_QPA" = "yes" ]; then
echo "Host architecture: $CFG_HOST_ARCH"
fi
@@ -7565,31 +7093,7 @@ else
fi
echo "zlib support ........... $CFG_ZLIB"
echo "Session management ..... $CFG_SM"
-if [ "$PLATFORM_QWS" = "yes" ]; then
- echo "Embedded support ....... $CFG_EMBEDDED"
- if [ "$CFG_QWS_FREETYPE" = "auto" ]; then
- echo "Freetype2 support ...... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)"
- else
- echo "Freetype2 support ...... $CFG_QWS_FREETYPE"
- fi
- # Normalize the decoration output first
- CFG_GFX_ON=`echo ${CFG_GFX_ON}`
- CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}`
- echo "Graphics (qt) .......... ${CFG_GFX_ON}"
- echo "Graphics (plugin) ...... ${CFG_GFX_PLUGIN}"
- CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}`
- CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}`
- echo "Decorations (qt) ....... $CFG_DECORATION_ON"
- echo "Decorations (plugin) ... $CFG_DECORATION_PLUGIN"
- CFG_KBD_ON=`echo ${CFG_KBD_ON}`
- CFG_KBD_PLUGIN=`echo ${CFG_KBD_PLUGIN}`
- echo "Keyboard driver (qt) ... ${CFG_KBD_ON}"
- echo "Keyboard driver (plugin) .. ${CFG_KBD_PLUGIN}"
- CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}`
- CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}`
- echo "Mouse driver (qt) ...... $CFG_MOUSE_ON"
- echo "Mouse driver (plugin) .. $CFG_MOUSE_PLUGIN"
-fi
+
if [ "$CFG_OPENGL" = "desktop" ]; then
echo "OpenGL support ......... yes (Desktop OpenGL)"
elif [ "$CFG_OPENGL" = "es2" ]; then
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index 292f5ffba0..5a9ce7e6c7 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -199,6 +199,7 @@ information about a particular change.
You might need to adjust your code if it used a QIconEngine.
- qmake
+ * Projects which explicitly set an empty TARGET are considered broken now.
* several functions and built-in variables were modified to return normalized paths.
- QTextCodecPlugin has been removed since it is no longer used. All text codecs
@@ -295,6 +296,10 @@ QtCore
* The QDate::addDays() and QDateTime::addDays() methods now take a qint64
* The QDate::daysTo() and QDateTime::daysTo() methods now return a qint64
+* QTextCodec::codecForCStrings() and QTextCodec::setCodecForCStrings() have both
+ been removed. This was removed due to issues with breaking other code from
+ libraries, creating uncertainty/bugs in using QString easily, and (to a lesser
+ extent) performance issues.
* QIntValidator and QDoubleValidator no longer fall back to using the C locale if
the requested locale fails to validate the input.
diff --git a/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp b/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp
index 9fa9a23234..9de685a7b5 100644
--- a/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp
+++ b/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp
@@ -76,7 +76,7 @@ extern "C" MY_EXPORT int avg(int a, int b)
//! [4]
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT
diff --git a/doc/src/snippets/code/src_gui_kernel_qevent.cpp b/doc/src/snippets/code/src_gui_kernel_qevent.cpp
index 35c53337f4..d8bdeebe84 100644
--- a/doc/src/snippets/code/src_gui_kernel_qevent.cpp
+++ b/doc/src/snippets/code/src_gui_kernel_qevent.cpp
@@ -41,14 +41,16 @@
//! [0]
void MyWidget::wheelEvent(QWheelEvent *event)
{
- int numDegrees = event->delta() / 8;
- int numSteps = numDegrees / 15;
+ QPoint numPixels = envent->pixelDelta();
+ QPoint numDegrees = envent->angleDelta() / 8;
- if (event->orientation() == Qt::Horizontal) {
- scrollHorizontally(numSteps);
- } else {
- scrollVertically(numSteps);
+ if (!numPixels.isNull()) {
+ scrollWithPixels(numpixels);
+ } else if (!numDegrees.isNull()) {
+ QPoint numSteps = numDegrees / 15;
+ scrollWithDegrees(numSteps);
}
+
event->accept();
}
//! [0]
diff --git a/examples/animation/sub-attaq/mainwindow.cpp b/examples/animation/sub-attaq/mainwindow.cpp
index fd41cee6dc..70f0303177 100644
--- a/examples/animation/sub-attaq/mainwindow.cpp
+++ b/examples/animation/sub-attaq/mainwindow.cpp
@@ -45,13 +45,13 @@
//Qt
#include <QGraphicsView>
+#include <QApplication>
+#include <QMenu>
+#include <QMenuBar>
+#include <QLayout>
-#ifdef QT_NO_OPENGL
- #include <QtGui/QMenuBar>
- #include <QtGui/QLayout>
- #include <QtGui/QApplication>
-#else
- #include <QtOpenGL/QtOpenGL>
+#ifndef QT_NO_OPENGL
+# include <QtOpenGL/QtOpenGL>
#endif
MainWindow::MainWindow() : QMainWindow(0)
diff --git a/examples/animation/sub-attaq/pixmapitem.cpp b/examples/animation/sub-attaq/pixmapitem.cpp
index b2061dc06c..077151d708 100644
--- a/examples/animation/sub-attaq/pixmapitem.cpp
+++ b/examples/animation/sub-attaq/pixmapitem.cpp
@@ -48,9 +48,9 @@
PixmapItem::PixmapItem(const QString &fileName,GraphicsScene::Mode mode, QGraphicsItem * parent) : QGraphicsObject(parent)
{
if (mode == GraphicsScene::Big)
- pix = ":/big/" + fileName;
+ pix = QPixmap(QStringLiteral(":/big/") + fileName);
else
- pix = ":/small/" + fileName;
+ pix = QPixmap(QStringLiteral(":/small/") + fileName);
}
PixmapItem::PixmapItem(const QString &fileName, QGraphicsScene *scene) : QGraphicsObject(), pix(fileName)
diff --git a/examples/animation/sub-attaq/sub-attaq.pro b/examples/animation/sub-attaq/sub-attaq.pro
index e994694b54..6d9b3195ac 100644
--- a/examples/animation/sub-attaq/sub-attaq.pro
+++ b/examples/animation/sub-attaq/sub-attaq.pro
@@ -1,4 +1,5 @@
-contains(QT_CONFIG, opengl):QT += opengl widgets
+QT += widgets
+contains(QT_CONFIG, opengl):QT += opengl
HEADERS += boat.h \
bomb.h \
mainwindow.h \
diff --git a/examples/dbus/complexpingpong/complexping.pro b/examples/dbus/complexpingpong/complexping.pro
index bc45e99c7b..303f6eb2d7 100644
--- a/examples/dbus/complexpingpong/complexping.pro
+++ b/examples/dbus/complexpingpong/complexping.pro
@@ -1,14 +1,9 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
CONFIG += qdbus
-# Input
HEADERS += complexping.h ping-common.h
SOURCES += complexping.cpp
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
diff --git a/examples/dbus/complexpingpong/complexpong.pro b/examples/dbus/complexpingpong/complexpong.pro
index 0934740185..fcb833e596 100644
--- a/examples/dbus/complexpingpong/complexpong.pro
+++ b/examples/dbus/complexpingpong/complexpong.pro
@@ -1,14 +1,9 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
CONFIG += qdbus
-# Input
HEADERS += complexpong.h
SOURCES += complexpong.cpp
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
diff --git a/examples/dbus/dbus-chat/dbus-chat.pro b/examples/dbus/dbus-chat/dbus-chat.pro
index e1a3539cf3..29b1f56826 100644
--- a/examples/dbus/dbus-chat/dbus-chat.pro
+++ b/examples/dbus/dbus-chat/dbus-chat.pro
@@ -1,9 +1,6 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
CONFIG += qdbus
+QT += widgets
-# Input
HEADERS += chat.h chat_adaptor.h chat_interface.h
SOURCES += chat.cpp chat_adaptor.cpp chat_interface.cpp
FORMS += chatmainwindow.ui chatsetnickname.ui
@@ -17,5 +14,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xml
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/chat
INSTALLS += target sources
-QT += widgets
simulator: warning(This example does not work on Simulator platform)
diff --git a/examples/dbus/listnames/listnames.pro b/examples/dbus/listnames/listnames.pro
index a863bbc83d..27805e5f6b 100644
--- a/examples/dbus/listnames/listnames.pro
+++ b/examples/dbus/listnames/listnames.pro
@@ -1,14 +1,9 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
CONFIG += qdbus
win32:CONFIG += console
-# Input
SOURCES += listnames.cpp
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/listnames
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/listnames
diff --git a/examples/dbus/pingpong/ping.pro b/examples/dbus/pingpong/ping.pro
index 533371c2ce..2ba1ad2c9c 100644
--- a/examples/dbus/pingpong/ping.pro
+++ b/examples/dbus/pingpong/ping.pro
@@ -1,15 +1,9 @@
-TEMPLATE = app
-TARGET = ping
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
CONFIG += qdbus
-# Input
HEADERS += ping-common.h
SOURCES += ping.cpp
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
diff --git a/examples/dbus/pingpong/pong.pro b/examples/dbus/pingpong/pong.pro
index 37a5a5c404..5c7cb85c43 100644
--- a/examples/dbus/pingpong/pong.pro
+++ b/examples/dbus/pingpong/pong.pro
@@ -1,15 +1,9 @@
-TEMPLATE = app
-TARGET = pong
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
CONFIG += qdbus
-# Input
HEADERS += ping-common.h pong.h
SOURCES += pong.cpp
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
diff --git a/examples/dbus/remotecontrolledcar/car/car.pro b/examples/dbus/remotecontrolledcar/car/car.pro
index 761181a782..ea49a7a6d3 100644
--- a/examples/dbus/remotecontrolledcar/car/car.pro
+++ b/examples/dbus/remotecontrolledcar/car/car.pro
@@ -1,13 +1,6 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Mon Aug 28 19:50:14 2006
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += widgets
CONFIG += qdbus
-# Input
# DBUS_ADAPTORS += car.xml
HEADERS += car.h car_adaptor.h
SOURCES += car.cpp main.cpp car_adaptor.cpp
@@ -18,5 +11,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xml
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/car
INSTALLS += target sources
-QT += widgets
simulator: warning(This example does not work on Simulator platform)
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.pro b/examples/dbus/remotecontrolledcar/controller/controller.pro
index 36983e0c54..07fd169519 100644
--- a/examples/dbus/remotecontrolledcar/controller/controller.pro
+++ b/examples/dbus/remotecontrolledcar/controller/controller.pro
@@ -1,13 +1,6 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue Aug 29 12:28:05 2006
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += widgets
CONFIG += qdbus
-# Input
# DBUS_INTERFACES += car.xml
FORMS += controller.ui
HEADERS += car_interface.h controller.h
@@ -19,5 +12,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xml
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/controller
INSTALLS += target sources
-QT += widgets
simulator: warning(This example does not work on Simulator platform)
diff --git a/examples/embedded/styleexample/styleexample.pro b/examples/embedded/styleexample/styleexample.pro
index 3cd4d0a3c0..a0fd001cf9 100644
--- a/examples/embedded/styleexample/styleexample.pro
+++ b/examples/embedded/styleexample/styleexample.pro
@@ -1,6 +1,5 @@
-TEMPLATE = app
+QT += widgets
-# Input
HEADERS += stylewidget.h
FORMS += stylewidget.ui
SOURCES += main.cpp stylewidget.cpp
@@ -10,5 +9,3 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/styleexample
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.html
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/styleexample
INSTALLS += target sources
-
-QT += widgets widgets
diff --git a/examples/graphicsview/boxes/boxes.pro b/examples/graphicsview/boxes/boxes.pro
index 176bc3a1cf..0564ae0ba6 100644
--- a/examples/graphicsview/boxes/boxes.pro
+++ b/examples/graphicsview/boxes/boxes.pro
@@ -1,13 +1,5 @@
-######################################################################
-# Automatically generated by qmake (2.01a) ma 3. nov 17:33:30 2008
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += opengl widgets
-# Input
HEADERS += 3rdparty/fbm.h \
glbuffers.h \
glextensions.h \
@@ -27,8 +19,6 @@ SOURCES += 3rdparty/fbm.c \
RESOURCES += boxes.qrc
-QT += opengl widgets
-
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/boxes
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html *.jpg *.png *.fsh *.vsh *.par
diff --git a/examples/graphicsview/flowlayout/flowlayout.pro b/examples/graphicsview/flowlayout/flowlayout.pro
index 8d1f7b85ff..4a4b22bcf7 100644
--- a/examples/graphicsview/flowlayout/flowlayout.pro
+++ b/examples/graphicsview/flowlayout/flowlayout.pro
@@ -1,12 +1,8 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += widgets
QMAKE_PROJECT_NAME = flowlayout_graphicsview
-# Input
HEADERS += flowlayout.h window.h
SOURCES += flowlayout.cpp main.cpp window.cpp
-QT += widgets
simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/graphicsview/padnavigator/padnavigator.pro b/examples/graphicsview/padnavigator/padnavigator.pro
index 2c1d043a92..4b9733bb9b 100644
--- a/examples/graphicsview/padnavigator/padnavigator.pro
+++ b/examples/graphicsview/padnavigator/padnavigator.pro
@@ -16,7 +16,8 @@ RESOURCES += \
FORMS += \
form.ui
-contains(QT_CONFIG, opengl):QT += opengl widgets
+QT += widgets
+contains(QT_CONFIG, opengl):QT += opengl
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/padnavigator
diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro
index 4c2fdc60de..b6eb292a12 100644
--- a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro
+++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro
@@ -1,8 +1,5 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue May 12 15:22:25 2009
-######################################################################
+QT += widgets
-# Input
SOURCES += main.cpp
RESOURCES += weatheranchorlayout.qrc
@@ -12,5 +9,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES weatheranchorlayout.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/weatheranchorlayout
INSTALLS += target sources
-QT += widgets
simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/itemviews/interview/model.cpp b/examples/itemviews/interview/model.cpp
index 966dc7bfba..3b20f91ed6 100644
--- a/examples/itemviews/interview/model.cpp
+++ b/examples/itemviews/interview/model.cpp
@@ -95,7 +95,7 @@ QVariant Model::data(const QModelIndex &index, int role) const
if (!index.isValid())
return QVariant();
if (role == Qt::DisplayRole)
- return "Item " + QString::number(index.row()) + ":" + QString::number(index.column());
+ return QVariant("Item " + QString::number(index.row()) + ":" + QString::number(index.column()));
if (role == Qt::DecorationRole) {
if (index.column() == 0)
return iconProvider.icon(QFileIconProvider::Folder);
diff --git a/examples/itemviews/spreadsheet/spreadsheet.pro b/examples/itemviews/spreadsheet/spreadsheet.pro
index f00dfb4c81..93fc5e95c6 100644
--- a/examples/itemviews/spreadsheet/spreadsheet.pro
+++ b/examples/itemviews/spreadsheet/spreadsheet.pro
@@ -1,17 +1,6 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Thu Mar 5 14:39:33 2009
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
QT += widgets printsupport
-CONFIG += qt warn_on
#unix:contains(QT_CONFIG, dbus):QT += dbus widgets
-# Input
HEADERS += printview.h spreadsheet.h spreadsheetdelegate.h spreadsheetitem.h
SOURCES += main.cpp \
printview.cpp \
@@ -20,7 +9,6 @@ SOURCES += main.cpp \
spreadsheetitem.cpp
RESOURCES += spreadsheet.qrc
-
build_all:!build_pass {
CONFIG -= build_all
CONFIG += release
diff --git a/examples/network/download/download.pro b/examples/network/download/download.pro
index 7c53044f69..3eabedd375 100644
--- a/examples/network/download/download.pro
+++ b/examples/network/download/download.pro
@@ -1,14 +1,6 @@
-######################################################################
-# Automatically generated by qmake (2.01a) fr. nov. 16 13:18:20 2007
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
QT = core network
CONFIG += console
-# Input
SOURCES += main.cpp
# install
@@ -17,5 +9,4 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/network/download
INSTALLS += target sources
-
simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/network/downloadmanager/downloadmanager.pro b/examples/network/downloadmanager/downloadmanager.pro
index 6b7e4f8757..04a6c4c4ea 100644
--- a/examples/network/downloadmanager/downloadmanager.pro
+++ b/examples/network/downloadmanager/downloadmanager.pro
@@ -1,14 +1,6 @@
-######################################################################
-# Automatically generated by qmake (2.01a) fr. nov. 16 14:11:36 2007
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
QT = core network
CONFIG += console
-# Input
HEADERS += downloadmanager.h textprogressbar.h
SOURCES += downloadmanager.cpp main.cpp textprogressbar.cpp
@@ -18,7 +10,6 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/network/downloadmanager
INSTALLS += target sources
-
OTHER_FILES += \
debian/changelog \
debian/compat \
@@ -26,4 +17,5 @@ OTHER_FILES += \
debian/copyright \
debian/README \
debian/rules
+
simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp
index 38f9eaf9fd..12f9504b7b 100644
--- a/examples/network/torrent/trackerclient.cpp
+++ b/examples/network/torrent/trackerclient.cpp
@@ -108,10 +108,10 @@ void TrackerClient::fetchPeerList()
// Percent encode the hash
QByteArray infoHash = torrentDownloader->infoHash();
- QString encodedSum;
+ QByteArray encodedSum;
for (int i = 0; i < infoHash.size(); ++i) {
encodedSum += '%';
- encodedSum += QString::number(infoHash[i], 16).right(2).rightJustified(2, '0');
+ encodedSum += QByteArray::number(infoHash[i], 16).right(2).rightJustified(2, '0');
}
bool seeding = (torrentDownloader->state() == TorrentClient::Seeding);
diff --git a/examples/opengl/hellogl_es/hellogl_es.pro b/examples/opengl/hellogl_es/hellogl_es.pro
index 6932b77831..ca0a4bf4cd 100644
--- a/examples/opengl/hellogl_es/hellogl_es.pro
+++ b/examples/opengl/hellogl_es/hellogl_es.pro
@@ -1,17 +1,12 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += gui
-# Input
SOURCES += main.cpp
SOURCES += glwindow.cpp
HEADERS += glwindow.h
RESOURCES += texture.qrc
-QT += gui
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es
diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro
index d5bc7ba0a5..5a3d170df8 100644
--- a/examples/opengl/hellogl_es2/hellogl_es2.pro
+++ b/examples/opengl/hellogl_es2/hellogl_es2.pro
@@ -1,12 +1,5 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Thu Oct 4 19:01:12 2007
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += opengl widgets
-# Input
SOURCES += main.cpp
SOURCES += glwidget.cpp
SOURCES += mainwindow.cpp
@@ -17,7 +10,6 @@ HEADERS += mainwindow.h
HEADERS += bubble.h
RESOURCES += texture.qrc
-QT += opengl widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es2
@@ -25,7 +17,6 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es2.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es2
INSTALLS += target sources
-
maemo5 {
# Debian package name may not contain numbers or special characters
# such as '_', lets change this in Maemo.
diff --git a/examples/opengl/hellowindow/hellowindow.pro b/examples/opengl/hellowindow/hellowindow.pro
index dc724421f5..b5ede1b83f 100644
--- a/examples/opengl/hellowindow/hellowindow.pro
+++ b/examples/opengl/hellowindow/hellowindow.pro
@@ -1,12 +1,5 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
QT += gui-private core-private
-# Input
+
HEADERS += hellowindow.h
SOURCES += hellowindow.cpp main.cpp
diff --git a/examples/opengl/paintedwindow/paintedwindow.pro b/examples/opengl/paintedwindow/paintedwindow.pro
index a3ae3bace5..098329ac4d 100644
--- a/examples/opengl/paintedwindow/paintedwindow.pro
+++ b/examples/opengl/paintedwindow/paintedwindow.pro
@@ -1,12 +1,3 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
HEADERS += paintedwindow.h
SOURCES += paintedwindow.cpp main.cpp
@@ -15,4 +6,3 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/paintedwindow
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS paintedwindow.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/paintedwindow
INSTALLS += target sources
-
diff --git a/examples/opengl/pbuffers2/pbuffers2.pro b/examples/opengl/pbuffers2/pbuffers2.pro
index bc3b7bb692..ba3a039da2 100644
--- a/examples/opengl/pbuffers2/pbuffers2.pro
+++ b/examples/opengl/pbuffers2/pbuffers2.pro
@@ -1,14 +1,5 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Fri May 12 17:15:46 2006
-######################################################################
-
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
QT += opengl svg widgets
-# Input
HEADERS += glwidget.h
SOURCES += glwidget.cpp main.cpp
RESOURCES += pbuffers2.qrc
@@ -19,5 +10,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES pbuffers2.pro *.png *.svg
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/pbuffers2
INSTALLS += target sources
-
simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/painting/affine/affine.pro b/examples/painting/affine/affine.pro
index 80f966e59d..0977ea1c5b 100644
--- a/examples/painting/affine/affine.pro
+++ b/examples/painting/affine/affine.pro
@@ -3,8 +3,9 @@ HEADERS += xform.h
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) {
DEFINES += QT_OPENGL_SUPPORT
- QT += opengl widgets
+ QT += opengl
}
+QT += widgets
SHARED_FOLDER = ../shared
diff --git a/examples/painting/composition/composition.pro b/examples/painting/composition/composition.pro
index 8641109cc0..eb63d0c47a 100644
--- a/examples/painting/composition/composition.pro
+++ b/examples/painting/composition/composition.pro
@@ -8,8 +8,9 @@ include($$SHARED_FOLDER/shared.pri)
RESOURCES += composition.qrc
contains(QT_CONFIG, opengl) {
DEFINES += QT_OPENGL_SUPPORT
- QT += opengl widgets
+ QT += opengl
}
+QT += widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/composition
diff --git a/examples/painting/deform/deform.pro b/examples/painting/deform/deform.pro
index bd704507c5..527133e7e5 100644
--- a/examples/painting/deform/deform.pro
+++ b/examples/painting/deform/deform.pro
@@ -9,8 +9,9 @@ RESOURCES += deform.qrc
contains(QT_CONFIG, opengl) {
DEFINES += QT_OPENGL_SUPPORT
- QT += opengl widgets
+ QT += opengl
}
+QT += widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/deform
diff --git a/examples/painting/gradients/gradients.pro b/examples/painting/gradients/gradients.pro
index 4d3efe1255..4362d283ee 100644
--- a/examples/painting/gradients/gradients.pro
+++ b/examples/painting/gradients/gradients.pro
@@ -8,8 +8,9 @@ include($$SHARED_FOLDER/shared.pri)
RESOURCES += gradients.qrc
contains(QT_CONFIG, opengl) {
DEFINES += QT_OPENGL_SUPPORT
- QT += opengl widgets
+ QT += opengl
}
+QT += widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/gradients
diff --git a/examples/painting/pathstroke/pathstroke.pro b/examples/painting/pathstroke/pathstroke.pro
index 60a5cd75ca..916866d1f2 100644
--- a/examples/painting/pathstroke/pathstroke.pro
+++ b/examples/painting/pathstroke/pathstroke.pro
@@ -9,8 +9,9 @@ RESOURCES += pathstroke.qrc
contains(QT_CONFIG, opengl) {
DEFINES += QT_OPENGL_SUPPORT
- QT += opengl widgets
+ QT += opengl
}
+QT += widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/pathstroke
diff --git a/examples/qpa/windows/windows.pro b/examples/qpa/windows/windows.pro
index ab59f28a3e..40280b718a 100644
--- a/examples/qpa/windows/windows.pro
+++ b/examples/qpa/windows/windows.pro
@@ -1,15 +1,5 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011
-######################################################################
+CONFIG += console
+QT += gui-private core-private
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-CONFIG+=console
-QT += gui-private
-QT += core-private
-
-# Input
HEADERS += window.h
SOURCES += window.cpp main.cpp
diff --git a/examples/qtconcurrent/imagescaling/imagescaling.pro b/examples/qtconcurrent/imagescaling/imagescaling.pro
index b268aa75f2..b959915a55 100644
--- a/examples/qtconcurrent/imagescaling/imagescaling.pro
+++ b/examples/qtconcurrent/imagescaling/imagescaling.pro
@@ -1,20 +1,13 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-QT += concurrent
+QT += concurrent widgets
-# Input
SOURCES += main.cpp imagescaling.cpp
HEADERS += imagescaling.h
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/imagescaling
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/imagescaling
INSTALLS += target sources
-
wince*: DEPLOYMENT_PLUGIN += qgif qjpeg
-QT += widgets
simulator: warning(This example does not work on Simulator platform)
diff --git a/examples/qtconcurrent/map/map.pro b/examples/qtconcurrent/map/map.pro
index 72f770755f..994c266e9b 100644
--- a/examples/qtconcurrent/map/map.pro
+++ b/examples/qtconcurrent/map/map.pro
@@ -1,14 +1,10 @@
TEMPLATE = app
TARGET = mapdemo
-DEPENDPATH += .
-INCLUDEPATH += .
QT += concurrent widgets
+CONFIG += console
-# Input
SOURCES += main.cpp
-CONFIG += console
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/map
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/map
diff --git a/examples/qtconcurrent/progressdialog/progressdialog.pro b/examples/qtconcurrent/progressdialog/progressdialog.pro
index 75a3aba0ae..3ec3243b6a 100644
--- a/examples/qtconcurrent/progressdialog/progressdialog.pro
+++ b/examples/qtconcurrent/progressdialog/progressdialog.pro
@@ -1,17 +1,11 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += concurrent widgets
+CONFIG += console
-# Input
SOURCES += main.cpp
-CONFIG += console
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/progressdialog
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/progressdialog
INSTALLS += target sources
-QT += concurrent widgets
-
simulator: warning(This example does not work on Simulator platform)
diff --git a/examples/qtconcurrent/runfunction/runfunction.pro b/examples/qtconcurrent/runfunction/runfunction.pro
index f047577c9f..1ac02f6fa2 100644
--- a/examples/qtconcurrent/runfunction/runfunction.pro
+++ b/examples/qtconcurrent/runfunction/runfunction.pro
@@ -1,17 +1,11 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += concurrent widgets
+CONFIG += console
-# Input
SOURCES += main.cpp
-CONFIG += console
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/runfunction
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/runfunction
INSTALLS += target sources
-QT += concurrent widgets
-
simulator: warning(This example does not work on Simulator platform)
diff --git a/examples/qtconcurrent/wordcount/wordcount.pro b/examples/qtconcurrent/wordcount/wordcount.pro
index 3bddf1a862..8b6bf8104a 100644
--- a/examples/qtconcurrent/wordcount/wordcount.pro
+++ b/examples/qtconcurrent/wordcount/wordcount.pro
@@ -1,17 +1,11 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += concurrent widgets
+CONFIG += console
-# Input
SOURCES += main.cpp
-CONFIG += console
-# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/wordcount
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/wordcount
INSTALLS += target sources
-QT += concurrent widgets
-
simulator: warning(This example does not work on Simulator platform)
diff --git a/examples/threads/waitconditions/waitconditions.pro b/examples/threads/waitconditions/waitconditions.pro
index 6a3d63b641..29ef9b8334 100644
--- a/examples/threads/waitconditions/waitconditions.pro
+++ b/examples/threads/waitconditions/waitconditions.pro
@@ -1,16 +1,8 @@
-######################################################################
-# Automatically generated by qmake (1.08a) Fri Jan 7 15:25:07 2005
-######################################################################
-
-TEMPLATE = app
QT = core gui
CONFIG -= moc app_bundle
-DEPENDPATH += .
-INCLUDEPATH += .
+CONFIG += console
-# Input
SOURCES += waitconditions.cpp
-CONFIG += qt warn_on create_prl link_prl console
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/threads/waitconditions
@@ -18,5 +10,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS waitconditions.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/threads/waitconditions
INSTALLS += target sources
-
simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/tools/echoplugin/echowindow/echointerface.h b/examples/tools/echoplugin/echowindow/echointerface.h
index 412e37b7d2..13494c8d28 100644
--- a/examples/tools/echoplugin/echowindow/echointerface.h
+++ b/examples/tools/echoplugin/echowindow/echointerface.h
@@ -53,8 +53,10 @@ public:
QT_BEGIN_NAMESPACE
-Q_DECLARE_INTERFACE(EchoInterface,
- "com.trolltech.Plugin.EchoInterface/1.0");
+
+#define EchoInterface_iid "org.qt-project.Qt.Examples.EchoInterface"
+
+Q_DECLARE_INTERFACE(EchoInterface, EchoInterface_iid)
QT_END_NAMESPACE
//! [0]
diff --git a/examples/tools/echoplugin/plugin/echoplugin.cpp b/examples/tools/echoplugin/plugin/echoplugin.cpp
index d22e7ead23..07520899f5 100644
--- a/examples/tools/echoplugin/plugin/echoplugin.cpp
+++ b/examples/tools/echoplugin/plugin/echoplugin.cpp
@@ -48,7 +48,3 @@ QString EchoPlugin::echo(const QString &message)
return message;
}
//! [0]
-
-//! [1]
-Q_EXPORT_PLUGIN2(echoplugin, EchoPlugin);
-//! [1]
diff --git a/examples/tools/echoplugin/plugin/echoplugin.h b/examples/tools/echoplugin/plugin/echoplugin.h
index d5e24b3b76..47373fc8cb 100644
--- a/examples/tools/echoplugin/plugin/echoplugin.h
+++ b/examples/tools/echoplugin/plugin/echoplugin.h
@@ -42,6 +42,7 @@
#define ECHOPLUGIN_H
#include <QObject>
+#include <QtPlugin>
#include "echoplugin.h"
#include "echointerface.h"
@@ -49,6 +50,7 @@
class EchoPlugin : public QObject, EchoInterface
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.EchoInterface" FILE "echoplugin.json")
Q_INTERFACES(EchoInterface)
public:
diff --git a/examples/tools/echoplugin/plugin/echoplugin.json b/examples/tools/echoplugin/plugin/echoplugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/tools/echoplugin/plugin/echoplugin.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/tools/echoplugin/plugin/plugin.pro b/examples/tools/echoplugin/plugin/plugin.pro
index 2be6de80d1..308c1b8236 100644
--- a/examples/tools/echoplugin/plugin/plugin.pro
+++ b/examples/tools/echoplugin/plugin/plugin.pro
@@ -4,6 +4,7 @@ CONFIG += plugin
INCLUDEPATH += ../echowindow
HEADERS = echoplugin.h
SOURCES = echoplugin.cpp
+OTHER_FILES += echoplugin.json
TARGET = $$qtLibraryTarget(echoplugin)
DESTDIR = ../plugins
#! [0]
diff --git a/examples/tools/plugandpaint/interfaces.h b/examples/tools/plugandpaint/interfaces.h
index e48683cf68..5c1e0c302d 100644
--- a/examples/tools/plugandpaint/interfaces.h
+++ b/examples/tools/plugandpaint/interfaces.h
@@ -96,14 +96,18 @@ public:
QT_BEGIN_NAMESPACE
//! [3] //! [4]
-Q_DECLARE_INTERFACE(BrushInterface,
- "com.trolltech.PlugAndPaint.BrushInterface/1.0")
+#define BrushInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface"
+
+Q_DECLARE_INTERFACE(BrushInterface, BrushInterface_iid)
//! [3]
-Q_DECLARE_INTERFACE(ShapeInterface,
- "com.trolltech.PlugAndPaint.ShapeInterface/1.0")
+
+#define ShapeInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.ShapeInterface"
+
+Q_DECLARE_INTERFACE(ShapeInterface, ShapeInterface_iid)
//! [5]
-Q_DECLARE_INTERFACE(FilterInterface,
- "com.trolltech.PlugAndPaint.FilterInterface/1.0")
+#define FilterInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface"
+
+Q_DECLARE_INTERFACE(FilterInterface, FilterInterface_iid)
//! [4] //! [5]
QT_END_NAMESPACE
diff --git a/examples/tools/plugandpaint/main.cpp b/examples/tools/plugandpaint/main.cpp
index 841d5b417b..3c3693ec0b 100644
--- a/examples/tools/plugandpaint/main.cpp
+++ b/examples/tools/plugandpaint/main.cpp
@@ -43,9 +43,7 @@
#include <QtPlugin>
#include <QApplication>
-QT_BEGIN_NAMESPACE
-Q_IMPORT_PLUGIN(pnp_basictools)
-QT_END_NAMESPACE
+Q_IMPORT_PLUGIN(BasicToolsPlugin)
int main(int argc, char *argv[])
{
diff --git a/examples/tools/plugandpaintplugins/basictools/basictools.json b/examples/tools/plugandpaintplugins/basictools/basictools.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/tools/plugandpaintplugins/basictools/basictools.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/tools/plugandpaintplugins/basictools/basictools.pro b/examples/tools/plugandpaintplugins/basictools/basictools.pro
index 6175de34a3..89023d19cc 100644
--- a/examples/tools/plugandpaintplugins/basictools/basictools.pro
+++ b/examples/tools/plugandpaintplugins/basictools/basictools.pro
@@ -4,6 +4,7 @@ CONFIG += plugin static
INCLUDEPATH += ../..
HEADERS = basictoolsplugin.h
SOURCES = basictoolsplugin.cpp
+OTHER_FILES += basictools.json
TARGET = $$qtLibraryTarget(pnp_basictools)
DESTDIR = ../../plugandpaint/plugins
#! [0]
diff --git a/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp b/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp
index d55048dc0c..bbcae608fa 100644
--- a/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp
+++ b/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp
@@ -189,9 +189,3 @@ QImage BasicToolsPlugin::filterImage(const QString &filter, const QImage &image,
return result;
}
//! [8]
-
-QT_BEGIN_NAMESPACE
-//! [9]
-Q_EXPORT_PLUGIN2(pnp_basictools, BasicToolsPlugin)
-//! [9]
-QT_END_NAMESPACE
diff --git a/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.h b/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.h
index c857e4c7a0..a895b60a18 100644
--- a/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.h
+++ b/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.h
@@ -43,6 +43,7 @@
#include <QRect>
#include <QObject>
+#include <QtPlugin>
#include <QStringList>
#include <QPainterPath>
#include <QImage>
@@ -57,6 +58,7 @@ class BasicToolsPlugin : public QObject,
public FilterInterface
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface" FILE "basictools.json")
Q_INTERFACES(BrushInterface ShapeInterface FilterInterface)
//! [0]
diff --git a/examples/tools/plugandpaintplugins/extrafilters/extrafilters.json b/examples/tools/plugandpaintplugins/extrafilters/extrafilters.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/tools/plugandpaintplugins/extrafilters/extrafilters.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro b/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro
index 70e7c42c76..89acbabb23 100644
--- a/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro
+++ b/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro
@@ -4,6 +4,7 @@ CONFIG += plugin
INCLUDEPATH += ../..
HEADERS = extrafiltersplugin.h
SOURCES = extrafiltersplugin.cpp
+OTHER_FILES += extrafilters.json
TARGET = $$qtLibraryTarget(pnp_extrafilters)
DESTDIR = ../../plugandpaint/plugins
diff --git a/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp b/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp
index 9303fbb6a6..186f364b77 100644
--- a/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp
+++ b/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp
@@ -120,5 +120,3 @@ QImage ExtraFiltersPlugin::filterImage(const QString &filter,
}
return result;
}
-
-Q_EXPORT_PLUGIN2(pnp_extrafilters, ExtraFiltersPlugin)
diff --git a/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h b/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h
index b88febe347..6693287294 100644
--- a/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h
+++ b/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h
@@ -43,6 +43,7 @@
//! [0]
#include <QObject>
+#include <QtPlugin>
#include <QStringList>
#include <QImage>
@@ -51,6 +52,7 @@
class ExtraFiltersPlugin : public QObject, public FilterInterface
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface" FILE "extrafilters.json")
Q_INTERFACES(FilterInterface)
public:
diff --git a/examples/tools/styleplugin/plugin/plugin.pro b/examples/tools/styleplugin/plugin/plugin.pro
index e5cdbe072b..b0dd871b7b 100644
--- a/examples/tools/styleplugin/plugin/plugin.pro
+++ b/examples/tools/styleplugin/plugin/plugin.pro
@@ -5,6 +5,7 @@ HEADERS = simplestyle.h \
simplestyleplugin.h
SOURCES = simplestyle.cpp \
simplestyleplugin.cpp
+OTHER_FILES += simplestyle.json
TARGET = simplestyleplugin
#! [0]
win32 {
diff --git a/examples/tools/styleplugin/plugin/simplestyle.json b/examples/tools/styleplugin/plugin/simplestyle.json
new file mode 100644
index 0000000000..a708e2aafe
--- /dev/null
+++ b/examples/tools/styleplugin/plugin/simplestyle.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "simplestyle" ]
+}
diff --git a/examples/tools/styleplugin/plugin/simplestyleplugin.cpp b/examples/tools/styleplugin/plugin/simplestyleplugin.cpp
index caf3e01dcf..4b37b2adf2 100644
--- a/examples/tools/styleplugin/plugin/simplestyleplugin.cpp
+++ b/examples/tools/styleplugin/plugin/simplestyleplugin.cpp
@@ -58,7 +58,3 @@ QStyle *SimpleStylePlugin::create(const QString &key)
return 0;
}
//! [1]
-
-QT_BEGIN_NAMESPACE
-Q_EXPORT_PLUGIN2(simplestyleplugin, SimpleStylePlugin)
-QT_END_NAMESPACE
diff --git a/examples/tools/styleplugin/plugin/simplestyleplugin.h b/examples/tools/styleplugin/plugin/simplestyleplugin.h
index 873ac59a67..eb2cdedfed 100644
--- a/examples/tools/styleplugin/plugin/simplestyleplugin.h
+++ b/examples/tools/styleplugin/plugin/simplestyleplugin.h
@@ -52,9 +52,10 @@ QT_END_NAMESPACE
class SimpleStylePlugin : public QStylePlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "simplestyle.json")
public:
- SimpleStylePlugin() {};
+ SimpleStylePlugin() {}
QStringList keys() const;
QStyle *create(const QString &key);
diff --git a/examples/widgets/validators/validators.pro b/examples/widgets/validators/validators.pro
index f4cab8edac..7970f961cd 100644
--- a/examples/widgets/validators/validators.pro
+++ b/examples/widgets/validators/validators.pro
@@ -1,16 +1,8 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue Nov 28 13:20:04 2006
-######################################################################
-
-TEMPLATE = app
-TARGET = validators
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += widgets
FORMS += validators.ui
RESOURCES += validators.qrc
-# Input
SOURCES += main.cpp ledwidget.cpp localeselector.cpp
HEADERS += ledwidget.h localeselector.h
@@ -20,6 +12,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/validators
INSTALLS += target sources
-QT += widgets
-
simulator: warning(This example might not fully work on Simulator platform)
diff --git a/mkspecs/cmake/Qt5BasicConfig.cmake.in b/mkspecs/cmake/Qt5BasicConfig.cmake.in
index b3d33d62d1..45a0722ef5 100644
--- a/mkspecs/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/cmake/Qt5BasicConfig.cmake.in
@@ -6,7 +6,12 @@ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MINOR "$$eval(QT.$${MODULE}.MINOR_VERSION)"
set(Qt5$${CMAKE_MODULE_NAME}_VERSION_PATCH "$$eval(QT.$${MODULE}.PATCH_VERSION)")
set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME})
-set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${_qt5_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5_install_prefix}/$$CMAKE_INCLUDE_DIR/Qt$${CMAKE_MODULE_NAME}\")
+
+!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${_qt5_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5_install_prefix}/$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\")
+!!ELSE
+set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\")
+!!ENDIF
string(TOUPPER "$${CMAKE_MODULE_NAME}" _CMAKE_MODULE_NAME_UPPER)
set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -DQT_\${_CMAKE_MODULE_NAME_UPPER}_LIB)
@@ -32,46 +37,58 @@ endif()
if (NOT _Qt5$${CMAKE_MODULE_NAME}_target)
set(_Qt5$${CMAKE_MODULE_NAME}_target 1)
- if (\"$${CMAKE_STATIC_TYPE}\" STREQUAL \"\")
- add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
- else()
- add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
- endif()
- if (NOT \"$${CMAKE_BUILD_IS_FRAMEWORK}\" STREQUAL \"\")
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
- endif()
+!!IF !isEmpty(CMAKE_STATIC_TYPE)
+ add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
+!!ELSE
+ add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
+!!ENDIF
+!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
+!!ENDIF
endif()
-if (NOT \"$${debug_type}\" STREQUAL \"\")
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
- IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"$${CMAKE_QT5_MODULE_DEPS}\"
- IMPORTED_LOCATION_DEBUG \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
- )
- if (NOT \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" STREQUAL \"\")
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
- IMPORTED_IMPLIB_DEBUG \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\"
- )
- endif()
-endif()
+!!IF !isEmpty(debug_type)
+set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"$${CMAKE_QT5_MODULE_DEPS}\"
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ IMPORTED_LOCATION_DEBUG \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+!!ELSE
+ IMPORTED_LOCATION_DEBUG \"$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+!!ENDIF
+)
+!!IF !isEmpty(CMAKE_IMPLIB_FILE_LOCATION_DEBUG)
+set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ IMPORTED_IMPLIB_DEBUG \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\"
+)
+!!ENDIF
+!!ENDIF
-if (NOT \"$${release_type}\" STREQUAL \"\")
- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
- IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"$${CMAKE_QT5_MODULE_DEPS}\"
- IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
- )
- if (NOT \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" STREQUAL \"\")
- set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
- IMPORTED_IMPLIB_RELEASE \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\"
- )
- endif()
-endif()
+!!IF !isEmpty(release_type)
+set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+ IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"$${CMAKE_QT5_MODULE_DEPS}\"
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+!!ELSE
+ IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+!!ENDIF
+)
+!!IF !isEmpty(CMAKE_IMPLIB_FILE_LOCATION_RELEASE)
+set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ IMPORTED_IMPLIB_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\"
+!!ELSE
+ IMPORTED_IMPLIB_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\"
+!!ENDIF
+)
+!!ENDIF
+!!ENDIF
-if (NOT \"$${CMAKE_MODULE_EXTRAS}\" STREQUAL \"\")
- include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")
-endif()
+!!IF !isEmpty(CMAKE_MODULE_EXTRAS)
+include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")
+!!ENDIF
-if (NOT \"$${CMAKE_MODULE_MACROS}\" STREQUAL \"\")
- include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake\")
-endif()
+!!IF !isEmpty(CMAKE_MODULE_MACROS)
+include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake\")
+!!ENDIF
diff --git a/mkspecs/common/qcc-base.conf b/mkspecs/common/qcc-base.conf
index da006f52d7..5aa09cf21d 100644
--- a/mkspecs/common/qcc-base.conf
+++ b/mkspecs/common/qcc-base.conf
@@ -15,6 +15,7 @@ QMAKE_CFLAGS_RELEASE += -O2
QMAKE_CFLAGS_DEBUG += -g
QMAKE_CFLAGS_SHLIB += -fPIC
QMAKE_CFLAGS_STATIC_LIB += -fPIC
+QMAKE_CFLAGS_APP += -fPIE
QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses
QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden
@@ -26,6 +27,7 @@ QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB
QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB
+QMAKE_CXXFLAGS_APP += $$QMAKE_CFLAGS_APP
QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 3ae4ddc83b..1aa8ae5544 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -21,13 +21,40 @@ CMAKE_MODULE_DEPS = $$cmakeModuleList($$eval(QT.$${MODULE}.depends))
CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5::")
!isEmpty(CMAKE_PARTIAL_MODULE_DEPS):CMAKE_QT5_MODULE_DEPS = "Qt5::$${CMAKE_PARTIAL_MODULE_DEPS}"
-CMAKE_INCLUDE_DIR = include
-CMAKE_LIBS = $$eval(QT.$${MODULE}.libs)
-CMAKE_LIB_DIR = $$replace(CMAKE_LIBS, ^.*/, )
-CMAKE_BINS = $$eval(QT.$${MODULE}.bins)
-CMAKE_BIN_DIR = $$replace(CMAKE_BINS, ^.*/, )
+CMAKE_QT_INSTALL_PREFIX = $$replace($$list($$[QT_INSTALL_PREFIX]), \\\\, /)/
+CMAKE_QT_INSTALL_PREFIX_ESCAPED = "^$$re_escape($$CMAKE_QT_INSTALL_PREFIX)"
-CMAKE_RELATIVE_INSTALL_DIR = "../../../"
+CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]
+contains(CMAKE_INCLUDE_DIR, "$${CMAKE_QT_INSTALL_PREFIX_ESCAPED}.*") {
+ CMAKE_INCLUDE_DIR = $$replace(CMAKE_INCLUDE_DIR, "$$CMAKE_QT_INSTALL_PREFIX_ESCAPED", )
+} else {
+ CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+}
+
+CMAKE_LIB_DIR = $$replace($$list($$[QT_INSTALL_LIBS]), \\\\, /)/
+contains(CMAKE_LIB_DIR, "$${CMAKE_QT_INSTALL_PREFIX_ESCAPED}.*") {
+ CMAKE_LIB_DIR = $$replace(CMAKE_LIB_DIR, "$$CMAKE_QT_INSTALL_PREFIX_ESCAPED", )
+ CMAKE_RELATIVE_INSTALL_DIR = $$replace(CMAKE_LIB_DIR, "[^/]+", ..)
+ # We need to go up another two levels because the CMake files are
+ # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+ CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_DIR}../../"
+} else {
+ CMAKE_LIB_DIR_IS_ABSOLUTE = True
+}
+
+CMAKE_BIN_DIR = $$replace($$list($$[QT_INSTALL_BINS]), \\\\, /)/
+contains(CMAKE_BIN_DIR, "$${CMAKE_QT_INSTALL_PREFIX_ESCAPED}.*") {
+ CMAKE_BIN_DIR = $$replace(CMAKE_BIN_DIR, "$$CMAKE_QT_INSTALL_PREFIX_ESCAPED", )
+} else {
+ CMAKE_BIN_DIR_IS_ABSOLUTE = True
+}
+
+CMAKE_DATA_DIR = $$replace($$list($$[QT_INSTALL_DATA]), \\\\, /)/ # For the mkspecs
+contains(CMAKE_DATA_DIR, "$${CMAKE_QT_INSTALL_PREFIX_ESCAPED}.*") {
+ CMAKE_DATA_DIR = $$replace(CMAKE_DATA_DIR, "$$CMAKE_QT_INSTALL_PREFIX_ESCAPED", )
+} else {
+ CMAKE_DATA_DIR_IS_ABSOLUTE = True
+}
static|staticlib:CMAKE_STATIC_TYPE = true
@@ -48,16 +75,35 @@ macx {
}
}
} else:win32 {
- !isEmpty(CMAKE_STATIC_TYPE) {
- CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d.lib
- CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.lib
+ CMAKE_WINDOWS_BUILD = "true"
+ CMAKE_BIN_SUFFIX = ".exe"
+
+ CMAKE_LIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).dll
+ CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).dll
+
+ win32-g++ {
+ CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}d.a
+ CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a
+
+ !isEmpty(CMAKE_STATIC_TYPE) {
+ CMAKE_IMPLIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d.a
+ CMAKE_IMPLIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a
+ } else {
+ CMAKE_IMPLIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).a
+ CMAKE_IMPLIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).a
+ }
} else {
- CMAKE_LIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).dll
- CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).dll
- CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
- CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
+ CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib
+ CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib
+
+ !isEmpty(CMAKE_STATIC_TYPE) {
+ CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d.lib
+ CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.lib
+ } else {
+ CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
+ CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
+ }
}
- CMAKE_BIN_SUFFIX = ".exe"
} else {
!isEmpty(CMAKE_STATIC_TYPE) {
CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.a
diff --git a/mkspecs/features/opengles1.prf b/mkspecs/features/opengles1.prf
new file mode 100644
index 0000000000..b09262f8a9
--- /dev/null
+++ b/mkspecs/features/opengles1.prf
@@ -0,0 +1,2 @@
+QMAKE_LIBS_OPENGL_ES2 =
+LIBS += $$QMAKE_LIBS_OPENGL_ES1
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 1c2aec49c6..5328e6ccff 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -158,7 +158,7 @@ QT = $$sort_depends(QT, "QT.")
QT_DEPENDS=
unset(using_privates)
-for(QTLIB, $$list($$lower($$unique(QT)))) {
+for(QTLIB, QT) {
# Figure out if we're wanting to use the private headers of a module
contains(QTLIB, .*-private) {
QTLIB ~= s/-private//
diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf
index 3d0028c3a3..8441728815 100644
--- a/mkspecs/features/qt_config.prf
+++ b/mkspecs/features/qt_config.prf
@@ -6,9 +6,10 @@ exists($$_QMAKE_CACHE_) {
QMAKE_EXTRA_MODULE_FORWARDS = $$fromfile($$_QMAKE_CACHE_, QMAKE_EXTRA_MODULE_FORWARDS)
}
isEmpty(QMAKE_QT_CONFIG)|!exists($$QMAKE_QT_CONFIG) {
- !isEmpty(QT_BUILD_TREE):QMAKE_QT_CONFIG = $$QT_BUILD_TREE/mkspecs/qconfig.pri
- else:exists($$_QMAKE_CACHE_):infile($$_QMAKE_CACHE_, QT_BUILD_TREE):QMAKE_QT_CONFIG = $$fromfile($$_QMAKE_CACHE_, QT_BUILD_TREE)/mkspecs/qconfig.pri
- isEmpty(QMAKE_QT_CONFIG):exists($$[QT_INSTALL_DATA]/mkspecs/qconfig.pri):QMAKE_QT_CONFIG = $$[QT_INSTALL_DATA]/mkspecs/qconfig.pri
+ !isEmpty(QT_BUILD_TREE):QMAKE_QT_CONFIG = $$QT_BUILD_TREE
+ else:exists($$_QMAKE_CACHE_):QMAKE_QT_CONFIG = $$fromfile($$_QMAKE_CACHE_, QT_BUILD_TREE)
+ isEmpty(QMAKE_QT_CONFIG):QMAKE_QT_CONFIG = $$[QT_INSTALL_DATA]
+ QMAKE_QT_CONFIG = $$QMAKE_QT_CONFIG/mkspecs/qconfig.pri
}
!exists($$QMAKE_QT_CONFIG)|!include($$QMAKE_QT_CONFIG, "", true) {
debug(1, "Cannot load qconfig.pri!")
diff --git a/mkspecs/features/qt_targets.prf b/mkspecs/features/qt_targets.prf
index ec15869b0f..c23d63fc7f 100644
--- a/mkspecs/features/qt_targets.prf
+++ b/mkspecs/features/qt_targets.prf
@@ -1,4 +1,4 @@
QMAKE_TARGET_COMPANY = Nokia Corporation and/or its subsidiary(-ies)
-QMAKE_TARGET_PRODUCT = Qt4
+QMAKE_TARGET_PRODUCT = Qt5
QMAKE_TARGET_DESCRIPTION = C++ application development framework.
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index dd098596e9..59a615e63a 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2508,10 +2508,10 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if(!in_directory.isEmpty()) {
t << mkdir_p_asstring(out_directory)
<< out_directory_cdin
- << "$(QMAKE) " << escapeFilePath(in) << buildArgs(in_directory) << " -o " << out
+ << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out
<< in_directory_cdout << endl;
} else {
- t << "$(QMAKE) " << escapeFilePath(in) << buildArgs(in_directory) << " -o " << out << endl;
+ t << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << endl;
}
t << subtarget->target << "-qmake_all: ";
if(project->isEmpty("QMAKE_NOFORCE"))
@@ -2520,10 +2520,10 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
if(!in_directory.isEmpty()) {
t << mkdir_p_asstring(out_directory)
<< out_directory_cdin
- << "$(QMAKE) " << escapeFilePath(in) << buildArgs(in_directory) << " -o " << out
+ << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out
<< in_directory_cdout << endl;
} else {
- t << "$(QMAKE) " << escapeFilePath(in) << buildArgs(in_directory) << " -o " << out << endl;
+ t << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out << endl;
}
}
@@ -3287,6 +3287,7 @@ MakefileGenerator::writePkgConfigFile()
} else {
pkgConfiglibDir = "-L${libdir}";
pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
+ pkgConfiglibName += project->first("TARGET_VERSION_EXT");
}
t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl;
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 4d1a310daf..a2eb45ef40 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -85,12 +85,6 @@ ProjectGenerator::init()
templ.prepend(Option::user_template_prefix);
v["TEMPLATE_ASSIGN"] += templ;
- //figure out target
- if(Option::output.fileName() == "-")
- v["TARGET_ASSIGN"] = QStringList("unknown");
- else
- v["TARGET_ASSIGN"] = QStringList(QFileInfo(Option::output).baseName());
-
//the scary stuff
if(project->first("TEMPLATE_ASSIGN") != "subdirs") {
QString builtin_regex = project_builtin_regx();
@@ -360,6 +354,12 @@ ProjectGenerator::writeMakefile(QTextStream &t)
t << endl << "# Directories" << "\n"
<< getWritableVar("SUBDIRS");
} else {
+ //figure out target
+ QString ofn = QFileInfo(static_cast<QFile *>(t.device())->fileName()).completeBaseName();
+ if (ofn.isEmpty() || ofn == "-")
+ ofn = "unknown";
+ project->variables()["TARGET_ASSIGN"] = QStringList(ofn);
+
t << getWritableVar("TARGET_ASSIGN")
<< getWritableVar("CONFIG", false)
<< getWritableVar("CONFIG_REMOVE", false)
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 5f0828383f..a26be16f78 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -844,6 +844,12 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
QString dst_pc = pkgConfigFileName(false);
if (!dst_pc.isEmpty()) {
dst_pc = filePrefixRoot(root, targetdir + dst_pc);
+ const QString dst_pc_dir = fileInfo(dst_pc).path();
+ if (!dst_pc_dir.isEmpty()) {
+ if (!ret.isEmpty())
+ ret += "\n\t";
+ ret += mkdir_p_asstring(dst_pc_dir, true);
+ }
if(!ret.isEmpty())
ret += "\n\t";
ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\"";
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 38e09f60fd..54cf9f9bdf 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -163,6 +163,11 @@ int runQMake(int argc, char **argv)
fn = fn.right(fn.length() - di - 1);
}
+ if (!Option::prepareProject()) {
+ exit_val = 3;
+ break;
+ }
+
// read project..
if(!project.read(fn)) {
fprintf(stderr, "Error processing project file: %s\n",
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 431299b46b..0c649fdd77 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -116,6 +116,7 @@ bool Option::mkfile::do_dep_heuristics = true;
bool Option::mkfile::do_preprocess = false;
bool Option::mkfile::do_stub_makefile = false;
bool Option::mkfile::do_cache = true;
+QString Option::mkfile::project_build_root;
QString Option::mkfile::cachefile;
QStringList Option::mkfile::project_files;
QString Option::mkfile::qmakespec_commandline;
@@ -146,6 +147,14 @@ static QString detectProjectFile(const QString &path)
return ret;
}
+static QString cleanSpec(const QString &spec)
+{
+ QString ret = QDir::cleanPath(spec);
+ if (ret.contains('/'))
+ ret = QDir::cleanPath(QFileInfo(ret).absoluteFilePath());
+ return ret;
+}
+
QString project_builtin_regx();
bool usage(const char *a0)
{
@@ -314,7 +323,7 @@ Option::parseCommandLine(int argc, char **argv, int skip)
} else if(opt == "cache") {
Option::mkfile::cachefile = argv[++x];
} else if(opt == "platform" || opt == "spec") {
- Option::mkfile::qmakespec = argv[++x];
+ Option::mkfile::qmakespec = cleanSpec(argv[++x]);
Option::mkfile::qmakespec_commandline = argv[x];
} else {
fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData());
@@ -567,6 +576,34 @@ void Option::applyHostMode()
}
}
+bool Option::prepareProject()
+{
+ mkfile::project_build_root.clear();
+ if (mkfile::do_cache) {
+ if (mkfile::cachefile.isEmpty()) { //find it as it has not been specified
+ QDir dir(output_dir);
+ while (!dir.exists(QLatin1String(".qmake.cache")))
+ if (dir.isRoot() || !dir.cdUp())
+ goto no_cache;
+ mkfile::cachefile = dir.filePath(QLatin1String(".qmake.cache"));
+ mkfile::project_build_root = dir.path();
+ } else {
+ QFileInfo fi(mkfile::cachefile);
+ mkfile::cachefile = QDir::cleanPath(fi.absoluteFilePath());
+ mkfile::project_build_root = QDir::cleanPath(fi.absolutePath());
+ }
+
+ if (mkfile::qmakespec.isEmpty()) {
+ QMakeProject cproj;
+ if (!cproj.read(mkfile::cachefile, QMakeProject::ReadProFile))
+ return false;
+ mkfile::qmakespec = cproj.first(QLatin1String("QMAKESPEC"));
+ }
+ }
+ no_cache:
+ return true;
+}
+
bool Option::postProcessProject(QMakeProject *project)
{
Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"];
diff --git a/qmake/option.h b/qmake/option.h
index ee8a1c2403..b8a3b561fa 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -108,6 +108,7 @@ struct Option
//both of these must be called..
static int init(int argc=0, char **argv=0); //parse cmdline
static void applyHostMode();
+ static bool prepareProject();
static bool postProcessProject(QMakeProject *);
enum StringFixFlags {
@@ -201,6 +202,7 @@ struct Option
static bool do_dep_heuristics;
static bool do_preprocess;
static bool do_stub_makefile;
+ static QString project_build_root;
static QString cachefile;
static int cachefile_depth;
static QStringList project_files;
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 379854ed6a..52f2206410 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -592,10 +592,6 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
}
for(QStringList::Iterator concat_it = concat.begin();
concat_it != concat.end(); ++concat_it)
- feature_roots << (QLibraryInfo::location(QLibraryInfo::PrefixPath) +
- mkspecs_concat + (*concat_it));
- for(QStringList::Iterator concat_it = concat.begin();
- concat_it != concat.end(); ++concat_it)
feature_roots << (QLibraryInfo::location(QLibraryInfo::DataPath) +
mkspecs_concat + (*concat_it));
return feature_roots;
@@ -1285,35 +1281,9 @@ QMakeProject::read(uchar cmd)
base_vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix);
if ((cmd & ReadSetup) && Option::mkfile::do_cache) { // parse the cache
- int cache_depth = -1;
- QString qmake_cache = Option::mkfile::cachefile;
- if(qmake_cache.isEmpty()) { //find it as it has not been specified
- QString dir = Option::output_dir;
- while(!QFile::exists((qmake_cache = dir + QLatin1String("/.qmake.cache")))) {
- dir = dir.left(dir.lastIndexOf(QLatin1Char('/')));
- if(dir.isEmpty() || dir.indexOf(QLatin1Char('/')) == -1) {
- qmake_cache = "";
- break;
- }
- if(cache_depth == -1)
- cache_depth = 1;
- else
- cache_depth++;
- }
- } else {
- QString abs_cache = QFileInfo(Option::mkfile::cachefile).absoluteDir().path();
- if(Option::output_dir.startsWith(abs_cache))
- cache_depth = Option::output_dir.mid(abs_cache.length()).count('/');
- }
- if(!qmake_cache.isEmpty()) {
- QHash<QString, QStringList> cache;
- if(read(qmake_cache, cache)) {
- Option::mkfile::cachefile_depth = cache_depth;
- Option::mkfile::cachefile = qmake_cache;
- if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty())
- Option::mkfile::qmakespec = cache["QMAKESPEC"].first();
- }
- }
+ if (Option::output_dir.startsWith(Option::mkfile::project_build_root))
+ Option::mkfile::cachefile_depth =
+ Option::output_dir.mid(Option::mkfile::project_build_root.length()).count('/');
}
if (cmd & ReadSetup) { // parse mkspec
QString qmakespec = fixEnvVariables(Option::mkfile::qmakespec);
@@ -1444,9 +1414,6 @@ QMakeProject::read(uchar cmd)
parse("CONFIG += " + Option::after_user_configs.join(" "), vars);
}
- if(pfile != "-" && vars["TARGET"].isEmpty())
- vars["TARGET"].append(QFileInfo(pfile).baseName());
-
if(cmd & ReadFeatures) {
debug_msg(1, "Processing default_post: %s", vars["CONFIG"].join("::").toLatin1().constData());
doProjectInclude("default_post", IncludeFlagFeature, vars);
@@ -1528,12 +1495,15 @@ QMakeProject::resolveSpec(QString *spec, const QString &qmakespec)
// We can't resolve symlinks as they do on Unix, so configure.exe puts the source of the
// qmake.conf at the end of the default/qmake.conf in the QMAKESPEC_ORG variable.
const QStringList &spec_org = base_vars["QMAKESPEC_ORIGINAL"];
- if (!spec_org.isEmpty()) {
+ if (spec_org.isEmpty()) {
+ // try again the next time around
+ *spec = QString();
+ } else {
*spec = spec_org.at(0);
#endif
int lastSlash = spec->lastIndexOf(QLatin1Char('/'));
if (lastSlash != -1)
- spec->remove(lastSlash + 1);
+ spec->remove(0, lastSlash + 1);
}
}
}
@@ -1712,9 +1682,6 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
warn_msg(WarnParser, "%s:%d: QtScript support disabled for %s.",
pi.file.toLatin1().constData(), pi.line_no, orig_file.toLatin1().constData());
} else {
- QStack<ScopeBlock> sc = scope_blocks;
- IteratorBlock *it = iterator;
- FunctionBlock *fu = function;
if(flags & (IncludeFlagNewProject|IncludeFlagNewParser)) {
// The "project's variables" are used in other places (eg. export()) so it's not
// possible to use "place" everywhere. Instead just set variables and grab them later
@@ -1730,11 +1697,14 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
}
place = proj.variables();
} else {
+ QStack<ScopeBlock> sc = scope_blocks;
+ IteratorBlock *it = iterator;
+ FunctionBlock *fu = function;
parsed = read(file, place);
+ iterator = it;
+ function = fu;
+ scope_blocks = sc;
}
- iterator = it;
- function = fu;
- scope_blocks = sc;
}
if(parsed) {
if(place["QMAKE_INTERNAL_INCLUDED_FILES"].indexOf(orig_file) == -1)
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
index 0734442fe0..af0ee52e9a 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
@@ -265,6 +265,34 @@ static inline void positionCluster(HB_ShaperItem *item, int gfrom, int glast)
//qreal offsetBase = (size - 4) / 4 + qMin<qreal>(size, 4) + 1;
// qDebug("offset = %f", offsetBase);
+ // To fix some Thai character heights check for two above glyphs
+ if (nmarks == 2 && (attributes[gfrom+1].combiningClass == HB_Combining_AboveRight ||
+ attributes[gfrom+1].combiningClass == HB_Combining_AboveLeft ||
+ attributes[gfrom+1].combiningClass == HB_Combining_Above))
+ if (attributes[gfrom+2].combiningClass == 23 ||
+ attributes[gfrom+2].combiningClass == 24 ||
+ attributes[gfrom+2].combiningClass == 25 ||
+ attributes[gfrom+2].combiningClass == 27 ||
+ attributes[gfrom+2].combiningClass == 28 ||
+ attributes[gfrom+2].combiningClass == 30 ||
+ attributes[gfrom+2].combiningClass == 31 ||
+ attributes[gfrom+2].combiningClass == 33 ||
+ attributes[gfrom+2].combiningClass == 34 ||
+ attributes[gfrom+2].combiningClass == 35 ||
+ attributes[gfrom+2].combiningClass == 36 ||
+ attributes[gfrom+2].combiningClass == 107 ||
+ attributes[gfrom+2].combiningClass == 122) {
+ // Two above glyphs, check total height
+ int markTotalHeight = baseMetrics.height;
+ HB_GlyphMetrics markMetrics;
+ item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+1], &markMetrics);
+ markTotalHeight += markMetrics.height;
+ item->font->klass->getGlyphMetrics(item->font, glyphs[gfrom+2], &markMetrics);
+ markTotalHeight += markMetrics.height;
+ if ((markTotalHeight + 2 * offsetBase) > (size * 10))
+ offsetBase = ((size * 10) - markTotalHeight) / 2; // Use offset that just fits
+ }
+
bool rightToLeft = item->item.bidiLevel % 2;
int i;
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
index deff61be7e..bf6c35b19c 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
@@ -74,10 +74,10 @@ static void to_tis620(const HB_UChar16 *string, hb_uint32 len, const char *cstr)
for (i = 0; i < len; ++i) {
if (string[i] <= 0xa0)
result[i] = (unsigned char)string[i];
- if (string[i] >= 0xe01 && string[i] <= 0xe5b)
+ else if (string[i] >= 0xe01 && string[i] <= 0xe5b)
result[i] = (unsigned char)(string[i] - 0xe00 + 0xa0);
else
- result[i] = '?';
+ result[i] = (unsigned char)~0; // Same encoding as libthai uses for invalid chars
}
result[len] = 0;
@@ -259,8 +259,13 @@ static HB_Bool HB_ThaiConvertStringToGlyphIndices (HB_ShaperItem *item)
for (int lgi = 0; lgi < lgn; lgi++) {
if ( rglyphs[lgi] == 0xdd/*TH_BLANK_BASE_GLYPH*/ ) {
glyphString[slen++] = C_DOTTED_CIRCLE;
- }
- else {
+ } else if (cstr[i] == (signed char)~0) {
+ // The only glyphs that should be passed to this function that cannot be mapped to
+ // tis620 are the ones of type Inherited class. Pass these glyphs untouched.
+ glyphString[slen++] = string[i];
+ if (string[i] == 0x200D || string[i] == 0x200C)
+ item->attributes[slen-1].dontPrint = true; // Hide ZWJ and ZWNJ characters
+ } else {
glyphString[slen++] = (HB_UChar16) thai_get_glyph_index (font_type, rglyphs[lgi]);
}
}
@@ -353,7 +358,7 @@ HB_Bool HB_ThaiShape (HB_ShaperItem *shaper_item)
const int availableGlyphs = shaper_item->num_glyphs;
if ( HB_SelectScript (shaper_item, thai_features) ) {
HB_OpenTypeShape (shaper_item, /*properties*/0);
- return HB_OpenTypePosition (shaper_item, availableGlyphs, /*doLogClusters*/false);
+ return HB_OpenTypePosition (shaper_item, availableGlyphs, /*doLogClusters*/true);
}
#endif
diff --git a/src/3rdparty/rfc6234/sha-private.h b/src/3rdparty/rfc6234/sha-private.h
new file mode 100644
index 0000000000..6e9c4520fb
--- /dev/null
+++ b/src/3rdparty/rfc6234/sha-private.h
@@ -0,0 +1,28 @@
+/************************ sha-private.h ************************/
+/***************** See RFC 6234 for details. *******************/
+#ifndef _SHA_PRIVATE__H
+#define _SHA_PRIVATE__H
+/*
+ * These definitions are defined in FIPS 180-3, section 4.1.
+ * Ch() and Maj() are defined identically in sections 4.1.1,
+ * 4.1.2, and 4.1.3.
+ *
+ * The definitions used in FIPS 180-3 are as follows:
+ */
+
+#ifndef USE_MODIFIED_MACROS
+#define SHA_Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
+#define SHA_Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
+#else /* USE_MODIFIED_MACROS */
+/*
+ * The following definitions are equivalent and potentially faster.
+ */
+
+#define SHA_Ch(x, y, z) (((x) & ((y) ^ (z))) ^ (z))
+#define SHA_Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
+
+#endif /* USE_MODIFIED_MACROS */
+
+#define SHA_Parity(x, y, z) ((x) ^ (y) ^ (z))
+
+#endif /* _SHA_PRIVATE__H */
diff --git a/src/3rdparty/rfc6234/sha.h b/src/3rdparty/rfc6234/sha.h
new file mode 100644
index 0000000000..9c26f0253c
--- /dev/null
+++ b/src/3rdparty/rfc6234/sha.h
@@ -0,0 +1,357 @@
+/**************************** sha.h ****************************/
+/***************** See RFC 6234 for details. *******************/
+/*
+ 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.
+*/
+#ifndef _SHA_H_
+#define _SHA_H_
+
+/*
+ * Description:
+ * This file implements the Secure Hash Algorithms
+ * as defined in the U.S. National Institute of Standards
+ * and Technology Federal Information Processing Standards
+ * Publication (FIPS PUB) 180-3 published in October 2008
+ * and formerly defined in its predecessors, FIPS PUB 180-1
+ * and FIP PUB 180-2.
+ *
+ * A combined document showing all algorithms is available at
+ * http://csrc.nist.gov/publications/fips/
+ * fips180-3/fips180-3_final.pdf
+ *
+ * The five hashes are defined in these sizes:
+ * SHA-1 20 byte / 160 bit
+ * SHA-224 28 byte / 224 bit
+ * SHA-256 32 byte / 256 bit
+ * SHA-384 48 byte / 384 bit
+ * SHA-512 64 byte / 512 bit
+ *
+ * Compilation Note:
+ * These files may be compiled with two options:
+ * USE_32BIT_ONLY - use 32-bit arithmetic only, for systems
+ * without 64-bit integers
+ *
+ * USE_MODIFIED_MACROS - use alternate form of the SHA_Ch()
+ * and SHA_Maj() macros that are equivalent
+ * and potentially faster on many systems
+ *
+ */
+
+// stdint.h include commented out by Nokia, it is not available on all platforms.
+// #include <stdint.h>
+/*
+ * If you do not have the ISO standard stdint.h header file, then you
+ * must typedef the following:
+ * name meaning
+ * uint64_t unsigned 64-bit integer
+ * uint32_t unsigned 32-bit integer
+ * uint8_t unsigned 8-bit integer (i.e., unsigned char)
+ * int_least16_t integer of >= 16 bits
+ *
+ * See stdint-example.h
+ */
+
+#ifndef _SHA_enum_
+#define _SHA_enum_
+/*
+ * All SHA functions return one of these values.
+ */
+enum {
+ shaSuccess = 0,
+ shaNull, /* Null pointer parameter */
+ shaInputTooLong, /* input data too long */
+ shaStateError, /* called Input after FinalBits or Result */
+ shaBadParam /* passed a bad parameter */
+};
+#endif /* _SHA_enum_ */
+
+/*
+ * These constants hold size information for each of the SHA
+ * hashing operations
+ */
+enum {
+ SHA1_Message_Block_Size = 64, SHA224_Message_Block_Size = 64,
+ SHA256_Message_Block_Size = 64, SHA384_Message_Block_Size = 128,
+ SHA512_Message_Block_Size = 128,
+ USHA_Max_Message_Block_Size = SHA512_Message_Block_Size,
+
+ SHA1HashSize = 20, SHA224HashSize = 28, SHA256HashSize = 32,
+ SHA384HashSize = 48, SHA512HashSize = 64,
+ USHAMaxHashSize = SHA512HashSize,
+
+ SHA1HashSizeBits = 160, SHA224HashSizeBits = 224,
+ SHA256HashSizeBits = 256, SHA384HashSizeBits = 384,
+ SHA512HashSizeBits = 512, USHAMaxHashSizeBits = SHA512HashSizeBits
+};
+
+/*
+ * These constants are used in the USHA (Unified SHA) functions.
+ */
+typedef enum SHAversion {
+ SHA1, SHA224, SHA256, SHA384, SHA512
+} SHAversion;
+
+/*
+ * This structure will hold context information for the SHA-1
+ * hashing operation.
+ */
+typedef struct SHA1Context {
+ uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
+
+ uint32_t Length_High; /* Message length in bits */
+ uint32_t Length_Low; /* Message length in bits */
+
+ int_least16_t Message_Block_Index; /* Message_Block array index */
+ /* 512-bit message blocks */
+ uint8_t Message_Block[SHA1_Message_Block_Size];
+
+ int Computed; /* Is the hash computed? */
+ int Corrupted; /* Cumulative corruption code */
+} SHA1Context;
+
+/*
+ * This structure will hold context information for the SHA-256
+ * hashing operation.
+ */
+typedef struct SHA256Context {
+ uint32_t Intermediate_Hash[SHA256HashSize/4]; /* Message Digest */
+
+ uint32_t Length_High; /* Message length in bits */
+ uint32_t Length_Low; /* Message length in bits */
+
+ int_least16_t Message_Block_Index; /* Message_Block array index */
+ /* 512-bit message blocks */
+ uint8_t Message_Block[SHA256_Message_Block_Size];
+
+ int Computed; /* Is the hash computed? */
+ int Corrupted; /* Cumulative corruption code */
+} SHA256Context;
+
+/*
+ * This structure will hold context information for the SHA-512
+ * hashing operation.
+ */
+typedef struct SHA512Context {
+#ifdef USE_32BIT_ONLY
+ uint32_t Intermediate_Hash[SHA512HashSize/4]; /* Message Digest */
+ uint32_t Length[4]; /* Message length in bits */
+#else /* !USE_32BIT_ONLY */
+ uint64_t Intermediate_Hash[SHA512HashSize/8]; /* Message Digest */
+ uint64_t Length_High, Length_Low; /* Message length in bits */
+#endif /* USE_32BIT_ONLY */
+
+ int_least16_t Message_Block_Index; /* Message_Block array index */
+ /* 1024-bit message blocks */
+ uint8_t Message_Block[SHA512_Message_Block_Size];
+
+ int Computed; /* Is the hash computed?*/
+ int Corrupted; /* Cumulative corruption code */
+} SHA512Context;
+
+/*
+ * This structure will hold context information for the SHA-224
+ * hashing operation. It uses the SHA-256 structure for computation.
+ */
+typedef struct SHA256Context SHA224Context;
+
+/*
+ * This structure will hold context information for the SHA-384
+ * hashing operation. It uses the SHA-512 structure for computation.
+ */
+typedef struct SHA512Context SHA384Context;
+
+/*
+ * This structure holds context information for all SHA
+ * hashing operations.
+ */
+typedef struct USHAContext {
+ int whichSha; /* which SHA is being used */
+ union {
+ SHA1Context sha1Context;
+ SHA224Context sha224Context; SHA256Context sha256Context;
+ SHA384Context sha384Context; SHA512Context sha512Context;
+ } ctx;
+} USHAContext;
+
+/*
+ * This structure will hold context information for the HMAC
+ * keyed-hashing operation.
+ */
+typedef struct HMACContext {
+ int whichSha; /* which SHA is being used */
+ int hashSize; /* hash size of SHA being used */
+ int blockSize; /* block size of SHA being used */
+ USHAContext shaContext; /* SHA context */
+ unsigned char k_opad[USHA_Max_Message_Block_Size];
+ /* outer padding - key XORd with opad */
+ int Computed; /* Is the MAC computed? */
+ int Corrupted; /* Cumulative corruption code */
+
+} HMACContext;
+
+/*
+ * This structure will hold context information for the HKDF
+ * extract-and-expand Key Derivation Functions.
+ */
+typedef struct HKDFContext {
+ int whichSha; /* which SHA is being used */
+ HMACContext hmacContext;
+ int hashSize; /* hash size of SHA being used */
+ unsigned char prk[USHAMaxHashSize];
+ /* pseudo-random key - output of hkdfInput */
+ int Computed; /* Is the key material computed? */
+ int Corrupted; /* Cumulative corruption code */
+} HKDFContext;
+
+/*
+ * Function Prototypes
+ */
+
+/* SHA-1 */
+extern int SHA1Reset(SHA1Context *);
+extern int SHA1Input(SHA1Context *, const uint8_t *bytes,
+ unsigned int bytecount);
+extern int SHA1FinalBits(SHA1Context *, uint8_t bits,
+ unsigned int bit_count);
+extern int SHA1Result(SHA1Context *,
+ uint8_t Message_Digest[SHA1HashSize]);
+
+/* SHA-224 */
+extern int SHA224Reset(SHA224Context *);
+extern int SHA224Input(SHA224Context *, const uint8_t *bytes,
+ unsigned int bytecount);
+extern int SHA224FinalBits(SHA224Context *, uint8_t bits,
+ unsigned int bit_count);
+extern int SHA224Result(SHA224Context *,
+ uint8_t Message_Digest[SHA224HashSize]);
+
+/* SHA-256 */
+extern int SHA256Reset(SHA256Context *);
+extern int SHA256Input(SHA256Context *, const uint8_t *bytes,
+ unsigned int bytecount);
+extern int SHA256FinalBits(SHA256Context *, uint8_t bits,
+ unsigned int bit_count);
+extern int SHA256Result(SHA256Context *,
+ uint8_t Message_Digest[SHA256HashSize]);
+
+/* SHA-384 */
+extern int SHA384Reset(SHA384Context *);
+extern int SHA384Input(SHA384Context *, const uint8_t *bytes,
+ unsigned int bytecount);
+extern int SHA384FinalBits(SHA384Context *, uint8_t bits,
+ unsigned int bit_count);
+extern int SHA384Result(SHA384Context *,
+ uint8_t Message_Digest[SHA384HashSize]);
+
+/* SHA-512 */
+extern int SHA512Reset(SHA512Context *);
+extern int SHA512Input(SHA512Context *, const uint8_t *bytes,
+ unsigned int bytecount);
+extern int SHA512FinalBits(SHA512Context *, uint8_t bits,
+ unsigned int bit_count);
+extern int SHA512Result(SHA512Context *,
+ uint8_t Message_Digest[SHA512HashSize]);
+
+/* Unified SHA functions, chosen by whichSha */
+extern int USHAReset(USHAContext *context, SHAversion whichSha);
+extern int USHAInput(USHAContext *context,
+ const uint8_t *bytes, unsigned int bytecount);
+extern int USHAFinalBits(USHAContext *context,
+ uint8_t bits, unsigned int bit_count);
+extern int USHAResult(USHAContext *context,
+ uint8_t Message_Digest[USHAMaxHashSize]);
+extern int USHABlockSize(enum SHAversion whichSha);
+extern int USHAHashSize(enum SHAversion whichSha);
+extern int USHAHashSizeBits(enum SHAversion whichSha);
+extern const char *USHAHashName(enum SHAversion whichSha);
+
+/*
+ * HMAC Keyed-Hashing for Message Authentication, RFC 2104,
+ * for all SHAs.
+ * This interface allows a fixed-length text input to be used.
+ */
+extern int hmac(SHAversion whichSha, /* which SHA algorithm to use */
+ const unsigned char *text, /* pointer to data stream */
+ int text_len, /* length of data stream */
+ const unsigned char *key, /* pointer to authentication key */
+ int key_len, /* length of authentication key */
+ uint8_t digest[USHAMaxHashSize]); /* caller digest to fill in */
+
+/*
+ * HMAC Keyed-Hashing for Message Authentication, RFC 2104,
+ * for all SHAs.
+ * This interface allows any length of text input to be used.
+ */
+extern int hmacReset(HMACContext *context, enum SHAversion whichSha,
+ const unsigned char *key, int key_len);
+extern int hmacInput(HMACContext *context, const unsigned char *text,
+ int text_len);
+extern int hmacFinalBits(HMACContext *context, uint8_t bits,
+ unsigned int bit_count);
+extern int hmacResult(HMACContext *context,
+ uint8_t digest[USHAMaxHashSize]);
+
+/*
+ * HKDF HMAC-based Extract-and-Expand Key Derivation Function,
+ * RFC 5869, for all SHAs.
+ */
+extern int hkdf(SHAversion whichSha, const unsigned char *salt,
+ int salt_len, const unsigned char *ikm, int ikm_len,
+ const unsigned char *info, int info_len,
+ uint8_t okm[ ], int okm_len);
+extern int hkdfExtract(SHAversion whichSha, const unsigned char *salt,
+ int salt_len, const unsigned char *ikm,
+ int ikm_len, uint8_t prk[USHAMaxHashSize]);
+extern int hkdfExpand(SHAversion whichSha, const uint8_t prk[ ],
+ int prk_len, const unsigned char *info,
+ int info_len, uint8_t okm[ ], int okm_len);
+
+/*
+ * HKDF HMAC-based Extract-and-Expand Key Derivation Function,
+ * RFC 5869, for all SHAs.
+ * This interface allows any length of text input to be used.
+ */
+extern int hkdfReset(HKDFContext *context, enum SHAversion whichSha,
+ const unsigned char *salt, int salt_len);
+extern int hkdfInput(HKDFContext *context, const unsigned char *ikm,
+ int ikm_len);
+extern int hkdfFinalBits(HKDFContext *context, uint8_t ikm_bits,
+ unsigned int ikm_bit_count);
+extern int hkdfResult(HKDFContext *context,
+ uint8_t prk[USHAMaxHashSize],
+ const unsigned char *info, int info_len,
+ uint8_t okm[USHAMaxHashSize], int okm_len);
+#endif /* _SHA_H_ */
diff --git a/src/3rdparty/rfc6234/sha224-256.c b/src/3rdparty/rfc6234/sha224-256.c
new file mode 100644
index 0000000000..9546540ea5
--- /dev/null
+++ b/src/3rdparty/rfc6234/sha224-256.c
@@ -0,0 +1,583 @@
+/************************* sha224-256.c ************************/
+/***************** See RFC 6234 for details. *******************/
+/* Copyright (c) 2011 IETF Trust and the persons identified as */
+/* authors of the code. All rights reserved. */
+/* See sha.h for terms of use and redistribution. */
+
+/*
+ * Description:
+ * This file implements the Secure Hash Algorithms SHA-224 and
+ * SHA-256 as defined in the U.S. National Institute of Standards
+ * and Technology Federal Information Processing Standards
+ * Publication (FIPS PUB) 180-3 published in October 2008
+ * and formerly defined in its predecessors, FIPS PUB 180-1
+ * and FIP PUB 180-2.
+ *
+ * A combined document showing all algorithms is available at
+ * http://csrc.nist.gov/publications/fips/
+ * fips180-3/fips180-3_final.pdf
+ *
+ * The SHA-224 and SHA-256 algorithms produce 224-bit and 256-bit
+ * message digests for a given data stream. It should take about
+ * 2**n steps to find a message with the same digest as a given
+ * message and 2**(n/2) to find any two messages with the same
+ * digest, when n is the digest size in bits. Therefore, this
+ * algorithm can serve as a means of providing a
+ * "fingerprint" for a message.
+ *
+ * Portability Issues:
+ * SHA-224 and SHA-256 are defined in terms of 32-bit "words".
+ * This code uses <stdint.h> (included via "sha.h") to define 32-
+ * and 8-bit unsigned integer types. If your C compiler does not
+ * support 32-bit unsigned integers, this code is not
+ * appropriate.
+ *
+ * Caveats:
+ * SHA-224 and SHA-256 are designed to work with messages less
+ * than 2^64 bits long. This implementation uses SHA224/256Input()
+ * to hash the bits that are a multiple of the size of an 8-bit
+ * octet, and then optionally uses SHA224/256FinalBits()
+ * to hash the final few bits of the input.
+ */
+
+#include "sha.h"
+#include "sha-private.h"
+
+/* Define the SHA shift, rotate left, and rotate right macros */
+#define SHA256_SHR(bits,word) ((word) >> (bits))
+#define SHA256_ROTL(bits,word) \
+ (((word) << (bits)) | ((word) >> (32-(bits))))
+#define SHA256_ROTR(bits,word) \
+ (((word) >> (bits)) | ((word) << (32-(bits))))
+
+/* Define the SHA SIGMA and sigma macros */
+#define SHA256_SIGMA0(word) \
+ (SHA256_ROTR( 2,word) ^ SHA256_ROTR(13,word) ^ SHA256_ROTR(22,word))
+#define SHA256_SIGMA1(word) \
+ (SHA256_ROTR( 6,word) ^ SHA256_ROTR(11,word) ^ SHA256_ROTR(25,word))
+#define SHA256_sigma0(word) \
+ (SHA256_ROTR( 7,word) ^ SHA256_ROTR(18,word) ^ SHA256_SHR( 3,word))
+#define SHA256_sigma1(word) \
+ (SHA256_ROTR(17,word) ^ SHA256_ROTR(19,word) ^ SHA256_SHR(10,word))
+
+/*
+ * Add "length" to the length.
+ * Set Corrupted when overflow has occurred.
+ */
+/* addTemp commented out by Nokia, static variables are not thread-safe */
+/* static uint32_t addTemp; */
+/* 'M' appended to Macro name by Nokia */
+#define SHA224_256AddLengthM(context, length) \
+ (addTemp = (context)->Length_Low, (context)->Corrupted = \
+ (((context)->Length_Low += (length)) < addTemp) && \
+ (++(context)->Length_High == 0) ? shaInputTooLong : \
+ (context)->Corrupted )
+
+/* Local Function Prototypes */
+static int SHA224_256Reset(SHA256Context *context, uint32_t *H0);
+static void SHA224_256ProcessMessageBlock(SHA256Context *context);
+static void SHA224_256Finalize(SHA256Context *context,
+ uint8_t Pad_Byte);
+static void SHA224_256PadMessage(SHA256Context *context,
+ uint8_t Pad_Byte);
+static int SHA224_256ResultN(SHA256Context *context,
+ uint8_t Message_Digest[ ], int HashSize);
+
+/* Initial Hash Values: FIPS 180-3 section 5.3.2 */
+static uint32_t SHA224_H0[SHA256HashSize/4] = {
+ 0xC1059ED8, 0x367CD507, 0x3070DD17, 0xF70E5939,
+ 0xFFC00B31, 0x68581511, 0x64F98FA7, 0xBEFA4FA4
+};
+
+/* Initial Hash Values: FIPS 180-3 section 5.3.3 */
+static uint32_t SHA256_H0[SHA256HashSize/4] = {
+ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
+ 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19
+};
+
+/*
+ * SHA224Reset
+ *
+ * Description:
+ * This function will initialize the SHA224Context in preparation
+ * for computing a new SHA224 message digest.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to reset.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+int SHA224Reset(SHA224Context *context)
+{
+ return SHA224_256Reset(context, SHA224_H0);
+}
+
+/*
+ * SHA224Input
+ *
+ * Description:
+ * This function accepts an array of octets as the next portion
+ * of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_array[ ]: [in]
+ * An array of octets representing the next portion of
+ * the message.
+ * length: [in]
+ * The length of the message in message_array.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA224Input(SHA224Context *context, const uint8_t *message_array,
+ unsigned int length)
+{
+ return SHA256Input(context, message_array, length);
+}
+
+/*
+ * SHA224FinalBits
+ *
+ * Description:
+ * This function will add in any final bits of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_bits: [in]
+ * The final bits of the message, in the upper portion of the
+ * byte. (Use 0b###00000 instead of 0b00000### to input the
+ * three bits ###.)
+ * length: [in]
+ * The number of bits in message_bits, between 1 and 7.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+int SHA224FinalBits(SHA224Context *context,
+ uint8_t message_bits, unsigned int length)
+{
+ return SHA256FinalBits(context, message_bits, length);
+}
+
+/*
+ * SHA224Result
+ *
+ * Description:
+ * This function will return the 224-bit message digest
+ * into the Message_Digest array provided by the caller.
+ * NOTE:
+ * The first octet of hash is stored in the element with index 0,
+ * the last octet of hash in the element with index 27.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to use to calculate the SHA hash.
+ * Message_Digest[ ]: [out]
+ * Where the digest is returned.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+int SHA224Result(SHA224Context *context,
+ uint8_t Message_Digest[SHA224HashSize])
+{
+ return SHA224_256ResultN(context, Message_Digest, SHA224HashSize);
+}
+
+/*
+ * SHA256Reset
+ *
+ * Description:
+ * This function will initialize the SHA256Context in preparation
+ * for computing a new SHA256 message digest.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to reset.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+int SHA256Reset(SHA256Context *context)
+{
+ return SHA224_256Reset(context, SHA256_H0);
+}
+
+/*
+ * SHA256Input
+ *
+ * Description:
+ * This function accepts an array of octets as the next portion
+ * of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_array[ ]: [in]
+ * An array of octets representing the next portion of
+ * the message.
+ * length: [in]
+ * The length of the message in message_array.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+int SHA256Input(SHA256Context *context, const uint8_t *message_array,
+ unsigned int length)
+{
+ if (!context) return shaNull;
+ if (!length) return shaSuccess;
+ if (!message_array) return shaNull;
+ if (context->Computed) return context->Corrupted = shaStateError;
+ if (context->Corrupted) return context->Corrupted;
+
+ while (length--) {
+ context->Message_Block[context->Message_Block_Index++] =
+ *message_array;
+
+ if ((SHA224_256AddLength(context, 8) == shaSuccess) &&
+ (context->Message_Block_Index == SHA256_Message_Block_Size))
+ SHA224_256ProcessMessageBlock(context);
+
+ message_array++;
+ }
+
+ return context->Corrupted;
+
+}
+
+/*
+ * SHA256FinalBits
+ *
+ * Description:
+ * This function will add in any final bits of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_bits: [in]
+ * The final bits of the message, in the upper portion of the
+ * byte. (Use 0b###00000 instead of 0b00000### to input the
+ * three bits ###.)
+ * length: [in]
+ * The number of bits in message_bits, between 1 and 7.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+int SHA256FinalBits(SHA256Context *context,
+ uint8_t message_bits, unsigned int length)
+{
+ static uint8_t masks[8] = {
+ /* 0 0b00000000 */ 0x00, /* 1 0b10000000 */ 0x80,
+ /* 2 0b11000000 */ 0xC0, /* 3 0b11100000 */ 0xE0,
+ /* 4 0b11110000 */ 0xF0, /* 5 0b11111000 */ 0xF8,
+ /* 6 0b11111100 */ 0xFC, /* 7 0b11111110 */ 0xFE
+ };
+ static uint8_t markbit[8] = {
+ /* 0 0b10000000 */ 0x80, /* 1 0b01000000 */ 0x40,
+ /* 2 0b00100000 */ 0x20, /* 3 0b00010000 */ 0x10,
+ /* 4 0b00001000 */ 0x08, /* 5 0b00000100 */ 0x04,
+ /* 6 0b00000010 */ 0x02, /* 7 0b00000001 */ 0x01
+ };
+
+ if (!context) return shaNull;
+ if (!length) return shaSuccess;
+ if (context->Corrupted) return context->Corrupted;
+ if (context->Computed) return context->Corrupted = shaStateError;
+ if (length >= 8) return context->Corrupted = shaBadParam;
+
+ SHA224_256AddLength(context, length);
+ SHA224_256Finalize(context, (uint8_t)
+ ((message_bits & masks[length]) | markbit[length]));
+
+ return context->Corrupted;
+}
+
+/*
+ * SHA256Result
+ *
+ * Description:
+ * This function will return the 256-bit message digest
+ * into the Message_Digest array provided by the caller.
+ * NOTE:
+ * The first octet of hash is stored in the element with index 0,
+ * the last octet of hash in the element with index 31.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to use to calculate the SHA hash.
+ * Message_Digest[ ]: [out]
+ * Where the digest is returned.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+int SHA256Result(SHA256Context *context,
+ uint8_t Message_Digest[SHA256HashSize])
+{
+ return SHA224_256ResultN(context, Message_Digest, SHA256HashSize);
+}
+
+/*
+ * SHA224_256Reset
+ *
+ * Description:
+ * This helper function will initialize the SHA256Context in
+ * preparation for computing a new SHA-224 or SHA-256 message digest.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to reset.
+ * H0[ ]: [in]
+ * The initial hash value array to use.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+static int SHA224_256Reset(SHA256Context *context, uint32_t *H0)
+{
+ if (!context) return shaNull;
+
+ context->Length_High = context->Length_Low = 0;
+ context->Message_Block_Index = 0;
+
+ context->Intermediate_Hash[0] = H0[0];
+ context->Intermediate_Hash[1] = H0[1];
+ context->Intermediate_Hash[2] = H0[2];
+ context->Intermediate_Hash[3] = H0[3];
+ context->Intermediate_Hash[4] = H0[4];
+ context->Intermediate_Hash[5] = H0[5];
+ context->Intermediate_Hash[6] = H0[6];
+ context->Intermediate_Hash[7] = H0[7];
+
+ context->Computed = 0;
+ context->Corrupted = shaSuccess;
+
+ return shaSuccess;
+}
+
+/*
+ * SHA224_256ProcessMessageBlock
+ *
+ * Description:
+ * This helper function will process the next 512 bits of the
+ * message stored in the Message_Block array.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ *
+ * Returns:
+ * Nothing.
+ *
+ * Comments:
+ * Many of the variable names in this code, especially the
+ * single character names, were used because those were the
+ * names used in the Secure Hash Standard.
+ */
+static void SHA224_256ProcessMessageBlock(SHA256Context *context)
+{
+ /* Constants defined in FIPS 180-3, section 4.2.2 */
+ static const uint32_t K[64] = {
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
+ 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
+ 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,
+ 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,
+ 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
+ 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,
+ 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
+ 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
+ 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
+ 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+ };
+ int t, t4; /* Loop counter */
+ uint32_t temp1, temp2; /* Temporary word value */
+ uint32_t W[64]; /* Word sequence */
+ uint32_t A, B, C, D, E, F, G, H; /* Word buffers */
+
+ /*
+ * Initialize the first 16 words in the array W
+ */
+ for (t = t4 = 0; t < 16; t++, t4 += 4)
+ W[t] = (((uint32_t)context->Message_Block[t4]) << 24) |
+ (((uint32_t)context->Message_Block[t4 + 1]) << 16) |
+ (((uint32_t)context->Message_Block[t4 + 2]) << 8) |
+ (((uint32_t)context->Message_Block[t4 + 3]));
+
+ for (t = 16; t < 64; t++)
+ W[t] = SHA256_sigma1(W[t-2]) + W[t-7] +
+ SHA256_sigma0(W[t-15]) + W[t-16];
+
+ A = context->Intermediate_Hash[0];
+ B = context->Intermediate_Hash[1];
+ C = context->Intermediate_Hash[2];
+ D = context->Intermediate_Hash[3];
+ E = context->Intermediate_Hash[4];
+ F = context->Intermediate_Hash[5];
+ G = context->Intermediate_Hash[6];
+ H = context->Intermediate_Hash[7];
+
+ for (t = 0; t < 64; t++) {
+ temp1 = H + SHA256_SIGMA1(E) + SHA_Ch(E,F,G) + K[t] + W[t];
+ temp2 = SHA256_SIGMA0(A) + SHA_Maj(A,B,C);
+ H = G;
+ G = F;
+ F = E;
+ E = D + temp1;
+ D = C;
+ C = B;
+ B = A;
+ A = temp1 + temp2;
+ }
+
+ context->Intermediate_Hash[0] += A;
+ context->Intermediate_Hash[1] += B;
+ context->Intermediate_Hash[2] += C;
+ context->Intermediate_Hash[3] += D;
+ context->Intermediate_Hash[4] += E;
+ context->Intermediate_Hash[5] += F;
+ context->Intermediate_Hash[6] += G;
+ context->Intermediate_Hash[7] += H;
+
+ context->Message_Block_Index = 0;
+}
+
+/*
+ * SHA224_256Finalize
+ *
+ * Description:
+ * This helper function finishes off the digest calculations.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * Pad_Byte: [in]
+ * The last byte to add to the message block before the 0-padding
+ * and length. This will contain the last bits of the message
+ * followed by another single bit. If the message was an
+ * exact multiple of 8-bits long, Pad_Byte will be 0x80.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+static void SHA224_256Finalize(SHA256Context *context,
+ uint8_t Pad_Byte)
+{
+ int i;
+ SHA224_256PadMessage(context, Pad_Byte);
+ /* message may be sensitive, so clear it out */
+ for (i = 0; i < SHA256_Message_Block_Size; ++i)
+ context->Message_Block[i] = 0;
+ context->Length_High = 0; /* and clear length */
+ context->Length_Low = 0;
+ context->Computed = 1;
+}
+
+/*
+ * SHA224_256PadMessage
+ *
+ * Description:
+ * According to the standard, the message must be padded to the next
+ * even multiple of 512 bits. The first padding bit must be a '1'.
+ * The last 64 bits represent the length of the original message.
+ * All bits in between should be 0. This helper function will pad
+ * the message according to those rules by filling the
+ * Message_Block array accordingly. When it returns, it can be
+ * assumed that the message digest has been computed.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to pad.
+ * Pad_Byte: [in]
+ * The last byte to add to the message block before the 0-padding
+ * and length. This will contain the last bits of the message
+ * followed by another single bit. If the message was an
+ * exact multiple of 8-bits long, Pad_Byte will be 0x80.
+ *
+ * Returns:
+ * Nothing.
+ */
+static void SHA224_256PadMessage(SHA256Context *context,
+ uint8_t Pad_Byte)
+{
+ /*
+ * Check to see if the current message block is too small to hold
+ * the initial padding bits and length. If so, we will pad the
+ * block, process it, and then continue padding into a second
+ * block.
+ */
+ if (context->Message_Block_Index >= (SHA256_Message_Block_Size-8)) {
+ context->Message_Block[context->Message_Block_Index++] = Pad_Byte;
+ while (context->Message_Block_Index < SHA256_Message_Block_Size)
+ context->Message_Block[context->Message_Block_Index++] = 0;
+ SHA224_256ProcessMessageBlock(context);
+ } else
+ context->Message_Block[context->Message_Block_Index++] = Pad_Byte;
+
+ while (context->Message_Block_Index < (SHA256_Message_Block_Size-8))
+ context->Message_Block[context->Message_Block_Index++] = 0;
+
+ /*
+ * Store the message length as the last 8 octets
+ */
+ context->Message_Block[56] = (uint8_t)(context->Length_High >> 24);
+ context->Message_Block[57] = (uint8_t)(context->Length_High >> 16);
+ context->Message_Block[58] = (uint8_t)(context->Length_High >> 8);
+ context->Message_Block[59] = (uint8_t)(context->Length_High);
+ context->Message_Block[60] = (uint8_t)(context->Length_Low >> 24);
+ context->Message_Block[61] = (uint8_t)(context->Length_Low >> 16);
+ context->Message_Block[62] = (uint8_t)(context->Length_Low >> 8);
+ context->Message_Block[63] = (uint8_t)(context->Length_Low);
+
+ SHA224_256ProcessMessageBlock(context);
+}
+
+/*
+ * SHA224_256ResultN
+ *
+ * Description:
+ * This helper function will return the 224-bit or 256-bit message
+ * digest into the Message_Digest array provided by the caller.
+ * NOTE:
+ * The first octet of hash is stored in the element with index 0,
+ * the last octet of hash in the element with index 27/31.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to use to calculate the SHA hash.
+ * Message_Digest[ ]: [out]
+ * Where the digest is returned.
+ * HashSize: [in]
+ * The size of the hash, either 28 or 32.
+ *
+ * Returns:
+ * sha Error Code.
+ */
+static int SHA224_256ResultN(SHA256Context *context,
+ uint8_t Message_Digest[ ], int HashSize)
+{
+ int i;
+
+ if (!context) return shaNull;
+ if (!Message_Digest) return shaNull;
+ if (context->Corrupted) return context->Corrupted;
+
+ if (!context->Computed)
+ SHA224_256Finalize(context, 0x80);
+
+ for (i = 0; i < HashSize; ++i)
+ Message_Digest[i] = (uint8_t)
+ (context->Intermediate_Hash[i>>2] >> 8 * ( 3 - ( i & 0x03 ) ));
+
+ return shaSuccess;
+}
diff --git a/src/3rdparty/rfc6234/sha384-512.c b/src/3rdparty/rfc6234/sha384-512.c
new file mode 100644
index 0000000000..7d9ba3fa52
--- /dev/null
+++ b/src/3rdparty/rfc6234/sha384-512.c
@@ -0,0 +1,1034 @@
+/************************* sha384-512.c ************************/
+/***************** See RFC 6234 for details. *******************/
+/* Copyright (c) 2011 IETF Trust and the persons identified as */
+/* authors of the code. All rights reserved. */
+/* See sha.h for terms of use and redistribution. */
+
+/*
+ * Description:
+ * This file implements the Secure Hash Algorithms SHA-384 and
+ * SHA-512 as defined in the U.S. National Institute of Standards
+ * and Technology Federal Information Processing Standards
+ * Publication (FIPS PUB) 180-3 published in October 2008
+ * and formerly defined in its predecessors, FIPS PUB 180-1
+ * and FIP PUB 180-2.
+ *
+ * A combined document showing all algorithms is available at
+ * http://csrc.nist.gov/publications/fips/
+ * fips180-3/fips180-3_final.pdf
+ *
+ * The SHA-384 and SHA-512 algorithms produce 384-bit and 512-bit
+ * message digests for a given data stream. It should take about
+ * 2**n steps to find a message with the same digest as a given
+ * message and 2**(n/2) to find any two messages with the same
+ * digest, when n is the digest size in bits. Therefore, this
+ * algorithm can serve as a means of providing a
+ * "fingerprint" for a message.
+ *
+ * Portability Issues:
+ * SHA-384 and SHA-512 are defined in terms of 64-bit "words",
+ * but if USE_32BIT_ONLY is #defined, this code is implemented in
+ * terms of 32-bit "words". This code uses <stdint.h> (included
+ * via "sha.h") to define the 64-, 32- and 8-bit unsigned integer
+ * types. If your C compiler does not support 64-bit unsigned
+ * integers and you do not #define USE_32BIT_ONLY, this code is
+ * not appropriate.
+ *
+ * Caveats:
+ * SHA-384 and SHA-512 are designed to work with messages less
+ * than 2^128 bits long. This implementation uses SHA384/512Input()
+ * to hash the bits that are a multiple of the size of an 8-bit
+ * octet, and then optionally uses SHA384/256FinalBits()
+ * to hash the final few bits of the input.
+ *
+ */
+
+#include "sha.h"
+
+#ifdef USE_32BIT_ONLY
+/*
+ * Define 64-bit arithmetic in terms of 32-bit arithmetic.
+ * Each 64-bit number is represented in a 2-word array.
+ * All macros are defined such that the result is the last parameter.
+ */
+
+/*
+ * Define shift, rotate left, and rotate right functions
+ */
+#define SHA512_SHR(bits, word, ret) ( \
+ /* (((uint64_t)((word))) >> (bits)) */ \
+ (ret)[0] = (((bits) < 32) && ((bits) >= 0)) ? \
+ ((word)[0] >> (bits)) : 0, \
+ (ret)[1] = ((bits) > 32) ? ((word)[0] >> ((bits) - 32)) : \
+ ((bits) == 32) ? (word)[0] : \
+ ((bits) >= 0) ? \
+ (((word)[0] << (32 - (bits))) | \
+ ((word)[1] >> (bits))) : 0 )
+
+#define SHA512_SHL(bits, word, ret) ( \
+ /* (((uint64_t)(word)) << (bits)) */ \
+ (ret)[0] = ((bits) > 32) ? ((word)[1] << ((bits) - 32)) : \
+ ((bits) == 32) ? (word)[1] : \
+ ((bits) >= 0) ? \
+ (((word)[0] << (bits)) | \
+ ((word)[1] >> (32 - (bits)))) : \
+ 0, \
+ (ret)[1] = (((bits) < 32) && ((bits) >= 0)) ? \
+ ((word)[1] << (bits)) : 0 )
+
+/*
+ * Define 64-bit OR
+ */
+#define SHA512_OR(word1, word2, ret) ( \
+ (ret)[0] = (word1)[0] | (word2)[0], \
+ (ret)[1] = (word1)[1] | (word2)[1] )
+
+/*
+ * Define 64-bit XOR
+ */
+#define SHA512_XOR(word1, word2, ret) ( \
+ (ret)[0] = (word1)[0] ^ (word2)[0], \
+ (ret)[1] = (word1)[1] ^ (word2)[1] )
+
+/*
+ * Define 64-bit AND
+ */
+#define SHA512_AND(word1, word2, ret) ( \
+ (ret)[0] = (word1)[0] & (word2)[0], \
+ (ret)[1] = (word1)[1] & (word2)[1] )
+
+/*
+ * Define 64-bit TILDA
+ */
+#define SHA512_TILDA(word, ret) \
+ ( (ret)[0] = ~(word)[0], (ret)[1] = ~(word)[1] )
+
+/*
+ * Define 64-bit ADD
+ */
+#define SHA512_ADD(word1, word2, ret) ( \
+ (ret)[1] = (word1)[1], (ret)[1] += (word2)[1], \
+ (ret)[0] = (word1)[0] + (word2)[0] + ((ret)[1] < (word1)[1]) )
+
+/*
+ * Add the 4word value in word2 to word1.
+ */
+static uint32_t ADDTO4_temp, ADDTO4_temp2;
+#define SHA512_ADDTO4(word1, word2) ( \
+ ADDTO4_temp = (word1)[3], \
+ (word1)[3] += (word2)[3], \
+ ADDTO4_temp2 = (word1)[2], \
+ (word1)[2] += (word2)[2] + ((word1)[3] < ADDTO4_temp), \
+ ADDTO4_temp = (word1)[1], \
+ (word1)[1] += (word2)[1] + ((word1)[2] < ADDTO4_temp2), \
+ (word1)[0] += (word2)[0] + ((word1)[1] < ADDTO4_temp) )
+
+/*
+ * Add the 2word value in word2 to word1.
+ */
+static uint32_t ADDTO2_temp;
+#define SHA512_ADDTO2(word1, word2) ( \
+ ADDTO2_temp = (word1)[1], \
+ (word1)[1] += (word2)[1], \
+ (word1)[0] += (word2)[0] + ((word1)[1] < ADDTO2_temp) )
+
+/*
+ * SHA rotate ((word >> bits) | (word << (64-bits)))
+ */
+static uint32_t ROTR_temp1[2], ROTR_temp2[2];
+#define SHA512_ROTR(bits, word, ret) ( \
+ SHA512_SHR((bits), (word), ROTR_temp1), \
+ SHA512_SHL(64-(bits), (word), ROTR_temp2), \
+ SHA512_OR(ROTR_temp1, ROTR_temp2, (ret)) )
+
+/*
+ * Define the SHA SIGMA and sigma macros
+ *
+ * SHA512_ROTR(28,word) ^ SHA512_ROTR(34,word) ^ SHA512_ROTR(39,word)
+ */
+static uint32_t SIGMA0_temp1[2], SIGMA0_temp2[2],
+ SIGMA0_temp3[2], SIGMA0_temp4[2];
+#define SHA512_SIGMA0(word, ret) ( \
+ SHA512_ROTR(28, (word), SIGMA0_temp1), \
+ SHA512_ROTR(34, (word), SIGMA0_temp2), \
+ SHA512_ROTR(39, (word), SIGMA0_temp3), \
+ SHA512_XOR(SIGMA0_temp2, SIGMA0_temp3, SIGMA0_temp4), \
+ SHA512_XOR(SIGMA0_temp1, SIGMA0_temp4, (ret)) )
+
+/*
+ * SHA512_ROTR(14,word) ^ SHA512_ROTR(18,word) ^ SHA512_ROTR(41,word)
+ */
+static uint32_t SIGMA1_temp1[2], SIGMA1_temp2[2],
+ SIGMA1_temp3[2], SIGMA1_temp4[2];
+#define SHA512_SIGMA1(word, ret) ( \
+ SHA512_ROTR(14, (word), SIGMA1_temp1), \
+ SHA512_ROTR(18, (word), SIGMA1_temp2), \
+ SHA512_ROTR(41, (word), SIGMA1_temp3), \
+ SHA512_XOR(SIGMA1_temp2, SIGMA1_temp3, SIGMA1_temp4), \
+ SHA512_XOR(SIGMA1_temp1, SIGMA1_temp4, (ret)) )
+
+/*
+ * (SHA512_ROTR( 1,word) ^ SHA512_ROTR( 8,word) ^ SHA512_SHR( 7,word))
+ */
+static uint32_t sigma0_temp1[2], sigma0_temp2[2],
+ sigma0_temp3[2], sigma0_temp4[2];
+#define SHA512_sigma0(word, ret) ( \
+ SHA512_ROTR( 1, (word), sigma0_temp1), \
+ SHA512_ROTR( 8, (word), sigma0_temp2), \
+ SHA512_SHR( 7, (word), sigma0_temp3), \
+ SHA512_XOR(sigma0_temp2, sigma0_temp3, sigma0_temp4), \
+ SHA512_XOR(sigma0_temp1, sigma0_temp4, (ret)) )
+
+/*
+ * (SHA512_ROTR(19,word) ^ SHA512_ROTR(61,word) ^ SHA512_SHR( 6,word))
+ */
+static uint32_t sigma1_temp1[2], sigma1_temp2[2],
+ sigma1_temp3[2], sigma1_temp4[2];
+#define SHA512_sigma1(word, ret) ( \
+ SHA512_ROTR(19, (word), sigma1_temp1), \
+ SHA512_ROTR(61, (word), sigma1_temp2), \
+ SHA512_SHR( 6, (word), sigma1_temp3), \
+ SHA512_XOR(sigma1_temp2, sigma1_temp3, sigma1_temp4), \
+ SHA512_XOR(sigma1_temp1, sigma1_temp4, (ret)) )
+
+#ifndef USE_MODIFIED_MACROS
+/*
+ * These definitions are the ones used in FIPS 180-3, section 4.1.3
+ * Ch(x,y,z) ((x & y) ^ (~x & z))
+ */
+static uint32_t Ch_temp1[2], Ch_temp2[2], Ch_temp3[2];
+#define SHA_Ch(x, y, z, ret) ( \
+ SHA512_AND(x, y, Ch_temp1), \
+ SHA512_TILDA(x, Ch_temp2), \
+ SHA512_AND(Ch_temp2, z, Ch_temp3), \
+ SHA512_XOR(Ch_temp1, Ch_temp3, (ret)) )
+
+/*
+ * Maj(x,y,z) (((x)&(y)) ^ ((x)&(z)) ^ ((y)&(z)))
+ */
+static uint32_t Maj_temp1[2], Maj_temp2[2],
+ Maj_temp3[2], Maj_temp4[2];
+#define SHA_Maj(x, y, z, ret) ( \
+ SHA512_AND(x, y, Maj_temp1), \
+ SHA512_AND(x, z, Maj_temp2), \
+ SHA512_AND(y, z, Maj_temp3), \
+ SHA512_XOR(Maj_temp2, Maj_temp3, Maj_temp4), \
+ SHA512_XOR(Maj_temp1, Maj_temp4, (ret)) )
+#else /* !USE_MODIFIED_MACROS */
+/*
+ * These definitions are potentially faster equivalents for the ones
+ * used in FIPS 180-3, section 4.1.3.
+ * ((x & y) ^ (~x & z)) becomes
+ * ((x & (y ^ z)) ^ z)
+ */
+#define SHA_Ch(x, y, z, ret) ( \
+ (ret)[0] = (((x)[0] & ((y)[0] ^ (z)[0])) ^ (z)[0]), \
+ (ret)[1] = (((x)[1] & ((y)[1] ^ (z)[1])) ^ (z)[1]) )
+
+/*
+ * ((x & y) ^ (x & z) ^ (y & z)) becomes
+ * ((x & (y | z)) | (y & z))
+ */
+#define SHA_Maj(x, y, z, ret) ( \
+ ret[0] = (((x)[0] & ((y)[0] | (z)[0])) | ((y)[0] & (z)[0])), \
+ ret[1] = (((x)[1] & ((y)[1] | (z)[1])) | ((y)[1] & (z)[1])) )
+#endif /* USE_MODIFIED_MACROS */
+
+/*
+ * Add "length" to the length.
+ * Set Corrupted when overflow has occurred.
+ */
+static uint32_t addTemp[4] = { 0, 0, 0, 0 };
+#define SHA384_512AddLength(context, length) ( \
+ addTemp[3] = (length), SHA512_ADDTO4((context)->Length, addTemp), \
+ (context)->Corrupted = (((context)->Length[3] < (length)) && \
+ ((context)->Length[2] == 0) && ((context)->Length[1] == 0) && \
+ ((context)->Length[0] == 0)) ? shaInputTooLong : \
+ (context)->Corrupted )
+
+/* Local Function Prototypes */
+static int SHA384_512Reset(SHA512Context *context,
+ uint32_t H0[SHA512HashSize/4]);
+static void SHA384_512ProcessMessageBlock(SHA512Context *context);
+static void SHA384_512Finalize(SHA512Context *context,
+ uint8_t Pad_Byte);
+static void SHA384_512PadMessage(SHA512Context *context,
+ uint8_t Pad_Byte);
+static int SHA384_512ResultN( SHA512Context *context,
+ uint8_t Message_Digest[ ], int HashSize);
+
+/* Initial Hash Values: FIPS 180-3 sections 5.3.4 and 5.3.5 */
+static uint32_t SHA384_H0[SHA512HashSize/4] = {
+ 0xCBBB9D5D, 0xC1059ED8, 0x629A292A, 0x367CD507, 0x9159015A,
+ 0x3070DD17, 0x152FECD8, 0xF70E5939, 0x67332667, 0xFFC00B31,
+ 0x8EB44A87, 0x68581511, 0xDB0C2E0D, 0x64F98FA7, 0x47B5481D,
+ 0xBEFA4FA4
+};
+static uint32_t SHA512_H0[SHA512HashSize/4] = {
+ 0x6A09E667, 0xF3BCC908, 0xBB67AE85, 0x84CAA73B, 0x3C6EF372,
+ 0xFE94F82B, 0xA54FF53A, 0x5F1D36F1, 0x510E527F, 0xADE682D1,
+ 0x9B05688C, 0x2B3E6C1F, 0x1F83D9AB, 0xFB41BD6B, 0x5BE0CD19,
+ 0x137E2179
+};
+
+#else /* !USE_32BIT_ONLY */
+
+#include "sha-private.h"
+
+/* Define the SHA shift, rotate left and rotate right macros */
+#define SHA512_SHR(bits,word) (((uint64_t)(word)) >> (bits))
+#define SHA512_ROTR(bits,word) ((((uint64_t)(word)) >> (bits)) | \
+ (((uint64_t)(word)) << (64-(bits))))
+
+/*
+ * Define the SHA SIGMA and sigma macros
+ *
+ * SHA512_ROTR(28,word) ^ SHA512_ROTR(34,word) ^ SHA512_ROTR(39,word)
+ */
+#define SHA512_SIGMA0(word) \
+ (SHA512_ROTR(28,word) ^ SHA512_ROTR(34,word) ^ SHA512_ROTR(39,word))
+#define SHA512_SIGMA1(word) \
+ (SHA512_ROTR(14,word) ^ SHA512_ROTR(18,word) ^ SHA512_ROTR(41,word))
+#define SHA512_sigma0(word) \
+ (SHA512_ROTR( 1,word) ^ SHA512_ROTR( 8,word) ^ SHA512_SHR( 7,word))
+#define SHA512_sigma1(word) \
+ (SHA512_ROTR(19,word) ^ SHA512_ROTR(61,word) ^ SHA512_SHR( 6,word))
+
+/*
+ * Add "length" to the length.
+ * Set Corrupted when overflow has occurred.
+ */
+/* addTemp commented out by Nokia, static variables are not thread-safe */
+/* static uint64_t addTemp; */
+/* 'M' appended to Macro name by Nokia */
+#define SHA384_512AddLengthM(context, length) \
+ (addTemp = context->Length_Low, context->Corrupted = \
+ ((context->Length_Low += length) < addTemp) && \
+ (++context->Length_High == 0) ? shaInputTooLong : \
+ (context)->Corrupted)
+
+/* Local Function Prototypes */
+static int SHA384_512Reset(SHA512Context *context,
+ uint64_t H0[SHA512HashSize/8]);
+static void SHA384_512ProcessMessageBlock(SHA512Context *context);
+static void SHA384_512Finalize(SHA512Context *context,
+ uint8_t Pad_Byte);
+static void SHA384_512PadMessage(SHA512Context *context,
+ uint8_t Pad_Byte);
+static int SHA384_512ResultN(SHA512Context *context,
+ uint8_t Message_Digest[ ], int HashSize);
+
+/* Initial Hash Values: FIPS 180-3 sections 5.3.4 and 5.3.5 */
+static uint64_t SHA384_H0[ ] = {
+ 0xCBBB9D5DC1059ED8ll, 0x629A292A367CD507ll, 0x9159015A3070DD17ll,
+ 0x152FECD8F70E5939ll, 0x67332667FFC00B31ll, 0x8EB44A8768581511ll,
+ 0xDB0C2E0D64F98FA7ll, 0x47B5481DBEFA4FA4ll
+};
+static uint64_t SHA512_H0[ ] = {
+ 0x6A09E667F3BCC908ll, 0xBB67AE8584CAA73Bll, 0x3C6EF372FE94F82Bll,
+ 0xA54FF53A5F1D36F1ll, 0x510E527FADE682D1ll, 0x9B05688C2B3E6C1Fll,
+ 0x1F83D9ABFB41BD6Bll, 0x5BE0CD19137E2179ll
+};
+
+#endif /* USE_32BIT_ONLY */
+
+/*
+ * SHA384Reset
+ *
+ * Description:
+ * This function will initialize the SHA384Context in preparation
+ * for computing a new SHA384 message digest.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to reset.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA384Reset(SHA384Context *context)
+{
+ return SHA384_512Reset(context, SHA384_H0);
+}
+
+/*
+ * SHA384Input
+ *
+ * Description:
+ * This function accepts an array of octets as the next portion
+ * of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_array[ ]: [in]
+ * An array of octets representing the next portion of
+ * the message.
+ * length: [in]
+ * The length of the message in message_array.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA384Input(SHA384Context *context,
+ const uint8_t *message_array, unsigned int length)
+{
+ return SHA512Input(context, message_array, length);
+}
+
+/*
+ * SHA384FinalBits
+ *
+ * Description:
+ * This function will add in any final bits of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_bits: [in]
+ * The final bits of the message, in the upper portion of the
+ * byte. (Use 0b###00000 instead of 0b00000### to input the
+ * three bits ###.)
+ * length: [in]
+ * The number of bits in message_bits, between 1 and 7.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA384FinalBits(SHA384Context *context,
+ uint8_t message_bits, unsigned int length)
+{
+ return SHA512FinalBits(context, message_bits, length);
+}
+
+/*
+ * SHA384Result
+ *
+ * Description:
+ * This function will return the 384-bit message digest
+ * into the Message_Digest array provided by the caller.
+ * NOTE:
+ * The first octet of hash is stored in the element with index 0,
+ * the last octet of hash in the element with index 47.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to use to calculate the SHA hash.
+ * Message_Digest[ ]: [out]
+ * Where the digest is returned.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA384Result(SHA384Context *context,
+ uint8_t Message_Digest[SHA384HashSize])
+{
+ return SHA384_512ResultN(context, Message_Digest, SHA384HashSize);
+}
+
+/*
+ * SHA512Reset
+ *
+ * Description:
+ * This function will initialize the SHA512Context in preparation
+ * for computing a new SHA512 message digest.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to reset.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA512Reset(SHA512Context *context)
+{
+ return SHA384_512Reset(context, SHA512_H0);
+}
+
+/*
+ * SHA512Input
+ *
+ * Description:
+ * This function accepts an array of octets as the next portion
+ * of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_array[ ]: [in]
+ * An array of octets representing the next portion of
+ * the message.
+ * length: [in]
+ * The length of the message in message_array.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA512Input(SHA512Context *context,
+ const uint8_t *message_array,
+ unsigned int length)
+{
+ if (!context) return shaNull;
+ if (!length) return shaSuccess;
+ if (!message_array) return shaNull;
+ if (context->Computed) return context->Corrupted = shaStateError;
+ if (context->Corrupted) return context->Corrupted;
+
+ while (length--) {
+ context->Message_Block[context->Message_Block_Index++] =
+ *message_array;
+
+ if ((SHA384_512AddLength(context, 8) == shaSuccess) &&
+ (context->Message_Block_Index == SHA512_Message_Block_Size))
+ SHA384_512ProcessMessageBlock(context);
+
+ message_array++;
+ }
+
+ return context->Corrupted;
+}
+
+/*
+ * SHA512FinalBits
+ *
+ * Description:
+ * This function will add in any final bits of the message.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * message_bits: [in]
+ * The final bits of the message, in the upper portion of the
+ * byte. (Use 0b###00000 instead of 0b00000### to input the
+ * three bits ###.)
+ * length: [in]
+ * The number of bits in message_bits, between 1 and 7.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA512FinalBits(SHA512Context *context,
+ uint8_t message_bits, unsigned int length)
+{
+ static uint8_t masks[8] = {
+ /* 0 0b00000000 */ 0x00, /* 1 0b10000000 */ 0x80,
+ /* 2 0b11000000 */ 0xC0, /* 3 0b11100000 */ 0xE0,
+ /* 4 0b11110000 */ 0xF0, /* 5 0b11111000 */ 0xF8,
+ /* 6 0b11111100 */ 0xFC, /* 7 0b11111110 */ 0xFE
+ };
+ static uint8_t markbit[8] = {
+ /* 0 0b10000000 */ 0x80, /* 1 0b01000000 */ 0x40,
+ /* 2 0b00100000 */ 0x20, /* 3 0b00010000 */ 0x10,
+ /* 4 0b00001000 */ 0x08, /* 5 0b00000100 */ 0x04,
+ /* 6 0b00000010 */ 0x02, /* 7 0b00000001 */ 0x01
+ };
+
+ if (!context) return shaNull;
+ if (!length) return shaSuccess;
+ if (context->Corrupted) return context->Corrupted;
+ if (context->Computed) return context->Corrupted = shaStateError;
+ if (length >= 8) return context->Corrupted = shaBadParam;
+
+ SHA384_512AddLength(context, length);
+ SHA384_512Finalize(context, (uint8_t)
+ ((message_bits & masks[length]) | markbit[length]));
+
+ return context->Corrupted;
+}
+
+/*
+ * SHA512Result
+ *
+ * Description:
+ * This function will return the 512-bit message digest
+ * into the Message_Digest array provided by the caller.
+ * NOTE:
+ * The first octet of hash is stored in the element with index 0,
+ * the last octet of hash in the element with index 63.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to use to calculate the SHA hash.
+ * Message_Digest[ ]: [out]
+ * Where the digest is returned.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+int SHA512Result(SHA512Context *context,
+ uint8_t Message_Digest[SHA512HashSize])
+{
+ return SHA384_512ResultN(context, Message_Digest, SHA512HashSize);
+}
+
+/*
+ * SHA384_512Reset
+ *
+ * Description:
+ * This helper function will initialize the SHA512Context in
+ * preparation for computing a new SHA384 or SHA512 message
+ * digest.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to reset.
+ * H0[ ]: [in]
+ * The initial hash value array to use.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+#ifdef USE_32BIT_ONLY
+static int SHA384_512Reset(SHA512Context *context,
+ uint32_t H0[SHA512HashSize/4])
+#else /* !USE_32BIT_ONLY */
+static int SHA384_512Reset(SHA512Context *context,
+ uint64_t H0[SHA512HashSize/8])
+#endif /* USE_32BIT_ONLY */
+{
+ int i;
+ if (!context) return shaNull;
+
+ context->Message_Block_Index = 0;
+
+#ifdef USE_32BIT_ONLY
+ context->Length[0] = context->Length[1] =
+ context->Length[2] = context->Length[3] = 0;
+
+ for (i = 0; i < SHA512HashSize/4; i++)
+ context->Intermediate_Hash[i] = H0[i];
+#else /* !USE_32BIT_ONLY */
+ context->Length_High = context->Length_Low = 0;
+
+ for (i = 0; i < SHA512HashSize/8; i++)
+ context->Intermediate_Hash[i] = H0[i];
+#endif /* USE_32BIT_ONLY */
+
+ context->Computed = 0;
+ context->Corrupted = shaSuccess;
+
+ return shaSuccess;
+}
+
+/*
+ * SHA384_512ProcessMessageBlock
+ *
+ * Description:
+ * This helper function will process the next 1024 bits of the
+ * message stored in the Message_Block array.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ *
+ * Returns:
+ * Nothing.
+ *
+ * Comments:
+ * Many of the variable names in this code, especially the
+ * single character names, were used because those were the
+ * names used in the Secure Hash Standard.
+ *
+ *
+ */
+static void SHA384_512ProcessMessageBlock(SHA512Context *context)
+{
+#ifdef USE_32BIT_ONLY
+ /* Constants defined in FIPS 180-3, section 4.2.3 */
+ static const uint32_t K[80*2] = {
+ 0x428A2F98, 0xD728AE22, 0x71374491, 0x23EF65CD, 0xB5C0FBCF,
+ 0xEC4D3B2F, 0xE9B5DBA5, 0x8189DBBC, 0x3956C25B, 0xF348B538,
+ 0x59F111F1, 0xB605D019, 0x923F82A4, 0xAF194F9B, 0xAB1C5ED5,
+ 0xDA6D8118, 0xD807AA98, 0xA3030242, 0x12835B01, 0x45706FBE,
+ 0x243185BE, 0x4EE4B28C, 0x550C7DC3, 0xD5FFB4E2, 0x72BE5D74,
+ 0xF27B896F, 0x80DEB1FE, 0x3B1696B1, 0x9BDC06A7, 0x25C71235,
+ 0xC19BF174, 0xCF692694, 0xE49B69C1, 0x9EF14AD2, 0xEFBE4786,
+ 0x384F25E3, 0x0FC19DC6, 0x8B8CD5B5, 0x240CA1CC, 0x77AC9C65,
+ 0x2DE92C6F, 0x592B0275, 0x4A7484AA, 0x6EA6E483, 0x5CB0A9DC,
+ 0xBD41FBD4, 0x76F988DA, 0x831153B5, 0x983E5152, 0xEE66DFAB,
+ 0xA831C66D, 0x2DB43210, 0xB00327C8, 0x98FB213F, 0xBF597FC7,
+ 0xBEEF0EE4, 0xC6E00BF3, 0x3DA88FC2, 0xD5A79147, 0x930AA725,
+ 0x06CA6351, 0xE003826F, 0x14292967, 0x0A0E6E70, 0x27B70A85,
+ 0x46D22FFC, 0x2E1B2138, 0x5C26C926, 0x4D2C6DFC, 0x5AC42AED,
+ 0x53380D13, 0x9D95B3DF, 0x650A7354, 0x8BAF63DE, 0x766A0ABB,
+ 0x3C77B2A8, 0x81C2C92E, 0x47EDAEE6, 0x92722C85, 0x1482353B,
+ 0xA2BFE8A1, 0x4CF10364, 0xA81A664B, 0xBC423001, 0xC24B8B70,
+ 0xD0F89791, 0xC76C51A3, 0x0654BE30, 0xD192E819, 0xD6EF5218,
+ 0xD6990624, 0x5565A910, 0xF40E3585, 0x5771202A, 0x106AA070,
+ 0x32BBD1B8, 0x19A4C116, 0xB8D2D0C8, 0x1E376C08, 0x5141AB53,
+ 0x2748774C, 0xDF8EEB99, 0x34B0BCB5, 0xE19B48A8, 0x391C0CB3,
+ 0xC5C95A63, 0x4ED8AA4A, 0xE3418ACB, 0x5B9CCA4F, 0x7763E373,
+ 0x682E6FF3, 0xD6B2B8A3, 0x748F82EE, 0x5DEFB2FC, 0x78A5636F,
+ 0x43172F60, 0x84C87814, 0xA1F0AB72, 0x8CC70208, 0x1A6439EC,
+ 0x90BEFFFA, 0x23631E28, 0xA4506CEB, 0xDE82BDE9, 0xBEF9A3F7,
+ 0xB2C67915, 0xC67178F2, 0xE372532B, 0xCA273ECE, 0xEA26619C,
+ 0xD186B8C7, 0x21C0C207, 0xEADA7DD6, 0xCDE0EB1E, 0xF57D4F7F,
+ 0xEE6ED178, 0x06F067AA, 0x72176FBA, 0x0A637DC5, 0xA2C898A6,
+ 0x113F9804, 0xBEF90DAE, 0x1B710B35, 0x131C471B, 0x28DB77F5,
+ 0x23047D84, 0x32CAAB7B, 0x40C72493, 0x3C9EBE0A, 0x15C9BEBC,
+ 0x431D67C4, 0x9C100D4C, 0x4CC5D4BE, 0xCB3E42B6, 0x597F299C,
+ 0xFC657E2A, 0x5FCB6FAB, 0x3AD6FAEC, 0x6C44198C, 0x4A475817
+ };
+ int t, t2, t8; /* Loop counter */
+ uint32_t temp1[2], temp2[2], /* Temporary word values */
+ temp3[2], temp4[2], temp5[2];
+ uint32_t W[2*80]; /* Word sequence */
+ uint32_t A[2], B[2], C[2], D[2], /* Word buffers */
+ E[2], F[2], G[2], H[2];
+
+ /* Initialize the first 16 words in the array W */
+ for (t = t2 = t8 = 0; t < 16; t++, t8 += 8) {
+ W[t2++] = ((((uint32_t)context->Message_Block[t8 ])) << 24) |
+ ((((uint32_t)context->Message_Block[t8 + 1])) << 16) |
+ ((((uint32_t)context->Message_Block[t8 + 2])) << 8) |
+ ((((uint32_t)context->Message_Block[t8 + 3])));
+ W[t2++] = ((((uint32_t)context->Message_Block[t8 + 4])) << 24) |
+ ((((uint32_t)context->Message_Block[t8 + 5])) << 16) |
+ ((((uint32_t)context->Message_Block[t8 + 6])) << 8) |
+ ((((uint32_t)context->Message_Block[t8 + 7])));
+ }
+
+ for (t = 16; t < 80; t++, t2 += 2) {
+ /* W[t] = SHA512_sigma1(W[t-2]) + W[t-7] +
+ SHA512_sigma0(W[t-15]) + W[t-16]; */
+ uint32_t *Wt2 = &W[t2-2*2];
+ uint32_t *Wt7 = &W[t2-7*2];
+ uint32_t *Wt15 = &W[t2-15*2];
+ uint32_t *Wt16 = &W[t2-16*2];
+ SHA512_sigma1(Wt2, temp1);
+ SHA512_ADD(temp1, Wt7, temp2);
+ SHA512_sigma0(Wt15, temp1);
+ SHA512_ADD(temp1, Wt16, temp3);
+ SHA512_ADD(temp2, temp3, &W[t2]);
+ }
+
+ A[0] = context->Intermediate_Hash[0];
+ A[1] = context->Intermediate_Hash[1];
+ B[0] = context->Intermediate_Hash[2];
+ B[1] = context->Intermediate_Hash[3];
+ C[0] = context->Intermediate_Hash[4];
+ C[1] = context->Intermediate_Hash[5];
+ D[0] = context->Intermediate_Hash[6];
+ D[1] = context->Intermediate_Hash[7];
+ E[0] = context->Intermediate_Hash[8];
+ E[1] = context->Intermediate_Hash[9];
+ F[0] = context->Intermediate_Hash[10];
+ F[1] = context->Intermediate_Hash[11];
+ G[0] = context->Intermediate_Hash[12];
+ G[1] = context->Intermediate_Hash[13];
+ H[0] = context->Intermediate_Hash[14];
+ H[1] = context->Intermediate_Hash[15];
+
+ for (t = t2 = 0; t < 80; t++, t2 += 2) {
+ /*
+ * temp1 = H + SHA512_SIGMA1(E) + SHA_Ch(E,F,G) + K[t] + W[t];
+ */
+ SHA512_SIGMA1(E,temp1);
+ SHA512_ADD(H, temp1, temp2);
+ SHA_Ch(E,F,G,temp3);
+ SHA512_ADD(temp2, temp3, temp4);
+ SHA512_ADD(&K[t2], &W[t2], temp5);
+ SHA512_ADD(temp4, temp5, temp1);
+ /*
+ * temp2 = SHA512_SIGMA0(A) + SHA_Maj(A,B,C);
+ */
+ SHA512_SIGMA0(A,temp3);
+ SHA_Maj(A,B,C,temp4);
+ SHA512_ADD(temp3, temp4, temp2);
+ H[0] = G[0]; H[1] = G[1];
+ G[0] = F[0]; G[1] = F[1];
+ F[0] = E[0]; F[1] = E[1];
+ SHA512_ADD(D, temp1, E);
+ D[0] = C[0]; D[1] = C[1];
+ C[0] = B[0]; C[1] = B[1];
+ B[0] = A[0]; B[1] = A[1];
+ SHA512_ADD(temp1, temp2, A);
+ }
+
+ SHA512_ADDTO2(&context->Intermediate_Hash[0], A);
+ SHA512_ADDTO2(&context->Intermediate_Hash[2], B);
+ SHA512_ADDTO2(&context->Intermediate_Hash[4], C);
+ SHA512_ADDTO2(&context->Intermediate_Hash[6], D);
+ SHA512_ADDTO2(&context->Intermediate_Hash[8], E);
+ SHA512_ADDTO2(&context->Intermediate_Hash[10], F);
+ SHA512_ADDTO2(&context->Intermediate_Hash[12], G);
+ SHA512_ADDTO2(&context->Intermediate_Hash[14], H);
+
+#else /* !USE_32BIT_ONLY */
+ /* Constants defined in FIPS 180-3, section 4.2.3 */
+ static const uint64_t K[80] = {
+ 0x428A2F98D728AE22ll, 0x7137449123EF65CDll, 0xB5C0FBCFEC4D3B2Fll,
+ 0xE9B5DBA58189DBBCll, 0x3956C25BF348B538ll, 0x59F111F1B605D019ll,
+ 0x923F82A4AF194F9Bll, 0xAB1C5ED5DA6D8118ll, 0xD807AA98A3030242ll,
+ 0x12835B0145706FBEll, 0x243185BE4EE4B28Cll, 0x550C7DC3D5FFB4E2ll,
+ 0x72BE5D74F27B896Fll, 0x80DEB1FE3B1696B1ll, 0x9BDC06A725C71235ll,
+ 0xC19BF174CF692694ll, 0xE49B69C19EF14AD2ll, 0xEFBE4786384F25E3ll,
+ 0x0FC19DC68B8CD5B5ll, 0x240CA1CC77AC9C65ll, 0x2DE92C6F592B0275ll,
+ 0x4A7484AA6EA6E483ll, 0x5CB0A9DCBD41FBD4ll, 0x76F988DA831153B5ll,
+ 0x983E5152EE66DFABll, 0xA831C66D2DB43210ll, 0xB00327C898FB213Fll,
+ 0xBF597FC7BEEF0EE4ll, 0xC6E00BF33DA88FC2ll, 0xD5A79147930AA725ll,
+ 0x06CA6351E003826Fll, 0x142929670A0E6E70ll, 0x27B70A8546D22FFCll,
+ 0x2E1B21385C26C926ll, 0x4D2C6DFC5AC42AEDll, 0x53380D139D95B3DFll,
+ 0x650A73548BAF63DEll, 0x766A0ABB3C77B2A8ll, 0x81C2C92E47EDAEE6ll,
+ 0x92722C851482353Bll, 0xA2BFE8A14CF10364ll, 0xA81A664BBC423001ll,
+ 0xC24B8B70D0F89791ll, 0xC76C51A30654BE30ll, 0xD192E819D6EF5218ll,
+ 0xD69906245565A910ll, 0xF40E35855771202All, 0x106AA07032BBD1B8ll,
+ 0x19A4C116B8D2D0C8ll, 0x1E376C085141AB53ll, 0x2748774CDF8EEB99ll,
+ 0x34B0BCB5E19B48A8ll, 0x391C0CB3C5C95A63ll, 0x4ED8AA4AE3418ACBll,
+ 0x5B9CCA4F7763E373ll, 0x682E6FF3D6B2B8A3ll, 0x748F82EE5DEFB2FCll,
+ 0x78A5636F43172F60ll, 0x84C87814A1F0AB72ll, 0x8CC702081A6439ECll,
+ 0x90BEFFFA23631E28ll, 0xA4506CEBDE82BDE9ll, 0xBEF9A3F7B2C67915ll,
+ 0xC67178F2E372532Bll, 0xCA273ECEEA26619Cll, 0xD186B8C721C0C207ll,
+ 0xEADA7DD6CDE0EB1Ell, 0xF57D4F7FEE6ED178ll, 0x06F067AA72176FBAll,
+ 0x0A637DC5A2C898A6ll, 0x113F9804BEF90DAEll, 0x1B710B35131C471Bll,
+ 0x28DB77F523047D84ll, 0x32CAAB7B40C72493ll, 0x3C9EBE0A15C9BEBCll,
+ 0x431D67C49C100D4Cll, 0x4CC5D4BECB3E42B6ll, 0x597F299CFC657E2All,
+ 0x5FCB6FAB3AD6FAECll, 0x6C44198C4A475817ll
+ };
+ int t, t8; /* Loop counter */
+ uint64_t temp1, temp2; /* Temporary word value */
+ uint64_t W[80]; /* Word sequence */
+ uint64_t A, B, C, D, E, F, G, H; /* Word buffers */
+
+ /*
+ * Initialize the first 16 words in the array W
+ */
+ for (t = t8 = 0; t < 16; t++, t8 += 8)
+ W[t] = ((uint64_t)(context->Message_Block[t8 ]) << 56) |
+ ((uint64_t)(context->Message_Block[t8 + 1]) << 48) |
+ ((uint64_t)(context->Message_Block[t8 + 2]) << 40) |
+ ((uint64_t)(context->Message_Block[t8 + 3]) << 32) |
+ ((uint64_t)(context->Message_Block[t8 + 4]) << 24) |
+ ((uint64_t)(context->Message_Block[t8 + 5]) << 16) |
+ ((uint64_t)(context->Message_Block[t8 + 6]) << 8) |
+ ((uint64_t)(context->Message_Block[t8 + 7]));
+
+ for (t = 16; t < 80; t++)
+ W[t] = SHA512_sigma1(W[t-2]) + W[t-7] +
+ SHA512_sigma0(W[t-15]) + W[t-16];
+ A = context->Intermediate_Hash[0];
+ B = context->Intermediate_Hash[1];
+ C = context->Intermediate_Hash[2];
+ D = context->Intermediate_Hash[3];
+ E = context->Intermediate_Hash[4];
+ F = context->Intermediate_Hash[5];
+ G = context->Intermediate_Hash[6];
+ H = context->Intermediate_Hash[7];
+
+ for (t = 0; t < 80; t++) {
+ temp1 = H + SHA512_SIGMA1(E) + SHA_Ch(E,F,G) + K[t] + W[t];
+ temp2 = SHA512_SIGMA0(A) + SHA_Maj(A,B,C);
+ H = G;
+ G = F;
+ F = E;
+ E = D + temp1;
+ D = C;
+ C = B;
+ B = A;
+ A = temp1 + temp2;
+ }
+
+ context->Intermediate_Hash[0] += A;
+ context->Intermediate_Hash[1] += B;
+ context->Intermediate_Hash[2] += C;
+ context->Intermediate_Hash[3] += D;
+ context->Intermediate_Hash[4] += E;
+ context->Intermediate_Hash[5] += F;
+ context->Intermediate_Hash[6] += G;
+ context->Intermediate_Hash[7] += H;
+#endif /* USE_32BIT_ONLY */
+
+ context->Message_Block_Index = 0;
+}
+
+/*
+ * SHA384_512Finalize
+ *
+ * Description:
+ * This helper function finishes off the digest calculations.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The SHA context to update.
+ * Pad_Byte: [in]
+ * The last byte to add to the message block before the 0-padding
+ * and length. This will contain the last bits of the message
+ * followed by another single bit. If the message was an
+ * exact multiple of 8-bits long, Pad_Byte will be 0x80.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+static void SHA384_512Finalize(SHA512Context *context,
+ uint8_t Pad_Byte)
+{
+ int_least16_t i;
+ SHA384_512PadMessage(context, Pad_Byte);
+ /* message may be sensitive, clear it out */
+ for (i = 0; i < SHA512_Message_Block_Size; ++i)
+ context->Message_Block[i] = 0;
+#ifdef USE_32BIT_ONLY /* and clear length */
+ context->Length[0] = context->Length[1] = 0;
+ context->Length[2] = context->Length[3] = 0;
+#else /* !USE_32BIT_ONLY */
+ context->Length_High = context->Length_Low = 0;
+#endif /* USE_32BIT_ONLY */
+ context->Computed = 1;
+}
+
+/*
+ * SHA384_512PadMessage
+ *
+ * Description:
+ * According to the standard, the message must be padded to the next
+ * even multiple of 1024 bits. The first padding bit must be a '1'.
+ * The last 128 bits represent the length of the original message.
+ * All bits in between should be 0. This helper function will
+ * pad the message according to those rules by filling the
+ * Message_Block array accordingly. When it returns, it can be
+ * assumed that the message digest has been computed.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to pad.
+ * Pad_Byte: [in]
+ * The last byte to add to the message block before the 0-padding
+ * and length. This will contain the last bits of the message
+ * followed by another single bit. If the message was an
+ * exact multiple of 8-bits long, Pad_Byte will be 0x80.
+ *
+ * Returns:
+ * Nothing.
+ *
+ */
+static void SHA384_512PadMessage(SHA512Context *context,
+ uint8_t Pad_Byte)
+{
+ /*
+ * Check to see if the current message block is too small to hold
+ * the initial padding bits and length. If so, we will pad the
+ * block, process it, and then continue padding into a second
+ * block.
+ */
+ if (context->Message_Block_Index >= (SHA512_Message_Block_Size-16)) {
+ context->Message_Block[context->Message_Block_Index++] = Pad_Byte;
+ while (context->Message_Block_Index < SHA512_Message_Block_Size)
+ context->Message_Block[context->Message_Block_Index++] = 0;
+
+ SHA384_512ProcessMessageBlock(context);
+ } else
+ context->Message_Block[context->Message_Block_Index++] = Pad_Byte;
+
+ while (context->Message_Block_Index < (SHA512_Message_Block_Size-16))
+ context->Message_Block[context->Message_Block_Index++] = 0;
+
+ /*
+ * Store the message length as the last 16 octets
+ */
+#ifdef USE_32BIT_ONLY
+ context->Message_Block[112] = (uint8_t)(context->Length[0] >> 24);
+ context->Message_Block[113] = (uint8_t)(context->Length[0] >> 16);
+ context->Message_Block[114] = (uint8_t)(context->Length[0] >> 8);
+ context->Message_Block[115] = (uint8_t)(context->Length[0]);
+ context->Message_Block[116] = (uint8_t)(context->Length[1] >> 24);
+ context->Message_Block[117] = (uint8_t)(context->Length[1] >> 16);
+ context->Message_Block[118] = (uint8_t)(context->Length[1] >> 8);
+ context->Message_Block[119] = (uint8_t)(context->Length[1]);
+
+ context->Message_Block[120] = (uint8_t)(context->Length[2] >> 24);
+ context->Message_Block[121] = (uint8_t)(context->Length[2] >> 16);
+ context->Message_Block[122] = (uint8_t)(context->Length[2] >> 8);
+ context->Message_Block[123] = (uint8_t)(context->Length[2]);
+ context->Message_Block[124] = (uint8_t)(context->Length[3] >> 24);
+ context->Message_Block[125] = (uint8_t)(context->Length[3] >> 16);
+ context->Message_Block[126] = (uint8_t)(context->Length[3] >> 8);
+ context->Message_Block[127] = (uint8_t)(context->Length[3]);
+#else /* !USE_32BIT_ONLY */
+ context->Message_Block[112] = (uint8_t)(context->Length_High >> 56);
+ context->Message_Block[113] = (uint8_t)(context->Length_High >> 48);
+ context->Message_Block[114] = (uint8_t)(context->Length_High >> 40);
+ context->Message_Block[115] = (uint8_t)(context->Length_High >> 32);
+ context->Message_Block[116] = (uint8_t)(context->Length_High >> 24);
+ context->Message_Block[117] = (uint8_t)(context->Length_High >> 16);
+ context->Message_Block[118] = (uint8_t)(context->Length_High >> 8);
+ context->Message_Block[119] = (uint8_t)(context->Length_High);
+
+ context->Message_Block[120] = (uint8_t)(context->Length_Low >> 56);
+ context->Message_Block[121] = (uint8_t)(context->Length_Low >> 48);
+ context->Message_Block[122] = (uint8_t)(context->Length_Low >> 40);
+ context->Message_Block[123] = (uint8_t)(context->Length_Low >> 32);
+ context->Message_Block[124] = (uint8_t)(context->Length_Low >> 24);
+ context->Message_Block[125] = (uint8_t)(context->Length_Low >> 16);
+ context->Message_Block[126] = (uint8_t)(context->Length_Low >> 8);
+ context->Message_Block[127] = (uint8_t)(context->Length_Low);
+#endif /* USE_32BIT_ONLY */
+
+ SHA384_512ProcessMessageBlock(context);
+}
+
+/*
+ * SHA384_512ResultN
+ *
+ * Description:
+ * This helper function will return the 384-bit or 512-bit message
+ * digest into the Message_Digest array provided by the caller.
+ * NOTE:
+ * The first octet of hash is stored in the element with index 0,
+ * the last octet of hash in the element with index 47/63.
+ *
+ * Parameters:
+ * context: [in/out]
+ * The context to use to calculate the SHA hash.
+ * Message_Digest[ ]: [out]
+ * Where the digest is returned.
+ * HashSize: [in]
+ * The size of the hash, either 48 or 64.
+ *
+ * Returns:
+ * sha Error Code.
+ *
+ */
+static int SHA384_512ResultN(SHA512Context *context,
+ uint8_t Message_Digest[ ], int HashSize)
+{
+ int i;
+#ifdef USE_32BIT_ONLY
+ int i2;
+#endif /* USE_32BIT_ONLY */
+
+ if (!context) return shaNull;
+ if (!Message_Digest) return shaNull;
+ if (context->Corrupted) return context->Corrupted;
+
+ if (!context->Computed)
+ SHA384_512Finalize(context, 0x80);
+
+#ifdef USE_32BIT_ONLY
+ for (i = i2 = 0; i < HashSize; ) {
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2]>>24);
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2]>>16);
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2]>>8);
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2++]);
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2]>>24);
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2]>>16);
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2]>>8);
+ Message_Digest[i++]=(uint8_t)(context->Intermediate_Hash[i2++]);
+ }
+#else /* !USE_32BIT_ONLY */
+ for (i = 0; i < HashSize; ++i)
+ Message_Digest[i] = (uint8_t)
+ (context->Intermediate_Hash[i>>3] >> 8 * ( 7 - ( i % 8 ) ));
+#endif /* USE_32BIT_ONLY */
+
+ return shaSuccess;
+}
diff --git a/src/concurrent/qfuturewatcher.h b/src/concurrent/qfuturewatcher.h
index 11dab42174..439a25d844 100644
--- a/src/concurrent/qfuturewatcher.h
+++ b/src/concurrent/qfuturewatcher.h
@@ -63,7 +63,7 @@ class Q_CONCURRENT_EXPORT QFutureWatcherBase : public QObject
Q_DECLARE_PRIVATE(QFutureWatcherBase)
public:
- QFutureWatcherBase(QObject *parent = 0);
+ explicit QFutureWatcherBase(QObject *parent = 0);
int progressValue() const;
int progressMinimum() const;
@@ -119,7 +119,7 @@ template <typename T>
class QFutureWatcher : public QFutureWatcherBase
{
public:
- QFutureWatcher(QObject *_parent = 0)
+ explicit QFutureWatcher(QObject *_parent = 0)
: QFutureWatcherBase(_parent)
{ }
~QFutureWatcher()
@@ -189,7 +189,7 @@ template <>
class QFutureWatcher<void> : public QFutureWatcherBase
{
public:
- QFutureWatcher(QObject *_parent = 0)
+ explicit QFutureWatcher(QObject *_parent = 0)
: QFutureWatcherBase(_parent)
{ }
~QFutureWatcher()
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 37af42d6bd..67598f4f70 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -1,18 +1,62 @@
get_filename_component(_qt5_corelib_install_prefix ${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR} ABSOLUTE)
-# Required by default:
-set(QT_QMAKE_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/qmake$$CMAKE_BIN_SUFFIX\")
-set(QT_MOC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/moc$$CMAKE_BIN_SUFFIX\")
-set(QT_RCC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/rcc$$CMAKE_BIN_SUFFIX\")
+!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+set(QT_QMAKE_EXECUTABLE \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+set(QT_MOC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+set(QT_RCC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+!!ELSE
+set(QT_QMAKE_EXECUTABLE \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+set(QT_MOC_EXECUTABLE \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+set(QT_RCC_EXECUTABLE \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+!!ENDIF
+!!IF isEmpty(CMAKE_DATA_DIR_IS_ABSOLUTE)
list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/mkspecs/default\")
+!!ELSE
+list(APPEND Qt5Core_INCLUDE_DIRS \"$${CMAKE_DATA_DIR}mkspecs/default\")
+!!ENDIF
-if (NOT \"$${CMAKE_ADD_FPIE_FLAGS}\" STREQUAL \"\")
- set(Qt5Core_EXECUTABLE_COMPILE_FLAGS "-fPIE")
-endif()
+!!IF !isEmpty(CMAKE_ADD_FPIE_FLAGS)
+set(Qt5Core_EXECUTABLE_COMPILE_FLAGS "-fPIE")
+!!ENDIF
+
+!!IF !isEmpty(QT_NAMESPACE)
+list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE)
+list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
+!!ENDIF
+
+!!IF !isEmpty(QT_LIBINFIX)
+set(QT_LIBINFIX \"$${QT_LIBINFIX}\")
+!!ENDIF
-if (NOT \"$$QT_NAMESPACE\" STREQUAL \"\")
- list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE)
- list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
+!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+set(Qt5Core_QTMAIN_LIBRARIES Qt5::WinMain)
+
+if (NOT _Qt5WinMain_target)
+ set(_Qt5WinMain_target 1)
+ add_library(Qt5::WinMain STATIC IMPORTED)
endif()
+
+!!IF !isEmpty(debug_type)
+set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+set_target_properties(Qt5::WinMain PROPERTIES
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ IMPORTED_LOCATION_DEBUG "${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
+!!ELSE
+ IMPORTED_LOCATION_DEBUG "$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}"
+!!ENDIF
+)
+!!ENDIF
+
+!!IF !isEmpty(release_type)
+set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+set_target_properties(Qt5::WinMain PROPERTIES
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
+!!ELSE
+ IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\"
+!!ENDIF
+)
+!!ENDIF
+!!ENDIF
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index abfe49ec84..4a10fad9eb 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -83,7 +83,7 @@ macro(QT5_GET_MOC_FLAGS _moc_flags)
set(${_moc_flags} ${${_moc_flags}} "-D${_current}")
endforeach()
- if(Q_WS_WIN)
+ if(WIN32)
set(${_moc_flags} ${${_moc_flags}} -DWIN32)
endif()
endmacro()
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index e49ebfb844..3119c4f661 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -1495,35 +1495,7 @@ QString QTextDecoder::toUnicode(const QByteArray &ba)
files to be loaded. For details of internationalization, see
\l{Internationalization with Qt}.
- \sa codecForTr(), setCodecForCStrings()
-*/
-
-
-/*!
- \fn QTextCodec* QTextCodec::codecForCStrings()
-
- Returns the codec used by QString to convert to and from \c{const
- char *} and QByteArrays. If this function returns 0 (the default),
- QString assumes Latin-1.
-
- \sa setCodecForCStrings()
-*/
-
-/*!
- \fn void QTextCodec::setCodecForCStrings(QTextCodec *codec)
- \nonreentrant
-
- Sets the codec used by QString to convert to and from \c{const
- char *} and QByteArrays. If the \a codec is 0 (the default),
- QString assumes Latin-1.
-
- \warning Some codecs do not preserve the characters in the ASCII
- range (0x00 to 0x7F). For example, the Japanese Shift-JIS
- encoding maps the backslash character (0x5A) to the Yen
- character. To avoid undesirable side-effects, we recommend
- avoiding such codecs with setCodecsForCString().
-
- \sa codecForCStrings(), setCodecForTr()
+ \sa codecForTr()
*/
/*!
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index 9e46863964..ad37005e92 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -75,9 +75,6 @@ public:
static QTextCodec* codecForTr();
static void setCodecForTr(QTextCodec *c);
- static QTextCodec* codecForCStrings();
- static void setCodecForCStrings(QTextCodec *c);
-
static QTextCodec *codecForHtml(const QByteArray &ba);
static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec);
@@ -139,8 +136,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags)
inline QTextCodec* QTextCodec::codecForTr() { return validCodecs() ? cftr : 0; }
inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; }
-inline QTextCodec* QTextCodec::codecForCStrings() { return validCodecs() ? QString::codecForCStrings : 0; }
-inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; }
class Q_CORE_EXPORT QTextEncoder {
Q_DISABLE_COPY(QTextEncoder)
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 5ab79092d2..b3787261be 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -76,14 +76,13 @@
# define Q_CC_SYM
/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */
# if defined(__SC__) && __SC__ < 0x750
-# define Q_NO_EXPLICIT_KEYWORD
+# error "Compiler not supported"
# endif
# define Q_NO_USING_KEYWORD
#elif defined(_MSC_VER)
# define Q_CC_MSVC
# define Q_CC_MSVC_NET
-# define Q_CANNOT_DELETE_CONSTANT
# define Q_OUTOFLINE_TEMPLATE inline
# define Q_NO_TEMPLATE_FRIENDS
# define Q_ALIGNOF(type) __alignof(type)
@@ -114,8 +113,7 @@
# define Q_CC_BOR
# define Q_INLINE_TEMPLATE
# if __BORLANDC__ < 0x502
-# define Q_NO_BOOL_TYPE
-# define Q_NO_EXPLICIT_KEYWORD
+# error "Compiler not supported"
# endif
# define Q_NO_USING_KEYWORD
@@ -140,45 +138,19 @@
# define Q_CC_MINGW
# endif
# if defined(__INTEL_COMPILER)
-/* Intel C++ also masquerades as GCC 3.2.0 */
+/* Intel C++ also masquerades as GCC */
# define Q_CC_INTEL
# endif
# if defined(__clang__)
-/* Clang also masquerades as GCC 4.2.1 */
+/* Clang also masquerades as GCC */
# define Q_CC_CLANG
# endif
-# ifdef __APPLE__
-# define Q_NO_DEPRECATED_CONSTRUCTORS
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
-# define Q_FULL_TEMPLATE_INSTANTIATION
-# endif
-/* GCC 2.95 knows "using" but does not support it correctly */
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
-# define Q_NO_USING_KEYWORD
-# endif
-# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-# define Q_ALIGNOF(type) __alignof__(type)
-# define Q_TYPEOF(expr) __typeof__(expr)
-# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
-# endif
-# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
-# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
-# endif
-/* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */
-# if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1
-# define Q_WRONG_SB_CTYPE_MACROS
-# endif
-/* GCC <= 3.3 cannot handle template friends */
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
-# define Q_NO_TEMPLATE_FRIENDS
-# endif
-/* Apple's GCC 3.1 chokes on our streaming qDebug() */
-# if defined(Q_OS_DARWIN) && __GNUC__ == 3 && (__GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 3)
-# define Q_BROKEN_DEBUG_STREAM
-# endif
-# if (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_MOC_CPP)
+# define Q_ALIGNOF(type) __alignof__(type)
+# define Q_TYPEOF(expr) __typeof__(expr)
+# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
+# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
+# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
+# if !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# define Q_NO_PACKED_REFERENCE
# ifndef __ARM_EABI__
@@ -251,12 +223,7 @@
# define Q_CC_XLC
# define Q_FULL_TEMPLATE_INSTANTIATION
# if __xlC__ < 0x400
-# define Q_NO_BOOL_TYPE
-# define Q_NO_EXPLICIT_KEYWORD
-# define Q_NO_USING_KEYWORD
-# define Q_OUTOFLINE_TEMPLATE inline
-# define Q_BROKEN_TEMPLATE_SPECIALIZATION
-# define Q_CANNOT_DELETE_CONSTANT
+# error "Compiler not supported"
# elif __xlC__ >= 0x0600
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
@@ -280,7 +247,7 @@
- observed on Compaq C++ V6.3-002.
In any case versions prior to Compaq C++ V6.0-005 do not have bool. */
# if !defined(_BOOL_EXISTS)
-# define Q_NO_BOOL_TYPE
+# error "Compiler not supported"
# endif
/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
# define Q_NO_USING_KEYWORD
@@ -288,7 +255,6 @@
DEC C++ V5.5-004. */
# if __DECCXX_VER < 60060000
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
-# define Q_CANNOT_DELETE_CONSTANT
# endif
/* avoid undefined symbol problems with out-of-line template members */
# define Q_OUTOFLINE_TEMPLATE inline
@@ -315,7 +281,7 @@
__BOOL_DEFINED
Defined in Microsoft C++ mode when bool is a keyword. */
# if !defined(_BOOL) && !defined(__BOOL_DEFINED)
-# define Q_NO_BOOL_TYPE
+# error "Compiler not supported"
# endif
/* The Comeau compiler is based on EDG and does define __EDG__ */
@@ -341,9 +307,8 @@
# elif defined(__DCC__)
# define Q_CC_DIAB
-# undef Q_NO_BOOL_TYPE
# if !defined(__bool)
-# define Q_NO_BOOL_TYPE
+# error "Compiler not supported"
# endif
/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */
@@ -407,7 +372,7 @@
# define Q_NO_TEMPLATE_FRIENDS
# endif
# if !defined(_BOOL)
-# define Q_NO_BOOL_TYPE
+# error "Compiler not supported"
# endif
# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4)
# define Q_NO_USING_KEYWORD
@@ -415,9 +380,7 @@
# define Q_C_CALLBACKS
/* 4.2 compiler or older */
# else
-# define Q_NO_BOOL_TYPE
-# define Q_NO_EXPLICIT_KEYWORD
-# define Q_NO_USING_KEYWORD
+# error "Compiler not supported"
# endif
/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant
@@ -426,7 +389,7 @@
# define Q_CC_EDG
# define Q_CC_CDS
# if !defined(_BOOL)
-# define Q_NO_BOOL_TYPE
+# error "Compiler not supported"
# endif
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
@@ -449,11 +412,7 @@
# define Q_DECL_IMPORT Q_DECL_EXPORT
# endif
# else
-# define Q_CC_HP
-# define Q_NO_BOOL_TYPE
-# define Q_FULL_TEMPLATE_INSTANTIATION
-# define Q_BROKEN_TEMPLATE_SPECIALIZATION
-# define Q_NO_EXPLICIT_KEYWORD
+# error "Compiler not supported"
# endif
# define Q_NO_USING_KEYWORD /* ### check "using" status */
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index fb6eaeb452..99328d52ac 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -191,7 +191,7 @@ namespace QT_NAMESPACE {}
#endif
#ifndef Q_REQUIRED_RESULT
-# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
+# if defined(Q_CC_GNU)
# define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result))
# else
# define Q_REQUIRED_RESULT
@@ -275,11 +275,6 @@ typedef unsigned int uint;
typedef unsigned long ulong;
QT_END_INCLUDE_NAMESPACE
-#if defined(Q_NO_BOOL_TYPE)
-#error "Compiler doesn't support the bool type"
-#endif
-
-
/*
Constant bool values
*/
@@ -315,9 +310,7 @@ QT_END_INCLUDE_NAMESPACE
/*
Warnings and errors when using deprecated methods
*/
-#if defined(Q_MOC_RUN)
-# define Q_DECL_DEPRECATED Q_DECL_DEPRECATED
-#elif (defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2))) || defined(Q_CC_RVCT)
+#if defined(Q_CC_GNU) || defined(Q_CC_RVCT)
# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
#elif defined(Q_CC_MSVC)
# define Q_DECL_DEPRECATED __declspec(deprecated)
@@ -331,15 +324,6 @@ QT_END_INCLUDE_NAMESPACE
#ifndef Q_DECL_VARIABLE_DEPRECATED
# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED
#endif
-#ifndef Q_DECL_CONSTRUCTOR_DEPRECATED
-# if defined(Q_MOC_RUN)
-# define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED
-# elif defined(Q_NO_DEPRECATED_CONSTRUCTORS)
-# define Q_DECL_CONSTRUCTOR_DEPRECATED
-# else
-# define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_DEPRECATED
-# endif
-#endif
#if defined(QT_NO_DEPRECATED)
# undef QT_DEPRECATED
@@ -394,24 +378,13 @@ QT_END_INCLUDE_NAMESPACE
#ifdef QT_ASCII_CAST_WARNINGS
# define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED
-# if defined(Q_CC_GNU) && __GNUC__ < 4
- /* gcc < 4 doesn't like Q_DECL_DEPRECATED in front of constructors */
-# define QT_ASCII_CAST_WARN_CONSTRUCTOR
-# else
-# define QT_ASCII_CAST_WARN_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED
-# endif
#else
# define QT_ASCII_CAST_WARN
-# define QT_ASCII_CAST_WARN_CONSTRUCTOR
#endif
#if defined(__i386__) || defined(_WIN32) || defined(_WIN32_WCE)
# if defined(Q_CC_GNU)
-#if !defined(Q_CC_INTEL) && ((100*(__GNUC__ - 0) + 10*(__GNUC_MINOR__ - 0) + __GNUC_PATCHLEVEL__) >= 332)
# define QT_FASTCALL __attribute__((regparm(3)))
-#else
-# define QT_FASTCALL
-#endif
# elif defined(Q_CC_MSVC)
# define QT_FASTCALL __fastcall
# else
@@ -512,17 +485,12 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
class QDataStream;
-#if !defined(QT_NO_COP)
-# define QT_NO_COP
-#endif
-
#if defined(Q_OS_VXWORKS)
# define QT_NO_CRASHHANDLER // no popen
# define QT_NO_PROCESS // no exec*, no fork
# define QT_NO_LPR
# define QT_NO_SHAREDMEMORY // only POSIX, no SysV and in the end...
# define QT_NO_SYSTEMSEMAPHORE // not needed at all in a flat address space
-# define QT_NO_QWS_MULTIPROCESS // no processes
#endif
# include <QtCore/qfeatures.h>
@@ -1237,12 +1205,15 @@ class QFlags
int i;
public:
typedef Enum enum_type;
- Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {}
+ // compiler-generated copy/move ctor/assignment operators are fine!
+#ifdef qdoc
+ inline QFlags(const QFlags &other);
+ inline QFlags &operator=(const QFlags &other);
+#endif
Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
inline QFlags(QFlag f) : i(f) {}
- inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; }
inline QFlags &operator&=(int mask) { i &= mask; return *this; }
inline QFlags &operator&=(uint mask) { i &= mask; return *this; }
inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; }
@@ -1463,8 +1434,6 @@ Q_CORE_EXPORT int qrand();
#ifdef Q_OS_QNX
// QNX doesn't have SYSV style shared memory. Multiprocess QWS apps,
// shared fonts and QSystemSemaphore + QSharedMemory are not available
-# define QT_NO_QWS_MULTIPROCESS
-# define QT_NO_QWS_SHARE_FONTS
# define QT_NO_SYSTEMSEMAPHORE
# define QT_NO_SHAREDMEMORY
#endif
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 61c750acaf..c871675334 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -348,71 +348,8 @@ QLibraryInfo::location(LibraryLocation loc)
QSettings *config = QLibraryInfoPrivate::configuration();
config->beginGroup(QLatin1String("Paths"));
- QString subKey;
- {
- /*
- find the child group whose version number is closest
- to the library version. for example and we have the
- following groups:
-
- Paths
- Paths/4.0
- Paths/4.1.2
- Paths/4.2.5
- Paths/5
-
- if QT_VERSION is 4.0.1, then we use 'Paths/4.0'
- if QT_VERSION is 4.1.5, then we use 'Paths/4.1.2'
- if QT_VERSION is 4.6.3, then we use 'Paths/4.2.5'
- if QT_VERSION is 6.0.2, then we use 'Paths/5'
-
- note: any of the trailing version numbers may be
- omitted (in which case, they default to zero),
- i.e. 4 == 4.0.0, 4.1 == 4.1.0, and so on
- */
- enum {
- QT_MAJOR = ((QT_VERSION >> 16) & 0xFF),
- QT_MINOR = ((QT_VERSION >> 8) & 0xFF),
- QT_PATCH = (QT_VERSION & 0xFF)
- };
- int maj = 0, min = 0, pat = 0;
- QStringList children = config->childGroups();
- for(int child = 0; child < children.size(); ++child) {
- QString cver = children.at(child);
- QStringList cver_list = cver.split(QLatin1Char('.'));
- if(cver_list.size() > 0 && cver_list.size() < 4) {
- bool ok;
- int cmaj = -1, cmin = -1, cpat = -1;
- cmaj = cver_list[0].toInt(&ok);
- if(!ok || cmaj < 0)
- continue;
- if(cver_list.size() >= 2) {
- cmin = cver_list[1].toInt(&ok);
- if(!ok)
- continue;
- if(cmin < 0)
- cmin = -1;
- }
- if(cver_list.size() >= 3) {
- cpat = cver_list[2].toInt(&ok);
- if(!ok)
- continue;
- if(cpat < 0)
- cpat = -1;
- }
- if((cmaj >= maj && cmaj <= QT_MAJOR) &&
- (cmin == -1 || (cmin >= min && cmin <= QT_MINOR)) &&
- (cpat == -1 || (cpat >= pat && cpat <= QT_PATCH)) &&
- config->contains(cver + QLatin1Char('/') + key)) {
- subKey = cver + QLatin1Char('/');
- maj = cmaj;
- min = cmin;
- pat = cpat;
- }
- }
- }
- }
- ret = config->value(subKey + key, defaultValue).toString();
+ ret = config->value(key, defaultValue).toString();
+
// expand environment variables in the form $(ENVVAR)
int rep;
QRegExp reg_var(QLatin1String("\\$\\(.*\\)"));
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 2087d763de..4ea62c77a6 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -293,6 +293,7 @@ public:
WindowStaysOnTopHint = 0x00040000,
WindowTransparentForInput = 0x00080000,
WindowOverridesSystemGestures = 0x00100000,
+ WindowDoesNotAcceptFocus = 0x00200000,
CustomizeWindowHint = 0x02000000,
WindowStaysOnBottomHint = 0x04000000,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index d50960f68b..895feb7f53 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2112,6 +2112,9 @@
implements its own set of gestures and that system level gestures, like for
instance three-finger desktop switching, should be disabled.
+ \value WindowDoesNotAcceptFocus Informs the window system that this window should
+ not receive the input focus.
+
\value WindowType_Mask A mask for extracting the window type
part of the window flags.
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index f4f285bae4..534c377102 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -66,7 +66,9 @@
QT_BEGIN_NAMESPACE
+#ifndef Q_OS_WIN
#define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER
+#endif
// used in testing framework
#define QSETTINGS_P_H_VERSION 3
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index e31337d0fd..aa3745237b 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -67,7 +67,7 @@ QWindowsPipeWriter::~QWindowsPipeWriter()
quitNow = true;
waitCondition.wakeOne();
lock.unlock();
- if (!wait(100))
+ if (!wait(30000))
terminate();
#if !defined(Q_OS_WINCE) || (_WIN32_WCE >= 0x600)
CloseHandle(writePipe);
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 1d6610af05..a8c3921f45 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -431,15 +431,9 @@ bool QPersistentModelIndex::isValid() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QModelIndex &idx)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QModelIndex(" << idx.row() << ',' << idx.column()
<< ',' << idx.internalPointer() << ',' << idx.model() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QModelIndex to QDebug");
- return dbg;
- Q_UNUSED(idx);
-#endif
}
QDebug operator<<(QDebug dbg, const QPersistentModelIndex &idx)
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index 7f31128770..c6c1f6f3cf 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -1622,15 +1622,9 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QItemSelectionRange &range)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QItemSelectionRange(" << range.topLeft()
<< ',' << range.bottomRight() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QItemSelectionRange to QDebug");
- return dbg;
- Q_UNUSED(range);
-#endif
}
#endif
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index ebd1ce2a70..b7ef69423f 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -883,9 +883,10 @@ void QSortFilterProxyModelPrivate::source_items_removed(
if (proxy_count > source_to_proxy.size()) {
// mapping is in an inconsistent state -- redo the whole mapping
qWarning("QSortFilterProxyModel: inconsistent changes reported by source model");
- remove_from_mapping(source_parent);
Q_Q(QSortFilterProxyModel);
- q->reset();
+ q->beginResetModel();
+ remove_from_mapping(source_parent);
+ q->endResetModel();
return;
}
diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp
index 8b0ec85679..dfdd178c35 100644
--- a/src/corelib/kernel/qeventloop.cpp
+++ b/src/corelib/kernel/qeventloop.cpp
@@ -322,28 +322,51 @@ class QEventLoopLockerPrivate
{
public:
explicit QEventLoopLockerPrivate(QEventLoopPrivate *loop)
- : loop(loop), app(0)
+ : loop(loop), type(EventLoop)
{
loop->ref();
}
+ explicit QEventLoopLockerPrivate(QThreadPrivate *thread)
+ : thread(thread), type(Thread)
+ {
+ thread->ref();
+ }
+
explicit QEventLoopLockerPrivate(QCoreApplicationPrivate *app)
- : loop(0), app(app)
+ : app(app), type(Application)
{
app->ref();
}
~QEventLoopLockerPrivate()
{
- if (loop)
+ switch (type)
+ {
+ case EventLoop:
loop->deref();
- else
+ break;
+ case Thread:
+ thread->deref();
+ break;
+ default:
app->deref();
+ break;
+ }
}
private:
- QEventLoopPrivate *loop;
- QCoreApplicationPrivate *app;
+ union {
+ QEventLoopPrivate * loop;
+ QThreadPrivate * thread;
+ QCoreApplicationPrivate * app;
+ };
+ enum Type {
+ EventLoop,
+ Thread,
+ Application
+ };
+ const Type type;
};
/*!
@@ -390,6 +413,12 @@ QEventLoopLocker::QEventLoopLocker(QEventLoop *loop)
}
+QEventLoopLocker::QEventLoopLocker(QThread *thread)
+ : d_ptr(new QEventLoopLockerPrivate(static_cast<QThreadPrivate*>(QObjectPrivate::get(thread))))
+{
+
+}
+
/*!
Destroys this event loop locker object
*/
diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h
index 0e7195d6a7..ba082d7d9d 100644
--- a/src/corelib/kernel/qeventloop.h
+++ b/src/corelib/kernel/qeventloop.h
@@ -96,6 +96,7 @@ class Q_CORE_EXPORT QEventLoopLocker
public:
QEventLoopLocker();
explicit QEventLoopLocker(QEventLoop *loop);
+ explicit QEventLoopLocker(QThread *thread);
~QEventLoopLocker();
private:
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index a1baf28f10..003ad1c32d 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -1290,7 +1290,7 @@ namespace {
class TypeDestroyer {
template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct DestroyerImpl {
- static void Destroy(const int /* type */, T *where) { delete where; }
+ static void Destroy(const int /* type */, void *where) { qMetaTypeDeleteHelper<T>(where); }
};
template<typename T>
struct DestroyerImpl<T, /* IsAcceptedType = */ false> {
@@ -1318,7 +1318,7 @@ public:
template<typename T>
void delegate(const T *where) { DestroyerImpl<T>::Destroy(m_type, const_cast<T*>(where)); }
void delegate(const void *) {}
- void delegate(const QMetaTypeSwitcher::UnknownType *where) { customTypeDestroyer(m_type, (void*)where); }
+ void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestroyer(m_type, (void*)where); }
private:
static void customTypeDestroyer(const int type, void *where)
@@ -1354,11 +1354,11 @@ namespace {
class TypeConstructor {
template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct ConstructorImpl {
- static void *Construct(const int /*type*/, void *where, const T *copy) { return qMetaTypeConstructHelper(where, copy); }
+ static void *Construct(const int /*type*/, void *where, const void *copy) { return qMetaTypeConstructHelper<T>(where, copy); }
};
template<typename T>
struct ConstructorImpl<T, /* IsAcceptedType = */ false> {
- static void *Construct(const int type, void *where, const T *copy)
+ static void *Construct(const int type, void *where, const void *copy)
{
if (QTypeModuleInfo<T>::IsGui)
return Q_LIKELY(qMetaTypeGuiHelper) ? qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor(where, copy) : 0;
@@ -1380,7 +1380,7 @@ public:
template<typename T>
void *delegate(const T *copy) { return ConstructorImpl<T>::Construct(m_type, m_where, copy); }
void *delegate(const void *) { return m_where; }
- void *delegate(const QMetaTypeSwitcher::UnknownType *copy) { return customTypeConstructor(m_type, m_where, copy); }
+ void *delegate(const QMetaTypeSwitcher::NotBuiltinType *copy) { return customTypeConstructor(m_type, m_where, copy); }
private:
static void *customTypeConstructor(const int type, void *where, const void *copy)
@@ -1440,7 +1440,7 @@ namespace {
class TypeDestructor {
template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct DestructorImpl {
- static void Destruct(const int /* type */, T *where) { qMetaTypeDestructHelper(where); }
+ static void Destruct(const int /* type */, void *where) { qMetaTypeDestructHelper<T>(where); }
};
template<typename T>
struct DestructorImpl<T, /* IsAcceptedType = */ false> {
@@ -1468,7 +1468,7 @@ public:
template<typename T>
void delegate(const T *where) { DestructorImpl<T>::Destruct(m_type, const_cast<T*>(where)); }
void delegate(const void *) {}
- void delegate(const QMetaTypeSwitcher::UnknownType *where) { customTypeDestructor(m_type, (void*)where); }
+ void delegate(const QMetaTypeSwitcher::NotBuiltinType *where) { customTypeDestructor(m_type, (void*)where); }
private:
static void customTypeDestructor(const int type, void *where)
@@ -1536,7 +1536,7 @@ public:
template<typename T>
int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); }
- int delegate(const QMetaTypeSwitcher::UnknownType*) { return customTypeSizeOf(m_type); }
+ int delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeSizeOf(m_type); }
private:
static int customTypeSizeOf(const int type)
{
@@ -1606,7 +1606,7 @@ public:
template<typename T>
quint32 delegate(const T*) { return FlagsImpl<T>::Flags(m_type); }
quint32 delegate(const void*) { return 0; }
- quint32 delegate(const QMetaTypeSwitcher::UnknownType*) { return customTypeFlags(m_type); }
+ quint32 delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return customTypeFlags(m_type); }
private:
const int m_type;
static quint32 customTypeFlags(const int type)
@@ -1793,7 +1793,7 @@ public:
template<typename T>
void delegate(const T*) { TypeInfoImpl<T>(m_type, info); }
void delegate(const void*) {}
- void delegate(const QMetaTypeSwitcher::UnknownType*) { customTypeInfo(m_type); }
+ void delegate(const QMetaTypeSwitcher::NotBuiltinType*) { customTypeInfo(m_type); }
private:
void customTypeInfo(const uint type)
{
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 4af77fcedc..beb7294abd 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -200,14 +200,7 @@ public:
LastWidgetsType = QSizePolicy,
HighestInternalId = LastWidgetsType,
-// This logic must match the one in qglobal.h
-#if defined(QT_COORD_TYPE)
- QReal = 0,
-#elif defined(QT_NO_FPU) || defined(Q_PROCESSOR_ARM) || defined(Q_OS_WINCE)
- QReal = Float,
-#else
- QReal = Double,
-#endif
+ QReal = sizeof(qreal) == sizeof(double) ? Double : Float,
User = 256
};
@@ -318,46 +311,57 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaType::TypeFlags)
template <typename T>
-void qMetaTypeDeleteHelper(T *t)
+void qMetaTypeDeleteHelper(void *t)
{
- delete t;
+ delete static_cast<T*>(t);
}
+template <> inline void qMetaTypeDeleteHelper<void>(void *) {}
template <typename T>
-void *qMetaTypeCreateHelper(const T *t)
+void *qMetaTypeCreateHelper(const void *t)
{
if (t)
return new T(*static_cast<const T*>(t));
return new T();
}
+template <> inline void *qMetaTypeCreateHelper<void>(const void *) { return 0; }
+
template <typename T>
-void qMetaTypeDestructHelper(T *t)
+void qMetaTypeDestructHelper(void *t)
{
Q_UNUSED(t) // Silence MSVC that warns for POD types.
- t->~T();
+ static_cast<T*>(t)->~T();
}
+template <> inline void qMetaTypeDestructHelper<void>(void *) {}
+
template <typename T>
-void *qMetaTypeConstructHelper(void *where, const T *t)
+void *qMetaTypeConstructHelper(void *where, const void *t)
{
if (t)
return new (where) T(*static_cast<const T*>(t));
return new (where) T;
}
+template <> inline void *qMetaTypeConstructHelper<void>(void *, const void *) { return 0; }
+
#ifndef QT_NO_DATASTREAM
template <typename T>
-void qMetaTypeSaveHelper(QDataStream &stream, const T *t)
+void qMetaTypeSaveHelper(QDataStream &stream, const void *t)
{
- stream << *t;
+ stream << *static_cast<const T*>(t);
}
+template <> inline void qMetaTypeSaveHelper<void>(QDataStream &, const void *) {}
+
template <typename T>
-void qMetaTypeLoadHelper(QDataStream &stream, T *t)
+void qMetaTypeLoadHelper(QDataStream &stream, void *t)
{
- stream >> *t;
+ stream >> *static_cast<T*>(t);
}
+
+template <> inline void qMetaTypeLoadHelper<void>(QDataStream &, void *) {}
#endif // QT_NO_DATASTREAM
template <typename T>
@@ -442,15 +446,6 @@ int qRegisterMetaType(const char *typeName
if (typedefOf != -1)
return QMetaType::registerTypedef(typeName, typedefOf);
- typedef void*(*CreatePtr)(const T*);
- CreatePtr cptr = qMetaTypeCreateHelper<T>;
- typedef void(*DeletePtr)(T*);
- DeletePtr dptr = qMetaTypeDeleteHelper<T>;
- typedef void*(*ConstructPtr)(void *, const T*);
- ConstructPtr ipcptr = qMetaTypeConstructHelper<T>;
- typedef void(*DestructPtr)(T*);
- DestructPtr ipdptr = qMetaTypeDestructHelper<T>;
-
QMetaType::TypeFlags flags;
if (!QTypeInfo<T>::isStatic)
flags |= QMetaType::MovableType;
@@ -461,10 +456,10 @@ int qRegisterMetaType(const char *typeName
if (QtPrivate::IsPointerToTypeDerivedFromQObject<T>::Value)
flags |= QMetaType::PointerToQObject;
- return QMetaType::registerType(typeName, reinterpret_cast<QMetaType::Deleter>(dptr),
- reinterpret_cast<QMetaType::Creator>(cptr),
- reinterpret_cast<QMetaType::Destructor>(ipdptr),
- reinterpret_cast<QMetaType::Constructor>(ipcptr),
+ return QMetaType::registerType(typeName, qMetaTypeDeleteHelper<T>,
+ qMetaTypeCreateHelper<T>,
+ qMetaTypeDestructHelper<T>,
+ qMetaTypeConstructHelper<T>,
sizeof(T),
flags);
}
@@ -477,14 +472,8 @@ void qRegisterMetaTypeStreamOperators(const char *typeName
#endif
)
{
- typedef void(*SavePtr)(QDataStream &, const T *);
- typedef void(*LoadPtr)(QDataStream &, T *);
- SavePtr sptr = qMetaTypeSaveHelper<T>;
- LoadPtr lptr = qMetaTypeLoadHelper<T>;
-
qRegisterMetaType<T>(typeName);
- QMetaType::registerStreamOperators(typeName, reinterpret_cast<QMetaType::SaveOperator>(sptr),
- reinterpret_cast<QMetaType::LoadOperator>(lptr));
+ QMetaType::registerStreamOperators(typeName, qMetaTypeSaveHelper<T>, qMetaTypeLoadHelper<T>);
}
#endif // QT_NO_DATASTREAM
@@ -516,16 +505,8 @@ inline int qRegisterMetaType(
template <typename T>
inline int qRegisterMetaTypeStreamOperators()
{
- typedef void(*SavePtr)(QDataStream &, const T *);
- typedef void(*LoadPtr)(QDataStream &, T *);
- SavePtr sptr = qMetaTypeSaveHelper<T>;
- LoadPtr lptr = qMetaTypeLoadHelper<T>;
-
register int id = qMetaTypeId<T>();
- QMetaType::registerStreamOperators(id,
- reinterpret_cast<QMetaType::SaveOperator>(sptr),
- reinterpret_cast<QMetaType::LoadOperator>(lptr));
-
+ QMetaType::registerStreamOperators(id, qMetaTypeSaveHelper<T>, qMetaTypeLoadHelper<T>);
return id;
}
#endif
diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h
index e48c5d3033..b50521c7a6 100644
--- a/src/corelib/kernel/qmetatype_p.h
+++ b/src/corelib/kernel/qmetatype_p.h
@@ -122,31 +122,6 @@ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_DECLARE_WIDGETS_MODULE_TYPES_ITER)
class QMetaTypeInterface
{
public:
- template<typename T>
- struct Impl {
- static void *creator(const T *t)
- {
- if (t)
- return new T(*t);
- return new T();
- }
-
- static void deleter(T *t) { delete t; }
- static void saver(QDataStream &stream, const T *t) { stream << *t; }
- static void loader(QDataStream &stream, T *t) { stream >> *t; }
- static void destructor(T *t)
- {
- Q_UNUSED(t) // Silence MSVC that warns for POD types.
- t->~T();
- }
- static void *constructor(void *where, const T *t)
- {
- if (t)
- return new (where) T(*static_cast<const T*>(t));
- return new (where) T;
- }
- };
-
QMetaType::Creator creator;
QMetaType::Deleter deleter;
QMetaType::SaveOperator saveOp;
@@ -157,20 +132,10 @@ public:
quint32 flags; // same as QMetaType::TypeFlags
};
-template<>
-struct QMetaTypeInterface::Impl<void> {
- static void *creator(const void *) { return 0; }
- static void deleter(void *) {}
- static void saver(QDataStream &, const void *) {}
- static void loader(QDataStream &, void *) {}
- static void destructor(void *){}
- static void *constructor(void *, const void *) { return 0; }
-};
-
#ifndef QT_NO_DATASTREAM
# define QT_METATYPE_INTERFACE_INIT_DATASTREAM_IMPL(Type) \
- /*saveOp*/(reinterpret_cast<QMetaType::SaveOperator>(QMetaTypeInterface::Impl<Type>::saver)), \
- /*loadOp*/(reinterpret_cast<QMetaType::LoadOperator>(QMetaTypeInterface::Impl<Type>::loader)),
+ /*saveOp*/(qMetaTypeSaveHelper<Type>), \
+ /*loadOp*/(qMetaTypeLoadHelper<Type>),
# define QT_METATYPE_INTERFACE_INIT_EMPTY_DATASTREAM_IMPL(Type) \
/*saveOp*/ 0, \
/*loadOp*/ 0,
@@ -184,11 +149,11 @@ struct QMetaTypeInterface::Impl<void> {
#define QT_METATYPE_INTERFACE_INIT_IMPL(Type, DATASTREAM_DELEGATE) \
{ \
- /*creator*/(reinterpret_cast<QMetaType::Creator>(QMetaTypeInterface::Impl<Type>::creator)), \
- /*deleter*/(reinterpret_cast<QMetaType::Deleter>(QMetaTypeInterface::Impl<Type>::deleter)), \
+ /*creator*/(qMetaTypeCreateHelper<Type>), \
+ /*deleter*/(qMetaTypeDeleteHelper<Type>), \
DATASTREAM_DELEGATE(Type) \
- /*constructor*/(reinterpret_cast<QMetaType::Constructor>(QMetaTypeInterface::Impl<Type>::constructor)), \
- /*destructor*/(reinterpret_cast<QMetaType::Destructor>(QMetaTypeInterface::Impl<Type>::destructor)), \
+ /*constructor*/(qMetaTypeConstructHelper<Type>), \
+ /*destructor*/(qMetaTypeDestructHelper<Type>), \
/*size*/(QTypeInfo<Type>::sizeOf), \
/*flags*/(!QTypeInfo<Type>::isStatic * QMetaType::MovableType) \
| (QTypeInfo<Type>::isComplex * QMetaType::NeedsConstruction) \
diff --git a/src/corelib/kernel/qmetatypeswitcher_p.h b/src/corelib/kernel/qmetatypeswitcher_p.h
index c1cccfca63..e9c15ea214 100644
--- a/src/corelib/kernel/qmetatypeswitcher_p.h
+++ b/src/corelib/kernel/qmetatypeswitcher_p.h
@@ -59,46 +59,27 @@ QT_BEGIN_NAMESPACE
class QMetaTypeSwitcher {
public:
-
- typedef void *UnknownType;
+ class NotBuiltinType;
template<class ReturnType, class DelegateObject>
static ReturnType switcher(DelegateObject &logic, int type, const void *data);
};
-#define QT_METATYPE_SWICHER_CASE_PRIMITIVE(TypeName, TypeId, Name)\
- case QMetaType::TypeName: return logic.delegate(static_cast<const Name *>(data));
-
-#define QT_METATYPE_SWICHER_CASE_PRIMITIVE_POINTER(TypeName, TypeId, Name)\
- case QMetaType::TypeName: return logic.delegate(static_cast< Name * const *>(data));
-
-#define QT_METATYPE_SWICHER_CASE_POINTER(TypeName, TypeId, Name)\
- case QMetaType::TypeName: return logic.delegate(static_cast< QT_PREPEND_NAMESPACE(Name) * const *>(data));
-
-#define QT_METATYPE_SWICHER_CASE_QCLASS(TypeName, TypeId, Name)\
- case QMetaType::TypeName: return logic.delegate(static_cast<const QT_PREPEND_NAMESPACE(Name) *>(data));
+#define QT_METATYPE_SWICHER_CASE(TypeName, TypeId, Name)\
+ case QMetaType::TypeName: return logic.delegate(static_cast<Name const *>(data));
template<class ReturnType, class DelegateObject>
ReturnType QMetaTypeSwitcher::switcher(DelegateObject &logic, int type, const void *data)
{
switch (QMetaType::Type(type)) {
- QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(QT_METATYPE_SWICHER_CASE_PRIMITIVE)
- QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QT_METATYPE_SWICHER_CASE_PRIMITIVE_POINTER)
- QT_FOR_EACH_STATIC_CORE_POINTER(QT_METATYPE_SWICHER_CASE_POINTER)
- QT_FOR_EACH_STATIC_CORE_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS)
- QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_METATYPE_SWICHER_CASE_QCLASS)
- QT_FOR_EACH_STATIC_GUI_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS)
- QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS)
+ QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_SWICHER_CASE)
default:
- return logic.delegate(static_cast<const UnknownType *>(data));
+ return logic.delegate(static_cast<NotBuiltinType const *>(data));
}
}
-#undef QT_METATYPE_SWICHER_CASE_PRIMITIVE
-#undef QT_METATYPE_SWICHER_CASE_PRIMITIVE_POINTER
-#undef QT_METATYPE_SWICHER_CASE_QCLASS
-#undef QT_METATYPE_SWICHER_CASE_POINTER
+#undef QT_METATYPE_SWICHER_CASE
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 252a713872..8fa5dcdcff 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3617,7 +3617,6 @@ QObjectUserData* QObject::userData(uint id) const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QObject *o) {
-#ifndef Q_BROKEN_DEBUG_STREAM
if (!o)
return dbg << "QObject(0x0) ";
dbg.nospace() << o->metaObject()->className() << '(' << (void *)o;
@@ -3625,11 +3624,6 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
dbg << ", name = " << o->objectName();
dbg << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QObject to QDebug");
- return dbg;
- Q_UNUSED(o);
-#endif
}
#endif
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index 5adffb708f..419fcc1dd4 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE
namespace QtPrivate {
template <typename T> struct RemoveRef { typedef T Type; };
- template <typename T> struct RemoveRef<const T&> { typedef T Type; };
template <typename T> struct RemoveRef<T&> { typedef T Type; };
template <typename T> struct RemoveConstRef { typedef T Type; };
template <typename T> struct RemoveConstRef<const T&> { typedef T Type; };
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 45ef8ab3ca..fa0226917f 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -54,7 +54,7 @@ class QByteArray;
class QString;
#ifndef Q_MOC_OUTPUT_REVISION
-#define Q_MOC_OUTPUT_REVISION 63
+#define Q_MOC_OUTPUT_REVISION 64
#endif
// The following macros are our "extensions" to C++
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 2f67ae9287..5eaa93c7b0 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -279,7 +279,7 @@ inline bool qt_convertToBool(const QVariant::Private *const d)
Converts \a d to type \a t, which is placed in \a result.
*/
-static bool convert(const QVariant::Private *d, QVariant::Type t, void *result, bool *ok)
+static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
{
Q_ASSERT(d->type != uint(t));
Q_ASSERT(result);
@@ -732,7 +732,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
return true;
}
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
static void streamDebug(QDebug dbg, const QVariant &v)
{
QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
@@ -752,7 +752,7 @@ const QVariant::Handler qt_kernel_variant_handler = {
compare,
convert,
0,
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
streamDebug
#else
0
@@ -763,8 +763,8 @@ static void dummyConstruct(QVariant::Private *, const void *) { Q_ASSERT_X(false
static void dummyClear(QVariant::Private *) { Q_ASSERT_X(false, "QVariant", "Trying to clear an unknown type"); }
static bool dummyIsNull(const QVariant::Private *d) { Q_ASSERT_X(false, "QVariant::isNull", "Trying to call isNull on an unknown type"); return d->is_null; }
static bool dummyCompare(const QVariant::Private *, const QVariant::Private *) { Q_ASSERT_X(false, "QVariant", "Trying to compare an unknown types"); return false; }
-static bool dummyConvert(const QVariant::Private *, QVariant::Type , void *, bool *) { Q_ASSERT_X(false, "QVariant", "Trying to convert an unknown type"); return false; }
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+static bool dummyConvert(const QVariant::Private *, int, void *, bool *) { Q_ASSERT_X(false, "QVariant", "Trying to convert an unknown type"); return false; }
+#if !defined(QT_NO_DEBUG_STREAM)
static void dummyStreamDebug(QDebug, const QVariant &) { Q_ASSERT_X(false, "QVariant", "Trying to convert an unknown type"); }
#endif
const QVariant::Handler qt_dummy_variant_handler = {
@@ -778,7 +778,7 @@ const QVariant::Handler qt_dummy_variant_handler = {
dummyCompare,
dummyConvert,
0,
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
dummyStreamDebug
#else
0
@@ -840,14 +840,14 @@ static bool customCompare(const QVariant::Private *a, const QVariant::Private *b
return !memcmp(a_ptr, b_ptr, QMetaType::sizeOf(a->type));
}
-static bool customConvert(const QVariant::Private *, QVariant::Type, void *, bool *ok)
+static bool customConvert(const QVariant::Private *, int, void *, bool *ok)
{
if (ok)
*ok = false;
return false;
}
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
static void customStreamDebug(QDebug, const QVariant &) {}
#endif
@@ -862,7 +862,7 @@ const QVariant::Handler qt_custom_variant_handler = {
customCompare,
customConvert,
0,
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
customStreamDebug
#else
0
@@ -1062,9 +1062,9 @@ Q_CORE_EXPORT void QVariantPrivate::unregisterHandler(const int /* Modules::Name
/*!
- \fn QVariant::QVariant(int typeOrUserType, const void *copy)
+ \fn QVariant::QVariant(int typeId, const void *copy)
- Constructs variant of type \a typeOrUserType, and initializes with
+ Constructs variant of type \a typeId, and initializes with
\a copy if \a copy is not 0.
Note that you have to pass the address of the variable you want stored.
@@ -1162,17 +1162,15 @@ QVariant::QVariant(QDataStream &s)
\fn QVariant::QVariant(const char *val)
Constructs a new variant with a string value of \a val.
- The variant creates a deep copy of \a val, using the encoding
- set by QTextCodec::setCodecForCStrings().
+ The variant creates a deep copy of \a val into a QString assuming
+ UTF-8 encoding on the input \a val.
Note that \a val is converted to a QString for storing in the
- variant and QVariant::type() will return QMetaType::QString for
+ variant and QVariant::userType() will return QMetaType::QString for
the variant.
You can disable this operator by defining \c
QT_NO_CAST_FROM_ASCII when you compile your applications.
-
- \sa QTextCodec::setCodecForCStrings()
*/
#ifndef QT_NO_CAST_FROM_ASCII
@@ -1375,19 +1373,19 @@ QVariant::QVariant(const char *val)
QVariant::QVariant(Type type)
{ create(type, 0); }
-QVariant::QVariant(int typeOrUserType, const void *copy)
-{ create(typeOrUserType, copy); d.is_null = false; }
+QVariant::QVariant(int typeId, const void *copy)
+{ create(typeId, copy); d.is_null = false; }
/*! \internal
flags is true if it is a pointer type
*/
-QVariant::QVariant(int typeOrUserType, const void *copy, uint flags)
+QVariant::QVariant(int typeId, const void *copy, uint flags)
{
if (flags) { //type is a pointer type
- d.type = typeOrUserType;
+ d.type = typeId;
d.data.ptr = *reinterpret_cast<void *const*>(copy);
} else {
- create(typeOrUserType, copy);
+ create(typeId, copy);
}
d.is_null = false;
}
@@ -1565,7 +1563,7 @@ void QVariant::detach()
*/
const char *QVariant::typeName() const
{
- return typeToName(Type(d.type));
+ return typeToName(d.type);
}
/*!
@@ -1582,17 +1580,17 @@ void QVariant::clear()
}
/*!
- Converts the enum representation of the storage type, \a typ, to
+ Converts the int representation of the storage type, \a typeId, to
its string representation.
Returns a null pointer if the type is QVariant::Invalid or doesn't exist.
*/
-const char *QVariant::typeToName(Type typ)
+const char *QVariant::typeToName(int typeId)
{
- if (typ == Invalid)
+ if (typeId == Invalid)
return 0;
- return QMetaType::typeName(typ);
+ return QMetaType::typeName(typeId);
}
@@ -1842,7 +1840,7 @@ QDataStream& operator<<(QDataStream &s, const QVariant::Type p)
template <typename T>
inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &handlerManager)
{
- const QVariant::Type targetType = static_cast<const QVariant::Type>(qMetaTypeId<T>());
+ const uint targetType = qMetaTypeId<T>();
if (d.type == targetType)
return *v_cast<T>(&d);
@@ -2163,7 +2161,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d,
return val;
T ret = 0;
- if (!handlerManager[d.type]->convert(&d, QVariant::Type(t), &ret, ok) && ok)
+ if (!handlerManager[d.type]->convert(&d, t, &ret, ok) && ok)
*ok = false;
return ret;
}
@@ -2407,7 +2405,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*!
Returns true if the variant's type can be cast to the requested
- type, \a t. Such casting is done automatically when calling the
+ type, \a targetTypeId. Such casting is done automatically when calling the
toInt(), toBool(), ... methods.
The following casts are done automatically:
@@ -2439,18 +2437,18 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
\sa convert()
*/
-bool QVariant::canConvert(Type t) const
+bool QVariant::canConvert(int targetTypeId) const
{
// TODO Reimplement this function, currently it works but it is a historical mess.
const uint currentType = ((d.type == QMetaType::Float) ? QVariant::Double : d.type);
- if (uint(t) == uint(QMetaType::Float)) t = QVariant::Double;
+ if (uint(targetTypeId) == uint(QMetaType::Float)) targetTypeId = QVariant::Double;
- if (currentType == uint(t))
+ if (currentType == uint(targetTypeId))
return true;
// FIXME It should be LastCoreType intead of Uuid
- if (currentType > QVariant::Uuid || t > QVariant::Uuid) {
- switch (uint(t)) {
+ if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) {
+ switch (uint(targetTypeId)) {
case QVariant::Int:
return currentType == QVariant::KeySequence
|| currentType == QMetaType::ULong
@@ -2492,14 +2490,14 @@ bool QVariant::canConvert(Type t) const
}
}
- if(t == String && currentType == StringList)
+ if (targetTypeId == String && currentType == StringList)
return v_cast<QStringList>(&d)->count() == 1;
else
- return qCanConvertMatrix[t] & (1 << currentType);
+ return qCanConvertMatrix[targetTypeId] & (1 << currentType);
}
/*!
- Casts the variant to the requested type, \a t. If the cast cannot be
+ Casts the variant to the requested type, \a targetTypeId. If the cast cannot be
done, the variant is cleared. Returns true if the current type of
the variant was successfully cast; otherwise returns false.
@@ -2510,23 +2508,23 @@ bool QVariant::canConvert(Type t) const
\sa canConvert(), clear()
*/
-bool QVariant::convert(Type t)
+bool QVariant::convert(int targetTypeId)
{
- if (d.type == uint(t))
+ if (d.type == uint(targetTypeId))
return true;
QVariant oldValue = *this;
clear();
- if (!oldValue.canConvert(t))
+ if (!oldValue.canConvert(targetTypeId))
return false;
- create(t, 0);
+ create(targetTypeId, 0);
if (oldValue.isNull())
return false;
bool isOk = true;
- if (!handlerManager[d.type]->convert(&oldValue.d, t, data(), &isOk))
+ if (!handlerManager[d.type]->convert(&oldValue.d, targetTypeId, data(), &isOk))
isOk = false;
d.is_null = !isOk;
return isOk;
@@ -2540,7 +2538,7 @@ bool QVariant::convert(Type t)
bool QVariant::convert(const int type, void *ptr) const
{
Q_ASSERT(type < int(QMetaType::User));
- return handlerManager[type]->convert(&d, QVariant::Type(type), ptr, 0);
+ return handlerManager[type]->convert(&d, type, ptr, 0);
}
@@ -2607,7 +2605,7 @@ bool QVariant::cmp(const QVariant &v) const
else
return toLongLong() == v.toLongLong();
}
- if (!v2.canConvert(Type(d.type)) || !v2.convert(Type(d.type)))
+ if (!v2.canConvert(d.type) || !v2.convert(d.type))
return false;
}
return handlerManager[d.type]->compare(&d, &v2.d);
@@ -2646,28 +2644,16 @@ bool QVariant::isNull() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QVariant &v)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QVariant(" << QMetaType::typeName(v.userType()) << ", ";
handlerManager[v.d.type]->debugStream(dbg, v);
dbg.nospace() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QVariant to QDebug");
- return dbg;
- Q_UNUSED(v);
-#endif
}
QDebug operator<<(QDebug dbg, const QVariant::Type p)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QVariant::" << QMetaType::typeName(p);
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QVariant::Type to QDebug");
- return dbg;
- Q_UNUSED(p);
-#endif
}
#endif
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 5fcfe3e696..5da482d5cd 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -194,8 +194,8 @@ class Q_CORE_EXPORT QVariant
inline QVariant();
~QVariant();
QVariant(Type type);
- QVariant(int typeOrUserType, const void *copy);
- QVariant(int typeOrUserType, const void *copy, uint flags);
+ QVariant(int typeId, const void *copy);
+ QVariant(int typeId, const void *copy, uint flags);
QVariant(const QVariant &other);
#ifndef QT_NO_DATASTREAM
@@ -210,7 +210,7 @@ class Q_CORE_EXPORT QVariant
QVariant(double d);
QVariant(float f) { d.is_null = false; d.type = QMetaType::Float; d.data.f = f; }
#ifndef QT_NO_CAST_FROM_ASCII
- QT_ASCII_CAST_WARN_CONSTRUCTOR QVariant(const char *str);
+ QT_ASCII_CAST_WARN QVariant(const char *str);
#endif
QVariant(const QByteArray &bytearray);
@@ -257,8 +257,8 @@ class Q_CORE_EXPORT QVariant
int userType() const;
const char *typeName() const;
- bool canConvert(Type t) const;
- bool convert(Type t);
+ bool canConvert(int targetTypeId) const;
+ bool convert(int targetTypeId);
inline bool isValid() const;
bool isNull() const;
@@ -311,7 +311,7 @@ class Q_CORE_EXPORT QVariant
void load(QDataStream &ds);
void save(QDataStream &ds) const;
#endif
- static const char *typeToName(Type type);
+ static const char *typeToName(int typeId);
static Type nameToType(const char *name);
void *data();
@@ -331,7 +331,7 @@ class Q_CORE_EXPORT QVariant
template<typename T>
bool canConvert() const
- { return canConvert(Type(qMetaTypeId<T>())); }
+ { return canConvert(qMetaTypeId<T>()); }
public:
#ifndef qdoc
@@ -381,8 +381,8 @@ class Q_CORE_EXPORT QVariant
typedef void (*f_save)(const Private *, QDataStream &);
#endif
typedef bool (*f_compare)(const Private *, const Private *);
- typedef bool (*f_convert)(const QVariant::Private *d, Type t, void *, bool *);
- typedef bool (*f_canConvert)(const QVariant::Private *d, Type t);
+ typedef bool (*f_convert)(const QVariant::Private *d, int t, void *, bool *);
+ typedef bool (*f_canConvert)(const QVariant::Private *d, int t);
typedef void (*f_debugStream)(QDebug, const QVariant &);
struct Handler {
f_construct construct;
@@ -527,7 +527,7 @@ namespace QtPrivate {
return *reinterpret_cast<const T *>(v.constData());
if (vid < int(QMetaType::User)) {
T t;
- if (v.convert(QVariant::Type(vid), &t))
+ if (v.convert(vid, &t))
return t;
}
return T();
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index cdae8997a7..a754bc4363 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -188,7 +188,7 @@ public:
}
bool delegate(const void*) { return true; }
-
+ bool delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return false; }
protected:
const QVariant::Private *m_a;
const QVariant::Private *m_b;
@@ -282,6 +282,7 @@ public:
}
// we need that as sizof(void) is undefined and it is needed in HasIsNullMethod
bool delegate(const void *) { return m_d->is_null; }
+ bool delegate(const QMetaTypeSwitcher::NotBuiltinType *) { return m_d->is_null; }
protected:
const QVariant::Private *m_d;
};
@@ -345,7 +346,7 @@ public:
FilteredConstructor<T>(*this);
}
- void delegate(const QMetaTypeSwitcher::UnknownType*)
+ void delegate(const QMetaTypeSwitcher::NotBuiltinType*)
{
qWarning("Trying to construct an instance of an invalid type, type id: %i", m_x->type);
m_x->type = QVariant::Invalid;
@@ -395,7 +396,7 @@ public:
FilteredDestructor<T> cleaner(m_d);
}
- void delegate(const QMetaTypeSwitcher::UnknownType*)
+ void delegate(const QMetaTypeSwitcher::NotBuiltinType*)
{
qWarning("Trying to destruct an instance of an invalid type, type id: %i", m_d->type);
}
@@ -410,7 +411,7 @@ Q_CORE_EXPORT void registerHandler(const int /* Modules::Names */ name, const QV
Q_CORE_EXPORT void unregisterHandler(const int /* Modules::Names */ name);
}
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
template<class Filter>
class QVariantDebugStream
{
@@ -441,7 +442,7 @@ public:
Filtered<T> streamIt(m_debugStream, m_d);
}
- void delegate(const QMetaTypeSwitcher::UnknownType*)
+ void delegate(const QMetaTypeSwitcher::NotBuiltinType*)
{
qWarning("Trying to stream an instance of an invalid type, type id: %i", m_d->type);
}
diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h
index 655ca365fa..e35c1923f9 100644
--- a/src/corelib/mimetypes/qmimemagicrule_p.h
+++ b/src/corelib/mimetypes/qmimemagicrule_p.h
@@ -83,6 +83,7 @@ public:
private:
const QScopedPointer<QMimeMagicRulePrivate> d;
};
+Q_DECLARE_TYPEINFO(QMimeMagicRule, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index 77592880a0..4099487f9b 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -300,7 +300,6 @@ QString QMimeType::name() const
Returns the description of the MIME type to be displayed on user interfaces.
The system language (QLocale::system().name()) is used to select the appropriate translation.
- Another language can be specified by setting the \a localeName argument.
*/
QString QMimeType::comment() const
{
diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp
index 23f57367e3..4a2ec0a0b2 100644
--- a/src/corelib/mimetypes/qmimetypeparser.cpp
+++ b/src/corelib/mimetypes/qmimetypeparser.cpp
@@ -58,29 +58,29 @@
QT_BEGIN_NAMESPACE
// XML tags in MIME files
-const char *const mimeInfoTagC = "mime-info";
-const char *const mimeTypeTagC = "mime-type";
-const char *const mimeTypeAttributeC = "type";
-const char *const subClassTagC = "sub-class-of";
-const char *const commentTagC = "comment";
-const char *const genericIconTagC = "generic-icon";
-const char *const iconTagC = "icon";
-const char *const nameAttributeC = "name";
-const char *const globTagC = "glob";
-const char *const aliasTagC = "alias";
-const char *const patternAttributeC = "pattern";
-const char *const weightAttributeC = "weight";
-const char *const caseSensitiveAttributeC = "case-sensitive";
-const char *const localeAttributeC = "xml:lang";
+static const char mimeInfoTagC[] = "mime-info";
+static const char mimeTypeTagC[] = "mime-type";
+static const char mimeTypeAttributeC[] = "type";
+static const char subClassTagC[] = "sub-class-of";
+static const char commentTagC[] = "comment";
+static const char genericIconTagC[] = "generic-icon";
+static const char iconTagC[] = "icon";
+static const char nameAttributeC[] = "name";
+static const char globTagC[] = "glob";
+static const char aliasTagC[] = "alias";
+static const char patternAttributeC[] = "pattern";
+static const char weightAttributeC[] = "weight";
+static const char caseSensitiveAttributeC[] = "case-sensitive";
+static const char localeAttributeC[] = "xml:lang";
-const char *const magicTagC = "magic";
-const char *const priorityAttributeC = "priority";
+static const char magicTagC[] = "magic";
+static const char priorityAttributeC[] = "priority";
-const char *const matchTagC = "match";
-const char *const matchValueAttributeC = "value";
-const char *const matchTypeAttributeC = "type";
-const char *const matchOffsetAttributeC = "offset";
-const char *const matchMaskAttributeC = "mask";
+static const char matchTagC[] = "match";
+static const char matchValueAttributeC[] = "value";
+static const char matchTypeAttributeC[] = "type";
+static const char matchOffsetAttributeC[] = "offset";
+static const char matchMaskAttributeC[] = "mask";
/*!
\class QMimeTypeParser
diff --git a/src/corelib/mimetypes/qmimetypeparser_p.h b/src/corelib/mimetypes/qmimetypeparser_p.h
index 455c07063c..af01e1641a 100644
--- a/src/corelib/mimetypes/qmimetypeparser_p.h
+++ b/src/corelib/mimetypes/qmimetypeparser_p.h
@@ -50,30 +50,6 @@ QT_BEGIN_NAMESPACE
class QIODevice;
-// XML tags in MIME files
-extern const char *const mimeInfoTagC;
-extern const char *const mimeTypeTagC;
-extern const char *const mimeTypeAttributeC;
-extern const char *const subClassTagC;
-extern const char *const commentTagC;
-extern const char *const genericIconTagC;
-extern const char *const nameAttributeC;
-extern const char *const globTagC;
-extern const char *const aliasTagC;
-extern const char *const patternAttributeC;
-extern const char *const weightAttributeC;
-extern const char *const caseSensitiveAttributeC;
-extern const char *const localeAttributeC;
-
-extern const char *const magicTagC;
-extern const char *const priorityAttributeC;
-
-extern const char *const matchTagC;
-extern const char *const matchValueAttributeC;
-extern const char *const matchTypeAttributeC;
-extern const char *const matchOffsetAttributeC;
-extern const char *const matchMaskAttributeC;
-
class QMimeTypeParserBase
{
Q_DISABLE_COPY(QMimeTypeParserBase)
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index be0a98d3b5..a071463178 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -763,5 +763,14 @@ void QThread::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
}
}
+bool QThread::event(QEvent *event)
+{
+ if (event->type() == QEvent::Quit) {
+ quit();
+ return true;
+ } else {
+ return QObject::event(event);
+ }
+}
QT_END_NAMESPACE
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index 719f4afbbb..ba119afb5d 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -95,6 +95,8 @@ public:
QAbstractEventDispatcher *eventDispatcher() const;
void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
+ bool event(QEvent *event);
+
public Q_SLOTS:
void start(Priority = InheritPriority);
void terminate();
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index d8374e9805..6597b56893 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -60,6 +60,7 @@
#include "QtCore/qstack.h"
#include "QtCore/qwaitcondition.h"
#include "QtCore/qmap.h"
+#include "QtCore/qcoreapplication.h"
#include "private/qobject_p.h"
@@ -144,6 +145,7 @@ public:
~QThreadPrivate();
mutable QMutex mutex;
+ QAtomicInt quitLockRef;
bool running;
bool finished;
@@ -179,6 +181,18 @@ public:
QThreadData *data;
static void createEventDispatcher(QThreadData *data);
+
+ void ref()
+ {
+ quitLockRef.ref();
+ }
+
+ void deref()
+ {
+ if (!quitLockRef.deref() && running) {
+ QCoreApplication::instance()->postEvent(q_ptr, new QEvent(QEvent::Quit));
+ }
+ }
};
#else // QT_NO_THREAD
@@ -195,6 +209,9 @@ public:
static QThread *threadForId(int) { return QThread::currentThread(); }
static void createEventDispatcher(QThreadData *data);
+ void ref() {}
+ void deref() {}
+
Q_DECLARE_PUBLIC(QThread)
};
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index afcfb2c949..38fb6ef8dd 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -72,7 +72,7 @@
QT_BEGIN_NAMESPACE
void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread);
-void qt_adopted_thread_watcher_function(void *);
+DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID);
static DWORD qt_current_thread_data_tls_index = TLS_OUT_OF_INDEXES;
void qt_create_tls()
@@ -147,7 +147,7 @@ void QAdoptedThread::init()
static QVector<HANDLE> qt_adopted_thread_handles;
static QVector<QThread *> qt_adopted_qthreads;
static QMutex qt_adopted_thread_watcher_mutex;
-static HANDLE qt_adopted_thread_watcher_handle = 0;
+static DWORD qt_adopted_thread_watcher_id = 0;
static HANDLE qt_adopted_thread_wakeup = 0;
/*! \internal
@@ -158,18 +158,25 @@ static HANDLE qt_adopted_thread_wakeup = 0;
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;
+ }
+
qt_adopted_thread_handles.append(adoptedThreadHandle);
qt_adopted_qthreads.append(qthread);
// Start watcher thread if it is not already running.
- if (qt_adopted_thread_watcher_handle == 0) {
+ if (qt_adopted_thread_watcher_id == 0) {
if (qt_adopted_thread_wakeup == 0) {
qt_adopted_thread_wakeup = CreateEvent(0, false, false, 0);
qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup);
}
- qt_adopted_thread_watcher_handle =
- (HANDLE)_beginthread(qt_adopted_thread_watcher_function, 0, NULL);
+ CreateThread(0, 0, qt_adopted_thread_watcher_function, 0, 0, &qt_adopted_thread_watcher_id);
} else {
SetEvent(qt_adopted_thread_wakeup);
}
@@ -180,13 +187,13 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread)
When this happens it derefs the QThreadData for the adopted thread
to make sure it gets cleaned up properly.
*/
-void qt_adopted_thread_watcher_function(void *)
+DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID)
{
forever {
qt_adopted_thread_watcher_mutex.lock();
if (qt_adopted_thread_handles.count() == 1) {
- qt_adopted_thread_watcher_handle = 0;
+ qt_adopted_thread_watcher_id = 0;
qt_adopted_thread_watcher_mutex.unlock();
break;
}
@@ -244,6 +251,12 @@ void qt_adopted_thread_watcher_function(void *)
qt_adopted_qthreads.remove(qthreadIndex);
}
}
+
+ QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index));
+ if (threadData)
+ threadData->deref();
+
+ return 0;
}
#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 01241dce6b..0261843a3a 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -413,33 +413,16 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn QChar::QChar(char ch)
+
Constructs a QChar corresponding to ASCII/Latin-1 character \a ch.
*/
-QChar::QChar(char ch)
-{
-#ifndef QT_NO_CODEC_FOR_C_STRINGS
- if (QTextCodec::codecForCStrings())
- // #####
- ucs = QTextCodec::codecForCStrings()->toUnicode(&ch, 1).at(0).unicode();
- else
-#endif
- ucs = uchar(ch);
-}
/*!
+ \fn QChar::QChar(uchar ch)
+
Constructs a QChar corresponding to ASCII/Latin-1 character \a ch.
*/
-QChar::QChar(uchar ch)
-{
-#ifndef QT_NO_CODEC_FOR_C_STRINGS
- if (QTextCodec::codecForCStrings()) {
- // #####
- char c = char(ch);
- ucs = QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode();
- } else
-#endif
- ucs = ch;
-}
/*!
\fn QChar::QChar(uchar cell, uchar row)
@@ -1256,49 +1239,35 @@ ushort QChar::toCaseFolded(ushort ucs2)
Returns the Latin-1 character equivalent to the QChar, or 0. This
is mainly useful for non-internationalized software.
- \sa toAscii(), unicode(), QTextCodec::codecForCStrings()
+ \sa toAscii(), unicode()
*/
/*!
- Returns the character value of the QChar obtained using the current
- codec used to read C strings, or 0 if the character is not representable
- using this codec. The default codec handles Latin-1 encoded text,
- but this can be changed to assist developers writing source code using
- other encodings.
+ \fn char QChar::toAscii() const
+
+ Returns the Latin-1 character value of the QChar, or 0 if the character is not
+ representable.
The main purpose of this function is to preserve ASCII characters used
in C strings. This is mainly useful for developers of non-internationalized
software.
- \sa toLatin1(), unicode(), QTextCodec::codecForCStrings()
+ \note It is not possible to distinguish a non-Latin 1 character from an ASCII 0
+ (NUL) character. Prefer to use unicode(), which does not have this ambiguity.
+
+ \sa toLatin1(), unicode()
*/
-char QChar::toAscii() const
-{
-#ifndef QT_NO_CODEC_FOR_C_STRINGS
- if (QTextCodec::codecForCStrings())
- // #####
- return QTextCodec::codecForCStrings()->fromUnicode(QString(*this)).at(0);
-#endif
- return ucs > 0xff ? 0 : char(ucs);
-}
/*!
+ \fn QChar QChar::fromAscii(char)
+
Converts the ASCII character \a c to it's equivalent QChar. This
is mainly useful for non-internationalized software.
An alternative is to use QLatin1Char.
- \sa fromLatin1(), unicode(), QTextCodec::codecForCStrings()
+ \sa fromLatin1(), unicode()
*/
-QChar QChar::fromAscii(char c)
-{
-#ifndef QT_NO_CODEC_FOR_C_STRINGS
- if (QTextCodec::codecForCStrings())
- // #####
- return QTextCodec::codecForCStrings()->toUnicode(&c, 1).at(0).unicode();
-#endif
- return QChar(ushort((uchar)c));
-}
#ifndef QT_NO_DATASTREAM
/*!
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index df3d7eac33..3209ffb0f2 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -86,9 +86,8 @@ public:
Q_DECL_CONSTEXPR QChar(QLatin1Char ch) : ucs(ch.unicode()) {} // implicit
#ifndef QT_NO_CAST_FROM_ASCII
- // these two constructors are NOT inline const_expr!
- QT_ASCII_CAST_WARN_CONSTRUCTOR explicit QChar(char c);
- QT_ASCII_CAST_WARN_CONSTRUCTOR explicit QChar(uchar c);
+ QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(char c) : ucs(uchar(c)) { }
+ QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(uchar c) : ucs(c) { }
#endif
// Unicode information
@@ -222,13 +221,13 @@ public:
UnicodeVersion unicodeVersion() const;
- char toAscii() const;
+ inline char toAscii() const;
inline char toLatin1() const;
inline ushort unicode() const { return ucs; }
inline ushort &unicode() { return ucs; }
- static QChar fromAscii(char c);
- static QChar fromLatin1(char c);
+ static inline QChar fromAscii(char c);
+ static inline QChar fromLatin1(char c);
inline bool isNull() const { return ucs == 0; }
bool isPrint() const;
@@ -344,8 +343,10 @@ private:
Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE);
+inline char QChar::toAscii() const { return ucs > 0xff ? 0 : char(ucs); }
inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); }
+inline QChar QChar::fromAscii(char c) { return QChar(ushort(uchar(c))); }
inline void QChar::setCell(uchar acell)
{ ucs = ushort((ucs & 0xff00) + acell); }
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index 164660f818..31a0fdc5e6 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -46,8 +46,53 @@
#include "../../3rdparty/md4/md4.h"
#include "../../3rdparty/md4/md4.cpp"
#include "../../3rdparty/sha1/sha1.cpp"
+
+/*
+ These typedefs are needed by the RFC6234 code. Normally they would come
+ from from stdint.h, but since this header is not available on all platforms
+ (MSVC 2008, for example), we need to define them ourselves.
+*/
+typedef QT_PREPEND_NAMESPACE(quint64) uint64_t;
+typedef QT_PREPEND_NAMESPACE(quint32) uint32_t;
+typedef QT_PREPEND_NAMESPACE(quint8) uint8_t;
+typedef QT_PREPEND_NAMESPACE(qint16) int_least16_t;
+// Header from rfc6234 with 1 modification:
+// sha1.h - commented out '#include <stdint.h>' on line 74
+#include "../../3rdparty/rfc6234/sha.h"
+
+/*
+ These 2 functions replace macros of the same name in sha224-256.c and
+ sha384-512.c. Originally, these macros relied on a global static 'addTemp'
+ variable. We do not want this for 2 reasons:
+
+ 1. since we are including the sources directly, the declaration of the 2 conflict
+
+ 2. static variables are not thread-safe, we do not want multiple threads
+ computing a hash to corrupt one another
+*/
+static int SHA224_256AddLength(SHA256Context *context, unsigned int length);
+static int SHA384_512AddLength(SHA512Context *context, unsigned int length);
+
+// Sources from rfc6234, with 4 modifications:
+// sha224-256.c - commented out 'static uint32_t addTemp;' on line 68
+// sha224-256.c - appended 'M' to the SHA224_256AddLength macro on line 70
+#include "../../3rdparty/rfc6234/sha224-256.c"
+// sha384-512.c - commented out 'static uint64_t addTemp;' on line 302
+// sha384-512.c - appended 'M' to the SHA224_256AddLength macro on line 304
+#include "../../3rdparty/rfc6234/sha384-512.c"
+
#include <qiodevice.h>
+static inline int SHA224_256AddLength(SHA256Context *context, unsigned int length)
+{
+ uint32_t addTemp;
+ return SHA224_256AddLengthM(context, length);
+}
+static inline int SHA384_512AddLength(SHA512Context *context, unsigned int length)
+{
+ uint64_t addTemp;
+ return SHA384_512AddLengthM(context, length);
+}
QT_BEGIN_NAMESPACE
@@ -59,6 +104,10 @@ public:
MD5Context md5Context;
md4_context md4Context;
Sha1State sha1Context;
+ SHA224Context sha224Context;
+ SHA256Context sha256Context;
+ SHA384Context sha384Context;
+ SHA512Context sha512Context;
};
QByteArray result;
};
@@ -75,7 +124,7 @@ public:
QCryptographicHash can be used to generate cryptographic hashes of binary or text data.
- Currently MD4, MD5, and SHA-1 are supported.
+ Currently MD4, MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 are supported.
*/
/*!
@@ -83,7 +132,11 @@ public:
\value Md4 Generate an MD4 hash sum
\value Md5 Generate an MD5 hash sum
- \value Sha1 Generate an SHA1 hash sum
+ \value Sha1 Generate an SHA-1 hash sum
+ \value Sha224 Generate an SHA-224 hash sum
+ \value Sha256 Generate an SHA-256 hash sum
+ \value Sha384 Generate an SHA-384 hash sum
+ \value Sha512 Generate an SHA-512 hash sum
*/
/*!
@@ -119,6 +172,18 @@ void QCryptographicHash::reset()
case Sha1:
sha1InitState(&d->sha1Context);
break;
+ case Sha224:
+ SHA224Reset(&d->sha224Context);
+ break;
+ case Sha256:
+ SHA256Reset(&d->sha256Context);
+ break;
+ case Sha384:
+ SHA384Reset(&d->sha384Context);
+ break;
+ case Sha512:
+ SHA512Reset(&d->sha512Context);
+ break;
}
d->result.clear();
}
@@ -139,6 +204,18 @@ void QCryptographicHash::addData(const char *data, int length)
case Sha1:
sha1Update(&d->sha1Context, (const unsigned char *)data, length);
break;
+ case Sha224:
+ SHA224Input(&d->sha224Context, reinterpret_cast<const unsigned char *>(data), length);
+ break;
+ case Sha256:
+ SHA256Input(&d->sha256Context, reinterpret_cast<const unsigned char *>(data), length);
+ break;
+ case Sha384:
+ SHA384Input(&d->sha384Context, reinterpret_cast<const unsigned char *>(data), length);
+ break;
+ case Sha512:
+ SHA512Input(&d->sha512Context, reinterpret_cast<const unsigned char *>(data), length);
+ break;
}
d->result.clear();
}
@@ -201,6 +278,31 @@ QByteArray QCryptographicHash::result() const
d->result.resize(20);
sha1FinalizeState(&copy);
sha1ToHash(&copy, (unsigned char *)d->result.data());
+ break;
+ }
+ case Sha224: {
+ SHA224Context copy = d->sha224Context;
+ d->result.resize(SHA224HashSize);
+ SHA224Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));
+ break;
+ }
+ case Sha256:{
+ SHA256Context copy = d->sha256Context;
+ d->result.resize(SHA256HashSize);
+ SHA256Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));
+ break;
+ }
+ case Sha384:{
+ SHA384Context copy = d->sha384Context;
+ d->result.resize(SHA384HashSize);
+ SHA384Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));
+ break;
+ }
+ case Sha512:{
+ SHA512Context copy = d->sha512Context;
+ d->result.resize(SHA512HashSize);
+ SHA512Result(&copy, reinterpret_cast<unsigned char *>(d->result.data()));
+ break;
}
}
return d->result;
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index 59314e1963..2bfc03373a 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -58,7 +58,11 @@ public:
enum Algorithm {
Md4,
Md5,
- Sha1
+ Sha1,
+ Sha224,
+ Sha256,
+ Sha384,
+ Sha512
};
QCryptographicHash(Algorithm method);
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 1ca9a55d72..81778f908f 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1110,6 +1110,7 @@ QEasingCurve::~QEasingCurve()
Swaps curve \a other with this curve. This operation is very
fast and never fails.
+*/
/*!
Compare this easing curve with \a other and returns true if they are
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 8f36e5c2ae..bf6933732c 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -402,7 +402,7 @@ Q_INLINE_TEMPLATE void QList<T>::node_copy(Node *from, Node *to, Node *src)
}
} else {
if (src != from && to - from > 0)
- memcpy(from, src, (to - from) * sizeof(Node *));
+ memcpy(from, src, (to - from) * sizeof(Node));
}
}
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index 2fff58333d..3a386c17d6 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -89,7 +89,7 @@
pair; it does not use the system locale database.
\note For the current keyboard input locale take a look at
- QInputPanel::locale().
+ QInputMethod::locale().
QLocale's data is based on Common Locale Data Repository v1.8.1.
@@ -114,7 +114,7 @@
California, Berkeley and its contributors.
\sa QString::arg(), QString::toInt(), QString::toDouble(),
- QInputPanel::locale()
+ QInputMethod::locale()
*/
/*!
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index cd9fffc7a5..e787f2fa2a 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -525,7 +525,7 @@ QVariant QSystemLocalePrivate::toCurrencyString(const QSystemLocale::CurrencyToS
QVariant QSystemLocalePrivate::uiLanguages()
{
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
- typedef BOOL (*GetUserPreferredUILanguagesFunc) (
+ typedef BOOL (WINAPI *GetUserPreferredUILanguagesFunc) (
DWORD dwFlags,
PULONG pulNumLanguages,
PWSTR pwszLanguagesBuffer,
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index e8c0d4eccc..d7bcd0edbc 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -3934,6 +3934,7 @@ static void invalidateEngine(QRegExpPrivate *priv)
QRegExp::QRegExp()
{
priv = new QRegExpPrivate;
+ prepareEngine(priv);
}
/*!
@@ -3949,6 +3950,7 @@ QRegExp::QRegExp()
QRegExp::QRegExp(const QString &pattern, Qt::CaseSensitivity cs, PatternSyntax syntax)
{
priv = new QRegExpPrivate(QRegExpEngineKey(pattern, syntax, cs));
+ prepareEngine(priv);
}
/*!
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index d0c5506228..e73c52980f 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -96,10 +96,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_TEXTCODEC
-QTextCodec *QString::codecForCStrings;
-#endif
-
#ifdef QT_USE_ICU
// qlocale_icu.cpp
extern bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result);
@@ -471,9 +467,8 @@ const QString::Null QString::null = { };
\snippet doc/src/snippets/qstring/main.cpp 0
QString converts the \c{const char *} data into Unicode using the
- fromAscii() function. By default, fromAscii() treats character
- above 128 as Latin-1 characters, but this can be changed by
- calling QTextCodec::setCodecForCStrings().
+ fromAscii() function. fromAscii() treats ordinals above 128 as Latin-1
+ characters.
In all of the QString functions that take \c{const char *}
parameters, the \c{const char *} is interpreted as a classic
@@ -611,9 +606,7 @@ const QString::Null QString::null = { };
toLatin1(), toUtf8(), and toLocal8Bit().
\list
- \o toAscii() returns an 8-bit string encoded using the codec
- specified by QTextCodec::codecForCStrings (by default, that is
- Latin 1).
+ \o toAscii() returns a Latin-1 (ISO 8859-1) encoded 8-bit string.
\o toLatin1() returns a Latin-1 (ISO 8859-1) encoded 8-bit string.
\o toUtf8() returns a UTF-8 encoded 8-bit string. UTF-8 is a
superset of US-ASCII (ANSI X3.4-1986) that supports the entire
@@ -721,11 +714,11 @@ const QString::Null QString::null = { };
\section1 More Efficient String Construction
Many strings are known at compile time. But the trivial
- constructor QString("Hello"), will convert the string literal
- to a QString using the codecForCStrings(). To avoid this one
- can use the QStringLiteral macro to directly create the required
- data at compile time. Constructing a QString out of the literal
- does then not cause any overhead at runtime.
+ constructor QString("Hello"), will copy the contents of the string,
+ treating the contents as Latin-1. To avoid this one can use the
+ QStringLiteral macro to directly create the required data at compile
+ time. Constructing a QString out of the literal does then not cause
+ any overhead at runtime.
A slightly less efficient way is to use QLatin1String. This class wraps
a C string literal, precalculates it length at compile time and can
@@ -3658,9 +3651,7 @@ QByteArray QString::toLatin1() const
/*!
Returns an 8-bit representation of the string as a QByteArray.
- If a codec has been set using QTextCodec::setCodecForCStrings(),
- it is used to convert Unicode to 8-bit char; otherwise this
- function does the same as toLatin1().
+ This function does the same as toLatin1().
Note that, despite the name, this function does not necessarily return an US-ASCII
(ANSI X3.4-1986) string and its result may not be US-ASCII compatible.
@@ -3669,10 +3660,6 @@ QByteArray QString::toLatin1() const
*/
QByteArray QString::toAscii() const
{
-#ifndef QT_NO_TEXTCODEC
- if (codecForCStrings)
- return codecForCStrings->fromUnicode(*this);
-#endif // QT_NO_TEXTCODEC
return toLatin1();
}
@@ -3806,23 +3793,6 @@ QString::Data *QString::fromLatin1_helper(const char *str, int size)
QString::Data *QString::fromAscii_helper(const char *str, int size)
{
-#ifndef QT_NO_TEXTCODEC
- if (codecForCStrings) {
- Data *d;
- if (!str) {
- d = const_cast<Data *>(&shared_null.str);
- } else if (size == 0 || (!*str && size < 0)) {
- d = const_cast<Data *>(&shared_empty.str);
- } else {
- if (size < 0)
- size = qstrlen(str);
- QString s = codecForCStrings->toUnicode(str, size);
- d = s.d;
- d->ref.ref();
- }
- return d;
- }
-#endif
return fromLatin1_helper(str, size);
}
@@ -3871,11 +3841,7 @@ QString QString::fromLocal8Bit_helper(const char *str, int size)
If \a size is -1 (default), it is taken to be strlen(\a
str).
- Note that, despite the name, this function actually uses the codec
- defined by QTextCodec::setCodecForCStrings() to convert \a str to
- Unicode. Depending on the codec, it may not accept valid US-ASCII (ANSI
- X3.4-1986) input. If no codec has been set, this function does the same
- as fromLatin1().
+ This function does the same as fromLatin1().
\sa toAscii(), fromLatin1(), fromUtf8(), fromLocal8Bit()
*/
@@ -5144,19 +5110,8 @@ QString &QString::vsprintf(const char* cformat, va_list ap)
const char *c = cformat;
for (;;) {
// Copy non-escape chars to result
-#ifndef QT_NO_TEXTCODEC
- int i = 0;
- while (*(c + i) != '\0' && *(c + i) != '%')
- ++i;
- if (codecForCStrings)
- result.append(codecForCStrings->toUnicode(c, i));
- else
- result.append(fromLatin1(c, i));
- c += i;
-#else
while (*c != '\0' && *c != '%')
result.append(QLatin1Char(*c++));
-#endif
if (*c == '\0')
break;
@@ -7068,8 +7023,7 @@ bool QString::isRightToLeft() const
This operator is mostly useful to pass a QString to a function
that accepts a std::string object.
- If the QString contains Unicode characters that the
- QTextCodec::codecForCStrings() codec cannot handle, using this operator
+ If the QString contains non-Latin1 Unicode characters, using this
can lead to loss of information.
This operator is only available if Qt is configured with STL
@@ -8742,9 +8696,7 @@ QByteArray QStringRef::toLatin1() const
Returns an 8-bit representation of the string as a QByteArray.
- If a codec has been set using QTextCodec::setCodecForCStrings(),
- it is used to convert Unicode to 8-bit char; otherwise this
- function does the same as toLatin1().
+ This function does the same as toLatin1().
Note that, despite the name, this function does not necessarily return an US-ASCII
(ANSI X3.4-1986) string and its result may not be US-ASCII compatible.
@@ -8753,10 +8705,6 @@ QByteArray QStringRef::toLatin1() const
*/
QByteArray QStringRef::toAscii() const
{
-#ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings)
- return QString::codecForCStrings->fromUnicode(unicode(), length());
-#endif // QT_NO_TEXTCODEC
return toLatin1();
}
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index bdadba8bd4..6fc86fc04b 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -502,10 +502,10 @@ public:
// ASCII compatibility
#ifndef QT_NO_CAST_FROM_ASCII
- inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch)
+ inline QT_ASCII_CAST_WARN QString(const char *ch)
: d(fromAscii_helper(ch, ch ? int(strlen(ch)) : -1))
{}
- inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const QByteArray &a)
+ inline QT_ASCII_CAST_WARN QString(const QByteArray &a)
: d(fromAscii_helper(a.constData(), qstrnlen(a.constData(), a.size())))
{}
inline QT_ASCII_CAST_WARN QString &operator=(const char *ch)
@@ -609,9 +609,6 @@ private:
Data *d;
inline QString(Data *dd, int /*dummy*/) : d(dd) {}
-#ifndef QT_NO_TEXTCODEC
- static QTextCodec *codecForCStrings;
-#endif
static int grow(int);
static void free(Data *);
void realloc();
@@ -931,9 +928,6 @@ inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
#ifndef QT_NO_CAST_FROM_ASCII
inline bool qStringComparisonHelper(const QString &s1, const char *s2)
{
-# ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2, s2 ? int(strlen(s2)) : -1));
-# endif
return (s1 == QLatin1String(s2));
}
inline bool QString::operator==(const char *s) const
@@ -1220,9 +1214,6 @@ inline bool operator>=(const QStringRef &s1, const QStringRef &s2)
inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2)
{
-# ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2, s2 ? int(strlen(s2)) : -1));
-# endif
return (s1 == QLatin1String(s2));
}
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 3d6b0eb709..6999972172 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -105,14 +105,6 @@ QT_BEGIN_NAMESPACE
*/
void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out)
{
-#ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings && len) {
- QString tmp = QString::fromAscii(a, len > 0 ? len : -1);
- memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size());
- out += tmp.length();
- return;
- }
-#endif
if (len == -1) {
if (!a)
return;
@@ -124,25 +116,4 @@ void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out
}
}
-/*! \internal */
-void QAbstractConcatenable::convertToAscii(const QChar* a, int len, char*& out)
-{
-#ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings) {
- QByteArray tmp = QString::codecForCStrings->fromUnicode(a, len);
- memcpy(out, tmp.constData(), tmp.size());
- out += tmp.length();
- return;
- }
-#endif
- if (len == -1) {
- while (a->unicode())
- convertToLatin1(*a++, out);
- } else {
- for (int i = 0; i < len; ++i)
- convertToLatin1(a[i], out);
- }
-}
-
-
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 5a4c27d22a..4c963185ad 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -62,30 +62,9 @@ struct Q_CORE_EXPORT QAbstractConcatenable
{
protected:
static void convertFromAscii(const char *a, int len, QChar *&out);
- static void convertToAscii(const QChar *a, int len, char *&out);
static inline void convertFromAscii(char a, QChar *&out)
{
-#ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings)
- *out++ = QChar::fromAscii(a);
- else
-#endif
- *out++ = QLatin1Char(a);
- }
-
- static inline void convertToAscii(QChar a, char *&out)
- {
-#ifndef QT_NO_TEXTCODEC
- if (QString::codecForCStrings)
- *out++ = a.toAscii(); //###
- else
-#endif
- convertToLatin1(a, out);
- }
-
- static inline void convertToLatin1(QChar a, char *&out)
- {
- *out++ = a.unicode() > 0xff ? '?' : char(a.unicode());
+ *out++ = QLatin1Char(a);
}
};
@@ -192,10 +171,6 @@ template <> struct QConcatenable<QChar> : private QAbstractConcatenable
static int size(const QChar) { return 1; }
static inline void appendTo(const QChar c, QChar *&out)
{ *out++ = c; }
-#ifndef QT_NO_CAST_TO_ASCII
- static inline QT_ASCII_CAST_WARN void appendTo(const QChar c, char *&out)
- { convertToAscii(c, out); }
-#endif
};
template <> struct QConcatenable<QCharRef> : private QAbstractConcatenable
@@ -206,10 +181,6 @@ template <> struct QConcatenable<QCharRef> : private QAbstractConcatenable
static int size(const QCharRef &) { return 1; }
static inline void appendTo(const QCharRef &c, QChar *&out)
{ *out++ = QChar(c); }
-#ifndef QT_NO_CAST_TO_ASCII
- static inline QT_ASCII_CAST_WARN void appendTo(const QCharRef &c, char *&out)
- { convertToAscii(c, out); }
-#endif
};
template <> struct QConcatenable<QLatin1String>
@@ -242,10 +213,6 @@ template <> struct QConcatenable<QString> : private QAbstractConcatenable
memcpy(out, reinterpret_cast<const char*>(a.constData()), sizeof(QChar) * n);
out += n;
}
-#ifndef QT_NO_CAST_TO_ASCII
- static inline QT_ASCII_CAST_WARN void appendTo(const QString &a, char *&out)
- { convertToAscii(a.constData(), a.length(), out); }
-#endif
};
template <int N> struct QConcatenable<QConstStringDataPtr<N> > : private QAbstractConcatenable
@@ -259,10 +226,6 @@ template <int N> struct QConcatenable<QConstStringDataPtr<N> > : private QAbstra
memcpy(out, reinterpret_cast<const char*>(a.ptr->data), sizeof(QChar) * N);
out += N;
}
-#ifndef QT_NO_CAST_TO_ASCII
- static inline QT_ASCII_CAST_WARN void appendTo(const type &a, char *&out)
- { convertToAscii(a.ptr->data, N, out); }
-#endif
};
template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
@@ -277,11 +240,6 @@ template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
memcpy(out, reinterpret_cast<const char*>(a.constData()), sizeof(QChar) * n);
out += n;
}
-#ifndef QT_NO_CAST_TO_ASCII
- static inline QT_ASCII_CAST_WARN void appendTo(const QStringRef &a, char *&out)
- { convertToAscii(a.constData(), a.length(), out); }
-#endif
-
};
template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp
index 1c2cb6f0f0..6e6e676dae 100644
--- a/src/dbus/qdbusargument.cpp
+++ b/src/dbus/qdbusargument.cpp
@@ -89,7 +89,7 @@ QByteArray QDBusArgumentPrivate::createSignature(int id)
if (signature.isEmpty() || !ok || !QDBusUtil::isValidSingleSignature(QString::fromLatin1(signature))) {
qWarning("QDBusMarshaller: type `%s' produces invalid D-BUS signature `%s' "
"(Did you forget to call beginStructure() ?)",
- QVariant::typeToName( QVariant::Type(id) ),
+ QMetaType::typeName(id),
signature.isEmpty() ? "<empty>" : signature.constData());
return "";
} else if ((signature.at(0) != DBUS_TYPE_ARRAY && signature.at(0) != DBUS_STRUCT_BEGIN_CHAR) ||
@@ -97,9 +97,9 @@ QByteArray QDBusArgumentPrivate::createSignature(int id)
signature.at(1) == DBUS_TYPE_STRING))) {
qWarning("QDBusMarshaller: type `%s' attempts to redefine basic D-BUS type '%s' (%s) "
"(Did you forget to call beginStructure() ?)",
- QVariant::typeToName( QVariant::Type(id) ),
+ QMetaType::typeName(id),
signature.constData(),
- QVariant::typeToName( QVariant::Type(QDBusMetaType::signatureToType(signature))) );
+ QMetaType::typeName(QDBusMetaType::signatureToType(signature)));
return "";
}
return signature;
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 0d00df2a17..37e7a1dbb4 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
\class QAccessible
\brief The QAccessible class provides enums and static functions
related to accessibility.
+ \internal
\ingroup accessibility
\inmodule QtWidgets
@@ -364,6 +365,8 @@ QT_BEGIN_NAMESPACE
\value Labelled The first object is labelled by the second object.
\value Controller The first object controls the second object.
\value Controlled The first object is controlled by the second object.
+ \value AllRelations Used as a mask to specify that we are interesting in information
+ about all relations
Implementations of relations() return a combination of these flags.
Some values are mutually exclusive.
@@ -690,6 +693,7 @@ void QAccessible::updateAccessibility(const QAccessibleEvent &event)
\class QAccessibleEvent
\brief The QAccessibleEvent is use to notify about changes that are
relevant for accessibility in the application.
+ \internal
\ingroup accessibility
\inmodule QtGui
@@ -725,6 +729,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
\class QAccessibleInterface
\brief The QAccessibleInterface class defines an interface that exposes information
about accessible objects.
+ \internal
\ingroup accessibility
\inmodule QtGui
@@ -1170,6 +1175,7 @@ const char *qAccessibleEventString(QAccessible::Event event)
return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
}
+/*! \internal */
bool operator==(const QAccessible::State &first, const QAccessible::State &second)
{
return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index e57033d9bf..a72b91a90f 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -306,10 +306,10 @@ public:
};
enum RelationFlag {
- Label = 0x00020000,
- Labelled = 0x00040000,
- Controller = 0x00080000,
- Controlled = 0x00100000,
+ Label = 0x00000001,
+ Labelled = 0x00000002,
+ Controller = 0x00000004,
+ Controlled = 0x00000008,
AllRelations = 0xffffffff
};
Q_DECLARE_FLAGS(Relation, RelationFlag)
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index 0f854c6158..db3028b371 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
/*!
\namespace QAccessible2
\ingroup accessibility
+ \internal
\brief The QAccessible2 namespace defines constants relating to
IAccessible2-based interfaces
@@ -60,6 +61,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleTextInterface
+ \internal
\ingroup accessibility
@@ -180,6 +182,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleEditableTextInterface
\ingroup accessibility
+ \internal
\brief The QAccessibleEditableTextInterface class implements support for objects with editable text.
@@ -247,6 +250,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleSimpleEditableTextInterface
\ingroup accessibility
+ \internal
\brief The QAccessibleSimpleEditableTextInterface class is a convenience class for
text-based widgets. It can be inherited instead of \l QAccessibleEditableTextInterface.
@@ -259,6 +263,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleValueInterface
\ingroup accessibility
+ \internal
\brief The QAccessibleValueInterface class implements support for objects that manipulate a value.
@@ -323,6 +328,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleTableCellInterface
\ingroup accessibility
+ \internal
\brief The QAccessibleTableCellInterface class implements support for
the IAccessibleTable2 Cell interface.
@@ -333,6 +339,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleTableInterface
\ingroup accessibility
+ \internal
\brief The QAccessibleTableInterface class implements support for
the IAccessibleTable2 interface.
@@ -344,6 +351,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleActionInterface
\ingroup accessibility
+ \internal
\brief The QAccessibleActionInterface class implements support for
invocable actions in the interface.
diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp
index 8fcf0474a1..d6d0796701 100644
--- a/src/gui/accessible/qaccessiblebridge.cpp
+++ b/src/gui/accessible/qaccessiblebridge.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
\class QAccessibleBridge
\brief The QAccessibleBridge class is the base class for
accessibility back-ends.
+ \internal
\ingroup accessibility
\inmodule QtWidgets
@@ -100,6 +101,7 @@ QT_BEGIN_NAMESPACE
\class QAccessibleBridgePlugin
\brief The QAccessibleBridgePlugin class provides an abstract
base for accessibility bridge plugins.
+ \internal
\ingroup plugins
\ingroup accessibility
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index d277f39c43..e587ad077c 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -92,6 +92,7 @@ QList<QByteArray> QAccessibleObjectPrivate::actionList() const
\class QAccessibleObject
\brief The QAccessibleObject class implements parts of the
QAccessibleInterface for QObjects.
+ \internal
\ingroup accessibility
\inmodule QtWidgets
diff --git a/src/gui/accessible/qaccessibleplugin.cpp b/src/gui/accessible/qaccessibleplugin.cpp
index 8823d63b79..c2fe9c7a7a 100644
--- a/src/gui/accessible/qaccessibleplugin.cpp
+++ b/src/gui/accessible/qaccessibleplugin.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
\class QAccessiblePlugin
\brief The QAccessiblePlugin class provides an abstract base for
accessibility plugins.
+ \internal
\ingroup plugins
\ingroup accessibility
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index b33ccd42a2..0d97fdd0be 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -76,8 +76,6 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode)
if (!clipboard->supportsMode(mode)) return;
clipboard->setMimeData(src,mode);
-
- emitChanged(mode);
}
bool QClipboard::supportsMode(Mode mode) const
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index c3a6be692b..281d4f61bc 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -453,7 +453,13 @@ QHoverEvent::~QHoverEvent()
Wheel events are sent to the widget under the mouse cursor, but
if that widget does not handle the event they are sent to the
- focus widget. The rotation distance is provided by delta().
+ focus widget. Wheel events are generated for both mouse wheels
+ and trackpad scroll gestures. There are two ways to read the
+ wheel event delta: angleDelta() returns the delta in wheel
+ degrees. This value is always provided. pixelDelta() returns
+ the delta in screen pixels and is available on platforms that
+ have high-resolution trackpads, such as Mac OS X.
+
The functions pos() and globalPos() return the mouse cursor's
location at the time of the event.
@@ -483,8 +489,11 @@ QHoverEvent::~QHoverEvent()
*/
/*!
+ \obsolete
Constructs a wheel event object.
+ Use the QPoint-based constructor instead.
+
The position, \a pos, is the location of the mouse cursor within
the widget. The globalPos() is initialized to QCursor::pos()
which is usually, but not always, correct.
@@ -496,13 +505,13 @@ QHoverEvent::~QHoverEvent()
\a modifiers holds the keyboard modifier flags at the time of the
event, and \a orient holds the wheel's orientation.
- \sa pos() delta() state()
+ \sa pos() pixelDelta() angleDelta() state()
*/
#ifndef QT_NO_WHEELEVENT
QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient)
- : QInputEvent(Wheel, modifiers), p(pos), d(delta), mouseState(buttons), o(orient)
+ : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons)
{
g = QCursor::pos();
}
@@ -515,26 +524,69 @@ QWheelEvent::~QWheelEvent()
}
/*!
+ \obsolete
Constructs a wheel event object.
+ Use the QPoint-based constructor instead.
+
The \a pos provides the location of the mouse cursor
within the widget. The position in global coordinates is specified
by \a globalPos. \a delta contains the rotation distance, \a modifiers
holds the keyboard modifier flags at the time of the event, and
\a orient holds the wheel's orientation.
- \sa pos() globalPos() delta() state()
+
+ \sa pos() pixelDelta() angleDelta() state()
*/
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), d(delta), mouseState(buttons), o(orient)
+ : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons)
+{}
+
+/*!
+ Constructs a wheel event object.
+
+ The \a pos provides the location of the mouse cursor
+ within the window. The position in global coordinates is specified
+ by \a globalPos. \pixelDelta contains the scrolling distance
+ in pixels on screen, \a angleDelta contains the wheel rotation distance.
+ \pixelDelta is optional and can be null.
+
+ \a modifiers holds the keyboard modifier flags at the time of the event.
+
+ \a pixelDelta contains the scrolling delta in pixels,
+ \a angleDelta contains the rotation distance, and
+ \a orient holds the wheel's orientation.
+
+ \sa pos() globalPos() delta() state()
+*/
+
+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)
{}
+
#endif // QT_NO_WHEELEVENT
/*!
- \fn int QWheelEvent::delta() const
+ \fn QPoint QWheelEvent::pixelDelta() const
+
+ Returns the scrolling distance in pixels on screen. This value is
+ provided on platforms that support high-resolution pixel-based
+ delta values, such as Mac OS X. The value should be used directly
+ to scroll content on screen.
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_gui_kernel_qevent.cpp 0
+*/
+
+/*!
+ \fn QPoint QWheelEvent::angleDelta() const
Returns the distance that the wheel is rotated, in eighths of a
degree. A positive value indicates that the wheel was rotated
@@ -556,6 +608,12 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
*/
/*!
+ \fn int QWheelEvent::delta() const
+
+ This function has been deprecated, use pixelDelta() or angleDelta() instead.
+*/
+
+/*!
\fn const QPoint &QWheelEvent::pos() const
Returns the position of the mouse cursor relative to the widget
@@ -833,7 +891,7 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
{
uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
- uint platform = QGuiApplicationPrivate::currentKeyPlatform();
+ const uint platform = QKeySequencePrivate::currentKeyPlatforms();
uint N = QKeySequencePrivate::numberOfKeyBindings;
@@ -2887,7 +2945,6 @@ QShortcutEvent::~QShortcutEvent()
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QEvent *e) {
-#ifndef Q_BROKEN_DEBUG_STREAM
// More useful event output could be added here
if (!e)
return dbg << "QEvent(this = 0x0)";
@@ -3168,11 +3225,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
dbg.nospace() << 'Q' << n << "Event(" << (const void *)e << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QEvent to QDebug");
- return dbg;
- Q_UNUSED(e);
-#endif
}
#endif
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 93dea41de9..ca93095a94 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -148,9 +148,21 @@ public:
QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient = Qt::Vertical);
+ QWheelEvent(const QPointF &pos, const QPointF& globalPos,
+ QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
+
~QWheelEvent();
- inline int delta() const { return d; }
+
+ inline QPoint pixelDelta() const { return pixelD; }
+ inline QPoint angleDelta() const { return angleD; }
+
+#if QT_DEPRECATED_SINCE(5, 0)
+ inline QT_DEPRECATED int delta() const { return qt4D; }
+ inline QT_DEPRECATED Qt::Orientation orientation() const { return qt4O; }
+#endif
+
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
inline QPoint pos() const { return p.toPoint(); }
inline QPoint globalPos() const { return g.toPoint(); }
@@ -163,15 +175,15 @@ public:
inline const QPointF &globalPosF() const { return g; }
inline Qt::MouseButtons buttons() const { return mouseState; }
- Qt::Orientation orientation() const { return o; }
-
-
protected:
QPointF p;
QPointF g;
- int d;
+ QPoint pixelD;
+ QPoint angleD;
+ int qt4D;
+ Qt::Orientation qt4O;
Qt::MouseButtons mouseState;
- Qt::Orientation o;
+ int reserved;
};
#endif
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 7cb3d4b488..1cd448a6bb 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -99,6 +99,14 @@ QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0;
QList<QObject *> QGuiApplicationPrivate::generic_plugin_list;
+enum ApplicationResourceFlags
+{
+ ApplicationPaletteExplicitlySet = 0x1,
+ ApplicationFontExplicitlySet = 0x2
+};
+
+static unsigned applicationResourceFlags = 0;
+
bool QGuiApplicationPrivate::app_do_modal = false;
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
@@ -144,7 +152,169 @@ static bool qt_detectRTLLanguage()
" and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
}
+static void initPalette()
+{
+ if (!QGuiApplicationPrivate::app_pal)
+ if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette())
+ QGuiApplicationPrivate::app_pal = new QPalette(*themePalette);
+ if (!QGuiApplicationPrivate::app_pal)
+ QGuiApplicationPrivate::app_pal = new QPalette(Qt::black);
+}
+
+static inline void clearPalette()
+{
+ delete QGuiApplicationPrivate::app_pal;
+ QGuiApplicationPrivate::app_pal = 0;
+}
+
+static void initFontUnlocked()
+{
+ if (!QGuiApplicationPrivate::app_font)
+ QGuiApplicationPrivate::app_font =
+ new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont());
+}
+
+static inline void clearFontUnlocked()
+{
+ delete QGuiApplicationPrivate::app_font;
+ QGuiApplicationPrivate::app_font = 0;
+}
+
+/*!
+ \class QGuiApplication
+ \brief The QGuiApplication class manages the GUI application's control
+ flow and main settings.
+
+ \inmodule QtGui
+
+ QGuiApplication contains the main event loop, where all events from the window
+ system and other sources are processed and dispatched. It also handles the
+ application's initialization and finalization. In addition, QGuiApplication handles
+ most of the system-wide and application-wide settings.
+
+ For any GUI application using Qt, there is precisely \bold one QGuiApplication
+ object no matter whether the application has 0, 1, 2 or more windows at
+ any given time. For non-GUI Qt applications, use QCoreApplication instead,
+ as it does not depend on the \l QtGui library.
+
+ The QGuiApplication object is accessible through the instance() function, which
+ returns a pointer equivalent to the global \l qApp pointer.
+
+ QGuiApplication's main areas of responsibility are:
+ \list
+ \o It initializes the application with the user's desktop settings,
+ such as palette(), font() and styleHints(). It keeps
+ track of these properties in case the user changes the desktop
+ globally, for example, through some kind of control panel.
+
+ \o It performs event handling, meaning that it receives events
+ from the underlying window system and dispatches them to the
+ relevant widgets. You can send your own events to windows by
+ using sendEvent() and postEvent().
+
+ \o It parses common command line arguments and sets its internal
+ state accordingly. See the \l{QGuiApplication::QGuiApplication()}
+ {constructor documentation} below for more details.
+
+ \o It provides localization of strings that are visible to the
+ user via translate().
+
+ \o It provides some magical objects like the clipboard().
+
+ \o It knows about the application's windows. You can ask which
+ window is at a certain position using topLevelAt(), get a list of
+ topLevelWindows(), etc.
+
+ \o It manages the application's mouse cursor handling, see
+ setOverrideCursor()
+ \endlist
+
+ Since the QGuiApplication object does so much initialization, it \e{must} be
+ created before any other objects related to the user interface are created.
+ QGuiApplication also deals with common command line arguments. Hence, it is
+ usually a good idea to create it \e before any interpretation or
+ modification of \c argv is done in the application itself.
+
+ \table
+ \header
+ \o{2,1} Groups of functions
+
+ \row
+ \o System settings
+ \o desktopSettingsAware(),
+ setDesktopSettingsAware(),
+ styleHints(),
+ palette(),
+ setPalette(),
+ font(),
+ setFont().
+
+ \row
+ \o Event handling
+ \o exec(),
+ processEvents(),
+ exit(),
+ quit().
+ sendEvent(),
+ postEvent(),
+ sendPostedEvents(),
+ removePostedEvents(),
+ hasPendingEvents(),
+ notify().
+
+ \row
+ \o Windows
+ \o allWindows(),
+ topLevelWindows(),
+ focusWindow(),
+ clipboard(),
+ topLevelAt().
+
+ \row
+ \o Advanced cursor handling
+ \o overrideCursor(),
+ setOverrideCursor(),
+ restoreOverrideCursor().
+
+ \row
+ \o Miscellaneous
+ \o startingUp(),
+ closingDown(),
+ type().
+ \endtable
+
+ \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop
+*/
+
+/*!
+ Initializes the window system and constructs an application object with
+ \a argc command line arguments in \a argv.
+
+ \warning The data referred to by \a argc and \a argv must stay valid for
+ the entire lifetime of the QGuiApplication object. In addition, \a argc must
+ be greater than zero and \a argv must contain at least one valid character
+ string.
+
+ The global \c qApp pointer refers to this application object. Only one
+ application object should be created.
+
+ This application object must be constructed before any \l{QPaintDevice}
+ {paint devices} (including pixmaps, bitmaps etc.).
+
+ \note \a argc and \a argv might be changed as Qt removes command line
+ arguments that it recognizes.
+ All Qt programs automatically support the following command line options:
+ \list
+ \o -reverse, sets the application's layout direction to
+ Qt::RightToLeft
+ \o -qmljsdebugger=, activates the QML/JS debugger with a specified port.
+ The value must be of format port:1234[,block], where block is optional
+ and will make the application wait until a debugger connects to it.
+ \endlist
+
+ \sa arguments()
+*/
QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
: QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags))
{
@@ -159,6 +329,9 @@ QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
d_func()->init();
}
+/*!
+ Destructs the application.
+*/
QGuiApplication::~QGuiApplication()
{
Q_D(QGuiApplication);
@@ -174,8 +347,7 @@ QGuiApplication::~QGuiApplication()
delete QGuiApplicationPrivate::qt_clipboard;
QGuiApplicationPrivate::qt_clipboard = 0;
- delete QGuiApplicationPrivate::app_pal;
- QGuiApplicationPrivate::app_pal = 0;
+ clearPalette();
qUnregisterGuiVariant();
@@ -194,6 +366,10 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags
application_type = QCoreApplication::GuiClient;
}
+/*!
+ Returns the QWindow that receives events tied to focus,
+ such as key events.
+*/
QWindow *QGuiApplication::focusWindow()
{
return QGuiApplicationPrivate::focus_window;
@@ -208,7 +384,7 @@ QWindow *QGuiApplication::focusWindow()
/*!
Returns the QObject in currently active window that will be final receiver of events
- tied focus, such as key events.
+ tied to focus, such as key events.
*/
QObject *QGuiApplication::focusObject()
{
@@ -249,6 +425,11 @@ QWindowList QGuiApplication::topLevelWindows()
return topLevelWindows;
}
+/*!
+ Returns the primary (or default) screen of the application.
+
+ This will be the screen where QWindows are shown, unless otherwise specified.
+*/
QScreen *QGuiApplication::primaryScreen()
{
if (QGuiApplicationPrivate::screen_list.isEmpty())
@@ -256,11 +437,18 @@ QScreen *QGuiApplication::primaryScreen()
return QGuiApplicationPrivate::screen_list.at(0);
}
+/*!
+ Returns a list of all the screens associated with the
+ windowing system the application is connected to.
+*/
QList<QScreen *> QGuiApplication::screens()
{
return QGuiApplicationPrivate::screen_list;
}
+/*!
+ Returns the top level window at the given position, if any.
+*/
QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
{
QList<QScreen *> screens = QGuiApplication::screens();
@@ -517,8 +705,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
delete generic_plugin_list.at(i);
generic_plugin_list.clear();
- delete app_font;
- app_font = 0;
+ clearFontUnlocked();
+
QFont::cleanup();
#ifndef QT_NO_CURSOR
@@ -557,27 +745,62 @@ static QClipboard *clipboard();
#endif
#endif
+/*!
+ Returns the currently held keyboard modifiers.
+*/
Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
{
return QGuiApplicationPrivate::modifier_buttons;
}
+/*!
+ Returns the currently held mouse buttons.
+*/
Qt::MouseButtons QGuiApplication::mouseButtons()
{
return QGuiApplicationPrivate::mouse_buttons;
}
+/*!
+ Returns the platform's native interface, for platform specific
+ functionality.
+*/
QPlatformNativeInterface *QGuiApplication::platformNativeInterface()
{
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return pi->nativeInterface();
}
+/*!
+ Enters the main event loop and waits until exit() is called, and then
+ returns the value that was set to exit() (which is 0 if exit() is called
+ via quit()).
+
+ It is necessary to call this function to start event handling. The main
+ event loop receives events from the window system and dispatches these to
+ the application widgets.
+
+ Generally, no user interaction can take place before calling exec().
+
+ To make your application perform idle processing, e.g., executing a special
+ function whenever there are no pending events, use a QTimer with 0 timeout.
+ More advanced idle processing schemes can be achieved using processEvents().
+
+ We recommend that you connect clean-up code to the
+ \l{QCoreApplication::}{aboutToQuit()} signal, instead of putting it in your
+ application's \c{main()} function. This is because, on some platforms, the
+ QApplication::exec() call may not return.
+
+ \sa quitOnLastWindowClosed, quit(), exit(), processEvents(),
+ QCoreApplication::exec()
+*/
int QGuiApplication::exec()
{
return QCoreApplication::exec();
}
+/*! \reimp
+*/
bool QGuiApplication::notify(QObject *object, QEvent *event)
{
#ifndef QT_NO_SHORTCUT
@@ -595,6 +818,8 @@ bool QGuiApplication::notify(QObject *object, QEvent *event)
return QCoreApplication::notify(object, event);
}
+/*! \reimp
+*/
bool QGuiApplication::event(QEvent *e)
{
if(e->type() == QEvent::LanguageChange) {
@@ -603,6 +828,9 @@ bool QGuiApplication::event(QEvent *e)
return QCoreApplication::event(e);
}
+/*!
+ \internal
+*/
bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
{
return QCoreApplication::compressEvent(event, receiver, postedEvents);
@@ -804,8 +1032,7 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
QWindow *window = e->window.data();
if (window) {
- QWheelEvent ev(e->localPos, e->globalPos, e->delta, buttons, e->modifiers,
- e->orient);
+ QWheelEvent ev(e->localPos, e->globalPos, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, buttons, e->modifiers);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev);
return;
@@ -896,6 +1123,8 @@ void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfa
void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce)
{
+ if (self)
+ self->notifyThemeChanged();
if (QWindow *window = tce->window.data()) {
QEvent e(QEvent::ThemeChange);
QGuiApplication::sendSpontaneousEvent(window, &e);
@@ -1364,6 +1593,9 @@ Qt::DropAction QGuiApplicationPrivate::processDrop(QWindow *w, QMimeData *dropDa
}
#ifndef QT_NO_CLIPBOARD
+/*!
+ Returns the object for interacting with the clipboard.
+*/
QClipboard * QGuiApplication::clipboard()
{
if (QGuiApplicationPrivate::qt_clipboard == 0) {
@@ -1378,20 +1610,22 @@ QClipboard * QGuiApplication::clipboard()
#endif
/*!
- Returns the application palette.
+ Returns the default application palette.
- \sa setPalette(), QWidget::palette()
+ \sa setPalette()
*/
+
QPalette QGuiApplication::palette()
{
- if (!QGuiApplicationPrivate::app_pal)
- if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette())
- QGuiApplicationPrivate::app_pal = new QPalette(*themePalette);
- if (!QGuiApplicationPrivate::app_pal)
- QGuiApplicationPrivate::app_pal = new QPalette(Qt::black);
+ initPalette();
return *QGuiApplicationPrivate::app_pal;
}
+/*!
+ Changes the default application palette to \a palette.
+
+ \sa palette()
+*/
void QGuiApplication::setPalette(const QPalette &pal)
{
if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal))
@@ -1400,17 +1634,26 @@ void QGuiApplication::setPalette(const QPalette &pal)
QGuiApplicationPrivate::app_pal = new QPalette(pal);
else
*QGuiApplicationPrivate::app_pal = pal;
+ applicationResourceFlags |= ApplicationPaletteExplicitlySet;
}
+/*!
+ Returns the default application font.
+
+ \sa setFont()
+*/
QFont QGuiApplication::font()
{
QMutexLocker locker(&applicationFontMutex);
- if (!QGuiApplicationPrivate::app_font)
- QGuiApplicationPrivate::app_font =
- new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont());
+ initFontUnlocked();
return *QGuiApplicationPrivate::app_font;
}
+/*!
+ Changes the default application font to \a font.
+
+ \sa font()
+*/
void QGuiApplication::setFont(const QFont &font)
{
QMutexLocker locker(&applicationFontMutex);
@@ -1418,6 +1661,7 @@ void QGuiApplication::setFont(const QFont &font)
QGuiApplicationPrivate::app_font = new QFont(font);
else
*QGuiApplicationPrivate::app_font = font;
+ applicationResourceFlags |= ApplicationFontExplicitlySet;
}
/*!
@@ -1631,7 +1875,7 @@ void QGuiApplication::restoreOverrideCursor()
/*!
\since 5.0
- returns the style hints.
+ Returns the application's style hints.
The style hints encapsulate a set of platform dependent properties
such as double click intervals, full width selection and others.
@@ -1675,6 +1919,14 @@ bool QGuiApplication::desktopSettingsAware()
return QGuiApplicationPrivate::obey_desktop_settings;
}
+QInputMethod *QGuiApplication::inputMethod() const
+{
+ Q_D(const QGuiApplication);
+ if (!d->inputMethod)
+ const_cast<QGuiApplicationPrivate *>(d)->inputMethod = new QInputMethod();
+ return d->inputMethod;
+}
+
/*!
\since 5.0
@@ -1686,40 +1938,11 @@ bool QGuiApplication::desktopSettingsAware()
\sa QInputPanel
*/
-QInputMethod *QGuiApplication::inputMethod() const
-{
- Q_D(const QGuiApplication);
- if (!d->inputMethod)
- const_cast<QGuiApplicationPrivate *>(d)->inputMethod = new QInputMethod();
- return d->inputMethod;
-}
-
QInputPanel *QGuiApplication::inputPanel() const
{
return inputMethod();
}
-
-// Returns the current platform used by keyBindings
-uint QGuiApplicationPrivate::currentKeyPlatform()
-{
- uint platform = KB_Win;
-#ifdef Q_OS_MAC
- platform = KB_Mac;
-#elif defined Q_WS_X11 // ## TODO: detect these
- platform = KB_X11;
-#if 0
- if (X11->desktopEnvironment == DE_KDE)
- platform |= KB_KDE;
- if (X11->desktopEnvironment == DE_GNOME)
- platform |= KB_Gnome;
- if (X11->desktopEnvironment == DE_CDE)
- platform |= KB_CDE;
-#endif
-#endif
- return platform;
-}
-
/*!
\since 4.5
\fn void QGuiApplication::fontDatabaseChanged()
@@ -1843,4 +2066,17 @@ QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape)
return QPixmap();
}
+void QGuiApplicationPrivate::notifyThemeChanged()
+{
+ if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet)) {
+ clearPalette();
+ initPalette();
+ }
+ if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
+ QMutexLocker locker(&applicationFontMutex);
+ clearFontUnlocked();
+ initFontUnlocked();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 7e6e0aa8c7..68546ce0cf 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -89,19 +89,6 @@ public:
static QPlatformTheme *platformTheme()
{ return platform_theme; }
-
- enum KeyPlatform {
- KB_Win = 1,
- KB_Mac = 2,
- KB_X11 = 4,
- KB_KDE = 8,
- KB_Gnome = 16,
- KB_CDE = 32,
- KB_All = 0xffff
- };
-
- static uint currentKeyPlatform();
-
static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
{ return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; }
@@ -213,6 +200,9 @@ public:
};
QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints;
+protected:
+ virtual void notifyThemeChanged();
+
private:
void init();
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 8378650dcb..50d3f0b7d1 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -221,7 +221,7 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, 0);
}
-static bool convert(const QVariant::Private *d, QVariant::Type t,
+static bool convert(const QVariant::Private *d, int t,
void *result, bool *ok)
{
switch (t) {
@@ -236,7 +236,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t,
switch (d->type) {
#ifndef QT_NO_SHORTCUT
case QVariant::KeySequence:
- *str = QString(*v_cast<QKeySequence>(d));
+ *str = (*v_cast<QKeySequence>(d)).toString(QKeySequence::NativeText);
return true;
#endif
case QVariant::Font:
@@ -285,7 +285,8 @@ static bool convert(const QVariant::Private *d, QVariant::Type t,
#ifndef QT_NO_SHORTCUT
case QVariant::Int:
if (d->type == QVariant::KeySequence) {
- *static_cast<int *>(result) = (int)(*(v_cast<QKeySequence>(d)));
+ const QKeySequence &seq = *v_cast<QKeySequence>(d);
+ *static_cast<int *>(result) = seq.isEmpty() ? 0 : seq[0];
return true;
}
break;
@@ -342,7 +343,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type t,
return qcoreVariantHandler()->convert(d, t, result, ok);
}
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
static void streamDebug(QDebug dbg, const QVariant &v)
{
QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
@@ -362,7 +363,7 @@ const QVariant::Handler qt_gui_variant_handler = {
compare,
convert,
0,
-#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
+#if !defined(QT_NO_DEBUG_STREAM)
streamDebug
#else
0
diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp
index de00396e40..9e724446ff 100644
--- a/src/gui/kernel/qinputmethod.cpp
+++ b/src/gui/kernel/qinputmethod.cpp
@@ -154,9 +154,9 @@ QRectF QInputMethod::cursorRectangle() const
QInputMethodQueryEvent query(Qt::ImCursorRectangle);
QGuiApplication::sendEvent(d->inputItem.data(), &query);
- QRect r = query.value(Qt::ImCursorRectangle).toRect();
+ QRectF r = query.value(Qt::ImCursorRectangle).toRectF();
if (!r.isValid())
- return QRect();
+ return QRectF();
return d->inputItemTransform.mapRect(r);
}
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 021135b6fe..7053f01196 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -41,6 +41,7 @@
#include "qkeysequence.h"
#include "qkeysequence_p.h"
+#include "qplatformtheme_qpa.h"
#include "private/qguiapplication_p.h"
#ifndef QT_NO_SHORTCUT
@@ -640,153 +641,163 @@ static const struct {
//Table of key bindings. It must be sorted on key sequence.
//A priority of 1 indicates that this is the primary key binding when multiple are defined.
+enum KeyPlatform {
+ KB_Win = (1 << QPlatformTheme::WindowsKeyboardScheme),
+ KB_Mac = (1 << QPlatformTheme::MacKeyboardScheme),
+ KB_X11 = (1 << QPlatformTheme::X11KeyboardScheme),
+ KB_KDE = (1 << QPlatformTheme::KdeKeyboardScheme),
+ KB_Gnome = (1 << QPlatformTheme::GnomeKeyboardScheme),
+ KB_CDE = (1 << QPlatformTheme::CdeKeyboardScheme),
+ KB_All = 0xffff
+};
+
const QKeyBinding QKeySequencePrivate::keyBindings[] = {
// StandardKey Priority Key Sequence Platforms
- {QKeySequence::Back, 0, Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, QGuiApplicationPrivate::KB_All},
- {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Delete, 1, Qt::Key_Delete, QGuiApplicationPrivate::KB_All},
- {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, QGuiApplicationPrivate::KB_All},
- {QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, QGuiApplicationPrivate::KB_All},
- {QKeySequence::MoveToNextChar, 0, Qt::Key_Right, QGuiApplicationPrivate::KB_All},
- {QKeySequence::MoveToNextLine, 0, Qt::Key_Down, QGuiApplicationPrivate::KB_All},
- {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, QGuiApplicationPrivate::KB_All},
- {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, QGuiApplicationPrivate::KB_All},
- {QKeySequence::HelpContents, 0, Qt::Key_F1, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::FindNext, 0, Qt::Key_F3, QGuiApplicationPrivate::KB_X11},
- {QKeySequence::FindNext, 1, Qt::Key_F3, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Refresh, 0, Qt::Key_F5, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::Undo, 0, Qt::Key_F14, QGuiApplicationPrivate::KB_X11}, //Undo on sun keyboards
- {QKeySequence::Copy, 0, Qt::Key_F16, QGuiApplicationPrivate::KB_X11}, //Copy on sun keyboards
- {QKeySequence::Paste, 0, Qt::Key_F18, QGuiApplicationPrivate::KB_X11}, //Paste on sun keyboards
- {QKeySequence::Cut, 0, Qt::Key_F20, QGuiApplicationPrivate::KB_X11}, //Cut on sun keyboards
- {QKeySequence::PreviousChild, 0, Qt::Key_Back, QGuiApplicationPrivate::KB_All},
- {QKeySequence::NextChild, 0, Qt::Key_Forward, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, QGuiApplicationPrivate::KB_All},
- {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, //## Check if this should work on mac
- {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_All},
- {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_All},
- {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_All},
- {QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_All},
- {QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, QGuiApplicationPrivate::KB_All},
- {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, QGuiApplicationPrivate::KB_All},
- {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, QGuiApplicationPrivate::KB_All},
- {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, QGuiApplicationPrivate::KB_X11},
- {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, QGuiApplicationPrivate::KB_All},
- {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, QGuiApplicationPrivate::KB_KDE},
- {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, QGuiApplicationPrivate::KB_All},
- {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, QGuiApplicationPrivate::KB_KDE},
- {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, QGuiApplicationPrivate::KB_X11}, //emacs (line edit only)
- {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, QGuiApplicationPrivate::KB_All},
- {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QGuiApplicationPrivate::KB_Gnome},
- {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, QGuiApplicationPrivate::KB_All},
- {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, QGuiApplicationPrivate::KB_X11}, //emacs (line edit only)
- {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_KDE | QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, QGuiApplicationPrivate::KB_KDE},
- {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, QGuiApplicationPrivate::KB_All},
- {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, QGuiApplicationPrivate::KB_Mac}, //different priority from above
- {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
- {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
- {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac },
- {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac },
- {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QGuiApplicationPrivate::KB_KDE},
- {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Mac },//different priority from above
- {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac },
- {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac },
- {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, //mac only
- {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, //mac only
- {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, QGuiApplicationPrivate::KB_Mac },
- {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, QGuiApplicationPrivate::KB_Mac },
- {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,QGuiApplicationPrivate::KB_Win},
- {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, //mac only
- {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, //mac only
- {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac}
+ {QKeySequence::Back, 0, Qt::Key_Backspace, KB_Win},
+ {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, KB_All},
+ {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, KB_All},
+ {QKeySequence::Delete, 1, Qt::Key_Delete, KB_All},
+ {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, KB_Win | KB_X11},
+ {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, KB_Mac},
+ {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11},
+ {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, KB_Mac},
+ {QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, KB_All},
+ {QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, KB_All},
+ {QKeySequence::MoveToNextChar, 0, Qt::Key_Right, KB_All},
+ {QKeySequence::MoveToNextLine, 0, Qt::Key_Down, KB_All},
+ {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, KB_All},
+ {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, KB_All},
+ {QKeySequence::HelpContents, 0, Qt::Key_F1, KB_Win | KB_X11},
+ {QKeySequence::FindNext, 0, Qt::Key_F3, KB_X11},
+ {QKeySequence::FindNext, 1, Qt::Key_F3, KB_Win},
+ {QKeySequence::Refresh, 0, Qt::Key_F5, KB_Win | KB_X11},
+ {QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards
+ {QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards
+ {QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards
+ {QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, //Cut on sun keyboards
+ {QKeySequence::PreviousChild, 0, Qt::Key_Back, KB_All},
+ {QKeySequence::NextChild, 0, Qt::Key_Forward, KB_All},
+ {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, KB_Win},
+ {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All},
+ {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All},
+ {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, KB_Win | KB_X11},
+ {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, KB_Win | KB_X11}, //## Check if this should work on mac
+ {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11},
+ {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, KB_Mac},
+ {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11},
+ {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, KB_Mac},
+ {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, KB_All},
+ {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, KB_All},
+ {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, KB_All},
+ {QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, KB_All},
+ {QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, KB_All},
+ {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, KB_All},
+ {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, KB_All},
+ {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, KB_X11},
+ {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, KB_Win},
+ {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, KB_All},
+ {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, KB_KDE},
+ {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac},
+ {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, KB_All},
+ {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, KB_KDE},
+ {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, KB_Mac},
+ {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, KB_All},
+ {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, KB_All},
+ {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, KB_All},
+ {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, KB_X11}, //emacs (line edit only)
+ {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, KB_All},
+ {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, KB_Gnome | KB_Mac},
+ {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, KB_Win},
+ {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Win},
+ {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Gnome},
+ {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, KB_All},
+ {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, KB_X11}, //emacs (line edit only)
+ {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, KB_All},
+ {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, KB_All},
+ {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, KB_All},
+ {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_Gnome | KB_KDE | KB_Mac},
+ {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, KB_Gnome | KB_Mac},
+ {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, KB_KDE},
+ {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, KB_All},
+ {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, KB_All},
+ {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, KB_All},
+ {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, KB_All},
+ {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, KB_Win | KB_X11},
+ {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, KB_Mac},
+ {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, KB_All},
+ {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, KB_Win},
+ {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, KB_All},
+ {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, KB_Mac},
+ {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, KB_Mac},
+ {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, KB_Mac},
+ {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, KB_Mac},
+ {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, KB_Win | KB_X11},
+ {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, KB_Mac}, //different priority from above
+ {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, KB_X11 | KB_Win},
+ {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, KB_X11 | KB_Win},
+ {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, KB_X11 | KB_Win},
+ {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, KB_Win | KB_X11},
+ {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, KB_Win | KB_X11},
+ {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, KB_Mac},
+ {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, KB_Win | KB_X11},
+ {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, KB_Mac },
+ {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, KB_Mac},
+ {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, KB_Mac},
+ {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, KB_Mac },
+ {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, KB_Win | KB_X11},
+ {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, KB_Mac},
+ {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, KB_Win},
+ {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, KB_Mac},
+ {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, KB_Win},
+ {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Gnome | KB_Mac},
+ {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Win},
+ {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, KB_KDE},
+ {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac},
+ {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Win | KB_X11},
+ {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Mac},
+ {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Win | KB_X11},
+ {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Mac },//different priority from above
+ {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, KB_X11},
+ {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11},
+ {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11},
+ {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Win | KB_X11},
+ {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Mac },
+ {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, KB_Mac},
+ {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Win | KB_X11},
+ {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Mac },
+ {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, KB_Mac},
+ {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, KB_Win},
+ {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win},
+ {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, KB_Mac},
+ {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, KB_Mac},
+ {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, KB_Win | KB_X11},
+ {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac},
+ {QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only
+ {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, KB_Mac},
+ {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, KB_Win | KB_X11},
+ {QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only
+ {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, KB_Mac },
+ {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, KB_Mac },
+ {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,KB_Win},
+ {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, KB_Mac},
+ {QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only
+ {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, KB_Mac},
+ {QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only
+ {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac},
+ {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac},
+ {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac},
+ {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, KB_Mac},
+ {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, KB_Mac},
+ {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, KB_Mac},
+ {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, KB_Mac},
+ {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, KB_Mac},
+ {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, KB_Mac},
+ {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, KB_Mac},
+ {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, KB_Mac},
+ {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac},
+ {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac},
+ {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, KB_Mac},
+ {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}
};
const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding));
@@ -991,7 +1002,7 @@ static inline int maybeSwapShortcut(int shortcut)
*/
QList<QKeySequence> QKeySequence::keyBindings(StandardKey key)
{
- uint platform = QGuiApplicationPrivate::currentKeyPlatform();
+ const uint platform = QKeySequencePrivate::currentKeyPlatforms();
QList <QKeySequence> list;
for (uint i = 0; i < QKeySequencePrivate::numberOfKeyBindings ; ++i) {
QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i];
@@ -1330,6 +1341,19 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
return ret;
}
+unsigned QKeySequencePrivate::currentKeyPlatforms()
+{
+ int keyboardScheme = QPlatformTheme::WindowsKeyboardScheme;
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
+ unsigned result = 1u << keyboardScheme;
+ if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
+ || keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
+ || keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
+ result |= KB_X11;
+ return result;
+}
+
/*!
Creates a shortcut string for \a key. For example,
Qt::CTRL+Qt::Key_O gives "Ctrl+O". The strings, "Ctrl", "Shift", etc. are
@@ -1711,14 +1735,8 @@ QDataStream &operator>>(QDataStream &s, QKeySequence &keysequence)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QKeySequence &p)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QKeySequence(" << p.toString() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QKeySequence to QDebug");
- return dbg;
- Q_UNUSED(p);
-#endif
}
#endif
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 68cbb8778b..4481557121 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -88,6 +88,7 @@ public:
static const QKeyBinding keyBindings[];
static const uint numberOfKeyBindings;
+ static unsigned currentKeyPlatforms();
};
#endif // QT_NO_SHORTCUT
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index ba51653fcf..f9ebf8820c 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -74,6 +74,76 @@ QHash<QOpenGLContext *, bool> QOpenGLContextPrivate::makeCurrentTracker;
QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
#endif
+/*!
+ \class QOpenGLContext
+ \brief The QOpenGLContext represents a native OpenGL context, enabling
+ OpenGL rendering on a QSurface.
+
+ QOpenGLContext represents the OpenGL state of an underlying OpenGL context.
+ To set up a context, set its screen and format such that they match those
+ of the surface or surfaces with which the context is meant to be used, if
+ necessary make it share resources with other contexts with
+ setShareContext(), and finally call create(). Use isValid() to check if the
+ context was successfully initialized.
+
+ A context can be made current against a given surface by calling
+ makeCurrent(). When OpenGL rendering is done, call swapBuffers() to swap
+ the front and back buffers of the surface, so that the newly rendered
+ content becomes visible. To be able to support certain platforms,
+ QOpenGLContext requires that you call makeCurrent() again before starting
+ rendering a new frame, after calling swapBuffers().
+
+ If the context is temporarily not needed, such as when the application is
+ not rendering, it can be useful to call destroy() to free resources.
+ However, if you do so you will need to call create() again before the
+ context can be used, and you might need to recreate any OpenGL resources
+ and reinitialize the OpenGL state. You can connect to the
+ aboutToBeDestroyed() signal to clean up any resources that have been
+ allocated with different ownership from the QOpenGLContext itself.
+
+ Once a QOpenGLContext has been made current, you can render to it in a
+ platform independent way by using Qt's OpenGL enablers such as
+ QOpenGLFunctions, QOpenGLBuffer, QOpenGLShaderProgram, and
+ QOpenGLFramebufferObject. It is also possible to use the platform's OpenGL
+ API directly, without using the Qt enablers, although potentially at the
+ cost of portability. The latter is necessary when wanting to use OpenGL 1.x
+ or OpenGL ES 1.x.
+
+ For more information about the OpenGL API, refer to the official
+ \l{OpenGL documentation}.
+
+ \section1 Thread affinity
+
+ QOpenGLContext can be moved to a different thread with moveToThread(). Do
+ not call makeCurrent() from a different thread than the one to which the
+ QOpenGLContext object belongs. A context can only be current in one thread
+ and against one surface at a time, and a thread only has one context
+ current at a time.
+
+ \section1 Context resource sharing
+
+ Resources, such as framebuffer objects, textures, and vertex buffer objects
+ can be shared between contexts. Use setShareContext() before calling
+ create() to specify that the contexts should share these resources.
+ QOpenGLContext internally keeps track of a QOpenGLContextGroup object which
+ can be accessed with shareGroup(), and which can be used to find all the
+ contexts in a given share group. A share group consists of all contexts that
+ have been succesfully initialized and are sharing with an existing context in
+ the share group. A non-sharing context has a share group consisting of a
+ single context.
+
+ \section1 Default framebuffer
+
+ On certain platforms, a framebuffer other than 0 might be the default frame
+ buffer depending on the current surface. Instead of calling
+ glBindFramebuffer(0), it is recommended that you use
+ glBindFramebuffer(ctx->defaultFramebufferObject()), to ensure that your
+ application is portable between different platforms. However, if you use
+ QOpenGLFunctions::glBindFramebuffer(), this is done automatically for you.
+
+ \sa QOpenGLFunctions, QOpenGLBuffer, QOpenGLShaderProgram, QOpenGLFramebufferObject
+*/
+
void QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context)
{
QGuiGLThreadContext *threadContext = qwindow_context_storage.localData();
@@ -89,7 +159,8 @@ void QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context)
}
/*!
- Returns the last context which called makeCurrent. This function is thread aware.
+ Returns the last context which called makeCurrent in the current thread,
+ or 0, if no context is current.
*/
QOpenGLContext* QOpenGLContext::currentContext()
{
@@ -100,17 +171,31 @@ QOpenGLContext* QOpenGLContext::currentContext()
return 0;
}
+/*!
+ Returns true if the two contexts are sharing OpenGL resources.
+*/
bool QOpenGLContext::areSharing(QOpenGLContext *first, QOpenGLContext *second)
{
return first->shareGroup() == second->shareGroup();
}
+/*!
+ Returns the underlying platform context.
+
+ \internal
+*/
QPlatformOpenGLContext *QOpenGLContext::handle() const
{
Q_D(const QOpenGLContext);
return d->platformGLContext;
}
+/*!
+ Returns the underlying platform context with which this context is sharing.
+
+ \internal
+*/
+
QPlatformOpenGLContext *QOpenGLContext::shareHandle() const
{
Q_D(const QOpenGLContext);
@@ -120,7 +205,11 @@ QPlatformOpenGLContext *QOpenGLContext::shareHandle() const
}
/*!
- Creates a new GL context instance, you need to call create() before it can be used.
+ Creates a new OpenGL context instance.
+
+ Before it can be used you need to set the proper format and call create().
+
+ \sa create(), makeCurrent()
*/
QOpenGLContext::QOpenGLContext(QObject *parent)
: QObject(*new QOpenGLContextPrivate(), parent)
@@ -130,7 +219,8 @@ QOpenGLContext::QOpenGLContext(QObject *parent)
}
/*!
- Sets the format the GL context should be compatible with. You need to call create() before it takes effect.
+ Sets the \a format the OpenGL context should be compatible with. You need
+ to call create() before it takes effect.
*/
void QOpenGLContext::setFormat(const QSurfaceFormat &format)
{
@@ -139,7 +229,8 @@ void QOpenGLContext::setFormat(const QSurfaceFormat &format)
}
/*!
- Sets the context to share textures, shaders, and other GL resources with. You need to call create() before it takes effect.
+ Sets the context to share textures, shaders, and other OpenGL resources
+ with. You need to call create() before it takes effect.
*/
void QOpenGLContext::setShareContext(QOpenGLContext *shareContext)
{
@@ -148,7 +239,8 @@ void QOpenGLContext::setShareContext(QOpenGLContext *shareContext)
}
/*!
- Sets the screen the GL context should be valid for. You need to call create() before it takes effect.
+ Sets the \a screen the OpenGL context should be valid for. You need to call
+ create() before it takes effect.
*/
void QOpenGLContext::setScreen(QScreen *screen)
{
@@ -159,9 +251,15 @@ void QOpenGLContext::setScreen(QScreen *screen)
}
/*!
- Attempts to create the GL context with the desired parameters.
+ Attempts to create the OpenGL context with the current configuration.
+
+ The current configuration includes the format, the share context, and the
+ screen.
- Returns true if the native context was successfully created and is ready to be used.
+ Returns true if the native context was successfully created and is ready to
+ be used with makeCurrent(), swapBuffers(), etc.
+
+ \sa makeCurrent(), destroy()
*/
bool QOpenGLContext::create()
{
@@ -179,6 +277,22 @@ bool QOpenGLContext::create()
return d->platformGLContext;
}
+/*!
+ Destroy the underlying platform context associated with this context.
+
+ If any other context is directly or indirectly sharing resources with this
+ context, the shared resources, which includes vertex buffer objects, shader
+ objects, textures, and framebuffer objects, are not freed. However,
+ destroying the underlying platform context frees any state associated with
+ the context.
+
+ After destroy() has been called, you must call create() if you wish to
+ use the context again.
+
+ \note This implicitly calls doneCurrent() if the context is current.
+
+ \sa create()
+*/
void QOpenGLContext::destroy()
{
Q_D(QOpenGLContext);
@@ -199,15 +313,20 @@ void QOpenGLContext::destroy()
\fn void QOpenGLContext::aboutToBeDestroyed()
This signal is emitted before the underlying native OpenGL context is
- destroyed, such that users may clean up OpenGL resources that might otherwise
- be left dangling in the case of shared OpenGL contexts.
+ destroyed, such that users may clean up OpenGL resources that might
+ otherwise be left dangling in the case of shared OpenGL contexts.
- If you wish to make the context current in order to do clean-up, make sure to
- only connect to the signal using a direct connection.
+ If you wish to make the context current in order to do clean-up, make sure
+ to only connect to the signal using a direct connection.
*/
/*!
- If this is the current context for the thread, doneCurrent is called
+ Destroys the QOpenGLContext object.
+
+ This implicitly calls destroy(), so if this is the current context for the
+ thread, doneCurrent() is also called.
+
+ \sa destroy()
*/
QOpenGLContext::~QOpenGLContext()
{
@@ -219,7 +338,9 @@ QOpenGLContext::~QOpenGLContext()
}
/*!
- Returns if this context is valid, i.e. has been successfully created.
+ Returns if this context is valid, i.e. has been successfully created.
+
+ \sa create()
*/
bool QOpenGLContext::isValid() const
{
@@ -228,11 +349,13 @@ bool QOpenGLContext::isValid() const
}
/*!
- Get the QOpenGLFunctions instance for this context.
+ Get the QOpenGLFunctions instance for this context.
- The context or a sharing context must be current.
-*/
+ QOpenGLContext offers this as a convenient way to access QOpenGLFunctions
+ without having to manage it manually.
+ The context or a sharing context must be current.
+*/
QOpenGLFunctions *QOpenGLContext::functions() const
{
Q_D(const QOpenGLContext);
@@ -242,15 +365,17 @@ QOpenGLFunctions *QOpenGLContext::functions() const
}
/*!
- Call this to get the default framebuffer object for the current surface.
+ Call this to get the default framebuffer object for the current surface.
- On some platforms the default framebuffer object depends on the surface being rendered to,
- and might be different from 0. Thus, instead of calling glBindFramebuffer(0), you should
- call glBindFramebuffer(ctx->defaultFramebufferObject()) if you want your application to
- work across different Qt platforms.
+ On some platforms the default framebuffer object depends on the surface
+ being rendered to, and might be different from 0. Thus, instead of calling
+ glBindFramebuffer(0), you should call
+ glBindFramebuffer(ctx->defaultFramebufferObject()) if you want your
+ application to work across different Qt platforms.
- If you use the glBindFramebuffer() in QOpenGLFunctions you do not have to worry about this,
- as it automatically binds the current context's defaultFramebufferObject() when 0 is passed.
+ If you use the glBindFramebuffer() in QOpenGLFunctions you do not have to
+ worry about this, as it automatically binds the current context's
+ defaultFramebufferObject() when 0 is passed.
*/
GLuint QOpenGLContext::defaultFramebufferObject() const
{
@@ -265,12 +390,18 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
}
/*!
- If surface is 0 this is equivalent to calling doneCurrent().
+ Makes the context current in the current thread, against the given
+ \a surface.
+
+ If \a surface is 0 this is equivalent to calling doneCurrent().
- Do not call 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.
+ Do not call 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()
*/
bool QOpenGLContext::makeCurrent(QSurface *surface)
{
@@ -313,6 +444,10 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
/*!
Convenience function for calling makeCurrent with a 0 surface.
+
+ This results in no context being current in the current thread.
+
+ \sa makeCurrent(), currentContext()
*/
void QOpenGLContext::doneCurrent()
{
@@ -330,7 +465,9 @@ void QOpenGLContext::doneCurrent()
}
/*!
- Returns the surface the context is current for.
+ Returns the surface the context has been made current with.
+
+ This is the surface passed as an argument to makeCurrent().
*/
QSurface *QOpenGLContext::surface() const
{
@@ -391,6 +528,11 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
d->platformGLContext->swapBuffers(surfaceHandle);
}
+/*!
+ Resolves the function pointer to an OpenGL extension function, identified by \a procName
+
+ Returns 0 if no such function can be found.
+*/
QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName)
{
Q_D(QOpenGLContext);
@@ -399,6 +541,11 @@ QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName)
return d->platformGLContext->getProcAddress(procName);
}
+/*!
+ Returns the format of the underlying platform context, if create() has been called.
+
+ Otherwise, returns the requested format.
+*/
QSurfaceFormat QOpenGLContext::format() const
{
Q_D(const QOpenGLContext);
@@ -407,27 +554,41 @@ QSurfaceFormat QOpenGLContext::format() const
return d->platformGLContext->format();
}
+/*!
+ Returns the share group this context belongs to.
+*/
QOpenGLContextGroup *QOpenGLContext::shareGroup() const
{
Q_D(const QOpenGLContext);
return d->shareGroup;
}
+/*!
+ Returns the share context this context was created with.
+
+ If the underlying platform was not able to support the requested
+ sharing, this will return 0.
+*/
QOpenGLContext *QOpenGLContext::shareContext() const
{
Q_D(const QOpenGLContext);
return d->shareContext;
}
+/*!
+ Returns the screen the context was created for.
+*/
QScreen *QOpenGLContext::screen() const
{
Q_D(const QOpenGLContext);
return d->screen;
}
-/*
- internal: Needs to have a pointer to qGLContext. But since this is in QtGui we cant
- have any type information.
+/*!
+ internal: Needs to have a pointer to qGLContext. But since this is in QtGui we cant
+ have any type information.
+
+ \internal
*/
void *QOpenGLContext::qGLContextHandle() const
{
@@ -435,6 +596,9 @@ void *QOpenGLContext::qGLContextHandle() const
return d->qGLContextHandle;
}
+/*!
+ \internal
+*/
void QOpenGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *))
{
Q_D(QOpenGLContext);
@@ -442,6 +606,9 @@ void QOpenGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFun
d->qGLContextDeleteFunction = qGLContextDeleteFunction;
}
+/*!
+ \internal
+*/
void QOpenGLContext::deleteQGLContext()
{
Q_D(QOpenGLContext);
@@ -452,23 +619,45 @@ void QOpenGLContext::deleteQGLContext()
}
}
+/*!
+ \class QOpenGLContextGroup
+ \brief The QOpenGLContextGroup represents a group of contexts sharing
+ OpenGL resources.
+
+ QOpenGLContextGroup is automatically created and managed by QOpenGLContext
+ instances. Its purpose is to identify all the contexts that are sharing
+ resources.
+
+ \sa QOpenGLContext::shareGroup()
+*/
QOpenGLContextGroup::QOpenGLContextGroup()
: QObject(*new QOpenGLContextGroupPrivate())
{
}
+/*!
+ \internal
+*/
QOpenGLContextGroup::~QOpenGLContextGroup()
{
Q_D(QOpenGLContextGroup);
d->cleanup();
}
+/*!
+ Returns all the QOpenGLContext objects in this share group.
+*/
QList<QOpenGLContext *> QOpenGLContextGroup::shares() const
{
Q_D(const QOpenGLContextGroup);
return d->m_shares;
}
+/*!
+ Returns the QOpenGLContextGroup corresponding to the current context.
+
+ \sa QOpenGLContext::currentContext()
+*/
QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup()
{
QOpenGLContext *current = QOpenGLContext::currentContext();
@@ -544,9 +733,10 @@ void QOpenGLContextGroupPrivate::deletePendingResources(QOpenGLContext *ctx)
\class QOpenGLSharedResource
\internal
\since 5.0
- \brief The QOpenGLSharedResource class is used to keep track of resources that
- are shared between OpenGL contexts (like textures, framebuffer objects, shader
- programs, etc), and clean them up in a safe way when they're no longer needed.
+ \brief The QOpenGLSharedResource class is used to keep track of resources
+ that are shared between OpenGL contexts (like textures, framebuffer
+ objects, shader programs, etc), and clean them up in a safe way when
+ they're no longer needed.
The QOpenGLSharedResource instance should never be deleted, instead free()
should be called when it's no longer needed. Thus it will be put on a queue
@@ -556,11 +746,11 @@ void QOpenGLContextGroupPrivate::deletePendingResources(QOpenGLContext *ctx)
The sub-class needs to implement two pure virtual functions. The first,
freeResource() must be implemented to actually do the freeing, for example
call glDeleteTextures() on a texture id. Qt makes sure a valid context in
- the resource's share group is current at the time. The other, invalidateResource(),
- is called by Qt in the circumstance when the last context in the share group is
- destroyed before free() has been called. The implementation of invalidateResource()
- should set any identifiers to 0 or set a flag to prevent them from being used
- later on.
+ the resource's share group is current at the time. The other,
+ invalidateResource(), is called by Qt in the circumstance when the last
+ context in the share group is destroyed before free() has been called. The
+ implementation of invalidateResource() should set any identifiers to 0 or
+ set a flag to prevent them from being used later on.
*/
QOpenGLSharedResource::QOpenGLSharedResource(QOpenGLContextGroup *group)
: m_group(group)
@@ -616,9 +806,9 @@ void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context)
\since 5.0
\brief The QOpenGLMultiGroupSharedResource keeps track of a shared resource
that might be needed from multiple contexts, like a glyph cache or gradient
- cache. One instance of the object is created for each group when
- necessary. The shared resource instance should have a constructor that
- takes a QOpenGLContext *. To get an instance for a given context one calls
+ cache. One instance of the object is created for each group when necessary.
+ The shared resource instance should have a constructor that takes a
+ QOpenGLContext *. To get an instance for a given context one calls
T *QOpenGLMultiGroupSharedResource::value<T>(context), where T is a sub-class
of QOpenGLSharedResource.
diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp
index 9e0c60b3f6..bc08a73a7f 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.cpp
+++ b/src/gui/kernel/qplatformclipboard_qpa.cpp
@@ -96,6 +96,8 @@ void QPlatformClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
//we know its clipboard
Q_UNUSED(mode);
q_clipboardData()->setSource(data);
+
+ emitChanged(mode);
}
bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index 77c3811d95..c7d823d662 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -64,7 +64,7 @@ public:
virtual void reset();
virtual void commit();
virtual void update(Qt::InputMethodQueries);
- virtual void invokeAction(QInputPanel::Action, int cursorPosition);
+ virtual void invokeAction(QInputMethod::Action, int cursorPosition);
virtual bool filterEvent(const QEvent *event);
virtual QRectF keyboardRect() const;
void emitKeyboardRectChanged();
diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp
index aec465f0ff..3f6b69b902 100644
--- a/src/gui/kernel/qplatformtheme_qpa.cpp
+++ b/src/gui/kernel/qplatformtheme_qpa.cpp
@@ -84,6 +84,20 @@ QT_BEGIN_NAMESPACE
\value StyleNames (QStringList) A list of preferred style names.
+ \value WindowAutoPlacement (bool) A boolean value indicating whether Windows
+ (particularly dialogs) are placed by the system
+ (see _NET_WM_FULL_PLACEMENT in X11).
+
+ \value DialogButtonBoxLayout (int) An integer representing a
+ QDialogButtonBox::ButtonLayout value.
+
+ \value DialogButtonBoxButtonsHaveIcons (bool) A boolean value indicating whether
+ the buttons of a QDialogButtonBox should have icons.
+
+ \value UseFullScreenForPopupMenu (bool) Pop menus can cover the full screen including task bar.
+
+ \value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the
+ keyboard scheme.
\sa themeHint(), QStyle::pixelMetric()
*/
@@ -121,6 +135,14 @@ const QPalette *QPlatformTheme::palette(Palette type) const
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
+ case QPlatformTheme::UseFullScreenForPopupMenu:
+ return QVariant(false);
+ case QPlatformTheme::WindowAutoPlacement:
+ return QVariant(false);
+ case QPlatformTheme::DialogButtonBoxLayout:
+ return QVariant(int(0));
+ case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
+ return QVariant(false);
case QPlatformTheme::ItemViewActivateItemOnSingleClick:
return QVariant(false);
case QPlatformTheme::ToolButtonStyle:
@@ -140,6 +162,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
return QVariant(false);
case MaximumScrollBarDragDistance:
return QVariant(-1);
+ case KeyboardScheme:
+ return QVariant(int(WindowsKeyboardScheme));
}
return QVariant();
}
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index 036432054e..31a52a9391 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -69,7 +69,12 @@ public:
SystemIconThemeName,
SystemIconFallbackThemeName,
IconThemeSearchPaths,
- StyleNames
+ StyleNames,
+ WindowAutoPlacement,
+ DialogButtonBoxLayout,
+ DialogButtonBoxButtonsHaveIcons,
+ UseFullScreenForPopupMenu,
+ KeyboardScheme
};
enum DialogType {
@@ -84,6 +89,16 @@ public:
NPalettes
};
+ enum KeyboardSchemes
+ {
+ WindowsKeyboardScheme,
+ MacKeyboardScheme,
+ X11KeyboardScheme,
+ KdeKeyboardScheme,
+ GnomeKeyboardScheme,
+ CdeKeyboardScheme
+ };
+
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index b97852dc1d..9021d82e20 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -106,10 +106,86 @@ public:
int minor;
};
+/*!
+ \class QSurfaceFormat
+ \brief The QSurfaceFormat class represents the format of a QSurface.
+
+ The format includes the size of the color buffers, red, green, and blue;
+ the size of the alpha buffer; the size of the depth and stencil buffers;
+ and number of samples per pixel for multisampling. In addition, the format
+ contains surface configuration parameters such as OpenGL profile and
+ version for rendering, whether or not enable stereo buffers, and swap
+ behaviour.
+*/
+
+/*!
+ \enum QSurfaceFormat::FormatOption
+
+ This enum contains format options for use with QSurfaceFormat.
+
+ \value StereoBuffers Used to request stereo buffers in the surface format.
+ \value DebugContext Used to request a debug context with extra debugging information.
+ This requires OpenGL version 3.0 or higher.
+ \value DeprecatedFunctions Used to request that deprecated functions be included
+ in the OpenGL context profile. If not specified, you should get a forward compatible context
+ without support functionality marked as deprecated. This requires OpenGL version 3.0 or higher.
+*/
+
+/*!
+ \enum QSurfaceFormat::SwapBehavior
+
+ This enum is used by QSurfaceFormat to specify the swap behaviour of a surface. The swap behaviour
+ is mostly transparent to the application, but it affects factors such as rendering latency and
+ throughput.
+
+ \value DefaultSwapBehavior The default, unspecified swap behaviour of the platform.
+ \value SingleBuffer Used to request single buffering, which might result in flickering
+ when OpenGL rendering is done directly to screen without an intermediate offscreen
+ buffer.
+ \value DoubleBuffer This is typically the default swap behaviour on desktop platforms,
+ consisting of one back buffer and one front buffer. Rendering is done to the back
+ buffer, and then the back buffer and front buffer are swapped, or the contents of
+ the back buffer are copied to the front buffer, depending on the implementation.
+ \value TripleBuffer This swap behaviour is sometimes used in order to decrease the
+ risk of skipping a frame when the rendering rate is just barely keeping up with
+ the screen refresh rate. Depending on the platform it might also lead to slightly
+ more efficient use of the GPU due to improved pipelining behaviour. Triple buffering
+ comes at the cost of an extra frame of memory usage and latency, and might not be
+ supported depending on the underlying platform.
+*/
+
+/*!
+ \enum QSurfaceFormat::OpenGLContextProfile
+
+ This enum is used to specify the OpenGL context profile, in
+ conjunction with QSurfaceFormat::setMajorVersion() and
+ QSurfaceFormat::setMinorVersion().
+
+ Profiles are exposed in OpenGL 3.2 and above, and are used
+ to choose between a restricted core profile, and a compatibility
+ profile which might contain deprecated support functionality.
+
+ Note that the core profile might still contain functionality that
+ is deprecated and scheduled for removal in a higher version. To
+ get access to the deprecated functionality for the core profile
+ in the set OpenGL version you can use the QSurfaceFormat format option
+ QSurfaceFormat::DeprecatedFunctions.
+
+ \value NoProfile OpenGL version is lower than 3.2.
+ \value CoreProfile Functionality deprecated in OpenGL version 3.0 is not available.
+ \value CompatibilityProfile Functionality from earlier OpenGL versions is available.
+*/
+
+/*!
+ Constructs a default initialized QSurfaceFormat.
+*/
QSurfaceFormat::QSurfaceFormat() : d(new QSurfaceFormatPrivate)
{
}
+/*!
+ Constructs a QSurfaceFormat with the given format \a options.
+*/
QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) :
d(new QSurfaceFormatPrivate(options))
{
@@ -131,7 +207,6 @@ void QSurfaceFormat::detach()
/*!
Constructs a copy of \a other.
*/
-
QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat &other)
{
d = other.d;
@@ -141,7 +216,6 @@ QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat &other)
/*!
Assigns \a other to this object.
*/
-
QSurfaceFormat &QSurfaceFormat::operator=(const QSurfaceFormat &other)
{
if (d != other.d) {
@@ -182,7 +256,6 @@ QSurfaceFormat::~QSurfaceFormat()
\sa stereo()
*/
-
void QSurfaceFormat::setStereo(bool enable)
{
QSurfaceFormat::FormatOptions newOptions = d->opts;
@@ -199,8 +272,7 @@ void QSurfaceFormat::setStereo(bool enable)
/*!
Returns the number of samples per pixel when multisampling is
- enabled. By default, the highest number of samples that is
- available is used.
+ enabled. By default, multisampling is disabled.
\sa setSampleBuffers(), sampleBuffers(), setSamples()
*/
@@ -211,8 +283,7 @@ int QSurfaceFormat::samples() const
/*!
Set the preferred number of samples per pixel when multisampling
- is enabled to \a numSamples. By default, the highest number of
- samples available is used.
+ is enabled to \a numSamples. By default, multisampling is disabled.
\sa setSampleBuffers(), sampleBuffers(), samples()
*/
@@ -229,7 +300,6 @@ void QSurfaceFormat::setSamples(int numSamples)
\sa testOption()
*/
-
void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt)
{
const QSurfaceFormat::FormatOptions newOptions = d->opts | opt;
@@ -244,7 +314,6 @@ void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt)
\sa setOption()
*/
-
bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const
{
return d->opts & opt;
@@ -273,6 +342,13 @@ int QSurfaceFormat::depthBufferSize() const
return d->depthSize;
}
+/*!
+ Set the swap behaviour of the surface.
+
+ The swap behaviour specifies whether single, double, or triple
+ buffering is desired. The default, SwapBehavior::DefaultSwapBehavior,
+ gives the default swap behavior of the platform.
+*/
void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior)
{
if (d->swapBehavior != behavior) {
@@ -281,19 +357,29 @@ void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior)
}
}
+/*!
+ Returns the configured swap behaviour.
+ \sa setSwapBehavior()
+*/
QSurfaceFormat::SwapBehavior QSurfaceFormat::swapBehavior() const
{
return d->swapBehavior;
}
+/*!
+ Returns true if the alpha buffer size is greater than zero.
+
+ This means that the surface might be used with per pixel
+ translucency effects.
+*/
bool QSurfaceFormat::hasAlpha() const
{
return d->alphaBufferSize > 0;
}
/*!
- Set the preferred stencil buffer size to \a size.
+ Set the preferred stencil buffer size to \a size bits.
\sa stencilBufferSize(), setStencil(), stencil()
*/
@@ -306,7 +392,7 @@ void QSurfaceFormat::setStencilBufferSize(int size)
}
/*!
- Returns the stencil buffer size.
+ Returns the stencil buffer size in bits.
\sa stencil(), setStencil(), setStencilBufferSize()
*/
@@ -315,26 +401,41 @@ int QSurfaceFormat::stencilBufferSize() const
return d->stencilSize;
}
+/*!
+ Get the size in bits of the red channel of the color buffer.
+*/
int QSurfaceFormat::redBufferSize() const
{
return d->redBufferSize;
}
+/*!
+ Get the size in bits of the green channel of the color buffer.
+*/
int QSurfaceFormat::greenBufferSize() const
{
return d->greenBufferSize;
}
+/*!
+ Get the size in bits of the blue channel of the color buffer.
+*/
int QSurfaceFormat::blueBufferSize() const
{
return d->blueBufferSize;
}
+/*!
+ Get the size in bits of the alpha channel of the color buffer.
+*/
int QSurfaceFormat::alphaBufferSize() const
{
return d->alphaBufferSize;
}
+/*!
+ Set the desired size in bits of the red channel of the color buffer.
+*/
void QSurfaceFormat::setRedBufferSize(int size)
{
if (d->redBufferSize != size) {
@@ -343,6 +444,9 @@ void QSurfaceFormat::setRedBufferSize(int size)
}
}
+/*!
+ Set the desired size in bits of the green channel of the color buffer.
+*/
void QSurfaceFormat::setGreenBufferSize(int size)
{
if (d->greenBufferSize != size) {
@@ -351,6 +455,9 @@ void QSurfaceFormat::setGreenBufferSize(int size)
}
}
+/*!
+ Set the desired size in bits of the blue channel of the color buffer.
+*/
void QSurfaceFormat::setBlueBufferSize(int size)
{
if (d->blueBufferSize != size) {
@@ -359,6 +466,9 @@ void QSurfaceFormat::setBlueBufferSize(int size)
}
}
+/*!
+ Set the desired size in bits of the alpha channel of the color buffer.
+*/
void QSurfaceFormat::setAlphaBufferSize(int size)
{
if (d->alphaBufferSize != size) {
@@ -368,10 +478,10 @@ void QSurfaceFormat::setAlphaBufferSize(int size)
}
/*!
- Sets the desired OpenGL context profile.
+ Sets the desired OpenGL context profile.
- This setting is ignored if the requested OpenGL version is
- less than 3.2.
+ This setting is ignored if the requested OpenGL version is
+ less than 3.2.
*/
void QSurfaceFormat::setProfile(OpenGLContextProfile profile)
{
@@ -381,6 +491,12 @@ void QSurfaceFormat::setProfile(OpenGLContextProfile profile)
}
}
+/*!
+ Get the configured OpenGL context profile.
+
+ This setting is ignored if the requested OpenGL version is
+ less than 3.2.
+*/
QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const
{
return d->profile;
@@ -428,6 +544,12 @@ int QSurfaceFormat::minorVersion() const
return d->minor;
}
+/*!
+ Returns true if all the options of the two QSurfaceFormat objects
+ are equal.
+
+ \relates QSurfaceFormat
+*/
bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b)
{
return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts
@@ -450,7 +572,6 @@ bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b)
\relates QSurfaceFormat
*/
-
bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b)
{
return !(a == b);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 9c6b6c4bf7..04c2617838 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -63,15 +63,17 @@ QT_BEGIN_NAMESPACE
/*!
\class QWindow
- \brief The QWindow class encapsulates an independent window in a Windowing System.
+ \brief The QWindow class represents a window in the underlying windowing system.
- A window that is supplied a parent become a native child window of
+ A window that is supplied a parent becomes a native child window of
their parent window.
+ \section1 Resource management
+
Windows can potentially use a lot of memory. A usual measurement is
- width * height * depth. A window might also include multiple buffers
- to support double and triple buffering. To release a windows memory
- resources, the destroy() function.
+ width times height times color depth. A window might also include multiple
+ buffers to support double and triple buffering, as well as depth and stencil
+ buffers. To release a window's memory resources, the destroy() function.
\section1 Window and content orientation
@@ -90,6 +92,29 @@ QT_BEGIN_NAMESPACE
the contents instead, especially when doing rotation animations
between different orientations. The windowing system might use this
value to determine the layout of system popups or dialogs.
+
+ \section1 Visibility and Windowing system exposure.
+
+ By default, the window is not visible, and you must call setVisible(true),
+ or show() or similar to make it visible. To make a window hidden again,
+ call setVisible(false) or hide(). The visible property describes the state
+ the application wants the window to be in. Depending on the underlying
+ system, a visible window might still not be shown on the screen. It could,
+ for instance, be covered by other opaque windows or moved outside the
+ physical area of the screen. On windowing systems that have exposure
+ notifications, the isExposed() accessor describes whether the window should
+ be treated as directly visible on screen. The exposeEvent() function is
+ called whenever the windows exposure in the windowing system changes. On
+ windowing systems that do not make this information visible to the
+ application, isExposed() will simply return the same value as isVisible().
+*/
+
+/*!
+ Creates a window as a top level on the given screen.
+
+ The window is not shown until setVisible(true), show(), or similar is called.
+
+ \sa setScreen()
*/
QWindow::QWindow(QScreen *targetScreen)
: QObject(*new QWindowPrivate(), 0)
@@ -108,6 +133,15 @@ QWindow::QWindow(QScreen *targetScreen)
QGuiApplicationPrivate::window_list.prepend(this);
}
+/*!
+ Creates a window as a child of the given \a parent window.
+
+ The window will be embedded inside the parent window, its coordinates relative to the parent.
+
+ The screen is inherited from the parent.
+
+ \sa setParent()
+*/
QWindow::QWindow(QWindow *parent)
: QObject(*new QWindowPrivate(), parent)
, QSurface(QSurface::Window)
@@ -134,6 +168,9 @@ QWindow::QWindow(QWindowPrivate &dd, QWindow *parent)
QGuiApplicationPrivate::window_list.prepend(this);
}
+/*!
+ Destroys the window.
+*/
QWindow::~QWindow()
{
if (QGuiApplicationPrivate::focus_window == this)
@@ -146,18 +183,43 @@ QSurface::~QSurface()
{
}
+/*!
+ Set the \a surfaceType of the window.
+
+ Specifies whether the window is meant for raster rendering with
+ QBackingStore, or OpenGL rendering with QOpenGLContext.
+
+ \sa QBackingStore, QOpenGLContext
+*/
void QWindow::setSurfaceType(SurfaceType surfaceType)
{
Q_D(QWindow);
d->surfaceType = surfaceType;
}
+/*!
+ Returns the surface type of the window.
+
+ \sa setSurfaceType()
+*/
QWindow::SurfaceType QWindow::surfaceType() const
{
Q_D(const QWindow);
return d->surfaceType;
}
+/*!
+ \property QWindow::visible
+ \brief whether the window is visible or not
+ \since 5.0
+
+ This property controls the visibility of the window in the windowing system.
+
+ By default, the window is not visible, you must call setVisible(true), or
+ show() or similar to make it visible.
+
+ \sa show()
+*/
void QWindow::setVisible(bool visible)
{
Q_D(QWindow);
@@ -186,7 +248,10 @@ void QWindow::setVisible(bool visible)
}
}
-
+/*!
+ Returns true if the window is set to visible.
+ \obsolete
+*/
bool QWindow::visible() const
{
return isVisible();
@@ -199,6 +264,20 @@ bool QWindow::isVisible() const
return d->visible;
}
+/*!
+ Allocates the platform resources associated with the window.
+
+ It is at this point that the surface format set using setFormat() gets resolved
+ into an actual native surface. However, the window remains hidden until setVisible() is called.
+
+ Note that it is not usually necessary to call this function directly, as it will be implicitly
+ called by show(), setVisible(), and other functions that require access to the platform
+ resources.
+
+ Call destroy() to free the platform resources if necessary.
+
+ \sa destroy()
+*/
void QWindow::create()
{
Q_D(QWindow);
@@ -216,6 +295,14 @@ void QWindow::create()
}
}
+/*!
+ Returns the window's platform id.
+
+ For platforms where this id might be useful, the value returned
+ will uniquely represent the window inside the corresponding screen.
+
+ \sa screen()
+*/
WId QWindow::winId() const
{
Q_D(const QWindow);
@@ -228,16 +315,22 @@ WId QWindow::winId() const
return id;
}
+/*!
+ Returns the parent window, if any.
+
+ A window without a parent is known as a top level window.
+*/
QWindow *QWindow::parent() const
{
Q_D(const QWindow);
return d->parentWindow;
}
-/**
- Sets the parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the parent window.
- Setting parent to be 0(NULL) means map it as a top level window. If the parent window has grabbed its window system resources, then the current window will also grab its window system resources.
- **/
+/*!
+ Sets the parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the parent window.
+
+ Setting parent to be 0 will make the window become a top level window.
+*/
void QWindow::setParent(QWindow *parent)
{
@@ -257,46 +350,66 @@ void QWindow::setParent(QWindow *parent)
}
/*!
- Returns whether the window is top level, i.e. has no parent window.
- */
+ Returns whether the window is top level, i.e. has no parent window.
+*/
bool QWindow::isTopLevel() const
{
Q_D(const QWindow);
return d->parentWindow == 0;
}
+/*!
+ Returns whether the window is modal.
+
+ A modal window prevents other windows from getting any input.
+*/
bool QWindow::isModal() const
{
Q_D(const QWindow);
return d->modality != Qt::NonModal;
}
+/*!
+ Returns the window's modality.
+
+ \sa setWindowModality()
+*/
Qt::WindowModality QWindow::windowModality() const
{
Q_D(const QWindow);
return d->modality;
}
+/*!
+ Sets the window's modality to \a windowModality.
+*/
void QWindow::setWindowModality(Qt::WindowModality windowModality)
{
Q_D(QWindow);
d->modality = windowModality;
}
+/*!
+ Sets the window's surface \a format.
+
+ The format determines properties such as color depth, alpha,
+ depth and stencil buffer size, etc.
+*/
void QWindow::setFormat(const QSurfaceFormat &format)
{
Q_D(QWindow);
d->requestedFormat = format;
}
-
/*!
Returns the requested surfaceformat of this window.
If the requested format was not supported by the platform implementation,
the requestedFormat will differ from the actual window format.
- \sa format.
+ This is the value set with setFormat().
+
+ \sa setFormat(), format()
*/
QSurfaceFormat QWindow::requestedFormat() const
{
@@ -304,6 +417,15 @@ QSurfaceFormat QWindow::requestedFormat() const
return d->requestedFormat;
}
+/*!
+ Returns the actual format of this window.
+
+ After the window has been created, this function will return the actual surface format
+ of the window. It might differ from the requested format if the requested format could
+ not be fulfilled by the platform.
+
+ \sa create(), requestedFormat()
+*/
QSurfaceFormat QWindow::format() const
{
Q_D(const QWindow);
@@ -312,6 +434,15 @@ QSurfaceFormat QWindow::format() const
return d->requestedFormat;
}
+/*!
+ Sets the window flags of the window to \a flags.
+
+ The window flags control the window's appearance in the windowing system,
+ whether it's a dialog, popup, or a regular window, and whether it should
+ have a title bar, etc.
+
+ \sa windowFlags()
+*/
void QWindow::setWindowFlags(Qt::WindowFlags flags)
{
Q_D(QWindow);
@@ -321,18 +452,46 @@ void QWindow::setWindowFlags(Qt::WindowFlags flags)
d->windowFlags = flags;
}
+/*!
+ Returns the window flags of the window.
+
+ This might differ from the flags set with setWindowFlags() if the
+ requested flags could not be fulfilled.
+
+ \sa setWindowFlags()
+*/
Qt::WindowFlags QWindow::windowFlags() const
{
Q_D(const QWindow);
return d->windowFlags;
}
+/*!
+ Returns the type of the window.
+
+ This returns the part of the window flags that represents
+ whether the window is a dialog, tooltip, popup, regular window, etc.
+
+ \sa windowFlags(), setWindowFlags()
+*/
Qt::WindowType QWindow::windowType() const
{
Q_D(const QWindow);
return static_cast<Qt::WindowType>(int(d->windowFlags & Qt::WindowType_Mask));
}
+/*!
+ \property QWindow::windowTitle
+ \brief the window's title in the windowing system
+ \since 5.0
+
+ The window title might appear in the title area of the window decorations,
+ depending on the windowing system and the window flags. It might also
+ be used by the windowing system to identify the window in other contexts,
+ such as in the task switcher.
+
+ \sa windowFlags()
+*/
void QWindow::setWindowTitle(const QString &title)
{
Q_D(QWindow);
@@ -348,6 +507,11 @@ QString QWindow::windowTitle() const
return d->windowTitle;
}
+/*!
+ Raise the window in the windowing system.
+
+ Requests that the window be raised to appear above other windows.
+*/
void QWindow::raise()
{
Q_D(QWindow);
@@ -356,6 +520,11 @@ void QWindow::raise()
}
}
+/*!
+ Lower the window in the windowing system.
+
+ Requests that the window be lowered to appear below other windows.
+*/
void QWindow::lower()
{
Q_D(QWindow);
@@ -364,6 +533,16 @@ void QWindow::lower()
}
}
+/*!
+ Sets the window's opacity in the windowing system to \a level.
+
+ If the windowing system supports window opacity, this can be used to fade the
+ window in and out, or to make it semitransparent.
+
+ A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below
+ is treated as fully transparent. Values inbetween represent varying levels of
+ translucency between the two extremes.
+*/
void QWindow::setOpacity(qreal level)
{
Q_D(QWindow);
@@ -372,6 +551,11 @@ void QWindow::setOpacity(qreal level)
}
}
+/*!
+ Requests the window to be activated, i.e. receive keyboard focus.
+
+ \sa isActive(), QGuiApplication::focusWindow()
+*/
void QWindow::requestActivateWindow()
{
Q_D(QWindow);
@@ -379,7 +563,6 @@ void QWindow::requestActivateWindow()
d->platformWindow->requestActivateWindow();
}
-
/*!
Returns if this window is exposed in the windowing system.
@@ -388,8 +571,9 @@ void QWindow::requestActivateWindow()
should minimize rendering and other graphical activities.
An exposeEvent() is sent every time this value changes.
- */
+ \sa exposeEvent()
+*/
bool QWindow::isExposed() const
{
Q_D(const QWindow);
@@ -424,22 +608,26 @@ bool QWindow::isActive() const
}
/*!
- Reports that the orientation of the window's contents have changed.
+ \property QWindow::contentOrientation
+ \since 5.0
+ \brief the orientation of the window's contents
+
+ This is a hint to the window manager in case it needs to display
+ additional content like popups, dialogs, status bars, or similar
+ in relation to the window.
- This is a hint to the window manager in case it needs to display
- additional content like popups, dialogs, status bars, or similar
- in relation to the window.
+ The recommended orientation is QScreen::orientation() but
+ an application doesn't have to support all possible orientations,
+ and thus can opt to ignore the current screen orientation.
- The recommended orientation is QScreen::orientation() but
- an application doesn't have to support all possible orientations,
- and thus can opt to ignore the current screen orientation.
+ The difference between the window and the content orientation
+ determines how much to rotate the content by. QScreen::angleBetween(),
+ QScreen::transformBetween(), and QScreen::mapBetween() can be used
+ to compute the necessary transform.
- The difference between the window and the content orientation
- determines how much to rotate the content by. QScreen::angleBetween(),
- QScreen::transformBetween(), and QScreen::mapBetween() can be used
- to compute the necessary transform.
+ The default value is Qt::PrimaryOrientation
- \sa requestWindowOrientation(), QScreen::orientation()
+ \sa requestWindowOrientation(), QScreen::orientation()
*/
void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
{
@@ -454,12 +642,6 @@ void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
emit contentOrientationChanged(orientation);
}
-/*!
- Returns the actual content orientation.
-
- This is the last value set with reportContentOrientationChange(). It defaults
- to Qt::PrimaryOrientation.
-*/
Qt::ScreenOrientation QWindow::contentOrientation() const
{
Q_D(const QWindow);
@@ -506,12 +688,27 @@ Qt::ScreenOrientation QWindow::windowOrientation() const
return d->windowOrientation;
}
+/*!
+ Returns the window state.
+
+ \sa setWindowState()
+*/
Qt::WindowState QWindow::windowState() const
{
Q_D(const QWindow);
return d->windowState;
}
+/*!
+ Sets the desired window \a state.
+
+ The window state represents whether the window appears in the
+ windowing system as maximized, minimized, fullscreen, or normal.
+
+ The enum value Qt::WindowActive is not an accepted parameter.
+
+ \sa windowState(), showNormal(), showFullScreen(), showMinimized(), showMaximized()
+*/
void QWindow::setWindowState(Qt::WindowState state)
{
if (state == Qt::WindowActive) {
@@ -527,7 +724,11 @@ void QWindow::setWindowState(Qt::WindowState state)
}
/*!
- Sets the transient parent, which is a hint to the window manager that this window is a dialog or pop-up on behalf of the given window.
+ Sets the transient parent
+
+ This is a hint to the window manager that this window is a dialog or pop-up on behalf of the given window.
+
+ \sa transientParent(), parent()
*/
void QWindow::setTransientParent(QWindow *parent)
{
@@ -538,6 +739,11 @@ void QWindow::setTransientParent(QWindow *parent)
d->transientParent = parent;
}
+/*!
+ Returns the transient parent of the window.
+
+ \sa setTransientParent(), parent()
+*/
QWindow *QWindow::transientParent() const
{
Q_D(const QWindow);
@@ -555,8 +761,8 @@ QWindow *QWindow::transientParent() const
*/
/*!
- Returns true if the window is an ancestor of the given child. If mode is
- IncludeTransients transient parents are also considered ancestors.
+ Returns true if the window is an ancestor of the given child. If mode is
+ IncludeTransients transient parents are also considered ancestors.
*/
bool QWindow::isAncestorOf(const QWindow *child, AncestorMode mode) const
{
@@ -567,30 +773,57 @@ bool QWindow::isAncestorOf(const QWindow *child, AncestorMode mode) const
|| (mode == IncludeTransients && child->transientParent() && isAncestorOf(child->transientParent(), mode));
}
+/*!
+ Returns the minimum size of the window.
+
+ \sa setMinimumSize()
+*/
QSize QWindow::minimumSize() const
{
Q_D(const QWindow);
return d->minimumSize;
}
+/*!
+ Returns the maximum size of the window.
+
+ \sa setMaximumSize()
+*/
QSize QWindow::maximumSize() const
{
Q_D(const QWindow);
return d->maximumSize;
}
+/*!
+ Returns the base size of the window.
+
+ \sa setBaseSize()
+*/
QSize QWindow::baseSize() const
{
Q_D(const QWindow);
return d->baseSize;
}
+/*!
+ Returns the size increment of the window.
+
+ \sa setSizeIncrement()
+*/
QSize QWindow::sizeIncrement() const
{
Q_D(const QWindow);
return d->sizeIncrement;
}
+/*!
+ Sets the minimum size of the window.
+
+ This is a hint to the window manager to prevent resizing below the specified \a size.
+
+ \sa setMaximumSize(), minimumSize()
+*/
void QWindow::setMinimumSize(const QSize &size)
{
Q_D(QWindow);
@@ -602,6 +835,13 @@ void QWindow::setMinimumSize(const QSize &size)
d->platformWindow->propagateSizeHints();
}
+/*!
+ Sets the maximum size of the window.
+
+ This is a hint to the window manager to prevent resizing above the specified \a size.
+
+ \sa setMinimumSize(), maximumSize()
+*/
void QWindow::setMaximumSize(const QSize &size)
{
Q_D(QWindow);
@@ -613,6 +853,14 @@ void QWindow::setMaximumSize(const QSize &size)
d->platformWindow->propagateSizeHints();
}
+/*!
+ Sets the base size of the window.
+
+ The base size is used to calculate a proper window size if the
+ window defines sizeIncrement().
+
+ \sa setMinimumSize(), setMaximumSize(), setSizeIncrement(), baseSize()
+*/
void QWindow::setBaseSize(const QSize &size)
{
Q_D(QWindow);
@@ -623,6 +871,20 @@ void QWindow::setBaseSize(const QSize &size)
d->platformWindow->propagateSizeHints();
}
+/*!
+ Sets the size increment of the window.
+
+ When the user resizes the window, the size will move in steps of
+ sizeIncrement().width() pixels horizontally and
+ sizeIncrement().height() pixels vertically, with baseSize() as the
+ basis.
+
+ By default, this property contains a size with zero width and height.
+
+ The windowing system might not support size increments.
+
+ \sa setBaseSize(), setMinimumSize(), setMaximumSize()
+*/
void QWindow::setSizeIncrement(const QSize &size)
{
Q_D(QWindow);
@@ -634,7 +896,12 @@ void QWindow::setSizeIncrement(const QSize &size)
}
/*!
- Sets the geometry of the window excluding its window frame.
+ Sets the geometry of the window, excluding its window frame, to \a rect.
+
+ To make sure the window is visible, make sure the geometry is within
+ the virtual geometry of its screen.
+
+ \sa geometry(), screen(), QScreen::virtualGeometry()
*/
void QWindow::setGeometry(const QRect &rect)
{
@@ -661,7 +928,33 @@ void QWindow::setGeometry(const QRect &rect)
}
/*!
- Returns the geometry of the window excluding its window frame.
+ \property QWindow::x
+ \since 5.0
+ \brief the x position of the window's geometry
+*/
+
+/*!
+ \property QWindow::y
+ \since 5.0
+ \brief the y position of the window's geometry
+*/
+
+/*!
+ \property QWindow::width
+ \since 5.0
+ \brief the width of the window's geometry
+*/
+
+/*!
+ \property QWindow::height
+ \since 5.0
+ \brief the height of the window's geometry
+*/
+
+/*!
+ Returns the geometry of the window, excluding its window frame.
+
+ \sa frameMargins(), frameGeometry()
*/
QRect QWindow::geometry() const
{
@@ -673,6 +966,8 @@ QRect QWindow::geometry() const
/*!
Returns the window frame margins surrounding the window.
+
+ \sa geometry(), frameGeometry()
*/
QMargins QWindow::frameMargins() const
{
@@ -683,7 +978,9 @@ QMargins QWindow::frameMargins() const
}
/*!
- Returns the geometry of the window including its window frame.
+ Returns the geometry of the window, including its window frame.
+
+ \sa geometry(), frameMargins()
*/
QRect QWindow::frameGeometry() const
{
@@ -696,7 +993,11 @@ QRect QWindow::frameGeometry() const
}
/*!
- Returns the top left position of the window including its window frame.
+ Returns the top left position of the window, including its window frame.
+
+ This returns the same value as frameGeometry().topLeft().
+
+ \sa geometry(), frameGeometry()
*/
QPoint QWindow::framePos() const
{
@@ -710,6 +1011,8 @@ QPoint QWindow::framePos() const
/*!
Sets the upper left position of the window including its window frame.
+
+ \sa setGeometry(), frameGeometry()
*/
void QWindow::setFramePos(const QPoint &point)
{
@@ -722,6 +1025,11 @@ void QWindow::setFramePos(const QPoint &point)
}
}
+/*!
+ Sets the size of the window to be \a newSize.
+
+ \sa setGeometry()
+*/
void QWindow::resize(const QSize &newSize)
{
Q_D(QWindow);
@@ -732,18 +1040,23 @@ void QWindow::resize(const QSize &newSize)
}
}
+/*!
+ Sets the window icon to the given \a icon image.
+
+ The window icon might be used by the windowing system for example to decorate the window,
+ or in the task switcher.
+*/
void QWindow::setWindowIcon(const QImage &icon) const
{
Q_UNUSED(icon);
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
}
-
-
/*!
Releases the native platform resources associated with this window.
- */
+ \sa create()
+*/
void QWindow::destroy()
{
Q_D(QWindow);
@@ -761,18 +1074,37 @@ void QWindow::destroy()
d->platformWindow = 0;
}
+/*!
+ Returns the platform window corresponding to the window.
+
+ \internal
+*/
QPlatformWindow *QWindow::handle() const
{
Q_D(const QWindow);
return d->platformWindow;
}
+/*!
+ Returns the platform surface corresponding to the window.
+
+ \internal
+*/
QPlatformSurface *QWindow::surfaceHandle() const
{
Q_D(const QWindow);
return d->platformWindow;
}
+/*!
+ Set whether keyboard grab should be enabled or not.
+
+ If the return value is true, the window receives all key events until setKeyboardGrabEnabled(false) is
+ called; other windows get no key events at all. Mouse events are not affected.
+ Use setMouseGrabEnabled() if you want to grab that.
+
+ \sa setMouseGrabEnabled()
+*/
bool QWindow::setKeyboardGrabEnabled(bool grab)
{
Q_D(QWindow);
@@ -781,6 +1113,15 @@ bool QWindow::setKeyboardGrabEnabled(bool grab)
return false;
}
+/*!
+ Sets whether mouse grab should be enabled or not.
+
+ If the return value is true, the window receives all mouse events until setMouseGrabEnabled(false) is
+ called; other windows get no mouse events at all. Keyboard events are not affected.
+ Use setKeyboardGrabEnabled() if you want to grab that.
+
+ \sa setKeyboardGrabEnabled()
+*/
bool QWindow::setMouseGrabEnabled(bool grab)
{
Q_D(QWindow);
@@ -789,12 +1130,30 @@ bool QWindow::setMouseGrabEnabled(bool grab)
return false;
}
+/*!
+ Returns the screen on which the window is shown.
+
+ The value returned will not change when the window is moved
+ between virtual screens (as returned by QScreen::virtualSiblings()).
+
+ \sa setScreen(), QScreen::virtualSiblings()
+*/
QScreen *QWindow::screen() const
{
Q_D(const QWindow);
return d->screen;
}
+/*!
+ Sets the screen on which the window should be shown.
+
+ If the window has been created, it will be recreated on the new screen.
+
+ Note that if the screen is part of a virtual desktop of multiple screens,
+ the window can appear on any of the screens returned by QScreen::virtualSiblings().
+
+ \sa screen(), QScreen::virtualSiblings()
+*/
void QWindow::setScreen(QScreen *newScreen)
{
Q_D(QWindow);
@@ -833,7 +1192,7 @@ void QWindow::screenDestroyed(QObject *object)
/*!
Returns the accessibility interface for the object that the window represents
- \preliminary
+ \internal
\sa QAccessible
*/
QAccessibleInterface *QWindow::accessibleRoot() const
@@ -849,14 +1208,22 @@ QAccessibleInterface *QWindow::accessibleRoot() const
*/
/*!
- Returns the QObject that will be the final receiver of events tied focus, such
- as key events.
+ Returns the QObject that will be the final receiver of events tied focus, such
+ as key events.
*/
QObject *QWindow::focusObject() const
{
return const_cast<QWindow *>(this);
}
+/*!
+ Shows the window.
+
+ This equivalent to calling showFullScreen() or showNormal(), depending
+ on whether the platform defaults to windows being fullscreen or not.
+
+ \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen()
+*/
void QWindow::show()
{
if (qApp->styleHints()->showIsFullScreen())
@@ -865,23 +1232,54 @@ void QWindow::show()
showNormal();
}
+/*!
+ Hides the window.
+
+ Equivalent to calling setVisible(false).
+
+ \sa show(), setVisible()
+*/
void QWindow::hide()
{
setVisible(false);
}
+/*!
+ Shows the window as minimized.
+
+ Equivalent to calling setWindowState(Qt::WindowMinimized) and then
+ setVisible(true).
+
+ \sa setWindowState(), setVisible()
+*/
void QWindow::showMinimized()
{
setWindowState(Qt::WindowMinimized);
setVisible(true);
}
+/*!
+ Shows the window as maximized.
+
+ Equivalent to calling setWindowState(Qt::WindowMaximized) and then
+ setVisible(true).
+
+ \sa setWindowState(), setVisible()
+*/
void QWindow::showMaximized()
{
setWindowState(Qt::WindowMaximized);
setVisible(true);
}
+/*!
+ Shows the window as fullscreen.
+
+ Equivalent to calling setWindowState(Qt::WindowFullScreen) and then
+ setVisible(true).
+
+ \sa setWindowState(), setVisible()
+*/
void QWindow::showFullScreen()
{
setWindowState(Qt::WindowFullScreen);
@@ -889,12 +1287,28 @@ void QWindow::showFullScreen()
requestActivateWindow();
}
+/*!
+ Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen.
+
+ Equivalent to calling setWindowState(Qt::WindowNoState) and then
+ setVisible(true).
+
+ \sa setWindowState(), setVisible()
+*/
void QWindow::showNormal()
{
setWindowState(Qt::WindowNoState);
setVisible(true);
}
+/*!
+ Close the window.
+
+ This closes the window, effectively calling destroy(), and
+ potentially quitting the application
+
+ \sa destroy(), QGuiApplication::quitOnLastWindowClosed()
+*/
bool QWindow::close()
{
Q_D(QWindow);
@@ -912,8 +1326,6 @@ bool QWindow::close()
return true;
}
-
-
/*!
The expose event is sent by the window system whenever the window's
exposure on screen changes.
@@ -923,33 +1335,60 @@ bool QWindow::close()
value of isExposed() might change to false. When this happens,
an application should stop its rendering as it is no longer visible
to the user.
- */
+ \sa isExposed()
+*/
void QWindow::exposeEvent(QExposeEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle mouse events.
+*/
void QWindow::moveEvent(QMoveEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle resize events.
+
+ The resize event is called whenever the window is resized in the windowing system,
+ either directly through the windowing system acknowledging a setGeometry() or resize() request,
+ or indirectly through the user resizing the window manually.
+*/
void QWindow::resizeEvent(QResizeEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle show events.
+
+ The show event is called when the window becomes visible in the windowing system.
+*/
void QWindow::showEvent(QShowEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle show events.
+
+ The show event is called when the window becomes hidden in the windowing system.
+*/
void QWindow::hideEvent(QHideEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle any event sent to the window.
+
+ Remembet to call the base class version if you wish for mouse events,
+ key events, resize events, etc to be dispatched as usual.
+*/
bool QWindow::event(QEvent *ev)
{
switch (ev->type()) {
@@ -1032,58 +1471,111 @@ bool QWindow::event(QEvent *ev)
return true;
}
+/*!
+ Override this to handle key press events.
+
+ \sa keyReleaseEvent
+*/
void QWindow::keyPressEvent(QKeyEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle key release events.
+
+ \sa keyPressEvent
+*/
void QWindow::keyReleaseEvent(QKeyEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle focus in events.
+
+ Focus in events are sent when the window receives keyboard focus.
+
+ \sa focusOutEvent
+*/
void QWindow::focusInEvent(QFocusEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle focus out events.
+
+ Focus out events are sent when the window loses keyboard focus.
+
+ \sa focusInEvent
+*/
void QWindow::focusOutEvent(QFocusEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle mouse press events.
+
+ \sa mouseReleaseEvent()
+*/
void QWindow::mousePressEvent(QMouseEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle mouse release events.
+
+ \sa mousePressEvent()
+*/
void QWindow::mouseReleaseEvent(QMouseEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle mouse double click events.
+
+ \sa mousePressEvent(), QStyleHints::mouseDoubleClickInterval()
+*/
void QWindow::mouseDoubleClickEvent(QMouseEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle mouse move events.
+*/
void QWindow::mouseMoveEvent(QMouseEvent *ev)
{
ev->ignore();
}
#ifndef QT_NO_WHEELEVENT
+/*!
+ Override this to handle mouse wheel or other wheel events.
+*/
void QWindow::wheelEvent(QWheelEvent *ev)
{
ev->ignore();
}
#endif //QT_NO_WHEELEVENT
+/*!
+ Override this to handle touch events.
+*/
void QWindow::touchEvent(QTouchEvent *ev)
{
ev->ignore();
}
+/*!
+ Override this to handle platform dependent events.
+
+ This might make your application non-portable.
+*/
bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
Q_UNUSED(eventType);
@@ -1101,14 +1593,12 @@ bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *resu
\sa mapFromGlobal()
*/
-
QPoint QWindow::mapToGlobal(const QPoint &pos) const
{
return pos + d_func()->globalPosition();
}
-
/*!
\fn QPoint QWindow::mapFromGlobal(const QPoint &pos) const
@@ -1117,14 +1607,12 @@ QPoint QWindow::mapToGlobal(const QPoint &pos) const
\sa mapToGlobal()
*/
-
QPoint QWindow::mapFromGlobal(const QPoint &pos) const
{
return pos - d_func()->globalPosition();
}
-
Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window)
{
return window->d_func();
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index e6c4454104..40a4ec07a6 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -189,8 +189,53 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local,
void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)
{
- QWindowSystemInterfacePrivate::WheelEvent *e =
- new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o, mods);
+ QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0);
+ handleWheelEvent(tlw, timestamp, local, global, point, point, mods);
+}
+
+void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods)
+{
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleWheelEvent(w, time, local, global, pixelDelta, angleDelta, mods);
+}
+
+void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods)
+{
+ // Qt 4 sends two separate wheel events for horizontal and vertical
+ // deltas. For Qt 5 we want to send the deltas in one event, but at the
+ // same time preserve source and behavior compatibility with Qt 4.
+ //
+ // In addition high-resolution pixel-based deltas are also supported.
+ // Platforms that does not support these may pass a null point here.
+ // Angle deltas must always be sent in addition to pixel deltas.
+ QWindowSystemInterfacePrivate::WheelEvent *e;
+
+ if (angleDelta.isNull())
+ return;
+
+ // Simple case: vertical deltas only:
+ if (angleDelta.y() != 0 && angleDelta.x() == 0) {
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+ return;
+ }
+
+ // Simple case: horizontal deltas only:
+ if (angleDelta.y() == 0 && angleDelta.x() != 0) {
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+ return;
+ }
+
+ // Both horizontal and vertical deltas: Send two wheel events.
+ // The first event contains the Qt 5 pixel and angle delta as points,
+ // and in addition the Qt 4 compatibility vertical angle delta.
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+
+ // The second event contains null pixel and angle points and the
+ // Qt 4 compatibility horizontal angle delta.
+ e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 78152a1178..836fb40bd7 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -80,7 +80,10 @@ public:
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
ushort count = 1);
+ static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ // Wheel event compatibility functions. Will be removed: do not use.
static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 661b39da88..f5c141b4c9 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -157,13 +157,15 @@ public:
class WheelEvent : public InputEvent {
public:
- WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, int d,
- Qt::Orientation o, Qt::KeyboardModifiers mods)
- : InputEvent(w, time, Wheel, mods), delta(d), localPos(local), globalPos(global), orient(o) { }
- int delta;
+ WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
+ Qt::KeyboardModifiers mods)
+ : InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global) { }
+ QPoint pixelDelta;
+ QPoint angleDelta;
+ int qt4Delta;
+ Qt::Orientation qt4Orientation;
QPointF localPos;
QPointF globalPos;
- Qt::Orientation orient;
};
class KeyEvent : public InputEvent {
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index f39dc12239..290fcb287e 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -42,6 +42,7 @@
#include "qopengl_p.h"
#include "qopenglcontext.h"
+#include "qopenglfunctions.h"
QT_BEGIN_NAMESPACE
@@ -50,7 +51,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher(const char *str)
init(str);
}
-typedef GLubyte * (*qt_glGetStringi)(GLenum, GLuint);
+typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
#ifndef GL_NUM_EXTENSIONS
#define GL_NUM_EXTENSIONS 0x821D
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp
index e6879a9e60..f47f71c121 100644
--- a/src/gui/opengl/qopenglbuffer.cpp
+++ b/src/gui/opengl/qopenglbuffer.cpp
@@ -49,16 +49,16 @@ QT_BEGIN_NAMESPACE
/*!
\class QOpenGLBuffer
- \brief The QOpenGLBuffer class provides functions for creating and managing GL buffer objects.
+ \brief The QOpenGLBuffer class provides functions for creating and managing OpenGL buffer objects.
\since 5.0
\ingroup painting-3D
- Buffer objects are created in the GL server so that the
+ Buffer objects are created in the OpenGL server so that the
client application can avoid uploading vertices, indices,
texture image data, etc every time they are needed.
QOpenGLBuffer objects can be copied around as a reference to the
- underlying GL buffer object:
+ underlying OpenGL buffer object:
\code
QOpenGLBuffer buffer1(QOpenGLBuffer::IndexBuffer);
@@ -74,16 +74,16 @@ QT_BEGIN_NAMESPACE
/*!
\enum QOpenGLBuffer::Type
- This enum defines the type of GL buffer object to create with QOpenGLBuffer.
+ This enum defines the type of OpenGL buffer object to create with QOpenGLBuffer.
\value VertexBuffer Vertex buffer object for use when specifying
vertex arrays.
\value IndexBuffer Index buffer object for use with \c{glDrawElements()}.
\value PixelPackBuffer Pixel pack buffer object for reading pixel
- data from the GL server (for example, with \c{glReadPixels()}).
+ data from the OpenGL server (for example, with \c{glReadPixels()}).
Not supported under OpenGL/ES.
\value PixelUnpackBuffer Pixel unpack buffer object for writing pixel
- data to the GL server (for example, with \c{glTexImage2D()}).
+ data to the OpenGL server (for example, with \c{glTexImage2D()}).
Not supported under OpenGL/ES.
*/
@@ -95,26 +95,26 @@ QT_BEGIN_NAMESPACE
for drawing operations. Under OpenGL/ES 1.1 this is identical
to StaticDraw.
\value StreamRead The data will be set once and used a few times
- for reading data back from the GL server. Not supported
+ for reading data back from the OpenGL server. Not supported
under OpenGL/ES.
\value StreamCopy The data will be set once and used a few times
- for reading data back from the GL server for use in further
+ for reading data back from the OpenGL server for use in further
drawing operations. Not supported under OpenGL/ES.
\value StaticDraw The data will be set once and used many times
for drawing operations.
\value StaticRead The data will be set once and used many times
- for reading data back from the GL server. Not supported
+ for reading data back from the OpenGL server. Not supported
under OpenGL/ES.
\value StaticCopy The data will be set once and used many times
- for reading data back from the GL server for use in further
+ for reading data back from the OpenGL server for use in further
drawing operations. Not supported under OpenGL/ES.
\value DynamicDraw The data will be modified repeatedly and used
many times for drawing operations.
\value DynamicRead The data will be modified repeatedly and used
- many times for reading data back from the GL server.
+ many times for reading data back from the OpenGL server.
Not supported under OpenGL/ES.
\value DynamicCopy The data will be modified repeatedly and used
- many times for reading data back from the GL server for
+ many times for reading data back from the OpenGL server for
use in further drawing operations. Not supported under OpenGL/ES.
*/
@@ -152,7 +152,7 @@ public:
Constructs a new buffer object of type QOpenGLBuffer::VertexBuffer.
Note: this constructor just creates the QOpenGLBuffer instance. The actual
- buffer object in the GL server is not created until create() is called.
+ buffer object in the OpenGL server is not created until create() is called.
\sa create()
*/
@@ -165,7 +165,7 @@ QOpenGLBuffer::QOpenGLBuffer()
Constructs a new buffer object of \a type.
Note: this constructor just creates the QOpenGLBuffer instance. The actual
- buffer object in the GL server is not created until create() is called.
+ buffer object in the OpenGL server is not created until create() is called.
\sa create()
*/
@@ -188,7 +188,7 @@ QOpenGLBuffer::QOpenGLBuffer(const QOpenGLBuffer &other)
/*!
Destroys this buffer object, including the storage being
- used in the GL server.
+ used in the OpenGL server.
*/
QOpenGLBuffer::~QOpenGLBuffer()
{
@@ -256,14 +256,14 @@ namespace {
}
/*!
- Creates the buffer object in the GL server. Returns true if
+ Creates the buffer object in the OpenGL server. Returns true if
the object was created; false otherwise.
This function must be called with a current QOpenGLContext.
The buffer will be bound to and can only be used in
that context (or any other context that is shared with it).
- This function will return false if the GL implementation
+ This function will return false if the OpenGL implementation
does not support buffers, or there is no current QOpenGLContext.
\sa isCreated(), allocate(), write(), destroy()
@@ -303,7 +303,7 @@ bool QOpenGLBuffer::isCreated() const
/*!
Destroys this buffer object, including the storage being
- used in the GL server. All references to the buffer will
+ used in the OpenGL server. All references to the buffer will
become invalid.
*/
void QOpenGLBuffer::destroy()
@@ -398,8 +398,8 @@ void QOpenGLBuffer::allocate(const void *data, int count)
/*!
Binds the buffer associated with this object to the current
- GL context. Returns false if binding was not possible, usually because
- type() is not supported on this GL implementation.
+ OpenGL context. Returns false if binding was not possible, usually because
+ type() is not supported on this OpenGL implementation.
The buffer must be bound to the same QOpenGLContext current when create()
was called, or to another QOpenGLContext that is sharing with it.
@@ -431,7 +431,7 @@ bool QOpenGLBuffer::bind()
/*!
Releases the buffer associated with this object from the
- current GL context.
+ current OpenGL context.
This function must be called with the same QOpenGLContext current
as when bind() was called on the buffer.
@@ -470,7 +470,7 @@ void QOpenGLBuffer::release(QOpenGLBuffer::Type type)
}
/*!
- Returns the GL identifier associated with this buffer; zero if
+ Returns the OpenGL identifier associated with this buffer; zero if
the buffer has not been created.
\sa isCreated()
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 0eb264b2d9..a523cd2cf1 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
{ \
GLenum err = glGetError(); \
if (err != GL_NO_ERROR) { \
- qDebug("[%s line %d] GL Error: %d", \
+ qDebug("[%s line %d] OpenGL Error: %d", \
__FILE__, __LINE__, (int)err); \
} \
}
@@ -649,13 +649,13 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer
object, defined by the \c{GL_EXT_framebuffer_object} extension. In
addition it provides a rendering surface that can be painted on
- with a QPainter, rendered to using native GL calls, or both. This
- surface can be bound and used as a regular texture in your own GL
+ with a QPainter, rendered to using native OpenGL calls, or both. This
+ surface can be bound and used as a regular texture in your own OpenGL
drawing code. By default, the QOpenGLFramebufferObject class
- generates a 2D GL texture (using the \c{GL_TEXTURE_2D} target),
+ generates a 2D OpenGL texture (using the \c{GL_TEXTURE_2D} target),
which is used as the internal rendering target.
- \bold{It is important to have a current GL context when creating a
+ \bold{It is important to have a current OpenGL context when creating a
QOpenGLFramebufferObject, otherwise initialization will fail.}
When using a QPainter to paint to a QOpenGLFramebufferObject you should take
@@ -708,11 +708,11 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
/*! \fn QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum target)
- Constructs an OpenGL framebuffer object and binds a 2D GL texture
+ Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
to the buffer of the size \a size. The texture is bound to the
\c GL_COLOR_ATTACHMENT0 target in the framebuffer object.
- The \a target parameter is used to specify the GL texture
+ The \a target parameter is used to specify the OpenGL texture
target. The default target is \c GL_TEXTURE_2D. Keep in mind that
\c GL_TEXTURE_2D textures must have a power of 2 width and height
(e.g. 256x512), unless you are using OpenGL 2.0 or higher.
@@ -723,7 +723,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
The default internal texture format is \c GL_RGBA8 for desktop
OpenGL, and \c GL_RGBA for OpenGL/ES.
- It is important that you have a current GL context set when
+ It is important that you have a current OpenGL context set when
creating the QOpenGLFramebufferObject, otherwise the initialization
will fail.
@@ -739,7 +739,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
/*! \overload
- Constructs an OpenGL framebuffer object and binds a 2D GL texture
+ Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
to the buffer of the given \a width and \a height.
\sa size(), texture()
@@ -931,7 +931,7 @@ bool QOpenGLFramebufferObject::release()
Returns the texture id for the texture attached as the default
rendering target in this framebuffer object. This texture id can
- be bound as a normal texture in your own GL code.
+ be bound as a normal texture in your own OpenGL code.
If a multisample framebuffer object is used then the value returned
from this function will be invalid.
@@ -1109,7 +1109,7 @@ bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()
/*!
\fn GLuint QOpenGLFramebufferObject::handle() const
- Returns the GL framebuffer object handle for this framebuffer
+ Returns the OpenGL framebuffer object handle for this framebuffer
object (returned by the \c{glGenFrameBuffersEXT()} function). This
handle can be used to attach new images or buffers to the
framebuffer. The user is responsible for cleaning up and
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 13f91e2ad8..c2e177c162 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -421,7 +421,7 @@ bool QOpenGLExtensions::hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension ex
}
/*!
- Initializes GL function resolution for the current context.
+ Initializes OpenGL function resolution for the current context.
After calling this function, the QOpenGLFunctions object can only be
used with the current context and other contexts that share with it.
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index 118fe63122..32da27a078 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -63,10 +63,10 @@ QT_BEGIN_NAMESPACE
\ingroup painting-3D
When painting to a QOpenGLPaintDevice using QPainter, the state of
- the current GL context will be altered by the paint engine to reflect
- its needs. Applications should not rely upon the GL state being reset
+ the current OpenGL context will be altered by the paint engine to reflect
+ its needs. Applications should not rely upon the OpenGL state being reset
to its original conditions, particularly the current shader program,
- GL viewport, texture units, and drawing modes.
+ OpenGL viewport, texture units, and drawing modes.
*/
class QOpenGLPaintDevicePrivate
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index c8dc370a8b..6850eac59e 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -957,7 +957,6 @@ bool QBrush::operator==(const QBrush &b) const
*/
QDebug operator<<(QDebug dbg, const QBrush &b)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
static const char *BRUSH_STYLES[] = {
"NoBrush",
"SolidPattern",
@@ -983,11 +982,6 @@ QDebug operator<<(QDebug dbg, const QBrush &b)
dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QBrush to QDebug");
- return dbg;
- Q_UNUSED(b);
-#endif
}
#endif
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 2c95434843..96491918cd 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2399,7 +2399,6 @@ void QColor::invalidate()
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QColor &c)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
if (!c.isValid())
dbg.nospace() << "QColor(Invalid)";
else if (c.spec() == QColor::Rgb)
@@ -2413,11 +2412,6 @@ QDebug operator<<(QDebug dbg, const QColor &c)
dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QColor to QDebug");
- return dbg;
- Q_UNUSED(c);
-#endif
}
#endif
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index d30328b0fa..44772a4bb5 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -60,48 +60,50 @@
QT_BEGIN_NAMESPACE
struct QFixed {
+private:
+ Q_DECL_CONSTEXPR QFixed(int val, int) : val(val) {} // 2nd int is just a dummy for disambiguation
public:
- QFixed() : val(0) {}
- QFixed(int i) : val(i<<6) {}
- QFixed(long i) : val(i<<6) {}
+ Q_DECL_CONSTEXPR QFixed() : val(0) {}
+ Q_DECL_CONSTEXPR QFixed(int i) : val(i<<6) {}
+ Q_DECL_CONSTEXPR QFixed(long i) : val(i<<6) {}
QFixed &operator=(int i) { val = (i<<6); return *this; }
QFixed &operator=(long i) { val = (i<<6); return *this; }
- static QFixed fromReal(qreal r) { QFixed f; f.val = (int)(r*qreal(64)); return f; }
- static QFixed fromFixed(int fixed) { QFixed f; f.val = fixed; return f; }
+ Q_DECL_CONSTEXPR static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); }
+ Q_DECL_CONSTEXPR static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor
- inline int value() const { return val; }
+ Q_DECL_CONSTEXPR inline int value() const { return val; }
inline void setValue(int value) { val = value; }
- inline int toInt() const { return (((val)+32) & -64)>>6; }
- inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
+ Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; }
+ Q_DECL_CONSTEXPR inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
- inline int truncate() const { return val>>6; }
- inline QFixed round() const { QFixed f; f.val = ((val)+32) & -64; return f; }
- inline QFixed floor() const { QFixed f; f.val = (val) & -64; return f; }
- inline QFixed ceil() const { QFixed f; f.val = (val+63) & -64; return f; }
+ Q_DECL_CONSTEXPR inline int truncate() const { return val>>6; }
+ Q_DECL_CONSTEXPR inline QFixed round() const { return fromFixed(((val)+32) & -64); }
+ Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); }
+ Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); }
- inline QFixed operator+(int i) const { QFixed f; f.val = (val + (i<<6)); return f; }
- inline QFixed operator+(uint i) const { QFixed f; f.val = (val + (i<<6)); return f; }
- inline QFixed operator+(const QFixed &other) const { QFixed f; f.val = (val + other.val); return f; }
+ Q_DECL_CONSTEXPR inline QFixed operator+(int i) const { return fromFixed((val + (i<<6))); }
+ Q_DECL_CONSTEXPR inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); }
+ Q_DECL_CONSTEXPR inline QFixed operator+(const QFixed &other) const { return fromFixed((val + other.val)); }
inline QFixed &operator+=(int i) { val += (i<<6); return *this; }
inline QFixed &operator+=(uint i) { val += (i<<6); return *this; }
inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; }
- inline QFixed operator-(int i) const { QFixed f; f.val = (val - (i<<6)); return f; }
- inline QFixed operator-(uint i) const { QFixed f; f.val = (val - (i<<6)); return f; }
- inline QFixed operator-(const QFixed &other) const { QFixed f; f.val = (val - other.val); return f; }
+ Q_DECL_CONSTEXPR inline QFixed operator-(int i) const { return fromFixed((val - (i<<6))); }
+ Q_DECL_CONSTEXPR inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); }
+ Q_DECL_CONSTEXPR inline QFixed operator-(const QFixed &other) const { return fromFixed((val - other.val)); }
inline QFixed &operator-=(int i) { val -= (i<<6); return *this; }
inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; }
inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; }
- inline QFixed operator-() const { QFixed f; f.val = -val; return f; }
+ Q_DECL_CONSTEXPR inline QFixed operator-() const { return fromFixed(-val); }
- inline bool operator==(const QFixed &other) const { return val == other.val; }
- inline bool operator!=(const QFixed &other) const { return val != other.val; }
- inline bool operator<(const QFixed &other) const { return val < other.val; }
- inline bool operator>(const QFixed &other) const { return val > other.val; }
- inline bool operator<=(const QFixed &other) const { return val <= other.val; }
- inline bool operator>=(const QFixed &other) const { return val >= other.val; }
- inline bool operator!() const { return !val; }
+ Q_DECL_CONSTEXPR inline bool operator==(const QFixed &other) const { return val == other.val; }
+ Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &other) const { return val != other.val; }
+ Q_DECL_CONSTEXPR inline bool operator<(const QFixed &other) const { return val < other.val; }
+ Q_DECL_CONSTEXPR inline bool operator>(const QFixed &other) const { return val > other.val; }
+ Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &other) const { return val <= other.val; }
+ Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &other) const { return val >= other.val; }
+ Q_DECL_CONSTEXPR inline bool operator!() const { return !val; }
inline QFixed &operator/=(int x) { val /= x; return *this; }
inline QFixed &operator/=(const QFixed &o) {
@@ -120,7 +122,7 @@ public:
}
return *this;
}
- inline QFixed operator/(int d) const { QFixed f; f.val = val/d; return f; }
+ Q_DECL_CONSTEXPR inline QFixed operator/(int d) const { return fromFixed(val/d); }
inline QFixed operator/(QFixed b) const { QFixed f = *this; return (f /= b); }
inline QFixed operator>>(int d) const { QFixed f = *this; f.val >>= d; return f; }
inline QFixed &operator*=(int i) { val *= i; return *this; }
@@ -136,50 +138,50 @@ public:
val = neg ? -res : res;
return *this;
}
- inline QFixed operator*(int i) const { QFixed f = *this; return (f *= i); }
- inline QFixed operator*(uint i) const { QFixed f = *this; return (f *= i); }
+ Q_DECL_CONSTEXPR inline QFixed operator*(int i) const { return fromFixed(val * i); }
+ Q_DECL_CONSTEXPR inline QFixed operator*(uint i) const { return fromFixed(val * i); }
inline QFixed operator*(const QFixed &o) const { QFixed f = *this; return (f *= o); }
private:
- QFixed(qreal i) : val((int)(i*qreal(64))) {}
+ Q_DECL_CONSTEXPR QFixed(qreal i) : val((int)(i*qreal(64))) {}
QFixed &operator=(qreal i) { val = (int)(i*qreal(64)); return *this; }
- inline QFixed operator+(qreal i) const { QFixed f; f.val = (val + (int)(i*qreal(64))); return f; }
+ Q_DECL_CONSTEXPR inline QFixed operator+(qreal i) const { return fromFixed((val + (int)(i*qreal(64)))); }
inline QFixed &operator+=(qreal i) { val += (int)(i*64); return *this; }
- inline QFixed operator-(qreal i) const { QFixed f; f.val = (val - (int)(i*qreal(64))); return f; }
+ Q_DECL_CONSTEXPR inline QFixed operator-(qreal i) const { return fromFixed((val - (int)(i*qreal(64)))); }
inline QFixed &operator-=(qreal i) { val -= (int)(i*64); return *this; }
inline QFixed &operator/=(qreal r) { val = (int)(val/r); return *this; }
- inline QFixed operator/(qreal d) const { QFixed f; f.val = (int)(val/d); return f; }
+ Q_DECL_CONSTEXPR inline QFixed operator/(qreal d) const { return fromFixed((int)(val/d)); }
inline QFixed &operator*=(qreal d) { val = (int) (val*d); return *this; }
- inline QFixed operator*(qreal d) const { QFixed f = *this; return (f *= d); }
+ Q_DECL_CONSTEXPR inline QFixed operator*(qreal d) const { return fromFixed((int) (val*d)); }
int val;
};
Q_DECLARE_TYPEINFO(QFixed, Q_PRIMITIVE_TYPE);
#define QFIXED_MAX (INT_MAX/256)
-inline int qRound(const QFixed &f) { return f.toInt(); }
-inline int qFloor(const QFixed &f) { return f.floor().truncate(); }
-
-inline QFixed operator*(int i, const QFixed &d) { return d*i; }
-inline QFixed operator+(int i, const QFixed &d) { return d+i; }
-inline QFixed operator-(int i, const QFixed &d) { return -(d-i); }
-inline QFixed operator*(uint i, const QFixed &d) { return d*i; }
-inline QFixed operator+(uint i, const QFixed &d) { return d+i; }
-inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
-// inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; }
-
-inline bool operator==(const QFixed &f, int i) { return f.value() == (i<<6); }
-inline bool operator==(int i, const QFixed &f) { return f.value() == (i<<6); }
-inline bool operator!=(const QFixed &f, int i) { return f.value() != (i<<6); }
-inline bool operator!=(int i, const QFixed &f) { return f.value() != (i<<6); }
-inline bool operator<=(const QFixed &f, int i) { return f.value() <= (i<<6); }
-inline bool operator<=(int i, const QFixed &f) { return (i<<6) <= f.value(); }
-inline bool operator>=(const QFixed &f, int i) { return f.value() >= (i<<6); }
-inline bool operator>=(int i, const QFixed &f) { return (i<<6) >= f.value(); }
-inline bool operator<(const QFixed &f, int i) { return f.value() < (i<<6); }
-inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); }
-inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); }
-inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); }
+Q_DECL_CONSTEXPR inline int qRound(const QFixed &f) { return f.toInt(); }
+Q_DECL_CONSTEXPR inline int qFloor(const QFixed &f) { return f.floor().truncate(); }
+
+Q_DECL_CONSTEXPR inline QFixed operator*(int i, const QFixed &d) { return d*i; }
+Q_DECL_CONSTEXPR inline QFixed operator+(int i, const QFixed &d) { return d+i; }
+Q_DECL_CONSTEXPR inline QFixed operator-(int i, const QFixed &d) { return -(d-i); }
+Q_DECL_CONSTEXPR inline QFixed operator*(uint i, const QFixed &d) { return d*i; }
+Q_DECL_CONSTEXPR inline QFixed operator+(uint i, const QFixed &d) { return d+i; }
+Q_DECL_CONSTEXPR inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
+// Q_DECL_CONSTEXPR inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; }
+
+Q_DECL_CONSTEXPR inline bool operator==(const QFixed &f, int i) { return f.value() == (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator==(int i, const QFixed &f) { return f.value() == (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &f, int i) { return f.value() != (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator!=(int i, const QFixed &f) { return f.value() != (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &f, int i) { return f.value() <= (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator<=(int i, const QFixed &f) { return (i<<6) <= f.value(); }
+Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &f, int i) { return f.value() >= (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator>=(int i, const QFixed &f) { return (i<<6) >= f.value(); }
+Q_DECL_CONSTEXPR inline bool operator<(const QFixed &f, int i) { return f.value() < (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); }
+Q_DECL_CONSTEXPR inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); }
+Q_DECL_CONSTEXPR inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); }
#ifndef QT_NO_DEBUG_STREAM
inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
@@ -189,29 +191,28 @@ inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
struct QFixedPoint {
QFixed x;
QFixed y;
- inline QFixedPoint() {}
- inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {}
- QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
- static QFixedPoint fromPointF(const QPointF &p) {
+ Q_DECL_CONSTEXPR inline QFixedPoint() {}
+ Q_DECL_CONSTEXPR inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {}
+ Q_DECL_CONSTEXPR QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
+ Q_DECL_CONSTEXPR static QFixedPoint fromPointF(const QPointF &p) {
return QFixedPoint(QFixed::fromReal(p.x()), QFixed::fromReal(p.y()));
}
};
Q_DECLARE_TYPEINFO(QFixedPoint, Q_PRIMITIVE_TYPE);
-inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2)
+Q_DECL_CONSTEXPR inline QFixedPoint operator-(const QFixedPoint &p1, const QFixedPoint &p2)
{ return QFixedPoint(p1.x - p2.x, p1.y - p2.y); }
-inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2)
+Q_DECL_CONSTEXPR inline QFixedPoint operator+(const QFixedPoint &p1, const QFixedPoint &p2)
{ return QFixedPoint(p1.x + p2.x, p1.y + p2.y); }
struct QFixedSize {
QFixed width;
QFixed height;
- QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); }
- static QFixedSize fromSizeF(const QSizeF &s) {
- QFixedSize size;
- size.width = QFixed::fromReal(s.width());
- size.height = QFixed::fromReal(s.height());
- return size;
+ Q_DECL_CONSTEXPR QFixedSize() {}
+ Q_DECL_CONSTEXPR QFixedSize(QFixed _width, QFixed _height) : width(_width), height(_height) {}
+ Q_DECL_CONSTEXPR QSizeF toSizeF() const { return QSizeF(width.toReal(), height.toReal()); }
+ Q_DECL_CONSTEXPR static QFixedSize fromSizeF(const QSizeF &s) {
+ return QFixedSize(QFixed::fromReal(s.width()), QFixed::fromReal(s.height()));
}
};
Q_DECLARE_TYPEINFO(QFixedSize, Q_PRIMITIVE_TYPE);
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index b6966b12c3..8d05eb56ff 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -985,7 +985,6 @@ QDataStream &operator>>(QDataStream &s, QPen &p)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPen &p)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
const char *PEN_STYLES[] = {
"NoPen",
"SolidLine",
@@ -1002,11 +1001,6 @@ QDebug operator<<(QDebug dbg, const QPen &p)
<< ',' << p.dashOffset()
<< ',' << p.miterLimit() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QPen to QDebug");
- return dbg;
- Q_UNUSED(p);
-#endif
}
#endif
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index 3a4860a559..ee1f7967cb 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -468,17 +468,11 @@ QRect QPolygon::boundingRect() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygon &a)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QPolygon(";
for (int i = 0; i < a.count(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QPolygon to QDebug");
- return dbg;
- Q_UNUSED(a);
-#endif
}
#endif
@@ -814,17 +808,11 @@ QDataStream &operator>>(QDataStream &s, QPolygonF &a)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPolygonF &a)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QPolygonF(";
for (int i = 0; i < a.count(); ++i)
dbg.nospace() << a.at(i);
dbg.nospace() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QPolygonF to QDebug");
- return dbg;
- Q_UNUSED(a);
-#endif
}
#endif
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index 7bf2a631ea..86de48b1dc 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -239,7 +239,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn int QAbstractTextDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const
- Returns the cursor postion for the given \a point with the specified
+ Returns the cursor position for the given \a point with the specified
\a accuracy. Returns -1 if no valid cursor position was found.
*/
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 38070458b7..fd01934eae 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -1272,11 +1272,9 @@ void ValueExtractor::extractFont()
extractFont(&f, &dummy);
}
-bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size)
+bool ValueExtractor::extractImage(QCss::IconValue *icon, Qt::Alignment *a, QSize *size)
{
bool hit = false;
-#if 0
- // ### Qt5
for (int i = 0; i < declarations.count(); ++i) {
const Declaration &decl = declarations.at(i);
switch (decl.d->propertyId) {
@@ -1297,7 +1295,6 @@ bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size)
}
hit = true;
}
-#endif
return hit;
}
@@ -1646,30 +1643,27 @@ void Declaration::borderImageValue(QString *image, int *cuts,
*h = *v;
}
-#if 0
-// ### Qt 5
-QIcon Declaration::iconValue() const
+IconValue Declaration::iconValue() const
{
if (d->parsed.isValid())
- return qvariant_cast<QIcon>(d->parsed);
+ return qvariant_cast<IconValue>(d->parsed);
- QIcon icon;
+ IconValue icon;
for (int i = 0; i < d->values.count();) {
const Value &value = d->values.at(i++);
if (value.type != Value::Uri)
break;
- QString uri = value.variant.toString();
- QIcon::Mode mode = QIcon::Normal;
- QIcon::State state = QIcon::Off;
+ IconValue::IconEntry entry;
+ entry.uri = value.variant.toString();
for (int j = 0; j < 2; j++) {
if (i != d->values.count() && d->values.at(i).type == Value::KnownIdentifier) {
switch (d->values.at(i).variant.toInt()) {
- case Value_Disabled: mode = QIcon::Disabled; break;
- case Value_Active: mode = QIcon::Active; break;
- case Value_Selected: mode = QIcon::Selected; break;
- case Value_Normal: mode = QIcon::Normal; break;
- case Value_On: state = QIcon::On; break;
- case Value_Off: state = QIcon::Off; break;
+ case Value_Disabled: entry.mode = IconValue::Disabled; break;
+ case Value_Active: entry.mode = IconValue::Active; break;
+ case Value_Selected: entry.mode = IconValue::Selected; break;
+ case Value_Normal: entry.mode = IconValue::Normal; break;
+ case Value_On: entry.state = IconValue::On; break;
+ case Value_Off: entry.state = IconValue::Off; break;
default: break;
}
++i;
@@ -1677,12 +1671,7 @@ QIcon Declaration::iconValue() const
break;
}
}
-
- // QIcon is soo broken
- if (icon.isNull())
- icon = QIcon(uri);
- else
- icon.addPixmap(uri, mode, state);
+ icon.entries.push_back(entry);
if (i == d->values.count())
break;
@@ -1691,10 +1680,9 @@ QIcon Declaration::iconValue() const
i++;
}
- d->parsed = QVariant::fromValue<QIcon>(icon);
+ d->parsed = QVariant::fromValue<QCss::IconValue>(icon);
return icon;
}
-#endif
///////////////////////////////////////////////////////////////////////////////
// Selector
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index d50b87dcd5..b19fd8326e 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -411,6 +411,22 @@ struct BorderData {
BrushData color;
};
+struct Q_GUI_EXPORT IconValue
+{
+ enum Mode { Normal, Disabled, Active, Selected }; // In sync with QIcon.
+ enum State { On, Off };
+
+ struct Q_GUI_EXPORT IconEntry
+ {
+ IconEntry() : mode(Normal) , state(On) {}
+
+ Mode mode;
+ State state;
+ QString uri;
+ };
+
+ QList<IconEntry> entries;
+};
// 1. StyleRule - x:hover, y:clicked > z:checked { prop1: value1; prop2: value2; }
// 2. QVector<Selector> - x:hover, y:clicked z:checked
@@ -455,7 +471,7 @@ struct Q_GUI_EXPORT Declaration
QSize sizeValue() const;
QRect rectValue() const;
QString uriValue() const;
-// QIcon iconValue() const;
+ IconValue iconValue() const;
void borderImageValue(QString *image, int *cuts, TileMode *h, TileMode *v) const;
};
@@ -582,7 +598,7 @@ struct Q_GUI_EXPORT ValueExtractor
bool extractOutline(int *borders, QBrush *colors, BorderStyle *Styles, QSize *radii, int *offsets);
bool extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg);
int extractStyleFeatures();
- bool extractImage(QIcon *icon, Qt::Alignment *a, QSize *size);
+ bool extractImage(QCss::IconValue *icon, Qt::Alignment *a, QSize *size);
int lengthValue(const Declaration &decl);
@@ -842,6 +858,7 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE( QCss::BackgroundData )
Q_DECLARE_METATYPE( QCss::LengthData )
Q_DECLARE_METATYPE( QCss::BorderData )
+Q_DECLARE_METATYPE( QCss::IconValue )
#endif // QT_NO_CSSPARSER
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index bc7f4f7ad6..c63f0fede8 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -115,7 +115,20 @@ private:
return;
const int end = start + length;
for (int i = start + 1; i < end; ++i) {
- if ((m_analysis[i] == m_analysis[start])
+ // According to the unicode spec we should be treating characters in the Common script
+ // (punctuation, spaces, etc) as being the same script as the surrounding text for the
+ // purpose of splitting up text. This is important because, for example, a fullstop
+ // (0x2E) can be used to indicate an abbreviation and so must be treated as part of a
+ // word. Thus it must be passed along with the word in languages that have to calculate
+ // word breaks. For example the thai word "ครม." has no word breaks but the word "ครม"
+ // does.
+ // Unfortuntely because we split up the strings for both wordwrapping and for setting
+ // the font and because Japanese and Chinese are also aliases of the script "Common",
+ // doing this would break too many things. So instead we only pass the full stop
+ // along, and nothing else.
+ if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel
+ && m_analysis[i].flags == m_analysis[start].flags
+ && (m_analysis[i].script == m_analysis[start].script || m_string[i] == QLatin1Char('.'))
&& m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject
&& i - start < MaxItemLength)
continue;
@@ -2689,6 +2702,8 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos);
// the approximate width of each individual element of the ligature
QFixed perItemWidth = glyphWidth / clusterLength;
+ if (perItemWidth <= 0)
+ return si->position + clusterStart;
QFixed left = x > edge ? edge : edge - glyphWidth;
int n = ((x - left) / perItemWidth).floor().toInt();
QFixed dist = x - left - n * perItemWidth;
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index acb8d70d09..224ef9db8f 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -95,9 +95,9 @@
#include "qsslsocket.h"
#ifndef QT_NO_DEBUG_STREAM
#include <QtCore/qdebug.h>
+#endif
QT_BEGIN_NAMESPACE
-#endif
class QSslErrorPrivate
{
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index f62f3c1229..20ad82407c 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1384,6 +1384,10 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi
return errors;
}
+ if (s_loadRootCertsOnDemand) {
+ setDefaultCaCertificates(defaultCaCertificates() + systemCaCertificates());
+ }
+
QList<QSslCertificate> expiredCerts;
foreach (const QSslCertificate &caCertificate, QSslSocket::defaultCaCertificates()) {
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 836e7225be..31d6064e90 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4680,7 +4680,7 @@ QPaintEngine *QGLWidget::paintEngine() const
return qt_qgl_paint_engine();
}
-typedef GLubyte * (*qt_glGetStringi)(GLenum, GLuint);
+typedef const GLubyte * (QGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
#ifndef GL_NUM_EXTENSIONS
#define GL_NUM_EXTENSIONS 0x821D
diff --git a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
index 2c896ef2cc..af9bd0a01c 100644
--- a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
+++ b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
@@ -1,5 +1,5 @@
HEADERS += $$PWD/qfontconfigdatabase_p.h \
- fontdatabases/fontconfig/qfontenginemultifontconfig_p.h
+ $$PWD/qfontenginemultifontconfig_p.h
SOURCES += $$PWD/qfontconfigdatabase.cpp \
- fontdatabases/fontconfig/qfontenginemultifontconfig.cpp
+ $$PWD/qfontenginemultifontconfig.cpp
DEFINES -= QT_NO_FONTCONFIG
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index a9f05f6084..257fe9156f 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -89,12 +89,15 @@ QVariant QGenericUnixTheme::themeHint(ThemeHint hint) const
return QVariant(QString(QStringLiteral("hicolor")));
case QPlatformTheme::IconThemeSearchPaths:
return xdgIconThemePaths();
+ case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
+ return QVariant(true);
case QPlatformTheme::StyleNames: {
QStringList styleNames;
styleNames << QStringLiteral("Plastique") << QStringLiteral("Windows");
return QVariant(styleNames);
}
- break;
+ case QPlatformTheme::KeyboardScheme:
+ return QVariant(int(X11KeyboardScheme));
default:
break;
}
@@ -229,6 +232,12 @@ static QStringList kdeIconThemeSearchPaths(const QString &kdeHome)
QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
{
switch (hint) {
+ case QPlatformTheme::UseFullScreenForPopupMenu:
+ return QVariant(true);
+ case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
+ return QVariant(true);
+ case QPlatformTheme::DialogButtonBoxLayout:
+ return QVariant(2); // QDialogButtonBox::KdeLayout
case QPlatformTheme::ToolButtonStyle:
return QVariant(m_toolButtonStyle);
case QPlatformTheme::ToolBarIconSize:
@@ -241,6 +250,8 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(kdeIconThemeSearchPaths(m_kdeHome));
case QPlatformTheme::StyleNames:
return QVariant(m_styleNames);
+ case QPlatformTheme::KeyboardScheme:
+ return QVariant(int(KdeKeyboardScheme));
default:
break;
}
@@ -282,6 +293,10 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
{
switch (hint) {
+ case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
+ return QVariant(true);
+ case QPlatformTheme::DialogButtonBoxLayout:
+ return QVariant(3); // QDialogButtonBox::GnomeLayout
case QPlatformTheme::SystemIconThemeName:
case QPlatformTheme::SystemIconFallbackThemeName:
return QVariant(QString(QStringLiteral("gnome")));
@@ -292,6 +307,8 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
styleNames << QStringLiteral("GTK+") << QStringLiteral("cleanlooks") << QStringLiteral("windows");
return QVariant(styleNames);
}
+ case QPlatformTheme::KeyboardScheme:
+ return QVariant(int(GnomeKeyboardScheme));
default:
break;
}
diff --git a/src/platformsupport/udev/qudevhelper_p.h b/src/platformsupport/udev/qudevhelper_p.h
index e6046ca085..3895da87b6 100644
--- a/src/platformsupport/udev/qudevhelper_p.h
+++ b/src/platformsupport/udev/qudevhelper_p.h
@@ -43,6 +43,7 @@
#define QUDEVHELPER_P_H
#include <QString>
+#include <QObject>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/udev/qudevicehelper.cpp b/src/platformsupport/udev/qudevicehelper.cpp
new file mode 100644
index 0000000000..bf3ce67b43
--- /dev/null
+++ b/src/platformsupport/udev/qudevicehelper.cpp
@@ -0,0 +1,235 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 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 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qudevicehelper_p.h"
+
+#include <QStringList>
+#include <QCoreApplication>
+#include <QObject>
+#include <QHash>
+#include <QSocketNotifier>
+
+#include <linux/input.h>
+
+//#define QT_QPA_UDEVICE_HELPER_DEBUG
+
+#ifdef QT_QPA_UDEVICE_HELPER_DEBUG
+#include <QtDebug>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QUDeviceHelper *QUDeviceHelper::createUDeviceHelper(QUDeviceTypes types, QObject *parent)
+{
+#ifdef QT_QPA_UDEVICE_HELPER_DEBUG
+ qWarning() << "Try to create new UDeviceHelper";
+#endif
+
+ QUDeviceHelper *helper = 0;
+ struct udev *udev;
+
+ udev = udev_new();
+ if (udev) {
+ helper = new QUDeviceHelper(types, udev, parent);
+ } else {
+ qWarning("Failed to get udev library context.");
+ }
+
+ return helper;
+}
+
+QUDeviceHelper::QUDeviceHelper(QUDeviceTypes types, struct udev *udev, QObject *parent) :
+ QObject(parent),
+ m_udev(udev), m_types(types), m_udevMonitor(0), m_udevMonitorFileDescriptor(-1), m_udevSocketNotifier(0)
+{
+#ifdef QT_QPA_UDEVICE_HELPER_DEBUG
+ qWarning() << "New UDeviceHelper created for type" << types;
+#endif
+
+ if (!m_udev)
+ return;
+
+ m_udevMonitor = udev_monitor_new_from_netlink(m_udev, "udev");
+ if (!m_udevMonitor) {
+#ifdef QT_QPA_UDEVICE_HELPER_DEBUG
+ qWarning("Unable to create an Udev monitor. No devices can be detected.");
+#endif
+ return;
+ }
+
+ udev_monitor_filter_add_match_subsystem_devtype(m_udevMonitor, "input", 0);
+ udev_monitor_enable_receiving(m_udevMonitor);
+ m_udevMonitorFileDescriptor = udev_monitor_get_fd(m_udevMonitor);
+
+ m_udevSocketNotifier = new QSocketNotifier(m_udevMonitorFileDescriptor, QSocketNotifier::Read, this);
+ connect(m_udevSocketNotifier, SIGNAL(activated(int)), this, SLOT(handleUDevNotification()));
+}
+
+QUDeviceHelper::~QUDeviceHelper()
+{
+ if (m_udevMonitor)
+ udev_monitor_unref(m_udevMonitor);
+
+ if (m_udev)
+ udev_unref(m_udev);
+}
+
+QStringList QUDeviceHelper::scanConnectedDevices()
+{
+ QStringList devices;
+
+ if (!m_udev)
+ return devices;
+
+ udev_enumerate *ue = udev_enumerate_new(m_udev);
+ udev_enumerate_add_match_subsystem(ue, "input");
+
+ if (m_types & UDev_Mouse)
+ udev_enumerate_add_match_property(ue, "ID_INPUT_MOUSE", "1");
+ if (m_types & UDev_Touchpad)
+ udev_enumerate_add_match_property(ue, "ID_INPUT_TOUCHPAD", "1");
+ if (m_types & UDev_Touchscreen)
+ udev_enumerate_add_match_property(ue, "ID_INPUT_TOUCHSCREEN", "1");
+ if (m_types & UDev_Keyboard)
+ udev_enumerate_add_match_property(ue, "ID_INPUT_KEYBOARD", "1");
+
+ if (udev_enumerate_scan_devices(ue) != 0) {
+#ifdef QT_QPA_UDEVICE_HELPER_DEBUG
+ qWarning() << "UDeviceHelper scan connected devices for enumeration failed";
+#endif
+ return devices;
+ }
+
+ udev_list_entry *entry;
+ udev_list_entry_foreach (entry, udev_enumerate_get_list_entry(ue)) {
+ const char *syspath = udev_list_entry_get_name(entry);
+ udev_device *udevice = udev_device_new_from_syspath(m_udev, syspath);
+ QString candidate = QString::fromUtf8(udev_device_get_devnode(udevice));
+ if (candidate.startsWith(QLatin1String("/dev/input/event")))
+ devices << candidate;
+
+ udev_device_unref(udevice);
+ }
+ udev_enumerate_unref(ue);
+
+#ifdef QT_QPA_UDEVICE_HELPER_DEBUG
+ qWarning() << "UDeviceHelper found matching devices" << devices;
+#endif
+
+ return devices;
+}
+
+void QUDeviceHelper::handleUDevNotification()
+{
+ if (!m_udevMonitor)
+ return;
+
+ struct udev_device *dev;
+ QString devNode;
+ QUDeviceTypes types = QFlag(UDev_Unknown);
+
+ dev = udev_monitor_receive_device(m_udevMonitor);
+ if (!dev)
+ goto cleanup;
+
+ const char *action;
+ action = udev_device_get_action(dev);
+ if (!action)
+ goto cleanup;
+
+ const char *str;
+ str = udev_device_get_devnode(dev);
+ if (!str)
+ goto cleanup;
+
+ devNode = QString::fromUtf8(str);
+ if (!devNode.startsWith(QLatin1String("/dev/input/event")))
+ goto cleanup;
+
+ // does not increase the refcount
+ dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", 0);
+ if (!dev)
+ goto cleanup;
+
+ types = checkDeviceType(dev);
+
+ if (types && (qstrcmp(action, "add") == 0))
+ emit deviceDetected(devNode, types);
+
+ if (types && (qstrcmp(action, "remove") == 0))
+ emit deviceRemoved(devNode, types);
+
+cleanup:
+ udev_device_unref(dev);
+}
+
+QUDeviceHelper::QUDeviceTypes QUDeviceHelper::checkDeviceType(udev_device *dev)
+{
+ QUDeviceTypes types = QFlag(UDev_Unknown);
+
+ if ((m_types & UDev_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )) {
+ const char *capabilities_key = udev_device_get_sysattr_value(dev, "capabilities/key");
+ QStringList val = QString::fromUtf8(capabilities_key).split(QString::fromUtf8(" "), QString::SkipEmptyParts);
+ if (!val.isEmpty()) {
+ bool ok;
+ unsigned long long keys = val.last().toULongLong(&ok, 16);
+ if (ok) {
+ // Tests if the letter Q is valid for the device. We may want to alter this test, but it seems mostly reliable.
+ bool test = (keys >> KEY_Q) & 1;
+ if (test)
+ types |= UDev_Keyboard;
+ }
+ }
+ }
+
+ if ((m_types & UDev_Mouse) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0))
+ types |= UDev_Mouse;
+
+ if ((m_types & UDev_Touchpad) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"), "1") == 0))
+ types |= UDev_Touchpad;
+
+ if ((m_types & UDev_Touchscreen) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"), "1") == 0))
+ types |= UDev_Touchscreen;
+
+ return types;
+}
+
+QT_END_NAMESPACE
diff --git a/src/platformsupport/udev/qudevicehelper_p.h b/src/platformsupport/udev/qudevicehelper_p.h
new file mode 100644
index 0000000000..b7544fa6c2
--- /dev/null
+++ b/src/platformsupport/udev/qudevicehelper_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 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 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUDEVICEHELPER_H
+#define QUDEVICEHELPER_H
+
+#include <QObject>
+#include <QSocketNotifier>
+
+#include <libudev.h>
+
+QT_BEGIN_NAMESPACE
+
+class QUDeviceHelper : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(QUDeviceType)
+
+public:
+ enum QUDeviceType {
+ UDev_Unknown = 0x00,
+ UDev_Mouse = 0x01,
+ UDev_Touchpad = 0x02,
+ UDev_Touchscreen = 0x04,
+ UDev_Keyboard = 0x08
+ };
+ Q_DECLARE_FLAGS(QUDeviceTypes, QUDeviceType)
+
+ static QUDeviceHelper *createUDeviceHelper(QUDeviceTypes type, QObject *parent);
+ ~QUDeviceHelper();
+
+ QStringList scanConnectedDevices();
+
+signals:
+ void deviceDetected(const QString &deviceNode, QUDeviceTypes types);
+ void deviceRemoved(const QString &deviceNode, QUDeviceTypes types);
+
+private slots:
+ void handleUDevNotification();
+
+private:
+ QUDeviceHelper(QUDeviceTypes types, struct udev *udev, QObject *parent = 0);
+
+ void startWatching();
+ void stopWatching();
+
+ QUDeviceTypes checkDeviceType(struct udev_device *dev);
+
+ struct udev *m_udev;
+ QUDeviceTypes m_types;
+ struct udev_monitor *m_udevMonitor;
+ int m_udevMonitorFileDescriptor;
+ QSocketNotifier *m_udevSocketNotifier;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QUDeviceHelper::QUDeviceTypes)
+
+QT_END_NAMESPACE
+
+#endif // QUDEVICEHELPER_H
diff --git a/src/platformsupport/udev/udev.pri b/src/platformsupport/udev/udev.pri
index ac3f7df40a..48ad9d36af 100644
--- a/src/platformsupport/udev/udev.pri
+++ b/src/platformsupport/udev/udev.pri
@@ -1,5 +1,5 @@
contains(QT_CONFIG, libudev) {
- HEADERS += $$PWD/qudevhelper_p.h
- SOURCES += $$PWD/qudevhelper.cpp
+ HEADERS += $$PWD/qudevhelper_p.h $$PWD/qudevicehelper_p.h
+ SOURCES += $$PWD/qudevhelper.cpp $$PWD/qudevicehelper.cpp
LIBS += -ludev
}
diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp
index dfa9594d5b..ca8bf816b6 100644
--- a/src/plugins/accessible/widgets/main.cpp
+++ b/src/plugins/accessible/widgets/main.cpp
@@ -61,6 +61,9 @@ QT_BEGIN_NAMESPACE
class AccessibleFactory : public QAccessiblePlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QAccessibleFactoryInterface" FILE "widgets.json")
+
public:
AccessibleFactory();
@@ -109,7 +112,6 @@ QStringList AccessibleFactory::keys() const
list << QLatin1String("QStatusBar");
list << QLatin1String("QProgressBar");
list << QLatin1String("QMenuBar");
- list << QLatin1String("Q3PopupMenu");
list << QLatin1String("QMenu");
list << QLatin1String("QHeaderView");
list << QLatin1String("QTabBar");
@@ -251,8 +253,6 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
#ifndef QT_NO_MENU
} else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget);
- } else if (classname == QLatin1String("Q3PopupMenu")) {
- iface = new QAccessibleMenu(widget);
#endif
#ifndef QT_NO_ITEMVIEWS
} else if (classname == QLatin1String("QAbstractItemView")) {
@@ -345,9 +345,9 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
return iface;
}
-Q_EXPORT_STATIC_PLUGIN(AccessibleFactory)
-Q_EXPORT_PLUGIN2(qtaccessiblewidgets, AccessibleFactory)
QT_END_NAMESPACE
+#include "main.moc"
+
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index 0fdd4490f7..39d7e03a1b 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -115,7 +115,7 @@ QString QAccessibleButton::text(QAccessible::Text t) const
#ifndef QT_NO_SHORTCUT
QPushButton *pb = qobject_cast<QPushButton*>(object());
if (pb && pb->isDefault())
- str = (QString)QKeySequence(Qt::Key_Enter);
+ str = QKeySequence(Qt::Key_Enter).toString(QKeySequence::NativeText);
#endif
if (str.isEmpty())
str = qt_accHotKey(button()->text());
diff --git a/src/plugins/accessible/widgets/widgets.json b/src/plugins/accessible/widgets/widgets.json
new file mode 100644
index 0000000000..fdeb6f2b52
--- /dev/null
+++ b/src/plugins/accessible/widgets/widgets.json
@@ -0,0 +1,52 @@
+{
+ "Keys": [
+ "QLineEdit",
+ "QComboBox",
+ "QAbstractSpinBox",
+ "QSpinBox",
+ "QDoubleSpinBox",
+ "QScrollBar",
+ "QSlider",
+ "QAbstractSlider",
+ "QToolButton",
+ "QCheckBox",
+ "QRadioButton",
+ "QPushButton",
+ "QAbstractButton",
+ "QDialog",
+ "QMessageBox",
+ "QMainWindow",
+ "QLabel",
+ "QLCDNumber",
+ "QGroupBox",
+ "QStatusBar",
+ "QProgressBar",
+ "QMenuBar",
+ "QMenu",
+ "QHeaderView",
+ "QTabBar",
+ "QToolBar",
+ "QWorkspaceChild",
+ "QSizeGrip",
+ "QAbstractItemView",
+ "QWidget",
+ "QSplitter",
+ "QSplitterHandle",
+ "QTextEdit",
+ "QTipLabel",
+ "QFrame",
+ "QStackedWidget",
+ "QToolBox",
+ "QMdiArea",
+ "QMdiSubWindow",
+ "QWorkspace",
+ "QDialogButtonBox",
+ "QDial",
+ "QRubberBand",
+ "QTextBrowser",
+ "QAbstractScrollArea",
+ "QScrollArea",
+ "QCalendarWidget",
+ "QDockWidget",
+ "QAccessibleWidget" ]
+}
diff --git a/src/plugins/bearer/connman/connman.json b/src/plugins/bearer/connman/connman.json
new file mode 100644
index 0000000000..7a80b8c9be
--- /dev/null
+++ b/src/plugins/bearer/connman/connman.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "connman" ]
+}
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index 25243f8e0a..679637b37f 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -15,6 +15,8 @@ SOURCES += main.cpp \
qconnmanengine.cpp \
../qnetworksession_impl.cpp
+OTHER_FILES += connman.json
+
DESTDIR = $$QT.network.plugins/bearer
target.path += $$[QT_INSTALL_PLUGINS]/bearer
INSTALLS += target
diff --git a/src/plugins/bearer/connman/main.cpp b/src/plugins/bearer/connman/main.cpp
index f612f0ca9f..be934c72