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..be934c7282 100644
--- a/src/plugins/bearer/connman/main.cpp
+++ b/src/plugins/bearer/connman/main.cpp
@@ -51,6 +51,9 @@ QT_BEGIN_NAMESPACE
class QConnmanEnginePlugin : public QBearerEnginePlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "connman.json")
+
public:
QConnmanEnginePlugin();
~QConnmanEnginePlugin();
@@ -84,10 +87,9 @@ QBearerEngine *QConnmanEnginePlugin::create(const QString &key) const
return 0;
}
-Q_EXPORT_STATIC_PLUGIN(QConnmanEnginePlugin)
-Q_EXPORT_PLUGIN2(qconnmanbearer, QConnmanEnginePlugin)
-
QT_END_NAMESPACE
+#include "main.moc"
+
#endif
#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/corewlan/corewlan.json b/src/plugins/bearer/corewlan/corewlan.json
new file mode 100644
index 0000000000..b43519ea90
--- /dev/null
+++ b/src/plugins/bearer/corewlan/corewlan.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "corewlan" ]
+}
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index 6a214ac340..82a514fb14 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -19,6 +19,8 @@ SOURCES += main.cpp \
OBJECTIVE_SOURCES += qcorewlanengine.mm
+OTHER_FILES += corewlan.json
+
DESTDIR = $$QT.network.plugins/bearer
target.path += $$[QT_INSTALL_PLUGINS]/bearer
INSTALLS += target
diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp
index 0f5ad2c7fb..f2ba8bd879 100644
--- a/src/plugins/bearer/corewlan/main.cpp
+++ b/src/plugins/bearer/corewlan/main.cpp
@@ -51,6 +51,9 @@ QT_BEGIN_NAMESPACE
class QCoreWlanEnginePlugin : public QBearerEnginePlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "corewlan.json")
+
public:
QCoreWlanEnginePlugin();
~QCoreWlanEnginePlugin();
@@ -80,9 +83,8 @@ QBearerEngine *QCoreWlanEnginePlugin::create(const QString &key) const
return 0;
}
-Q_EXPORT_STATIC_PLUGIN(QCoreWlanEnginePlugin)
-Q_EXPORT_PLUGIN2(qcorewlanbearer, QCoreWlanEnginePlugin)
-
QT_END_NAMESPACE
+#include "main.moc"
+
#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/generic/generic.json b/src/plugins/bearer/generic/generic.json
new file mode 100644
index 0000000000..e9357f4c72
--- /dev/null
+++ b/src/plugins/bearer/generic/generic.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "generic" ]
+}
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
index 4f86c2a38c..e66c5b2c7a 100644
--- a/src/plugins/bearer/generic/generic.pro
+++ b/src/plugins/bearer/generic/generic.pro
@@ -11,6 +11,8 @@ SOURCES += qgenericengine.cpp \
../qnetworksession_impl.cpp \
main.cpp
+OTHER_FILES += generic.json
+
DESTDIR = $$QT.network.plugins/bearer
target.path += $$[QT_INSTALL_PLUGINS]/bearer
INSTALLS += target
diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp
index 0311bcbef0..5f5ad7c238 100644
--- a/src/plugins/bearer/generic/main.cpp
+++ b/src/plugins/bearer/generic/main.cpp
@@ -51,6 +51,9 @@ QT_BEGIN_NAMESPACE
class QGenericEnginePlugin : public QBearerEnginePlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "generic.json")
+
public:
QGenericEnginePlugin();
~QGenericEnginePlugin();
@@ -80,9 +83,8 @@ QBearerEngine *QGenericEnginePlugin::create(const QString &key) const
return 0;
}
-Q_EXPORT_STATIC_PLUGIN(QGenericEnginePlugin)
-Q_EXPORT_PLUGIN2(qgenericbearer, QGenericEnginePlugin)
-
QT_END_NAMESPACE
+#include "main.moc"
+
#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp
index 74129c1d0a..8baa977a9d 100644
--- a/src/plugins/bearer/nativewifi/main.cpp
+++ b/src/plugins/bearer/nativewifi/main.cpp
@@ -92,6 +92,9 @@ static void resolveLibrary()
class QNativeWifiEnginePlugin : public QBearerEnginePlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "nativewifi.json")
+
public:
QNativeWifiEnginePlugin();
~QNativeWifiEnginePlugin();
@@ -135,9 +138,8 @@ QBearerEngine *QNativeWifiEnginePlugin::create(const QString &key) const
return engine;
}
-Q_EXPORT_STATIC_PLUGIN(QNativeWifiEnginePlugin)
-Q_EXPORT_PLUGIN2(qnativewifibearer, QNativeWifiEnginePlugin)
-
QT_END_NAMESPACE
+#include "main.moc"
+
#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/nativewifi/nativewifi.json b/src/plugins/bearer/nativewifi/nativewifi.json
new file mode 100644
index 0000000000..f3db199150
--- /dev/null
+++ b/src/plugins/bearer/nativewifi/nativewifi.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "nativewifi" ]
+}
diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro
index ec86cc0b93..3124d58ff2 100644
--- a/src/plugins/bearer/nativewifi/nativewifi.pro
+++ b/src/plugins/bearer/nativewifi/nativewifi.pro
@@ -12,6 +12,8 @@ SOURCES += main.cpp \
qnativewifiengine.cpp \
../qnetworksession_impl.cpp
+OTHER_FILES += nativewifi.json
+
DESTDIR = $$QT.network.plugins/bearer
target.path += $$[QT_INSTALL_PLUGINS]/bearer
INSTALLS += target
diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp
index 2278d221fd..c8a8a74e46 100644
--- a/src/plugins/bearer/networkmanager/main.cpp
+++ b/src/plugins/bearer/networkmanager/main.cpp
@@ -52,6 +52,9 @@ QT_BEGIN_NAMESPACE
class QNetworkManagerEnginePlugin : public QBearerEnginePlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "networkmanager.json")
+
public:
QNetworkManagerEnginePlugin();
~QNetworkManagerEnginePlugin();
@@ -86,10 +89,9 @@ QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const
return 0;
}
-Q_EXPORT_STATIC_PLUGIN(QNetworkManagerEnginePlugin)
-Q_EXPORT_PLUGIN2(qnmbearer, QNetworkManagerEnginePlugin)
-
QT_END_NAMESPACE
+#include "main.moc"
+
#endif // QT_NO_DBUS
#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/networkmanager/networkmanager.json b/src/plugins/bearer/networkmanager/networkmanager.json
new file mode 100644
index 0000000000..3d408d5c20
--- /dev/null
+++ b/src/plugins/bearer/networkmanager/networkmanager.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "networkmanager" ]
+}
diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro
index 262f60a69c..c1c6664897 100644
--- a/src/plugins/bearer/networkmanager/networkmanager.pro
+++ b/src/plugins/bearer/networkmanager/networkmanager.pro
@@ -15,6 +15,8 @@ SOURCES += main.cpp \
qnetworkmanagerengine.cpp \
../qnetworksession_impl.cpp
+OTHER_FILES += networkmanager.json
+
DESTDIR = $$QT.network.plugins/bearer
target.path += $$[QT_INSTALL_PLUGINS]/bearer
INSTALLS += target
diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp
index 4337c1748a..4a2c915d13 100644
--- a/src/plugins/bearer/nla/main.cpp
+++ b/src/plugins/bearer/nla/main.cpp
@@ -49,6 +49,9 @@ QT_BEGIN_NAMESPACE
class QNlaEnginePlugin : public QBearerEnginePlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "nla.json")
+
public:
QNlaEnginePlugin();
~QNlaEnginePlugin();
@@ -78,7 +81,6 @@ QBearerEngine *QNlaEnginePlugin::create(const QString &key) const
return 0;
}
-Q_EXPORT_STATIC_PLUGIN(QNlaEnginePlugin)
-Q_EXPORT_PLUGIN2(qnlabearer, QNlaEnginePlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/bearer/nla/nla.json b/src/plugins/bearer/nla/nla.json
new file mode 100644
index 0000000000..2554d2c5c4
--- /dev/null
+++ b/src/plugins/bearer/nla/nla.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "nla" ]
+}
diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro
index 76da098dbf..5444269f1f 100644
--- a/src/plugins/bearer/nla/nla.pro
+++ b/src/plugins/bearer/nla/nla.pro
@@ -1,7 +1,7 @@
TARGET = qnlabearer
load(qt_plugin)
-QT = core network
+QT = core core-private network network-private
!wince* {
LIBS += -lWs2_32
@@ -18,6 +18,8 @@ SOURCES += main.cpp \
qnlaengine.cpp \
../qnetworksession_impl.cpp
+OTHER_FILES += nla.json
+
DESTDIR = $$QT.network.plugins/bearer
target.path += $$[QT_INSTALL_PLUGINS]/bearer
INSTALLS += target
diff --git a/src/plugins/generic/evdevkeyboard/evdevkeyboard.json b/src/plugins/generic/evdevkeyboard/evdevkeyboard.json
new file mode 100644
index 0000000000..0e24bb0568
--- /dev/null
+++ b/src/plugins/generic/evdevkeyboard/evdevkeyboard.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "EvdevKeyboard" ]
+}
diff --git a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
index 997a58ef6e..82edf170a8 100644
--- a/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
+++ b/src/plugins/generic/evdevkeyboard/evdevkeyboard.pro
@@ -10,10 +10,13 @@ HEADERS = \
qevdevkeyboardhandler.h \
qevdevkeyboardmanager.h
-QT += core-private
+QT += core-private platformsupport-private
LIBS += -ludev
SOURCES = main.cpp \
qevdevkeyboardhandler.cpp \
qevdevkeyboardmanager.cpp
+
+OTHER_FILES += \
+ evdevkeyboard.json
diff --git a/src/plugins/generic/evdevkeyboard/main.cpp b/src/plugins/generic/evdevkeyboard/main.cpp
index 6df4e29fcb..71d15720bd 100644
--- a/src/plugins/generic/evdevkeyboard/main.cpp
+++ b/src/plugins/generic/evdevkeyboard/main.cpp
@@ -46,6 +46,9 @@ QT_BEGIN_NAMESPACE
class QEvdevKeyboardPlugin : public QGenericPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "evdevkeyboard.json")
+
public:
QEvdevKeyboardPlugin();
@@ -72,6 +75,6 @@ QObject* QEvdevKeyboardPlugin::create(const QString &key,
return 0;
}
-Q_EXPORT_PLUGIN2(qevdevkeyboardplugin, QEvdevKeyboardPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp
index cb23d3a49c..0938fdc2e4 100644
--- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp
+++ b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp
@@ -42,28 +42,27 @@
#include "qevdevkeyboardmanager.h"
#include <QStringList>
-#include <QDebug>
#include <QCoreApplication>
-#include <linux/input.h>
-#include <linux/kd.h>
-
//#define QT_QPA_KEYMAP_DEBUG
+#ifdef QT_QPA_KEYMAP_DEBUG
+#include <QDebug>
+#endif
+
QT_BEGIN_NAMESPACE
QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &specification)
- : m_udev(0), m_udevMonitor(0), m_udevMonitorFileDescriptor(-1), m_udevSocketNotifier(0)
{
Q_UNUSED(key);
- bool useUDev = false;
+ bool useUDev = true;
QStringList args = specification.split(QLatin1Char(':'));
QStringList devices;
foreach (const QString &arg, args) {
- if (arg.startsWith("udev") && !arg.contains("no")) {
- useUDev = true;
+ if (arg.startsWith("udev") && arg.contains("no")) {
+ useUDev = false;
} else if (arg.startsWith("/dev/")) {
// if device is specified try to use it
devices.append(arg);
@@ -71,182 +70,69 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
}
}
+ // build new specification without /dev/ elements
m_spec = args.join(":");
// add all keyboards for devices specified in the argument list
foreach (const QString &device, devices)
addKeyboard(device);
- // no udev and no devices specified, try a fallback
- if (!useUDev && devices.isEmpty()) {
- addKeyboard();
- return;
- }
+ if (useUDev) {
+#ifdef QT_QPA_KEYMAP_DEBUG
+ qWarning() << "Use UDev for device discovery";
+#endif
+
+ m_udeviceHelper = QUDeviceHelper::createUDeviceHelper(QUDeviceHelper::UDev_Keyboard, this);
+ if (m_udeviceHelper) {
+ // scan and add already connected keyboards
+ QStringList devices = m_udeviceHelper->scanConnectedDevices();
+ foreach (QString device, devices) {
+ addKeyboard(device);
+ }
- m_udev = udev_new();
- if (!m_udev) {
- qWarning() << "Failed to read udev configuration. Try to open a keyboard without it";
- addKeyboard();
- } else {
- // Look for already attached devices:
- parseConnectedDevices();
- // Watch for device add/remove
- startWatching();
+ connect(m_udeviceHelper, SIGNAL(deviceDetected(QString,QUDeviceTypes)), this, SLOT(addKeyboard(QString)));
+ connect(m_udeviceHelper, SIGNAL(deviceRemoved(QString,QUDeviceTypes)), this, SLOT(removeKeyboard(QString)));
+ }
}
}
QEvdevKeyboardManager::~QEvdevKeyboardManager()
{
- // cleanup udev related resources
- stopWatching();
- if (m_udev)
- udev_unref(m_udev);
-
- // cleanup all resources of connected keyboards
qDeleteAll(m_keyboards);
m_keyboards.clear();
}
-void QEvdevKeyboardManager::addKeyboard(const QString &devnode)
+void QEvdevKeyboardManager::addKeyboard(const QString &deviceNode)
{
+#ifdef QT_QPA_KEYMAP_DEBUG
+ qWarning() << "Adding keyboard at" << deviceNode;
+#endif
+
QString specification = m_spec;
- QString deviceString = devnode;
- if (!deviceString.isEmpty()) {
+ if (!deviceNode.isEmpty()) {
specification.append(":");
- specification.append(deviceString);
- } else {
- deviceString = "default";
+ specification.append(deviceNode);
}
-#ifdef QT_QPA_KEYMAP_DEBUG
- qWarning() << "Adding keyboard at" << deviceString;
-#endif
-
QEvdevKeyboardHandler *keyboard;
keyboard = QEvdevKeyboardHandler::createLinuxInputKeyboardHandler("EvdevKeyboard", specification);
if (keyboard)
- m_keyboards.insert(deviceString, keyboard);
+ m_keyboards.insert(deviceNode, keyboard);
else
- qWarning() << "Failed to open keyboard";
+ qWarning("Failed to open keyboard");
}
-void QEvdevKeyboardManager::removeKeyboard(const QString &devnode)
+void QEvdevKeyboardManager::removeKeyboard(const QString &deviceNode)
{
- if (m_keyboards.contains(devnode)) {
+ if (m_keyboards.contains(deviceNode)) {
#ifdef QT_QPA_KEYMAP_DEBUG
- qWarning() << "Removing keyboard at" << devnode;
+ qWarning() << "Removing keyboard at" << deviceNode;
#endif
- QEvdevKeyboardHandler *keyboard = m_keyboards.value(devnode);
- m_keyboards.remove(devnode);
+ QEvdevKeyboardHandler *keyboard = m_keyboards.value(deviceNode);
+ m_keyboards.remove(deviceNode);
delete keyboard;
}
}
-void QEvdevKeyboardManager::startWatching()
-{
- m_udevMonitor = udev_monitor_new_from_netlink(m_udev, "udev");
- if (!m_udevMonitor) {
-#ifdef QT_QPA_KEYMAP_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", NULL);
- 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(deviceDetected()));
-}
-
-void QEvdevKeyboardManager::stopWatching()
-{
- if (m_udevSocketNotifier)
- delete m_udevSocketNotifier;
-
- if (m_udevMonitor)
- udev_monitor_unref(m_udevMonitor);
-
- m_udevSocketNotifier = 0;
- m_udevMonitor = 0;
- m_udevMonitorFileDescriptor = 0;
-}
-
-void QEvdevKeyboardManager::deviceDetected()
-{
- if (!m_udevMonitor)
- return;
-
- struct udev_device *dev;
- dev = udev_monitor_receive_device(m_udevMonitor);
- if (!dev)
- return;
-
- if (qstrcmp(udev_device_get_action(dev), "add") == 0) {
- checkDevice(dev);
- } else {
- // We can't determine what the device was, so we handle false positives outside of this class
- QString str = udev_device_get_devnode(dev);
- if (!str.isEmpty())
- removeKeyboard(str);
- }
-
- udev_device_unref(dev);
-}
-
-void QEvdevKeyboardManager::parseConnectedDevices()
-{
- struct udev_enumerate *enumerate;
- struct udev_list_entry *devices;
- struct udev_list_entry *dev_list_entry;
- struct udev_device *dev;
- const char *str;
-
- enumerate = udev_enumerate_new(m_udev);
- udev_enumerate_add_match_subsystem(enumerate, "input");
- udev_enumerate_scan_devices(enumerate);
- devices = udev_enumerate_get_list_entry(enumerate);
-
- udev_list_entry_foreach(dev_list_entry, devices) {
- str = udev_list_entry_get_name(dev_list_entry);
- dev = udev_device_new_from_syspath(m_udev, str);
- checkDevice(dev);
- }
-
- udev_enumerate_unref(enumerate);
-}
-
-void QEvdevKeyboardManager::checkDevice(udev_device *dev)
-{
- const char *str;
- QString devnode;
-
- str = udev_device_get_devnode(dev);
- if (!str)
- return;
-
- devnode = str;
-
- dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL);
- if (!dev)
- return;
-
- str = udev_device_get_sysattr_value(dev, "capabilities/key");
- QStringList val = QString(str).split(' ', QString::SkipEmptyParts);
-
- bool ok;
- unsigned long long keys = val.last().toULongLong(&ok, 16);
- if (!ok)
- return;
-
- // 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) {
- addKeyboard(devnode);
- return;
- }
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h
index 3caed6ff43..c776af2ec5 100644
--- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h
+++ b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h
@@ -44,12 +44,12 @@
#include "qevdevkeyboardhandler.h"
+#include <QtPlatformSupport/private/qudevicehelper_p.h>
+
#include <QObject>
#include <QHash>
#include <QSocketNotifier>
-#include <libudev.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -62,24 +62,13 @@ public:
~QEvdevKeyboardManager();
private slots:
- void deviceDetected();
+ void addKeyboard(const QString &deviceNode = QString());
+ void removeKeyboard(const QString &deviceNode);
private:
- void startWatching();
- void stopWatching();
- void parseConnectedDevices();
- void checkDevice(struct udev_device *dev);
-
- void addKeyboard(const QString &devnode = QString());
- void removeKeyboard(const QString &devnode);
-
QString m_spec;
QHash<QString,QEvdevKeyboardHandler*> m_keyboards;
-
- struct udev *m_udev;
- struct udev_monitor *m_udevMonitor;
- int m_udevMonitorFileDescriptor;
- QSocketNotifier *m_udevSocketNotifier;
+ QUDeviceHelper *m_udeviceHelper;
};
QT_END_HEADER
diff --git a/src/plugins/generic/evdevmouse/evdevmouse.json b/src/plugins/generic/evdevmouse/evdevmouse.json
new file mode 100644
index 0000000000..00ddd3a9cf
--- /dev/null
+++ b/src/plugins/generic/evdevmouse/evdevmouse.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "EvdevMouse" ]
+}
diff --git a/src/plugins/generic/evdevmouse/evdevmouse.pro b/src/plugins/generic/evdevmouse/evdevmouse.pro
index f25199161b..c5d162fb2f 100644
--- a/src/plugins/generic/evdevmouse/evdevmouse.pro
+++ b/src/plugins/generic/evdevmouse/evdevmouse.pro
@@ -11,3 +11,6 @@ QT += core-private platformsupport-private
SOURCES = main.cpp \
qevdevmouse.cpp
+
+OTHER_FILES += \
+ evdevmouse.json
diff --git a/src/plugins/generic/evdevmouse/main.cpp b/src/plugins/generic/evdevmouse/main.cpp
index 34ca62f960..47a4ddf56b 100644
--- a/src/plugins/generic/evdevmouse/main.cpp
+++ b/src/plugins/generic/evdevmouse/main.cpp
@@ -46,6 +46,9 @@ QT_BEGIN_NAMESPACE
class QEvdevMousePlugin : public QGenericPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "evdevmouse.json")
+
public:
QEvdevMousePlugin();
@@ -72,6 +75,6 @@ QObject* QEvdevMousePlugin::create(const QString &key,
return 0;
}
-Q_EXPORT_PLUGIN2(qevdevmouseplugin, QEvdevMousePlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/generic/evdevtouch/evdevtouch.json b/src/plugins/generic/evdevtouch/evdevtouch.json
new file mode 100644
index 0000000000..6a6959c8e6
--- /dev/null
+++ b/src/plugins/generic/evdevtouch/evdevtouch.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "EvdevTouch" ]
+}
diff --git a/src/plugins/generic/evdevtouch/evdevtouch.pro b/src/plugins/generic/evdevtouch/evdevtouch.pro
index 78fe551aa2..284f1d1221 100644
--- a/src/plugins/generic/evdevtouch/evdevtouch.pro
+++ b/src/plugins/generic/evdevtouch/evdevtouch.pro
@@ -12,3 +12,6 @@ SOURCES = main.cpp \
qevdevtouch.cpp
QT += core-private platformsupport-private
+
+OTHER_FILES += \
+ evdevtouch.json
diff --git a/src/plugins/generic/evdevtouch/main.cpp b/src/plugins/generic/evdevtouch/main.cpp
index 526e336fd8..47b026ac96 100644
--- a/src/plugins/generic/evdevtouch/main.cpp
+++ b/src/plugins/generic/evdevtouch/main.cpp
@@ -46,6 +46,9 @@ QT_BEGIN_NAMESPACE
class QTouchScreenPlugin : public QGenericPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "evdevtouch.json")
+
public:
QTouchScreenPlugin();
@@ -71,6 +74,6 @@ QObject* QTouchScreenPlugin::create(const QString &key,
return 0;
}
-Q_EXPORT_PLUGIN2(qevdevtouchplugin, QTouchScreenPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
index c5064663a1..ca8f492c5d 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
@@ -57,7 +57,7 @@ public:
bool isValid() const;
- void invokeAction(QInputPanel::Action a, int x);
+ void invokeAction(QInputMethod::Action a, int x);
void reset();
void commit();
void update(Qt::InputMethodQueries);
diff --git a/src/plugins/platforminputcontexts/maliit/qmaliitplatforminputcontext.h b/src/plugins/platforminputcontexts/maliit/qmaliitplatforminputcontext.h
index 3760885641..a17abe7cbb 100644
--- a/src/plugins/platforminputcontexts/maliit/qmaliitplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/maliit/qmaliitplatforminputcontext.h
@@ -59,7 +59,7 @@ public:
bool isValid() const;
- void invokeAction(QInputPanel::Action action, int x);
+ void invokeAction(QInputMethod::Action action, int x);
void reset(void);
void update(Qt::InputMethodQueries);
virtual QRectF keyboardRect() const;
diff --git a/src/plugins/platforms/blackberry/blackberry.pro b/src/plugins/platforms/blackberry/blackberry.pro
new file mode 100644
index 0000000000..94b9c5dbc8
--- /dev/null
+++ b/src/plugins/platforms/blackberry/blackberry.pro
@@ -0,0 +1,71 @@
+TARGET = blackberry
+include(../../qpluginbase.pri)
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
+QT += opengl opengl-private platformsupport platformsupport-private widgets-private
+
+# Uncomment this to build with support for IMF once it becomes available in the BBNDK
+#CONFIG += qbb_imf
+
+# Uncomment these to enable debugging output for various aspects of the plugin
+#DEFINES += QBBBUFFER_DEBUG
+#DEFINES += QBBCLIPBOARD_DEBUG
+#DEFINES += QBBEVENTTHREAD_DEBUG
+#DEFINES += QBBGLBACKINGSTORE_DEBUG
+#DEFINES += QBBGLCONTEXT_DEBUG
+#DEFINES += QBBINPUTCONTEXT_DEBUG
+#DEFINES += QBBINPUTCONTEXT_IMF_EVENT_DEBUG
+#DEFINES += QBBINTEGRATION_DEBUG
+#DEFINES += QBBNAVIGATORTHREAD_DEBUG
+#DEFINES += QBBRASTERBACKINGSTORE_DEBUG
+#DEFINES += QBBROOTWINDOW_DEBUG
+#DEFINES += QBBSCREEN_DEBUG
+#DEFINES += QBBVIRTUALKEYBOARD_DEBUG
+#DEFINES += QBBWINDOW_DEBUG
+
+SOURCES = main.cpp \
+ qbbbuffer.cpp \
+ qbbeventthread.cpp \
+ qbbglcontext.cpp \
+ qbbglbackingstore.cpp \
+ qbbintegration.cpp \
+ qbbnavigatorthread.cpp \
+ qbbscreen.cpp \
+ qbbwindow.cpp \
+ qbbrasterbackingstore.cpp \
+ qbbvirtualkeyboard.cpp \
+ qbbclipboard.cpp \
+ qbbrootwindow.cpp
+
+HEADERS = qbbbuffer.h \
+ qbbeventthread.h \
+ qbbkeytranslator.h \
+ qbbintegration.h \
+ qbbnavigatorthread.h \
+ qbbglcontext.h \
+ qbbglbackingstore.h \
+ qbbscreen.h \
+ qbbwindow.h \
+ qbbrasterbackingstore.h \
+ qbbvirtualkeyboard.h \
+ qbbclipboard.h \
+ qbbrootwindow.h
+
+CONFIG(qbb_imf) {
+ DEFINES += QBB_IMF
+ HEADERS += qbbinputcontext_imf.h
+ SOURCES += qbbinputcontext_imf.cpp
+} else {
+ HEADERS += qbbinputcontext_noimf.h
+ SOURCES += qbbinputcontext_noimf.cpp
+}
+
+QMAKE_CXXFLAGS += -I./private
+
+LIBS += -lpps -lscreen -lEGL -lclipboard
+
+include (../../../platformsupport/eglconvenience/eglconvenience.pri)
+include (../../../platformsupport/fontdatabases/fontdatabases.pri)
+
+target.path += $$[QT_INSTALL_PLUGINS]/platforms
+INSTALLS += target
diff --git a/src/plugins/platforms/blackberry/main.cpp b/src/plugins/platforms/blackberry/main.cpp
new file mode 100644
index 0000000000..b9e09c0384
--- /dev/null
+++ b/src/plugins/platforms/blackberry/main.cpp
@@ -0,0 +1,72 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 <QtGui/QPlatformIntegrationPlugin>
+#include "qbbintegration.h"
+
+QT_BEGIN_NAMESPACE
+
+class QBBIntegrationPlugin : public QPlatformIntegrationPlugin
+{
+public:
+ QStringList keys() const;
+ QPlatformIntegration *create(const QString&, const QStringList&);
+};
+
+QStringList QBBIntegrationPlugin::keys() const
+{
+ QStringList list;
+ list << QLatin1String("blackberry");
+ return list;
+}
+
+QPlatformIntegration *QBBIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+{
+ Q_UNUSED(paramList);
+ if (system.toLower() == QLatin1String("blackberry"))
+ return new QBBIntegration;
+
+ return 0;
+}
+
+Q_EXPORT_PLUGIN2(blackberry, QBBIntegrationPlugin)
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbbuffer.cpp b/src/plugins/platforms/blackberry/qbbbuffer.cpp
new file mode 100644
index 0000000000..c4ac04898d
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbbuffer.cpp
@@ -0,0 +1,165 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbbuffer.h"
+
+#include <QtCore/QDebug>
+
+#include <errno.h>
+#include <sys/mman.h>
+
+QT_BEGIN_NAMESPACE
+
+QBBBuffer::QBBBuffer()
+ : m_buffer(0)
+{
+#if defined(QBBBUFFER_DEBUG)
+ qDebug() << "QBBBuffer::QBBBuffer - empty";
+#endif
+}
+
+QBBBuffer::QBBBuffer(screen_buffer_t buffer)
+ : m_buffer(buffer)
+{
+#if defined(QBBBUFFER_DEBUG)
+ qDebug() << "QBBBuffer::QBBBuffer - normal";
+#endif
+
+ // Get size of buffer
+ errno = 0;
+ int size[2];
+ int result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_BUFFER_SIZE, size);
+ if (result != 0) {
+ qFatal("QBB: failed to query buffer size, errno=%d", errno);
+ }
+
+ // Get stride of buffer
+ errno = 0;
+ int stride;
+ result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, &stride);
+ if (result != 0) {
+ qFatal("QBB: failed to query buffer stride, errno=%d", errno);
+ }
+
+ // Get access to buffer's data
+ errno = 0;
+ uchar *dataPtr = 0;
+ result = screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr);
+ if (result != 0) {
+ qFatal("QBB: failed to query buffer pointer, errno=%d", errno);
+ }
+ if (dataPtr == NULL) {
+ qFatal("QBB: buffer pointer is NULL, errno=%d", errno);
+ }
+
+ // Get format of buffer
+ errno = 0;
+ int screenFormat;
+ result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_FORMAT, &screenFormat);
+ if (result != 0) {
+ qFatal("QBB: failed to query buffer format, errno=%d", errno);
+ }
+
+ // Convert screen format to QImage format
+ QImage::Format imageFormat = QImage::Format_Invalid;
+ switch (screenFormat) {
+ case SCREEN_FORMAT_RGBX4444:
+ imageFormat = QImage::Format_RGB444;
+ break;
+ case SCREEN_FORMAT_RGBA4444:
+ imageFormat = QImage::Format_ARGB4444_Premultiplied;
+ break;
+ case SCREEN_FORMAT_RGBX5551:
+ imageFormat = QImage::Format_RGB555;
+ break;
+ case SCREEN_FORMAT_RGB565:
+ imageFormat = QImage::Format_RGB16;
+ break;
+ case SCREEN_FORMAT_RGBX8888:
+ imageFormat = QImage::Format_RGB32;
+ break;
+ case SCREEN_FORMAT_RGBA8888:
+ imageFormat = QImage::Format_ARGB32_Premultiplied;
+ break;
+ default:
+ qFatal("QBB: unsupported buffer format, format=%d", screenFormat);
+ }
+
+ // wrap buffer in an image
+ m_image = QImage(dataPtr, size[0], size[1], stride, imageFormat);
+}
+
+QBBBuffer::QBBBuffer(const QBBBuffer &other)
+ : m_buffer(other.m_buffer),
+ m_image(other.m_image)
+{
+#if defined(QBBBUFFER_DEBUG)
+ qDebug() << "QBBBuffer::QBBBuffer - copy";
+#endif
+}
+
+QBBBuffer::~QBBBuffer()
+{
+#if defined(QBBBUFFER_DEBUG)
+ qDebug() << "QBBBuffer::~QBBBuffer";
+#endif
+}
+
+void QBBBuffer::invalidateInCache()
+{
+#if defined(QBBBUFFER_DEBUG)
+ qDebug() << "QBBBuffer::invalidateInCache";
+#endif
+
+ // Verify native buffer exists
+ if (m_buffer == 0) {
+ qFatal("QBB: can't invalidate cache for null buffer");
+ }
+
+ // Evict buffer's data from cache
+ errno = 0;
+ int result = msync(m_image.bits(), m_image.height() * m_image.bytesPerLine(), MS_INVALIDATE | MS_CACHE_ONLY);
+ if (result != 0) {
+ qFatal("QBB: failed to invalidate cache, errno=%d", errno);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbbuffer.h b/src/plugins/platforms/blackberry/qbbbuffer.h
new file mode 100644
index 0000000000..45cedb21a8
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbbuffer.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBBUFFER_H
+#define QBBBUFFER_H
+
+#include <QtGui/QImage>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBBBuffer
+{
+public:
+ QBBBuffer();
+ QBBBuffer(screen_buffer_t buffer);
+ QBBBuffer(const QBBBuffer &other);
+ virtual ~QBBBuffer();
+
+ screen_buffer_t nativeBuffer() const { return m_buffer; }
+ const QImage *image() const { return (m_buffer != NULL) ? &m_image : NULL; }
+ QImage *image() { return (m_buffer != NULL) ? &m_image : NULL; }
+
+ QRect rect() const { return m_image.rect(); }
+
+ void invalidateInCache();
+
+private:
+ screen_buffer_t m_buffer;
+ QImage m_image;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBBUFFER_H
diff --git a/src/plugins/platforms/blackberry/qbbclipboard.cpp b/src/plugins/platforms/blackberry/qbbclipboard.cpp
new file mode 100644
index 0000000000..fce016d5ee
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbclipboard.cpp
@@ -0,0 +1,132 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QT_NO_CLIPBOARD
+
+#include "qbbclipboard.h"
+
+#include <QtGui/QColor>
+
+#include <QtCore/QDebug>
+#include <QtCore/QStringList>
+#include <QtCore/QUrl>
+
+#include <clipboard/clipboard.h>
+#include <errno.h>
+
+QT_BEGIN_NAMESPACE
+static const char *typeList[] = {"text/html", "text/plain", "application/x-color"};
+
+QBBClipboard::QBBClipboard()
+{
+ m_mimeData = 0;
+}
+
+QBBClipboard::~QBBClipboard()
+{
+ delete m_mimeData;
+}
+
+void QBBClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
+{
+ if (mode != QClipboard::Clipboard)
+ return;
+
+ if (m_mimeData != data) {
+ delete m_mimeData;
+ m_mimeData = data;
+ }
+
+ empty_clipboard();
+
+ if (data == 0)
+ return;
+
+ QStringList format = data->formats();
+ for (int i = 0; i < format.size(); ++i) {
+ QString type = format.at(i);
+ QByteArray buf = data->data(type);
+ if (!buf.size())
+ continue;
+
+ int ret = set_clipboard_data(type.toUtf8().data(), buf.size(), buf.data());
+#if defined(QBBCLIPBOARD_DEBUG)
+ qDebug() << "QBB: set " << type.toUtf8().data() << "to clipboard, size=" << buf.size() << ";ret=" << ret;
+#else
+ Q_UNUSED(ret);
+#endif
+ }
+}
+
+void QBBClipboard::readClipboardBuff(const char *type)
+{
+ char *pbuffer;
+ if (is_clipboard_format_present(type) == 0) {
+ int size = get_clipboard_data(type, &pbuffer);
+ if (size != -1 && pbuffer) {
+ QString qtype = type;
+#if defined(QBBCLIPBOARD_DEBUG)
+ qDebug() << "QBB: clipboard has " << qtype;
+#endif
+ m_mimeData->setData(qtype, QByteArray(pbuffer, size));
+ delete pbuffer;
+ }
+ }
+}
+
+QMimeData *QBBClipboard::mimeData(QClipboard::Mode mode)
+{
+ if (mode != QClipboard::Clipboard)
+ return 0;
+
+ if (!m_mimeData)
+ m_mimeData = new QMimeData();
+
+ m_mimeData->clear();
+
+ for (int i = 0; i < 3; i++)
+ readClipboardBuff(typeList[i]);
+
+ return m_mimeData;
+}
+
+QT_END_NAMESPACE
+#endif //QT_NO_CLIPBOAR
diff --git a/config.tests/qws/svgalib/svgalib.cpp b/src/plugins/platforms/blackberry/qbbclipboard.h
index d42705597d..b9de9b3e36 100644
--- a/config.tests/qws/svgalib/svgalib.cpp
+++ b/src/plugins/platforms/blackberry/qbbclipboard.h
@@ -1,9 +1,9 @@
-/****************************************************************************
+/***************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 - 2012 Research In Motion
** Contact: http://www.qt-project.org/
**
-** This file is part of the config.tests of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,13 +39,29 @@
**
****************************************************************************/
-#include <vga.h>
-#include <vgagl.h>
+#ifndef QBBCLIPBOARD_H
+#define QBBCLIPBOARD_H
-int main(int, char **)
+#ifndef QT_NO_CLIPBOARD
+#include <QtGui/QPlatformClipboard>
+#include <QMimeData>
+
+QT_BEGIN_NAMESPACE
+
+class QBBClipboard : public QPlatformClipboard
{
- int mode = vga_getdefaultmode();
- gl_setcontextvga(mode);
+public:
+ QBBClipboard();
+ virtual ~QBBClipboard();
+ virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
+ virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
+
+private:
+ QMimeData *m_mimeData;
+ void readClipboardBuff(const char *type);
+};
+
+QT_END_NAMESPACE
- return 0;
-}
+#endif //QT_NO_CLIPBOARD
+#endif //QBBCLIPBOARD_H
diff --git a/src/plugins/platforms/blackberry/qbbeventthread.cpp b/src/plugins/platforms/blackberry/qbbeventthread.cpp
new file mode 100644
index 0000000000..547428d1c4
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbeventthread.cpp
@@ -0,0 +1,559 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbeventthread.h"
+#include "qbbintegration.h"
+#include "qbbkeytranslator.h"
+
+#if defined(QBB_IMF)
+#include "qbbinputcontext_imf.h"
+#else
+#include "qbbinputcontext_noimf.h"
+#endif
+
+#include <QtGui/QWindow>
+#include <QtGui/QPlatformScreen>
+#include <QtGui/QGuiApplication>
+
+#include <QtCore/QDebug>
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/keycodes.h>
+
+#include <cctype>
+
+QBBEventThread::QBBEventThread(screen_context_t context, QPlatformScreen& screen)
+ : QThread(),
+ m_screenContext(context),
+ m_platformScreen(screen),
+ m_quit(false),
+ m_lastButtonState(Qt::NoButton),
+ m_lastMouseWindow(0)
+{
+ // Create a touch device
+ m_touchDevice = new QTouchDevice;
+ m_touchDevice->setType(QTouchDevice::TouchScreen);
+ m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::Pressure | QTouchDevice::NormalizedPosition);
+ QWindowSystemInterface::registerTouchDevice(m_touchDevice);
+
+ // initialize array of touch points
+ for (int i = 0; i < MaximumTouchPoints; i++) {
+
+ // map array index to id
+ m_touchPoints[i].id = i;
+
+ // pressure is not supported - use default
+ m_touchPoints[i].pressure = 1.0;
+
+ // nothing touching
+ m_touchPoints[i].state = Qt::TouchPointReleased;
+ }
+}
+
+QBBEventThread::~QBBEventThread()
+{
+ // block until thread terminates
+ shutdown();
+}
+
+void QBBEventThread::run()
+{
+ screen_event_t event;
+
+ // create screen event
+ errno = 0;
+ int result = screen_create_event(&event);
+ if (result) {
+ qFatal("QBB: failed to create event, errno=%d", errno);
+ }
+
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: event loop started";
+#endif
+
+ // loop indefinitely
+ while (!m_quit) {
+
+ // block until screen event is available
+ errno = 0;
+ result = screen_get_event(m_screenContext, event, -1);
+ if (result) {
+ qFatal("QBB: failed to get event, errno=%d", errno);
+ }
+
+ // process received event
+ dispatchEvent(event);
+ }
+
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: event loop stopped";
+#endif
+
+ // cleanup
+ screen_destroy_event(event);
+}
+
+void QBBEventThread::shutdown()
+{
+ screen_event_t event;
+
+ // create screen event
+ errno = 0;
+ int result = screen_create_event(&event);
+ if (result) {
+ qFatal("QBB: failed to create event, errno=%d", errno);
+ }
+
+ // set the event type as user
+ errno = 0;
+ int type = SCREEN_EVENT_USER;
+ result = screen_set_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type);
+ if (result) {
+ qFatal("QBB: failed to set event type, errno=%d", errno);
+ }
+
+ // NOTE: ignore SCREEN_PROPERTY_USER_DATA; treat all user events as shutdown events
+
+ // post event to event loop so it will wake up and die
+ errno = 0;
+ result = screen_send_event(m_screenContext, event, getpid());
+ if (result) {
+ qFatal("QBB: failed to set event type, errno=%d", errno);
+ }
+
+ // cleanup
+ screen_destroy_event(event);
+
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: event loop shutdown begin";
+#endif
+
+ // block until thread terminates
+ wait();
+
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: event loop shutdown end";
+#endif
+}
+
+void QBBEventThread::dispatchEvent(screen_event_t event)
+{
+ // get the event type
+ errno = 0;
+ int qnxType;
+ int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &qnxType);
+ if (result) {
+ qFatal("QBB: failed to query event type, errno=%d", errno);
+ }
+
+ switch (qnxType) {
+ case SCREEN_EVENT_MTOUCH_TOUCH:
+ case SCREEN_EVENT_MTOUCH_MOVE:
+ case SCREEN_EVENT_MTOUCH_RELEASE:
+ handleTouchEvent(event, qnxType);
+ break;
+
+ case SCREEN_EVENT_KEYBOARD:
+ handleKeyboardEvent(event);
+ break;
+
+ case SCREEN_EVENT_POINTER:
+ handlePointerEvent(event);
+ break;
+
+ case SCREEN_EVENT_CLOSE:
+ handleCloseEvent(event);
+ break;
+
+ case SCREEN_EVENT_USER:
+ // treat all user events as shutdown requests
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: QNX user event";
+#endif
+ m_quit = true;
+ break;
+
+ default:
+ // event ignored
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: QNX unknown event";
+#endif
+ break;
+ }
+}
+
+void QBBEventThread::handleKeyboardEvent(screen_event_t event)
+{
+ // get flags of key event
+ errno = 0;
+ int flags;
+ int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
+ if (result) {
+ qFatal("QBB: failed to query event flags, errno=%d", errno);
+ }
+
+ // get key code
+ errno = 0;
+ int sym;
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym);
+ if (result) {
+ qFatal("QBB: failed to query event sym, errno=%d", errno);
+ }
+
+ int modifiers;
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers);
+ if (result) {
+ qFatal("QBB: failed to query event modifiers, errno=%d", errno);
+ }
+
+ int scan;
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan);
+ if (result) {
+ qFatal("QBB: failed to query event modifiers, errno=%d", errno);
+ }
+
+ int cap;
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
+ if (result) {
+ qFatal("QBB: failed to query event cap, errno=%d", errno);
+ }
+
+ injectKeyboardEvent(flags, sym, modifiers, scan, cap);
+}
+
+void QBBEventThread::injectKeyboardEvent(int flags, int sym, int modifiers, int scan, int cap)
+{
+ Q_UNUSED(scan);
+
+ Qt::KeyboardModifiers qtMod = Qt::NoModifier;
+ if (modifiers & KEYMOD_SHIFT)
+ qtMod |= Qt::ShiftModifier;
+ if (modifiers & KEYMOD_CTRL)
+ qtMod |= Qt::ControlModifier;
+ if (modifiers & KEYMOD_ALT)
+ qtMod |= Qt::AltModifier;
+
+ // determine event type
+ QEvent::Type type = (flags & KEY_DOWN) ? QEvent::KeyPress : QEvent::KeyRelease;
+
+ // Check if the key cap is valid
+ if (flags & KEY_CAP_VALID) {
+ Qt::Key key;
+ QString keyStr;
+
+ if (cap >= 0x20 && cap <= 0x0ff) {
+ key = Qt::Key(std::toupper(cap)); // Qt expects the CAP to be upper case.
+
+ if ( qtMod & Qt::ControlModifier ) {
+ keyStr = QChar((int)(key & 0x3f));
+ } else {
+ if (flags & KEY_SYM_VALID) {
+ keyStr = QChar(sym);
+ }
+ }
+ } else if ((cap > 0x0ff && cap < UNICODE_PRIVATE_USE_AREA_FIRST) || cap > UNICODE_PRIVATE_USE_AREA_LAST) {
+ key = (Qt::Key)cap;
+ keyStr = QChar(sym);
+ } else {
+ if (isKeypadKey(cap))
+ qtMod |= Qt::KeypadModifier; // Is this right?
+ key = keyTranslator(cap);
+ }
+
+ QWindowSystemInterface::handleKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, keyStr);
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt key t=" << type << ", k=" << key << ", s=" << keyStr;
+#endif
+ }
+}
+
+void QBBEventThread::handlePointerEvent(screen_event_t event)
+{
+ errno = 0;
+
+ // Query the window that was clicked
+ screen_window_t qnxWindow;
+ void *handle;
+ int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
+ if (result) {
+ qFatal("QBB: failed to query event window, errno=%d", errno);
+ }
+ qnxWindow = static_cast<screen_window_t>(handle);
+
+ // Query the button states
+ int buttonState = 0;
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_BUTTONS, &buttonState);
+ if (result) {
+ qFatal("QBB: failed to query event button state, errno=%d", errno);
+ }
+
+ // Query the window position
+ int windowPos[2];
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
+ if (result) {
+ qFatal("QBB: failed to query event window position, errno=%d", errno);
+ }
+
+ // Query the screen position
+ int pos[2];
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
+ if (result) {
+ qFatal("QBB: failed to query event position, errno=%d", errno);
+ }
+
+ // Query the wheel delta
+ int wheelDelta = 0;
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_MOUSE_WHEEL, &wheelDelta);
+ if (result) {
+ qFatal("QBB: failed to query event wheel delta, errno=%d", errno);
+ }
+
+ // Map window handle to top-level QWindow
+ QWindow *w = QBBIntegration::window(qnxWindow);
+
+ // Generate enter and leave events as needed.
+ if (qnxWindow != m_lastMouseWindow) {
+ QWindow *wOld = QBBIntegration::window(m_lastMouseWindow);
+
+ if (wOld) {
+ QWindowSystemInterface::handleLeaveEvent(wOld);
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt leave, w=" << wOld;
+#endif
+ }
+
+ if (w) {
+ QWindowSystemInterface::handleEnterEvent(w);
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt enter, w=" << w;
+#endif
+ }
+ }
+ m_lastMouseWindow = qnxWindow;
+
+ // Apply scaling to wheel delta and invert value for Qt. We'll probably want to scale
+ // this via a system preference at some point. But for now this is a sane value and makes
+ // the wheel usable.
+ wheelDelta *= -10;
+
+ // convert point to local coordinates
+ QPoint globalPoint(pos[0], pos[1]);
+ QPoint localPoint(windowPos[0], windowPos[1]);
+
+ // Convert buttons.
+ Qt::MouseButtons buttons = Qt::NoButton;
+ if (buttonState & 1)
+ buttons |= Qt::LeftButton;
+ if (buttonState & 2)
+ buttons |= Qt::MidButton;
+ if (buttonState & 4)
+ buttons |= Qt::RightButton;
+
+ if (w) {
+ // Inject mouse event into Qt only if something has changed.
+ if (m_lastGlobalMousePoint != globalPoint ||
+ m_lastLocalMousePoint != localPoint ||
+ m_lastButtonState != buttons) {
+ QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << static_cast<int>(buttons);
+#endif
+ }
+
+ if (wheelDelta) {
+ // Screen only supports a single wheel, so we will assume Vertical orientation for
+ // now since that is pretty much standard.
+ QWindowSystemInterface::handleWheelEvent(w, localPoint, globalPoint, wheelDelta, Qt::Vertical);
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt wheel, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), d=" << static_cast<int>(wheelDelta);
+#endif
+ }
+ }
+
+ m_lastGlobalMousePoint = globalPoint;
+ m_lastLocalMousePoint = localPoint;
+ m_lastButtonState = buttons;
+}
+
+void QBBEventThread::handleTouchEvent(screen_event_t event, int qnxType)
+{
+ // get display coordinates of touch
+ errno = 0;
+ int pos[2];
+ int result = screen_get_event_property_iv(event, SCREEN_PROPERTY_POSITION, pos);
+ if (result) {
+ qFatal("QBB: failed to query event position, errno=%d", errno);
+ }
+
+ // get window coordinates of touch
+ errno = 0;
+ int windowPos[2];
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, windowPos);
+ if (result) {
+ qFatal("QBB: failed to query event window position, errno=%d", errno);
+ }
+
+ // determine which finger touched
+ errno = 0;
+ int touchId;
+ result = screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, &touchId);
+ if (result) {
+ qFatal("QBB: failed to query event touch id, errno=%d", errno);
+ }
+
+ // determine which window was touched
+ errno = 0;
+ void *handle;
+ result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
+ if (result) {
+ qFatal("QBB: failed to query event window, errno=%d", errno);
+ }
+ screen_window_t qnxWindow = static_cast<screen_window_t>(handle);
+
+ // check if finger is valid
+ if (touchId < MaximumTouchPoints) {
+
+ // Map window handle to top-level QWindow
+ QWindow *w = QBBIntegration::window(qnxWindow);
+
+ // Generate enter and leave events as needed.
+ if (qnxWindow != m_lastMouseWindow) {
+ QWindow *wOld = QBBIntegration::window(m_lastMouseWindow);
+
+ if (wOld) {
+ QWindowSystemInterface::handleLeaveEvent(wOld);
+ #if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt leave, w=" << wOld;
+ #endif
+ }
+
+ if (w) {
+ QWindowSystemInterface::handleEnterEvent(w);
+ #if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt enter, w=" << w;
+ #endif
+ }
+ }
+ m_lastMouseWindow = qnxWindow;
+
+ if (w) {
+ // convert primary touch to mouse event
+ if (touchId == 0) {
+
+ // convert point to local coordinates
+ QPoint globalPoint(pos[0], pos[1]);
+ QPoint localPoint(windowPos[0], windowPos[1]);
+
+ // map touch state to button state
+ Qt::MouseButtons buttons = (qnxType == SCREEN_EVENT_MTOUCH_RELEASE) ? Qt::NoButton : Qt::LeftButton;
+
+ // inject event into Qt
+ QWindowSystemInterface::handleMouseEvent(w, localPoint, globalPoint, buttons);
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt mouse, w=" << w << ", (" << localPoint.x() << "," << localPoint.y() << "), b=" << buttons;
+#endif
+ }
+
+ // get size of screen which contains window
+ QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w);
+ QSizeF screenSize = platformScreen->physicalSize();
+
+ // update cached position of current touch point
+ m_touchPoints[touchId].normalPosition = QPointF( static_cast<qreal>(pos[0]) / screenSize.width(), static_cast<qreal>(pos[1]) / screenSize.height() );
+ m_touchPoints[touchId].area = QRectF( pos[0], pos[1], 0.0, 0.0 );
+
+ // determine event type and update state of current touch point
+ QEvent::Type type = QEvent::None;
+ switch (qnxType) {
+ case SCREEN_EVENT_MTOUCH_TOUCH:
+ m_touchPoints[touchId].state = Qt::TouchPointPressed;
+ type = QEvent::TouchBegin;
+ break;
+ case SCREEN_EVENT_MTOUCH_MOVE:
+ m_touchPoints[touchId].state = Qt::TouchPointMoved;
+ type = QEvent::TouchUpdate;
+ break;
+ case SCREEN_EVENT_MTOUCH_RELEASE:
+ m_touchPoints[touchId].state = Qt::TouchPointReleased;
+ type = QEvent::TouchEnd;
+ break;
+ }
+
+ // build list of active touch points
+ QList<QWindowSystemInterface::TouchPoint> pointList;
+ for (int i = 0; i < MaximumTouchPoints; i++) {
+ if (i == touchId) {
+ // current touch point is always active
+ pointList.append(m_touchPoints[i]);
+ } else if (m_touchPoints[i].state != Qt::TouchPointReleased) {
+ // finger is down but did not move
+ m_touchPoints[i].state = Qt::TouchPointStationary;
+ pointList.append(m_touchPoints[i]);
+ }
+ }
+
+ // inject event into Qt
+ QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList);
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: Qt touch, w=" << w << ", p=(" << pos[0] << "," << pos[1] << "), t=" << type;
+#endif
+ }
+ }
+}
+
+void QBBEventThread::handleCloseEvent(screen_event_t event)
+{
+ // Query the window that was closed
+ void *handle;
+ int result = screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, &handle);
+ if (result != 0) {
+ qFatal("QBB: failed to query event window, errno=%d", errno);
+ }
+ screen_window_t qnxWindow = static_cast<screen_window_t>(handle);
+
+ // Map window handle to top-level QWindow
+ QWindow *w = QBBIntegration::window(qnxWindow);
+ if (w != 0) {
+ QWindowSystemInterface::handleCloseEvent(w);
+ }
+}
+
diff --git a/src/plugins/platforms/blackberry/qbbeventthread.h b/src/plugins/platforms/blackberry/qbbeventthread.h
new file mode 100644
index 0000000000..afa738830c
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbeventthread.h
@@ -0,0 +1,90 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBEVENTTHREAD_H
+#define QBBEVENTTHREAD_H
+
+#include <QtCore/QThread>
+
+#include <QtGui/QPlatformScreen>
+#include <QtGui/QWindowSystemInterface>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBBEventThread : public QThread
+{
+public:
+ QBBEventThread(screen_context_t context, QPlatformScreen& screen);
+ virtual ~QBBEventThread();
+
+ static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
+
+protected:
+ virtual void run();
+
+private:
+ enum {
+ MaximumTouchPoints = 10
+ };
+
+ void shutdown();
+ void dispatchEvent(screen_event_t event);
+ void handleKeyboardEvent(screen_event_t event);
+ void handlePointerEvent(screen_event_t event);
+ void handleTouchEvent(screen_event_t event, int type);
+ void handleCloseEvent(screen_event_t event);
+
+ screen_context_t m_screenContext;
+ QPlatformScreen& m_platformScreen;
+ bool m_quit;
+ QPoint m_lastGlobalMousePoint;
+ QPoint m_lastLocalMousePoint;
+ Qt::MouseButtons m_lastButtonState;
+ screen_window_t m_lastMouseWindow;
+ QTouchDevice *m_touchDevice;
+ QWindowSystemInterface::TouchPoint m_touchPoints[MaximumTouchPoints];
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBEVENTTHREAD_H
diff --git a/src/plugins/platforms/blackberry/qbbglbackingstore.cpp b/src/plugins/platforms/blackberry/qbbglbackingstore.cpp
new file mode 100644
index 0000000000..91b07770e1
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbglbackingstore.cpp
@@ -0,0 +1,189 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbglbackingstore.h"
+#include "qbbglcontext.h"
+#include "qbbwindow.h"
+#include "qbbscreen.h"
+
+#include <QtGui/qwindow.h>
+
+#include <QtOpenGL/private/qgl_p.h>
+#include <QtOpenGL/QGLContext>
+
+#include <QtCore/QDebug>
+
+#include <errno.h>
+
+QT_BEGIN_NAMESPACE
+
+QBBGLPaintDevice::QBBGLPaintDevice(QWindow *window)
+ : QGLPaintDevice(),
+ m_window(0),
+ m_glContext(0)
+{
+ m_window = static_cast<QBBWindow*>(window->handle());
+
+ // Extract the QPlatformOpenGLContext from the window
+ QPlatformOpenGLContext *platformOpenGLContext = m_window->platformOpenGLContext();
+
+ // Convert this to a QGLContext
+ m_glContext = QGLContext::fromOpenGLContext(platformOpenGLContext->context());
+}
+
+QBBGLPaintDevice::~QBBGLPaintDevice()
+{
+ // Cleanup GL context
+ delete m_glContext;
+}
+
+QPaintEngine *QBBGLPaintDevice::paintEngine() const
+{
+ // Select a paint engine based on configued OpenGL version
+ return qt_qgl_paint_engine();
+}
+
+QSize QBBGLPaintDevice::size() const
+{
+ // Get size of EGL surface
+ return m_window->geometry().size();
+}
+
+
+QBBGLBackingStore::QBBGLBackingStore(QWindow *window)
+ : QPlatformBackingStore(window),
+ m_openGLContext(0),
+ m_paintDevice(0),
+ m_requestedSize(),
+ m_size()
+{
+#if defined(QBBGLBACKINGSTORE_DEBUG)
+ qDebug() << "QBBGLBackingStore::QBBGLBackingStore - w=" << window;
+#endif
+
+ // Create an OpenGL paint device which in turn creates a QGLContext for us
+ m_paintDevice = new QBBGLPaintDevice(window);
+ m_openGLContext = m_paintDevice->context()->contextHandle();
+}
+
+QBBGLBackingStore::~QBBGLBackingStore()
+{
+#if defined(QBBGLBACKINGSTORE_DEBUG)
+ qDebug() << "QBBGLBackingStore::~QBBGLBackingStore - w=" << window();
+#endif
+
+ // cleanup OpenGL paint device
+ delete m_paintDevice;
+}
+
+void QBBGLBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
+{
+ Q_UNUSED(region);
+ Q_UNUSED(offset);
+
+#if defined(QBBGLBACKINGSTORE_DEBUG)
+ qDebug() << "QBBGLBackingStore::flush - w=" << window;
+#endif
+
+ // update the display with newly rendered content
+ m_openGLContext->swapBuffers(window);
+}
+
+void QBBGLBackingStore::resize(const QSize &size, const QRegion &staticContents)
+{
+ Q_UNUSED(staticContents);
+#if defined(QBBGLBACKINGSTORE_DEBUG)
+ qDebug() << "QBBGLBackingStore::resize - w=" << window() << ", s=" << size;
+#endif
+ // NOTE: defer resizing window buffers until next paint as
+ // resize() can be called multiple times before a paint occurs
+ m_requestedSize = size;
+}
+
+void QBBGLBackingStore::beginPaint(const QRegion &region)
+{
+ Q_UNUSED(region);
+
+#if defined(QBBGLBACKINGSTORE_DEBUG)
+ qDebug() << "QBBGLBackingStore::beginPaint - w=" << window();
+#endif
+
+ // resize EGL surface if window surface resized
+ if (m_size != m_requestedSize) {
+ resizeSurface(m_requestedSize);
+ }
+}
+
+void QBBGLBackingStore::endPaint(const QRegion &region)
+{
+ Q_UNUSED(region);
+#if defined(QBBGLBACKINGSTORE_DEBUG)
+ qDebug() << "QBBGLBackingStore::endPaint - w=" << window();
+#endif
+}
+
+void QBBGLBackingStore::resizeSurface(const QSize &size)
+{
+ // need to destroy surface so make sure its not current
+ bool restoreCurrent = false;
+ QBBGLContext *platformContext = static_cast<QBBGLContext *>(m_openGLContext->handle());
+ if (platformContext->isCurrent()) {
+ m_openGLContext->doneCurrent();
+ restoreCurrent = true;
+ }
+
+ // destroy old EGL surface
+ platformContext->destroySurface();
+
+ // resize window's buffers
+ static_cast<QBBWindow*>(window()->handle())->setBufferSize(size);
+
+ // re-create EGL surface with new size
+ m_size = size;
+ platformContext->createSurface(window()->handle());
+
+ // make context current again
+ if (restoreCurrent) {
+ m_openGLContext->makeCurrent(window());
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbglbackingstore.h b/src/plugins/platforms/blackberry/qbbglbackingstore.h
new file mode 100644
index 0000000000..5455c5767c
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbglbackingstore.h
@@ -0,0 +1,95 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBGLBACKINGSTORE_H
+#define QBBGLBACKINGSTORE_H
+
+#include <QtGui/qplatformbackingstore_qpa.h>
+#include <QtOpenGL/private/qglpaintdevice_p.h>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QGLContext;
+class QBBGLContext;
+class QBBScreen;
+class QBBWindow;
+
+class QBBGLPaintDevice : public QGLPaintDevice
+{
+public:
+ QBBGLPaintDevice(QWindow *window);
+ virtual ~QBBGLPaintDevice();
+
+ virtual QPaintEngine *paintEngine() const;
+ virtual QSize size() const;
+ virtual QGLContext *context() const { return m_glContext; }
+
+private:
+ QBBWindow *m_window;
+ QGLContext *m_glContext;
+};
+
+class QBBGLBackingStore : public QPlatformBackingStore
+{
+public:
+ QBBGLBackingStore(QWindow *window);
+ virtual ~QBBGLBackingStore();
+
+ virtual QPaintDevice *paintDevice() { return m_paintDevice; }
+ virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset);
+ virtual void resize(const QSize &size, const QRegion &staticContents);
+ virtual void beginPaint(const QRegion &region);
+ virtual void endPaint(const QRegion &region);
+
+ void resizeSurface(const QSize &size);
+
+private:
+ QOpenGLContext *m_openGLContext;
+ QBBGLPaintDevice *m_paintDevice;
+ QSize m_requestedSize;
+ QSize m_size;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBGLBACKINGSTORE_H
diff --git a/src/plugins/platforms/blackberry/qbbglcontext.cpp b/src/plugins/platforms/blackberry/qbbglcontext.cpp
new file mode 100644
index 0000000000..fb74fdb5d2
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbglcontext.cpp
@@ -0,0 +1,356 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbglcontext.h"
+#include "qbbrootwindow.h"
+#include "qbbscreen.h"
+#include "qbbwindow.h"
+
+#include "private/qeglconvenience_p.h"
+
+#include <QtCore/QDebug>
+#include <QtGui/QOpenGLContext>
+
+QT_BEGIN_NAMESPACE
+
+EGLDisplay QBBGLContext::ms_eglDisplay = EGL_NO_DISPLAY;
+
+static EGLenum checkEGLError(const char *msg)
+{
+ static const char *errmsg[] =
+ {
+ "EGL function succeeded",
+ "EGL is not initialized, or could not be initialized, for the specified display",
+ "EGL cannot access a requested resource",
+ "EGL failed to allocate resources for the requested operation",
+ "EGL fail to access an unrecognized attribute or attribute value was passed in an attribute list",
+ "EGLConfig argument does not name a valid EGLConfig",
+ "EGLContext argument does not name a valid EGLContext",
+ "EGL current surface of the calling thread is no longer valid",
+ "EGLDisplay argument does not name a valid EGLDisplay",
+ "EGL arguments are inconsistent",
+ "EGLNativePixmapType argument does not refer to a valid native pixmap",
+ "EGLNativeWindowType argument does not refer to a valid native window",
+ "EGL one or more argument values are invalid",
+ "EGLSurface argument does not name a valid surface configured for rendering",
+ "EGL power management event has occurred",
+ };
+ EGLenum error = eglGetError();
+ fprintf(stderr, "%s: %s\n", msg, errmsg[error - EGL_SUCCESS]);
+ return error;
+}
+
+QBBGLContext::QBBGLContext(QOpenGLContext *glContext)
+ : QPlatformOpenGLContext(),
+ m_glContext(glContext),
+ m_eglSurface(EGL_NO_SURFACE)
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ QSurfaceFormat format = m_glContext->format();
+
+ // Set current rendering API
+ EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
+ }
+
+ // Get colour channel sizes from window format
+ int alphaSize = format.alphaBufferSize();
+ int redSize = format.redBufferSize();
+ int greenSize = format.greenBufferSize();
+ int blueSize = format.blueBufferSize();
+
+ // Check if all channels are don't care
+ if (alphaSize == -1 && redSize == -1 && greenSize == -1 && blueSize == -1) {
+ // Set colour channels based on depth of window's screen
+ QBBScreen *screen = static_cast<QBBScreen*>(QBBScreen::screens().first());
+ int depth = screen->depth();
+ if (depth == 32) {
+ // SCREEN_FORMAT_RGBA8888
+ alphaSize = 8;
+ redSize = 8;
+ greenSize = 8;
+ blueSize = 8;
+ } else {
+ // SCREEN_FORMAT_RGB565
+ alphaSize = 0;
+ redSize = 5;
+ greenSize = 6;
+ blueSize = 5;
+ }
+ } else {
+ // Choose best match based on supported pixel formats
+ if (alphaSize <= 0 && redSize <= 5 && greenSize <= 6 && blueSize <= 5) {
+ // SCREEN_FORMAT_RGB565
+ alphaSize = 0;
+ redSize = 5;
+ greenSize = 6;
+ blueSize = 5;
+ } else {
+ // SCREEN_FORMAT_RGBA8888
+ alphaSize = 8;
+ redSize = 8;
+ greenSize = 8;
+ blueSize = 8;
+ }
+ }
+
+ // Update colour channel sizes in window format
+ format.setAlphaBufferSize(alphaSize);
+ format.setRedBufferSize(redSize);
+ format.setGreenBufferSize(greenSize);
+ format.setBlueBufferSize(blueSize);
+ format.setSamples(2);
+
+ // Select EGL config based on requested window format
+ m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format);
+ if (m_eglConfig == 0) {
+ qFatal("QBB: failed to find EGL config");
+ }
+
+ m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttrs());
+ if (m_eglContext == EGL_NO_CONTEXT) {
+ checkEGLError("eglCreateContext");
+ qFatal("QBB: failed to create EGL context, err=%d", eglGetError());
+ }
+
+ // Query/cache window format of selected EGL config
+ m_windowFormat = q_glFormatFromConfig(ms_eglDisplay, m_eglConfig);
+}
+
+QBBGLContext::~QBBGLContext()
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ // Cleanup EGL context if it exists
+ if (m_eglContext != EGL_NO_CONTEXT) {
+ eglDestroyContext(ms_eglDisplay, m_eglContext);
+ }
+
+ // Cleanup EGL surface if it exists
+ destroySurface();
+}
+
+void QBBGLContext::initialize()
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Initialize connection to EGL
+ ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (ms_eglDisplay == EGL_NO_DISPLAY) {
+ checkEGLError("eglGetDisplay");
+ qFatal("QBB: failed to obtain EGL display");
+ }
+
+ EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0);
+ if (eglResult != EGL_TRUE) {
+ checkEGLError("eglInitialize");
+ qFatal("QBB: failed to initialize EGL display, err=%d", eglGetError());
+ }
+}
+
+void QBBGLContext::shutdown()
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Close connection to EGL
+ eglTerminate(ms_eglDisplay);
+}
+
+bool QBBGLContext::makeCurrent(QPlatformSurface *surface)
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Set current rendering API
+ EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
+ }
+
+ if (m_eglSurface == EGL_NO_SURFACE)
+ createSurface(surface);
+
+ eglResult = eglMakeCurrent(ms_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
+ if (eglResult != EGL_TRUE) {
+ checkEGLError("eglMakeCurrent");
+ qFatal("QBB: failed to set current EGL context, err=%d", eglGetError());
+ }
+ return (eglResult == EGL_TRUE);
+}
+
+void QBBGLContext::doneCurrent()
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // set current rendering API
+ EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
+ }
+
+ // clear curent EGL context and unbind EGL surface
+ eglResult = eglMakeCurrent(ms_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to clear current EGL context, err=%d", eglGetError());
+ }
+}
+
+void QBBGLContext::swapBuffers(QPlatformSurface *surface)
+{
+ Q_UNUSED(surface);
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ // Set current rendering API
+ EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
+ }
+
+ // Post EGL surface to window
+ eglResult = eglSwapBuffers(ms_eglDisplay, m_eglSurface);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to swap EGL buffers, err=%d", eglGetError());
+ }
+}
+
+QFunctionPointer QBBGLContext::getProcAddress(const QByteArray &procName)
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ // Set current rendering API
+ EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to set EGL API, err=%d", eglGetError());
+ }
+
+ // Lookup EGL extension function pointer
+ return static_cast<QFunctionPointer>(eglGetProcAddress(procName.constData()));
+}
+
+EGLint *QBBGLContext::contextAttrs()
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ // Choose EGL settings based on OpenGL version
+#if defined(QT_OPENGL_ES_2)
+ static EGLint attrs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
+ return attrs;
+#else
+ return 0;
+#endif
+}
+
+bool QBBGLContext::isCurrent() const
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ return (eglGetCurrentContext() == m_eglContext);
+}
+
+void QBBGLContext::createSurface(QPlatformSurface *surface)
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Get a pointer to the corresponding platform window
+ QBBWindow *platformWindow = dynamic_cast<QBBWindow*>(surface);
+ if (!platformWindow) {
+ qFatal("QBB: unable to create EGLSurface without a QBBWindow");
+ }
+
+ // If the platform window does not yet have any buffers, we create
+ // a temporary set of buffers with a size of 1x1 pixels. This will
+ // suffice until such time as the platform window has obtained
+ // buffers of the proper size
+ if (!platformWindow->hasBuffers()) {
+ platformWindow->setPlatformOpenGLContext(this);
+ m_surfaceSize = platformWindow->geometry().size();
+ platformWindow->setBufferSize(m_surfaceSize);
+ }
+
+ // Obtain the native handle for our window
+ screen_window_t handle = platformWindow->nativeHandle();
+
+ const EGLint eglSurfaceAttrs[] =
+ {
+ EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
+ EGL_NONE
+ };
+
+ // Create EGL surface
+ m_eglSurface = eglCreateWindowSurface(ms_eglDisplay, m_eglConfig, (EGLNativeWindowType) handle, eglSurfaceAttrs);
+ if (m_eglSurface == EGL_NO_SURFACE) {
+ checkEGLError("eglCreateWindowSurface");
+ qFatal("QBB: failed to create EGL surface, err=%d", eglGetError());
+ }
+}
+
+void QBBGLContext::destroySurface()
+{
+#if defined(QBBGLCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ // Destroy EGL surface if it exists
+ if (m_eglSurface != EGL_NO_SURFACE) {
+ EGLBoolean eglResult = eglDestroySurface(ms_eglDisplay, m_eglSurface);
+ if (eglResult != EGL_TRUE) {
+ qFatal("QBB: failed to destroy EGL surface, err=%d", eglGetError());
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbglcontext.h b/src/plugins/platforms/blackberry/qbbglcontext.h
new file mode 100644
index 0000000000..8ea1df5f40
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbglcontext.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBGLCONTEXT_H
+#define QBBGLCONTEXT_H
+
+#include <QtGui/QPlatformOpenGLContext>
+#include <QtGui/QSurfaceFormat>
+#include <QtCore/QSize>
+
+#include <EGL/egl.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBBWindow;
+
+class QBBGLContext : public QPlatformOpenGLContext
+{
+public:
+ QBBGLContext(QOpenGLContext *glContext);
+ virtual ~QBBGLContext();
+
+ static void initialize();
+ static void shutdown();
+
+ virtual bool makeCurrent(QPlatformSurface *surface);
+ virtual void doneCurrent();
+ virtual void swapBuffers(QPlatformSurface *surface);
+ virtual QFunctionPointer getProcAddress(const QByteArray &procName);
+
+ virtual QSurfaceFormat format() const { return m_windowFormat; }
+
+ bool isCurrent() const;
+
+ void createSurface(QPlatformSurface *surface);
+ void destroySurface();
+
+private:
+ /** \todo Should this be non-static so we can use additional displays? */
+ static EGLDisplay ms_eglDisplay;
+
+ QSurfaceFormat m_windowFormat;
+ QOpenGLContext *m_glContext;
+
+ EGLConfig m_eglConfig;
+ EGLContext m_eglContext;
+ EGLSurface m_eglSurface;
+ QSize m_surfaceSize;
+
+ static EGLint *contextAttrs();
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBGLCONTEXT_H
diff --git a/src/plugins/platforms/blackberry/qbbinputcontext_imf.cpp b/src/plugins/platforms/blackberry/qbbinputcontext_imf.cpp
new file mode 100644
index 0000000000..fab3d3f151
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbinputcontext_imf.cpp
@@ -0,0 +1,1696 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbinputcontext_imf.h"
+#include "qbbeventthread.h"
+#include "qbbvirtualkeyboard.h"
+
+#include <QtWidgets/QAbstractSpinBox>
+#include <QtWidgets/QAction>
+
+#include <QtGui/QGuiApplication>
+#include <QtGui/QInputMethodEvent>
+#include <QtGui/QTextCharFormat>
+
+#include <QtCore/QDebug>
+#include <QtCore/QMutex>
+#include <QtCore/QVariant>
+#include <QtCore/QVariantHash>
+#include <QtCore/QWaitCondition>
+
+#include <dlfcn.h>
+#include "imf/imf_client.h"
+#include "imf/input_control.h"
+#include <process.h>
+#include <sys/keycodes.h>
+
+/** TODO:
+ Support inputMethodHints to restrict input (needs additional features in IMF).
+*/
+
+#define STRX(x) #x
+#define STR(x) STRX(x)
+
+// Someone tell me why input_control methods are in this namespace, but the rest is not.
+using namespace InputMethodSystem;
+
+#define qs(x) QString::fromLatin1(x)
+#define iarg(name) event->mArgs[qs(#name)] = QVariant::fromValue(name)
+#define parg(name) event->mArgs[qs(#name)] = QVariant::fromValue((void*)name)
+namespace
+{
+
+spannable_string_t *toSpannableString(const QString &text);
+static const input_session_t *sInputSession = 0;
+bool isSessionOkay(input_session_t *ic)
+{
+ return ic !=0 && sInputSession != 0 && ic->component_id == sInputSession->component_id;
+}
+
+enum ImfEventType
+{
+ ImfBeginBatchEdit,
+ ImfClearMetaKeyStates,
+ ImfCommitText,
+ ImfDeleteSurroundingText,
+ ImfEndBatchEdit,
+ ImfFinishComposingText,
+ ImfGetCursorCapsMode,
+ ImfGetCursorPosition,
+ ImfGetExtractedText,
+ ImfGetSelectedText,
+ ImfGetTextAfterCursor,
+ ImfGetTextBeforeCursor,
+ ImfPerformEditorAction,
+ ImfReportFullscreenMode,
+ ImfSendEvent,
+ ImfSendAsyncEvent,
+ ImfSetComposingRegion,
+ ImfSetComposingText,
+ ImfSetSelection
+};
+
+// We use this class as a round about way to support a posting synchronous event into
+// Qt's main thread from the IMF thread.
+class ImfEventResult
+{
+public:
+ ImfEventResult()
+ {
+ m_mutex.lock();
+ }
+
+ ~ImfEventResult()
+ {
+ m_mutex.unlock();
+ }
+
+ void wait()
+ {
+ m_wait.wait(&m_mutex);
+ }
+
+ void signal()
+ {
+ m_wait.wakeAll();
+ }
+
+ void setResult(const QVariant& result)
+ {
+ m_mutex.lock();
+ m_retVal = result;
+ signal();
+ m_mutex.unlock();
+ }
+
+ QVariant result()
+ {
+ return m_retVal;
+ }
+
+private:
+ QVariant m_retVal;
+ QMutex m_mutex;
+ QWaitCondition m_wait;
+};
+
+class ImfEvent : public QEvent
+{
+ public:
+ ImfEvent(input_session_t *session, ImfEventType type, ImfEventResult *result) :
+ QEvent((QEvent::Type)sUserEventType),
+ m_session(session),
+ m_imfType(type),
+ m_result(result)
+ {
+ }
+ ~ImfEvent() { }
+
+ input_session_t *m_session;
+ ImfEventType m_imfType;
+ QVariantHash m_args;
+ ImfEventResult *m_result;
+
+ static int sUserEventType;
+};
+int ImfEvent::sUserEventType = QEvent::registerEventType();
+
+static int32_t imfBeginBatchEdit(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfBeginBatchEdit, &result);
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+
+ return ret;
+}
+
+static int32_t imfClearMetaKeyStates(input_session_t *ic, int32_t states)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfClearMetaKeyStates, &result);
+ iarg(states);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+
+ return ret;
+}
+
+static int32_t imfCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfCommitText, &result);
+ parg(text);
+ iarg(new_cursor_position);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+
+ return ret;
+}
+
+static int32_t imfDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfDeleteSurroundingText, &result);
+ iarg(left_length);
+ iarg(right_length);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+
+ return ret;
+}
+
+static int32_t imfEndBatchEdit(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfEndBatchEdit, &result);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+
+ return ret;
+}
+
+static int32_t imfFinishComposingText(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfFinishComposingText, &result);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+
+ return ret;
+}
+
+static int32_t imfGetCursorCapsMode(input_session_t *ic, int32_t req_modes)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfGetCursorCapsMode, &result);
+ iarg(req_modes);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ int32_t ret = result.result().value<int32_t>();
+ return ret;
+}
+
+static int32_t imfGetCursorPosition(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfGetCursorPosition, &result);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+
+ return ret;
+}
+
+static extracted_text_t *imfGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic)) {
+ extracted_text_t *et = (extracted_text_t *)calloc(sizeof(extracted_text_t),1);
+ et->text = (spannable_string_t *)calloc(sizeof(spannable_string_t),1);
+ return et;
+ }
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfGetExtractedText, &result);
+ parg(request);
+ iarg(flags);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ return result.result().value<extracted_text_t *>();
+}
+
+static spannable_string_t *imfGetSelectedText(input_session_t *ic, int32_t flags)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return toSpannableString("");
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfGetSelectedText, &result);
+ iarg(flags);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ return result.result().value<extracted_text_t *>();
+}
+
+static spannable_string_t *imfGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return toSpannableString("");
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfGetTextAfterCursor, &result);
+ iarg(n);
+ iarg(flags);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ return result.result().value<extracted_text_t *>();
+}
+
+static spannable_string_t *imfGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return toSpannableString("");
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfGetTextBeforeCursor, &result);
+ iarg(n);
+ iarg(flags);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ return result.result().value<extracted_text_t *>();
+}
+
+static int32_t imfPerformEditorAction(input_session_t *ic, int32_t editor_action)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfPerformEditorAction, &result);
+ iarg(editor_action);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+ return ret;
+}
+
+static int32_t imfReportFullscreenMode(input_session_t *ic, int32_t enabled)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfReportFullscreenMode, &result);
+ iarg(enabled);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+ return ret;
+}
+
+static int32_t imfSendEvent(input_session_t *ic, event_t *event)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEvent *imfEvent = new ImfEvent(ic, ImfSendEvent, 0);
+ imfEvent->m_args[qs("event")] = QVariant::fromValue(static_cast<void *>(event));
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), imfEvent);
+
+ return 0;
+}
+
+static int32_t imfSendAsyncEvent(input_session_t *ic, event_t *event)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEvent *imfEvent = new ImfEvent(ic, ImfSendAsyncEvent, 0);
+ imfEvent->m_args[qs("event")] = QVariant::fromValue(static_cast<void *>(event));
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), imfEvent);
+
+ return 0;
+}
+
+static int32_t imfSetComposingRegion(input_session_t *ic, int32_t start, int32_t end)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfSetComposingRegion, &result);
+ iarg(start);
+ iarg(end);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+ return ret;
+}
+
+static int32_t imfSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfSetComposingText, &result);
+ parg(text);
+ iarg(new_cursor_position);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+ return ret;
+}
+
+static int32_t imfSetSelection(input_session_t *ic, int32_t start, int32_t end)
+{
+#if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ ImfEventResult result;
+ ImfEvent *event = new ImfEvent(ic, ImfSetSelection, &result);
+ iarg(start);
+ iarg(end);
+
+ QCoreApplication::postEvent(QCoreApplication::instance(), event);
+
+ result.wait();
+ int32_t ret = result.result().value<int32_t>();
+ return ret;
+}
+
+static connection_interface_t ic_funcs = {
+ imfBeginBatchEdit,
+ imfClearMetaKeyStates,
+ imfCommitText,
+ imfDeleteSurroundingText,
+ imfEndBatchEdit,
+ imfFinishComposingText,
+ imfGetCursorCapsMode,
+ imfGetCursorPosition,
+ imfGetExtractedText,
+ imfGetSelectedText,
+ imfGetTextAfterCursor,
+ imfGetTextBeforeCursor,
+ imfPerformEditorAction,
+ imfReportFullscreenMode,
+ NULL, //ic_send_key_event
+ imfSendEvent,
+ imfSendAsyncEvent,
+ imfSetComposingRegion,
+ imfSetComposingText,
+ imfSetSelection,
+ NULL, //ic_set_candidates,
+};
+
+static void
+initEvent(event_t *pEvent, const input_session_t *pSession, EventType eventType, int eventId)
+{
+ static int s_transactionId;
+
+ // Make sure structure is squeaky clean since it's not clear just what is significant.
+ memset(pEvent, 0, sizeof(event_t));
+ pEvent->event_type = eventType;
+ pEvent->event_id = eventId;
+ pEvent->pid = getpid();
+ pEvent->component_id = pSession->component_id;
+ pEvent->transaction_id = ++s_transactionId;
+}
+
+spannable_string_t *toSpannableString(const QString &text)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << text;
+#endif
+
+ spannable_string_t *pString = reinterpret_cast<spannable_string_t *>(malloc(sizeof(spannable_string_t)));
+ pString->str = (wchar_t *)malloc(sizeof(wchar_t) * text.length() + 1);
+ pString->length = text.length();
+ pString->spans = NULL;
+ pString->spans_count = 0;
+
+ const QChar *pData = text.constData();
+ wchar_t *pDst = pString->str;
+
+ while (!pData->isNull())
+ {
+ *pDst = pData->unicode();
+ pDst++;
+ pData++;
+ }
+ *pDst = 0;
+
+ return pString;
+}
+
+} // namespace
+
+static const input_session_t *(*p_ictrl_open_session)(connection_interface_t *) = 0;
+static void (*p_ictrl_close_session)(input_session_t *) = 0;
+static int32_t (*p_ictrl_dispatch_event)(event_t*) = 0;
+static int32_t (*p_imf_client_init)() = 0;
+static void (*p_imf_client_disconnect)() = 0;
+static int32_t (*p_vkb_init_selection_service)() = 0;
+static int32_t (*p_ictrl_get_num_active_sessions)() = 0;
+static bool s_imfInitFailed = false;
+
+static bool imfAvailable()
+{
+ static bool s_imfDisabled = getenv("DISABLE_IMF") != NULL;
+ static bool s_imfReady = false;
+
+ if ( s_imfInitFailed || s_imfDisabled) {
+ return false;
+ }
+ else if ( s_imfReady ) {
+ return true;
+ }
+
+ if ( p_imf_client_init == NULL ) {
+ void *handle = dlopen("libinput_client.so.1", 0);
+ if ( handle ) {
+ p_imf_client_init = (int32_t (*)()) dlsym(handle, "imf_client_init");
+ p_imf_client_disconnect = (void (*)()) dlsym(handle, "imf_client_disconnect");
+ p_ictrl_open_session = (const input_session_t *(*)(connection_interface_t *))dlsym(handle, "ictrl_open_session");
+ p_ictrl_close_session = (void (*)(input_session_t *))dlsym(handle, "ictrl_close_session");
+ p_ictrl_dispatch_event = (int32_t (*)(event_t *))dlsym(handle, "ictrl_dispatch_event");
+ p_vkb_init_selection_service = (int32_t (*)())dlsym(handle, "vkb_init_selection_service");
+ p_ictrl_get_num_active_sessions = (int32_t (*)())dlsym(handle, "ictrl_get_num_active_sessions");
+ }
+ else
+ {
+ qCritical() << Q_FUNC_INFO << "libinput_client.so.1 is not present - IMF services are disabled.";
+ s_imfDisabled = true;
+ return false;
+ }
+ if ( p_imf_client_init && p_ictrl_open_session && p_ictrl_dispatch_event ) {
+ s_imfReady = true;
+ }
+ else {
+ p_ictrl_open_session = NULL;
+ p_ictrl_dispatch_event = NULL;
+ s_imfDisabled = true;
+ qCritical() << Q_FUNC_INFO << "libinput_client.so.1 did not contain the correct symbols, library mismatch? IMF services are disabled.";
+ return false;
+ }
+ }
+
+ return s_imfReady;
+}
+
+QBBInputContext::QBBInputContext():
+ QPlatformInputContext(),
+ m_lastCaretPos(0),
+ m_isComposing(false),
+ m_inputPanelVisible(false),
+ m_inputPanelLocale(QLocale::c())
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!imfAvailable())
+ return;
+
+ if ( p_imf_client_init() != 0 ) {
+ s_imfInitFailed = true;
+ qCritical("imf_client_init failed - IMF services will be unavailable");
+ }
+
+ QCoreApplication::instance()->installEventFilter(this);
+
+ // p_vkb_init_selection_service();
+
+ QBBVirtualKeyboard &keyboard = QBBVirtualKeyboard::instance();
+ connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
+ connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
+ keyboardVisibilityChanged(keyboard.isVisible());
+ keyboardLocaleChanged(keyboard.locale());
+
+ QInputMethod *inputMethod = qApp->inputMethod();
+ connect(inputMethod, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged()));
+
+}
+
+QBBInputContext::~QBBInputContext()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!imfAvailable())
+ return;
+
+ QCoreApplication::instance()->removeEventFilter(this);
+ p_imf_client_disconnect();
+}
+
+#define getarg(type, name) type name = imfEvent->mArgs[qs(#name)].value<type>()
+#define getparg(type, name) type name = (type)(imfEvent->mArgs[qs(#name)].value<void*>())
+
+bool QBBInputContext::isValid() const
+{
+ return imfAvailable();
+}
+
+bool QBBInputContext::eventFilter(QObject *obj, QEvent *event)
+{
+ if (event->type() == ImfEvent::sUserEventType) {
+ // Forward the event to our real handler.
+ ImfEvent *imfEvent = static_cast<ImfEvent *>(event);
+ switch (imfEvent->m_imfType) {
+ case ImfBeginBatchEdit: {
+ int32_t ret = onBeginBatchEdit(imfEvent->m_session);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfClearMetaKeyStates: {
+ getarg(int32_t, states);
+ int32_t ret = onClearMetaKeyStates(imfEvent->m_session, states);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfCommitText: {
+ getparg(spannable_string_t*, text);
+ getarg(int32_t, new_cursor_position);
+ int32_t ret = onCommitText(imfEvent->m_session, text, new_cursor_position);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfDeleteSurroundingText: {
+ getarg(int32_t, left_length);
+ getarg(int32_t, right_length);
+ int32_t ret = onDeleteSurroundingText(imfEvent->m_session, left_length, right_length);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfEndBatchEdit: {
+ int32_t ret = onEndBatchEdit(imfEvent->m_session);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfFinishComposingText: {
+ int32_t ret = onFinishComposingText(imfEvent->m_session);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfGetCursorCapsMode: {
+ getarg(int32_t, req_modes);
+ int32_t ret = onGetCursorCapsMode(imfEvent->m_session, req_modes);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfGetCursorPosition: {
+ int32_t ret = onGetCursorPosition(imfEvent->m_session);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfGetExtractedText: {
+ getparg(extracted_text_request_t*, request);
+ getarg(int32_t, flags);
+ extracted_text_t *ret = onGetExtractedText(imfEvent->m_session, request, flags);
+ imfEvent->m_result->setResult(QVariant::fromValue(static_cast<void *>(ret)));
+ break;
+ }
+
+ case ImfGetSelectedText: {
+ getarg(int32_t, flags);
+ spannable_string_t *ret = onGetSelectedText(imfEvent->m_session, flags);
+ imfEvent->m_result->setResult(QVariant::fromValue(static_cast<void *>(ret)));
+ break;
+ }
+
+ case ImfGetTextAfterCursor: {
+ getarg(int32_t, n);
+ getarg(int32_t, flags);
+ spannable_string_t *ret = onGetTextAfterCursor(imfEvent->m_session, n, flags);
+ imfEvent->m_result->setResult(QVariant::fromValue(static_cast<void *>(ret)));
+ break;
+ }
+
+ case ImfGetTextBeforeCursor: {
+ getarg(int32_t, n);
+ getarg(int32_t, flags);
+ spannable_string_t *ret = onGetTextBeforeCursor(imfEvent->m_session, n, flags);
+ imfEvent->m_result->setResult(QVariant::fromValue((void*)ret));
+ break;
+ }
+
+ case ImfPerformEditorAction: {
+ getarg(int32_t, editor_action);
+ int32_t ret = onPerformEditorAction(imfEvent->m_session, editor_action);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfReportFullscreenMode: {
+ getarg(int32_t, enabled);
+ int32_t ret = onReportFullscreenMode(imfEvent->m_session, enabled);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfSendEvent: {
+ getparg(event_t*, event);
+ onSendEvent(imfEvent->m_session, event);
+ break;
+ }
+
+ case ImfSendAsyncEvent: {
+ getparg(event_t*, event);
+ onSendAsyncEvent(imfEvent->m_session, event);
+ break;
+ }
+
+ case ImfSetComposingRegion: {
+ getarg(int32_t, start);
+ getarg(int32_t, end);
+ int32_t ret = onSetComposingRegion(imfEvent->m_session, start, end);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfSetComposingText: {
+ getparg(spannable_string_t*, text);
+ getarg(int32_t, new_cursor_position);
+ int32_t ret = onSetComposingText(imfEvent->m_session, text, new_cursor_position);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+
+ case ImfSetSelection: {
+ getarg(int32_t, start);
+ getarg(int32_t, end);
+ int32_t ret = onSetSelection(imfEvent->m_session, start, end);
+ imfEvent->m_result->setResult(QVariant::fromValue(ret));
+ break;
+ }
+ }; //switch
+
+ return true;
+ } else {
+ // standard event processing
+ return QObject::eventFilter(obj, event);
+ }
+}
+
+bool QBBInputContext::filterEvent( const QEvent *event )
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << event;
+#endif
+ switch (event->type()) {
+ case QEvent::CloseSoftwareInputPanel: {
+ return dispatchCloseSoftwareInputPanel();
+ }
+ case QEvent::RequestSoftwareInputPanel: {
+ return dispatchRequestSoftwareInputPanel();
+ }
+ default:
+ return false;
+ }
+}
+
+void QBBInputContext::reset()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ endComposition();
+}
+
+void QBBInputContext::update(Qt::InputMethodQueries queries)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ reset();
+
+ QPlatformInputContext::update(queries);
+}
+
+void QBBInputContext::closeSession()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO
+#endif
+ if (!imfAvailable())
+ return;
+
+ if (sInputSession) {
+ p_ictrl_close_session((input_session_t *)sInputSession);
+ sInputSession = 0;
+ }
+}
+
+void QBBInputContext::openSession()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO
+#endif
+ if (!imfAvailable())
+ return;
+
+ closeSession();
+ sInputSession = p_ictrl_open_session(&ic_funcs);
+}
+
+bool QBBInputContext::hasSession()
+{
+ return sInputSession != 0;
+}
+
+bool QBBInputContext::hasSelectedText()
+{
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!input)
+ return false;
+
+ QInputMethodQueryEvent query(Qt::ImCurrentSelection);
+ QCoreApplication::sendEvent(input, &query);
+
+ return !query.value(Qt::ImCurrentSelection).toString().isEmpty();
+}
+
+bool QBBInputContext::dispatchRequestSoftwareInputPanel()
+{
+ QBBVirtualKeyboard::instance().showKeyboard();
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << "QBB: requesting virtual keyboard";
+#endif
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return true;
+
+ if (!hasSession())
+ openSession();
+
+ // This also means that the caret position has moved
+ QInputMethodQueryEvent query(Qt::ImCursorPosition);
+ QCoreApplication::sendEvent(input, &query);
+ int caretPos = query.value(Qt::ImCursorPosition).toInt();
+ caret_event_t caretEvent;
+ memset(&caretEvent, 0, sizeof(caret_event_t));
+ initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED);
+ caretEvent.old_pos = m_lastCaretPos;
+ m_lastCaretPos = caretEvent.new_pos = caretPos;
+ p_ictrl_dispatch_event((event_t *)&caretEvent);
+ return true;
+}
+
+bool QBBInputContext::dispatchCloseSoftwareInputPanel()
+{
+ QBBVirtualKeyboard::instance().hideKeyboard();
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << "QBB: hiding virtual keyboard";
+#endif
+
+ // This also means we are stopping composition, but we should already have done that.
+ return true;
+}
+
+/**
+ * IMF Event Dispatchers.
+ */
+bool QBBInputContext::dispatchFocusEvent(FocusEventId id, int hints)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!sInputSession) {
+ qWarning() << Q_FUNC_INFO << "Attempt to dispatch a focus event with no input session.";
+ return false;
+ }
+
+ if (!imfAvailable())
+ return false;
+
+ // Set the last caret position to 0 since we don't really have one and we don't
+ // want to have the old one.
+ m_lastCaretPos = 0;
+
+ focus_event_t focusEvent;
+ memset(&focusEvent, 0, sizeof(focusEvent));
+ initEvent(&focusEvent.event, sInputSession, EVENT_FOCUS, id);
+ focusEvent.style = DEFAULT_STYLE;
+
+ if (hints && Qt::ImhNoPredictiveText)
+ focusEvent.style |= NO_PREDICTION | NO_AUTO_CORRECTION;
+ if (hints && Qt::ImhNoAutoUppercase)
+ focusEvent.style |= NO_AUTO_TEXT;
+
+ p_ictrl_dispatch_event((event_t *)&focusEvent);
+
+ return true;
+}
+
+bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
+{
+ if (!imfAvailable())
+ return false;
+
+ int key = (flags & KEY_SYM_VALID) ? sym : cap;
+ bool navKey = false;
+ switch ( key ) {
+ case KEYCODE_RETURN:
+ /* In a single line edit we should end composition because enter might be used by something.
+ endComposition();
+ return false;*/
+ break;
+
+ case KEYCODE_BACKSPACE:
+ case KEYCODE_DELETE:
+ // If there is a selection range, then we want a delete key to operate on that (by
+ // deleting the contents of the select range) rather than operating on the composition
+ // range.
+ if (hasSelectedText())
+ return false;
+ break;
+ case KEYCODE_LEFT:
+ key = NAVIGATE_LEFT;
+ navKey = true;
+ break;
+ case KEYCODE_RIGHT:
+ key = NAVIGATE_RIGHT;
+ navKey = true;
+ break;
+ case KEYCODE_UP:
+ key = NAVIGATE_UP;
+ navKey = true;
+ break;
+ case KEYCODE_DOWN:
+ key = NAVIGATE_DOWN;
+ navKey = true;
+ break;
+ case KEYCODE_CAPS_LOCK:
+ case KEYCODE_LEFT_SHIFT:
+ case KEYCODE_RIGHT_SHIFT:
+ case KEYCODE_LEFT_CTRL:
+ case KEYCODE_RIGHT_CTRL:
+ case KEYCODE_LEFT_ALT:
+ case KEYCODE_RIGHT_ALT:
+ case KEYCODE_MENU:
+ case KEYCODE_LEFT_HYPER:
+ case KEYCODE_RIGHT_HYPER:
+ case KEYCODE_INSERT:
+ case KEYCODE_HOME:
+ case KEYCODE_PG_UP:
+ case KEYCODE_END:
+ case KEYCODE_PG_DOWN:
+ // Don't send these
+ key = 0;
+ break;
+ }
+
+ if ( mod & KEYMOD_CTRL ) {
+ // If CTRL is pressed, just let AIR handle it. But terminate any composition first
+ //endComposition();
+ return false;
+ }
+
+ // Pass the keys we don't know about on through
+ if ( key == 0 )
+ return false;
+
+ // IMF doesn't need key releases so just swallow them.
+ if (!(flags & KEY_DOWN))
+ return true;
+
+ if ( navKey ) {
+ // Even if we're forwarding up events, we can't do this for
+ // navigation keys.
+ if ( flags & KEY_DOWN ) {
+ navigation_event_t navEvent;
+ initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key);
+ navEvent.magnitude = 1;
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "dispatch navigation event " << key;
+#endif
+ p_ictrl_dispatch_event(&navEvent.event);
+ }
+ }
+ else {
+ key_event_t keyEvent;
+ initEvent(&keyEvent.event, sInputSession, EVENT_KEY, flags & KEY_DOWN ? IMF_KEY_DOWN : IMF_KEY_UP);
+ keyEvent.key_code = key;
+ keyEvent.character = 0;
+ keyEvent.meta_key_state = 0;
+
+ p_ictrl_dispatch_event(&keyEvent.event);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "dispatch key event " << key;
+#endif
+ }
+
+ scan = 0;
+ return true;
+}
+
+void QBBInputContext::endComposition()
+{
+ if (!m_isComposing)
+ return;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return;
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ QInputMethodEvent event(QLatin1String(""), attributes);
+ event.setCommitString(m_composingText);
+ m_composingText = QString();
+ m_isComposing = false;
+ QCoreApplication::sendEvent(input, &event);
+
+ action_event_t actionEvent;
+ memset(&actionEvent, 0, sizeof(actionEvent));
+ initEvent(&actionEvent.event, sInputSession, EVENT_ACTION, ACTION_END_COMPOSITION);
+ p_ictrl_dispatch_event(&actionEvent.event);
+}
+
+void QBBInputContext::setComposingText(QString const& composingText)
+{
+ m_composingText = composingText;
+ m_isComposing = true;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return;
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ QTextCharFormat format;
+ format.setFontUnderline(true);
+ attributes.push_back(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, composingText.length(), format));
+
+ QInputMethodEvent event(composingText, attributes);
+
+ QCoreApplication::sendEvent(input, &event);
+}
+
+int32_t QBBInputContext::processEvent(event_t *event)
+{
+ int32_t result = -1;
+ switch (event->event_type) {
+ case EVENT_SPELL_CHECK: {
+ #if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "EVENT_SPELL_CHECK";
+ #endif
+ result = 0;
+ break;
+ }
+
+ case EVENT_NAVIGATION: {
+ #if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "EVENT_NAVIGATION";
+ #endif
+
+ int key = event->event_id == NAVIGATE_UP ? KEYCODE_UP :
+ event->event_id == NAVIGATE_DOWN ? KEYCODE_DOWN :
+ event->event_id == NAVIGATE_LEFT ? KEYCODE_LEFT :
+ event->event_id == NAVIGATE_RIGHT ? KEYCODE_RIGHT : 0;
+
+ QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, key, 0, 0, 0);
+ QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, key, 0, 0, 0);
+ result = 0;
+ break;
+ }
+
+ case EVENT_KEY: {
+ #if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "EVENT_KEY";
+ #endif
+ key_event_t *kevent = static_cast<key_event_t *>(event);
+
+ QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
+ QBBEventThread::injectKeyboardEvent(KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
+
+ result = 0;
+ break;
+ }
+
+ case EVENT_ACTION:
+ // Don't care, indicates that IMF is done.
+ break;
+
+ case EVENT_CARET:
+ case EVENT_NOTHING:
+ case EVENT_FOCUS:
+ case EVENT_USER_ACTION:
+ case EVENT_STROKE:
+ case EVENT_INVOKE_LATER:
+ qCritical() << Q_FUNC_INFO << "Unsupported event type: " << event->event_type;
+ break;
+ default:
+ qCritical() << Q_FUNC_INFO << "Unknown event type: " << event->event_type;
+ }
+ return result;
+}
+
+/**
+ * IMF Event Handlers
+ */
+
+int32_t QBBInputContext::onBeginBatchEdit(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ // We don't care.
+ return 0;
+}
+
+int32_t QBBInputContext::onClearMetaKeyStates(input_session_t *ic, int32_t states)
+{
+ Q_UNUSED(states);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ // Should never get called.
+ qCritical() << Q_FUNC_INFO << "onClearMetaKeyStates is unsupported.";
+ return 0;
+}
+
+int32_t QBBInputContext::onCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
+{
+ Q_UNUSED(new_cursor_position); // TODO: How can we set the cursor position it's not part of the API.
+ if (!isSessionOkay(ic))
+ return 0;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return 0;
+
+ QString commitString = QString::fromWCharArray(text->str, text->length);
+
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "Committing [" << commitString << "]";
+#endif
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ QInputMethodEvent event(QLatin1String(""), attributes);
+ event.setCommitString(commitString, 0, 0);
+
+ QCoreApplication::sendEvent(input, &event);
+ m_composingText = QString();
+
+ return 0;
+}
+
+int32_t QBBInputContext::onDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "L:" << left_length << " R:" << right_length;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return 0;
+
+ if (hasSelectedText()) {
+ QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
+ QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
+ reset();
+ return 0;
+ }
+
+ int replacementLength = left_length + right_length;
+ int replacementStart = -left_length;
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ QInputMethodEvent event(QLatin1String(""), attributes);
+ event.setCommitString(QLatin1String(""), replacementStart, replacementLength);
+ QCoreApplication::sendEvent(input, &event);
+
+ return 0;
+}
+
+int32_t QBBInputContext::onEndBatchEdit(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ return 0;
+}
+
+int32_t QBBInputContext::onFinishComposingText(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return 0;
+
+ // Only update the control, no need to send a message back to imf (don't call
+ // end composition)
+ QList<QInputMethodEvent::Attribute> attributes;
+ QInputMethodEvent event(QLatin1String(""), attributes);
+ event.setCommitString(m_composingText);
+ m_composingText = QString();
+ m_isComposing = false;
+ QCoreApplication::sendEvent(input, &event);
+
+ return 0;
+}
+
+int32_t QBBInputContext::onGetCursorCapsMode(input_session_t *ic, int32_t req_modes)
+{
+ Q_UNUSED(req_modes);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ // Should never get called.
+ qCritical() << Q_FUNC_INFO << "onGetCursorCapsMode is unsupported.";
+
+ return 0;
+}
+
+int32_t QBBInputContext::onGetCursorPosition(input_session_t *ic)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return 0;
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition);
+ QCoreApplication::sendEvent(input, &query);
+ m_lastCaretPos = query.value(Qt::ImCursorPosition).toInt();
+
+ return m_lastCaretPos;
+}
+
+extracted_text_t *QBBInputContext::onGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags)
+{
+ Q_UNUSED(flags);
+ Q_UNUSED(request);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic)) {
+ extracted_text_t *et = (extracted_text_t *)calloc(sizeof(extracted_text_t),1);
+ et->text = reinterpret_cast<spannable_string_t *>(calloc(sizeof(spannable_string_t),1));
+ return et;
+ }
+
+ // Used to update dictionaries, but not supported right now.
+ extracted_text_t *et = (extracted_text_t *)calloc(sizeof(extracted_text_t),1);
+ et->text = reinterpret_cast<spannable_string_t *>(calloc(sizeof(spannable_string_t),1));
+
+ return et;
+}
+
+spannable_string_t *QBBInputContext::onGetSelectedText(input_session_t *ic, int32_t flags)
+{
+ Q_UNUSED(flags);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return toSpannableString("");
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return 0;
+
+ QInputMethodQueryEvent query(Qt::ImCurrentSelection);
+ QCoreApplication::sendEvent(input, &query);
+ QString text = query.value(Qt::ImCurrentSelection).toString();
+
+ return toSpannableString(text);
+}
+
+spannable_string_t *QBBInputContext::onGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags)
+{
+ Q_UNUSED(flags);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return toSpannableString("");
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return toSpannableString("");
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImSurroundingText);
+ QCoreApplication::sendEvent(input, &query);
+ QString text = query.value(Qt::ImSurroundingText).toString();
+ m_lastCaretPos = query.value(Qt::ImCursorPosition).toInt();
+
+ return toSpannableString(text.mid(m_lastCaretPos+1, n));
+}
+
+spannable_string_t *QBBInputContext::onGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags)
+{
+ Q_UNUSED(flags);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return toSpannableString("");
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return toSpannableString("");
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImSurroundingText);
+ QCoreApplication::sendEvent(input, &query);
+ QString text = query.value(Qt::ImSurroundingText).toString();
+ m_lastCaretPos = query.value(Qt::ImCursorPosition).toInt();
+
+ if (n < m_lastCaretPos) {
+ return toSpannableString(text.mid(m_lastCaretPos - n, n));
+ } else {
+ return toSpannableString(text.mid(0, m_lastCaretPos));
+ }
+}
+
+int32_t QBBInputContext::onPerformEditorAction(input_session_t *ic, int32_t editor_action)
+{
+ Q_UNUSED(editor_action);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ // Should never get called.
+ qCritical() << Q_FUNC_INFO << "onPerformEditorAction is unsupported.";
+
+ return 0;
+}
+
+int32_t QBBInputContext::onReportFullscreenMode(input_session_t *ic, int32_t enabled)
+{
+ Q_UNUSED(enabled);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ // Should never get called.
+ qCritical() << Q_FUNC_INFO << "onReportFullscreenMode is unsupported.";
+
+ return 0;
+}
+
+int32_t QBBInputContext::onSendEvent(input_session_t *ic, event_t *event)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ return processEvent(event);
+}
+
+int32_t QBBInputContext::onSendAsyncEvent(input_session_t *ic, event_t *event)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ return processEvent(event);
+}
+
+int32_t QBBInputContext::onSetComposingRegion(input_session_t *ic, int32_t start, int32_t end)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return 0;
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImSurroundingText);
+ QCoreApplication::sendEvent(input, &query);
+ QString text = query.value(Qt::ImSurroundingText).toString();
+ m_lastCaretPos = query.value(Qt::ImCursorPosition).toInt();
+
+ QString empty = QString::fromLatin1("");
+ text = text.mid(start, end - start);
+
+ // Delete the current text.
+ QList<QInputMethodEvent::Attribute> attributes;
+ QInputMethodEvent event(empty, attributes);
+ event.setCommitString(empty, start - m_lastCaretPos, end - start);
+ QCoreApplication::sendEvent(input, &event);
+
+ // Move the specified text into a preedit string.
+ setComposingText(text);
+
+ return 0;
+}
+
+int32_t QBBInputContext::onSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
+{
+ Q_UNUSED(new_cursor_position);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ QInputPanel *panel = qApp->inputPanel();
+ QObject *input = panel->inputItem();
+ if (!imfAvailable() || !input)
+ return 0;
+
+ m_isComposing = true;
+
+ QString preeditString = QString::fromWCharArray(text->str, text->length);
+ setComposingText(preeditString);
+
+ return 0;
+}
+
+int32_t QBBInputContext::onSetSelection(input_session_t *ic, int32_t start, int32_t end)
+{
+ Q_UNUSED(start);
+ Q_UNUSED(end);
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ if (!isSessionOkay(ic))
+ return 0;
+
+ // Should never get called.
+ qCritical() << Q_FUNC_INFO << "onSetSelection is unsupported.";
+
+ return 0;
+}
+
+void QBBInputContext::showInputPanel()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ dispatchRequestSoftwareInputPanel();
+}
+
+void QBBInputContext::hideInputPanel()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ dispatchCloseSoftwareInputPanel();
+}
+
+bool QBBInputContext::isInputPanelVisible() const
+{
+ return m_inputPanelVisible;
+}
+
+QLocale QBBInputContext::locale() const
+{
+ return m_inputPanelLocale;
+}
+
+void QBBInputContext::keyboardVisibilityChanged(bool visible)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "visible=" << visible;
+#endif
+ if (m_inputPanelVisible != visible) {
+ m_inputPanelVisible = visible;
+ emitInputPanelVisibleChanged();
+ }
+}
+
+void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "locale=" << locale;
+#endif
+ if (m_inputPanelLocale != locale) {
+ m_inputPanelLocale = locale;
+ emitLocaleChanged();
+ }
+}
+
+void QBBInputContext::inputItemChanged()
+{
+ QInputMethod *inputMethod = qApp->inputMethod();
+ QObject *inputItem = inputMethod->inputItem();
+
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "input item=" << inputItem;
+#endif
+
+ if (!inputItem) {
+ if (m_inputPanelVisible)
+ hideInputPanel();
+ } else {
+ if (qobject_cast<QAbstractSpinBox*>(inputItem)) {
+ QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::NumPunc);
+ } else {
+ QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::Default);
+ }
+ if (!m_inputPanelVisible)
+ showInputPanel();
+ }
+}
diff --git a/src/plugins/platforms/blackberry/qbbinputcontext_imf.h b/src/plugins/platforms/blackberry/qbbinputcontext_imf.h
new file mode 100644
index 0000000000..135ec02971
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbinputcontext_imf.h
@@ -0,0 +1,132 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBINPUTCONTEXT_H
+#define QBBINPUTCONTEXT_H
+
+#include <QtGui/QPlatformInputContext>
+
+#include <QtCore/QLocale>
+#include <QtCore/QMetaType>
+#include <QtGui/QPlatformIntegration>
+
+#include "imf/imf_client.h"
+#include "imf/input_control.h"
+
+QT_BEGIN_NAMESPACE
+
+class QBBInputContext : public QPlatformInputContext
+{
+ Q_OBJECT
+public:
+ QBBInputContext();
+ ~QBBInputContext();
+
+ virtual bool isValid() const;
+
+ virtual bool filterEvent(const QEvent *event);
+ virtual void reset();
+ virtual void update(Qt::InputMethodQueries);
+ bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
+
+ virtual void showInputPanel();
+ virtual void hideInputPanel();
+ virtual bool isInputPanelVisible() const;
+
+ virtual QLocale locale() const;
+
+protected:
+ // Filters only for IMF events.
+ bool eventFilter(QObject *obj, QEvent *event);
+
+private Q_SLOTS:
+ void keyboardVisibilityChanged(bool visible);
+ void keyboardLocaleChanged(const QLocale &locale);
+ void inputItemChanged();
+
+private:
+ // IMF Event dispatchers
+ bool dispatchFocusEvent(FocusEventId id, int hints = Qt::ImhNone);
+ bool dispatchRequestSoftwareInputPanel();
+ bool dispatchCloseSoftwareInputPanel();
+ int32_t processEvent(event_t *event);
+
+ void closeSession();
+ void openSession();
+ bool hasSession();
+ void endComposition();
+ void setComposingText(QString const &composingText);
+ bool hasSelectedText();
+
+ // IMF Event handlers - these events will come in from QCoreApplication.
+ int32_t onBeginBatchEdit(input_session_t *ic);
+ int32_t onClearMetaKeyStates(input_session_t *ic, int32_t states);
+ int32_t onCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position);
+ int32_t onDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length);
+ int32_t onEndBatchEdit(input_session_t *ic);
+ int32_t onFinishComposingText(input_session_t *ic);
+ int32_t onGetCursorCapsMode(input_session_t *ic, int32_t req_modes);
+ int32_t onGetCursorPosition(input_session_t *ic);
+ extracted_text_t *onGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags);
+ spannable_string_t *onGetSelectedText(input_session_t *ic, int32_t flags);
+ spannable_string_t *onGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags);
+ spannable_string_t *onGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags);
+ int32_t onPerformEditorAction(input_session_t *ic, int32_t editor_action);
+ int32_t onReportFullscreenMode(input_session_t *ic, int32_t enabled);
+ int32_t onSendEvent(input_session_t *ic, event_t *event);
+ int32_t onSendAsyncEvent(input_session_t *ic, event_t *event);
+ int32_t onSetComposingRegion(input_session_t *ic, int32_t start, int32_t end);
+ int32_t onSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position);
+ int32_t onSetSelection(input_session_t *ic, int32_t start, int32_t end);
+ int32_t onForceUpdate();
+
+ int m_lastCaretPos;
+ bool m_isComposing;
+ QString m_composingText;
+ bool m_inputPanelVisible;
+ QLocale m_inputPanelLocale;
+};
+
+Q_DECLARE_METATYPE(extracted_text_t*)
+
+QT_END_NAMESPACE
+
+#endif // QBBINPUTCONTEXT_H
diff --git a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp
new file mode 100644
index 0000000000..abe84e2e53
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.cpp
@@ -0,0 +1,187 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbinputcontext_noimf.h"
+#include "qbbvirtualkeyboard.h"
+
+#include <QtCore/QDebug>
+#include <QtGui/QGuiApplication>
+#include <QtWidgets/QAbstractSpinBox>
+
+QBBInputContext::QBBInputContext() :
+ QPlatformInputContext(),
+ m_inputPanelVisible(false),
+ m_inputPanelLocale(QLocale::c())
+{
+ QBBVirtualKeyboard &keyboard = QBBVirtualKeyboard::instance();
+ connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
+ connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
+ keyboardVisibilityChanged(keyboard.isVisible());
+ keyboardLocaleChanged(keyboard.locale());
+
+ QInputMethod *inputMethod = qApp->inputMethod();
+ connect(inputMethod, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged()));
+}
+
+QBBInputContext::~QBBInputContext()
+{
+}
+
+bool QBBInputContext::isValid() const
+{
+ return true;
+}
+
+bool QBBInputContext::hasPhysicalKeyboard()
+{
+ // TODO: This should query the system to check if a USB keyboard is connected.
+ return false;
+}
+
+void QBBInputContext::reset()
+{
+}
+
+bool QBBInputContext::filterEvent( const QEvent *event )
+{
+ if (hasPhysicalKeyboard())
+ return false;
+
+ if (event->type() == QEvent::CloseSoftwareInputPanel) {
+ QBBVirtualKeyboard::instance().hideKeyboard();
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << "QBB: hiding virtual keyboard";
+#endif
+ return false;
+ }
+
+ if (event->type() == QEvent::RequestSoftwareInputPanel) {
+ QBBVirtualKeyboard::instance().showKeyboard();
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << "QBB: requesting virtual keyboard";
+#endif
+ return false;
+ }
+
+ return false;
+
+}
+
+bool QBBInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
+{
+ Q_UNUSED(flags);
+ Q_UNUSED(sym);
+ Q_UNUSED(mod);
+ Q_UNUSED(scan);
+ Q_UNUSED(cap);
+ return false;
+}
+
+void QBBInputContext::showInputPanel()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ QBBVirtualKeyboard::instance().showKeyboard();
+}
+
+void QBBInputContext::hideInputPanel()
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ QBBVirtualKeyboard::instance().hideKeyboard();
+}
+
+bool QBBInputContext::isInputPanelVisible() const
+{
+ return m_inputPanelVisible;
+}
+
+QLocale QBBInputContext::locale() const
+{
+ return m_inputPanelLocale;
+}
+
+void QBBInputContext::keyboardVisibilityChanged(bool visible)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "visible=" << visible;
+#endif
+ if (m_inputPanelVisible != visible) {
+ m_inputPanelVisible = visible;
+ emitInputPanelVisibleChanged();
+ }
+}
+
+void QBBInputContext::keyboardLocaleChanged(const QLocale &locale)
+{
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "locale=" << locale;
+#endif
+ if (m_inputPanelLocale != locale) {
+ m_inputPanelLocale = locale;
+ emitLocaleChanged();
+ }
+}
+
+void QBBInputContext::inputItemChanged()
+{
+ QInputMethod *inputMethod = qApp->inputMethod();
+ QObject *inputItem = inputMethod->inputItem();
+
+#if defined(QBBINPUTCONTEXT_DEBUG)
+ qDebug() << Q_FUNC_INFO << "input item=" << inputItem;
+#endif
+
+ if (!inputItem) {
+ if (m_inputPanelVisible)
+ hideInputPanel();
+ } else {
+ if (qobject_cast<QAbstractSpinBox*>(inputItem)) {
+ QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::NumPunc);
+ } else {
+ QBBVirtualKeyboard::instance().setKeyboardMode(QBBVirtualKeyboard::Default);
+ }
+ if (!m_inputPanelVisible)
+ showInputPanel();
+ }
+}
diff --git a/src/plugins/platforms/blackberry/qbbinputcontext_noimf.h b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.h
new file mode 100644
index 0000000000..3d4d6da830
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbinputcontext_noimf.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBINPUTCONTEXT_H
+#define QBBINPUTCONTEXT_H
+
+#include <QtCore/QLocale>
+#include <QtGui/QPlatformInputContext>
+#include <QtGui/QPlatformIntegration>
+
+QT_BEGIN_NAMESPACE
+
+class QBBInputContext : public QPlatformInputContext
+{
+ Q_OBJECT
+public:
+ explicit QBBInputContext();
+ ~QBBInputContext();
+
+ virtual bool isValid() const;
+
+ void reset();
+ virtual bool filterEvent( const QEvent *event );
+ bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
+
+ virtual void showInputPanel();
+ virtual void hideInputPanel();
+ virtual bool isInputPanelVisible() const;
+
+ virtual QLocale locale() const;
+
+private Q_SLOTS:
+ void keyboardVisibilityChanged(bool visible);
+ void keyboardLocaleChanged(const QLocale &locale);
+ void inputItemChanged();
+
+private:
+ bool hasPhysicalKeyboard();
+
+ bool m_inputPanelVisible;
+ QLocale m_inputPanelLocale;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBINPUTCONTEXT_H
diff --git a/src/plugins/platforms/blackberry/qbbintegration.cpp b/src/plugins/platforms/blackberry/qbbintegration.cpp
new file mode 100644
index 0000000000..9f922a419e
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbintegration.cpp
@@ -0,0 +1,293 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbintegration.h"
+#include "qbbeventthread.h"
+#include "qbbglbackingstore.h"
+#include "qbbglcontext.h"
+#include "qbbnavigatorthread.h"
+#include "qbbrasterbackingstore.h"
+#include "qbbscreen.h"
+#include "qbbwindow.h"
+#include "qbbvirtualkeyboard.h"
+#include "qbbclipboard.h"
+#include "qbbglcontext.h"
+
+#if defined(QBB_IMF)
+#include "qbbinputcontext_imf.h"
+#else
+#include "qbbinputcontext_noimf.h"
+#endif
+
+#include "private/qgenericunixfontdatabase_p.h"
+#include "private/qgenericunixeventdispatcher_p.h"
+
+#include <QtGui/QPlatformWindow>
+#include <QtGui/QWindowSystemInterface>
+#include <QtGui/QOpenGLContext>
+
+#include <QtCore/QDebug>
+#include <QtCore/QHash>
+
+#include <errno.h>
+
+QT_BEGIN_NAMESPACE
+
+QBBWindowMapper QBBIntegration::ms_windowMapper;
+QMutex QBBIntegration::ms_windowMapperMutex;
+
+QBBIntegration::QBBIntegration()
+ : QPlatformIntegration()
+ , m_eventThread(0)
+ , m_navigatorThread(0)
+ , m_inputContext(0)
+ , m_fontDatabase(new QGenericUnixFontDatabase())
+ , m_paintUsingOpenGL(false)
+ , m_eventDispatcher(createUnixEventDispatcher())
+#ifndef QT_NO_CLIPBOARD
+ , m_clipboard(0)
+#endif
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Open connection to QNX composition manager
+ errno = 0;
+ int result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT);
+ if (result != 0) {
+ qFatal("QBB: failed to connect to composition manager, errno=%d", errno);
+ }
+
+ // Create displays for all possible screens (which may not be attached)
+ QBBScreen::createDisplays(m_screenContext);
+ Q_FOREACH (QPlatformScreen *screen, QBBScreen::screens()) {
+ screenAdded(screen);
+ }
+
+ // Initialize global OpenGL resources
+ QBBGLContext::initialize();
+
+ // Create/start event thread
+ m_eventThread = new QBBEventThread(m_screenContext, *QBBScreen::primaryDisplay());
+ m_eventThread->start();
+
+ // Create/start navigator thread
+ m_navigatorThread = new QBBNavigatorThread(*QBBScreen::primaryDisplay());
+ m_navigatorThread->start();
+
+ // Create/start the keyboard class.
+ QBBVirtualKeyboard::instance();
+
+ // Set up the input context
+ m_inputContext = new QBBInputContext;
+}
+
+QBBIntegration::~QBBIntegration()
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << "QBB: platform plugin shutdown begin";
+#endif
+ // Destroy the keyboard class.
+ QBBVirtualKeyboard::destroy();
+
+#ifndef QT_NO_CLIPBOARD
+ // Delete the clipboard
+ delete m_clipboard;
+#endif
+
+ // Stop/destroy event thread
+ delete m_eventThread;
+
+ // Stop/destroy navigator thread
+ delete m_navigatorThread;
+
+ // Destroy all displays
+ QBBScreen::destroyDisplays();
+
+ // Close connection to QNX composition manager
+ screen_destroy_context(m_screenContext);
+
+ // Cleanup global OpenGL resources
+ QBBGLContext::shutdown();
+
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << "QBB: platform plugin shutdown end";
+#endif
+}
+
+bool QBBIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+#if defined(QT_OPENGL_ES)
+ case OpenGL:
+ return true;
+#endif
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
+QPlatformWindow *QBBIntegration::createPlatformWindow(QWindow *window) const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // New windows are created on the primary display.
+ return new QBBWindow(window, m_screenContext);
+}
+
+QPlatformBackingStore *QBBIntegration::createPlatformBackingStore(QWindow *window) const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ if (paintUsingOpenGL())
+ return new QBBGLBackingStore(window);
+ else
+ return new QBBRasterBackingStore(window);
+}
+
+QPlatformOpenGLContext *QBBIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ return new QBBGLContext(context);
+}
+
+QPlatformInputContext *QBBIntegration::inputContext() const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ return m_inputContext;
+}
+
+void QBBIntegration::moveToScreen(QWindow *window, int screen)
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << "QBBIntegration::moveToScreen - w=" << window << ", s=" << screen;
+#endif
+
+ // get platform window used by widget
+ QBBWindow *platformWindow = static_cast<QBBWindow *>(window->handle());
+
+ // lookup platform screen by index
+ QBBScreen *platformScreen = static_cast<QBBScreen*>(QBBScreen::screens().at(screen));
+
+ // move the platform window to the platform screen
+ platformWindow->setScreen(platformScreen);
+}
+
+QList<QPlatformScreen *> QBBIntegration::screens() const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ return QBBScreen::screens();
+}
+
+QAbstractEventDispatcher *QBBIntegration::guiThreadEventDispatcher() const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ return m_eventDispatcher;
+}
+
+#ifndef QT_NO_CLIPBOARD
+QPlatformClipboard *QBBIntegration::clipboard() const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ if (!m_clipboard) {
+ m_clipboard = new QBBClipboard;
+ }
+ return m_clipboard;
+}
+#endif
+
+QVariant QBBIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ if (hint == ShowIsFullScreen)
+ return true;
+
+ return QPlatformIntegration::styleHint(hint);
+}
+
+QWindow *QBBIntegration::window(screen_window_t qnxWindow)
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ QMutexLocker locker(&ms_windowMapperMutex);
+ Q_UNUSED(locker);
+ return ms_windowMapper.value(qnxWindow, 0);
+}
+
+void QBBIntegration::addWindow(screen_window_t qnxWindow, QWindow *window)
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ QMutexLocker locker(&ms_windowMapperMutex);
+ Q_UNUSED(locker);
+ ms_windowMapper.insert(qnxWindow, window);
+}
+
+void QBBIntegration::removeWindow(screen_window_t qnxWindow)
+{
+#if defined(QBBINTEGRATION_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ QMutexLocker locker(&ms_windowMapperMutex);
+ Q_UNUSED(locker);
+ ms_windowMapper.remove(qnxWindow);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbintegration.h b/src/plugins/platforms/blackberry/qbbintegration.h
new file mode 100644
index 0000000000..6b54329dac
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbintegration.h
@@ -0,0 +1,119 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBINTEGRATION_H
+#define QBBINTEGRATION_H
+
+#include <QtGui/qplatformintegration_qpa.h>
+
+#include <QtCore/qmutex.h>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBBEventThread;
+class QBBInputContext;
+class QBBNavigatorThread;
+class QBBWindow;
+
+#ifndef QT_NO_CLIPBOARD
+class QBBClipboard;
+#endif
+
+template<class K, class V> class QHash;
+typedef QHash<screen_window_t, QWindow *> QBBWindowMapper;
+
+class QBBIntegration : public QPlatformIntegration
+{
+public:
+ QBBIntegration();
+ virtual ~QBBIntegration();
+
+ virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
+
+ virtual QPlatformWindow *createPlatformWindow(QWindow *window) const;
+ virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
+ virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+
+ virtual QPlatformInputContext *inputContext() const;
+
+ virtual QList<QPlatformScreen *> screens() const;
+ virtual void moveToScreen(QWindow *window, int screen);
+
+ virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const;
+
+ virtual QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; }
+
+#ifndef QT_NO_CLIPBOARD
+ virtual QPlatformClipboard *clipboard() const;
+#endif
+
+ virtual QVariant styleHint(StyleHint hint) const;
+
+ bool paintUsingOpenGL() const { return m_paintUsingOpenGL; }
+
+ static QWindow *window(screen_window_t qnxWindow);
+
+private:
+ static void addWindow(screen_window_t qnxWindow, QWindow *window);
+ static void removeWindow(screen_window_t qnxWindow);
+
+ screen_context_t m_screenContext;
+ QBBEventThread *m_eventThread;
+ QBBNavigatorThread *m_navigatorThread;
+ QBBInputContext *m_inputContext;
+ QPlatformFontDatabase *m_fontDatabase;
+ bool m_paintUsingOpenGL;
+ QAbstractEventDispatcher *m_eventDispatcher;
+#ifndef QT_NO_CLIPBOARD
+ mutable QBBClipboard* m_clipboard;
+#endif
+
+ static QBBWindowMapper ms_windowMapper;
+ static QMutex ms_windowMapperMutex;
+
+ friend class QBBWindow;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBINTEGRATION_H
diff --git a/src/plugins/platforms/blackberry/qbbkeytranslator.h b/src/plugins/platforms/blackberry/qbbkeytranslator.h
new file mode 100644
index 0000000000..fdc1220aba
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbkeytranslator.h
@@ -0,0 +1,269 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBKEYTRANSLATOR_H
+#define QBBKEYTRANSLATOR_H
+
+#include <sys/keycodes.h>
+
+#if defined(QBBEVENTTHREAD_DEBUG)
+#include <QtCore/QDebug>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+Qt::Key keyTranslator( int key )
+{
+ switch (key) {
+ case KEYCODE_PAUSE:
+ return Qt::Key_Pause;
+
+ case KEYCODE_SCROLL_LOCK:
+ return Qt::Key_ScrollLock;
+
+ case KEYCODE_PRINT:
+ return Qt::Key_Print;
+
+ case KEYCODE_SYSREQ:
+ return Qt::Key_SysReq;
+
+// case KEYCODE_BREAK:
+
+ case KEYCODE_ESCAPE:
+ return Qt::Key_Escape;
+
+ case KEYCODE_BACKSPACE:
+ return Qt::Key_Backspace;
+
+ case KEYCODE_TAB:
+ return Qt::Key_Tab;
+
+ case KEYCODE_BACK_TAB:
+ return Qt::Key_Backtab;
+
+ case KEYCODE_RETURN:
+ return Qt::Key_Return;
+
+ case KEYCODE_CAPS_LOCK:
+ return Qt::Key_CapsLock;
+
+ case KEYCODE_LEFT_SHIFT:
+ case KEYCODE_RIGHT_SHIFT:
+ return Qt::Key_Shift;
+
+ case KEYCODE_LEFT_CTRL:
+ case KEYCODE_RIGHT_CTRL:
+ return Qt::Key_Control;
+
+ case KEYCODE_LEFT_ALT:
+ case KEYCODE_RIGHT_ALT:
+ return Qt::Key_Alt;
+
+ case KEYCODE_MENU:
+ return Qt::Key_Menu;
+
+ case KEYCODE_LEFT_HYPER:
+ return Qt::Key_Hyper_L;
+
+ case KEYCODE_RIGHT_HYPER:
+ return Qt::Key_Hyper_R;
+
+ case KEYCODE_INSERT:
+ return Qt::Key_Insert;
+
+ case KEYCODE_HOME:
+ return Qt::Key_Home;
+
+ case KEYCODE_PG_UP:
+ return Qt::Key_PageUp;
+
+ case KEYCODE_DELETE:
+ return Qt::Key_Delete;
+
+ case KEYCODE_END:
+ return Qt::Key_End;
+
+ case KEYCODE_PG_DOWN:
+ return Qt::Key_PageDown;
+
+ case KEYCODE_LEFT:
+ return Qt::Key_Left;
+
+ case KEYCODE_RIGHT:
+ return Qt::Key_Right;
+
+ case KEYCODE_UP:
+ return Qt::Key_Up;
+
+ case KEYCODE_DOWN:
+ return Qt::Key_Down;
+
+ case KEYCODE_NUM_LOCK:
+ return Qt::Key_NumLock;
+
+ case KEYCODE_KP_PLUS:
+ return Qt::Key_Plus;
+
+ case KEYCODE_KP_MINUS:
+ return Qt::Key_Minus;
+
+ case KEYCODE_KP_MULTIPLY:
+ return Qt::Key_Asterisk;
+
+ case KEYCODE_KP_DIVIDE:
+ return Qt::Key_Slash;
+
+ case KEYCODE_KP_ENTER:
+ return Qt::Key_Enter;
+
+ case KEYCODE_KP_HOME:
+ return Qt::Key_Home;
+
+ case KEYCODE_KP_UP:
+ return Qt::Key_Up;
+
+ case KEYCODE_KP_PG_UP:
+ return Qt::Key_PageUp;
+
+ case KEYCODE_KP_LEFT:
+ return Qt::Key_Left;
+
+ // Is this right?
+ case KEYCODE_KP_FIVE:
+ return Qt::Key_5;
+
+ case KEYCODE_KP_RIGHT:
+ return Qt::Key_Right;
+
+ case KEYCODE_KP_END:
+ return Qt::Key_End;
+
+ case KEYCODE_KP_DOWN:
+ return Qt::Key_Down;
+
+ case KEYCODE_KP_PG_DOWN:
+ return Qt::Key_PageDown;
+
+ case KEYCODE_KP_INSERT:
+ return Qt::Key_Insert;
+
+ case KEYCODE_KP_DELETE:
+ return Qt::Key_Delete;
+
+ case KEYCODE_F1:
+ return Qt::Key_F1;
+
+ case KEYCODE_F2:
+ return Qt::Key_F2;
+
+ case KEYCODE_F3:
+ return Qt::Key_F3;
+
+ case KEYCODE_F4:
+ return Qt::Key_F4;
+
+ case KEYCODE_F5:
+ return Qt::Key_F5;
+
+ case KEYCODE_F6:
+ return Qt::Key_F6;
+
+ case KEYCODE_F7:
+ return Qt::Key_F7;
+
+ case KEYCODE_F8:
+ return Qt::Key_F8;
+
+ case KEYCODE_F9:
+ return Qt::Key_F9;
+
+ case KEYCODE_F10:
+ return Qt::Key_F10;
+
+ case KEYCODE_F11:
+ return Qt::Key_F11;
+
+ case KEYCODE_F12:
+ return Qt::Key_F12;
+
+ // See keycodes.h for more, but these are all the basics. And printables are already included.
+
+ default:
+#if defined(QBBEVENTTHREAD_DEBUG)
+ qDebug() << "QBB: unknown key for translation:" << key;
+#endif
+ break;
+ }
+
+ return Qt::Key_Escape;
+}
+
+bool isKeypadKey( int key )
+{
+ switch (key)
+ {
+ case KEYCODE_KP_PLUS:
+ case KEYCODE_KP_MINUS:
+ case KEYCODE_KP_MULTIPLY:
+ case KEYCODE_KP_DIVIDE:
+ case KEYCODE_KP_ENTER:
+ case KEYCODE_KP_HOME:
+ case KEYCODE_KP_UP:
+ case KEYCODE_KP_PG_UP:
+ case KEYCODE_KP_LEFT:
+ case KEYCODE_KP_FIVE:
+ case KEYCODE_KP_RIGHT:
+ case KEYCODE_KP_END:
+ case KEYCODE_KP_DOWN:
+ case KEYCODE_KP_PG_DOWN:
+ case KEYCODE_KP_INSERT:
+ case KEYCODE_KP_DELETE:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+QT_END_NAMESPACE
+
+#endif // QBBKEYTRANSLATOR_H
diff --git a/src/plugins/platforms/blackberry/qbbnavigatorthread.cpp b/src/plugins/platforms/blackberry/qbbnavigatorthread.cpp
new file mode 100644
index 0000000000..65cbb77d31
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbnavigatorthread.cpp
@@ -0,0 +1,279 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbnavigatorthread.h"
+#include "qbbscreen.h"
+
+#include <QtGui/QGuiApplication>
+#include <QtGui/QWindow>
+#include <QtGui/QWindowSystemInterface>
+
+#include <QtCore/QByteArray>
+#include <QtCore/QDebug>
+#include <QtCore/QList>
+#include <QtCore/QSocketNotifier>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+static const char *navigatorControlPath = "/pps/services/navigator/control";
+static const int ppsBufferSize = 4096;
+
+QBBNavigatorThread::QBBNavigatorThread(QBBScreen& primaryScreen)
+ : m_primaryScreen(primaryScreen),
+ m_fd(-1),
+ m_readNotifier(0)
+{
+}
+
+QBBNavigatorThread::~QBBNavigatorThread()
+{
+ // block until thread terminates
+ shutdown();
+
+ delete m_readNotifier;
+}
+
+void QBBNavigatorThread::run()
+{
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "QBB: navigator thread started";
+#endif
+
+ // open connection to navigator
+ errno = 0;
+ m_fd = open(navigatorControlPath, O_RDWR);
+ if (m_fd == -1) {
+ qWarning("QBB: failed to open navigator pps, errno=%d", errno);
+ return;
+ }
+
+ m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read);
+ // using direct connection to get the slot called in this thread's context
+ connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(readData()), Qt::DirectConnection);
+
+ exec();
+
+ // close connection to navigator
+ close(m_fd);
+
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "QBB: navigator thread stopped";
+#endif
+}
+
+void QBBNavigatorThread::shutdown()
+{
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "QBB: navigator thread shutdown begin";
+#endif
+
+ // signal thread to terminate
+ quit();
+
+ // block until thread terminates
+ wait();
+
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "QBB: navigator thread shutdown end";
+#endif
+}
+
+void QBBNavigatorThread::parsePPS(const QByteArray &ppsData, QByteArray &msg, QByteArray &dat, QByteArray &id)
+{
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: data=" << ppsData;
+#endif
+
+ // tokenize pps data into lines
+ QList<QByteArray> lines = ppsData.split('\n');
+
+ // validate pps object
+ if (lines.size() == 0 || lines.at(0) != "@control") {
+ qFatal("QBB: unrecognized pps object, data=%s", ppsData.constData());
+ }
+
+ // parse pps object attributes and extract values
+ for (int i = 1; i < lines.size(); i++) {
+
+ // tokenize current attribute
+ const QByteArray &attr = lines.at(i);
+
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: attr=" << attr;
+#endif
+
+ int firstColon = attr.indexOf(':');
+ if (firstColon == -1) {
+ // abort - malformed attribute
+ continue;
+ }
+
+ int secondColon = attr.indexOf(':', firstColon + 1);
+ if (secondColon == -1) {
+ // abort - malformed attribute
+ continue;
+ }
+
+ QByteArray key = attr.left(firstColon);
+ QByteArray value = attr.mid(secondColon + 1);
+
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: key=" << key;
+ qDebug() << "PPS: val=" << value;
+#endif
+
+ // save attribute value
+ if (key == "msg") {
+ msg = value;
+ } else if (key == "dat") {
+ dat = value;
+ } else if (key == "id") {
+ id = value;
+ } else {
+ qFatal("QBB: unrecognized pps attribute, attr=%s", key.constData());
+ }
+ }
+}
+
+void QBBNavigatorThread::replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat)
+{
+ // construct pps message
+ QByteArray ppsData = "res::";
+ ppsData += res;
+ ppsData += "\nid::";
+ ppsData += id;
+ if (!dat.isEmpty()) {
+ ppsData += "\ndat::";
+ ppsData += dat;
+ }
+ ppsData += "\n";
+
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS reply=" << ppsData;
+#endif
+
+ // send pps message to navigator
+ errno = 0;
+ int bytes = write(m_fd, ppsData.constData(), ppsData.size());
+ if (bytes == -1) {
+ qFatal("QBB: failed to write navigator pps, errno=%d", errno);
+ }
+}
+
+void QBBNavigatorThread::handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id)
+{
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: msg=" << msg << ", dat=" << dat << ", id=" << id;
+#endif
+
+ // check message type
+ if (msg == "orientationCheck") {
+
+ // reply to navigator that (any) orientation is acceptable
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: orientation check, o=" << dat;
+#endif
+ replyPPS(msg, id, "true");
+
+ } else if (msg == "orientation") {
+
+ // update screen geometry and reply to navigator that we're ready
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: orientation, o=" << dat;
+#endif
+ m_primaryScreen.setRotation( dat.toInt() );
+ QWindowSystemInterface::handleScreenGeometryChange(0, m_primaryScreen.geometry());
+ replyPPS(msg, id, "");
+
+ } else if (msg == "SWIPE_DOWN") {
+
+ // simulate menu key press
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: menu";
+#endif
+ QWindow *w = QGuiApplication::focusWindow();
+ QWindowSystemInterface::handleKeyEvent(w, QEvent::KeyPress, Qt::Key_Menu, Qt::NoModifier);
+ QWindowSystemInterface::handleKeyEvent(w, QEvent::KeyRelease, Qt::Key_Menu, Qt::NoModifier);
+
+ } else if (msg == "exit") {
+
+ // shutdown everything
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "PPS: exit";
+#endif
+ QCoreApplication::quit();
+ }
+}
+
+void QBBNavigatorThread::readData()
+{
+#if defined(QBBNAVIGATORTHREAD_DEBUG)
+ qDebug() << "QBB: reading navigator data";
+#endif
+ // allocate buffer for pps data
+ char buffer[ppsBufferSize];
+
+ // attempt to read pps data
+ errno = 0;
+ int bytes = read(m_fd, buffer, ppsBufferSize - 1);
+ if (bytes == -1) {
+ qFatal("QBB: failed to read navigator pps, errno=%d", errno);
+ }
+
+ // check if pps data was received
+ if (bytes > 0) {
+
+ // ensure data is null terminated
+ buffer[bytes] = '\0';
+
+ // process received message
+ QByteArray ppsData(buffer);
+ QByteArray msg;
+ QByteArray dat;
+ QByteArray id;
+ parsePPS(ppsData, msg, dat, id);
+ handleMessage(msg, dat, id);
+ }
+}
diff --git a/src/plugins/platforms/blackberry/qbbnavigatorthread.h b/src/plugins/platforms/blackberry/qbbnavigatorthread.h
new file mode 100644
index 0000000000..fda24b0c67
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbnavigatorthread.h
@@ -0,0 +1,78 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBNAVIGATORTHREAD_H
+#define QBBNAVIGATORTHREAD_H
+
+#include <QThread>
+
+QT_BEGIN_NAMESPACE
+
+class QBBScreen;
+class QSocketNotifier;
+
+class QBBNavigatorThread : public QThread
+{
+ Q_OBJECT
+public:
+ QBBNavigatorThread(QBBScreen &primaryScreen);
+ virtual ~QBBNavigatorThread();
+
+protected:
+ virtual void run();
+
+private Q_SLOTS:
+ void readData();
+
+private:
+ void shutdown();
+ void parsePPS(const QByteArray &ppsData, QByteArray &msg, QByteArray &dat, QByteArray &id);
+ void replyPPS(const QByteArray &res, const QByteArray &id, const QByteArray &dat);
+ void handleMessage(const QByteArray &msg, const QByteArray &dat, const QByteArray &id);
+
+ QBBScreen &m_primaryScreen;
+ int m_fd;
+ QSocketNotifier *m_readNotifier;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBNAVIGATORTHREAD_H
diff --git a/src/plugins/platforms/blackberry/qbbrasterbackingstore.cpp b/src/plugins/platforms/blackberry/qbbrasterbackingstore.cpp
new file mode 100644
index 0000000000..405e09260f
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbrasterbackingstore.cpp
@@ -0,0 +1,166 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbrasterbackingstore.h"
+#include "qbbwindow.h"
+
+#include <QtCore/QDebug>
+
+#include <errno.h>
+
+QT_BEGIN_NAMESPACE
+
+QBBRasterBackingStore::QBBRasterBackingStore(QWindow *window)
+ : QPlatformBackingStore(window)
+{
+#if defined(QBBRASTERBACKINGSTORE_DEBUG)
+ qDebug() << "QBBRasterBackingStore::QBBRasterBackingStore - w=" << window;
+#endif
+
+ // save platform window associated with widget
+ m_platformWindow = static_cast<QBBWindow*>(window->handle());
+}
+
+QBBRasterBackingStore::~QBBRasterBackingStore()
+{
+#if defined(QBBRasterBackingStore_DEBUG)
+ qDebug() << "QBBRasterBackingStore::~QBBRasterBackingStore - w=" << window();
+#endif
+}
+
+QPaintDevice *QBBRasterBackingStore::paintDevice()
+{
+ return m_platformWindow->renderBuffer().image();
+}
+
+void QBBRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
+{
+ Q_UNUSED(window);
+ Q_UNUSED(offset);
+
+#if defined(QBBRASTERBACKINGSTORE_DEBUG)
+ qDebug() << "QBBRasterBackingStore::flush - w=" << this->window();
+#endif
+
+ // visit all pending scroll operations
+ for (int i = m_scrollOpList.size() - 1; i >= 0; i--) {
+
+ // do the scroll operation
+ ScrollOp &op = m_scrollOpList[i];
+ QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) );
+ m_platformWindow->scroll(srcArea, op.dx, op.dy);
+ }
+
+ // clear all pending scroll operations
+ m_scrollOpList.clear();
+
+ // update the display with newly rendered content
+ m_platformWindow->post(region);
+}
+
+void QBBRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
+{
+ Q_UNUSED(size);
+ Q_UNUSED(staticContents);
+#if defined(QBBRASTERBACKINGSTORE_DEBUG)
+ qDebug() << "QBBRasterBackingStore::resize - w=" << window() << ", s=" << size;
+#endif
+
+ // NOTE: defer resizing window buffers until next paint as
+ // resize() can be called multiple times before a paint occurs
+}
+
+bool QBBRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
+{
+#if defined(QBBRASTERBACKINGSTORE_DEBUG)
+ qDebug() << "QBBRasterBackingStore::scroll - w=" << window();
+#endif
+
+ // calculate entire region affected by scroll operation (src + dst)
+ QRegion totalArea = area.translated(dx, dy);
+ totalArea += area;
+
+ // visit all pending scroll operations
+ for (int i = m_scrollOpList.size() - 1; i >= 0; i--) {
+
+ ScrollOp &op = m_scrollOpList[i];
+ if (op.totalArea == totalArea) {
+ // same area is being scrolled again - update delta
+ op.dx += dx;
+ op.dy += dy;
+ return true;
+ } else if (op.totalArea.intersects(totalArea)) {
+ // current scroll overlaps previous scroll but is
+ // not equal in area - just paint everything
+ qWarning("QBB: pending scroll operations overlap but not equal");
+ return false;
+ }
+ }
+
+ // create new scroll operation
+ m_scrollOpList.append( ScrollOp(totalArea, dx, dy) );
+ return true;
+}
+
+void QBBRasterBackingStore::beginPaint(const QRegion &region)
+{
+ Q_UNUSED(region);
+
+#if defined(QBBRASTERBACKINGSTORE_DEBUG)
+ qDebug() << "QBBRasterBackingStore::beginPaint - w=" << window();
+#endif
+
+ // resize window buffers if surface resized
+ QSize s = window()->size();
+ if (s != m_platformWindow->bufferSize()) {
+ m_platformWindow->setBufferSize(s);
+ }
+}
+
+void QBBRasterBackingStore::endPaint(const QRegion &region)
+{
+ Q_UNUSED(region);
+#if defined(QBBRasterBackingStore_DEBUG)
+ qDebug() << "QBBRasterBackingStore::endPaint - w=" << window();
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbrasterbackingstore.h b/src/plugins/platforms/blackberry/qbbrasterbackingstore.h
new file mode 100644
index 0000000000..ca1e27bcc8
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbrasterbackingstore.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBRASTERWINDOWSURFACE_H
+#define QBBRASTERWINDOWSURFACE_H
+
+#include <QtGui/qplatformbackingstore_qpa.h>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBBWindow;
+
+class QBBRasterBackingStore : public QPlatformBackingStore
+{
+public:
+ QBBRasterBackingStore(QWindow *window);
+ virtual ~QBBRasterBackingStore();
+
+ virtual QPaintDevice *paintDevice();
+ virtual void flush(QWindow *window, const QRegion &region, const QPoint &offset);
+ virtual void resize(const QSize &size, const QRegion &staticContents);
+ virtual bool scroll(const QRegion &area, int dx, int dy);
+ virtual void beginPaint(const QRegion &region);
+ virtual void endPaint(const QRegion &region);
+
+private:
+ class ScrollOp {
+ public:
+ ScrollOp(const QRegion &a, int x, int y) : totalArea(a), dx(x), dy(y) {}
+ QRegion totalArea;
+ int dx;
+ int dy;
+ };
+
+ QBBWindow *m_platformWindow;
+ QList<ScrollOp> m_scrollOpList;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBRASTERWINDOWSURFACE_H
diff --git a/src/plugins/platforms/blackberry/qbbrootwindow.cpp b/src/plugins/platforms/blackberry/qbbrootwindow.cpp
new file mode 100644
index 0000000000..831b0774f9
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbrootwindow.cpp
@@ -0,0 +1,257 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbrootwindow.h"
+
+#include "qbbscreen.h"
+
+#include <QtCore/QUuid>
+
+#if defined(QBBROOTWINDOW_DEBUG)
+#include <QtCore/QDebug>
+#endif
+
+#include <errno.h>
+#include <unistd.h>
+
+static const int MAGIC_ZORDER_FOR_NO_NAV = 10;
+
+QBBRootWindow::QBBRootWindow(QBBScreen *screen)
+ : m_screen(screen),
+ m_window(0),
+ m_windowGroupName()
+{
+#if defined(QBBROOTWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Create one top-level QNX window to act as a container for child windows
+ // since navigator only supports one application window
+ errno = 0;
+ int result = screen_create_window(&m_window, m_screen->nativeContext());
+ int val[2];
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to create window, errno=%d", errno);
+ }
+
+ // Move window to proper display
+ errno = 0;
+ screen_display_t display = m_screen->nativeDisplay();
+ result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window display, errno=%d", errno);
+ }
+
+ // Make sure window is above navigator but below keyboard if running as root
+ // since navigator won't automatically set our z-order in this case
+ if (getuid() == 0) {
+ errno = 0;
+ val[0] = MAGIC_ZORDER_FOR_NO_NAV;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window z-order, errno=%d", errno);
+ }
+ }
+
+ // Window won't be visible unless it has some buffers so make one dummy buffer that is 1x1
+ errno = 0;
+ val[0] = SCREEN_USAGE_NATIVE;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window buffer usage, errno=%d", errno);
+ }
+
+ errno = 0;
+ val[0] = m_screen->nativeFormat();
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window pixel format, errno=%d", errno);
+ }
+
+ errno = 0;
+ val[0] = 1;
+ val[1] = 1;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window buffer size, errno=%d", errno);
+ }
+
+ errno = 0;
+ result = screen_create_window_buffers(m_window, 1);
+ if (result != 0) {
+ qFatal("QBB: failed to create window buffer, errno=%d", errno);
+ }
+
+ // Window is always the size of the display
+ errno = 0;
+ QRect geometry = m_screen->geometry();
+ val[0] = geometry.width();
+ val[1] = geometry.height();
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window size, errno=%d", errno);
+ }
+
+ // Fill the window with solid black
+ errno = 0;
+ val[0] = 0;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_COLOR, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window colour, errno=%d", errno);
+ }
+
+ // Make the window opaque
+ errno = 0;
+ val[0] = SCREEN_TRANSPARENCY_NONE;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window transparency, errno=%d", errno);
+ }
+
+ // Set the swap interval to 1
+ errno = 0;
+ val[0] = 1;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window swap interval, errno=%d", errno);
+ }
+
+ // Set viewport size equal to window size but move outside buffer so the fill colour is used exclusively
+ errno = 0;
+ val[0] = geometry.width();
+ val[1] = geometry.height();
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window source size, errno=%d", errno);
+ }
+
+ errno = 0;
+ val[0] = 1;
+ val[1] = 0;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_POSITION, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window source position, errno=%d", errno);
+ }
+
+ createWindowGroup();
+ post();
+}
+
+QBBRootWindow::~QBBRootWindow()
+{
+ // Cleanup top-level QNX window
+ screen_destroy_window(m_window);
+}
+
+void QBBRootWindow::post() const
+{
+#if defined(QBBROOTWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ errno = 0;
+ screen_buffer_t buffer;
+ int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&buffer);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to query window buffer, errno=%d", errno);
+ }
+
+ errno = 0;
+ int dirtyRect[] = {0, 0, 1, 1};
+ result = screen_post_window(m_window, buffer, 1, dirtyRect, 0);
+ if (result != 0) {
+ qFatal("QBB: failed to post window buffer, errno=%d", errno);
+ }
+}
+
+void QBBRootWindow::flush() const
+{
+#if defined(QBBROOTWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Force immediate display update
+ errno = 0;
+ int result = screen_flush_context(m_screen->nativeContext(), 0);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to flush context, errno=%d", errno);
+ }
+}
+
+void QBBRootWindow::setRotation(int rotation)
+{
+#if defined(QBBROOTWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "angle =" << rotation;
+#endif
+ errno = 0;
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window rotation, errno=%d", errno);
+ }
+}
+
+void QBBRootWindow::resize(const QSize &size)
+{
+ errno = 0;
+ int val[] = {size.width(), size.height()};
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window size, errno=%d", errno);
+ }
+
+ errno = 0;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to set window source size, errno=%d", errno);
+ }
+
+ // NOTE: display will update when child windows relayout and repaint
+}
+
+void QBBRootWindow::createWindowGroup()
+{
+ // Generate a random window group name
+ m_windowGroupName = QUuid::createUuid().toString().toAscii();
+
+ // Create window group so child windows can be parented by container window
+ errno = 0;
+ int result = screen_create_window_group(m_window, m_windowGroupName.constData());
+ if (result != 0) {
+ qFatal("QBBRootWindow: failed to create app window group, errno=%d", errno);
+ }
+}
diff --git a/src/plugins/platforms/blackberry/qbbrootwindow.h b/src/plugins/platforms/blackberry/qbbrootwindow.h
new file mode 100644
index 0000000000..0b89f52a5e
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbrootwindow.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBROOTWINDOW_H
+#define QBBROOTWINDOW_H
+
+#include <QtCore/QByteArray>
+#include <QtCore/QRect>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBBScreen;
+
+class QBBRootWindow
+{
+public:
+ QBBRootWindow(QBBScreen *screen);
+ ~QBBRootWindow();
+
+ screen_window_t nativeHandle() const { return m_window; }
+
+ void post() const;
+ void flush() const;
+
+ void setRotation(int rotation);
+
+ void resize(const QSize &size);
+
+ QByteArray groupName() const { return m_windowGroupName; }
+
+private:
+ void createWindowGroup();
+
+ QBBScreen *m_screen;
+ screen_window_t m_window;
+ QByteArray m_windowGroupName;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBROOTWINDOW_H
diff --git a/src/plugins/platforms/blackberry/qbbscreen.cpp b/src/plugins/platforms/blackberry/qbbscreen.cpp
new file mode 100644
index 0000000000..39d2136b7d
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbscreen.cpp
@@ -0,0 +1,315 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbscreen.h"
+#include "qbbvirtualkeyboard.h"
+#include "qbbwindow.h"
+
+#include <QtCore/QDebug>
+#include <QtCore/QUuid>
+
+#include <errno.h>
+
+QT_BEGIN_NAMESPACE
+
+QList<QPlatformScreen *> QBBScreen::ms_screens;
+QList<QBBWindow*> QBBScreen::ms_childWindows;
+
+QBBScreen::QBBScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen)
+ : m_screenContext(screenContext),
+ m_display(display),
+ m_rootWindow(),
+ m_primaryScreen(primaryScreen),
+ m_posted(false),
+ m_platformContext(0)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Cache initial orientation of this display
+ // TODO: use ORIENTATION environment variable?
+ errno = 0;
+ int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation);
+ if (result != 0) {
+ qFatal("QBBScreen: failed to query display rotation, errno=%d", errno);
+ }
+ m_currentRotation = m_initialRotation;
+
+ // Cache size of this display in pixels
+ // TODO: use WIDTH and HEIGHT environment variables?
+ errno = 0;
+ int val[2];
+ result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBScreen: failed to query display size, errno=%d", errno);
+ }
+
+ m_currentGeometry = m_initialGeometry = QRect(0, 0, val[0], val[1]);
+
+ // Cache size of this display in millimeters
+ errno = 0;
+ result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_PHYSICAL_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBScreen: failed to query display physical size, errno=%d", errno);
+ }
+
+ // Peg the DPI to 96 (for now) so fonts are a reasonable size. We'll want to match
+ // everything with a QStyle later, and at that point the physical size can be used
+ // instead.
+ {
+ static const int dpi = 96;
+ int width = m_currentGeometry.width() / dpi * qreal(25.4) ;
+ int height = m_currentGeometry.height() / dpi * qreal(25.4) ;
+
+ m_currentPhysicalSize = m_initialPhysicalSize = QSize(width,height);
+ }
+
+ // We only create the root window if we are the primary display.
+ if (primaryScreen)
+ m_rootWindow = QSharedPointer<QBBRootWindow>(new QBBRootWindow(this));
+}
+
+QBBScreen::~QBBScreen()
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+}
+
+/* static */
+void QBBScreen::createDisplays(screen_context_t context)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Query number of displays
+ errno = 0;
+ int displayCount;
+ int result = screen_get_context_property_iv(context, SCREEN_PROPERTY_DISPLAY_COUNT, &displayCount);
+ if (result != 0) {
+ qFatal("QBBScreen: failed to query display count, errno=%d", errno);
+ }
+
+ // Get all displays
+ errno = 0;
+ screen_display_t *displays = (screen_display_t *)alloca(sizeof(screen_display_t) * displayCount);
+ result = screen_get_context_property_pv(context, SCREEN_PROPERTY_DISPLAYS, (void **)displays);
+ if (result != 0) {
+ qFatal("QBBScreen: failed to query displays, errno=%d", errno);
+ }
+
+ for (int i=0; i<displayCount; i++) {
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << "QBBScreen::Creating screen for display " << i;
+#endif
+ QBBScreen *screen = new QBBScreen(context, displays[i], i==0);
+ ms_screens.append(screen);
+ }
+}
+
+/* static */
+void QBBScreen::destroyDisplays()
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ qDeleteAll(ms_screens);
+ ms_screens.clear();
+
+ // We're not managing the child windows anymore so we need to clear the list.
+ ms_childWindows.clear();
+}
+
+/* static */
+int QBBScreen::defaultDepth()
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ static int defaultDepth = 0;
+ if (defaultDepth == 0) {
+ // check if display depth was specified in environment variable;
+ // use default value if no valid value found
+ defaultDepth = qgetenv("QBB_DISPLAY_DEPTH").toInt();
+ if (defaultDepth != 16 && defaultDepth != 32) {
+ defaultDepth = 32;
+ }
+ }
+ return defaultDepth;
+}
+
+QRect QBBScreen::availableGeometry() const
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // available geometry = total geometry - keyboard
+ int keyboardHeight = QBBVirtualKeyboard::instance().height();
+ return QRect(m_currentGeometry.x(), m_currentGeometry.y(),
+ m_currentGeometry.width(), m_currentGeometry.height() - keyboardHeight);
+}
+
+/*!
+ Check if the supplied angles are perpendicular to each other.
+*/
+static bool isOrthogonal(int angle1, int angle2)
+{
+ return ((angle1 - angle2) % 180) != 0;
+}
+
+void QBBScreen::setRotation(int rotation)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO << "orientation =" << rotation;
+#endif
+ // Check if rotation changed
+ if (m_currentRotation != rotation) {
+ // Update rotation of root window
+ if (m_rootWindow)
+ m_rootWindow->setRotation(rotation);
+
+ // Swap dimensions if we've rotated 90 or 270 from initial orientation
+ if (isOrthogonal(m_currentRotation, rotation)) {
+ m_currentGeometry = QRect(0, 0, m_initialGeometry.height(), m_initialGeometry.width());
+ m_currentPhysicalSize = QSize(m_initialPhysicalSize.height(), m_initialPhysicalSize.width());
+ } else {
+ m_currentGeometry = QRect(0, 0, m_initialGeometry.width(), m_initialGeometry.height());
+ m_currentPhysicalSize = m_initialPhysicalSize;
+ }
+
+ // Resize root window if we've rotated 90 or 270 from previous orientation
+ if (isOrthogonal(m_currentRotation, rotation)) {
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size();
+#endif
+ if (m_rootWindow)
+ m_rootWindow->resize(m_currentGeometry.size());
+ } else {
+ // TODO: Find one global place to flush display updates
+ // Force immediate display update if no geometry changes required
+ if (m_rootWindow)
+ m_rootWindow->flush();
+ }
+
+ // Save new rotation
+ m_currentRotation = rotation;
+ }
+}
+
+void QBBScreen::addWindow(QBBWindow *window)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window;
+#endif
+
+ if (ms_childWindows.contains(window))
+ return;
+
+ ms_childWindows.push_back(window);
+ QBBScreen::updateHierarchy();
+}
+
+void QBBScreen::removeWindow(QBBWindow *window)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window;
+#endif
+
+ ms_childWindows.removeAll(window);
+ QBBScreen::updateHierarchy();
+}
+
+void QBBScreen::raiseWindow(QBBWindow *window)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window;
+#endif
+
+ removeWindow(window);
+ ms_childWindows.push_back(window);
+ QBBScreen::updateHierarchy();
+}
+
+void QBBScreen::lowerWindow(QBBWindow *window)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window;
+#endif
+
+ removeWindow(window);
+ ms_childWindows.push_front(window);
+ QBBScreen::updateHierarchy();
+}
+
+void QBBScreen::updateHierarchy()
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+
+ QList<QBBWindow*>::iterator it;
+ int topZorder = 0;
+
+ for (it = ms_childWindows.begin(); it != ms_childWindows.end(); it++)
+ (*it)->updateZorder(topZorder);
+
+ // After a hierarchy update, we need to force a flush on all screens.
+ // Right now, all screens share a context.
+ screen_flush_context( primaryDisplay()->m_screenContext, 0 );
+}
+
+void QBBScreen::onWindowPost(QBBWindow *window)
+{
+#if defined(QBBSCREEN_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ Q_UNUSED(window)
+
+ // post app window (so navigator will show it) after first child window
+ // has posted; this only needs to happen once as the app window's content
+ // never changes
+ if (!m_posted && m_rootWindow) {
+ m_rootWindow->post();
+ m_posted = true;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbscreen.h b/src/plugins/platforms/blackberry/qbbscreen.h
new file mode 100644
index 0000000000..16606944d8
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbscreen.h
@@ -0,0 +1,121 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBSCREEN_H
+#define QBBSCREEN_H
+
+#include <QtGui/QPlatformScreen>
+
+#include "qbbrootwindow.h"
+
+#include <QtCore/QByteArray>
+#include <QtCore/QScopedPointer>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBBWindow;
+
+class QBBScreen : public QPlatformScreen
+{
+public:
+ static QList<QPlatformScreen *> screens() { return ms_screens; }
+ static void createDisplays(screen_context_t context);
+ static void destroyDisplays();
+ static QBBScreen *primaryDisplay() { return static_cast<QBBScreen*>(ms_screens.at(0)); }
+ static int defaultDepth();
+
+ virtual QRect geometry() const { return m_currentGeometry; }
+ virtual QRect availableGeometry() const;
+ virtual int depth() const { return defaultDepth(); }
+ virtual QImage::Format format() const { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; }
+ virtual QSizeF physicalSize() const { return m_currentPhysicalSize; }
+
+ bool isPrimaryScreen() const { return m_primaryScreen; }
+
+ int rotation() const { return m_currentRotation; }
+ void setRotation(int rotation);
+
+ int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; }
+ screen_display_t nativeDisplay() const { return m_display; }
+ screen_context_t nativeContext() const { return m_screenContext; }
+ const char *windowGroupName() const { return m_rootWindow->groupName().constData(); }
+
+ /* Window hierarchy management */
+ static void addWindow(QBBWindow *child);
+ static void removeWindow(QBBWindow *child);
+ static void raiseWindow(QBBWindow *window);
+ static void lowerWindow(QBBWindow *window);
+ static void updateHierarchy();
+
+ void onWindowPost(QBBWindow *window);
+
+ QSharedPointer<QBBRootWindow> rootWindow() const { return m_rootWindow; }
+
+private:
+ QBBScreen(screen_context_t context, screen_display_t display, bool primaryScreen);
+ virtual ~QBBScreen();
+
+ static bool orthogonal(int rotation1, int rotation2);
+
+ screen_context_t m_screenContext;
+ screen_display_t m_display;
+ QSharedPointer<QBBRootWindow> m_rootWindow;
+ bool m_primaryScreen;
+ bool m_posted;
+ bool m_usingOpenGL;
+
+ int m_initialRotation;
+ int m_currentRotation;
+ QSize m_initialPhysicalSize;
+ QSize m_currentPhysicalSize;
+ QRect m_initialGeometry;
+ QRect m_currentGeometry;
+ QPlatformOpenGLContext *m_platformContext;
+
+ static QList<QPlatformScreen *> ms_screens;
+ static QList<QBBWindow *> ms_childWindows;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBSCREEN_H
diff --git a/src/plugins/platforms/blackberry/qbbvirtualkeyboard.cpp b/src/plugins/platforms/blackberry/qbbvirtualkeyboard.cpp
new file mode 100644
index 0000000000..082ef9b19d
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbvirtualkeyboard.cpp
@@ -0,0 +1,500 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbvirtualkeyboard.h"
+#include "qbbscreen.h"
+
+#include <QtGui/QPlatformScreen>
+#include <QtGui/QPlatformWindow>
+
+#include <QtCore/QDebug>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/iomsg.h>
+#include <sys/pps.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+const char *QBBVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait";
+const size_t QBBVirtualKeyboard::ms_bufferSize = 2048;
+
+static QBBVirtualKeyboard *s_instance = 0;
+
+// Huge hack for keyboard shadow (see QNX PR 88400). Should be removed ASAP.
+#define KEYBOARD_SHADOW_HEIGHT 8
+
+QBBVirtualKeyboard::QBBVirtualKeyboard() :
+ m_encoder(NULL),
+ m_decoder(NULL),
+ m_buffer(NULL),
+ m_height(0),
+ m_fd(-1),
+ m_keyboardMode(Default),
+ m_visible(false),
+ m_locale(QLatin1String("en_US"))
+{
+ connect();
+}
+
+QBBVirtualKeyboard::~QBBVirtualKeyboard()
+{
+ close();
+}
+
+/* static */
+QBBVirtualKeyboard& QBBVirtualKeyboard::instance()
+{
+ if (!s_instance) {
+ s_instance = new QBBVirtualKeyboard();
+ s_instance->start();
+ }
+
+ return *s_instance;
+}
+
+/* static */
+void QBBVirtualKeyboard::destroy()
+{
+ if (s_instance) {
+ delete s_instance;
+ s_instance = 0;
+ }
+}
+
+void QBBVirtualKeyboard::close()
+{
+ if (m_fd) {
+ // any reads will fail after we close the fd, which is basically what we want.
+ ::close(m_fd);
+ }
+
+ // Wait for the thread to die (should be immediate), then continue the cleanup.
+ wait();
+
+ if (m_fd) {
+ m_fd = -1;
+ }
+
+
+ if (m_decoder)
+ {
+ pps_decoder_cleanup(m_decoder);
+ delete m_decoder;
+ m_decoder = NULL;
+ }
+
+ if (m_encoder)
+ {
+ pps_encoder_cleanup(m_encoder);
+ delete m_encoder;
+ m_encoder = NULL;
+ }
+
+ delete [] m_buffer;
+ m_buffer = NULL;
+}
+
+bool QBBVirtualKeyboard::connect()
+{
+ close();
+
+ m_encoder = new pps_encoder_t;
+ m_decoder = new pps_decoder_t;
+
+ pps_encoder_initialize(m_encoder, false);
+ pps_decoder_initialize(m_decoder, NULL);
+
+ errno = 0;
+ m_fd = ::open(ms_PPSPath, O_RDWR);
+ if (m_fd == -1)
+ {
+ qCritical("QBBVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).",
+ ms_PPSPath, strerror(errno), errno);
+ close();
+ return false;
+ }
+
+ m_buffer = new char[ms_bufferSize];
+ if (!m_buffer) {
+ qCritical("QBBVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.", ms_bufferSize);
+ return false;
+ }
+
+ if (!queryPPSInfo())
+ return false;
+
+ start();
+
+ return true;
+}
+
+bool QBBVirtualKeyboard::queryPPSInfo()
+{
+ // Request info, requires id to regenerate res message.
+ pps_encoder_add_string(m_encoder, "msg", "info");
+ pps_encoder_add_string(m_encoder, "id", "libWebView");
+
+ if (::write(m_fd, pps_encoder_buffer(m_encoder), pps_encoder_length(m_encoder)) == -1) {
+ close();
+ return false;
+ }
+
+ pps_encoder_reset(m_encoder);
+
+ return true;
+}
+
+void QBBVirtualKeyboard::notifyClientActiveStateChange(bool active)
+{
+ if (!active)
+ hideKeyboard();
+}
+
+void QBBVirtualKeyboard::run()
+{
+ ppsDataReady();
+}
+
+void QBBVirtualKeyboard::ppsDataReady()
+{
+ while (1) {
+ ssize_t nread = read(m_fd, m_buffer, ms_bufferSize - 1);
+
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ qDebug() << "QBB: keyboardMessage size: " << nread;
+#endif
+ if (nread < 0)
+ break;
+
+ // nread is the real space necessary, not the amount read.
+ if (static_cast<size_t>(nread) > ms_bufferSize - 1) {
+ qCritical("QBBVirtualKeyboard: Keyboard buffer size too short; need %u.", nread + 1);
+ break;
+ }
+
+ m_buffer[nread] = 0;
+ pps_decoder_parse_pps_str(m_decoder, m_buffer);
+ pps_decoder_push(m_decoder, NULL);
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ pps_decoder_dump_tree(m_decoder, stderr);
+#endif
+
+ const char *value;
+ if (pps_decoder_get_string(m_decoder, "error", &value) == PPS_DECODER_OK) {
+ qCritical("QBBVirtualKeyboard: Keyboard PPS decoder error: %s", value ? value : "[null]");
+ continue;
+ }
+
+ if (pps_decoder_get_string(m_decoder, "msg", &value) == PPS_DECODER_OK) {
+ if (strcmp(value, "show") == 0) {
+ const bool oldVisible = m_visible;
+ m_visible = true;
+ handleKeyboardStateChangeMessage(true);
+ if (oldVisible != m_visible)
+ emit visibilityChanged(m_visible);
+ } else if (strcmp(value, "hide") == 0) {
+ const bool oldVisible = m_visible;
+ m_visible = false;
+ handleKeyboardStateChangeMessage(false);
+ if (oldVisible != m_visible)
+ emit visibilityChanged(m_visible);
+ } else if (strcmp(value, "info") == 0)
+ handleKeyboardInfoMessage();
+ else if (strcmp(value, "connect") == 0) { }
+ else
+ qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS msg value: %s", value ? value : "[null]");
+ } else if (pps_decoder_get_string(m_decoder, "res", &value) == PPS_DECODER_OK) {
+ if (strcmp(value, "info") == 0)
+ handleKeyboardInfoMessage();
+ else
+ qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS res value: %s", value ? value : "[null]");
+ } else
+ qCritical("QBBVirtualKeyboard: Unexpected keyboard PPS message type");
+ }
+
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ qDebug() << "QBB: exiting keyboard thread";
+#endif
+
+ if (m_decoder)
+ pps_decoder_cleanup(m_decoder);
+}
+
+void QBBVirtualKeyboard::handleKeyboardInfoMessage()
+{
+ int newHeight = 0;
+ const char *value;
+
+ if (pps_decoder_push(m_decoder, "dat") != PPS_DECODER_OK) {
+ qCritical("QBBVirtualKeyboard: Keyboard PPS dat object not found");
+ return;
+ }
+ if (pps_decoder_get_int(m_decoder, "size", &newHeight) != PPS_DECODER_OK) {
+ qCritical("QBBVirtualKeyboard: Keyboard PPS size field not found");
+ return;
+ }
+ if (pps_decoder_push(m_decoder, "locale") != PPS_DECODER_OK) {
+ qCritical("QBBVirtualKeyboard: Keyboard PPS locale object not found");
+ return;
+ }
+ if (pps_decoder_get_string(m_decoder, "languageId", &value) != PPS_DECODER_OK) {
+ qCritical("QBBVirtualKeyboard: Keyboard PPS languageId field not found");
+ return;
+ }
+ const QString languageId = QString::fromLatin1(value);
+ if (pps_decoder_get_string(m_decoder, "countryId", &value) != PPS_DECODER_OK) {
+ qCritical("QBBVirtualKeyboard: Keyboard PPS size countryId not found");
+ return;
+ }
+ const QString countryId = QString::fromLatin1(value);
+
+ // HUGE hack, should be removed ASAP.
+ newHeight -= KEYBOARD_SHADOW_HEIGHT; // We want to ignore the 8 pixel shadow above the keyboard. (PR 88400)
+
+ if (newHeight != m_height) {
+ m_height = newHeight;
+ updateAvailableScreenGeometry();
+ }
+
+ const QLocale locale = QLocale(languageId + QLatin1Char('_') + countryId);
+ if (locale != m_locale) {
+ m_locale = locale;
+ emit localeChanged(locale);
+ }
+
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ qDebug() << "QBB: handleKeyboardInfoMessage size=" << m_height << "locale=" << m_locale;
+#endif
+}
+
+void QBBVirtualKeyboard::handleKeyboardStateChangeMessage(bool visible)
+{
+
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ qDebug() << "QBB: handleKeyboardStateChangeMessage " << visible;
+#endif
+ updateAvailableScreenGeometry();
+
+ if (visible)
+ showKeyboard();
+ else
+ hideKeyboard();
+}
+
+void QBBVirtualKeyboard::updateAvailableScreenGeometry()
+{
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ qDebug() << "QBB: updateAvailableScreenGeometry: keyboard visible=" << m_visible << ", keyboard height=" << m_height;
+#endif
+
+ // TODO: What screen index should be used? I assume primaryScreen here because it works, and
+ // we do it for handleScreenGeometryChange elsewhere but since we have support
+ // for more than one screen, that's not going to always work.
+ QBBScreen *platformScreen = QBBScreen::primaryDisplay();
+ QWindowSystemInterface::handleScreenAvailableGeometryChange(platformScreen->screen(), platformScreen->availableGeometry());
+}
+
+bool QBBVirtualKeyboard::showKeyboard()
+{
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ qDebug() << "QBB: showKeyboard()";
+#endif
+
+ // Try to connect.
+ if (m_fd == -1 && !connect())
+ return false;
+
+ // NOTE: This must be done everytime the keyboard is shown even if there is no change because
+ // hiding the keyboard wipes the setting.
+ applyKeyboardModeOptions();
+
+ pps_encoder_reset(m_encoder);
+
+ // Send the show message.
+ pps_encoder_add_string(m_encoder, "msg", "show");
+
+ if (::write(m_fd, pps_encoder_buffer(m_encoder), pps_encoder_length(m_encoder)) == -1) {
+ close();
+ return false;
+ }
+
+ pps_encoder_reset(m_encoder);
+
+ // Return true if no error occurs. Sizing response will be triggered when confirmation of
+ // the change arrives.
+ return true;
+}
+
+bool QBBVirtualKeyboard::hideKeyboard()
+{
+#ifdef QBBVIRTUALKEYBOARD_DEBUG
+ qDebug() << "QBB: hideKeyboard()";
+#endif
+
+ if (m_fd == -1 && !connect())
+ return false;
+
+ pps_encoder_add_string(m_encoder, "msg", "hide");
+
+ if (::write(m_fd, pps_encoder_buffer(m_encoder), pps_encoder_length(m_encoder)) == -1) {
+ close();
+
+ //Try again.
+ if (connect()) {
+ if (::write(m_fd, pps_encoder_buffer(m_encoder), pps_encoder_length(m_encoder)) == -1) {
+ close();
+ return false;
+ }
+ }
+ else
+ return false;
+ }
+
+ pps_encoder_reset(m_encoder);
+
+ // Return true if no error occurs. Sizing response will be triggered when confirmation of
+ // the change arrives.
+ return true;
+}
+
+void QBBVirtualKeyboard::setKeyboardMode(KeyboardMode mode)
+{
+ m_keyboardMode = mode;
+}
+
+void QBBVirtualKeyboard::applyKeyboardModeOptions()
+{
+ // Try to connect.
+ if (m_fd == -1 && !connect())
+ return;
+
+ // Send the options message.
+ pps_encoder_add_string(m_encoder, "msg", "options");
+
+ pps_encoder_start_object(m_encoder, "dat");
+ switch (m_keyboardMode) {
+ case Url:
+ addUrlModeOptions();
+ break;
+ case Email:
+ addEmailModeOptions();
+ break;
+ case Web:
+ addWebModeOptions();
+ break;
+ case NumPunc:
+ addNumPuncModeOptions();
+ break;
+ case Symbol:
+ addSymbolModeOptions();
+ break;
+ case Phone:
+ addPhoneModeOptions();
+ break;
+ case Pin:
+ addPinModeOptions();
+ break;
+ case Default:
+ default:
+ addDefaultModeOptions();
+ break;
+ }
+
+ pps_encoder_end_object(m_encoder);
+
+ if (::write(m_fd, pps_encoder_buffer(m_encoder), pps_encoder_length(m_encoder)) == -1) {
+ close();
+ }
+
+ pps_encoder_reset(m_encoder);
+}
+
+void QBBVirtualKeyboard::addDefaultModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "default");
+}
+
+void QBBVirtualKeyboard::addUrlModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "url");
+}
+
+void QBBVirtualKeyboard::addEmailModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "email");
+}
+
+void QBBVirtualKeyboard::addWebModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "web");
+}
+
+void QBBVirtualKeyboard::addNumPuncModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "numPunc");
+}
+
+void QBBVirtualKeyboard::addPhoneModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "phone");
+}
+
+void QBBVirtualKeyboard::addPinModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "pin");
+}
+
+void QBBVirtualKeyboard::addSymbolModeOptions()
+{
+ pps_encoder_add_string(m_encoder, "enter", "enter.default");
+ pps_encoder_add_string(m_encoder, "type", "symbol");
+}
diff --git a/src/plugins/platforms/blackberry/qbbvirtualkeyboard.h b/src/plugins/platforms/blackberry/qbbvirtualkeyboard.h
new file mode 100644
index 0000000000..14003ee897
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbvirtualkeyboard.h
@@ -0,0 +1,130 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 VIRTUALKEYBOARD_H_
+#define VIRTUALKEYBOARD_H_
+
+#include <QtCore/QThread>
+#include <QtCore/QLocale>
+#include <QtGui/QPlatformScreen>
+#include <QtGui/QWindowSystemInterface>
+
+#include <stddef.h>
+#include <vector>
+#include <string>
+#include <sys/pps.h>
+
+QT_BEGIN_NAMESPACE
+
+/* Shamelessly copied from the browser - this should be rewritten once we have a proper PPS wrapper class */
+class QBBVirtualKeyboard : public QThread
+{
+ Q_OBJECT
+public:
+ // NOTE: Not all the following keyboard modes are currently used.
+ // Default - Regular Keyboard
+ // Url/Email - Enhanced keys for each types.
+ // Web - Regular keyboard with two blank keys, currently unused.
+ // NumPunc - Numbers & Punctionation, alternate to Symbol
+ // Symbol - All symbols, alternate to NumPunc, currently unused.
+ // Phone - Phone enhanced keyboard - currently unused as no alternate keyboard available to access a-zA-Z
+ // Pin - Keyboard for entering Pins (Hex values) currently unused.
+ //
+ // SPECIAL NOTE: Usage of NumPunc may have to be removed, ABC button is non-functional.
+ //
+ enum KeyboardMode { Default, Url, Email, Web, NumPunc, Symbol, Phone, Pin };
+
+ static QBBVirtualKeyboard& instance();
+ static void destroy();
+
+ bool showKeyboard();
+ bool hideKeyboard();
+ int height() { return m_visible ? m_height : 0; }
+ void setKeyboardMode(KeyboardMode);
+ void notifyClientActiveStateChange(bool);
+ bool isVisible() const { return m_visible; }
+ QLocale locale() const { return m_locale; }
+
+Q_SIGNALS:
+ void localeChanged(const QLocale &locale);
+ void visibilityChanged(bool visible);
+
+private:
+ QBBVirtualKeyboard();
+ virtual ~QBBVirtualKeyboard();
+
+ // Will be called internally if needed.
+ bool connect();
+ void close();
+ void ppsDataReady();
+ bool queryPPSInfo();
+ void handleKeyboardInfoMessage();
+ void handleKeyboardStateChangeMessage(bool visible);
+ void updateAvailableScreenGeometry();
+
+ void applyKeyboardModeOptions();
+ void addDefaultModeOptions();
+ void addUrlModeOptions();
+ void addEmailModeOptions();
+ void addWebModeOptions();
+ void addNumPuncModeOptions();
+ void addSymbolModeOptions();
+ void addPhoneModeOptions();
+ void addPinModeOptions();
+
+ // QThread overrides
+ virtual void run();
+
+ pps_encoder_t *m_encoder;
+ pps_decoder_t *m_decoder;
+ char *m_buffer;
+ int m_height;
+ int m_fd;
+ KeyboardMode m_keyboardMode;
+ bool m_visible;
+ QLocale m_locale;
+
+ // Path to keyboardManager in PPS.
+ static const char *ms_PPSPath;
+ static const size_t ms_bufferSize;
+};
+
+#endif /* VIRTUALKEYBOARD_H_ */
diff --git a/src/plugins/platforms/blackberry/qbbwindow.cpp b/src/plugins/platforms/blackberry/qbbwindow.cpp
new file mode 100644
index 0000000000..bc9f112b01
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbwindow.cpp
@@ -0,0 +1,665 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 "qbbwindow.h"
+#include "qbbglcontext.h"
+#include "qbbintegration.h"
+#include "qbbscreen.h"
+
+#include <QtGui/QWindow>
+#include <QtGui/QWindowSystemInterface>
+
+#include <QtCore/QDebug>
+
+#include <errno.h>
+
+QT_BEGIN_NAMESPACE
+
+QBBWindow::QBBWindow(QWindow *window, screen_context_t context)
+ : QPlatformWindow(window),
+ m_screenContext(context),
+ m_window(0),
+ m_currentBufferIndex(-1),
+ m_previousBufferIndex(-1),
+ m_platformOpenGLContext(0),
+ m_screen(0),
+ m_parentWindow(0),
+ m_visible(true)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size();
+#endif
+ int result;
+
+ // Create child QNX window
+ errno = 0;
+ result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to create window, errno=%d", errno);
+ }
+
+ // Set window buffer usage based on rendering API
+ int val;
+ QSurface::SurfaceType surfaceType = window->surfaceType();
+ switch (surfaceType) {
+ case QSurface::RasterSurface:
+ val = SCREEN_USAGE_NATIVE | SCREEN_USAGE_READ | SCREEN_USAGE_WRITE;
+ break;
+ case QSurface::OpenGLSurface:
+ val = SCREEN_USAGE_OPENGL_ES2;
+ break;
+ default:
+ qFatal("QBBWindow: unsupported window API");
+ break;
+ }
+
+ errno = 0;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, &val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window buffer usage, errno=%d", errno);
+ }
+
+ // Alpha channel is always pre-multiplied if present
+ errno = 0;
+ val = SCREEN_PRE_MULTIPLIED_ALPHA;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ALPHA_MODE, &val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window alpha mode, errno=%d", errno);
+ }
+
+ // Make the window opaque
+ errno = 0;
+ val = SCREEN_TRANSPARENCY_NONE;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window transparency, errno=%d", errno);
+ }
+
+ // Set the window swap interval
+ errno = 0;
+ val = 1;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, &val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window swap interval, errno=%d", errno);
+ }
+
+ // Assign the window to the primary display (this is the default specified by screen).
+ setScreen(QBBScreen::primaryDisplay());
+
+ // Add the window to the root of the hierarchy
+ QBBScreen::addWindow(this);
+
+ // Add window to plugin's window mapper
+ QBBIntegration::addWindow(m_window, window);
+}
+
+QBBWindow::~QBBWindow()
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+ // Remove from plugin's window mapper
+ QBBIntegration::removeWindow(m_window);
+
+ // Remove from parent's Hierarchy.
+ removeFromParent();
+ QBBScreen::updateHierarchy();
+
+ // We shouldn't allow this case unless QT allows it. Does it? Or should we send the
+ // handleCloseEvent on all children when this window is deleted?
+ if (m_childWindows.size() > 0)
+ qFatal("QBBWindow: window destroyed before children!");
+
+ // Cleanup QNX window and its buffers
+ screen_destroy_window(m_window);
+}
+
+void QBBWindow::setGeometry(const QRect &rect)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window() << ", (" << rect.x() << "," << rect.y() << "," << rect.width() << "," << rect.height() << ")";
+#endif
+
+ QRect oldGeometry = geometry();
+
+ // Call base class method
+ QPlatformWindow::setGeometry(rect);
+
+ // Set window geometry equal to widget geometry
+ errno = 0;
+ int val[2];
+ val[0] = rect.x();
+ val[1] = rect.y();
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window position, errno=%d", errno);
+ }
+
+ errno = 0;
+ val[0] = rect.width();
+ val[1] = rect.height();
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window size, errno=%d", errno);
+ }
+
+ // Set viewport size equal to window size
+ errno = 0;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window source size, errno=%d", errno);
+ }
+
+ // Now move all children.
+ QPoint offset;
+ if (!oldGeometry.isEmpty()) {
+ offset = rect.topLeft();
+ offset -= oldGeometry.topLeft();
+
+ QList<QBBWindow*>::iterator it;
+ for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
+ (*it)->offset(offset);
+ }
+ }
+}
+
+void QBBWindow::offset(const QPoint &offset)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+ // Move self and then children.
+ QRect newGeometry = geometry();
+ newGeometry.translate(offset);
+
+ // Call the base class
+ QPlatformWindow::setGeometry(newGeometry);
+
+ int val[2];
+
+ errno = 0;
+ val[0] = newGeometry.x();
+ val[1] = newGeometry.y();
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window position, errno=%d", errno);
+ }
+
+ QList<QBBWindow*>::iterator it;
+ for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
+ (*it)->offset(offset);
+ }
+}
+
+void QBBWindow::setVisible(bool visible)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible;
+#endif
+
+ m_visible = visible;
+
+ QBBWindow *root = this;
+ while (root->m_parentWindow)
+ root = root->m_parentWindow;
+
+ root->updateVisibility(root->m_visible);
+
+ window()->requestActivateWindow();
+}
+
+void QBBWindow::updateVisibility(bool parentVisible)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "parentVisible =" << parentVisible << "window =" << window();
+#endif
+ // Set window visibility
+ errno = 0;
+ int val = (m_visible && parentVisible) ? 1 : 0;
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window visibility, errno=%d", errno);
+ }
+
+ QList<QBBWindow *>::iterator it;
+ for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
+ (*it)->updateVisibility(m_visible && parentVisible);
+ }
+}
+
+void QBBWindow::setOpacity(qreal level)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window() << "opacity =" << level;
+#endif
+ // Set window global alpha
+ errno = 0;
+ int val = (int)(level * 255);
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_GLOBAL_ALPHA, &val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window global alpha, errno=%d", errno);
+ }
+
+ // TODO: How to handle children of this window? If we change all the visibilities, then
+ // the transparency will look wrong...
+}
+
+void QBBWindow::setBufferSize(const QSize &size)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size;
+#endif
+ // Set window buffer size
+ errno = 0;
+ int val[2] = { size.width(), size.height() };
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window buffer size, errno=%d", errno);
+ }
+
+ // Create window buffers if they do not exist
+ if (!hasBuffers()) {
+ // Get pixel format from EGL config if using OpenGL;
+ // otherwise inherit pixel format of window's screen
+ if (m_platformOpenGLContext != 0) {
+ val[0] = platformWindowFormatToNativeFormat(m_platformOpenGLContext->format());
+ } else {
+ val[0] = m_screen->nativeFormat();
+ }
+
+ errno = 0;
+ result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window pixel format, errno=%d", errno);
+ }
+
+ errno = 0;
+ result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to create window buffers, errno=%d", errno);
+ }
+ }
+
+ // Cache new buffer size
+ m_bufferSize = size;
+
+ // Buffers were destroyed; reacquire them
+ m_currentBufferIndex = -1;
+ m_previousDirty = QRegion();
+ m_scrolled = QRegion();
+}
+
+QBBBuffer &QBBWindow::renderBuffer()
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+ // Check if render buffer is invalid
+ if (m_currentBufferIndex == -1) {
+ // Get all buffers available for rendering
+ errno = 0;
+ screen_buffer_t buffers[MAX_BUFFER_COUNT];
+ int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to query window buffers, errno=%d", errno);
+ }
+
+ // Wrap each buffer
+ for (int i = 0; i < MAX_BUFFER_COUNT; ++i) {
+ m_buffers[i] = QBBBuffer(buffers[i]);
+ }
+
+ // Use the first available render buffer
+ m_currentBufferIndex = 0;
+ m_previousBufferIndex = -1;
+ }
+
+ return m_buffers[m_currentBufferIndex];
+}
+
+void QBBWindow::scroll(const QRegion &region, int dx, int dy, bool flush)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+ copyBack(region, dx, dy, flush);
+ m_scrolled += region;
+}
+
+void QBBWindow::post(const QRegion &dirty)
+{
+ // Check if render buffer exists and something was rendered
+ if (m_currentBufferIndex != -1 && !dirty.isEmpty()) {
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << "QBBWindow::post - window =" << window();
+#endif
+ QBBBuffer &currentBuffer = m_buffers[m_currentBufferIndex];
+
+ // Copy unmodified region from old render buffer to new render buffer;
+ // required to allow partial updates
+ QRegion preserve = m_previousDirty - dirty - m_scrolled;
+ copyBack(preserve, 0, 0);
+
+ // Calculate region that changed
+ QRegion modified = preserve + dirty + m_scrolled;
+ QRect rect = modified.boundingRect();
+ int dirtyRect[4] = { rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height() };
+
+ // Update the display with contents of render buffer
+ errno = 0;
+ int result = screen_post_window(m_window, currentBuffer.nativeBuffer(), 1, dirtyRect, 0);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to post window buffer, errno=%d", errno);
+ }
+
+ // Advance to next nender buffer
+ m_previousBufferIndex = m_currentBufferIndex++;
+ if (m_currentBufferIndex >= MAX_BUFFER_COUNT) {
+ m_currentBufferIndex = 0;
+ }
+
+ // Save modified region and clear scrolled region
+ m_previousDirty = dirty;
+ m_scrolled = QRegion();
+
+ // Notify screen that window posted
+ if (m_screen != 0) {
+ m_screen->onWindowPost(this);
+ }
+ }
+}
+
+void QBBWindow::setScreen(QBBScreen *platformScreen)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen;
+#endif
+
+ if (m_screen == platformScreen)
+ return;
+
+ m_screen = platformScreen;
+
+ // Move window to proper screen/display
+ errno = 0;
+ screen_display_t display = platformScreen->nativeDisplay();
+ int result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to set window display, errno=%d", errno);
+ }
+
+ // Add window to display's window group
+ errno = 0;
+ result = screen_join_window_group(m_window, platformScreen->windowGroupName());
+ if (result != 0) {
+ qFatal("QBBWindow: failed to join window group, errno=%d", errno);
+ }
+
+ QList<QBBWindow*>::iterator it;
+ for (it = m_childWindows.begin(); it != m_childWindows.end(); it++) {
+ // Only subwindows and tooltips need necessarily be moved to another display with the window.
+ if ((window()->windowType() & Qt::WindowType_Mask) == Qt::SubWindow ||
+ (window()->windowType() & Qt::WindowType_Mask) == Qt::ToolTip)
+ (*it)->setScreen(platformScreen);
+ }
+
+ QBBScreen::updateHierarchy();
+}
+
+void QBBWindow::removeFromParent()
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+ // Remove from old Hierarchy position
+ if (m_parentWindow) {
+ if (m_parentWindow->m_childWindows.removeAll(this))
+ m_parentWindow = 0;
+ else
+ qFatal("QBBWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
+ } else {
+ QBBScreen::removeWindow(this);
+ }
+}
+
+void QBBWindow::setParent(const QPlatformWindow *window)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << this->window() << "platformWindow =" << window;
+#endif
+ // Cast away the const, we need to modify the hierarchy.
+ QBBWindow *newParent = 0;
+
+ if (window)
+ newParent = static_cast<QBBWindow*>((QPlatformWindow *)window);
+
+ if (newParent == m_parentWindow)
+ return;
+
+ removeFromParent();
+ m_parentWindow = newParent;
+
+ // Add to new hierarchy position.
+ if (m_parentWindow) {
+ if (m_parentWindow->m_screen != m_screen)
+ setScreen(m_parentWindow->m_screen);
+
+ m_parentWindow->m_childWindows.push_back(this);
+ } else {
+ QBBScreen::addWindow(this);
+ }
+
+ QBBScreen::updateHierarchy();
+}
+
+void QBBWindow::raise()
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+
+ QBBWindow *oldParent = m_parentWindow;
+ if (oldParent) {
+ removeFromParent();
+ oldParent->m_childWindows.push_back(this);
+ } else {
+ QBBScreen::raiseWindow(this);
+ }
+
+ QBBScreen::updateHierarchy();
+}
+
+void QBBWindow::lower()
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+
+ QBBWindow *oldParent = m_parentWindow;
+ if (oldParent) {
+ removeFromParent();
+ oldParent->m_childWindows.push_front(this);
+ } else {
+ QBBScreen::lowerWindow(this);
+ }
+
+ QBBScreen::updateHierarchy();
+}
+
+void QBBWindow::requestActivateWindow()
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+
+ // TODO: Tell screen to set keyboard focus to this window.
+
+ // Notify that we gained focus.
+ gainedFocus();
+}
+
+void QBBWindow::gainedFocus()
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+
+ // Got focus
+ QWindowSystemInterface::handleWindowActivated(window());
+}
+
+void QBBWindow::setPlatformOpenGLContext(QBBGLContext *platformOpenGLContext)
+{
+ // This function does not take ownership of the platform gl context.
+ // It is owned by the frontend QOpenGLContext
+ m_platformOpenGLContext = platformOpenGLContext;
+}
+
+void QBBWindow::updateZorder(int &topZorder)
+{
+ errno = 0;
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, &topZorder);
+ topZorder++;
+
+ if (result != 0)
+ qFatal("QBBWindow: failed to set window z-order=%d, errno=%d, mWindow=%p", topZorder, errno, m_window);
+
+ QList<QBBWindow*>::const_iterator it;
+
+ for (it = m_childWindows.begin(); it != m_childWindows.end(); it++)
+ (*it)->updateZorder(topZorder);
+}
+
+void QBBWindow::copyBack(const QRegion &region, int dx, int dy, bool flush)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO << "window =" << window();
+#endif
+ int result;
+
+ // Abort if previous buffer is invalid
+ if (m_previousBufferIndex == -1) {
+ return;
+ }
+
+ // Abort if nothing to copy
+ if (region.isEmpty()) {
+ return;
+ }
+
+ QBBBuffer &currentBuffer = m_buffers[m_currentBufferIndex];
+ QBBBuffer &previousBuffer = m_buffers[m_previousBufferIndex];
+
+ // Break down region into non-overlapping rectangles
+ QVector<QRect> rects = region.rects();
+ for (int i = rects.size() - 1; i >= 0; i--) {
+ // Clip rectangle to bounds of target
+ QRect rect = rects[i].intersected( currentBuffer.rect() );
+
+ if (rect.isEmpty())
+ continue;
+
+ // Setup blit operation
+ int attribs[] = { SCREEN_BLIT_SOURCE_X, rect.x(),
+ SCREEN_BLIT_SOURCE_Y, rect.y(),
+ SCREEN_BLIT_SOURCE_WIDTH, rect.width(),
+ SCREEN_BLIT_SOURCE_HEIGHT, rect.height(),
+ SCREEN_BLIT_DESTINATION_X, rect.x() + dx,
+ SCREEN_BLIT_DESTINATION_Y, rect.y() + dy,
+ SCREEN_BLIT_DESTINATION_WIDTH, rect.width(),
+ SCREEN_BLIT_DESTINATION_HEIGHT, rect.height(),
+ SCREEN_BLIT_END };
+
+ // Queue blit operation
+ errno = 0;
+ result = screen_blit(m_screenContext, currentBuffer.nativeBuffer(), previousBuffer.nativeBuffer(), attribs);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to blit buffers, errno=%d", errno);
+ }
+ }
+
+ // Check if flush requested
+ if (flush) {
+ // Wait for all blits to complete
+ errno = 0;
+ result = screen_flush_blits(m_screenContext, SCREEN_WAIT_IDLE);
+ if (result != 0) {
+ qFatal("QBBWindow: failed to flush blits, errno=%d", errno);
+ }
+
+ // Buffer was modified outside the CPU
+ currentBuffer.invalidateInCache();
+ }
+}
+
+int QBBWindow::platformWindowFormatToNativeFormat(const QSurfaceFormat &format)
+{
+#if defined(QBBWINDOW_DEBUG)
+ qDebug() << Q_FUNC_INFO;
+#endif
+ // Extract size of colour channels from window format
+ int redSize = format.redBufferSize();
+ if (redSize == -1) {
+ qFatal("QBBWindow: red size not defined");
+ }
+
+ int greenSize = format.greenBufferSize();
+ if (greenSize == -1) {
+ qFatal("QBBWindow: green size not defined");
+ }
+
+ int blueSize = format.blueBufferSize();
+ if (blueSize == -1) {
+ qFatal("QBBWindow: blue size not defined");
+ }
+
+ // select matching native format
+ if (redSize == 5 && greenSize == 6 && blueSize == 5) {
+ return SCREEN_FORMAT_RGB565;
+ } else if (redSize == 8 && greenSize == 8 && blueSize == 8) {
+ return SCREEN_FORMAT_RGBA8888;
+ } else {
+ qFatal("QBBWindow: unsupported pixel format");
+ return 0;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/blackberry/qbbwindow.h b/src/plugins/platforms/blackberry/qbbwindow.h
new file mode 100644
index 0000000000..ffdeba423a
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbwindow.h
@@ -0,0 +1,133 @@
+/***************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** 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 QBBWINDOW_H
+#define QBBWINDOW_H
+
+#include <QtGui/QPlatformWindow>
+
+#include "qbbbuffer.h"
+
+#include <QtGui/QImage>
+
+#include <EGL/egl.h>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+// all surfaces double buffered
+#define MAX_BUFFER_COUNT 2
+
+class QBBGLContext;
+class QBBScreen;
+
+class QPlatformGLContext;
+class QSurfaceFormat;
+
+class QBBWindow : public QPlatformWindow
+{
+friend class QBBScreen;
+public:
+ QBBWindow(QWindow *window, screen_context_t context);
+ virtual ~QBBWindow();
+
+ virtual void setGeometry(const QRect &rect);
+ virtual void setVisible(bool visible);
+ virtual void setOpacity(qreal level);
+
+ virtual WId winId() const { return (WId)m_window; }
+ screen_window_t nativeHandle() const { return m_window; }
+
+ void setBufferSize(const QSize &size);
+ QSize bufferSize() const { return m_bufferSize; }
+ bool hasBuffers() const { return !m_bufferSize.isEmpty(); }
+
+ QBBBuffer &renderBuffer();
+ void scroll(const QRegion &region, int dx, int dy, bool flush=false);
+ void post(const QRegion &dirty);
+
+ void setScreen(QBBScreen *platformScreen);
+
+ virtual void setParent(const QPlatformWindow *window);
+ virtual void raise();
+ virtual void lower();
+ virtual void requestActivateWindow();
+
+ void gainedFocus();
+
+ QBBScreen *screen() const { return m_screen; }
+ const QList<QBBWindow*>& children() const { return m_childWindows; }
+
+ void setPlatformOpenGLContext(QBBGLContext *platformOpenGLContext);
+ QBBGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; }
+
+private:
+ void removeFromParent();
+ void offset(const QPoint &offset);
+ void updateVisibility(bool parentVisible);
+ void updateZorder(int &topZorder);
+
+ void fetchBuffers();
+
+ void copyBack(const QRegion &region, int dx, int dy, bool flush=false);
+
+ static int platformWindowFormatToNativeFormat(const QSurfaceFormat &format);
+
+ screen_context_t m_screenContext;
+ screen_window_t m_window;
+ QSize m_bufferSize;
+ QBBBuffer m_buffers[MAX_BUFFER_COUNT];
+ int m_currentBufferIndex;
+ int m_previousBufferIndex;
+ QRegion m_previousDirty;
+ QRegion m_scrolled;
+
+ QBBGLContext *m_platformOpenGLContext;
+ QBBScreen *m_screen;
+ QList<QBBWindow*> m_childWindows;
+ QBBWindow *m_parentWindow;
+ bool m_visible;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBBWINDOW_H
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index b8582022f6..4f80511f61 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -71,10 +71,14 @@ public:
static NSOpenGLPixelFormat *createNSOpenGLPixelFormat(const QSurfaceFormat &format);
NSOpenGLContext *nsOpenGLContext() const;
+ bool isSharing() const;
+ bool isValid() const;
+
private:
void setActiveWindow(QWindow *window);
NSOpenGLContext *m_context;
+ NSOpenGLContext *m_shareContext;
QSurfaceFormat m_format;
QWeakPointer<QWindow> m_currentWindow;
};
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 960163d727..637678c19e 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -51,13 +51,19 @@
QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share)
: m_format(format)
{
- QCocoaAutoReleasePool pool; // For the SG Canvas render thread.
+ QCocoaAutoReleasePool pool; // For the SG Canvas render thread
NSOpenGLPixelFormat *pixelFormat = static_cast <NSOpenGLPixelFormat *>(qcgl_createNSOpenGLPixelFormat(format));
- NSOpenGLContext *actualShare = share ? static_cast<QCocoaGLContext *>(share)->m_context : 0;
+ m_shareContext = share ? static_cast<QCocoaGLContext *>(share)->nsOpenGLContext() : nil;
m_context = [NSOpenGLContext alloc];
- [m_context initWithFormat:pixelFormat shareContext:actualShare];
+ [m_context initWithFormat:pixelFormat shareContext:m_shareContext];
+
+ if (!m_context && m_shareContext) {
+ // try without shared context
+ m_shareContext = nil;
+ [m_context initWithFormat:pixelFormat shareContext:nil];
+ }
const GLint interval = 1;
[m_context setValues:&interval forParameter:NSOpenGLCPSwapInterval];
@@ -139,3 +145,12 @@ NSOpenGLContext *QCocoaGLContext::nsOpenGLContext() const
return m_context;
}
+bool QCocoaGLContext::isValid() const
+{
+ return m_context != nil;
+}
+
+bool QCocoaGLContext::isSharing() const
+{
+ return m_shareContext != nil;
+}
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index ad20c2fb27..0fef3234b4 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -105,13 +105,16 @@ QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialo
QVariant QCocoaTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
- case QPlatformTheme::StyleNames:
- return QStringList() << QLatin1Literal("macintosh");
- break;
- default:
- return QPlatformTheme::themeHint(hint);
+ case QPlatformTheme::StyleNames:
+ return QStringList(QStringLiteral("macintosh"));
+ case QPlatformTheme::DialogButtonBoxLayout:
+ return QVariant(1); // QDialogButtonBox::MacLayout
+ case KeyboardScheme:
+ return QVariant(int(MacKeyboardScheme));
+ default:
break;
}
+ return QPlatformTheme::themeHint(hint);
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 577e0751c6..a43b3fe893 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -371,14 +371,11 @@ static QTouchDevice *touchDevice = 0;
#ifndef QT_NO_WHEELEVENT
- (void)scrollWheel:(NSEvent *)theEvent
{
- int deltaX = 0;
- int deltaY = 0;
- int deltaZ = 0;
-
const EventRef carbonEvent = (EventRef)[theEvent eventRef];
const UInt32 carbonEventKind = carbonEvent ? ::GetEventKind(carbonEvent) : 0;
const bool scrollEvent = carbonEventKind == kEventMouseScroll;
+ QPoint angleDelta;
if (scrollEvent) {
// The mouse device contains pixel scroll wheel support (Mighty Mouse, Trackpad).
// Since deviceDelta is delivered as pixels rather than degrees, we need to
@@ -389,40 +386,45 @@ static QTouchDevice *touchDevice = 0;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if ([theEvent respondsToSelector:@selector(scrollingDeltaX)]) {
- deltaX = [theEvent scrollingDeltaX] * pixelsToDegrees;
- deltaY = [theEvent scrollingDeltaY] * pixelsToDegrees;
- // scrollingDeltaZ API is missing.
+ angleDelta.setX([theEvent scrollingDeltaX] * pixelsToDegrees);
+ angleDelta.setY([theEvent scrollingDeltaY] * pixelsToDegrees);
} else
#endif
{
- deltaX = [theEvent deviceDeltaX] * pixelsToDegrees;
- deltaY = [theEvent deviceDeltaY] * pixelsToDegrees;
- deltaZ = [theEvent deviceDeltaZ] * pixelsToDegrees;
+ angleDelta.setX([theEvent deviceDeltaX] * pixelsToDegrees);
+ angleDelta.setY([theEvent deviceDeltaY] * pixelsToDegrees);
}
} else {
// carbonEventKind == kEventMouseWheelMoved
// Remove acceleration, and use either -120 or 120 as delta:
- deltaX = qBound(-120, int([theEvent deltaX] * 10000), 120);
- deltaY = qBound(-120, int([theEvent deltaY] * 10000), 120);
- deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120);
+ angleDelta.setX(qBound(-120, int([theEvent deltaX] * 10000), 120));
+ angleDelta.setY(qBound(-120, int([theEvent deltaY] * 10000), 120));
}
+ QPoint pixelDelta;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if ([theEvent respondsToSelector:@selector(scrollingDeltaX)]) {
+ if ([theEvent hasPreciseScrollingDeltas]) {
+ pixelDelta.setX([theEvent scrollingDeltaX]);
+ pixelDelta.setY([theEvent scrollingDeltaY]);
+ } else {
+ // docs: "In the case of !hasPreciseScrollingDeltas, multiply the delta with the line width."
+ // scrollingDeltaX seems to return a minimum value of 0.1 in this case, map that to two pixels.
+ const CGFloat lineWithEstimate = 20.0;
+ pixelDelta.setX([theEvent scrollingDeltaX] * lineWithEstimate);
+ pixelDelta.setY([theEvent scrollingDeltaY] * lineWithEstimate);
+ }
+ }
+#endif
+
+
NSPoint windowPoint = [self convertPoint: [theEvent locationInWindow] fromView: nil];
QPoint qt_windowPoint(windowPoint.x, windowPoint.y);
NSTimeInterval timestamp = [theEvent timestamp];
ulong qt_timestamp = timestamp * 1000;
- if (deltaX != 0)
- QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, deltaX, Qt::Horizontal);
-
- if (deltaY != 0)
- QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, deltaY, Qt::Vertical);
-
- if (deltaZ != 0)
- // Qt doesn't explicitly support wheels with a Z component. In a misguided attempt to
- // try to be ahead of the pack, I'm adding this extra value.
- QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, deltaY, (Qt::Orientation)3);
+ QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, pixelDelta, angleDelta);
}
#endif //QT_NO_WHEELEVENT
diff --git a/src/plugins/platforms/directfb/directfb.json b/src/plugins/platforms/directfb/directfb.json
new file mode 100644
index 0000000000..5c74095fe6
--- /dev/null
+++ b/src/plugins/platforms/directfb/directfb.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "directfb", "directfbegl" ]
+}
diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro
index 0585777889..ae47ec397b 100644
--- a/src/plugins/platforms/directfb/directfb.pro
+++ b/src/plugins/platforms/directfb/directfb.pro
@@ -43,3 +43,5 @@ directfbegl: {
CONFIG += qpa/genericunixfontdatabase
target.path += $$[QT_INSTALL_PLUGINS]/platforms
INSTALLS += target
+
+OTHER_FILES += directfb.json
diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp
index 048e9ed611..26bdd719ca 100644
--- a/src/plugins/platforms/directfb/main.cpp
+++ b/src/plugins/platforms/directfb/main.cpp
@@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE
class QDirectFbIntegrationPlugin : public QPlatformIntegrationPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPlatformIntegrationFactoryInterface" FILE "directfb.json")
public:
QStringList keys() const;
QPlatformIntegration *create(const QString&, const QStringList&);
@@ -86,6 +88,6 @@ QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system,
return integration;
}
-Q_EXPORT_PLUGIN2(directfb, QDirectFbIntegrationPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
index 7b253b7220..e41a2e0440 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
@@ -128,13 +128,65 @@ IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPlatformPixmap(QPlatformPix
Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier)
{
- switch (identifier){
- case DIBI_LEFT:
+ // The Enum contains values for DIBI_FIRST (= DIBI_LEFT), DIBI_LAST (= 0x1f,) and
+ // just 3 enumerated Mouse Buttons. To convert into *ALL* possible Qt::MoueButton values,
+ // the parameter is cast as integer.
+
+ switch (int(identifier)) {
+ case DIBI_LEFT: // value is 0x00
return Qt::LeftButton;
- case DIBI_MIDDLE:
- return Qt::MidButton;
- case DIBI_RIGHT:
+ case DIBI_RIGHT: // value is 0x01
return Qt::RightButton;
+ case DIBI_MIDDLE: // value is 0x02
+ return Qt::MidButton;
+ case 0x03:
+ return Qt::BackButton;
+ case 0x04:
+ return Qt::ForwardButton;
+ case 0x05:
+ return Qt::ExtraButton3;
+ case 0x06:
+ return Qt::ExtraButton4;
+ case 0x07:
+ return Qt::ExtraButton5;
+ case 0x08:
+ return Qt::ExtraButton6;
+ case 0x09:
+ return Qt::ExtraButton7;
+ case 0x0a:
+ return Qt::ExtraButton8;
+ case 0x0b:
+ return Qt::ExtraButton9;
+ case 0x0c:
+ return Qt::ExtraButton10;
+ case 0x0d:
+ return Qt::ExtraButton11;
+ case 0x0e:
+ return Qt::ExtraButton12;
+ case 0x0f:
+ return Qt::ExtraButton13;
+ case 0x10:
+ return Qt::ExtraButton14;
+ case 0x11:
+ return Qt::ExtraButton15;
+ case 0x12:
+ return Qt::ExtraButton16;
+ case 0x13:
+ return Qt::ExtraButton17;
+ case 0x14:
+ return Qt::ExtraButton18;
+ case 0x15:
+ return Qt::ExtraButton19;
+ case 0x16:
+ return Qt::ExtraButton20;
+ case 0x17:
+ return Qt::ExtraButton21;
+ case 0x18:
+ return Qt::ExtraButton22;
+ case 0x19:
+ return Qt::ExtraButton23;
+ case 0x1a:
+ return Qt::ExtraButton24;
default:
return Qt::NoButton;
}
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
index c2e6d8cea7..8f728a5fb0 100644
--- a/src/plugins/platforms/platforms.pro
+++ b/src/plugins/platforms/platforms.pro
@@ -11,3 +11,7 @@ mac {
}
win32: SUBDIRS += windows
+
+blackberry-armv7le-qcc {
+ SUBDIRS += blackberry
+}
diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h
index b0c53dde95..e8b093764f 100644
--- a/src/plugins/platforms/vnc/qvncserver.h
+++ b/src/plugins/platforms/vnc/qvncserver.h
@@ -262,7 +262,7 @@ public:
int refreshRate;
QVNCServer *vncServer;
-#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY)
+#if !defined(QT_NO_SHAREDMEMORY)
QSharedMemory shm;
#endif
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index 4f083e93d2..cd555d71a1 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -287,8 +287,7 @@ bool QWindowsClipboard::clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM w
const bool owned = ownsClipboard();
if (QWindowsContext::verboseOLE)
qDebug("Clipboard changed owned %d", owned);
- if (!owned) // changed is emitted by QClipboard in that case.
- emitChanged(QClipboard::Clipboard);
+ emitChanged(QClipboard::Clipboard);
// clean up the clipboard object if we no longer own the clipboard
if (!owned && m_data)
releaseIData();
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 1df985c8a7..fba7794a12 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -329,8 +329,183 @@ static inline QFontDatabase::WritingSystem writingSystemFromScript(const QString
return QFontDatabase::Any;
}
-extern bool localizedName(const QString &name);
-extern QString getEnglishName(const QString &familyName);
+#ifdef MAKE_TAG
+#undef MAKE_TAG
+#endif
+// GetFontData expects the tags in little endian ;(
+#define MAKE_TAG(ch1, ch2, ch3, ch4) (\
+ (((quint32)(ch4)) << 24) | \
+ (((quint32)(ch3)) << 16) | \
+ (((quint32)(ch2)) << 8) | \
+ ((quint32)(ch1)) \
+ )
+
+bool localizedName(const QString &name)
+{
+ const QChar *c = name.unicode();
+ for (int i = 0; i < name.length(); ++i) {
+ if (c[i].unicode() >= 0x100)
+ return true;
+ }
+ return false;
+}
+
+static inline quint16 getUShort(const unsigned char *p)
+{
+ quint16 val;
+ val = *p++ << 8;
+ val |= *p;
+
+ return val;
+}
+
+static QString getEnglishName(const uchar *table, quint32 bytes)
+{
+ QString i18n_name;
+ enum {
+ NameRecordSize = 12,
+ FamilyId = 1,
+ MS_LangIdEnglish = 0x009
+ };
+
+ // get the name table
+ quint16 count;
+ quint16 string_offset;
+ const unsigned char *names;
+
+ int microsoft_id = -1;
+ int apple_id = -1;
+ int unicode_id = -1;
+
+ if (getUShort(table) != 0)
+ goto error;
+
+ count = getUShort(table+2);
+ string_offset = getUShort(table+4);
+ names = table + 6;
+
+ if (string_offset >= bytes || 6 + count*NameRecordSize > string_offset)
+ goto error;
+
+ for (int i = 0; i < count; ++i) {
+ // search for the correct name entry
+
+ quint16 platform_id = getUShort(names + i*NameRecordSize);
+ quint16 encoding_id = getUShort(names + 2 + i*NameRecordSize);
+ quint16 language_id = getUShort(names + 4 + i*NameRecordSize);
+ quint16 name_id = getUShort(names + 6 + i*NameRecordSize);
+
+ if (name_id != FamilyId)
+ continue;
+
+ enum {
+ PlatformId_Unicode = 0,
+ PlatformId_Apple = 1,
+ PlatformId_Microsoft = 3
+ };
+
+ quint16 length = getUShort(names + 8 + i*NameRecordSize);
+ quint16 offset = getUShort(names + 10 + i*NameRecordSize);
+ if (DWORD(string_offset + offset + length) >= bytes)
+ continue;
+
+ if ((platform_id == PlatformId_Microsoft
+ && (encoding_id == 0 || encoding_id == 1))
+ && (language_id & 0x3ff) == MS_LangIdEnglish
+ && microsoft_id == -1)
+ microsoft_id = i;
+ // not sure if encoding id 4 for Unicode is utf16 or ucs4...
+ else if (platform_id == PlatformId_Unicode && encoding_id < 4 && unicode_id == -1)
+ unicode_id = i;
+ else if (platform_id == PlatformId_Apple && encoding_id == 0 && language_id == 0)
+ apple_id = i;
+ }
+ {
+ bool unicode = false;
+ int id = -1;
+ if (microsoft_id != -1) {
+ id = microsoft_id;
+ unicode = true;
+ } else if (apple_id != -1) {
+ id = apple_id;
+ unicode = false;
+ } else if (unicode_id != -1) {
+ id = unicode_id;
+ unicode = true;
+ }
+ if (id != -1) {
+ quint16 length = getUShort(names + 8 + id*NameRecordSize);
+ quint16 offset = getUShort(names + 10 + id*NameRecordSize);
+ if (unicode) {
+ // utf16
+
+ length /= 2;
+ i18n_name.resize(length);
+ QChar *uc = (QChar *) i18n_name.unicode();
+ const unsigned char *string = table + string_offset + offset;
+ for (int i = 0; i < length; ++i)
+ uc[i] = getUShort(string + 2*i);
+ } else {
+ // Apple Roman
+
+ i18n_name.resize(length);
+ QChar *uc = (QChar *) i18n_name.unicode();
+ const unsigned char *string = table + string_offset + offset;
+ for (int i = 0; i < length; ++i)
+ uc[i] = QLatin1Char(string[i]);
+ }
+ }
+ }
+error:
+ //qDebug("got i18n name of '%s' for font '%s'", i18n_name.latin1(), familyName.toLocal8Bit().data());
+ return i18n_name;
+}
+
+QString getEnglishName(const QString &familyName)
+{
+ QString i18n_name;
+
+ HDC hdc = GetDC( 0 );
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(LOGFONT));
+ memcpy(lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.length()) * sizeof(wchar_t));
+ lf.lfCharSet = DEFAULT_CHARSET;
+ HFONT hfont = CreateFontIndirect(&lf);
+
+ if (!hfont) {
+ ReleaseDC(0, hdc);
+ return QString();
+ }
+
+ HGDIOBJ oldobj = SelectObject( hdc, hfont );
+
+ const DWORD name_tag = MAKE_TAG( 'n', 'a', 'm', 'e' );
+
+ // get the name table
+ unsigned char *table = 0;
+
+ DWORD bytes = GetFontData( hdc, name_tag, 0, 0, 0 );
+ if ( bytes == GDI_ERROR ) {
+ // ### Unused variable
+ // int err = GetLastError();
+ goto error;
+ }
+
+ table = new unsigned char[bytes];
+ GetFontData(hdc, name_tag, 0, table, bytes);
+ if ( bytes == GDI_ERROR )
+ goto error;
+
+ i18n_name = getEnglishName(table, bytes);
+error:
+ delete [] table;
+ SelectObject( hdc, oldobj );
+ DeleteObject( hfont );
+ ReleaseDC( 0, hdc );
+
+ //qDebug("got i18n name of '%s' for font '%s'", i18n_name.latin1(), familyName.toLocal8Bit().data());
+ return i18n_name;
+}
Q_GUI_EXPORT void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias);
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index 031d6ad1a6..e972ae23ee 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -102,184 +102,6 @@ static inline QFont::Weight weightFromInteger(long weight)
return QFont::Black;
}
-#ifdef MAKE_TAG
-#undef MAKE_TAG
-#endif
-// GetFontData expects the tags in little endian ;(
-#define MAKE_TAG(ch1, ch2, ch3, ch4) (\
- (((quint32)(ch4)) << 24) | \
- (((quint32)(ch3)) << 16) | \
- (((quint32)(ch2)) << 8) | \
- ((quint32)(ch1)) \
- )
-
-bool localizedName(const QString &name)
-{
- const QChar *c = name.unicode();
- for (int i = 0; i < name.length(); ++i) {
- if (c[i].unicode() >= 0x100)
- return true;
- }
- return false;
-}
-
-static inline quint16 getUShort(const unsigned char *p)
-{
- quint16 val;
- val = *p++ << 8;
- val |= *p;
-
- return val;
-}
-
-static QString getEnglishName(const uchar *table, quint32 bytes)
-{
- QString i18n_name;
- enum {
- NameRecordSize = 12,
- FamilyId = 1,
- MS_LangIdEnglish = 0x009
- };
-
- // get the name table
- quint16 count;
- quint16 string_offset;
- const unsigned char *names;
-
- int microsoft_id = -1;
- int apple_id = -1;
- int unicode_id = -1;
-
- if (getUShort(table) != 0)
- goto error;
-
- count = getUShort(table+2);
- string_offset = getUShort(table+4);
- names = table + 6;
-
- if (string_offset >= bytes || 6 + count*NameRecordSize > string_offset)
- goto error;
-
- for (int i = 0; i < count; ++i) {
- // search for the correct name entry
-
- quint16 platform_id = getUShort(names + i*NameRecordSize);
- quint16 encoding_id = getUShort(names + 2 + i*NameRecordSize);
- quint16 language_id = getUShort(names + 4 + i*NameRecordSize);
- quint16 name_id = getUShort(names + 6 + i*NameRecordSize);
-
- if (name_id != FamilyId)
- continue;
-
- enum {
- PlatformId_Unicode = 0,
- PlatformId_Apple = 1,
- PlatformId_Microsoft = 3
- };
-
- quint16 length = getUShort(names + 8 + i*NameRecordSize);
- quint16 offset = getUShort(names + 10 + i*NameRecordSize);
- if (DWORD(string_offset + offset + length) >= bytes)
- continue;
-
- if ((platform_id == PlatformId_Microsoft
- && (encoding_id == 0 || encoding_id == 1))
- && (language_id & 0x3ff) == MS_LangIdEnglish
- && microsoft_id == -1)
- microsoft_id = i;
- // not sure if encoding id 4 for Unicode is utf16 or ucs4...
- else if (platform_id == PlatformId_Unicode && encoding_id < 4 && unicode_id == -1)
- unicode_id = i;
- else if (platform_id == PlatformId_Apple && encoding_id == 0 && language_id == 0)
- apple_id = i;
- }
- {
- bool unicode = false;
- int id = -1;
- if (microsoft_id != -1) {
- id = microsoft_id;
- unicode = true;
- } else if (apple_id != -1) {
- id = apple_id;
- unicode = false;
- } else if (unicode_id != -1) {
- id = unicode_id;
- unicode = true;
- }
- if (id != -1) {
- quint16 length = getUShort(names + 8 + id*NameRecordSize);
- quint16 offset = getUShort(names + 10 + id*NameRecordSize);
- if (unicode) {
- // utf16
-
- length /= 2;
- i18n_name.resize(length);
- QChar *uc = (QChar *) i18n_name.unicode();
- const unsigned char *string = table + string_offset + offset;
- for (int i = 0; i < length; ++i)
- uc[i] = getUShort(string + 2*i);
- } else {
- // Apple Roman
-
- i18n_name.resize(length);
- QChar *uc = (QChar *) i18n_name.unicode();
- const unsigned char *string = table + string_offset + offset;
- for (int i = 0; i < length; ++i)
- uc[i] = QLatin1Char(string[i]);
- }
- }
- }
-error:
- //qDebug("got i18n name of '%s' for font '%s'", i18n_name.latin1(), familyName.toLocal8Bit().data());
- return i18n_name;
-}
-
-QString getEnglishName(const QString &familyName)
-{
- QString i18n_name;
-
- HDC hdc = GetDC( 0 );
- LOGFONT lf;
- memset(&lf, 0, sizeof(LOGFONT));
- memcpy(lf.lfFaceName, familyName.utf16(), qMin(LF_FACESIZE, familyName.length()) * sizeof(wchar_t));
- lf.lfCharSet = DEFAULT_CHARSET;
- HFONT hfont = CreateFontIndirect(&lf);
-
- if (!hfont) {
- ReleaseDC(0, hdc);
- return QString();
- }
-
- HGDIOBJ oldobj = SelectObject( hdc, hfont );
-
- const DWORD name_tag = MAKE_TAG( 'n', 'a', 'm', 'e' );
-
- // get the name table
- unsigned char *table = 0;
-
- DWORD bytes = GetFontData( hdc, name_tag, 0, 0, 0 );
- if ( bytes == GDI_ERROR ) {
- // ### Unused variable
- // int err = GetLastError();
- goto error;
- }
-
- table = new unsigned char[bytes];
- GetFontData(hdc, name_tag, 0, table, bytes);
- if ( bytes == GDI_ERROR )
- goto error;
-
- i18n_name = getEnglishName(table, bytes);
-error:
- delete [] table;
- SelectObject( hdc, oldobj );
- DeleteObject( hfont );
- ReleaseDC( 0, hdc );
-
- //qDebug("got i18n name of '%s' for font '%s'", i18n_name.latin1(), familyName.toLocal8Bit().data());
- return i18n_name;
-}
-
static FontFile * createFontFile(const QString &fileName, int index)
{
FontFile *fontFile = new FontFile;
@@ -288,6 +110,9 @@ static FontFile * createFontFile(const QString &fileName, int index)
return fontFile;
}
+extern bool localizedName(const QString &name);
+extern QString getEnglishName(const QString &familyName);
+
Q_GUI_EXPORT void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias);
static bool addFontToDatabase(QString familyName, const QString &scriptName,
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h
index a33d24e2f6..610bad08dd 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.h
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.h
@@ -70,7 +70,7 @@ public:
virtual void reset();
virtual void update(Qt::InputMethodQueries);
- virtual void invokeAction(QInputPanel::Action, int cursorPosition);
+ virtual void invokeAction(QInputMethod::Action, int cursorPosition);
static QWindowsInputContext *instance();
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index a59b74cef3..5350b3ca3f 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -52,6 +52,7 @@
#include <QtCore/QSysInfo>
#include <QtGui/QPalette>
#include <QtGui/QGuiApplication>
+#include <QtGui/QWindowSystemInterface>
QT_BEGIN_NAMESPACE
@@ -220,11 +221,12 @@ static inline QStringList styleNames()
QVariant QWindowsTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
- case SystemIconThemeName:
- break;
+ case UseFullScreenForPopupMenu:
+ return QVariant(true);
+ case DialogButtonBoxLayout:
+ return QVariant(int(0)); // QDialogButtonBox::WinLayout
case IconThemeSearchPaths:
return QVariant(iconThemeSearchPaths());
- break;
case StyleNames:
return QVariant(styleNames());
case TextCursorWidth:
@@ -233,8 +235,12 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false));
case MaximumScrollBarDragDistance:
return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375));
+ case KeyboardScheme:
+ return QVariant(int(WindowsKeyboardScheme));
+ default:
+ break;
}
- return QVariant();
+ return QPlatformTheme::themeHint(hint);
}
void QWindowsTheme::refresh()
@@ -260,10 +266,10 @@ QPlatformDialogHelper *QWindowsTheme::createPlatformDialogHelper(DialogType type
return QWindowsDialogs::createHelper(type);
}
-void QWindowsTheme::windowsThemeChanged(QWindow * /* window */)
+void QWindowsTheme::windowsThemeChanged(QWindow * window)
{
refresh();
- // QWindowSystemInterface::handleThemeChange(window);
+ QWindowSystemInterface::handleThemeChange(window);
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index bad80568e3..f8d35ed4da 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -295,6 +295,7 @@ void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
qWarning("QClipboard::setData: Cannot set X11 selection owner");
}
+ emitChanged(mode);
}
bool QXcbClipboard::supportsMode(QClipboard::Mode mode) const
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index e7cdef4da9..98f69e9e16 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -204,12 +204,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case ThreadedPixmaps: return true;
case OpenGL: return true;
- case ThreadedOpenGL:
-#ifdef XCB_POLL_FOR_QUEUED_EVENT
- return true;
-#else
- return false;
-#endif
+ case ThreadedOpenGL: return false;
default: return QPlatformIntegration::hasCapability(cap);
}
}
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 43e4a6b7d9..067cb775c8 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -77,6 +77,7 @@
#define xcb_size_hints_set_win_gravity xcb_icccm_size_hints_set_win_gravity
#define xcb_wm_hints_set_iconic xcb_icccm_wm_hints_set_iconic
#define xcb_wm_hints_set_normal xcb_icccm_wm_hints_set_normal
+#define xcb_wm_hints_set_input xcb_icccm_wm_hints_set_input
#define xcb_wm_hints_t xcb_icccm_wm_hints_t
#define XCB_WM_STATE_ICONIC XCB_ICCCM_WM_STATE_ICONIC
#define XCB_WM_STATE_WITHDRAWN XCB_ICCCM_WM_STATE_WITHDRAWN
@@ -322,6 +323,8 @@ void QXcbWindow::create()
memset(&hints, 0, sizeof(hints));
xcb_wm_hints_set_normal(&hints);
+ xcb_wm_hints_set_input(&hints, !(window()->windowFlags() & Qt::WindowDoesNotAcceptFocus));
+
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
xcb_window_t leader = m_screen->clientLeader();
@@ -509,6 +512,8 @@ void QXcbWindow::show()
else
xcb_wm_hints_set_normal(&hints);
+ xcb_wm_hints_set_input(&hints, !(window()->windowFlags() & Qt::WindowDoesNotAcceptFocus));
+
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
// update WM_NORMAL_HINTS
@@ -730,6 +735,7 @@ Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags)
setMotifWindowFlags(flags);
setTransparentForMouseEvents(flags & Qt::WindowTransparentForInput);
+ updateDoesNotAcceptFocus(flags & Qt::WindowDoesNotAcceptFocus);
return flags;
}
@@ -1062,6 +1068,24 @@ void QXcbWindow::setTransparentForMouseEvents(bool transparent)
m_transparent = transparent;
}
+void QXcbWindow::updateDoesNotAcceptFocus(bool doesNotAcceptFocus)
+{
+ xcb_get_property_cookie_t cookie = xcb_get_wm_hints(xcb_connection(), m_window);
+
+ xcb_generic_error_t *error;
+
+ xcb_wm_hints_t hints;
+ xcb_get_wm_hints_reply(xcb_connection(), cookie, &hints, &error);
+
+ if (error) {
+ connection()->handleXcbError(error);
+ free(error);
+ return;
+ }
+
+ xcb_wm_hints_set_input(&hints, !doesNotAcceptFocus);
+ xcb_set_wm_hints(xcb_connection(), m_window, &hints);
+}
WId QXcbWindow::winId() const
{
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 365c8b0549..6ae55e77e6 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -132,6 +132,7 @@ private:
void updateNetWmStateBeforeMap();
void setTransparentForMouseEvents(bool transparent);
+ void updateDoesNotAcceptFocus(bool doesNotAcceptFocus);
void create();
void destroy();
diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp
index 920b4a4cff..69a0f20777 100644
--- a/src/plugins/platforms/xlib/qxlibclipboard.cpp
+++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp
@@ -223,6 +223,7 @@ void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
qWarning("QClipboard::setData: Cannot set X11 selection owner");
}
+ emitChanged(mode);
}
bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const
diff --git a/src/plugins/printsupport/windows/main.cpp b/src/plugins/printsupport/windows/main.cpp
index baf18504ee..e29705a8a7 100644
--- a/src/plugins/printsupport/windows/main.cpp
+++ b/src/plugins/printsupport/windows/main.cpp
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
class QWindowsPrinterSupportPlugin : public QPlatformPrinterSupportPlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.QPlatformPrinterSupportFactoryInterface" FILE "windows.json")
+
public:
QStringList keys() const;
QPlatformPrinterSupport *create(const QString &);
@@ -67,8 +69,6 @@ QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key
return 0;
}
-Q_EXPORT_PLUGIN2(windowsprint, QWindowsPrinterSupportPlugin)
-
QT_END_NAMESPACE
#include "main.moc"
diff --git a/src/plugins/printsupport/windows/windows.json b/src/plugins/printsupport/windows/windows.json
new file mode 100644
index 0000000000..803052854e
--- /dev/null
+++ b/src/plugins/printsupport/windows/windows.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "windowsprintsupport" ]
+}
diff --git a/src/plugins/printsupport/windows/windows.pro b/src/plugins/printsupport/windows/windows.pro
index 2032125f4b..97d90a6a9d 100644
--- a/src/plugins/printsupport/windows/windows.pro
+++ b/src/plugins/printsupport/windows/windows.pro
@@ -15,6 +15,8 @@ SOURCES += \
HEADERS += \
qwindowsprintersupport.h
+OTHER_FILES += windows.json
+
target.path += $$[QT_INSTALL_PLUGINS]/printsupport
INSTALLS += target
LIBS += -lWinspool -lComdlg32
diff --git a/src/plugins/sqldrivers/db2/db2.json b/src/plugins/sqldrivers/db2/db2.json
new file mode 100644
index 0000000000..3f8678ae7a
--- /dev/null
+++ b/src/plugins/sqldrivers/db2/db2.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QDB2" ]
+}
diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro
index e053f3756b..d04e6f191b 100644
--- a/src/plugins/sqldrivers/db2/db2.pro
+++ b/src/plugins/sqldrivers/db2/db2.pro
@@ -1,6 +1,7 @@
TARGET = qsqldb2
SOURCES = main.cpp
+OTHER_FILES += db2.json
include(../../../sql/drivers/db2/qsql_db2.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/db2/main.cpp b/src/plugins/sqldrivers/db2/main.cpp
index af5eb10c67..186eacf2e9 100644
--- a/src/plugins/sqldrivers/db2/main.cpp
+++ b/src/plugins/sqldrivers/db2/main.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QDB2DriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "db2.json")
+
public:
QDB2DriverPlugin();
@@ -70,12 +73,9 @@ QSqlDriver* QDB2DriverPlugin::create(const QString &name)
QStringList QDB2DriverPlugin::keys() const
{
- QStringList l;
- l.append(QLatin1String("QDB2"));
- return l;
+ return QStringList(QStringLiteral("QDB2"));
}
-Q_EXPORT_STATIC_PLUGIN(QDB2DriverPlugin)
-Q_EXPORT_PLUGIN2(qsqldb2, QDB2DriverPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sqldrivers/ibase/ibase.json b/src/plugins/sqldrivers/ibase/ibase.json
new file mode 100644
index 0000000000..e2186b32cd
--- /dev/null
+++ b/src/plugins/sqldrivers/ibase/ibase.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QIBASE" ]
+}
diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro
index 7870ec8465..ca2a91aa2e 100644
--- a/src/plugins/sqldrivers/ibase/ibase.pro
+++ b/src/plugins/sqldrivers/ibase/ibase.pro
@@ -1,6 +1,7 @@
TARGET = qsqlibase
SOURCES = main.cpp
+OTHER_FILES += ibase.json
include(../../../sql/drivers/ibase/qsql_ibase.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/ibase/main.cpp b/src/plugins/sqldrivers/ibase/main.cpp
index c1018944fd..e820c6a333 100644
--- a/src/plugins/sqldrivers/ibase/main.cpp
+++ b/src/plugins/sqldrivers/ibase/main.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QIBaseDriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "ibase.json")
+
public:
QIBaseDriverPlugin();
@@ -70,12 +73,9 @@ QSqlDriver* QIBaseDriverPlugin::create(const QString &name)
QStringList QIBaseDriverPlugin::keys() const
{
- QStringList l;
- l << QLatin1String("QIBASE");
- return l;
+ return QStringList(QStringLiteral("QIBASE"));
}
-Q_EXPORT_STATIC_PLUGIN(QIBaseDriverPlugin)
-Q_EXPORT_PLUGIN2(qsqlibase, QIBaseDriverPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp
index 86cae58701..70937218c3 100644
--- a/src/plugins/sqldrivers/mysql/main.cpp
+++ b/src/plugins/sqldrivers/mysql/main.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QMYSQLDriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "mysql.json")
+
public:
QMYSQLDriverPlugin();
@@ -76,7 +79,6 @@ QStringList QMYSQLDriverPlugin::keys() const
return l;
}
-Q_EXPORT_STATIC_PLUGIN(QMYSQLDriverPlugin)
-Q_EXPORT_PLUGIN2(qsqlmysql, QMYSQLDriverPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sqldrivers/mysql/mysql.json b/src/plugins/sqldrivers/mysql/mysql.json
new file mode 100644
index 0000000000..0caaadb7ce
--- /dev/null
+++ b/src/plugins/sqldrivers/mysql/mysql.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QMYSQL3", "QMYSQL" ]
+}
diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro
index b6d42fffc8..05d1073701 100644
--- a/src/plugins/sqldrivers/mysql/mysql.pro
+++ b/src/plugins/sqldrivers/mysql/mysql.pro
@@ -1,6 +1,7 @@
TARGET = qsqlmysql
SOURCES = main.cpp
+OTHER_FILES += mysql.json
include(../../../sql/drivers/mysql/qsql_mysql.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/oci/main.cpp b/src/plugins/sqldrivers/oci/main.cpp
index 4e5a07a64c..205bfae783 100644
--- a/src/plugins/sqldrivers/oci/main.cpp
+++ b/src/plugins/sqldrivers/oci/main.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QOCIDriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "oci.json")
+
public:
QOCIDriverPlugin();
@@ -76,7 +79,6 @@ QStringList QOCIDriverPlugin::keys() const
return l;
}
-Q_EXPORT_STATIC_PLUGIN(QOCIDriverPlugin)
-Q_EXPORT_PLUGIN2(qsqloci, QOCIDriverPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sqldrivers/oci/oci.json b/src/plugins/sqldrivers/oci/oci.json
new file mode 100644
index 0000000000..cbed8fc1ac
--- /dev/null
+++ b/src/plugins/sqldrivers/oci/oci.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QOCI8", "QOCI" ]
+}
diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro
index d7dcce9e35..89642f3653 100644
--- a/src/plugins/sqldrivers/oci/oci.pro
+++ b/src/plugins/sqldrivers/oci/oci.pro
@@ -1,6 +1,7 @@
TARGET = qsqloci
SOURCES = main.cpp
+OTHER_FILES += oci.json
include(../../../sql/drivers/oci/qsql_oci.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/odbc/main.cpp b/src/plugins/sqldrivers/odbc/main.cpp
index eada54da9e..c55af6e6fc 100644
--- a/src/plugins/sqldrivers/odbc/main.cpp
+++ b/src/plugins/sqldrivers/odbc/main.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QODBCDriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "odbc.json")
+
public:
QODBCDriverPlugin();
@@ -76,7 +79,6 @@ QStringList QODBCDriverPlugin::keys() const
return l;
}
-Q_EXPORT_STATIC_PLUGIN(QODBCDriverPlugin)
-Q_EXPORT_PLUGIN2(qsqlodbc, QODBCDriverPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sqldrivers/odbc/odbc.json b/src/plugins/sqldrivers/odbc/odbc.json
new file mode 100644
index 0000000000..41640776fb
--- /dev/null
+++ b/src/plugins/sqldrivers/odbc/odbc.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QODBC3", "QODBC" ]
+}
diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro
index 677eb6eedf..5ebd34fd17 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -1,6 +1,7 @@
TARGET = qsqlodbc
SOURCES = main.cpp
+OTHER_FILES += odbc.json
include(../../../sql/drivers/odbc/qsql_odbc.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/psql/main.cpp b/src/plugins/sqldrivers/psql/main.cpp
index db233b9486..117df561ab 100644
--- a/src/plugins/sqldrivers/psql/main.cpp
+++ b/src/plugins/sqldrivers/psql/main.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QPSQLDriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "psql.json")
+
public:
QPSQLDriverPlugin();
@@ -76,7 +79,6 @@ QStringList QPSQLDriverPlugin::keys() const
return l;
}
-Q_EXPORT_STATIC_PLUGIN(QPSQLDriverPlugin)
-Q_EXPORT_PLUGIN2(qsqlpsql, QPSQLDriverPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sqldrivers/psql/psql.json b/src/plugins/sqldrivers/psql/psql.json
new file mode 100644
index 0000000000..1579b99160
--- /dev/null
+++ b/src/plugins/sqldrivers/psql/psql.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QPSQL7", "QPSQL" ]
+}
diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro
index 8276c0ae90..cb0d27e171 100644
--- a/src/plugins/sqldrivers/psql/psql.pro
+++ b/src/plugins/sqldrivers/psql/psql.pro
@@ -1,6 +1,7 @@
TARGET = qsqlpsql
SOURCES = main.cpp
+OTHER_FILES += psql.json
include(../../../sql/drivers/psql/qsql_psql.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/sqlite/smain.cpp b/src/plugins/sqldrivers/sqlite/smain.cpp
index 47cb08b75c..90ed72eedc 100644
--- a/src/plugins/sqldrivers/sqlite/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite/smain.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QSQLiteDriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "sqlite.json")
+
public:
QSQLiteDriverPlugin();
@@ -70,12 +73,9 @@ QSqlDriver* QSQLiteDriverPlugin::create(const QString &name)
QStringList QSQLiteDriverPlugin::keys() const
{
- QStringList l;
- l << QLatin1String("QSQLITE");
- return l;
+ return QStringList(QStringLiteral("QSQLITE"));
}
-Q_EXPORT_STATIC_PLUGIN(QSQLiteDriverPlugin)
-Q_EXPORT_PLUGIN2(qsqlite, QSQLiteDriverPlugin)
-
QT_END_NAMESPACE
+
+#include "smain.moc"
diff --git a/src/plugins/sqldrivers/sqlite/sqlite.json b/src/plugins/sqldrivers/sqlite/sqlite.json
new file mode 100644
index 0000000000..3061d83145
--- /dev/null
+++ b/src/plugins/sqldrivers/sqlite/sqlite.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QSQLITE" ]
+}
diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro
index f4c1671a4b..d1f4aa7233 100644
--- a/src/plugins/sqldrivers/sqlite/sqlite.pro
+++ b/src/plugins/sqldrivers/sqlite/sqlite.pro
@@ -1,6 +1,7 @@
TARGET = qsqlite
SOURCES = smain.cpp
+OTHER_FILES += sqlite.json
include(../../../sql/drivers/sqlite/qsql_sqlite.pri)
wince*: DEFINES += HAVE_LOCALTIME_S=0
diff --git a/src/plugins/sqldrivers/sqlite2/smain.cpp b/src/plugins/sqldrivers/sqlite2/smain.cpp
index f16057c0a6..49cfd1cdfb 100644
--- a/src/plugins/sqldrivers/sqlite2/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite2/smain.cpp
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE
class QSQLite2DriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "sqlite2.json")
+
public:
QSQLite2DriverPlugin();
@@ -70,12 +73,9 @@ QSqlDriver* QSQLite2DriverPlugin::create(const QString &name)
QStringList QSQLite2DriverPlugin::keys() const
{
- QStringList l;
- l << QLatin1String("QSQLITE2");
- return l;
+ return QStringList(QStringLiteral("QSQLITE2"));
}
-Q_EXPORT_STATIC_PLUGIN(QSQLite2DriverPlugin)
-Q_EXPORT_PLUGIN2(qsqlite2, QSQLite2DriverPlugin)
-
QT_END_NAMESPACE
+
+#include "smain.moc"
diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.json b/src/plugins/sqldrivers/sqlite2/sqlite2.json
new file mode 100644
index 0000000000..47bdae4d60
--- /dev/null
+++ b/src/plugins/sqldrivers/sqlite2/sqlite2.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QSQLITE2" ]
+}
diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
index e6197b9906..1cbd31c3dc 100644
--- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro
+++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
@@ -1,6 +1,7 @@
TARGET = qsqlite2
SOURCES = smain.cpp
+OTHER_FILES += sqlite2.json
include(../../../sql/drivers/sqlite2/qsql_sqlite2.pri)
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp
index 97ca1c0ed0..c63f0e5606 100644
--- a/src/plugins/sqldrivers/tds/main.cpp
+++ b/src/plugins/sqldrivers/tds/main.cpp
@@ -54,6 +54,9 @@ QT_BEGIN_NAMESPACE
class QTDSDriverPlugin : public QSqlDriverPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "tds.json")
+
public:
QTDSDriverPlugin();
@@ -83,7 +86,6 @@ QStringList QTDSDriverPlugin::keys() const
return l;
}
-Q_EXPORT_STATIC_PLUGIN(QTDSDriverPlugin)
-Q_EXPORT_PLUGIN2(qsqltds, QTDSDriverPlugin)
-
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/sqldrivers/tds/tds.json b/src/plugins/sqldrivers/tds/tds.json
new file mode 100644
index 0000000000..35955db9fa
--- /dev/null
+++ b/src/plugins/sqldrivers/tds/tds.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "QTDS7", "QTDS" ]
+}
diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro
index b8e8ded321..9f7c2a193f 100644
--- a/src/plugins/sqldrivers/tds/tds.pro
+++ b/src/plugins/sqldrivers/tds/tds.pro
@@ -1,6 +1,7 @@
TARGET = qsqltds
SOURCES = main.cpp
+OTHER_FILES += tds.json
include(../../../sql/drivers/tds/qsql_tds.pri)
include(../qsqldriverbase.pri)
diff --git a/src/printsupport/kernel/qprinterinfo_unix.cpp b/src/printsupport/kernel/qprinterinfo_unix.cpp
index fba3b4d0a3..ae0885c0f4 100644
--- a/src/printsupport/kernel/qprinterinfo_unix.cpp
+++ b/src/printsupport/kernel/qprinterinfo_unix.cpp
@@ -587,7 +587,6 @@ void qt_parseEtcLpMember(QList<QPrinterDescription> *printers)
if (dirs.isEmpty())
return;
- QString tmp;
for (int i = 0; i < dirs.size(); ++i) {
QFileInfo printer = dirs.at(i);
// I haven't found any real documentation, so I'm guessing that
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
index b42f82e800..2ffd88e8c5 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
@@ -53,7 +53,7 @@
#include <qstringlist.h>
#include <qvector.h>
-#if !defined Q_WS_WIN32
+#if !defined Q_OS_WIN
# include <unistd.h>
#endif
#include <sqlite.h>
@@ -208,7 +208,7 @@ bool QSQLite2ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int
// keep trying while busy, wish I could implement this better.
while ((res = sqlite_step(currentMachine, &colNum, &fvals, &cnames)) == SQLITE_BUSY) {
// sleep instead requesting result again immidiately.
-#if defined Q_WS_WIN32
+#if defined Q_OS_WIN
Sleep(1000);
#else
sleep(1);
diff --git a/src/sql/kernel/qsqlfield.cpp b/src/sql/kernel/qsqlfield.cpp
index 5d01df1b8e..3160d25ef5 100644
--- a/src/sql/kernel/qsqlfield.cpp
+++ b/src/sql/kernel/qsqlfield.cpp
@@ -504,7 +504,6 @@ bool QSqlField::isValid() const
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QSqlField &f)
{
-#ifndef Q_BROKEN_DEBUG_STREAM
dbg.nospace() << "QSqlField(" << f.name() << ", " << QVariant::typeToName(f.type());
if (f.length() >= 0)
dbg.nospace() << ", length: " << f.length();
@@ -520,11 +519,6 @@ QDebug operator<<(QDebug dbg, const QSqlField &f)
dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"';
dbg.nospace() << ')';
return dbg.space();
-#else
- qWarning("This compiler doesn't support streaming QSqlField to QDebug");
- return dbg;
- Q_UNUSED(f);
-#endif
}
#endif
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 932bbbfd6b..571c28f515 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -378,13 +378,19 @@ bool QSqlTableModel::select()
if (query.isEmpty())
return false;
- // clear the submitted flags so revertAll can do its job
- for (QSqlTableModelPrivate::CacheMap::Iterator it = d->cache.begin();
- it != d->cache.constEnd();
- ++it)
- it.value().setSubmitted(false);
+ QSqlTableModelPrivate::CacheMap::Iterator it = d->cache.end();
+ while (it != d->cache.constBegin()) {
+ --it;
+ // rows must be accounted for
+ if (it.value().op() == QSqlTableModelPrivate::Insert) {
+ beginRemoveRows(QModelIndex(), it.key(), it.key());
+ it = d->cache.erase(it);
+ endRemoveRows();
+ } else {
+ it = d->cache.erase(it);
+ }
+ }
- revertAll();
QSqlQuery qu(query, d->db);
setQuery(qu);
@@ -439,13 +445,11 @@ QVariant QSqlTableModel::headerData(int section, Qt::Orientation orientation, in
{
Q_D(const QSqlTableModel);
if (orientation == Qt::Vertical && role == Qt::DisplayRole) {
- if (d->cache.contains(section)) {
- const QSqlTableModelPrivate::Op op = d->cache.value(section).op();
- if (op == QSqlTableModelPrivate::Insert)
- return QLatin1String("*");
- else if (op == QSqlTableModelPrivate::Delete)
- return QLatin1String("!");
- }
+ const QSqlTableModelPrivate::Op op = d->cache.value(section).op();
+ if (op == QSqlTableModelPrivate::Insert)
+ return QLatin1String("*");
+ else if (op == QSqlTableModelPrivate::Delete)
+ return QLatin1String("!");
}
return QSqlQueryModel::headerData(section, orientation, role);
}
@@ -463,23 +467,14 @@ bool QSqlTableModel::isDirty(const QModelIndex &index) const
if (!index.isValid())
return false;
- switch (d->strategy) {
- case OnFieldChange:
- return false;
- case OnRowChange: {
- const QSqlTableModelPrivate::ModifiedRow row = d->cache.value(index.row());
- return row.op() == QSqlTableModelPrivate::Update
- && row.rec().isGenerated(index.column());
- }
- case OnManualSubmit: {
- const QSqlTableModelPrivate::ModifiedRow row = d->cache.value(index.row());
- return row.op() == QSqlTableModelPrivate::Insert
- || row.op() == QSqlTableModelPrivate::Delete
- || (row.op() == QSqlTableModelPrivate::Update
- && row.rec().isGenerated(index.column()));
- }
- }
- return false;
+ const QSqlTableModelPrivate::ModifiedRow row = d->cache.value(index.row());
+ if (row.submitted())
+ return false;
+
+ return row.op() == QSqlTableModelPrivate::Insert
+ || row.op() == QSqlTableModelPrivate::Delete
+ || (row.op() == QSqlTableModelPrivate::Update
+ && row.rec().isGenerated(index.column()));
}
/*!
@@ -513,10 +508,9 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in
QSqlTableModelPrivate::ModifiedRow &row = d->cache[index.row()];
- if (row.op() == QSqlTableModelPrivate::None) {
+ if (row.op() == QSqlTableModelPrivate::None)
row = QSqlTableModelPrivate::ModifiedRow(QSqlTableModelPrivate::Update,
d->rec);
- }
row.setValue(index.column(), value);
emit dataChanged(index, index);
@@ -659,7 +653,7 @@ bool QSqlTableModel::deleteRowFromTable(int row)
Note: In OnManualSubmit mode, already submitted changes won't
be cleared from the cache when submitAll() fails. This allows
- transactions to be rolled back and resubmitted again without
+ transactions to be rolled back and resubmitted without
losing data.
\sa revertAll(), lastError()
@@ -693,19 +687,6 @@ bool QSqlTableModel::submitAll()
it.value().setSubmitted(true);
}
- // all changes have been committed
-
- // clean up inserted rows
- QSqlTableModelPrivate::CacheMap::Iterator it = d->cache.end();
- while (it != d->cache.constBegin()) {
- --it;
- if (it.value().op() == QSqlTableModelPrivate::Insert) {
- beginRemoveRows(QModelIndex(), it.key(), it.key());
- it = d->cache.erase(it);
- endRemoveRows();
- }
- }
- d->clearCache();
return select();
}
@@ -1050,6 +1031,8 @@ bool QSqlTableModel::removeRows(int row, int count, const QModelIndex &parent)
Returns false if the parameters are out of bounds; otherwise
returns true.
+ Does not submit rows, regardless of edit strategy, not even OnFieldChange.
+
\sa primeInsert(), insertRecord()
*/
bool QSqlTableModel::insertRows(int row, int count, const QModelIndex &parent)
@@ -1097,7 +1080,11 @@ bool QSqlTableModel::insertRows(int row, int count, const QModelIndex &parent)
Returns true if the record could be inserted, otherwise false.
- \sa insertRows(), removeRows()
+ Changes are submitted immediately for OnFieldChange and
+ OnRowChange. Note the contrast with setRecord() in respect to
+ OnRowChange.
+
+ \sa insertRows(), removeRows(), setRecord()
*/
bool QSqlTableModel::insertRecord(int row, const QSqlRecord &record)
{
@@ -1210,9 +1197,15 @@ Qt::ItemFlags QSqlTableModel::flags(const QModelIndex &index) const
Returns true if all the values could be set; otherwise returns
false.
- \sa record()
+ The edit strategy affects automatic submitting.
+ With OnFieldChange, setRecord() commits its changed row.
+ With OnRowChange, setRecord() does not commit its changed row,
+ but making a change to another row causes previous changes to
+ be submitted.
+
+ \sa record(), editStrategy()
*/
-bool QSqlTableModel::setRecord(int row, const QSqlRecord &record)
+bool QSqlTableModel::setRecord(int row, const QSqlRecord &values)
{
Q_D(QSqlTableModel);
Q_ASSERT_X(row >= 0, "QSqlTableModel::setRecord()", "Cannot set a record to a row less than 0");
@@ -1230,9 +1223,9 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &record)
// Check field names and remember mapping
typedef QMap<int, int> Map;
Map map;
- for (int i = 0; i < record.count(); ++i) {
- if (record.isGenerated(i)) {
- int idx = d->nameToIndex(record.fieldName(i));
+ for (int i = 0; i < values.count(); ++i) {
+ if (values.isGenerated(i)) {
+ int idx = d->nameToIndex(values.fieldName(i));
if (idx == -1)
return false;
map[i] = idx;
@@ -1247,7 +1240,7 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &record)
Map::const_iterator i = map.constBegin();
const Map::const_iterator e = map.constEnd();
for ( ; i != e; ++i)
- mrow.setValue(i.value(), record.value(i.key()));
+ mrow.setValue(i.value(), values.value(i.key()));
if (columnCount())
emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1));
diff --git a/src/src.pro b/src/src.pro
index f3f6937c50..6e1517fb07 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -90,8 +90,8 @@ for(subname, SRC_SUBDIRS) {
subdir = $$replace(subdir, $$reg_src, $$QT_BUILD_TREE)
subdir = $$replace(subdir, /, $$QMAKE_DIR_SEP)
subdir = $$replace(subdir, \\\\, $$QMAKE_DIR_SEP)
- SUB_TEMPLATE = $$list($$fromfile($$subpro, TEMPLATE))
- !isEqual(subname, src_tools_bootstrap):if(isEqual($$SUB_TEMPLATE, lib) | isEqual($$SUB_TEMPLATE, subdirs)):!separate_debug_info {
+ SUB_TEMPLATE = $$fromfile($$subpro, TEMPLATE)
+ !isEqual(subname, src_tools_bootstrap):if(isEqual(SUB_TEMPLATE, lib) | isEqual(SUB_TEMPLATE, subdirs)):!separate_debug_info {
#debug
debug-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS
debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) debug)
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index bd4f26b493..2f87e08c3c 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -251,7 +251,6 @@ void QPlainTestLogger::printMessage(const char *type, const char *msg, const cha
outputMessage(buf.data());
}
-//void QPlainTestLogger::printBenchmarkResult(const char *bmtag, int value, int iterations)
void QPlainTestLogger::printBenchmarkResult(const QBenchmarkResult &result)
{
const char *bmtag = QTest::benchmarkResult2String();
@@ -372,8 +371,9 @@ void QPlainTestLogger::leaveTestFunction()
void QPlainTestLogger::addIncident(IncidentTypes type, const char *description,
const char *file, int line)
{
- // suppress PASS in silent mode
- if (type == QAbstractTestLogger::Pass && QTestLog::verboseLevel() < 0)
+ // suppress PASS and XFAIL in silent mode
+ if ((type == QAbstractTestLogger::Pass || type == QAbstractTestLogger::XFail)
+ && QTestLog::verboseLevel() < 0)
return;
printMessage(QTest::incidentType2String(type), description, file, line);
@@ -381,16 +381,18 @@ void QPlainTestLogger::addIncident(IncidentTypes type, const char *description,
void QPlainTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
{
-// printBenchmarkResult(QTest::benchmarkResult2String(), value, iterations);
+ // suppress benchmark results in silent mode
+ if (QTestLog::verboseLevel() < 0)
+ return;
+
printBenchmarkResult(result);
}
void QPlainTestLogger::addMessage(MessageTypes type, const char *message,
const char *file, int line)
{
- // suppress PASS in silent mode
- if ((type == QAbstractTestLogger::Skip || type == QAbstractTestLogger::Info)
- && QTestLog::verboseLevel() < 0)
+ // suppress non-fatal messages in silent mode
+ if (type != QAbstractTestLogger::QFatal && QTestLog::verboseLevel() < 0)
return;
printMessage(QTest::messageType2String(type), message, file, line);
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index e867b9629a..a4f1a39bbd 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -166,6 +166,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \macro QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)
+ \since 5.0
\relates QTest
@@ -183,6 +184,7 @@ QT_BEGIN_NAMESPACE
/*! \macro QTRY_VERIFY(condition)
+ \since 5.0
\relates QTest
@@ -195,6 +197,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \macro QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)
+ \since 5.0
\relates QTest
@@ -211,6 +214,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \macro QTRY_COMPARE(actual, expected)
+ \since 5.0
\relates QTest
@@ -360,6 +364,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \macro QFINDTESTDATA(filename)
+ \since 5.0
\relates QTest
@@ -449,6 +454,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \macro QTEST_GUILESS_MAIN(TestClass)
+ \since 5.0
\relates QTest
@@ -1186,7 +1192,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
" *** If no output format is specified, -txt is assumed.\n"
"\n"
" Detail options:\n"
- " -silent : Only outputs warnings and failures\n"
+ " -silent : Only output failures and fatal errors in plain text output\n"
" -v1 : Print enter messages for each testfunction\n"
" -v2 : Also print out each QVERIFY/QCOMPARE/QTEST\n"
" -vs : Print every signal emitted\n"
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 26769f95db..2f5b3229e4 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -13,7 +13,6 @@ unix:!embedded:QMAKE_PKGCONFIG_DESCRIPTION = Qt \
Testing \
Library
-# Input
HEADERS = qbenchmark.h \
qsignalspy.h \
qtestaccessible.h \
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index c7c7d96487..ac602fd6e8 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -951,13 +951,17 @@ void Generator::generateStaticMetacall()
}
fprintf(out, " default: ;\n");
fprintf(out, " }\n");
-
- fprintf(out, " } else if (_c == QMetaObject::IndexOfMethod) {\n");
+ fprintf(out, " }");
+ needElse = true;
+ }
+ if (!cdef->signalList.isEmpty()) {
+ Q_ASSERT(needElse); // if there is signal, there was method.
+ fprintf(out, " else if (_c == QMetaObject::IndexOfMethod) {\n");
fprintf(out, " int *result = reinterpret_cast<int *>(_a[0]);\n");
fprintf(out, " void **func = reinterpret_cast<void **>(_a[1]);\n");
bool anythingUsed = false;
- for (int methodindex = 0; methodindex < methodList.size(); ++methodindex) {
- const FunctionDef &f = methodList.at(methodindex);
+ for (int methodindex = 0; methodindex < cdef->signalList.size(); ++methodindex) {
+ const FunctionDef &f = cdef->signalList.at(methodindex);
if (f.wasCloned || !f.inPrivateClass.isEmpty() || f.isStatic)
continue;
anythingUsed = true;
diff --git a/src/tools/moc/outputrevision.h b/src/tools/moc/outputrevision.h
index 15661a43aa..2ce5b9b765 100644
--- a/src/tools/moc/outputrevision.h
+++ b/src/tools/moc/outputrevision.h
@@ -43,6 +43,6 @@
#define OUTPUTREVISION_H
// if the output revision changes, you MUST change it in qobjectdefs.h too
-enum { mocOutputRevision = 63 }; // moc format output revision
+enum { mocOutputRevision = 64 }; // moc format output revision
#endif // OUTPUTREVISION_H
diff --git a/src/tools/moc/util/generate_keywords.pro b/src/tools/moc/util/generate_keywords.pro
index eb04409922..88e5553f54 100644
--- a/src/tools/moc/util/generate_keywords.pro
+++ b/src/tools/moc/util/generate_keywords.pro
@@ -1,12 +1,4 @@
-######################################################################
-# Automatically generated by qmake (1.08a) Mon Feb 23 13:08:28 2004
-######################################################################
-
-TEMPLATE = app
CONFIG -= moc
mac:CONFIG -= app_bundle
-INCLUDEPATH += .
-# Input
SOURCES += generate_keywords.cpp
-CONFIG += qt create_prl link_prl
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index bfb3206778..dfe23983b7 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -687,7 +687,7 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice)
void RCCResourceLibrary::writeHex(quint8 tmp)
{
- const char * const digits = "0123456789abcdef";
+ const char digits[] = "0123456789abcdef";
writeChar('0');
writeChar('x');
if (tmp < 16) {
diff --git a/src/tools/tools.pro b/src/tools/tools.pro
index e6b9eefc69..cf10163539 100644
--- a/src/tools/tools.pro
+++ b/src/tools/tools.pro
@@ -32,8 +32,8 @@ for(subname, TOOLS_SUBDIRS) {
subdir = $$replace(subdir, $$reg_src, $$QT_BUILD_TREE)
subdir = $$replace(subdir, /, $$QMAKE_DIR_SEP)
subdir = $$replace(subdir, \\\\, $$QMAKE_DIR_SEP)
- SUB_TEMPLATE = $$list($$fromfile($$subpro, TEMPLATE))
- !isEqual(subname, src_tools_bootstrap):if(isEqual($$SUB_TEMPLATE, lib) | isEqual($$SUB_TEMPLATE, subdirs)):!separate_debug_info {
+ SUB_TEMPLATE = $$fromfile($$subpro, TEMPLATE)
+ !isEqual(subname, src_tools_bootstrap):if(isEqual(SUB_TEMPLATE, lib) | isEqual(SUB_TEMPLATE, subdirs)):!separate_debug_info {
#debug
debug-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS
debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) debug)
diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp
index 16dc12f277..ea1d4f21f3 100644
--- a/src/tools/uic/driver.cpp
+++ b/src/tools/uic/driver.cpp
@@ -43,7 +43,6 @@
#include "uic.h"
#include "ui4.h"
-#include <QtCore/QRegExp>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp
index 2de3352cfc..4ae04149e8 100644
--- a/src/tools/uic/uic.cpp
+++ b/src/tools/uic/uic.cpp
@@ -58,7 +58,6 @@
#include <QtCore/QXmlStreamReader>
#include <QtCore/QFileInfo>
-#include <QtCore/QRegExp>
#include <QtCore/QTextStream>
#include <QtCore/QDateTime>
diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
index baf34b2fbc..93d3c6998a 100644
--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
@@ -1,5 +1,8 @@
get_filename_component(_qt5_widgets_install_prefix ${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR} ABSOLUTE)
-# Not Required by default:
-set(QT_UIC_EXECUTABLE \"${_qt5_widgets_install_prefix}/$$CMAKE_BIN_DIR/uic$$CMAKE_BIN_SUFFIX\")
+!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+set(QT_UIC_EXECUTABLE \"${_qt5_widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+!!ELSE
+set(QT_UIC_EXECUTABLE \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+!!ENDIF
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index feac42780d..790b51102c 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -128,7 +128,7 @@ QString Q_WIDGETS_EXPORT qt_accHotKey(const QString &text)
}
if (ac.isNull())
return QString();
- return (QString)QKeySequence(Qt::ALT) + ac.toUpper();
+ return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + ac.toUpper();
#else
Q_UNUSED(text);
return QString();
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 49b4dd3a23..5ffb5466d6 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -55,6 +55,7 @@
#include "qplatformtheme_qpa.h"
#include "private/qdialog_p.h"
#include "private/qguiapplication_p.h"
+#include "qplatformtheme_qpa.h"
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
@@ -790,11 +791,10 @@ void QDialog::showEvent(QShowEvent *event)
/*! \internal */
void QDialog::adjustPosition(QWidget* w)
{
-#ifdef Q_WS_X11
- // if the WM advertises that it will place the windows properly for us, let it do it :)
- if (X11->isSupportedByWM(ATOM(_NET_WM_FULL_PLACEMENT)))
- return;
-#endif
+
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ if (theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool())
+ return;
QPoint p(0, 0);
int extraw = 0, extrah = 0, scrn = 0;
if (w)
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 7ea4302a56..0211b2512c 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -1926,12 +1926,10 @@ void QFileSystemModelPrivate::init()
q, SIGNAL(directoryLoaded(QString)));
q->connect(&delayedSortTimer, SIGNAL(timeout()), q, SLOT(_q_performDelayedSort()), Qt::QueuedConnection);
- QHash<int, QByteArray> roles = q->roleNames();
- roles.insertMulti(QFileSystemModel::FileIconRole, "fileIcon"); // == Qt::decoration
- roles.insert(QFileSystemModel::FilePathRole, "filePath");
- roles.insert(QFileSystemModel::FileNameRole, "fileName");
- roles.insert(QFileSystemModel::FilePermissions, "filePermissions");
- q->setRoleNames(roles);
+ roleNames.insertMulti(QFileSystemModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration
+ roleNames.insert(QFileSystemModel::FilePathRole, QByteArrayLiteral("filePath"));
+ roleNames.insert(QFileSystemModel::FileNameRole, QByteArrayLiteral("fileName"));
+ roleNames.insert(QFileSystemModel::FilePermissions, QByteArrayLiteral("filePermissions"));
}
/*!
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 634e911cd1..a737584e3f 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1365,13 +1365,13 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
#ifndef QT_NO_SHORTCUT
if (!(e->modifiers() & Qt::AltModifier)) {
- int key = e->key() & ~((int)Qt::MODIFIER_MASK|(int)Qt::UNICODE_ACCEL);
+ int key = e->key() & ~Qt::MODIFIER_MASK;
if (key) {
const QList<QAbstractButton *> buttons = d->buttonBox->buttons();
for (int i = 0; i < buttons.count(); ++i) {
QAbstractButton *pb = buttons.at(i);
- int acc = pb->shortcut() & ~((int)Qt::MODIFIER_MASK|(int)Qt::UNICODE_ACCEL);
- if (acc == key) {
+ QKeySequence shortcut = pb->shortcut();
+ if (!shortcut.isEmpty() && key == (shortcut[0] & ~Qt::MODIFIER_MASK)) {
pb->animateClick();
return;
}
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index 5dec62acc2..6758aeb337 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -481,7 +481,7 @@ QRegion QColumnView::visualRegionForSelection(const QItemSelection &selection) c
QRegion firstRegion = visualRect(firstIdx);
QRegion lastRegion = visualRect(lastIdx);
- return firstRegion.unite(lastRegion);
+ return firstRegion.united(lastRegion);
}
/*!
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 67a16a836d..ee097e5c41 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -1169,11 +1169,9 @@ void QDirModelPrivate::init()
root.parent = 0;
root.info = QFileInfo();
clear(&root);
- QHash<int, QByteArray> roles = q->roleNames();
- roles.insertMulti(QDirModel::FileIconRole, "fileIcon"); // == Qt::decoration
- roles.insert(QDirModel::FilePathRole, "filePath");
- roles.insert(QDirModel::FileNameRole, "fileName");
- q->setRoleNames(roles);
+ roleNames.insertMulti(QDirModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration
+ roleNames.insert(QDirModel::FilePathRole, QByteArrayLiteral("filePath"));
+ roleNames.insert(QDirModel::FileNameRole, QByteArrayLiteral("fileName"));
}
QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) const
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 6a1f949258..5d2aceaade 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1802,9 +1802,8 @@ void QHeaderViewPrivate::_q_sectionsRemoved(const QModelIndex &parent,
if (logicalFirst == logicalLast) { // Remove just one index.
int l = logicalFirst;
int visual = visualIndices.at(l);
+ Q_ASSERT(sectionCount == logicalIndices.count());
for (int v = 0; v < sectionCount; ++v) {
- if (v >= logicalIndices.count())
- continue; // the section doesn't exist
if (v > visual) {
int logical = logicalIndices.at(v);
--(visualIndices[logical]);
@@ -2434,20 +2433,15 @@ bool QHeaderView::viewportEvent(QEvent *e)
}
return true; }
#endif // QT_NO_STATUSTIP
- case QEvent::Hide: {
- d->invalidateCachedSizeHint();
+ case QEvent::Hide:
+ case QEvent::Show:
+ case QEvent::FontChange:
+ case QEvent::StyleChange:{
QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget());
if (parent && parent->isVisible()) // Only resize if we have a visible parent
resizeSections();
emit geometriesChanged();
break;}
- case QEvent::Show:
- case QEvent::FontChange:
- case QEvent::StyleChange:
- d->invalidateCachedSizeHint();
- resizeSections();
- emit geometriesChanged();
- break;
case QEvent::ContextMenu: {
d->state = QHeaderViewPrivate::NoState;
d->pressed = d->section = d->target = -1;
@@ -3391,11 +3385,11 @@ int QHeaderViewPrivate::viewSectionSizeHint(int logical) const
int QHeaderViewPrivate::adjustedVisualIndex(int visualIndex) const
{
- if (hiddenSectionSize.count() > 0) {
+ if (!sectionHidden.isEmpty()) {
int adjustedVisualIndex = visualIndex;
int currentVisualIndex = 0;
for (int i = 0; i < sectionSpans.count(); ++i) {
- if (sectionSpans.at(i).size == 0)
+ if (sectionHidden.testBit(i))
++adjustedVisualIndex;
else
++currentVisualIndex;
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 97fbea6c3d..bb39546ec8 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -75,6 +75,7 @@ QListModel::~QListModel()
void QListModel::clear()
{
+ beginResetModel();
for (int i = 0; i < items.count(); ++i) {
if (items.at(i)) {
items.at(i)->d->theid = -1;
@@ -83,7 +84,7 @@ void QListModel::clear()
}
}
items.clear();
- reset();
+ endResetModel();
}
QListWidgetItem *QListModel::at(int row) const
diff --git a/src/widgets/itemviews/qstandarditemmodel.cpp b/src/widgets/itemviews/qstandarditemmodel.cpp
index 112b533f4f..5616d76c4a 100644
--- a/src/widgets/itemviews/qstandarditemmodel.cpp
+++ b/src/widgets/itemviews/qstandarditemmodel.cpp
@@ -2097,13 +2097,14 @@ void QStandardItemModel::setItemRoleNames(const QHash<int,QByteArray> &roleNames
void QStandardItemModel::clear()
{
Q_D(QStandardItemModel);
+ beginResetModel();
d->root.reset(new QStandardItem);
d->root->d_func()->setModel(this);
qDeleteAll(d->columnHeaderItems);
d->columnHeaderItems.clear();
qDeleteAll(d->rowHeaderItems);
d->rowHeaderItems.clear();
- reset();
+ endResetModel();
}
/*!
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 82055ad11e..5932f20327 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -755,6 +755,7 @@ void QTableModel::clear()
void QTableModel::clearContents()
{
+ beginResetModel();
for (int i = 0; i < tableItems.count(); ++i) {
if (tableItems.at(i)) {
tableItems.at(i)->view = 0;
@@ -762,7 +763,7 @@ void QTableModel::clearContents()
tableItems[i] = 0;
}
}
- reset();
+ endResetModel();
}
void QTableModel::itemChanged(QTableWidgetItem *item)
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index ca8b9c4e09..cec709a816 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -160,6 +160,7 @@ QTreeModel::~QTreeModel()
void QTreeModel::clear()
{
SkipSorting skipSorting(this);
+ beginResetModel();
for (int i = 0; i < rootItem->childCount(); ++i) {
QTreeWidgetItem *item = rootItem->children.at(i);
item->par = 0;
@@ -168,7 +169,7 @@ void QTreeModel::clear()
}
rootItem->children.clear();
sortPendingTimer.stop();
- reset();
+ endResetModel();
}
/*!
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index d3d63a8c7b..f450d13a39 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -1119,7 +1119,7 @@ QAction::event(QEvent *e)
"QAction::event",
"Received shortcut event from incorrect shortcut");
if (se->isAmbiguous())
- qWarning("QAction::eventFilter: Ambiguous shortcut overload: %s", QString(se->key()).toLatin1().constData());
+ qWarning("QAction::eventFilter: Ambiguous shortcut overload: %s", se->key().toString(QKeySequence::NativeText).toLatin1().constData());
else
activate(Trigger);
return true;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index f7153a0f32..c350223278 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -76,10 +76,6 @@
#include "private/qkeymapper_p.h"
-#ifdef Q_WS_X11
-#include <private/qt_x11_p.h>
-#endif
-
#include <qthread.h>
#include <private/qthread_p.h>
@@ -87,10 +83,6 @@
#include <stdlib.h>
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
-#include <link.h>
-#endif
-
#include "qapplication_p.h"
#include "private/qevent_p.h"
#include "qwidget_p.h"
@@ -114,10 +106,6 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
#include "qdatetime.h"
-#ifdef Q_WS_MAC
-#include <private/qt_cocoa_helpers_mac_p.h>
-#endif
-
//#define ALIEN_DEBUG
static void initResources()
@@ -140,6 +128,21 @@ Q_CORE_EXPORT void qt_call_post_routines();
QApplicationPrivate *QApplicationPrivate::self = 0;
+static void initSystemPalette()
+{
+ if (!QApplicationPrivate::sys_pal)
+ if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette())
+ QApplicationPrivate::setSystemPalette(*themePalette);
+ if (!QApplicationPrivate::sys_pal && QApplicationPrivate::app_style)
+ QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette());
+}
+
+static void clearSystemPalette()
+{
+ delete QApplicationPrivate::sys_pal;
+ QApplicationPrivate::sys_pal = 0;
+}
+
#ifdef Q_OS_WINCE
int QApplicationPrivate::autoMaximizeThreshold = -1;
bool QApplicationPrivate::autoSipEnabled = false;
@@ -156,24 +159,11 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
is_session_restored = false;
#endif
-#if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
- directPainters = 0;
-#endif
-
#ifndef QT_NO_GESTURES
gestureManager = 0;
gestureWidget = 0;
#endif // QT_NO_GESTURES
-#if defined(Q_WS_X11) || defined(Q_WS_WIN)
- move_cursor = 0;
- copy_cursor = 0;
- link_cursor = 0;
-#endif
-#if defined(Q_WS_WIN)
- ignore_cursor = 0;
-#endif
-
if (!self)
self = this;
}
@@ -191,16 +181,14 @@ QApplicationPrivate::~QApplicationPrivate()
\inmodule QtWidgets
- QApplication 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, finalization, and provides session
- management. In addition, QApplication handles most of the system-wide and
- application-wide settings.
+ QApplication specializes QGuiApplication with some functionality needed
+ for QWidget-based applications. It handles widget specific initialization,
+ finalization, and provides session management.
For any GUI application using Qt, there is precisely \bold one QApplication
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.
+ any given time. For non-QWidget based Qt applications, use QGuiApplication instead,
+ as it does not depend on the \l QtWidgets library.
The QApplication object is accessible through the instance() function that
returns a pointer equivalent to the global qApp pointer.
@@ -241,9 +229,6 @@ QApplicationPrivate::~QApplicationPrivate()
\o It manages the application's mouse cursor handling, see
setOverrideCursor()
- \o On the X window system, it provides functions to flush and sync
- the communication stream, see flushX() and syncX().
-
\o It provides support for sophisticated \l{Session Management}
{session management}. This makes it possible for applications
to terminate gracefully when the user logs out, to cancel a
@@ -291,12 +276,7 @@ QApplicationPrivate::~QApplicationPrivate()
sendPostedEvents(),
removePostedEvents(),
hasPendingEvents(),
- notify(),
- macEventFilter(),
- qwsEventFilter(),
- x11EventFilter(),
- x11ProcessEvent(),
- winEventFilter().
+ notify().
\row
\o GUI Styles
@@ -306,8 +286,7 @@ QApplicationPrivate::~QApplicationPrivate()
\row
\o Color usage
\o colorSpec(),
- setColorSpec(),
- qwsSetCustomColors().
+ setColorSpec().
\row
\o Text handling
@@ -334,11 +313,6 @@ QApplicationPrivate::~QApplicationPrivate()
restoreOverrideCursor().
\row
- \o X Window System synchronization
- \o flushX(),
- syncX().
-
- \row
\o Session management
\o isSessionRestored(),
sessionId(),
@@ -391,9 +365,6 @@ QApplicationPrivate::~QApplicationPrivate()
*/
void qt_init(QApplicationPrivate *priv, int type
-#ifdef Q_WS_X11
- , Display *display = 0, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0
-#endif
);
void qt_cleanup();
@@ -409,6 +380,7 @@ QString QApplicationPrivate::styleSheet; // default application styles
QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
int QApplicationPrivate::app_cspec = QApplication::NormalColor;
+
QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
@@ -560,19 +532,6 @@ void QApplicationPrivate::process_cmdline()
\note \a argc and \a argv might be changed as Qt removes command line
arguments that it recognizes.
- Qt debugging options (not available if Qt was compiled without the QT_DEBUG
- flag defined):
- \list
- \o -nograb, tells Qt that it must never grab the mouse or the
- keyboard.
- \o -dograb (only under X11), running under a debugger can cause an
- implicit -nograb, use -dograb to override.
- \o -sync (only under X11), switches to synchronous mode for
- debugging.
- \endlist
-
- See \l{Debugging Techniques} for a more detailed explanation.
-
All Qt programs automatically support the following command line options:
\list
\o -style= \e style, sets the application GUI style. Possible values
@@ -598,45 +557,6 @@ void QApplicationPrivate::process_cmdline()
and will make the application wait until a debugger connects to it.
\endlist
- The X11 version of Qt supports some traditional X11 command line options:
- \list
- \o -display \e display, sets the X display (default is $DISPLAY).
- \o -geometry \e geometry, sets the client geometry of the first window
- that is shown.
- \o -fn or \c -font \e font, defines the application font. The font
- should be specified using an X logical font description. Note that
- this option is ignored when Qt is built with fontconfig support enabled.
- \o -bg or \c -background \e color, sets the default background color
- and an application palette (light and dark shades are calculated).
- \o -fg or \c -foreground \e color, sets the default foreground color.
- \o -btn or \c -button \e color, sets the default button color.
- \o -name \e name, sets the application name.
- \o -title \e title, sets the application title.
- \o -visual \c TrueColor, forces the application to use a TrueColor
- visual on an 8-bit display.
- \o -ncols \e count, limits the number of colors allocated in the color
- cube on an 8-bit display, if the application is using the
- QApplication::ManyColor color specification. If \e count is 216
- then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green,
- and 6 of blue); for other values, a cube approximately proportional
- to a 2x3x1 cube is used.
- \o -cmap, causes the application to install a private color map on an
- 8-bit display.
- \o -im, sets the input method server (equivalent to setting the
- XMODIFIERS environment variable)
- \o -inputstyle, defines how the input is inserted into the given
- widget, e.g., \c onTheSpot makes the input appear directly in the
- widget, while \c overTheSpot makes the input appear in a box
- floating over the widget and is not inserted until the editing is
- done.
- \endlist
-
- \section1 X11 Notes
-
- If QApplication fails to open the X11 display, it will terminate
- the process. This behavior is consistent with most X11
- applications.
-
\sa arguments()
*/
@@ -651,26 +571,18 @@ QApplication::QApplication(int &argc, char **argv, int _internal)
/*!
Constructs an application object with \a argc command line arguments in
- \a argv. If \a GUIenabled is true, a GUI application is constructed,
- otherwise a non-GUI (console) application is created.
+ \a argv.
\warning The data referred to by \a argc and \a argv must stay valid for
the entire lifetime of the QApplication object. In addition, \a argc must
be greater than zero and \a argv must contain at least one valid character
string.
- Set \a GUIenabled to false for programs without a graphical user interface
- that should be able to run without a window system.
-
- On X11, the window system is initialized if \a GUIenabled is true. If
- \a GUIenabled is false, the application does not connect to the X server.
- On Windows and Mac OS, currently the window system is always initialized,
- regardless of the value of GUIenabled. This may change in future versions
- of Qt.
-
The following example shows how to create an application that uses a
graphical interface when available.
+ \obsolete
+
\snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 0
*/
@@ -692,10 +604,6 @@ QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _intern
the entire lifetime of the QApplication object. In addition, \a argc must
be greater than zero and \a argv must contain at least one valid character
string.
-
- With Qt for Embedded Linux, passing QApplication::GuiServer for \a type
- makes this application the server (equivalent to running with the
- \c -qws option).
*/
QApplication::QApplication(int &argc, char **argv, Type type)
: QGuiApplication(*new QApplicationPrivate(argc, argv, type, 0x040000))
@@ -705,22 +613,10 @@ QApplication::QApplication(int &argc, char **argv, Type type , int _internal)
: QGuiApplication(*new QApplicationPrivate(argc, argv, type, _internal))
{ Q_D(QApplication); d->construct(); }
-#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
-static int qt_matchLibraryName(dl_phdr_info *info, size_t, void *data)
-{
- const char *name = static_cast<const char *>(data);
- return strstr(info->dlpi_name, name) != 0;
-}
-#endif
-
/*!
\internal
*/
-void QApplicationPrivate::construct(
-#ifdef Q_WS_X11
- Display *dpy, Qt::HANDLE visual, Qt::HANDLE cmap
-#endif
- )
+void QApplicationPrivate::construct()
{
initResources();
@@ -728,11 +624,7 @@ void QApplicationPrivate::construct(
process_cmdline();
// Must be called before initialize()
- qt_init(this, application_type
-#ifdef Q_WS_X11
- , dpy, visual, cmap
-#endif
- );
+ qt_init(this, application_type);
initialize();
eventDispatcher->startingUp();
@@ -759,82 +651,6 @@ void QApplicationPrivate::construct(
#endif
}
-#if defined(Q_WS_X11)
-// ### a string literal is a cont char*
-// ### using it as a char* is wrong and could lead to segfaults
-// ### if aargv is modified someday
-// ########## make it work with argc == argv == 0
-static int aargc = 1;
-static char *aargv[] = { (char*)"unknown", 0 };
-
-/*!
- \fn QApplication::QApplication(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap)
-
- Creates an application, given an already open display \a display. If
- \a visual and \a colormap are non-zero, the application will use those
- values as the default Visual and Colormap contexts.
-
- \warning Qt only supports TrueColor visuals at depths higher than 8
- bits-per-pixel.
-
- This function is only available on X11.
-*/
-QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap)
- : QGuiApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, 0x040000))
-{
- if (! dpy)
- qWarning("QApplication: Invalid Display* argument");
- Q_D(QApplication);
- d->construct(dpy, visual, colormap);
-}
-
-QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, int _internal)
- : QGuiApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, _internal))
-{
- if (! dpy)
- qWarning("QApplication: Invalid Display* argument");
- Q_D(QApplication);
- d->construct(dpy, visual, colormap);
- QApplicationPrivate::app_compile_version = _internal;
-}
-
-/*!
- \fn QApplication::QApplication(Display *display, int &argc, char **argv,
- Qt::HANDLE visual, Qt::HANDLE colormap)
-
- Creates an application, given an already open \a display and using \a argc
- command line arguments in \a argv. If \a visual and \a colormap are
- non-zero, the application will use those values as the default Visual
- and Colormap contexts.
-
- \warning Qt only supports TrueColor visuals at depths higher than 8
- bits-per-pixel.
-
- This function is only available on X11.
-*/
-QApplication::QApplication(Display *dpy, int &argc, char **argv,
- Qt::HANDLE visual, Qt::HANDLE colormap)
- : QGuiApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000))
-{
- if (! dpy)
- qWarning("QApplication: Invalid Display* argument");
- Q_D(QApplication);
- d->construct(dpy, visual, colormap);
-}
-
-QApplication::QApplication(Display *dpy, int &argc, char **argv,
- Qt::HANDLE visual, Qt::HANDLE colormap, int _internal)
- : QGuiApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal))
-{
- if (! dpy)
- qWarning("QApplication: Invalid Display* argument");
- Q_D(QApplication);
- d->construct(dpy, visual, colormap);
- QApplicationPrivate::app_compile_version = _internal;
-}
-
-#endif // Q_WS_X11
-
#ifndef QT_NO_STATEMACHINE
void qRegisterGuiStateMachine();
void qUnregisterGuiStateMachine();
@@ -981,19 +797,9 @@ QApplication::~QApplication()
delete qt_desktopWidget;
qt_desktopWidget = 0;
-#if defined(Q_WS_X11) || defined(Q_WS_WIN)
- delete d->move_cursor; d->move_cursor = 0;
- delete d->copy_cursor; d->copy_cursor = 0;
- delete d->link_cursor; d->link_cursor = 0;
-#endif
-#if defined(Q_WS_WIN)
- delete d->ignore_cursor; d->ignore_cursor = 0;
-#endif
-
delete QApplicationPrivate::app_pal;
QApplicationPrivate::app_pal = 0;
- delete QApplicationPrivate::sys_pal;
- QApplicationPrivate::sys_pal = 0;
+ clearSystemPalette();
delete QApplicationPrivate::set_pal;
QApplicationPrivate::set_pal = 0;
app_palettes()->clear();
@@ -1293,11 +1099,8 @@ QStyle *QApplication::style()
// take ownership of the style
QApplicationPrivate::app_style->setParent(qApp);
- if (!QApplicationPrivate::sys_pal)
- if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette())
- QApplicationPrivate::setSystemPalette(*themePalette);
- if (!QApplicationPrivate::sys_pal)
- QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette());
+ initSystemPalette();
+
if (QApplicationPrivate::set_pal) // repolish set palette with the new style
QApplication::setPalette(*QApplicationPrivate::set_pal);
@@ -1731,14 +1534,6 @@ QFont QApplication::font(const QWidget *widget)
{
FontHash *hash = app_fonts();
-#ifdef Q_WS_MAC
- // short circuit for small and mini controls
- if (widget->testAttribute(Qt::WA_MacSmallSize)) {
- return hash->value("QSmallFont");
- } else if (widget->testAttribute(Qt::WA_MacMiniSize)) {
- return hash->value("QMiniFont");
- }
-#endif
if (widget && hash && hash->size()) {
QHash<QByteArray, QFont>::ConstIterator it =
hash->constFind(widget->metaObject()->className());
@@ -1877,11 +1672,6 @@ void QApplication::setWindowIcon(const QIcon &icon)
QApplicationPrivate::app_icon = new QIcon();
*QApplicationPrivate::app_icon = icon;
if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
-#ifdef Q_WS_MAC
- void qt_mac_set_app_icon(const QPixmap &); //qapplication_mac.cpp
- QSize size = QApplicationPrivate::app_icon->actualSize(QSize(128, 128));
- qt_mac_set_app_icon(QApplicationPrivate::app_icon->pixmap(size));
-#endif
QEvent e(QEvent::ApplicationWindowIconChange);
QWidgetList all = QApplication::allWidgets();
for (QWidgetList::ConstIterator it = all.constBegin(); it != all.constEnd(); ++it) {
@@ -2094,13 +1884,7 @@ void QApplication::closeAllWindows()
void QApplication::aboutQt()
{
#ifndef QT_NO_MESSAGEBOX
- QMessageBox::aboutQt(
-#ifdef Q_WS_MAC
- 0
-#else
- activeWindow()
-#endif // Q_WS_MAC
- );
+ QMessageBox::aboutQt(activeWindow());
#endif // QT_NO_MESSAGEBOX
}
@@ -2184,9 +1968,6 @@ bool QApplication::event(QEvent *e)
}
if(e->type() == QEvent::LanguageChange) {
-#ifdef Q_WS_MAC
- qt_mac_post_retranslateAppMenu();
-#endif
QWidgetList list = topLevelWidgets();
for (int i = 0; i < list.size(); ++i) {
QWidget *w = list.at(i);
@@ -2198,13 +1979,14 @@ bool QApplication::event(QEvent *e)
return QGuiApplication::event(e);
}
-#if !defined(Q_WS_X11)
-
-// The doc and X implementation of this function is in qapplication_x11.cpp
-
-void QApplication::syncX() {} // do nothing
-
-#endif
+/*!
+ Was used to synchronize with the X server in 4.x, here for source compatibility.
+ \internal
+ \obsolete
+*/
+void QApplication::syncX()
+{
+}
void QApplicationPrivate::notifyLayoutDirectionChange()
{
@@ -2298,13 +2080,6 @@ void QApplication::setActiveWindow(QWidget* act)
sendSpontaneousEvent(w, &activationChange);
}
-#ifdef Q_WS_MAC
- // In case the user clicked on a child window, we need to
- // reestablish the stacking order of the window so
- // it pops in front of other child windows in cocoa:
- qt_cocoaStackChildWindowOnTopOfOtherChildren(window);
-#endif
-
for(int i = 0; i < toBeDeactivated.size(); ++i) {
QWidget *w = toBeDeactivated.at(i);
sendSpontaneousEvent(w, &windowDeactivate);
@@ -2455,10 +2230,6 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
for (int i = 0; i < leaveList.size(); ++i) {
w = leaveList.at(i);
if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
-#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC)
- if (leaveAfterRelease == w)
- leaveAfterRelease = 0;
-#endif
QApplication::sendEvent(w, &leaveEvent);
if (w->testAttribute(Qt::WA_Hover) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == w->window())) {
@@ -2511,9 +2282,6 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
if (!parentOfLeavingCursor->window()->graphicsProxyWidget())
#endif
{
-#if defined(Q_WS_X11)
- qt_x11_enforce_cursor(parentOfLeavingCursor,true);
-#endif
if (enter == QApplication::desktop()) {
qt_qpa_set_cursor(enter, true);
} else {
@@ -2535,13 +2303,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
} else
#endif
{
-#if defined(Q_WS_WIN)
- qt_win_set_cursor(cursorWidget, true);
-#elif defined(Q_WS_X11)
- qt_x11_enforce_cursor(cursorWidget, true);
-#else
qt_qpa_set_cursor(cursorWidget, true);
-#endif
}
}
#endif
@@ -2575,12 +2337,6 @@ bool QApplicationPrivate::isBlockedByModal(QWidget *widget)
return false;
w = w->parentWidget();
}
-#ifdef Q_WS_WIN
- if ((widget->testAttribute(Qt::WA_WState_Created) || widget->data->winid)
- && (modalWidget->testAttribute(Qt::WA_WState_Created) || modalWidget->data->winid)
- && IsChild(modalWidget->data->winid, widget->data->winid))
- return false;
-#endif
}
Qt::WindowModality windowModality = modalWidget->windowModality();
@@ -2708,12 +2464,6 @@ bool QApplicationPrivate::tryModalHelper(QWidget *widget, QWidget **rettop)
if (QApplication::activePopupWidget())
return true;
-#if defined(Q_WS_MAC)
- top = QApplicationPrivate::tryModalHelper_sys(top);
- if (rettop)
- *rettop = top;
-#endif
-
return !isBlockedByModal(widget->window());
}
@@ -3607,8 +3357,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
while (w) {
- QWheelEvent we(relpos, wheel->globalPos(), wheel->delta(), wheel->buttons(),
- wheel->modifiers(), wheel->orientation());
+ QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
+ wheel->modifiers());
we.spont = wheel->spontaneous();
res = d->notify_helper(w, w == receiver ? wheel : &we);
eventAccepted = ((w == receiver) ? wheel : &we)->isAccepted();
@@ -3726,16 +3476,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::DragEnter: {
QWidget* w = static_cast<QWidget *>(receiver);
QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e);
-#ifdef Q_WS_MAC
- // HIView has a slight difference in how it delivers events to children and parents
- // It will not give a leave to a child's parent when it enters a child.
- QWidget *currentTarget = QDragManager::self()->currentTarget();
- if (currentTarget) {
- // Assume currentTarget did not get a leave
- QDragLeaveEvent event;
- QApplication::sendEvent(currentTarget, &event);
- }
-#endif
#ifndef QT_NO_GRAPHICSVIEW
// QGraphicsProxyWidget handles its own propagation,
// and we must not change QDragManagers currentTarget.
@@ -3774,20 +3514,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
w = qobject_cast<QWidget *>(QDragManager::self()->currentTarget());
if (!w) {
-#ifdef Q_WS_MAC
- // HIView has a slight difference in how it delivers events to children and parents
- // It will not give an enter to a child's parent when it leaves the child.
- if (e->type() == QEvent::DragLeave)
- break;
- // Assume that w did not get an enter.
- QDropEvent *dropEvent = static_cast<QDropEvent *>(e);
- QDragEnterEvent dragEnterEvent(dropEvent->pos(), dropEvent->possibleActions(),
- dropEvent->mimeData(), dropEvent->mouseButtons(),
- dropEvent->keyboardModifiers());
- QApplication::sendEvent(receiver, &dragEnterEvent);
- w = QDragManager::self()->currentTarget();
- if (!w)
-#endif
break;
}
if (e->type() == QEvent::DragMove || e->type() == QEvent::Drop) {
@@ -3951,24 +3677,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break;
}
#endif // QT_NO_GESTURES
-#ifdef Q_WS_MAC
- case QEvent::Enter:
- if (receiver->isWidgetType()) {
- QWidget *w = static_cast<QWidget *>(receiver);
- if (w->testAttribute(Qt::WA_AcceptTouchEvents))
- qt_widget_private(w)->registerTouchWindow(true);
- }
- res = d->notify_helper(receiver, e);
- break;
- case QEvent::Leave:
- if (receiver->isWidgetType()) {
- QWidget *w = static_cast<QWidget *>(receiver);
- if (w->testAttribute(Qt::WA_AcceptTouchEvents))
- qt_widget_private(w)->registerTouchWindow(false);
- }
- res = d->notify_helper(receiver, e);
- break;
-#endif
default:
res = d->notify_helper(receiver, e);
break;
@@ -4304,168 +4012,6 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
\sa isPhase2()
*/
-/*****************************************************************************
- Stubbed session management support
- *****************************************************************************/
-#ifndef QT_NO_SESSIONMANAGER
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
-
-#if defined(Q_OS_WINCE)
-HRESULT qt_CoCreateGuid(GUID* guid)
-{
- // We will use the following information to create the GUID
- // 1. absolute path to application
- wchar_t tempFilename[MAX_PATH];
- if (!GetModuleFileName(0, tempFilename, MAX_PATH))
- return S_FALSE;
- unsigned int hash = qHash(QString::fromWCharArray(tempFilename));
- guid->Data1 = hash;
- // 2. creation time of file
- QFileInfo info(QString::fromWCharArray(tempFilename));
- guid->Data2 = qHash(info.created().toTime_t());
- // 3. current system time
- guid->Data3 = qHash(QDateTime::currentDateTime().toTime_t());
- return S_OK;
-}
-#if !defined(OLE32_MCOMGUID) || defined(QT_WINCE_FORCE_CREATE_GUID)
-#define CoCreateGuid qt_CoCreateGuid
-#endif
-
-#endif
-
-class QSessionManagerPrivate : public QObjectPrivate
-{
-public:
- QStringList restartCommand;
- QStringList discardCommand;
- QString sessionId;
- QString sessionKey;
- QSessionManager::RestartHint restartHint;
-};
-
-QSessionManager* qt_session_manager_self = 0;
-QSessionManager::QSessionManager(QApplication * app, QString &id, QString &key)
- : QObject(*new QSessionManagerPrivate, app)
-{
- Q_D(QSessionManager);
- setObjectName(QLatin1String("qt_sessionmanager"));
- qt_session_manager_self = this;
-#if defined(Q_WS_WIN)
- wchar_t guidstr[40];
- GUID guid;
- CoCreateGuid(&guid);
- StringFromGUID2(guid, guidstr, 40);
- id = QString::fromWCharArray(guidstr);
- CoCreateGuid(&guid);
- StringFromGUID2(guid, guidstr, 40);
- key = QString::fromWCharArray(guidstr);
-#endif
- d->sessionId = id;
- d->sessionKey = key;
- d->restartHint = RestartIfRunning;
-}
-
-QSessionManager::~QSessionManager()
-{
- qt_session_manager_self = 0;
-}
-
-QString QSessionManager::sessionId() const
-{
- Q_D(const QSessionManager);
- return d->sessionId;
-}
-
-QString QSessionManager::sessionKey() const
-{
- Q_D(const QSessionManager);
- return d->sessionKey;
-}
-
-
-#if defined(Q_WS_X11) || defined(Q_WS_MAC)
-void* QSessionManager::handle() const
-{
- return 0;
-}
-#endif
-
-#if !defined(Q_WS_WIN)
-bool QSessionManager::allowsInteraction()
-{
- return true;
-}
-
-bool QSessionManager::allowsErrorInteraction()
-{
- return true;
-}
-void QSessionManager::release()
-{
-}
-
-void QSessionManager::cancel()
-{
-}
-#endif
-
-
-void QSessionManager::setRestartHint(QSessionManager::RestartHint hint)
-{
- Q_D(QSessionManager);
- d->restartHint = hint;
-}
-
-QSessionManager::RestartHint QSessionManager::restartHint() const
-{
- Q_D(const QSessionManager);
- return d->restartHint;
-}
-
-void QSessionManager::setRestartCommand(const QStringList& command)
-{
- Q_D(QSessionManager);
- d->restartCommand = command;
-}
-
-QStringList QSessionManager::restartCommand() const
-{
- Q_D(const QSessionManager);
- return d->restartCommand;
-}
-
-void QSessionManager::setDiscardCommand(const QStringList& command)
-{
- Q_D(QSessionManager);
- d->discardCommand = command;
-}
-
-QStringList QSessionManager::discardCommand() const
-{
- Q_D(const QSessionManager);
- return d->discardCommand;
-}
-
-void QSessionManager::setManagerProperty(const QString&, const QString&)
-{
-}
-
-void QSessionManager::setManagerProperty(const QString&, const QStringList&)
-{
-}
-
-bool QSessionManager::isPhase2() const
-{
- return false;
-}
-
-void QSessionManager::requestPhase2()
-{
-}
-
-#endif
-#endif // QT_NO_SESSIONMANAGER
-
/*!
\typedef QApplication::ColorMode
\compat
@@ -4895,120 +4441,6 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy)
return true;
}
-/*! \fn QDecoration &QApplication::qwsDecoration()
- Return the QWSDecoration used for decorating windows.
-
- \warning This method is non-portable. It is only available in
- Qt for Embedded Linux.
-
- \sa QDecoration
-*/
-
-/*!
- \fn void QApplication::qwsSetDecoration(QDecoration *decoration)
-
- Sets the QDecoration derived class to use for decorating the
- windows used by Qt for Embedded Linux to the \a decoration
- specified.
-
- This method is non-portable. It is only available in Qt for Embedded Linux.
-
- \sa QDecoration
-*/
-
-/*! \fn QDecoration* QApplication::qwsSetDecoration(const QString &decoration)
- \overload
-
- Requests a QDecoration object for \a decoration from the
- QDecorationFactory.
-
- The string must be one of the QDecorationFactory::keys(). Keys are case
- insensitive.
-
- A later call to the QApplication constructor will override the requested
- style when a "-style" option is passed in as a commandline parameter.
-
- Returns 0 if an unknown \a decoration is passed, otherwise the QStyle object
- returned is set as the application's GUI style.
-*/
-
-/*!
- \fn bool QApplication::qwsEventFilter(QWSEvent *event)
-
- This virtual function is only implemented under Qt for Embedded Linux.
-
- If you create an application that inherits QApplication and
- reimplement this function, you get direct access to all QWS (Q
- Window System) events that the are received from the QWS master
- process. The events are passed in the \a event parameter.
-
- Return true if you want to stop the event from being processed.
- Return false for normal event dispatching. The default
- implementation returns false.
-*/
-
-/*! \fn void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors)
- Set Qt for Embedded Linux custom color table.
-
- Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube.
- The remaining 40 colors may be used by setting a custom color
- table in the QWS master process before any clients connect.
-
- \a colorTable is an array of up to 40 custom colors. \a start is
- the starting index (0-39) and \a numColors is the number of colors
- to be set (1-40).
-
- This method is non-portable. It is available \e only in
- Qt for Embedded Linux.
-
- \note The custom colors will not be used by the default screen
- driver. To make use of the new colors, implement a custom screen
- driver, or use QDirectPainter.
-*/
-
-/*! \fn int QApplication::qwsProcessEvent(QWSEvent* event)
- \internal
-*/
-
-/*! \fn int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only)
- \internal
-*/
-
-/*! \fn int QApplication::x11ProcessEvent(XEvent* event)
- This function does the core processing of individual X
- \a{event}s, normally by dispatching Qt events to the right
- destination.
-
- It returns 1 if the event was consumed by special handling, 0 if
- the \a event was consumed by normal handling, and -1 if the \a
- event was for an unrecognized widget.
-
- \sa x11EventFilter()
-*/
-
-/*!
- \fn bool QApplication::x11EventFilter(XEvent *event)
-
- \warning This virtual function is only implemented under X11.
-
- If you create an application that inherits QApplication and
- reimplement this function, you get direct access to all X events
- that the are received from the X server. The events are passed in
- the \a event parameter.
-
- Return true if you want to stop the event from being processed.
- Return false for normal event dispatching. The default
- implementation returns false.
-
- It is only the directly addressed messages that are filtered.
- You must install an event filter directly on the event
- dispatcher, which is returned by
- QAbstractEventDispatcher::instance(), to handle system wide
- messages.
-
- \sa x11ProcessEvent()
-*/
-
/*! \fn void QApplication::winFocus(QWidget *widget, bool gotFocus)
\internal
\since 4.1
@@ -5021,11 +4453,6 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy)
\internal
*/
-/*! \fn void QApplication::syncX()
- Synchronizes with the X server in the X11 implementation.
- This normally takes some time. Does nothing on other platforms.
-*/
-
void QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent)
{
for (int i = 0; i < touchEvent->touchPoints().count(); ++i) {
@@ -5216,6 +4643,13 @@ void QApplicationPrivate::translateTouchCancel(QTouchDevice *device, ulong times
}
}
+void QApplicationPrivate::notifyThemeChanged()
+{
+ QGuiApplicationPrivate::notifyThemeChanged();
+ clearSystemPalette();
+ initSystemPalette();
+}
+
#ifndef QT_NO_GESTURES
QGestureManager* QGestureManager::instance()
{
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 503b36aec6..060765969f 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -98,12 +98,8 @@ public:
#ifndef qdoc
QApplication(int &argc, char **argv, int = ApplicationFlags);
- QApplication(int &argc, char **argv, bool GUIenabled, int = ApplicationFlags);
+ QT_DEPRECATED QApplication(int &argc, char **argv, bool GUIenabled, int = ApplicationFlags);
QApplication(int &argc, char **argv, Type, int = ApplicationFlags);
-#if defined(Q_WS_X11)
- QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = ApplicationFlags);
- QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = ApplicationFlags);
-#endif
#endif
virtual ~QApplication();
@@ -150,7 +146,7 @@ public:
static QWidget *topLevelAt(const QPoint &p);
static inline QWidget *topLevelAt(int x, int y) { return topLevelAt(QPoint(x, y)); }
- static void syncX();
+ QT_DEPRECATED static void syncX();
static void beep();
static void alert(QWidget *widget, int duration = 0);
@@ -182,31 +178,8 @@ public:
static bool isEffectEnabled(Qt::UIEffect);
static void setEffectEnabled(Qt::UIEffect, bool enable = true);
-#if defined(Q_WS_MAC)
- virtual bool macEventFilter(EventHandlerCallRef, EventRef);
-#endif
-#if defined(Q_WS_X11)
- virtual bool x11EventFilter(XEvent *);
- virtual int x11ClientMessage(QWidget*, XEvent*, bool passive_only);
- int x11ProcessEvent(XEvent*);
-#endif
-#if defined(Q_WS_QWS)
- virtual bool qwsEventFilter(QWSEvent *);
- int qwsProcessEvent(QWSEvent*);
- void qwsSetCustomColors(QRgb *colortable, int start, int numColors);
-#ifndef QT_NO_QWS_MANAGER
- static QDecoration &qwsDecoration();
- static void qwsSetDecoration(QDecoration *);
- static QDecoration *qwsSetDecoration(const QString &decoration);
-#endif
-#endif
-
static QPlatformNativeInterface *platformNativeInterface();
-#if defined(Q_WS_WIN)
- void winFocus(QWidget *, bool);
- static void winMouseButtonUp();
-#endif
#ifndef QT_NO_SESSIONMANAGER
// session management
bool isSessionRestored() const;
@@ -252,21 +225,14 @@ public Q_SLOTS:
static void aboutQt();
protected:
-#if defined(Q_WS_QWS)
- void setArgs(int, char **);
-#endif
bool event(QEvent *);
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
#if defined(Q_INTERNAL_QAPP_SRC) || defined(qdoc)
QApplication(int &argc, char **argv);
- QApplication(int &argc, char **argv, bool GUIenabled);
+ QT_DEPRECATED QApplication(int &argc, char **argv, bool GUIenabled);
QApplication(int &argc, char **argv, Type);
-#if defined(Q_WS_X11)
- QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0);
- QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
-#endif
#endif
private:
@@ -291,21 +257,9 @@ private:
#endif
friend class QAction;
-#if defined(Q_WS_QWS)
- friend class QWSDirectPainterSurface;
- friend class QDirectPainter;
- friend class QDirectPainterPrivate;
-#endif
#ifndef QT_NO_GESTURES
friend class QGestureManager;
#endif
-
-#if defined(Q_WS_MAC) || defined(Q_WS_X11)
- Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut())
-#endif
-#if defined(QT_RX71_MULTITOUCH)
- Q_PRIVATE_SLOT(d_func(), void _q_readRX71MultiTouchEvents())
-#endif
};
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index e728868182..7a880986bf 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -260,7 +260,9 @@ public:
static QPalette *sys_pal;
static QPalette *set_pal;
-private:
+protected:
+ void notifyThemeChanged();
+
public:
static QFont *sys_font;
static QFont *set_font;
diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp
index c848dd74f4..97edb4fb0f 100644
--- a/src/widgets/kernel/qicon.cpp
+++ b/src/widgets/kernel/qicon.cpp
@@ -60,11 +60,6 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
-#ifdef Q_WS_X11
-#include "private/qt_x11_p.h"
-#include "private/qkde_p.h"
-#endif
-
#include "private/qhexstring_p.h"
#ifndef QT_NO_ICON
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 978e989a00..b331356e66 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -220,8 +220,6 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa
if (pe)
pe->setSystemClip(QRegion());
- QApplication::syncX();
-
#if defined(Q_OS_UNIX)
::usleep(1000 * msec);
#endif
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index 72080d9e6b..81847681e4 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -117,7 +117,7 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return false;
}
-static bool convert(const QVariant::Private *d, QVariant::Type type, void *result, bool *ok)
+static bool convert(const QVariant::Private *d, int type, void *result, bool *ok)
{
Q_UNUSED(d);
Q_UNUSED(type);
@@ -127,7 +127,7 @@ static bool convert(const QVariant::Private *d, QVariant::Type type, void *resul
return false;
}
-#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());
@@ -141,7 +141,7 @@ static void streamDebug(QDebug dbg, const QVariant &v)
dbg.nospace() << *v_cast<QSizePolicy>(d);
break;
default:
- dbg.nospace() << "QVariant::Type(" << d->type << ")";
+ dbg.nospace() << "QMetaType::Type(" << d->type << ")";
}
}
#endif
@@ -157,7 +157,7 @@ static const QVariant::Handler widgets_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/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp
index c04d8a9dc3..4d5e9d5774 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa.cpp
+++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp
@@ -364,7 +364,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event)
QPoint mapped = widget->mapFrom(m_widget, event->pos());
- QWheelEvent translated(mapped, event->globalPos(), event->delta(), event->buttons(), event->modifiers(), event->orientation());
+ QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->pixelDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers());
QGuiApplication::sendSpontaneousEvent(widget, &translated);
}
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 75476faeeb..174e94e63d 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -83,12 +83,6 @@
# include "private/qtextengine_p.h"
#endif
-#ifdef Q_WS_X11
-# include <private/qt_x11_p.h>
-#elif defined(Q_WS_MAC)
-# include <private/qt_cocoa_helpers_mac_p.h>
-#endif
-
#include <private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
@@ -4920,12 +4914,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
break;
case SH_DialogButtonLayout:
ret = QDialogButtonBox::WinLayout;
-#ifdef Q_WS_X11
- if (X11->desktopEnvironment == DE_KDE)
- ret = QDialogButtonBox::KdeLayout;
- else if (X11->desktopEnvironment == DE_GNOME)
- ret = QDialogButtonBox::GnomeLayout;
-#endif
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
break;
case SH_ComboBox_PopupFrameStyle:
ret = QFrame::StyledPanel | QFrame::Plain;
@@ -4934,10 +4924,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = Qt::LinksAccessibleByMouse;
break;
case SH_DialogButtonBox_ButtonsHaveIcons:
-#ifdef Q_WS_X11
- return true;
-#endif
ret = 0;
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ ret = theme->themeHint(QPlatformTheme::DialogButtonBoxButtonsHaveIcons).toBool() ? 1 : 0;
break;
case SH_SpellCheckUnderlineStyle:
ret = QTextCharFormat::WaveUnderline;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 30c6ed5e74..5c0ee254d4 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -860,6 +860,19 @@ static QStyle::StandardPixmap subControlIcon(int pe)
return QStyle::SP_CustomBase;
}
+static inline QIcon cssIconValueToIcon(const QCss::IconValue &iconValue)
+{
+ if (iconValue.entries.isEmpty())
+ return QIcon();
+ QIcon icon = QIcon(iconValue.entries.first().uri);
+ for (int i = 1; i < iconValue.entries.size(); ++i) {
+ const QCss::IconValue::IconEntry &entry = iconValue.entries.at(i);
+ icon.addPixmap(entry.uri, static_cast<QIcon::Mode>(entry.mode),
+ static_cast<QIcon::State>(entry.state));
+ }
+ return icon;
+}
+
QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QWidget *widget)
: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0)
{
@@ -919,11 +932,11 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QWidget
if (v.extractPalette(&fg, &sfg, &sbg, &abg))
pal = new QStyleSheetPaletteData(fg, sfg, sbg, abg);
- QIcon icon;
alignment = Qt::AlignCenter;
QSize size;
- if (v.extractImage(&icon, &alignment, &size))
- img = new QStyleSheetImageData(icon, alignment, size);
+ QCss::IconValue iconValue;
+ if (v.extractImage(&iconValue, &alignment, &size))
+ img = new QStyleSheetImageData(cssIconValueToIcon(iconValue), alignment, size);
int adj = -255;
hasFont = v.extractFont(&font, &adj);
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 503e5aa596..d416f26f51 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -421,7 +421,8 @@ void QCompletionModel::filter(const QStringList& parts)
void QCompletionModel::resetModel()
{
if (rowCount() == 0) {
- reset();
+ beginResetModel();
+ endResetModel();
return;
}
diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp
index 6a61e4dfd1..8d6ad36014 100644
--- a/src/widgets/util/qscrollerproperties.cpp
+++ b/src/widgets/util/qscrollerproperties.cpp
@@ -314,7 +314,7 @@ void QScrollerProperties::setScrollMetric(ScrollMetric metric, const QVariant &v
\value MousePressEventDelay This is the time a mouse press event is delayed when starting
a flick gesture in \c{[s]}. If the gesture is triggered within that time, no mouse press or
release is sent to the scrolled object. If it triggers after that delay the delayed
- mouse press plus a faked release event at global postion \c{QPoint(-QWIDGETSIZE_MAX,
+ mouse press plus a faked release event at global position \c{QPoint(-QWIDGETSIZE_MAX,
-QWIDGETSIZE_MAX)} is sent. If the gesture is canceled, then both the delayed mouse
press plus the real release event are delivered.
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index 4b09d5fc70..a87e9e0f05 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -142,7 +142,8 @@ void QUndoModel::stackDestroyed(QObject *obj)
void QUndoModel::stackChanged()
{
- reset();
+ beginResetModel();
+ endResetModel();
m_sel_model->setCurrentIndex(selectedIndex(), QItemSelectionModel::ClearAndSelect);
}
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index d6af8d6044..c5f5d6e6e1 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -43,6 +43,7 @@
#ifndef QT_NO_COMBOBOX
#include <qstylepainter.h>
+#include <qplatformtheme_qpa.h>
#include <qlineedit.h>
#include <qapplication.h>
#include <qdesktopwidget.h>
@@ -57,15 +58,13 @@
#include <qtreeview.h>
#include <qheaderview.h>
#include <qmath.h>
+#include <private/qguiapplication_p.h>
#include <private/qapplication_p.h>
#include <private/qcombobox_p.h>
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
#include <private/qsoftkeymanager_p.h>
#include <qdebug.h>
-#ifdef Q_WS_X11
-#include <private/qt_x11_p.h>
-#endif
#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC)
#include <private/qcore_mac_p.h>
#include <QMacStyle>
@@ -219,16 +218,12 @@ void QComboBoxPrivate::_q_modelDestroyed()
//Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't
QRect QComboBoxPrivate::popupGeometry(int screen) const
{
-#ifdef Q_WS_WIN
- return QApplication::desktop()->screenGeometry(screen);
-#elif defined Q_WS_X11
- if (X11->desktopEnvironment == DE_KDE)
- return QApplication::desktop()->screenGeometry(screen);
- else
- return QApplication::desktop()->availableGeometry(screen);
-#else
- return QApplication::desktop()->availableGeometry(screen);
-#endif
+ bool useFullScreenForPopupMenu = false;
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();
+ return useFullScreenForPopupMenu ?
+ QApplication::desktop()->screenGeometry(screen) :
+ QApplication::desktop()->availableGeometry(screen);
}
bool QComboBoxPrivate::updateHoverControl(const QPoint &pos)
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index df083ccbfe..a07ab73ad0 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -3321,7 +3321,8 @@ void QDockAreaLayout::keepSize(QDockWidget *w)
void QDockAreaLayout::styleChangedEvent()
{
sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainWindow);
- fitLayout();
+ if (isValid())
+ fitLayout();
}
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 77d6f5422a..7118881ef2 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -75,7 +75,8 @@
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include "qkeysequence.h"
-#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString())
+#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
+ QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())
#else
#define ACCEL_KEY(k) QString()
#endif
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index e619cdf4fc..7ebfdbecae 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -70,10 +70,8 @@
#include <private/qpushbutton_p.h>
#include <private/qaction_p.h>
#include <private/qsoftkeymanager_p.h>
-
-#ifdef Q_WS_X11
-# include <private/qt_x11_p.h>
-#endif
+#include <private/qguiapplication_p.h>
+#include <qplatformtheme_qpa.h>
QT_BEGIN_NAMESPACE
@@ -177,31 +175,23 @@ int QMenuPrivate::scrollerHeight() const
//Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't
QRect QMenuPrivate::popupGeometry(const QWidget *widget) const
{
-#ifdef Q_WS_WIN
- return QApplication::desktop()->screenGeometry(widget);
-#elif defined Q_WS_X11
- if (X11->desktopEnvironment == DE_KDE)
+ if (QGuiApplicationPrivate::platformTheme() &&
+ QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) {
return QApplication::desktop()->screenGeometry(widget);
- else
- return QApplication::desktop()->availableGeometry(widget);
-#else
+ } else {
return QApplication::desktop()->availableGeometry(widget);
-#endif
+ }
}
//Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't
QRect QMenuPrivate::popupGeometry(int screen) const
{
-#ifdef Q_WS_WIN
- return QApplication::desktop()->screenGeometry(screen);
-#elif defined Q_WS_X11
- if (X11->desktopEnvironment == DE_KDE)
+ if (QGuiApplicationPrivate::platformTheme() &&
+ QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) {
return QApplication::desktop()->screenGeometry(screen);
- else
- return QApplication::desktop()->availableGeometry(screen);
-#else
+ } else {
return QApplication::desktop()->availableGeometry(screen);
-#endif
+ }
}
QList<QPointer<QWidget> > QMenuPrivate::calcCausedStack() const
@@ -305,7 +295,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
} else {
QKeySequence seq = action->shortcut();
if (!seq.isEmpty())
- tabWidth = qMax(int(tabWidth), qfm.width(seq));
+ tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText)));
#endif
}
sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());
@@ -1197,7 +1187,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
if (textAndAccel.indexOf(QLatin1Char('\t')) == -1) {
QKeySequence seq = action->shortcut();
if (!seq.isEmpty())
- textAndAccel += QLatin1Char('\t') + QString(seq);
+ textAndAccel += QLatin1Char('\t') + seq.toString(QKeySequence::NativeText);
}
#endif
option->text = textAndAccel;
@@ -1908,13 +1898,21 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
if ((pos.x() + menuSize.width() > parentActionRect.left() - subMenuOffset)
&& (pos.x() < parentActionRect.right()))
{
+ pos.rx() = parentActionRect.left() - menuSize.width();
+ if (pos.x() < screen.x())
pos.rx() = parentActionRect.right();
+ if (pos.x() + menuSize.width() > screen.x() + screen.width())
+ pos.rx() = screen.x();
}
} else {
if ((pos.x() < parentActionRect.right() + subMenuOffset)
&& (pos.x() + menuSize.width() > parentActionRect.left()))
{
+ pos.rx() = parentActionRect.right();
+ if (pos.x() + menuSize.width() > screen.x() + screen.width())
pos.rx() = parentActionRect.left() - menuSize.width();
+ if (pos.x() < screen.x())
+ pos.rx() = screen.x() + screen.width() - menuSize.width();
}
}
}
@@ -2261,7 +2259,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e)
if (action && action == d->currentAction) {
if (!action->menu()){
-#if defined(Q_WS_WIN)
+#if defined(Q_OS_WIN)
//On Windows only context menus can be activated with the right button
if (e->button() == Qt::LeftButton || d->topCausedWidget() == 0)
#endif
@@ -3000,7 +2998,7 @@ void QMenu::internalDelayedPopup()
*/
void QMenu::setNoReplayFor(QWidget *noReplayFor)
{
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
d_func()->noReplayFor = noReplayFor;
#else
Q_UNUSED(noReplayFor);
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index d797a4e315..16e486e77f 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1075,7 +1075,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e)
d->activeMenu = 0;
menu->hide();
}
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
if((d->closePopupMode = style()->styleHint(QStyle::SH_MenuBar_DismissOnSecondClick)))
update(d->actionRect(action));
#endif
@@ -1845,15 +1845,12 @@ void QMenuBar::setDefaultAction(QAction *act)
Q_D(QMenuBar);
if (d->defaultAction == act)
return;
-#ifdef Q_OS_WINCE
if (qt_wince_is_mobile())
if (d->defaultAction) {
disconnect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction()));
disconnect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction()));
}
-#endif
d->defaultAction = act;
-#ifdef Q_OS_WINCE
if (qt_wince_is_mobile())
if (d->defaultAction) {
connect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction()));
@@ -1862,7 +1859,6 @@ void QMenuBar::setDefaultAction(QAction *act)
if (d->wce_menubar) {
d->wce_menubar->rebuild();
}
-#endif
}
/*!
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 2f5793bcba..73c3d14f9b 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -45,6 +45,8 @@
#include "qabstractitemview.h"
#include "qclipboard.h"
+#include <private/qguiapplication_p.h>
+#include <qplatformtheme_qpa.h>
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
@@ -374,6 +376,14 @@ void QWidgetLineControl::init(const QString &txt)
m_text = txt;
updateDisplayText();
m_cursor = m_text.length();
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
+ // Generalize for X11
+ if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme
+ || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
+ || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme) {
+ m_keyboardScheme = QPlatformTheme::X11KeyboardScheme;
+ }
}
/*!
@@ -1630,10 +1640,11 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
else if (event == QKeySequence::Paste) {
if (!isReadOnly()) {
QClipboard::Mode mode = QClipboard::Clipboard;
-#ifdef Q_WS_X11
- if (event->modifiers() == (Qt::CTRL | Qt::SHIFT) && event->key() == Qt::Key_Insert)
+ if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme
+ && event->modifiers() == (Qt::CTRL | Qt::SHIFT)
+ && event->key() == Qt::Key_Insert) {
mode = QClipboard::Selection;
-#endif
+ }
paste(mode);
}
}
@@ -1664,12 +1675,14 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
end(1);
}
else if (event == QKeySequence::MoveToNextChar) {
-#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER)
- if (hasSelectedText()) {
+#if defined(QT_NO_COMPLETER)
+ const bool inlineCompletion = false;
#else
- if (hasSelectedText() && m_completer
- && m_completer->completionMode() == QCompleter::InlineCompletion) {
+ const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
#endif
+ if (hasSelectedText()
+ && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
+ || inlineCompletion)) {
moveCursor(selectionEnd(), false);
} else {
cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
@@ -1679,12 +1692,14 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
}
else if (event == QKeySequence::MoveToPreviousChar) {
-#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER)
- if (hasSelectedText()) {
+#if defined(QT_NO_COMPLETER)
+ const bool inlineCompletion = false;
#else
- if (hasSelectedText() && m_completer
- && m_completer->completionMode() == QCompleter::InlineCompletion) {
+ const bool inlineCompletion = m_completer && m_completer->completionMode() == QCompleter::InlineCompletion;
#endif
+ if (hasSelectedText()
+ && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
+ || inlineCompletion)) {
moveCursor(selectionStart(), false);
} else {
cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));
@@ -1737,8 +1752,8 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
#endif // QT_NO_SHORTCUT
else {
bool handled = false;
-#ifdef Q_WS_MAC
- if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) {
+ if (m_keyboardScheme == QPlatformTheme::MacKeyboardScheme
+ && (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)) {
Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier);
if (myModifiers & Qt::ShiftModifier) {
if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier)
@@ -1756,7 +1771,6 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
}
handled = true;
}
-#endif
if (event->modifiers() & Qt::ControlModifier) {
switch (event->key()) {
case Qt::Key_Backspace:
@@ -1771,13 +1785,13 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
complete(event->key());
break;
#endif
-#if defined(Q_WS_X11)
case Qt::Key_E:
- end(0);
+ if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme)
+ end(0);
break;
case Qt::Key_U:
- if (!isReadOnly()) {
+ if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme && !isReadOnly()) {
setSelection(0, text().size());
#ifndef QT_NO_CLIPBOARD
copy();
@@ -1785,7 +1799,6 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
del();
}
break;
-#endif
default:
if (!handled)
unknown = true;
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index a0191188a7..72f25e9068 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -100,6 +100,7 @@ public:
, m_threadChecks(false)
, m_textLayoutThread(0)
#endif
+ , m_keyboardScheme(0)
{
init(txt);
}
@@ -527,6 +528,8 @@ private Q_SLOTS:
void _q_clipboardChanged();
void _q_deleteSelected();
+private:
+ int m_keyboardScheme;
};
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index aba0ca58c6..5380fb798c 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -326,8 +326,6 @@ void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e)
else
widget->setGeometry(geom);
}
-
- QApplication::syncX();
}
void QWidgetResizeHandler::setMouseCursor(MousePosition m)
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index a2c7915a5e..9eeffc1231 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -84,7 +84,9 @@
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include <qkeysequence.h>
-#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString())
+#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? \
+ QLatin1Char('\t') + QKeySequence(k).toString(QKeySequence::NativeText) : QString())
+
#else
#define ACCEL_KEY(k) QString()
#endif
diff --git a/src/widgets/widgets/qworkspace.cpp b/src/widgets/widgets/qworkspace.cpp
index be3f7836d5..5cc8e363f1 100644
--- a/src/widgets/widgets/qworkspace.cpp
+++ b/src/widgets/widgets/qworkspace.cpp
@@ -290,9 +290,6 @@ public:
QWorkspaceTitleBarPrivate()
:
lastControl(QStyle::SC_None),
-#ifndef QT_NO_TOOLTIP
- toolTip(0),
-#endif
act(0), window(0), movable(1), pressed(0), autoraise(0), moving(0)
{
}
@@ -301,9 +298,6 @@ public:
QStyle::SubControl buttonDown;
QStyle::SubControl lastControl;
QPoint moveOffset;
-#ifndef QT_NO_TOOLTIP
- QToolTip *toolTip;
-#endif
bool act :1;
QPointer<QWidget> window;
bool movable :1;
@@ -1085,7 +1079,8 @@ QWorkspacePrivate::init()
actions[QWorkspacePrivate::CloseAct] = new QAction(QIcon(q->style()->standardPixmap(QStyle::SP_TitleBarCloseButton, 0, q)),
QWorkspace::tr("&Close")
#ifndef QT_NO_SHORTCUT
- +QLatin1Char('\t')+(QString)QKeySequence(Qt::CTRL+Qt::Key_F4)
+ + QLatin1Char('\t')
+ + QKeySequence(Qt::CTRL+Qt::Key_F4).toString(QKeySequence::NativeText)
#endif
,q);
QObject::connect(actions[QWorkspacePrivate::CloseAct], SIGNAL(triggered()), q, SLOT(closeActiveWindow()));
@@ -3210,7 +3205,7 @@ QRect QWorkspacePrivate::updateWorkspace()
QWorkspaceChild *child = *it;
++it;
if (!child->isHidden())
- r = r.unite(child->geometry());
+ r = r.united(child->geometry());
}
vbar->blockSignals(true);
hbar->blockSignals(true);
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 38a44024aa..c503302fbb 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -172,14 +172,16 @@ public:
bool isDocumentType() const { return nodeType() == QDomNode::DocumentTypeNode; }
bool isElement() const { return nodeType() == QDomNode::ElementNode; }
bool isEntityReference() const { return nodeType() == QDomNode::EntityReferenceNode; }
- bool isText() const { return (nodeType() == QDomNode::TextNode)
- || (nodeType() == QDomNode::CDATASectionNode); }
+ bool isText() const { const QDomNode::NodeType nt = nodeType();
+ return (nt == QDomNode::TextNode)
+ || (nt == QDomNode::CDATASectionNode); }
bool isEntity() const { return nodeType() == QDomNode::EntityNode; }
bool isNotation() const { return nodeType() == QDomNode::NotationNode; }
bool isProcessingInstruction() const { return nodeType() == QDomNode::ProcessingInstructionNode; }
- bool isCharacterData() const { return (nodeType() == QDomNode::CharacterDataNode)
- || (nodeType() == QDomNode::TextNode)
- || (nodeType() == QDomNode::CommentNode); }
+ bool isCharacterData() const { const QDomNode::NodeType nt = nodeType();
+ return (nt == QDomNode::CharacterDataNode)
+ || (nt == QDomNode::TextNode)
+ || (nt == QDomNode::CommentNode); }
bool isComment() const { return nodeType() == QDomNode::CommentNode; }
virtual QDomNode::NodeType nodeType() const { return QDomNode::BaseNode; }
diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
index d6e2cb3171..e59746c158 100644
--- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
+++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro
@@ -1,4 +1,5 @@
CONFIG += testcase parallel_test
+TARGET = tst_qresourceengine
load(resources)
QT = core testlib
SOURCES = tst_qresourceengine.cpp
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 2ac0574ec5..f5b4f17732 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -45,6 +45,9 @@
#include "qjsonvalue.h"
#include "qjsondocument.h"
+#define INVALID_UNICODE "\357\277\277" // "\uffff"
+#define UNICODE_DJE "\320\202" // Character from the Serbian Cyrillic alphabet
+
class TestQtJson: public QObject
{
Q_OBJECT
@@ -1205,7 +1208,7 @@ void TestQtJson::fromJsonErrors()
}
{
QJsonParseError error;
- QByteArray json = "[\n \"foo\uffffbar\"]";
+ QByteArray json = "[\n \"foo" INVALID_UNICODE "bar\"]";
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::StringUTF8Scan);
@@ -1221,7 +1224,7 @@ void TestQtJson::fromJsonErrors()
}
{
QJsonParseError error;
- QByteArray json = "[\n \"cЂa\\u12\"]";
+ QByteArray json = "[\n \"c" UNICODE_DJE "a\\u12\"]";
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::StringEscapeSequence);
@@ -1229,7 +1232,7 @@ void TestQtJson::fromJsonErrors()
}
{
QJsonParseError error;
- QByteArray json = "[\n \"cЂa\uffffbar\"]";
+ QByteArray json = "[\n \"c" UNICODE_DJE "a" INVALID_UNICODE "bar\"]";
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::StringUTF8Scan);
@@ -1237,7 +1240,7 @@ void TestQtJson::fromJsonErrors()
}
{
QJsonParseError error;
- QByteArray json = "[\n \"cЂa ]";
+ QByteArray json = "[\n \"c" UNICODE_DJE "a ]";
QJsonDocument doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isEmpty());
QCOMPARE(error.error, QJsonParseError::EndOfString);
@@ -1378,7 +1381,7 @@ void TestQtJson::parseStrings()
"abc\\rabc",
"abc\\tabc",
"abc\\u0019abc",
- "abcЂabc",
+ "abc" UNICODE_DJE "abc",
};
int size = sizeof(strings)/sizeof(const char *);
@@ -1404,7 +1407,7 @@ void TestQtJson::parseStrings()
};
Pairs pairs [] = {
{ "abc\\/abc", "abc/abc" },
- { "abc\\u0402abc", "abcЂabc" },
+ { "abc\\u0402abc", "abc" UNICODE_DJE "abc" },
{ "abc\\u0065abc", "abceabc" }
};
size = sizeof(pairs)/sizeof(Pairs);
@@ -1547,7 +1550,7 @@ void TestQtJson::validation()
// only test the first 1000 bytes. Testing the full file takes too long
for (int i = 0; i < 1000; ++i) {
QByteArray corrupted = binary;
- corrupted[i] = 0xff;
+ corrupted[i] = char(0xff);
QJsonDocument doc = QJsonDocument::fromBinaryData(corrupted);
if (doc.isNull())
continue;
@@ -1567,7 +1570,7 @@ void TestQtJson::validation()
for (int i = 0; i < binary.size(); ++i) {
QByteArray corrupted = binary;
- corrupted[i] = 0xff;
+ corrupted[i] = char(0xff);
QJsonDocument doc = QJsonDocument::fromBinaryData(corrupted);
if (doc.isNull())
continue;
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 68ff8e4bb6..09fd0a7adb 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -326,6 +326,8 @@ public slots:
signals:
void sig0();
QString sig1(QString s1);
+ void sig10(QString s1, QString s2, QString s3, QString s4, QString s5, QString s6, QString s7,
+ QString s8, QString s9, QString s10);
protected:
QtTestObject(QVariant) {}
@@ -725,6 +727,7 @@ typedef QString CustomString;
class QtTestCustomObject: public QObject
{
Q_OBJECT
+ friend class tst_QMetaObject;
public:
QtTestCustomObject(): QObject(), sum(0) {}
@@ -1129,11 +1132,9 @@ void tst_QMetaObject::indexOfMethodPMF()
}
INDEXOFMETHODPMF_HELPER(tst_QMetaObject, value7Changed, (const QString&))
- INDEXOFMETHODPMF_HELPER(tst_QMetaObject, stdSet, ())
- INDEXOFMETHODPMF_HELPER(QtTestObject, sl10, (QString,QString,QString,QString,QString,QString,QString,QString,QString,QString))
INDEXOFMETHODPMF_HELPER(QtTestObject, sig0, ())
- INDEXOFMETHODPMF_HELPER(QtTestObject, testLongLong, (qint64, quint64))
- INDEXOFMETHODPMF_HELPER(QtTestObject, testReference, (QString&))
+ INDEXOFMETHODPMF_HELPER(QtTestObject, sig10, (QString,QString,QString,QString,QString,QString,QString,QString,QString,QString))
+ INDEXOFMETHODPMF_HELPER(QtTestCustomObject, sig_custom, (const CustomString &))
}
QTEST_MAIN(tst_QMetaObject)
diff --git a/tests/auto/corelib/kernel/qobject/qobject.pro b/tests/auto/corelib/kernel/qobject/qobject.pro
index 0f86408fc9..6a7cf07f51 100644
--- a/tests/auto/corelib/kernel/qobject/qobject.pro
+++ b/tests/auto/corelib/kernel/qobject/qobject.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS = signalbug
-tst_qobject.pro.depends = $$SUBDIRS
-SUBDIRS += tst_qobject.pro
+CONFIG += ordered
+
+SUBDIRS += \
+ signalbug \
+ test
diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
index 19d36a63a1..799ef34559 100644
--- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
+++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro
@@ -1,6 +1,3 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
CONFIG -= app_bundle debug_and_release
CONFIG += console
DESTDIR = ./
@@ -8,7 +5,7 @@ QT -= gui
wince*: {
LIBS += coredll.lib
}
-# Input
+
HEADERS += signalbug.h
SOURCES += signalbug.cpp
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.pro b/tests/auto/corelib/kernel/qobject/test/test.pro
index 30fd810a2e..9443b2e2c7 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.pro
+++ b/tests/auto/corelib/kernel/qobject/test/test.pro
@@ -1,11 +1,11 @@
CONFIG += testcase console
-TARGET = tst_qobject
+TARGET = ../tst_qobject
QT = core-private network testlib
-SOURCES = tst_qobject.cpp
+SOURCES = ../tst_qobject.cpp
# this is here for a reason, moc_oldnormalizedobject.cpp is not auto-generated, it was generated by
# moc from Qt 4.6, and should *not* be generated by the current moc
-SOURCES += moc_oldnormalizeobject.cpp
+SOURCES += ../moc_oldnormalizeobject.cpp
load(testcase) # for target.path and installTestHelperApp()
installTestHelperApp("signalbug/signalbug",signalbug,signalbug)
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
index d8551faddc..7a2b8cd3b6 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
+++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro
@@ -13,3 +13,11 @@ win32-borland: DEFINES += WIN32_BORLAND
# This project is testdata for tst_qlibrary
target.path = $$[QT_INSTALL_TESTS]/tst_qlibrary
INSTALLS += target
+
+win32 {
+ CONFIG(debug, debug|release) {
+ DESTDIR = ../debug/
+ } else {
+ DESTDIR = ../release/
+ }
+}
diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
index a15393b214..8d5af0ea79 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
+++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro
@@ -15,13 +15,20 @@ win32-borland: DEFINES += WIN32_BORLAND
# We want to test if we can load a shared library with *any* filename...
win32 {
+ CONFIG(debug, debug|release) {
+ BUILD_FOLDER = debug
+ } else {
+ BUILD_FOLDER = release
+ }
+ DESTDIR = ../$$BUILD_FOLDER/
+
# vcproj and Makefile generators refer to target differently
contains(TEMPLATE,vc.*) {
src = $(TargetPath)
} else {
src = $(DESTDIR_TARGET)
}
- files = mylib.dl2 system.qt.test.mylib.dll
+ files = $$BUILD_FOLDER$${QMAKE_DIR_SEP}mylib.dl2 $$BUILD_FOLDER$${QMAKE_DIR_SEP}system.qt.test.mylib.dll
} else {
src = $(DESTDIR)$(TARGET)
files = libmylib.so2 system.qt.test.mylib.so
@@ -34,7 +41,7 @@ renamed_target.path = $$target.path
for(file, files) {
QMAKE_POST_LINK += $$QMAKE_COPY $$src ..$$QMAKE_DIR_SEP$$file &&
renamed_target.extra += $$QMAKE_COPY $$src $(INSTALL_ROOT)$${target.path}$$QMAKE_DIR_SEP$$file &&
- CLEAN_FILES += ../$$file
+ CLEAN_FILES += ..$$QMAKE_DIR_SEP$$file
}
renamed_target.extra = $$member(renamed_target.extra, 0, -2)
QMAKE_POST_LINK = $$member(QMAKE_POST_LINK, 0, -2)
diff --git a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro
index ae6cf97891..d59cd738bf 100644
--- a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro
+++ b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro
@@ -13,5 +13,3 @@ win32 {
}
TESTDATA += ../library_path/invalid.so
-
-win32:CONFIG += insignificant_test # QTBUG-24151
diff --git a/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp
index 057db69174..e27085c293 100644
--- a/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp
+++ b/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp
@@ -39,5 +39,14 @@
**
****************************************************************************/
#include <QtPlugin>
+#include <QObject>
-Q_EXPORT_PLUGIN2(DebugPlugin, QObject)
+class DebugPlugin : public QObject
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "SomeIID")
+public:
+ DebugPlugin() {}
+};
+
+#include "main.moc"
diff --git a/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp
index 9542695112..d0875d2902 100644
--- a/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp
+++ b/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp
@@ -39,5 +39,14 @@
**
****************************************************************************/
#include <QtPlugin>
+#include <QObject>
-Q_EXPORT_PLUGIN2(ReleasePlugin, QObject)
+class ReleasePlugin : public QObject
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "SomeIID")
+public:
+ ReleasePlugin() {}
+};
+
+#include "main.moc"
diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
index e6a83cf3d7..af76fcc4a2 100644
--- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
+++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
@@ -55,15 +55,23 @@ public:
tst_QPlugin();
private slots:
+ void initTestCase();
void loadDebugPlugin();
void loadReleasePlugin();
};
tst_QPlugin::tst_QPlugin()
- : dir("plugins")
+ : dir(QFINDTESTDATA("plugins"))
{
}
+void tst_QPlugin::initTestCase()
+{
+ QVERIFY2(dir.exists(),
+ qPrintable(QString::fromLatin1("Cannot find the 'plugins' directory starting from '%1'").
+ arg(QDir::toNativeSeparators(QDir::currentPath()))));
+}
+
void tst_QPlugin::loadDebugPlugin()
{
foreach (QString fileName, dir.entryList(QStringList() << "*debug*", QDir::Files)) {
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp
index 4b2057087a..eaad3ceff5 100644
--- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp
@@ -47,5 +47,3 @@ QString AlmostPlugin::pluginName() const
unresolvedSymbol();
return QLatin1String("Plugin ok");
}
-
-Q_EXPORT_PLUGIN2(almostplugin, AlmostPlugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h
index 6658a5be8d..d64f5985ec 100644
--- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h
@@ -42,11 +42,13 @@
#define ALMOSTPLUGIN_H
#include <QObject>
+#include <QtPlugin>
#include "../theplugin/plugininterface.h"
class AlmostPlugin : public QObject, public PluginInterface
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json")
Q_INTERFACES(PluginInterface)
public:
diff --git a/tests/auto/corelib/plugin/qpluginloader/empty.json b/tests/auto/corelib/plugin/qpluginloader/empty.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/empty.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
index a568dd118d..fe0892c0fe 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
@@ -41,13 +41,19 @@
#ifndef PLUGININTERFACE_H
#define PLUGININTERFACE_H
+#include <QtCore/QtGlobal>
+
struct PluginInterface {
virtual ~PluginInterface() {}
virtual QString pluginName() const = 0;
};
QT_BEGIN_NAMESPACE
-Q_DECLARE_INTERFACE(PluginInterface, "com.trolltect.autotests.plugininterface/1.0")
+
+#define PluginInterface_iid "org.qt-project.Qt.autotests.plugininterface"
+
+Q_DECLARE_INTERFACE(PluginInterface, PluginInterface_iid)
+
QT_END_NAMESPACE
#endif // PLUGININTERFACE_H
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
index b064901a4d..8c97956a5f 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
@@ -46,6 +46,3 @@ QString ThePlugin::pluginName() const
{
return QLatin1String("Plugin ok");
}
-
-Q_EXPORT_PLUGIN2(theplugin, ThePlugin)
-
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
index b769aa6eed..3b8f12140e 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
@@ -42,11 +42,13 @@
#define THEPLUGIN_H
#include <QObject>
+#include <QtPlugin>
#include "plugininterface.h"
class ThePlugin : public QObject, public PluginInterface
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json")
Q_INTERFACES(PluginInterface)
public:
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 25e1a0587c..8eccd17376 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -107,6 +107,8 @@ private slots:
void customEventDispatcher();
void stressTest();
+
+ void quitLock();
};
enum { one_minute = 60 * 1000, five_minutes = 5 * one_minute };
@@ -1285,5 +1287,52 @@ void tst_QThread::customEventDispatcher()
QVERIFY(weak_ed.isNull());
}
+class Job : public QObject
+{
+ Q_OBJECT
+public:
+ Job(QThread *thread, int deleteDelay, QObject *parent = 0)
+ : QObject(parent), quitLocker(thread), exitThreadCalled(false)
+ {
+ moveToThread(thread);
+ QTimer::singleShot(deleteDelay, this, SLOT(deleteLater()));
+ QTimer::singleShot(1000, this, SLOT(exitThread()));
+ }
+
+private slots:
+ void exitThread()
+ {
+ exitThreadCalled = true;
+ thread()->exit(1);
+ }
+
+private:
+ QEventLoopLocker quitLocker;
+public:
+ bool exitThreadCalled;
+};
+
+void tst_QThread::quitLock()
+{
+ QThread thread;
+
+ QEventLoop loop;
+ connect(&thread, SIGNAL(finished()), &loop, SLOT(quit()));
+
+ Job *job;
+
+ thread.start();
+ job = new Job(&thread, 500);
+ QCOMPARE(job->thread(), &thread);
+ loop.exec();
+ QVERIFY(!job->exitThreadCalled);
+
+ thread.start();
+ job = new Job(&thread, 2500);
+ QCOMPARE(job->thread(), &thread);
+ loop.exec();
+ QVERIFY(job->exitThreadCalled);
+}
+
QTEST_MAIN(tst_QThread)
#include "tst_qthread.moc"
diff --git a/tests/auto/corelib/thread/qthreadstorage/crashOnExit.pro b/tests/auto/corelib/thread/qthreadstorage/crashOnExit.pro
deleted file mode 100644
index 68d0f1202b..0000000000
--- a/tests/auto/corelib/thread/qthreadstorage/crashOnExit.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-SOURCES += crashOnExit.cpp
-QT = core
-CONFIG-=app_bundle
-CONFIG+=console
-
-# This app is testdata for tst_qthreadstorage
-target.path = $$[QT_INSTALL_TESTS]/tst_qthreadstorage
-INSTALLS += target
diff --git a/tests/auto/corelib/thread/qthreadstorage/crashOnExit.cpp b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashOnExit.cpp
index 388c233d84..388c233d84 100644
--- a/tests/auto/corelib/thread/qthreadstorage/crashOnExit.cpp
+++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashOnExit.cpp
diff --git a/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro
new file mode 100644
index 0000000000..94a0a01e94
--- /dev/null
+++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro
@@ -0,0 +1,9 @@
+SOURCES += crashOnExit.cpp
+DESTDIR = ./
+QT = core
+CONFIG -= app_bundle
+CONFIG += console
+
+# This app is testdata for tst_qthreadstorage
+target.path = $$[QT_INSTALL_TESTS]/tst_qthreadstorage/$$TARGET
+INSTALLS += target
diff --git a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
index 0dc8d086df..2fa973d2f7 100644
--- a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
+++ b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
- tst_qthreadstorage.pro \
- crashOnExit.pro
-CONFIG += parallel_test
+ crashonexit \
+ test
+CONFIG += ordered parallel_test
diff --git a/tests/auto/corelib/thread/qthreadstorage/test/test.pro b/tests/auto/corelib/thread/qthreadstorage/test/test.pro
new file mode 100644
index 0000000000..a7d8eb0106
--- /dev/null
+++ b/tests/auto/corelib/thread/qthreadstorage/test/test.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+TARGET = ../tst_qthreadstorage
+CONFIG -= app_bundle
+CONFIG += console
+QT = core testlib
+SOURCES = ../tst_qthreadstorage.cpp
diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
index fff361ea2a..0529e67e0f 100644
--- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
+++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
@@ -46,6 +46,8 @@
#include <qthread.h>
#include <qwaitcondition.h>
#include <qthreadstorage.h>
+#include <qdir.h>
+#include <qfileinfo.h>
#ifdef Q_OS_UNIX
#include <pthread.h>
@@ -61,6 +63,7 @@ class tst_QThreadStorage : public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
void hasLocalData();
void localData();
void localData_const();
@@ -72,6 +75,9 @@ private slots:
void leakInDestructor();
void resetInDestructor();
void valueBased();
+
+private:
+ QString m_crashOnExit;
};
class Pointer
@@ -83,6 +89,20 @@ public:
};
int Pointer::count = 0;
+void tst_QThreadStorage::initTestCase()
+{
+ const QString crashOnExitDir = QFINDTESTDATA("crashonexit");
+ QVERIFY2(!crashOnExitDir.isEmpty(),
+ qPrintable(QString::fromLatin1("Could not find 'crashonexit' starting from '%1'")
+ .arg(QDir::toNativeSeparators(QDir::currentPath()))));
+ m_crashOnExit = crashOnExitDir + QStringLiteral("/crashonexit");
+#ifdef Q_OS_WIN
+ m_crashOnExit += QStringLiteral(".exe");
+#endif
+ QVERIFY2(QFileInfo(m_crashOnExit).isExecutable(),
+ qPrintable(QDir::toNativeSeparators(m_crashOnExit) + QStringLiteral(" does not exist or is not executable.")));
+}
+
void tst_QThreadStorage::hasLocalData()
{
QThreadStorage<Pointer *> pointers;
@@ -285,18 +305,32 @@ void tst_QThreadStorage::ensureCleanupOrder()
QVERIFY(First::order < Second::order);
}
-void tst_QThreadStorage::crashOnExit()
+static inline bool runCrashOnExit(const QString &binary, QString *errorMessage)
{
+ const int timeout = 60000;
QProcess process;
- // crashOnExit is always expected to be in the same directory
- // as this test binary
-#ifdef Q_OS_MAC
- process.start(QCoreApplication::applicationDirPath() + "/../../../crashOnExit");
-#else
- process.start(QCoreApplication::applicationDirPath() + "/crashOnExit");
-#endif
- QVERIFY(process.waitForFinished());
- QVERIFY(process.exitStatus() != QProcess::CrashExit);
+ process.start(binary);
+ if (!process.waitForStarted()) {
+ *errorMessage = QString::fromLatin1("Could not start '%1': %2").arg(binary, process.errorString());
+ return false;
+ }
+ if (!process.waitForFinished(timeout)) {
+ process.kill();
+ *errorMessage = QString::fromLatin1("Timeout (%1ms) waiting for %2.").arg(timeout).arg(binary);
+ return false;
+ }
+ if (process.exitStatus() != QProcess::NormalExit) {
+ *errorMessage = binary + QStringLiteral(" crashed.");
+ return false;
+ }
+ return true;
+}
+
+void tst_QThreadStorage::crashOnExit()
+{
+ QString errorMessage;
+ QVERIFY2(runCrashOnExit(m_crashOnExit, &errorMessage),
+ qPrintable(errorMessage));
}
// S stands for thread Safe.
diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.pro b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.pro
deleted file mode 100644
index 15ced107d3..0000000000
--- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qthreadstorage
-QT = core testlib
-SOURCES = tst_qthreadstorage.cpp
diff --git a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
index 81cc66f045..67c15682a2 100644
--- a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
+++ b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
@@ -102,6 +102,22 @@ void tst_QCryptographicHash::intermediary_result_data()
<< QByteArray("abc") << QByteArray("abc")
<< QByteArray::fromHex("A9993E364706816ABA3E25717850C26C9CD0D89D")
<< QByteArray::fromHex("F8C1D87006FBF7E5CC4B026C3138BC046883DC71");
+ QTest::newRow("sha224") << int(QCryptographicHash::Sha224)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("23097D223405D8228642A477BDA255B32AADBCE4BDA0B3F7E36C9DA7")
+ << QByteArray::fromHex("7C9C91FC479626AA1A525301084DEB96716131D146A2DB61B533F4C9");
+ QTest::newRow("sha256") << int(QCryptographicHash::Sha256)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD")
+ << QByteArray::fromHex("BBB59DA3AF939F7AF5F360F2CEB80A496E3BAE1CD87DDE426DB0AE40677E1C2C");
+ QTest::newRow("sha384") << int(QCryptographicHash::Sha384)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("CB00753F45A35E8BB5A03D699AC65007272C32AB0EDED1631A8B605A43FF5BED8086072BA1E7CC2358BAECA134C825A7")
+ << QByteArray::fromHex("CAF33A735C9535CE7F5D24FB5B3A4834F0E9316664AD15A9E8221679D4A3B4FB7E962404BA0C10C1D43AB49D03A08B8D");
+ QTest::newRow("sha512") << int(QCryptographicHash::Sha512)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA20A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD454D4423643CE80E2A9AC94FA54CA49F")
+ << QByteArray::fromHex("F3C41E7B63EE869596FC28BAD64120612C520F65928AB4D126C72C6998B551B8FF1CEDDFED4373E6717554DC89D1EEE6F0AB22FD3675E561ABA9AE26A3EEC53B");
}
void tst_QCryptographicHash::intermediary_result()
diff --git a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro
index d510d82207..a97350ca3f 100644
--- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro
+++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro
@@ -1,6 +1,7 @@
SOURCES += syslocaleapp.cpp
DESTDIR = ./
+CONFIG += console
CONFIG -= app_bundle
QT = core
diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro
index 5a4fb674c5..eafd8c1699 100644
--- a/tests/auto/corelib/tools/qlocale/test/test.pro
+++ b/tests/auto/corelib/tools/qlocale/test/test.pro
@@ -1,5 +1,6 @@
-CONFIG += testcase
-QT = core testlib network
+CONFIG += console testcase
+CONFIG -= app_bundle
+QT = core testlib
embedded: QT += gui
SOURCES = ../tst_qlocale.cpp
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index db7f503f57..02acb00548 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -43,6 +43,9 @@
#include <QtTest/QtTest>
#include <math.h>
#include <qglobal.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <QScopedArrayPointer>
#include <qtextcodec.h>
#include <qdatetime.h>
#include <float.h>
@@ -83,6 +86,7 @@ public:
tst_QLocale();
private slots:
+ void initTestCase();
void windowsDefaultLocale();
void macDefaultLocale();
@@ -131,6 +135,7 @@ private slots:
private:
QString m_decimal, m_thousand, m_sdate, m_ldate, m_time;
+ QString m_sysapp;
};
tst_QLocale::tst_QLocale()
@@ -138,6 +143,22 @@ tst_QLocale::tst_QLocale()
qRegisterMetaType<QLocale::FormatType>("QLocale::FormatType");
}
+void tst_QLocale::initTestCase()
+{
+ const QString syslocaleapp_dir = QFINDTESTDATA("syslocaleapp");
+ QVERIFY2(!syslocaleapp_dir.isEmpty(),
+ qPrintable(QStringLiteral("Cannot find 'syslocaleapp' starting from ")
+ + QDir::toNativeSeparators(QDir::currentPath())));
+ m_sysapp = syslocaleapp_dir + QStringLiteral("/syslocaleapp");
+#ifdef Q_OS_WIN
+ m_sysapp += QStringLiteral(".exe");
+#endif
+ const QFileInfo fi(m_sysapp);
+ QVERIFY2(fi.exists() && fi.isExecutable(),
+ qPrintable(QDir::toNativeSeparators(m_sysapp)
+ + QStringLiteral(" does not exist or is not executable.")));
+}
+
void tst_QLocale::ctor()
{
QLocale default_locale = QLocale::system();
@@ -346,6 +367,54 @@ void tst_QLocale::ctor()
#undef TEST_CTOR
}
+static inline bool runSysApp(const QString &binary,
+ const QStringList &env,
+ QString *output,
+ QString *errorMessage)
+{
+ output->clear();
+ errorMessage->clear();
+ QProcess process;
+ process.setEnvironment(env);
+ process.start(binary);
+ process.closeWriteChannel();
+ if (!process.waitForStarted()) {
+ *errorMessage = QString::fromLatin1("Cannot start '%1': %2").arg(binary, process.errorString());
+ return false;
+ }
+ if (!process.waitForFinished()) {
+ process.kill();
+ *errorMessage = QStringLiteral("Timeout waiting for ") + binary;
+ return false;
+ }
+ *output = QString::fromLocal8Bit(process.readAllStandardOutput());
+ return true;
+}
+
+static inline bool runSysAppTest(const QString &binary,
+ QStringList baseEnv,
+ const QString &requestedLocale,
+ const QString &expectedOutput,
+ QString *errorMessage)
+{
+ QString output;
+ baseEnv.append(QStringLiteral("LANG=") + requestedLocale);
+ if (!runSysApp(binary, baseEnv, &output, errorMessage))
+ return false;
+
+ if (output.isEmpty()) {
+ *errorMessage = QString::fromLatin1("Empty output received for requested '%1' (expected '%2')").
+ arg(requestedLocale, expectedOutput);
+ return false;
+ }
+ if (output != expectedOutput) {
+ *errorMessage = QString::fromLatin1("Output mismatch for requested '%1': Expected '%2', got '%3'").
+ arg(requestedLocale, expectedOutput, output);
+ return false;
+ }
+ return true;
+}
+
void tst_QLocale::emptyCtor()
{
#if defined(Q_OS_WINCE)
@@ -358,15 +427,9 @@ void tst_QLocale::emptyCtor()
{ \
/* Test constructor without arguments. Needs separate process */ \
/* because of caching of the system locale. */ \
- QProcess process; \
- process.setEnvironment(QStringList(env) << QString("LANG=%1").arg(req_lc)); \
- process.start(syslocaleapp_dir + "syslocaleapp"); \
- process.waitForReadyRead(); \
- QString ret = QString(process.readAll()); \
- process.waitForFinished(); \
- QVERIFY2(!ret.isEmpty(), "Cannot launch external process"); \
- QVERIFY2(QString(exp_str) == ret, QString("Expected: " + QString(exp_str) + ", got: " \
- + ret + ". Requested: " + QString(req_lc)).toLatin1().constData()); \
+ QString errorMessage; \
+ QVERIFY2(runSysAppTest(m_sysapp, env, QLatin1String(req_lc), QLatin1String(exp_str), &errorMessage), \
+ qPrintable(errorMessage)); \
}
// Get an environment free of any locale-related variables
@@ -377,15 +440,11 @@ void tst_QLocale::emptyCtor()
env << entry;
}
- QString syslocaleapp_dir = QFINDTESTDATA("syslocaleapp/");
-
// Get default locale.
- QProcess p;
- p.setEnvironment(env);
- p.start(syslocaleapp_dir + "syslocaleapp");
- p.waitForReadyRead();
- QString defaultLoc = QString(p.readAll());
- p.waitForFinished();
+ QString defaultLoc;
+ QString errorMessage;
+ QVERIFY2(runSysApp(m_sysapp, env, &defaultLoc, &errorMessage),
+ qPrintable(errorMessage));
TEST_CTOR("C", "C")
TEST_CTOR("bla", "C")
@@ -421,9 +480,9 @@ void tst_QLocale::emptyCtor()
TEST_CTOR("DE", "de_DE");
TEST_CTOR("EN", "en_US");
- TEST_CTOR("en/", defaultLoc)
- TEST_CTOR("asdfghj", defaultLoc);
- TEST_CTOR("123456", defaultLoc);
+ TEST_CTOR("en/", defaultLoc.toLatin1())
+ TEST_CTOR("asdfghj", defaultLoc.toLatin1());
+ TEST_CTOR("123456", defaultLoc.toLatin1());
#undef TEST_CTOR
#endif
@@ -1147,17 +1206,15 @@ static QString getWinLocaleInfo(LCTYPE type)
qWarning("QLocale: empty windows locale info (%d)", type);
return QString();
}
-
- QByteArray buff(cnt, 0);
-
- cnt = GetLocaleInfo(id, type, reinterpret_cast<wchar_t*>(buff.data()), buff.size() / 2);
+ cnt /= sizeof(wchar_t);
+ QScopedArrayPointer<wchar_t> buf(new wchar_t[cnt]);
+ cnt = GetLocaleInfo(id, type, buf.data(), cnt);
if (cnt == 0) {
qWarning("QLocale: empty windows locale info (%d)", type);
return QString();
}
-
- return QString::fromWCharArray(reinterpret_cast<wchar_t*>(buff.data()));
+ return QString::fromWCharArray(buf.data());
}
static void setWinLocaleInfo(LCTYPE type, const QString &value)
@@ -1189,13 +1246,13 @@ public:
};
-#endif
+#endif // Q_OS_WIN
void tst_QLocale::windowsDefaultLocale()
{
-#ifndef Q_OS_WIN
- QSKIP("This is a Windows test");
-#else
+#ifdef Q_OS_WIN
+ QSKIP("This test currently fails - QTBUG-24543");
+
RestoreLocaleHelper systemLocale;
// set weird system defaults and make sure we're using them
setWinLocaleInfo(LOCALE_SDECIMAL, QLatin1String("@"));
@@ -1204,7 +1261,6 @@ void tst_QLocale::windowsDefaultLocale()
setWinLocaleInfo(LOCALE_SLONGDATE, QLatin1String("d@M@yyyy"));
setWinLocaleInfo(LOCALE_STIMEFORMAT, QLatin1String("h^m^s"));
QLocale locale = QLocale::system();
-
// make sure we are seeing the system's format strings
QCOMPARE(locale.decimalPoint(), QChar('@'));
QCOMPARE(locale.groupSeparator(), QChar('?'));
@@ -1230,7 +1286,7 @@ void tst_QLocale::windowsDefaultLocale()
QCOMPARE(locale.toString(QDateTime(QDate(1974, 12, 1), QTime(1,2,3)), QLocale::LongFormat),
QString("1@12@1974 1^2^3"));
QCOMPARE(locale.toString(QTime(1,2,3), QLocale::LongFormat), QString("1^2^3"));
-#endif
+#endif // #ifdef Q_OS_WIN
}
void tst_QLocale::numberOptions()
diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
index 0148e933e4..a697e23270 100644
--- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
+++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
@@ -79,6 +79,8 @@ private slots:
void posAndCapConsistency_data();
void posAndCapConsistency();
void interval();
+ void validityCheck_data();
+ void validityCheck();
};
// Testing get/set functions
@@ -1344,6 +1346,33 @@ void tst_QRegExp::interval()
}
}
+void tst_QRegExp::validityCheck_data()
+{
+ QTest::addColumn<QString>("pattern");
+ QTest::addColumn<bool>("validity");
+ QTest::newRow("validity01") << QString() << true;
+ QTest::newRow("validity02") << QString("abc.*abc") << true;
+ QTest::newRow("validity03") << QString("[a-z") << false;
+ QTest::newRow("validity04") << QString("a(b") << false;
+}
+
+void tst_QRegExp::validityCheck()
+{
+ QFETCH(QString, pattern);
+
+ QRegExp rx(pattern);
+ QTEST(rx.isValid(), "validity");
+ QCOMPARE(rx.matchedLength(), -1);
+ QCOMPARE(rx.pos(), -1);
+ QCOMPARE(rx.cap(), QString(""));
+
+ QRegExp rx2(rx);
+ QTEST(rx2.isValid(), "validity");
+ QCOMPARE(rx2.matchedLength(), -1);
+ QCOMPARE(rx2.pos(), -1);
+ QCOMPARE(rx2.cap(), QString(""));
+}
+
QTEST_APPLESS_MAIN(tst_QRegExp)
#include "tst_qregexp.moc"
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 3fb253c646..7e4f591f47 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -808,10 +808,7 @@ void tst_QString::constructorQByteArray()
QCOMPARE(str1.length(), expected.length());
QCOMPARE( str1, expected );
- QTextCodec::setCodecForCStrings( QTextCodec::codecForMib(4) ); // Latin 1
QString strBA(src);
- QTextCodec::setCodecForCStrings( 0 );
-
QCOMPARE( strBA, expected );
}
@@ -928,12 +925,7 @@ void tst_QString::sprintf()
QCOMPARE(a.sprintf("%-5.5s", "Hello" ),(QString)"Hello");
// Check utf8 conversion for %s
- QCOMPARE(a.sprintf("%s", "\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205"), QString("\366\344\374\326\304\334\370\346\345\330\306\305"));
-
- // Check codecForCStrings is used to read non-modifier sequences in the format string
- QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
- QCOMPARE(a.sprintf("\303\251\303\250\303\240 %s", "\303\251\303\250\303\240"), QString("\303\251\303\250\303\240 \303\251\303\250\303\240"));
- QTextCodec::setCodecForCStrings(0);
+ QCOMPARE(a.sprintf("%s", "\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205"), QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305"));
int n1;
a.sprintf("%s%n%s", "hello", &n1, "goodbye");
@@ -1871,9 +1863,7 @@ void tst_QString::append_bytearray()
QFETCH( QString, str );
QFETCH( QByteArray, ba );
- QTextCodec::setCodecForCStrings( QTextCodec::codecForMib(4) ); // Latin 1
str.append( ba );
- QTextCodec::setCodecForCStrings( 0 );
QTEST( str, "res" );
}
@@ -1898,9 +1888,7 @@ void tst_QString::operator_pluseq_bytearray()
QFETCH( QString, str );
QFETCH( QByteArray, ba );
- QTextCodec::setCodecForCStrings( QTextCodec::codecForMib(4) ); // Latin 1
str += ba;
- QTextCodec::setCodecForCStrings( 0 );
QTEST( str, "res" );
}
@@ -1960,9 +1948,7 @@ void tst_QString::prepend_bytearray()
QFETCH( QString, str );
QFETCH( QByteArray, ba );
- QTextCodec::setCodecForCStrings( QTextCodec::codecForMib(4) ); // Latin 1
str.prepend( ba );
- QTextCodec::setCodecForCStrings( 0 );
QTEST( str, "res" );
}
@@ -3211,7 +3197,7 @@ void tst_QString::utf8()
QFETCH( QByteArray, utf8 );
QFETCH( QString, res );
- QCOMPARE( utf8, QByteArray(res.toUtf8()) );
+ QCOMPARE(res.toUtf8(), utf8);
}
void tst_QString::stringRef_utf8_data()
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index 95e24b22fb..afc16078b8 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -66,10 +66,8 @@
void runScenario()
{
- // set codec for C strings to 0, enforcing Latin1
- QTextCodec::setCodecForCStrings(0);
- QVERIFY(!QTextCodec::codecForCStrings());
-
+ // this code is latin1. TODO: replace it with the utf8 block below, once
+ // strings default to utf8.
QLatin1Literal l1literal(LITERAL);
QLatin1String l1string(LITERAL);
QString string(l1string);
@@ -130,7 +128,10 @@ void runScenario()
r = string P ba;
QCOMPARE(r, r2);
+#if 0
// now test with codec for C strings set
+ // TODO: to be re-enabled once strings default to utf8, in place of the
+ // latin1 code above.
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QVERIFY(QTextCodec::codecForCStrings());
QCOMPARE(QTextCodec::codecForCStrings()->name(), QByteArray("UTF-8"));
@@ -153,6 +154,7 @@ void runScenario()
QCOMPARE(r, r3);
r = string P ba;
QCOMPARE(r, r3);
+#endif
ba = QByteArray(); // empty
r = ba P string;
@@ -212,9 +214,12 @@ void runScenario()
str += QLatin1String(LITERAL) P str;
QCOMPARE(str, QString::fromUtf8(UTF8_LITERAL LITERAL UTF8_LITERAL));
#ifndef QT_NO_CAST_FROM_ASCII
+#if 0
+ // TODO: this relies on strings defaulting to utf8, so disable this for now.
str = (QString::fromUtf8(UTF8_LITERAL) += QLatin1String(LITERAL) P UTF8_LITERAL);
QCOMPARE(str, QString::fromUtf8(UTF8_LITERAL LITERAL UTF8_LITERAL));
#endif
+#endif
}
//operator QByteArray +=
@@ -229,11 +234,14 @@ void runScenario()
ba2 += ba2 P withZero;
QCOMPARE(ba2, QByteArray(withZero + withZero + withZero));
#ifndef QT_NO_CAST_TO_ASCII
+#if 0
+ // TODO: this relies on strings defaulting to utf8, so disable this for now.
ba = UTF8_LITERAL;
ba2 = (ba += QLatin1String(LITERAL) + QString::fromUtf8(UTF8_LITERAL));
QCOMPARE(ba2, ba);
QCOMPARE(ba, QByteArray(UTF8_LITERAL LITERAL UTF8_LITERAL));
#endif
+#endif
}
}
diff --git a/tests/auto/dbus/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h
index 87c434b71e..025641531d 100644
--- a/tests/auto/dbus/qdbusmarshall/common.h
+++ b/tests/auto/dbus/qdbusmarshall/common.h
@@ -581,7 +581,7 @@ bool compareToArgument(const QDBusArgument &arg, const QVariant &v2)
qWarning() << "Unexpected QVariant type" << v2.userType()
<< QByteArray(QDBusMetaType::typeToSignature(v2.userType()))
- << QVariant::typeToName(QVariant::Type(v2.userType()));
+ << QMetaType::typeName(v2.userType());
return false;
}
diff --git a/tests/auto/gui/kernel/qclipboard/copier/copier.pro b/tests/auto/gui/kernel/qclipboard/copier/copier.pro
index 1c188ca7de..def50b6476 100644
--- a/tests/auto/gui/kernel/qclipboard/copier/copier.pro
+++ b/tests/auto/gui/kernel/qclipboard/copier/copier.pro
@@ -1,9 +1,4 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
CONFIG -= app_bundle
win32: DESTDIR = ../copier
-# Input
-SOURCES += main.cpp
+SOURCES += main.cpp
diff --git a/tests/auto/gui/kernel/qclipboard/paster/paster.pro b/tests/auto/gui/kernel/qclipboard/paster/paster.pro
index 2f50eefb1e..ef91e77b6e 100644
--- a/tests/auto/gui/kernel/qclipboard/paster/paster.pro
+++ b/tests/auto/gui/kernel/qclipboard/paster/paster.pro
@@ -1,10 +1,4 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
win32: DESTDIR = ../paster
CONFIG -= app_bundle
-# Input
-SOURCES += main.cpp
-
+SOURCES += main.cpp
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index e1b0535e2f..7f41f0651e 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -291,19 +291,17 @@ void tst_QClipboard::setMimeData()
QGuiApplication::clipboard()->clear(QClipboard::Selection); // used to crash on X11
QGuiApplication::clipboard()->clear(QClipboard::FindBuffer);
-#if defined(Q_WS_X11)
- QCOMPARE(spySelection.count(), 1);
- QCOMPARE(spyData.count(), 1);
- QCOMPARE(spyFindBuffer.count(), 0);
-#elif defined(Q_OS_MAC)
- QCOMPARE(spySelection.count(), 0);
- QCOMPARE(spyData.count(), 1);
- QCOMPARE(spyFindBuffer.count(), 1);
-#elif defined(Q_WS_WIN)
- QCOMPARE(spySelection.count(), 0);
+ if (QGuiApplication::clipboard()->supportsSelection())
+ QCOMPARE(spySelection.count(), 1);
+ else
+ QCOMPARE(spySelection.count(), 0);
+
+ if (QGuiApplication::clipboard()->supportsFindBuffer())
+ QCOMPARE(spyFindBuffer.count(), 1);
+ else
+ QCOMPARE(spyFindBuffer.count(), 0);
+
QCOMPARE(spyData.count(), 1);
- QCOMPARE(spyFindBuffer.count(), 0);
-#endif
// an other crash test
data = new QMimeData;
@@ -324,19 +322,17 @@ void tst_QClipboard::setMimeData()
QGuiApplication::clipboard()->setMimeData(newData, QClipboard::Selection); // used to crash on X11
QGuiApplication::clipboard()->setMimeData(newData, QClipboard::FindBuffer);
-#if defined(Q_WS_X11)
- QCOMPARE(spySelection.count(), 1);
- QCOMPARE(spyData.count(), 1);
- QCOMPARE(spyFindBuffer.count(), 0);
-#elif defined(Q_OS_MAC)
- QCOMPARE(spySelection.count(), 0);
- QCOMPARE(spyData.count(), 1);
- QCOMPARE(spyFindBuffer.count(), 1);
-#elif defined(Q_WS_WIN)
- QCOMPARE(spySelection.count(), 0);
+ if (QGuiApplication::clipboard()->supportsSelection())
+ QCOMPARE(spySelection.count(), 1);
+ else
+ QCOMPARE(spySelection.count(), 0);
+
+ if (QGuiApplication::clipboard()->supportsFindBuffer())
+ QCOMPARE(spyFindBuffer.count(), 1);
+ else
+ QCOMPARE(spyFindBuffer.count(), 0);
+
QCOMPARE(spyData.count(), 1);
- QCOMPARE(spyFindBuffer.count(), 0);
-#endif
}
void tst_QClipboard::clearBeforeSetText()
diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
index c10d954489..bc364e37f1 100644
--- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
+++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp
@@ -44,90 +44,22 @@
#include <private/qguiapplication_p.h>
#include <private/qinputmethod_p.h>
#include <qplatforminputcontext_qpa.h>
-
-class PlatformInputContext : public QPlatformInputContext
-{
-public:
- PlatformInputContext() :
- m_animating(false),
- m_visible(false),
- m_updateCallCount(0),
- m_resetCallCount(0),
- m_commitCallCount(0),
- m_localeCallCount(0),
- m_inputDirectionCallCount(0),
- m_lastQueries(Qt::ImhNone),
- m_action(QInputMethod::Click),
- m_cursorPosition(0),
- m_lastEventType(QEvent::None)
- {}
-
- virtual QRectF keyboardRect() const { return m_keyboardRect; }
- virtual bool isAnimating() const { return m_animating; }
- virtual void reset() { m_resetCallCount++; }
- virtual void commit() { m_commitCallCount++; }
-
- virtual void update(Qt::InputMethodQueries queries)
- {
- m_updateCallCount++;
- m_lastQueries = queries;
- }
- virtual void invokeAction(QInputMethod::Action action, int cursorPosition)
- {
- m_action = action;
- m_cursorPosition = cursorPosition;
- }
- virtual bool filterEvent(const QEvent *event)
- {
- m_lastEventType = event->type(); return false;
- }
- virtual void showInputPanel()
- {
- m_visible = true;
- }
- virtual void hideInputPanel()
- {
- m_visible = false;
- }
- virtual bool isInputPanelVisible() const
- {
- return m_visible;
- }
- virtual QLocale locale() const
- {
- m_localeCallCount++;
- return QLocale::c();
- }
- virtual Qt::LayoutDirection inputDirection() const
- {
- m_inputDirectionCallCount++;
- return Qt::LeftToRight;
- }
-
- bool m_animating;
- bool m_visible;
- int m_updateCallCount;
- int m_resetCallCount;
- int m_commitCallCount;
- mutable int m_localeCallCount;
- mutable int m_inputDirectionCallCount;
- Qt::InputMethodQueries m_lastQueries;
- QInputMethod::Action m_action;
- int m_cursorPosition;
- int m_lastEventType;
- QRectF m_keyboardRect;
-};
+#include "../../../shared/platforminputcontext.h"
class InputItem : public QObject
{
Q_OBJECT
public:
+ InputItem() : cursorRectangle(1, 2, 3, 4), m_enabled(true) {}
+
bool event(QEvent *event)
{
if (event->type() == QEvent::InputMethodQuery) {
QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);
+ if (query->queries() & Qt::ImEnabled)
+ query->setValue(Qt::ImEnabled, m_enabled);
if (query->queries() & Qt::ImCursorRectangle)
- query->setValue(Qt::ImCursorRectangle, QRectF(1, 2, 3, 4));
+ query->setValue(Qt::ImCursorRectangle, cursorRectangle);
if (query->queries() & Qt::ImPreferredLanguage)
query->setValue(Qt::ImPreferredLanguage, QString("English"));
m_lastQueries = query->queries();
@@ -136,9 +68,40 @@ public:
}
return false;
}
+
+ void setEnabled(bool enabled) {
+ if (enabled != m_enabled) {
+ m_enabled = enabled;
+ qApp->inputMethod()->update(Qt::ImEnabled);
+ }
+ }
+
+ QRectF cursorRectangle;
Qt::InputMethodQueries m_lastQueries;
+ bool m_enabled;
};
+
+class DummyWindow : public QWindow
+{
+public:
+ DummyWindow() : m_focusObject(0) {}
+
+ virtual QObject *focusObject() const
+ {
+ return m_focusObject;
+ }
+
+ void setFocusObject(QObject *object)
+ {
+ m_focusObject = object;
+ emit focusObjectChanged(object);
+ }
+
+ QObject *m_focusObject;
+};
+
+
class tst_qinputmethod : public QObject
{
Q_OBJECT
@@ -258,7 +221,11 @@ void tst_qinputmethod::cursorRectangle()
QCOMPARE(qApp->inputMethod()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4)));
+ m_inputItem.cursorRectangle = QRectF(1.5, 2, 1, 8);
+ QCOMPARE(qApp->inputMethod()->cursorRectangle(), transform.mapRect(QRectF(1.5, 2, 1, 8)));
+
// reset
+ m_inputItem.cursorRectangle = QRectF(1, 2, 3, 4);
qApp->inputMethod()->setInputItem(0);
qApp->inputMethod()->setInputItemTransform(QTransform());
}
@@ -297,7 +264,6 @@ void tst_qinputmethod::commit()
void tst_qinputmethod::update()
{
- qApp->inputMethod()->setInputItem(&m_inputItem);
QCOMPARE(m_platformInputContext.m_updateCallCount, 0);
QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImhNone));
diff --git a/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro
index 1e0baafd09..cf4337b156 100644
--- a/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro
+++ b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro
@@ -1,7 +1,7 @@
CONFIG += testcase
TARGET = tst_qkeysequence
-QT += widgets widgets-private testlib
+QT += widgets testlib
QT += core-private gui-private
SOURCES += tst_qkeysequence.cpp
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 29588e2ee9..861ad3835d 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -41,9 +41,10 @@
#include <QtTest/QtTest>
-#include <private/qapplication_p.h>
#include <qkeysequence.h>
+#include <qplatformtheme_qpa.h>
#include <private/qkeysequence_p.h>
+#include <private/qguiapplication_p.h>
#include <QTranslator>
#include <QLibraryInfo>
@@ -142,6 +143,7 @@ private slots:
void initTestCase();
private:
+ int m_keyboardScheme;
QTranslator *ourTranslator;
QTranslator *qtTranslator;
#ifdef Q_OS_MAC
@@ -161,8 +163,10 @@ const QString tst_QKeySequence::MacAlt = QString(QChar(0x2325));
const QString tst_QKeySequence::MacShift = QString(QChar(0x21E7));
#endif
-tst_QKeySequence::tst_QKeySequence()
+tst_QKeySequence::tst_QKeySequence() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme)
{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
}
tst_QKeySequence::~tst_QKeySequence()
@@ -297,8 +301,7 @@ void tst_QKeySequence::checkMultipleCodes()
*/
void tst_QKeySequence::ensureSorted()
{
-//### accessing static members from private classes does not work on msvc at the moment
-#if defined(QT_BUILD_INTERNAL) && !defined(Q_WS_WIN)
+#if defined(QT_BUILD_INTERNAL)
uint N = QKeySequencePrivate::numberOfKeyBindings;
uint val = QKeySequencePrivate::keyBindings[0].shortcut;
for ( uint i = 1 ; i < N ; ++i) {
@@ -322,13 +325,13 @@ void tst_QKeySequence::standardKeys_data()
QTest::newRow("delete") << (int)QKeySequence::Delete<< QString("DEL");
QTest::newRow("open") << (int)QKeySequence::Open << QString("CTRL+O");
QTest::newRow("find") << (int)QKeySequence::Find<< QString("CTRL+F");
-#ifdef Q_WS_WIN
- QTest::newRow("addTab") << (int)QKeySequence::AddTab<< QString("CTRL+T");
- QTest::newRow("findNext") << (int)QKeySequence::FindNext<< QString("F3");
- QTest::newRow("findPrevious") << (int)QKeySequence::FindPrevious << QString("SHIFT+F3");
- QTest::newRow("close") << (int)QKeySequence::Close<< QString("CTRL+F4");
- QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H");
-#endif
+ if (m_keyboardScheme == QPlatformTheme::WindowsKeyboardScheme) {
+ QTest::newRow("addTab") << (int)QKeySequence::AddTab<< QString("CTRL+T");
+ QTest::newRow("findNext") << (int)QKeySequence::FindNext<< QString("F3");
+ QTest::newRow("findPrevious") << (int)QKeySequence::FindPrevious << QString("SHIFT+F3");
+ QTest::newRow("close") << (int)QKeySequence::Close<< QString("CTRL+F4");
+ QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H");
+ }
QTest::newRow("bold") << (int)QKeySequence::Bold << QString("CTRL+B");
QTest::newRow("italic") << (int)QKeySequence::Italic << QString("CTRL+I");
QTest::newRow("underline") << (int)QKeySequence::Underline << QString("CTRL+U");
@@ -362,23 +365,33 @@ void tst_QKeySequence::standardKeys()
{
QFETCH(int, standardKey);
QFETCH(QString, expected);
- QKeySequence ks((QKeySequence::StandardKey)standardKey);
- QKeySequence ks2(expected);
- QVERIFY(ks == ks2);
+ QKeySequence actualKeySequence((QKeySequence::StandardKey)standardKey);
+ QKeySequence expectedKeySequence(expected);
+ QVERIFY2(actualKeySequence == expectedKeySequence,
+ qPrintable(QString::fromLatin1("Key mismatch, expected '%1', got '%2' for standard key %3").
+ arg(expected, actualKeySequence.toString()).arg(standardKey)));
}
void tst_QKeySequence::keyBindings()
{
- QList<QKeySequence> bindings = QKeySequence::keyBindings(QKeySequence::Copy);
+ const QList<QKeySequence> bindings =
+ QKeySequence::keyBindings(QKeySequence::Copy);
+
QList<QKeySequence> expected;
-#if defined(Q_OS_MAC)
- expected << QKeySequence("CTRL+C");
-#elif defined Q_WS_X11
- expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT");
-#else
- expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT");
-#endif
- QVERIFY(bindings == expected);
+ const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
+ const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT"));
+ switch (m_keyboardScheme) {
+ case QPlatformTheme::MacKeyboardScheme:
+ expected << ctrlC;
+ break;
+ case QPlatformTheme::WindowsKeyboardScheme:
+ expected << ctrlC << ctrlInsert;
+ break;
+ default: // X11
+ expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert;
+ break;
+ }
+ QCOMPARE(bindings, expected);
}
void tst_QKeySequence::mnemonic_data()
diff --git a/tests/auto/gui/painting/qpainter/utils/createImages/createImages.pro b/tests/auto/gui/painting/qpainter/utils/createImages/createImages.pro
index ce2d341e92..36661c7d63 100644
--- a/tests/auto/gui/painting/qpainter/utils/createImages/createImages.pro
+++ b/tests/auto/gui/painting/qpainter/utils/createImages/createImages.pro
@@ -1,11 +1,3 @@
-######################################################################
-# Automatically generated by qmake (1.02a) Thu Apr 18 18:56:53 2002
-######################################################################
-
-TEMPLATE = app
CONFIG -= moc
-# Input
SOURCES += main.cpp
-
-
diff --git a/tests/auto/gui/text/qtextscriptengine/generate/generate.pro b/tests/auto/gui/text/qtextscriptengine/generate/generate.pro
index 354e0e5cdf..101b7451de 100644
--- a/tests/auto/gui/text/qtextscriptengine/generate/generate.pro
+++ b/tests/auto/gui/text/qtextscriptengine/generate/generate.pro
@@ -1,14 +1,5 @@
-######################################################################
-# Automatically generated by qmake (1.07a) Fri Sep 30 15:20:45 2005
-######################################################################
-
-TEMPLATE = app
CONFIG -= moc
INCLUDEPATH += . /usr/include/freetype2
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src
-# Input
SOURCES += main.cpp
-CONFIG += qt warn_on debug thread create_prl link_prl
-
-
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index cf02d1af50..7c9a83eaa4 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -104,6 +104,7 @@ private slots:
void mirroredChars();
void thaiIsolatedSaraAm();
+ void thaiWithZWJ();
private:
bool haveTestFonts;
@@ -1280,5 +1281,46 @@ void tst_QTextScriptEngine::thaiIsolatedSaraAm()
QSKIP("Cannot find Waree.");
}
+void tst_QTextScriptEngine::thaiWithZWJ()
+{
+ QString s(QString::fromUtf8("ร‍ร‌.ร.“ร…ร”ร\xA0ร本ร") + QChar(0x0363)/*superscript 'a', for testing Inherited class*/);
+ QTextLayout layout(s);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QTextEngine *e = layout.engine();
+ e->width(0, s.length()); //force itemize and shape
+
+ // A thai implementation could either remove the ZWJ and ZWNJ characters, or hide them.
+ // The current implementation hides them, so we test for that.
+ // But make sure that we don't hide anything else
+ QCOMPARE(e->layoutData->items.size(), 11);
+ QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(7)); // Thai: The ZWJ and ZWNJ characters are inherited, so should be part of the thai script
+ QCOMPARE(e->layoutData->items[1].num_glyphs, ushort(1)); // Common: The smart quotes cannot be handled by thai, so should be a seperate item
+ QCOMPARE(e->layoutData->items[2].num_glyphs, ushort(1)); // Thai: Thai character
+ QCOMPARE(e->layoutData->items[3].num_glyphs, ushort(1)); // Common: Ellipsis
+ QCOMPARE(e->layoutData->items[4].num_glyphs, ushort(1)); // Thai: Thai character
+ QCOMPARE(e->layoutData->items[5].num_glyphs, ushort(1)); // Common: Smart quote
+ QCOMPARE(e->layoutData->items[6].num_glyphs, ushort(1)); // Thai: Thai character
+ QCOMPARE(e->layoutData->items[7].num_glyphs, ushort(1)); // Common: \xA0 = non-breaking space. Could be useful to have in thai, but not currently implemented
+ QCOMPARE(e->layoutData->items[8].num_glyphs, ushort(1)); // Thai: Thai character
+ QCOMPARE(e->layoutData->items[9].num_glyphs, ushort(1)); // Japanese: Kanji for tree
+ QCOMPARE(e->layoutData->items[10].num_glyphs, ushort(2)); // Thai: Thai character followed by superscript "a" which is of inherited type
+
+ //A quick sanity check - check all the characters are individual clusters
+ unsigned short *logClusters = e->layoutData->logClustersPtr;
+ for (int i = 0; i < 7; i++)
+ QCOMPARE(logClusters[i], ushort(i));
+ for (int i = 0; i < 10; i++)
+ QCOMPARE(logClusters[i+7], ushort(0));
+ QCOMPARE(logClusters[17], ushort(1));
+
+ // The only characters that we should be hiding are the ZWJ and ZWNJ characters in position 1
+ // and 3.
+ for (int i = 0; i < 18; i++)
+ QCOMPARE((bool)e->layoutData->glyphLayout.attributes[i].dontPrint, (i == 1 || i == 3));
+}
+
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 671d03cf84..5b34fa7c29 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -79,6 +79,11 @@
#ifdef QT_BUILD_INTERNAL
#include <QtNetwork/private/qnetworkaccessmanager_p.h>
#endif
+
+#ifdef Q_OS_UNIX
+# include <sys/types.h>
+# include <unistd.h> // for getuid()
+#endif
#include <time.h>
#include "../../../network-settings.h"
@@ -1295,19 +1300,17 @@ QString tst_QNetworkReply::runCustomRequest(const QNetworkRequest &request,
int tst_QNetworkReply::waitForFinish(QNetworkReplyPtr &reply)
{
- int code = Success;
int count = 0;
connect(reply, SIGNAL(finished()), SLOT(finished()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(gotError()));
-
+ returnCode = Success;
loop = new QEventLoop;
QSignalSpy spy(reply, SIGNAL(downloadProgress(qint64,qint64)));
while (!reply->isFinished()) {
- QTimer::singleShot(10000, loop, SLOT(quit()));
- code = loop->exec();
- if (count == spy.count() && !reply->isFinished()) {
- code = Timeout;
+ QTimer::singleShot(5000, loop, SLOT(quit()));
+ if ( loop->exec() == Timeout && count == spy.count() && !reply->isFinished()) {
+ returnCode = Timeout;
break;
}
count = spy.count();
@@ -1315,7 +1318,7 @@ int tst_QNetworkReply::waitForFinish(QNetworkReplyPtr &reply)
delete loop;
loop = 0;
- return code;
+ return returnCode;
}
void tst_QNetworkReply::finished()
diff --git a/tests/auto/network/socket/qlocalsocket/example/client/client.pro b/tests/auto/network/socket/qlocalsocket/example/client/client.pro
index 84f20d6ec0..4b6585ff10 100644
--- a/tests/auto/network/socket/qlocalsocket/example/client/client.pro
+++ b/tests/auto/network/socket/qlocalsocket/example/client/client.pro
@@ -1,10 +1,4 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
CONFIG += console
QT = core network
SOURCES += main.cpp
-
-
diff --git a/tests/auto/network/socket/qlocalsocket/example/server/server.pro b/tests/auto/network/socket/qlocalsocket/example/server/server.pro
index bfd14d2bb7..b78e63d0a7 100644
--- a/tests/auto/network/socket/qlocalsocket/example/server/server.pro
+++ b/tests/auto/network/socket/qlocalsocket/example/server/server.pro
@@ -1,13 +1,5 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
CONFIG += console
QT = core network
-# Input
SOURCES += main.cpp
-
-
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index 70da67455e..2715bfc5dc 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -50,6 +50,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <unistd.h> // for unlink()
#endif
Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError)
diff --git a/tests/auto/other/atwrapper/atWrapper.pro b/tests/auto/other/atwrapper/atWrapper.pro
index 5dcbdb98ce..9de320b364 100644
--- a/tests/auto/other/atwrapper/atWrapper.pro
+++ b/tests/auto/other/atwrapper/atWrapper.pro
@@ -1,9 +1,6 @@
-# -*- Mode: makefile -*-
-
ARTHUR=$$QT_SOURCE_TREE/tests/arthur
COMMON_FOLDER = $$ARTHUR/common
include($$ARTHUR/arthurtester.pri)
-TEMPLATE = app
INCLUDEPATH += $$ARTHUR
DEFINES += SRCDIR=\\\"$$PWD\\\"
@@ -15,7 +12,6 @@ include($$ARTHUR/datagenerator/datagenerator.pri)
CONFIG += testcase
-# Input
HEADERS += atWrapper.h
SOURCES += atWrapperAutotest.cpp atWrapper.cpp
diff --git a/tests/auto/other/collections/tst_collections.cpp b/tests/auto/other/collections/tst_collections.cpp
index 9bfed15fc4..dc6d7f4b55 100644
--- a/tests/auto/other/collections/tst_collections.cpp
+++ b/tests/auto/other/collections/tst_collections.cpp
@@ -2124,11 +2124,10 @@ void tst_Collections::qstring()
QVERIFY(s.toAscii().isNull());
s = "ascii";
- s += (uchar) 0xb0;
+ s += QChar((uchar) 0xb0);
QVERIFY(s.toUtf8() != s.toLatin1());
- QString sa = s.toLatin1().constData();
- QVERIFY(sa[sa.length()-1] == (ushort) 0xb0);
- QVERIFY(sa.left(sa.length()-1) == "ascii");
+ QCOMPARE(s[s.length()-1].unicode(), (ushort)0xb0);
+ QVERIFY(s.left(s.length()-1) == "ascii");
QVERIFY(s == QString::fromUtf8(s.toUtf8().constData()));
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index 43e3788098..d72a04c8aa 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -268,9 +268,7 @@ namespace QtTestInternal
struct Getter {
static QMetaType::SaveOperator saveOp()
{
- typedef void(*SavePtr)(QDataStream &, const T *);
- SavePtr op = ::qMetaTypeSaveHelper<T>;
- return reinterpret_cast<QMetaType::SaveOperator>(op);
+ return ::qMetaTypeSaveHelper<T>;
}
};
diff --git a/tests/auto/other/languagechange/languagechange.pro b/tests/auto/other/languagechange/languagechange.pro
index efbc524556..b115c01641 100644
--- a/tests/auto/other/languagechange/languagechange.pro
+++ b/tests/auto/other/languagechange/languagechange.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
TARGET = tst_languagechange
-QT += widgets core-private testlib
+QT += widgets core-private gui-private testlib
SOURCES += tst_languagechange.cpp
diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp
index b4bd766df7..663f2ef798 100644
--- a/tests/auto/other/languagechange/tst_languagechange.cpp
+++ b/tests/auto/other/languagechange/tst_languagechange.cpp
@@ -43,13 +43,16 @@
#include <QtTest/QtTest>
#include <qapplication.h>
+#include <private/qguiapplication_p.h>
#include <QtCore/QSet>
#include <QtCore/QFile>
#include <QtCore/QTranslator>
#include <QtCore/QTemporaryDir>
#include <private/qthread_p.h>
+#include <QtGui/QPlatformTheme>
#include <QtWidgets/QInputDialog>
#include <QtWidgets/QColorDialog>
+#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QDesktopWidget>
@@ -66,12 +69,16 @@ private slots:
void retranslatability_data();
void retranslatability();
+private:
+ QDialogButtonBox::ButtonLayout m_layout;
};
-tst_languageChange::tst_languageChange()
-
+tst_languageChange::tst_languageChange() :
+ m_layout(QDialogButtonBox::WinLayout)
{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ m_layout = static_cast<QDialogButtonBox::ButtonLayout>(theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt());
}
void tst_languageChange::initTestCase()
@@ -240,6 +247,9 @@ void tst_languageChange::retranslatability()
QFETCH( int, dialogType);
QFETCH( TranslationSet, expected);
+ if (m_layout == QDialogButtonBox::GnomeLayout)
+ QSKIP("The input data are not suitable for this layout (QDialogButtonBox::GnomeLayout)");
+
// This will always be queried for when a language changes
expected.insert("QCoreApplication::QT_LAYOUT_DIRECTION::Translate this string to the string 'LTR' in left-to-right "
"languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to "
diff --git a/tests/auto/other/macgui/macgui.pro b/tests/auto/other/macgui/macgui.pro
index 5632450a3a..b7adbb470e 100644
--- a/tests/auto/other/macgui/macgui.pro
+++ b/tests/auto/other/macgui/macgui.pro
@@ -1,10 +1,6 @@
CONFIG += testcase
TARGET = tst_macgui
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
SOURCES += tst_macgui.cpp guitest.cpp
HEADERS += guitest.h
diff --git a/tests/auto/other/macnativeevents/macnativeevents.pro b/tests/auto/other/macnativeevents/macnativeevents.pro
index efe091f9f0..6ec0942222 100644
--- a/tests/auto/other/macnativeevents/macnativeevents.pro
+++ b/tests/auto/other/macnativeevents/macnativeevents.pro
@@ -1,7 +1,3 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Nov 29 22:24:47 2006
-######################################################################
-
CONFIG += testcase
TARGET = tst_macnativeevents
TEMPLATE = app
diff --git a/tests/auto/other/macplist/app/app.pro b/tests/auto/other/macplist/app/app.pro
index b4b895197c..9ccac831d0 100644
--- a/tests/auto/other/macplist/app/app.pro
+++ b/tests/auto/other/macplist/app/app.pro
@@ -1,12 +1,3 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Jan 7 13:01:11 2009
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += widgets
-# Input
SOURCES += main.cpp
-QT += widgets
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index 69fe00dc19..9ec5ea8e34 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -26,6 +26,8 @@ SUBDIRS=\
qtokenautomaton \
windowsmobile \
+testcocoon: SUBDIRS -= headersclean
+
cross_compile: SUBDIRS -= \
atwrapper \
compiler \
diff --git a/tests/auto/widgets/shared/platforminputcontext.h b/tests/auto/shared/platforminputcontext.h
index 759123a4a6..cddeca3945 100644
--- a/tests/auto/widgets/shared/platforminputcontext.h
+++ b/tests/auto/shared/platforminputcontext.h
@@ -50,8 +50,10 @@ public:
m_updateCallCount(0),
m_resetCallCount(0),
m_commitCallCount(0),
+ m_localeCallCount(0),
+ m_inputDirectionCallCount(0),
m_lastQueries(Qt::ImhNone),
- m_action(QInputPanel::Click),
+ m_action(QInputMethod::Click),
m_cursorPosition(0),
m_lastEventType(QEvent::None)
{}
@@ -66,7 +68,7 @@ public:
m_updateCallCount++;
m_lastQueries = queries;
}
- virtual void invokeAction(QInputPanel::Action action, int cursorPosition)
+ virtual void invokeAction(QInputMethod::Action action, int cursorPosition)
{
m_action = action;
m_cursorPosition = cursorPosition;
@@ -87,14 +89,26 @@ public:
{
return m_visible;
}
+ virtual QLocale locale() const
+ {
+ m_localeCallCount++;
+ return QLocale::c();
+ }
+ virtual Qt::LayoutDirection inputDirection() const
+ {
+ m_inputDirectionCallCount++;
+ return Qt::LeftToRight;
+ }
bool m_animating;
bool m_visible;
int m_updateCallCount;
int m_resetCallCount;
int m_commitCallCount;
+ mutable int m_localeCallCount;
+ mutable int m_inputDirectionCallCount;
Qt::InputMethodQueries m_lastQueries;
- QInputPanel::Action m_action;
+ QInputMethod::Action m_action;
int m_cursorPosition;
int m_lastEventType;
QRectF m_keyboardRect;
diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index 45b9c26824..ddafeea427 100644
--- a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -1406,8 +1406,7 @@ void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers()
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("Washington"));
QCOMPARE(model.data(model.index(0, 2)).toInt(), 7);
- //TODO: For some reson setting a record using manual submit fails
- //model.setEditStrategy(QSqlTableModel::OnManualSubmit);
+ model.setEditStrategy(QSqlTableModel::OnManualSubmit);
QSqlRecord recNew;
QSqlField f1New("id", QVariant::Int);
diff --git a/tests/auto/testlib/selftests/expected_silent.txt b/tests/auto/testlib/selftests/expected_silent.txt
new file mode 100644
index 0000000000..39e0bfc601
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_silent.txt
@@ -0,0 +1,9 @@
+Testing tst_Silent
+FAIL! : tst_Silent::fail() 'false' returned FALSE. (This test should fail)
+ Loc: [/home/jasmcdon/depot/qt5-test/qtbase/tests/auto/testlib/selftests/silent/tst_silent.cpp(73)]
+XPASS : tst_Silent::xpass() 'true' returned TRUE unexpectedly. (This test should XPASS)
+ Loc: [/home/jasmcdon/depot/qt5-test/qtbase/tests/auto/testlib/selftests/silent/tst_silent.cpp(85)]
+QFATAL : tst_Silent::messages() This is a fatal error message that should still appear in silent test output
+FAIL! : tst_Silent::messages() Received a fatal error.
+ Loc: [Unknown file(0)]
+Totals: 3 passed, 3 failed, 1 skipped
diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri
index 0809c4d497..1fc66e6364 100644
--- a/tests/auto/testlib/selftests/selftests.pri
+++ b/tests/auto/testlib/selftests/selftests.pri
@@ -30,6 +30,7 @@ SUBPROGRAMS = \
printdatatags \
printdatatagswithglobaltags \
qexecstringlist \
+ silent \
singleskip \
skip \
skipcleanup \
diff --git a/tests/auto/testlib/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc
index baa539a259..d05ac2a516 100644
--- a/tests/auto/testlib/selftests/selftests.qrc
+++ b/tests/auto/testlib/selftests/selftests.qrc
@@ -93,6 +93,7 @@
<file>expected_printdatatags.txt</file>
<file>expected_printdatatagswithglobaltags.txt</file>
<file>expected_qexecstringlist.txt</file>
+ <file>expected_silent.txt</file>
<file>expected_singleskip.lightxml</file>
<file>expected_singleskip.txt</file>
<file>expected_singleskip.xml</file>
diff --git a/tests/auto/testlib/selftests/silent/silent.pro b/tests/auto/testlib/selftests/silent/silent.pro
new file mode 100644
index 0000000000..3150f65a5e
--- /dev/null
+++ b/tests/auto/testlib/selftests/silent/silent.pro
@@ -0,0 +1,7 @@
+SOURCES += tst_silent.cpp
+QT = core testlib-private
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = silent
diff --git a/tests/auto/testlib/selftests/silent/tst_silent.cpp b/tests/auto/testlib/selftests/silent/tst_silent.cpp
new file mode 100644
index 0000000000..ec280f9f1a
--- /dev/null
+++ b/tests/auto/testlib/selftests/silent/tst_silent.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite 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 <QtCore/QCoreApplication>
+#include <QtTest/QtTest>
+#include <private/qtestlog_p.h>
+
+class tst_Silent : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void pass();
+ void skip();
+ void fail();
+ void xfail();
+ void xpass();
+
+ // This test function must be last, as it calls qFatal().
+ void messages();
+};
+
+void tst_Silent::pass()
+{
+ QVERIFY(true);
+}
+
+void tst_Silent::skip()
+{
+ QSKIP("This test should skip");
+}
+
+void tst_Silent::fail()
+{
+ QVERIFY2(false, "This test should fail");
+}
+
+void tst_Silent::xfail()
+{
+ QEXPECT_FAIL("", "This test should XFAIL", Abort);
+ QVERIFY(false);
+}
+
+void tst_Silent::xpass()
+{
+ QEXPECT_FAIL("", "This test should XPASS", Abort);
+ QVERIFY2(true, "This test should XPASS");
+}
+
+void tst_Silent::messages()
+{
+ qWarning("This is a warning that should not appear in silent test output");
+ QWARN("This is an internal testlib warning that should not appear in silent test output");
+ qDebug("This is a debug message that should not appear in silent test output");
+ qCritical("This is a critical message that should not appear in silent test output");
+ QTestLog::info("This is an internal testlib info message that should not appear in silent test output", __FILE__, __LINE__);
+ qFatal("This is a fatal error message that should still appear in silent test output");
+}
+
+QTEST_MAIN(tst_Silent)
+#include "tst_silent.moc"
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index decaa55386..2b90bdb389 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -155,7 +155,7 @@ static inline QString logFormat(const QString &logger)
// Return the log file name, or an empty string if the log goes to stdout.
static inline QString logName(const QString &logger)
{
- return (logger.startsWith("stdout") ? "" : "test_output." + logger);
+ return (logger.startsWith("stdout") ? "" : QString("test_output." + logger));
}
// Load the expected test output for the nominated test (subdir) and logger
@@ -354,6 +354,7 @@ void tst_Selftests::runSubTest_data()
<< "printdatatags"
<< "printdatatagswithglobaltags"
<< "qexecstringlist"
+ << "silent"
<< "singleskip"
<< "skip"
<< "skipcleanup"
@@ -409,6 +410,9 @@ void tst_Selftests::runSubTest_data()
else if (subtest == "printdatatagswithglobaltags") {
arguments << "-datatags";
}
+ else if (subtest == "silent") {
+ arguments << "-silent";
+ }
// These tests don't work right unless logging plain text to
@@ -434,6 +438,9 @@ void tst_Selftests::runSubTest_data()
if (subtest == "printdatatagswithglobaltags") {
continue;
}
+ if (subtest == "silent") {
+ continue;
+ }
// `crashes' will not output valid XML on platforms without a crash handler
if (subtest == "crashes") {
continue;
diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp
index d2cb9f2435..97c640b28f 100644
--- a/tests/auto/tools/qmake/testcompiler.cpp
+++ b/tests/auto/tools/qmake/testcompiler.cpp
@@ -126,7 +126,13 @@ TestCompiler::~TestCompiler()
{
}
-bool TestCompiler::runCommand( QString cmdline )
+bool TestCompiler::errorOut()
+{
+ qDebug(qPrintable(testOutput_.join("\n")));
+ return false;
+}
+
+bool TestCompiler::runCommand( QString cmdline, bool expectFail )
{
testOutput_.append("Running command: " + cmdline);
@@ -137,21 +143,21 @@ bool TestCompiler::runCommand( QString cmdline )
child.start(cmdline);
if (!child.waitForStarted(-1)) {
testOutput_.append( "Unable to start child process." );
- return false;
+ return errorOut();
}
- bool failed = false;
child.setReadChannel(QProcess::StandardError);
child.waitForFinished(-1);
+ bool ok = child.exitStatus() == QProcess::NormalExit && (expectFail ^ (child.exitCode() == 0));
foreach (const QByteArray &output, child.readAllStandardError().split('\n')) {
testOutput_.append(QString::fromLocal8Bit(output));
if (output.startsWith("Project MESSAGE: FAILED"))
- failed = true;
+ ok = false;
}
- return !failed && child.exitStatus() == QProcess::NormalExit && child.exitCode() == 0;
+ return ok ? true : errorOut();
}
void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd )
@@ -160,6 +166,18 @@ void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd )
qmakeCmd_ = qmakeCmd;
}
+void TestCompiler::resetArguments()
+{
+ makeArgs_.clear();
+ qmakeArgs_.clear();
+}
+
+void TestCompiler::setArguments( QString makeArgs, QString qmakeArgs )
+{
+ makeArgs_ = makeArgs;
+ qmakeArgs_ = qmakeArgs;
+}
+
void TestCompiler::resetEnvironment()
{
environment_.clear();
@@ -175,7 +193,7 @@ bool TestCompiler::makeClean( const QString &workPath )
QDir D;
if (!D.exists(workPath)) {
testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
- return false;
+ return errorOut();
}
D.setCurrent(workPath);
@@ -192,7 +210,7 @@ bool TestCompiler::makeDistClean( const QString &workPath )
QDir D;
if (!D.exists(workPath)) {
testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
- return false;
+ return errorOut();
}
D.setCurrent(workPath);
@@ -222,21 +240,21 @@ bool TestCompiler::qmake( const QString &workDir, const QString &proName, const
makeFile += "Makefile";
// Now start qmake and generate the makefile
- return runCommand( qmakeCmd_ + " " + projectFile + " -o " + makeFile );
+ return runCommand( qmakeCmd_ + " " + qmakeArgs_ + " " + projectFile + " -o " + makeFile );
}
-bool TestCompiler::make( const QString &workPath, const QString &target )
+bool TestCompiler::make( const QString &workPath, const QString &target, bool expectFail )
{
QDir D;
D.setCurrent( workPath );
- QString cmdline = makeCmd_;
+ QString cmdline = makeCmd_ + " " + makeArgs_;
if ( cmdline.contains("nmake", Qt::CaseInsensitive) )
cmdline.append(" /NOLOGO");
if ( !target.isEmpty() )
cmdline += " " + target;
- return runCommand( cmdline );
+ return runCommand( cmdline, expectFail );
}
bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version )
diff --git a/tests/auto/tools/qmake/testcompiler.h b/tests/auto/tools/qmake/testcompiler.h
index 116e424551..8aed3a9987 100644
--- a/tests/auto/tools/qmake/testcompiler.h
+++ b/tests/auto/tools/qmake/testcompiler.h
@@ -55,6 +55,10 @@ public:
virtual ~TestCompiler();
void setBaseCommands( QString makeCmd, QString qmakeCmd );
+
+ void resetArguments();
+ void setArguments( QString makeArgs, QString qmakeArgs );
+
void resetEnvironment();
void addToEnvironment( QString varAssignment );
@@ -65,7 +69,7 @@ public:
// executes a qmake on proName in the specified workDir, output goes to buildDir or workDir if it's null
bool qmake( const QString &workDir, const QString &proName, const QString &buildDir = QString() );
// executes a make in the specified workPath, with an optional target (eg. install)
- bool make( const QString &workPath, const QString &target = QString() );
+ bool make( const QString &workPath, const QString &target = QString(), bool expectFail = false );
// checks if the executable exists in destDir
bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version );
// removes the makefile
@@ -76,13 +80,13 @@ public:
void clearCommandOutput();
private:
- bool runCommand( QString cmdLine );
+ bool runCommand( QString cmdLine, bool expectFail = false );
+ bool errorOut();
- QString makeCmd_;
- QString qmakeCmd_;
+ QString makeCmd_, makeArgs_;
+ QString qmakeCmd_, qmakeArgs_;
QStringList environment_;
- // need to make this available somewhere
QStringList testOutput_;
};
diff --git a/tests/auto/tools/qmake/testdata/bundle-spaces/bundle-spaces.pro b/tests/auto/tools/qmake/testdata/bundle-spaces/bundle-spaces.pro
index 644a817a8e..e4f81e6e1e 100644
--- a/tests/auto/tools/qmake/testdata/bundle-spaces/bundle-spaces.pro
+++ b/tests/auto/tools/qmake/testdata/bundle-spaces/bundle-spaces.pro
@@ -1,9 +1,3 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
SOURCES += main.cpp
QWERTY_BUNDLE.version = Bogus.78
diff --git a/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro b/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro
index 43577b5122..442c9c767f 100644
--- a/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro
+++ b/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro
@@ -1,10 +1,5 @@
-TEMPLATE = app
-TARGET = findDeps
-DEPENDPATH += .
-INCLUDEPATH += .
DESTDIR = ./
-# Input
HEADERS += object1.h \
object2.h \
object3.h \
diff --git a/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro b/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
index 1469b4c5c3..a4a7dc987d 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
+++ b/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
@@ -1,9 +1,4 @@
-TEMPLATE = app
-TARGET = findMocs
-DEPENDPATH += .
-INCLUDEPATH += .
DESTDIR = ./
-# Input
HEADERS += object1.h object2.h object3.h object4.h object5.h object6.h object7.h
SOURCES += main.cpp
diff --git a/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro b/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro
index 7f22f437c2..13d4d6c4ad 100644
--- a/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro
+++ b/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro
@@ -6,7 +6,9 @@ SOURCES = main.cpp
RCCINPUT = "rc folder/test.qrc"
RCCOUTPUT = test.cpp
-rcc_test.commands = rcc -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+qtPrepareTool(QMAKE_RCC, rcc)
+
+rcc_test.commands = $$QMAKE_RCC -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
rcc_test.output = $$RCCOUTPUT
rcc_test.input = RCCINPUT
rcc_test.variable_out = SOURCES
diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp
index 4da781f763..88ff10a764 100644
--- a/tests/auto/tools/qmake/tst_qmake.cpp
+++ b/tests/auto/tools/qmake/tst_qmake.cpp
@@ -57,7 +57,6 @@ public:
public slots:
void initTestCase();
void cleanupTestCase();
- void init();
void cleanup();
private slots:
@@ -131,13 +130,10 @@ void tst_qmake::cleanupTestCase()
{
}
-void tst_qmake::init()
-{
- test_compiler.clearCommandOutput();
-}
-
void tst_qmake::cleanup()
{
+ test_compiler.resetArguments();
+ test_compiler.resetEnvironment();
test_compiler.clearCommandOutput();
}
@@ -305,7 +301,6 @@ void tst_qmake::export_across_file_boundaries()
test_compiler.addToEnvironment("QMAKEFEATURES=.");
QString workDir = base_path + "/testdata/export_across_file_boundaries";
QVERIFY( test_compiler.qmake( workDir, "foo" ));
- test_compiler.resetEnvironment();
}
void tst_qmake::include_dir()
@@ -448,31 +443,30 @@ void tst_qmake::bundle_spaces()
{
QString workDir = base_path + "/testdata/bundle-spaces";
- // We set up alternate commands here, to make sure we're testing Mac
+ // We set up alternate arguments here, to make sure we're testing Mac
// Bundles and since this might be the wrong output we rely on dry-running
// make (-n).
- TestCompiler local_tc;
- local_tc.setBaseCommands("make -n", "qmake -macx -spec macx-g++");
+ test_compiler.setArguments("-n", "-spec macx-g++");
- QVERIFY( local_tc.qmake(workDir, "bundle-spaces") );
+ QVERIFY( test_compiler.qmake(workDir, "bundle-spaces") );
TempFile non_existing_file(workDir + "/non-existing file");
QVERIFY( !non_existing_file.exists() );
// Make fails: no rule to make "non-existing file"
- QVERIFY( !local_tc.make(workDir) );
+ QVERIFY( test_compiler.make(workDir, QString(), true) );
QVERIFY( non_existing_file.open(QIODevice::WriteOnly) );
QVERIFY( non_existing_file.exists() );
// Aha!
- QVERIFY( local_tc.make(workDir) );
+ QVERIFY( test_compiler.make(workDir) );
// Cleanup
QVERIFY( non_existing_file.remove() );
QVERIFY( !non_existing_file.exists() );
- QVERIFY( local_tc.removeMakefile(workDir) );
+ QVERIFY( test_compiler.removeMakefile(workDir) );
}
#endif // Q_OS_WIN
diff --git a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro
index 730932d83d..b4cf05e347 100644
--- a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro
+++ b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro
@@ -1,10 +1,7 @@
CONFIG += testcase
TEMPLATE = app
TARGET = tst_qerrormessage
-DEPENDPATH += .
-INCLUDEPATH += .
QT += widgets testlib
-# Input
SOURCES += tst_qerrormessage.cpp
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 7ab3100cab..4a6f714a7c 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -489,6 +489,9 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior()
{
+#ifdef Q_OS_MAC
+ QSKIP("This test currently fails on Mac OS X, see QTBUG-23602");
+#endif
QDir current = QDir::currentPath();
current.mkdir("test");
current.cd("test");
@@ -515,9 +518,6 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior()
QTest::keyClick(list, Qt::Key_Down);
QTest::keyClick(list, Qt::Key_Return);
QTest::qWait(200);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "This test currently fails on Mac OS X, see QTBUG-23602", Continue);
-#endif
QCOMPARE(fd.isVisible(), true);
QTest::qWait(200);
file.close();
diff --git a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro
index f25ed650c3..91848fee24 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro
+++ b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro
@@ -1,9 +1,6 @@
-CONFIG += testcase
TEMPLATE = app
TARGET = tst_qmessagebox
-QT += widgets testlib
-DEPENDPATH += .
-INCLUDEPATH += .
+QT += gui-private core-private widgets testlib
+CONFIG += testcase
-# Input
SOURCES += tst_qmessagebox.cpp
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 7fc752488d..1d391a1c09 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -48,6 +48,8 @@
#include <QApplication>
#include <QPushButton>
#include <QDialogButtonBox>
+#include <QPlatformTheme>
+#include <private/qguiapplication_p.h>
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
#include <QMacStyle>
#endif
@@ -407,15 +409,12 @@ void tst_QMessageBox::staticSourceCompat()
sendKeySoon();
ret = QMessageBox::information(0, "title", "text", QMessageBox::Yes, QMessageBox::No);
int expectedButton = int(QMessageBox::Yes);
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(qApp->style()))
- expectedButton = int(QMessageBox::No);
-#elif !defined(QT_NO_STYLE_CLEANLOOKS)
- if (qobject_cast<QCleanlooksStyle *>(qApp->style())) {
- QEXPECT_FAIL("", "Special handling of QMessageBox::information buttons for Cleanlooks not implemented yet, QTBUG-24315", Continue);
- expectedButton = int(QMessageBox::No);
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
+ const int dialogButtonBoxLayout = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
+ if (dialogButtonBoxLayout == QDialogButtonBox::MacLayout
+ || dialogButtonBoxLayout == QDialogButtonBox::GnomeLayout)
+ expectedButton = int(QMessageBox::No);
}
-#endif
QCOMPARE(ret, expectedButton);
QCOMPARE(keyToSend, -1);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 3257e7efea..220c89ec2f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -51,7 +51,7 @@
#include <private/qgraphicssceneindex_p.h>
#include <math.h>
#include "../../../gui/painting/qpathclipper/pathcompare.h"
-#include "../../shared/platforminputcontext.h"
+#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 7ceeaaa0d3..84dea04c45 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -71,7 +71,7 @@
#include <QtWidgets/QDesktopWidget>
#include <private/qgraphicsview_p.h>
#include "../../../platformquirks.h"
-#include "../../shared/platforminputcontext.h"
+#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
Q_DECLARE_METATYPE(QList<int>)
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 4dd57e1b90..3edc125b5a 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -205,6 +205,7 @@ private slots:
void QTBUG12268_hiddenMovedSectionSorting();
void QTBUG14242_hideSectionAutoSize();
void ensureNoIndexAtLength();
+ void offsetConsistent();
void initialSortOrderRole();
@@ -2168,6 +2169,33 @@ void tst_QHeaderView::ensureNoIndexAtLength()
QVERIFY(hv->visualIndexAt(hv->length()) == -1);
}
+void tst_QHeaderView::offsetConsistent()
+{
+ // Ensure that a hidden section 'far away'
+ // does not affect setOffsetToSectionPosition ..
+ const int sectionToHide = 513;
+ QTableView qtv;
+ QStandardItemModel amodel(1000, 4);
+ qtv.setModel(&amodel);
+ QHeaderView *hv = qtv.verticalHeader();
+ for (int u = 0; u < 100; u += 2)
+ hv->resizeSection(u, 0);
+ hv->setOffsetToSectionPosition(150);
+ int offset1 = hv->offset();
+ hv->hideSection(sectionToHide);
+ hv->setOffsetToSectionPosition(150);
+ int offset2 = hv->offset();
+ QVERIFY(offset1 == offset2);
+ // Ensure that hidden indexes (still) is considered.
+ hv->resizeSection(sectionToHide, hv->sectionSize(200) * 2);
+ hv->setOffsetToSectionPosition(800);
+ offset1 = hv->offset();
+ hv->showSection(sectionToHide);
+ hv->setOffsetToSectionPosition(800);
+ offset2 = hv->offset();
+ QVERIFY(offset2 > offset1);
+}
+
void tst_QHeaderView::initialSortOrderRole()
{
QTableView view; // ### Shadowing member view (of type QHeaderView)
diff --git a/tests/auto/widgets/itemviews/qtableview/qtableview.pro b/tests/auto/widgets/itemviews/qtableview/qtableview.pro
index 528fa7d014..889caaf3c8 100644
--- a/tests/auto/widgets/itemviews/qtableview/qtableview.pro
+++ b/tests/auto/widgets/itemviews/qtableview/qtableview.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-
+TARGET = tst_qtableview
QT += widgets widgets-private testlib
QT += core-private gui-private
diff --git a/tests/auto/widgets/kernel/qaction/qaction.pro b/tests/auto/widgets/kernel/qaction/qaction.pro
index e6f0735394..c57107b1b0 100644
--- a/tests/auto/widgets/kernel/qaction/qaction.pro
+++ b/tests/auto/widgets/kernel/qaction/qaction.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qaction
-QT += widgets testlib
+QT += gui-private core-private widgets testlib
SOURCES += tst_qaction.cpp
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 47aad21074..51123af953 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -46,6 +46,8 @@
#include <qevent.h>
#include <qaction.h>
#include <qmenu.h>
+#include <qplatformtheme_qpa.h>
+#include <private/qguiapplication_p.h>
class tst_QAction : public QObject
{
@@ -77,6 +79,7 @@ private slots:
private:
int m_lastEventType;
+ int m_keyboardScheme;
QAction *m_lastAction;
QWidget *m_tstWidget;
};
@@ -121,8 +124,10 @@ private:
tst_QAction *tst;
};
-tst_QAction::tst_QAction()
+tst_QAction::tst_QAction() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme)
{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
}
tst_QAction::~tst_QAction()
@@ -237,13 +242,21 @@ void tst_QAction::setStandardKeys()
QVERIFY(act.shortcut() == act.shortcuts().first());
QList<QKeySequence> expected;
-#if defined(Q_OS_MAC)
- expected << QKeySequence("CTRL+C");
-#else
- expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT");
-#endif
-// Qt/Embedded on Windows: expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT");
- QVERIFY(act.shortcuts() == expected);
+ const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
+ const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT"));
+ switch (m_keyboardScheme) {
+ case QPlatformTheme::MacKeyboardScheme:
+ expected << ctrlC;
+ break;
+ case QPlatformTheme::WindowsKeyboardScheme:
+ expected << ctrlC << ctrlInsert;
+ break;
+ default: // X11
+ expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert;
+ break;
+ }
+
+ QCOMPARE(act.shortcuts(), expected);
}
diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro
index 3b229e31cb..97768eac74 100644
--- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro
+++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro
@@ -1,15 +1,6 @@
-######################################################################
-# Automatically generated by qmake (2.00a) Mon Jul 11 11:30:34 2005
-######################################################################
+QT += widgets
+CONFIG -= app_bundle
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
DESTDIR = ./
-# Input
-QT += widgets
SOURCES += main.cpp
-CONFIG += qt warn_on create_prl link_prl
-CONFIG -= app_bundle
-
diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro
index 5a18a70d9e..842fd11062 100644
--- a/tests/auto/widgets/styles/qstyle/qstyle.pro
+++ b/tests/auto/widgets/styles/qstyle/qstyle.pro
@@ -1,4 +1,5 @@
CONFIG += testcase
+TARGET = tst_qstyle
TARGET.EPOCHEAPSIZE = 0x200000 0x800000
QT += widgets testlib
SOURCES += tst_qstyle.cpp
diff --git a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro
index cadc6d6ddc..bf12a6b30f 100644
--- a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro
+++ b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro
@@ -1,12 +1,7 @@
-######################################################################
-# Automatically generated by qmake (2.00a) ti 8. mar 16:20:21 2005
-######################################################################
+TEMPLATE = app
+TARGET = tst_qstyleoption
CONFIG += testcase
-TARGET = tst_qstyleoption
-TEMPLATE = app
QT += widgets testlib
-# Input
-SOURCES += tst_qstyleoption.cpp
-
+SOURCES += tst_qstyleoption.cpp
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro
index f908c3ab7d..dd17183b30 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro
+++ b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro
@@ -1,10 +1,10 @@
CONFIG += testcase
TARGET = tst_qstylesheetstyle
-QT += widgets widgets-private testlib
-QT += gui-private
-# Input
+QT += widgets widgets-private gui-private testlib
+
SOURCES += tst_qstylesheetstyle.cpp
RESOURCES += resources.qrc
+
requires(contains(QT_CONFIG,private_tests))
win32:CONFIG += insignificant_test # QTBUG-24323
diff --git a/tests/auto/widgets/util/qcompleter/qcompleter.pro b/tests/auto/widgets/util/qcompleter/qcompleter.pro
index 63b137eb7c..6a817a89ac 100644
--- a/tests/auto/widgets/util/qcompleter/qcompleter.pro
+++ b/tests/auto/widgets/util/qcompleter/qcompleter.pro
@@ -2,10 +2,7 @@ CONFIG += testcase
TEMPLATE = app
TARGET = tst_qcompleter
QT += widgets testlib
-DEPENDPATH += .
-INCLUDEPATH += . ..
-# Input
SOURCES += tst_qcompleter.cpp
CONFIG += insignificant_test # QTBUG-21424
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 7cc043e247..f9eb8b6159 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -43,6 +43,8 @@
#include "qcombobox.h"
#include <private/qcombobox_p.h>
+#include <private/qguiapplication_p.h>
+#include <qplatformtheme_qpa.h>
#include <qfontcombobox.h>
#include <qdesktopwidget.h>
@@ -1915,19 +1917,15 @@ void tst_QComboBox::itemListPosition()
QWidget topLevel;
QFontComboBox combo(&topLevel);
- //the code to get the avaialbe screen space is copied from QComboBox code
+ //the code to get the available screen space is copied from QComboBox code
const int scrNumber = QApplication::desktop()->screenNumber(&combo);
- QRect screen;
-#ifdef Q_WS_WIN
- screen = QApplication::desktop()->screenGeometry(scrNumber);
-#elif defined Q_WS_X11
- if (X11->desktopEnvironment == DE_KDE)
- screen = QApplication::desktop()->screenGeometry(scrNumber);
- else
- screen = QApplication::desktop()->availableGeometry(scrNumber);
-#else
- screen = QApplication::desktop()->availableGeometry(scrNumber);
-#endif
+
+ bool useFullScreenForPopupMenu = false;
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();
+ const QRect screen = useFullScreenForPopupMenu ?
+ QApplication::desktop()->screenGeometry(scrNumber) :
+ QApplication::desktop()->availableGeometry(scrNumber);
combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo to the top-right corner
diff --git a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro
index 77b2ae537c..83f93f0ba0 100644
--- a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro
+++ b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro
@@ -1,6 +1,7 @@
CONFIG += testcase
TARGET = tst_qlineedit
-QT += widgets testlib
+QT += gui-private core-private widgets testlib
SOURCES += tst_qlineedit.cpp
-CONFIG += insignificant_test # QTBUG-21402
+# QTBUG-24518 - unstable test
+linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 645f47fc72..81dc940c00 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -48,6 +48,8 @@
#include "qvalidator.h"
#include "qcompleter.h"
#include "qstandarditemmodel.h"
+#include "qplatformtheme_qpa.h"
+#include <private/qguiapplication_p.h>
#ifndef QT_NO_CLIPBOARD
#include "qclipboard.h"
@@ -300,6 +302,7 @@ private:
int lastCursorPos;
int newCursorPos;
QLineEdit *testWidget;
+ int m_keyboardScheme;
};
typedef QList<int> IntList;
@@ -327,9 +330,16 @@ void tst_QLineEdit::getSetCheck()
QCOMPARE(true, obj1.dragEnabled());
}
-tst_QLineEdit::tst_QLineEdit()
+tst_QLineEdit::tst_QLineEdit() : validInput(false), m_keyboardScheme(0)
{
- validInput = false;
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
+ // Generalize for X11
+ if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme
+ || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
+ || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme) {
+ m_keyboardScheme = QPlatformTheme::X11KeyboardScheme;
+ }
}
tst_QLineEdit::~tst_QLineEdit()
@@ -1071,25 +1081,26 @@ void tst_QLineEdit::undo()
QVERIFY(!testWidget->isUndoAvailable());
QVERIFY(testWidget->text().isEmpty());
-#ifdef Q_WS_WIN
- // Repeat the test using shortcut instead of undo()
- for (i=0; i<insertString.size(); ++i) {
- if (insertIndex[i] > -1)
- testWidget->setCursorPosition(insertIndex[i]);
- if (insertMode[i] == REPLACE_UNTIL_END) {
- testWidget->setSelection(insertIndex[i], 8);
+
+ if (m_keyboardScheme == QPlatformTheme::WindowsKeyboardScheme) {
+ // Repeat the test using shortcut instead of undo()
+ for (i=0; i<insertString.size(); ++i) {
+ if (insertIndex[i] > -1)
+ testWidget->setCursorPosition(insertIndex[i]);
+ if (insertMode[i] == REPLACE_UNTIL_END)
+ testWidget->setSelection(insertIndex[i], 8);
+ if (use_keys)
+ QTest::keyClicks(testWidget, insertString[i]);
+ else
+ testWidget->insert(insertString[i]);
+ }
+ for (i=0; i<expectedString.size()-1; ++i) {
+ QCOMPARE(testWidget->text(), expectedString[i]);
+ QVERIFY(testWidget->isUndoAvailable());
+ QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier);
}
- if (use_keys)
- QTest::keyClicks(testWidget, insertString[i]);
- else
- testWidget->insert(insertString[i]);
- }
- for (i=0; i<expectedString.size()-1; ++i) {
- QCOMPARE(testWidget->text(), expectedString[i]);
- QVERIFY(testWidget->isUndoAvailable());
- QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier);
}
-#endif
+
}
void tst_QLineEdit::redo_data()
@@ -1152,21 +1163,22 @@ void tst_QLineEdit::redo()
QVERIFY(!testWidget->isRedoAvailable());
-#ifdef Q_WS_WIN
- // repeat test, this time using shortcuts instead of undo()/redo()
- while (!testWidget->text().isEmpty())
- QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier);
+ if (m_keyboardScheme == QPlatformTheme::WindowsKeyboardScheme) {
+ // repeat test, this time using shortcuts instead of undo()/redo()
- for (i = 0; i < expectedString.size(); ++i) {
- QVERIFY(testWidget->isRedoAvailable());
- QTest::keyClick(testWidget, Qt::Key_Backspace,
- Qt::ShiftModifier | Qt::AltModifier);
- QCOMPARE(testWidget->text() , expectedString[i]);
- }
+ while (!testWidget->text().isEmpty())
+ QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier);
- QVERIFY(!testWidget->isRedoAvailable());
-#endif
+ for (i = 0; i < expectedString.size(); ++i) {
+ QVERIFY(testWidget->isRedoAvailable());
+ QTest::keyClick(testWidget, Qt::Key_Backspace,
+ Qt::ShiftModifier | Qt::AltModifier);
+ QCOMPARE(testWidget->text() , expectedString[i]);
+ }
+
+ QVERIFY(!testWidget->isRedoAvailable());
+ }
}
void tst_QLineEdit::undo_keypressevents_data()
@@ -1263,7 +1275,7 @@ void tst_QLineEdit::undo_keypressevents_data()
// unselect any current selection
keys.addKeyClick(Qt::Key_Right);
-#ifdef Q_WS_WIN //Mac has a specialcase to handle jumping to the end of a selection
+#ifdef Q_OS_WIN //Mac has a specialcase to handle jumping to the end of a selection
keys.addKeyClick(Qt::Key_Left);
#endif
@@ -3080,6 +3092,7 @@ void tst_QLineEdit::leftKeyOnSelectedText()
#ifdef Q_OS_WIN
QCOMPARE(testWidget->cursorPosition(), 1);
#else
+ // Selection is cleared ands cursor remains at position 2.
// X11 used to behave like window prior to 4.2. Changes caused by QKeySequence
// resulted in an inadvertant change in behavior
QCOMPARE(testWidget->cursorPosition(), 2);
@@ -3603,6 +3616,9 @@ void tst_QLineEdit::taskQTBUG_7902_contextMenuCrash()
void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
{
+#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__)
+ QSKIP("QTBUG-24518 - Unstable test for Ubuntu 11.10");
+#endif
//ReadOnly QLineEdit should not intercept shortcut.
QLineEdit le;
le.setReadOnly(true);
@@ -3624,9 +3640,8 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
{
-#ifndef Q_WS_X11
- QSKIP("Only tested on X11");
-#endif
+ if (m_keyboardScheme != QPlatformTheme::X11KeyboardScheme)
+ QSKIP("Only tested on X11");
QLineEdit le;
le.setText(" ");
QPalette p = le.palette();
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 13540355c7..0f07546559 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -101,6 +101,7 @@ private slots:
void centralWidgetSize();
void dockWidgetSize();
void QTBUG2774_stylechange();
+ void QTBUG15080_restoreState();
void toggleUnifiedTitleAndToolBarOnMac();
};
@@ -1705,6 +1706,41 @@ void tst_QMainWindow::QTBUG2774_stylechange()
}
}
+void tst_QMainWindow::QTBUG15080_restoreState()
+{
+ QByteArray state;
+
+ //save state
+ {
+ QMainWindow mw1;
+ QDockWidget * dw1 = new QDockWidget();
+ dw1->setObjectName("Left DockWidget");
+ mw1.addDockWidget(Qt::LeftDockWidgetArea, dw1);
+ mw1.setCentralWidget(new QTextEdit());
+ mw1.show();
+ QApplication::processEvents();
+ dw1->setFixedWidth(101);
+ QApplication::processEvents();
+
+ state = mw1.saveState();
+ }
+
+ //restore state
+
+ QMainWindow mw2;
+ QDockWidget * dw2 = new QDockWidget();
+ dw2->setObjectName("Left DockWidget");
+ mw2.addDockWidget(Qt::LeftDockWidgetArea, dw2);
+ mw2.setCentralWidget(new QTextEdit());
+ mw2.restoreState(state);
+ //QTBUG15080 caused by setStyleSheet
+ mw2.setStyleSheet("color:red");
+ mw2.show();
+ QApplication::processEvents();
+
+ QCOMPARE(dw2->width(), 101);
+}
+
void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac()
{
#ifdef Q_OS_MAC
diff --git a/tests/auto/widgets/widgets/qmenu/qmenu.pro b/tests/auto/widgets/widgets/qmenu/qmenu.pro
index 55099f1c54..9efd0302bf 100644
--- a/tests/auto/widgets/widgets/qmenu/qmenu.pro
+++ b/tests/auto/widgets/widgets/qmenu/qmenu.pro
@@ -3,4 +3,3 @@ TARGET = tst_qmenu
QT += widgets testlib
SOURCES += tst_qmenu.cpp
-win32:CONFIG += insignificant_test # QTBUG-24325
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 9989e5e7aa..6a1f418739 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -50,10 +50,6 @@
#include <qaction.h>
#include <qstyleoption.h>
-#ifdef Q_WS_WIN
-#include <windows.h>
-#endif
-
#include <qobject.h>
QT_FORWARD_DECLARE_CLASS(QMainWindow)
diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png
index ced6eb6e5b..b9df19eeb3 100644
--- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png
+++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png
index 481b99c7fc..792593ff12 100644
--- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png
+++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png
index 292d3f9d4c..02e5e93380 100644
--- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png
+++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png
index 69b72ede09..5ef32d2d19 100644
--- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png
+++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png
index 467b91e6e0..d877e1b656 100644
--- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png
+++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png
index cce921b0cc..411c0859aa 100644
--- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png
+++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png
index 937494ac3c..55d060af1f 100644
--- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png
+++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png
Binary files differ
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index d79044157a..1533e6a139 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -1845,7 +1845,7 @@ void tst_QDom::checkIntOverflow() const
QVERIFY(doc.setContent(xmlMessage));
const QDomNodeList nl(doc.elementsByTagName(QLatin1String("test")));
- QCOMPARE(nl.length(), uint(1));
+ QCOMPARE(nl.length(), 1);
}
}
diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.pro b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.pro
index 93167f81c8..f801200942 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.pro
+++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.pro
@@ -1,15 +1,4 @@
-######################################################################
-# Automatically generated by qmake (1.06a) Thu Jun 5 19:00:42 2003
-######################################################################
-
-TEMPLATE = app
-INCLUDEPATH += .
+QT += xml
-# Input
HEADERS += parser.h
SOURCES += main.cpp parser.cpp
-
-CONFIG += qt warn_on debug
-QT += xml
-
-
diff --git a/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro b/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro
index cec33ded18..dc579ab742 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro
+++ b/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro
@@ -4,7 +4,6 @@ TEMPLATE = app
DEPENDPATH += parser
INCLUDEPATH += . parser
-# Input
HEADERS += parser/parser.h
SOURCES += tst_qxmlsimplereader.cpp parser/parser.cpp
diff --git a/tests/benchmarks/corelib/io/qdir/10000/10000.pro b/tests/benchmarks/corelib/io/qdir/10000/10000.pro
index 0319f2c195..196b3b5b30 100644
--- a/tests/benchmarks/corelib/io/qdir/10000/10000.pro
+++ b/tests/benchmarks/corelib/io/qdir/10000/10000.pro
@@ -1,9 +1,6 @@
TEMPLATE = app
TARGET = bench_qdir_10000
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
SOURCES += bench_qdir_10000.cpp
QT = core testlib
diff --git a/tests/benchmarks/corelib/io/qdir/tree/tree.pro b/tests/benchmarks/corelib/io/qdir/tree/tree.pro
index 415580cc46..2998a13b57 100644
--- a/tests/benchmarks/corelib/io/qdir/tree/tree.pro
+++ b/tests/benchmarks/corelib/io/qdir/tree/tree.pro
@@ -1,9 +1,6 @@
TEMPLATE = app
TARGET = bench_qdir_tree
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
SOURCES += bench_qdir_tree.cpp
RESOURCES += bench_qdir_tree.qrc
diff --git a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro
index 0dca21c1a8..42e8708b02 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro
+++ b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro
@@ -1,13 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qfileinfo
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
-
QT += core-private testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro b/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro
index 0dff0ce86e..20b02d190a 100644
--- a/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro
+++ b/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro
@@ -1,12 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qiodevice
TARGET.EPOCHEAPSIZE = 0x100000 0x2000000
-DEPENDPATH += .
-INCLUDEPATH += .
QT = core testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro
index 6ebee8a659..758930c139 100644
--- a/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro
+++ b/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro
@@ -1,11 +1,8 @@
TEMPLATE = app
TARGET = tst_bench_qtemporaryfile
-DEPENDPATH += .
-INCLUDEPATH += .
QT = core testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/kernel/events/events.pro b/tests/benchmarks/corelib/kernel/events/events.pro
index fb50116495..798a880e5b 100644
--- a/tests/benchmarks/corelib/kernel/events/events.pro
+++ b/tests/benchmarks/corelib/kernel/events/events.pro
@@ -1,7 +1,6 @@
TEMPLATE = app
TARGET = tst_bench_events
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
-SOURCES += main.cpp
+
QT = core testlib
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro
index 2c29fafca4..6896b3ff55 100644
--- a/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro
+++ b/tests/benchmarks/corelib/kernel/qcoreapplication/qcoreapplication.pro
@@ -2,8 +2,5 @@ QT += testlib
TEMPLATE = app
TARGET = tst_bench_qcoreapplication
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/kernel/qobject/qobject.pro b/tests/benchmarks/corelib/kernel/qobject/qobject.pro
index 8edd038b0d..e611eff0a2 100644
--- a/tests/benchmarks/corelib/kernel/qobject/qobject.pro
+++ b/tests/benchmarks/corelib/kernel/qobject/qobject.pro
@@ -2,9 +2,6 @@ QT += widgets testlib
TEMPLATE = app
TARGET = tst_bench_qobject
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
HEADERS += object.h
SOURCES += main.cpp object.cpp
diff --git a/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro b/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro
index 940973d8db..49edcbee70 100644
--- a/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro
+++ b/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro
@@ -1,8 +1,6 @@
TEMPLATE = app
TARGET = tst_bench_containers-associative
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
-SOURCES += main.cpp
QT = core testlib
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro b/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro
index 0ae83d70f7..6f731cb6d8 100644
--- a/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro
+++ b/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro
@@ -1,8 +1,6 @@
TEMPLATE = app
TARGET = tst_bench_containers-sequential
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
-SOURCES += main.cpp
QT = core testlib
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro b/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro
index 10fdc7261e..23d8dae18f 100644
--- a/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro
+++ b/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro
@@ -1,11 +1,7 @@
TEMPLATE = app
TARGET = tst_bench_qbytearray
-DEPENDPATH += .
-INCLUDEPATH += .
QT = core testlib
-
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/tools/qrect/qrect.pro b/tests/benchmarks/corelib/tools/qrect/qrect.pro
index b05483599e..42cfcd8924 100644
--- a/tests/benchmarks/corelib/tools/qrect/qrect.pro
+++ b/tests/benchmarks/corelib/tools/qrect/qrect.pro
@@ -1,11 +1,7 @@
TEMPLATE = app
TARGET = tst_bench_qrect
-DEPENDPATH += .
-INCLUDEPATH += .
QT = core testlib
-
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro
index b427150041..59e7d19244 100644
--- a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro
+++ b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro
@@ -1,14 +1,10 @@
TEMPLATE = app
TARGET = tst_bench_qregexp
-DEPENDPATH += .
-INCLUDEPATH += .
-RESOURCES+=qregexp.qrc
QT = core testlib
-
CONFIG += release
-# Input
SOURCES += main.cpp
+RESOURCES += qregexp.qrc
!isEmpty(QT.webkit.sources):exists($${QT.webkit.sources}/../JavaScriptCore/JavaScriptCore.pri) {
include( $${QT.webkit.sources}/../JavaScriptCore/JavaScriptCore.pri )
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro
index 3c880eeb4d..00becec216 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro
+++ b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro
@@ -2,6 +2,5 @@ QT += widgets testlib
TEMPLATE = app
TARGET = tst_bench_qgraphicswidget
-TEMPLATE = app
-# Input
+
SOURCES += tst_qgraphicswidget.cpp
diff --git a/tests/benchmarks/gui/image/blendbench/blendbench.pro b/tests/benchmarks/gui/image/blendbench/blendbench.pro
index 74ba0a5920..17c18301bb 100644
--- a/tests/benchmarks/gui/image/blendbench/blendbench.pro
+++ b/tests/benchmarks/gui/image/blendbench/blendbench.pro
@@ -1,7 +1,5 @@
TEMPLATE = app
TARGET = tst_bench_blendbench
-DEPENDPATH += .
-INCLUDEPATH += .
QT += testlib
-# Input
+
SOURCES += main.cpp
diff --git a/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro b/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro
index 7f5d829b26..074c764e50 100644
--- a/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro
+++ b/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro
@@ -1,5 +1,5 @@
TARGET = tst_bench_qpixmapcache
TEMPLATE = app
QT += testlib
-# Input
+
SOURCES += tst_qpixmapcache.cpp
diff --git a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro
index 19ca697102..86a016d42e 100644
--- a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro
+++ b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro
@@ -2,10 +2,7 @@ QT += widgets testlib
TEMPLATE = app
TARGET = tst_bench_qapplication
-DEPENDPATH += .
-INCLUDEPATH += .
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/gui/painting/qregion/qregion.pro b/tests/benchmarks/gui/painting/qregion/qregion.pro
index 99bbd39043..1ff55080c5 100644
--- a/tests/benchmarks/gui/painting/qregion/qregion.pro
+++ b/tests/benchmarks/gui/painting/qregion/qregion.pro
@@ -1,9 +1,6 @@
TEMPLATE = app
TARGET = tst_bench_qregion
-DEPENDPATH += .
-INCLUDEPATH += .
QT += testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro
index 82558e7ec9..5aef3520c0 100644
--- a/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro
+++ b/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro
@@ -1,11 +1,7 @@
TEMPLATE = app
QT += widgets testlib
TARGET = tst_bench_qstylesheetstyle
-DEPENDPATH += .
-INCLUDEPATH += .
-
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro
index bee2adafa1..eccabd5d89 100644
--- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro
+++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro
@@ -1,12 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qfile_vs_qnetworkaccessmanager
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro b/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro
index fe2204bb16..9de05b5e65 100644
--- a/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro
+++ b/tests/benchmarks/network/access/qnetworkdiskcache/qnetworkdiskcache.pro
@@ -1,14 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qnetworkdiskcache
-DEPENDPATH += .
-INCLUDEPATH += .
QT += gui # for QDesktopServices
QT += network testlib
CONFIG += release
-# Input
SOURCES += tst_qnetworkdiskcache.cpp
-
-
diff --git a/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro b/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro
index 36eeb23fd0..1618728295 100644
--- a/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro
+++ b/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro
@@ -1,12 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qnetworkreply
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += tst_qnetworkreply.cpp
diff --git a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro
index e26406fe74..41dae0051b 100644
--- a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro
+++ b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro
@@ -1,12 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qhostinfo
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += core-private network network-private testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
index 1ea2f96d78..ebf1891433 100644
--- a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
+++ b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro
@@ -1,12 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qtcpserver
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += tst_qtcpserver.cpp
diff --git a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro
index d71fd86316..a67c0d66df 100644
--- a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro
+++ b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro
@@ -1,12 +1,9 @@
TEMPLATE = app
TARGET = tst_bench_qsslsocket
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += tst_qsslsocket.cpp
diff --git a/tests/benchmarks/opengl/opengl.pro b/tests/benchmarks/opengl/opengl.pro
index 2866dbc650..1a81571a3f 100644
--- a/tests/benchmarks/opengl/opengl.pro
+++ b/tests/benchmarks/opengl/opengl.pro
@@ -1,11 +1,8 @@
TEMPLATE = app
TARGET = tst_bench_opengl
-DEPENDPATH += .
-INCLUDEPATH += .
QT += core-private gui-private opengl opengl-private testlib
-# Input
SOURCES += main.cpp
include(../trusted-benchmarks.pri)
diff --git a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro
index 1db78e332d..d278e9e721 100644
--- a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro
+++ b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro
@@ -1,7 +1,5 @@
TEMPLATE = app
TARGET = jpeg
-DEPENDPATH += .
-INCLUDEPATH += .
QT += testlib
CONFIG += release
@@ -11,5 +9,4 @@ wince*: {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
-# Input
SOURCES += jpeg.cpp
diff --git a/tests/manual/cmake/CMakeLists.txt b/tests/manual/cmake/CMakeLists.txt
index 930936a7b5..2d0164a47b 100644
--- a/tests/manual/cmake/CMakeLists.txt
+++ b/tests/manual/cmake/CMakeLists.txt
@@ -88,3 +88,4 @@ expect_fail(fail4)
expect_fail(fail5)
expect_pass("pass(needsquoting)6")
expect_pass(pass7)
+expect_pass(pass8)
diff --git a/tests/manual/cmake/pass8/CMakeLists.txt b/tests/manual/cmake/pass8/CMakeLists.txt
new file mode 100644
index 0000000000..735b1bd26e
--- /dev/null
+++ b/tests/manual/cmake/pass8/CMakeLists.txt
@@ -0,0 +1,20 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(pass8)
+
+find_package(Qt5Core REQUIRED)
+
+include_directories(${Qt5Core_INCLUDE_DIRS})
+
+add_definitions(${Qt5Core_DEFINITIONS})
+
+qt5_wrap_cpp(moc_files myobject.h)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+
+# On non-windows, the WIN32 is harmless, and Qt5Core_QTMAIN_LIBRARIES is empty.
+# We test that it is harmless on those, and test that it builds on Windows.
+# It wouldn't build if WIN32 is used and Qt5Core_QTMAIN_LIBRARIES is empty.
+add_executable(myobject WIN32 myobject.cpp ${moc_files} )
+target_link_libraries(myobject ${Qt5Core_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES})
diff --git a/config.tests/qws/sound/sound.cpp b/tests/manual/cmake/pass8/myobject.cpp
index fbc602b42a..b6287b2540 100644
--- a/config.tests/qws/sound/sound.cpp
+++ b/tests/manual/cmake/pass8/myobject.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** Contact: http://www.qt-project.org/
**
-** This file is part of the config.tests of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,11 +39,16 @@
**
****************************************************************************/
-#include <sys/soundcard.h>
+#include "myobject.h"
-int main(int, char **)
+MyObject::MyObject(QObject *parent)
+ : QObject(parent)
{
- audio_buf_info info;
+ emit someSignal();
+}
+int main(int argc, char **argv)
+{
+ MyObject myObject;
return 0;
}
diff --git a/config.tests/qws/directfb/directfb.cpp b/tests/manual/cmake/pass8/myobject.h
index d781702ab6..71a65ee801 100644
--- a/config.tests/qws/directfb/directfb.cpp
+++ b/tests/manual/cmake/pass8/myobject.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** Contact: http://www.qt-project.org/
**
-** This file is part of the config.tests of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,12 +39,19 @@
**
****************************************************************************/
-#include <directfb.h>
+#ifndef MYOBJECT_H
+#define MYOBJECT_H
-int main(int, char **)
+#include <QObject>
+
+class MyObject : public QObject
{
- DFBResult result = DFB_OK;
- result = DirectFBInit(0, 0);
+ Q_OBJECT
+public:
+ MyObject(QObject *parent = 0);
+
+signals:
+ void someSignal();
+};
- return (result == DFB_OK);
-}
+#endif
diff --git a/config.tests/qws/ahi/ahi.cpp b/tests/manual/cocoa/wheelevent/main.cpp
index 166fc4e2b4..979498991d 100644
--- a/config.tests/qws/ahi/ahi.cpp
+++ b/tests/manual/cocoa/wheelevent/main.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
-** This file is part of the config.tests of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
@@ -39,12 +39,21 @@
**
****************************************************************************/
-#include <ahi.h>
+#include <QtCore>
+#include <QtGui>
-int main(int, char **)
+#include "window.h"
+
+int main(int argc, char *argv[])
{
- AhiInit(0);
- AhiTerm();
+ QGuiApplication app(argc, argv);
+
+ Window window;
+ window.show();
+
- return 0;
+ return app.exec();
}
+
+
+
diff --git a/tests/manual/cocoa/wheelevent/wheelevent.pro b/tests/manual/cocoa/wheelevent/wheelevent.pro
new file mode 100644
index 0000000000..6eca6d48cf
--- /dev/null
+++ b/tests/manual/cocoa/wheelevent/wheelevent.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+
+HEADERS += window.h
+SOURCES += window.cpp main.cpp
+
+QT += core gui gui-private core-private
diff --git a/tests/manual/cocoa/wheelevent/window.cpp b/tests/manual/cocoa/wheelevent/window.cpp
new file mode 100644
index 0000000000..b305b057bf
--- /dev/null
+++ b/tests/manual/cocoa/wheelevent/window.cpp
@@ -0,0 +1,240 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite 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 "window.h"
+
+#include <private/qguiapplication_p.h>
+
+#include <QBackingStore>
+#include <QPainter>
+#include <QtGui>
+
+static int colorIndexId = 0;
+
+QColor colorTable[] =
+{
+ QColor("#f09f8f"),
+ QColor("#a2bff2"),
+ QColor("#c0ef8f")
+};
+
+Window::Window(QScreen *screen)
+ : QWindow(screen)
+ , m_backgroundColorIndex(colorIndexId++)
+{
+ initialize();
+}
+
+Window::Window(QWindow *parent)
+ : QWindow(parent)
+ , m_backgroundColorIndex(colorIndexId++)
+{
+ initialize();
+}
+
+void Window::initialize()
+{
+ if (parent())
+ setGeometry(QRect(160, 120, 320, 240));
+ else {
+ setGeometry(QRect(10, 10, 640, 480));
+
+ setSizeIncrement(QSize(10, 10));
+ setBaseSize(QSize(640, 480));
+ setMinimumSize(QSize(240, 160));
+ setMaximumSize(QSize(800, 600));
+ }
+
+ create();
+ m_backingStore = new QBackingStore(this);
+
+ m_image = QImage(geometry().size(), QImage::Format_RGB32);
+ m_image.fill(colorTable[m_backgroundColorIndex % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba());
+
+ m_lastPos = QPoint(-1, -1);
+ m_renderTimer = 0;
+}
+
+void Window::mousePressEvent(QMouseEvent *event)
+{
+ m_lastPos = event->pos();
+}
+
+void Window::mouseMoveEvent(QMouseEvent *event)
+{
+ if (m_lastPos != QPoint(-1, -1)) {
+ QPainter p(&m_image);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.drawLine(m_lastPos, event->pos());
+ m_lastPos = event->pos();
+ }
+
+ scheduleRender();
+}
+
+void Window::wheelEvent(QWheelEvent *event)
+{
+ qDebug() << "wheelEvent delta" << event->delta() << "orientation" << event->orientation();
+ qDebug() << "wheelEvent pixelDelta" << event->pixelDelta();
+ qDebug() << "wheelEvent angleDelta" << event->angleDelta();
+
+ const bool useQt4API = false;
+
+ if (useQt4API) {
+ if (event->orientation() == Qt::Horizontal)
+ scrollOffset.setX(scrollOffset.x() + event->delta());
+ else
+ scrollOffset.setY(scrollOffset.y() + event->delta());
+ scheduleRender();
+ } else {
+ if (!event->pixelDelta().isNull()) {
+ scrollOffset += event->pixelDelta();
+ scheduleRender();
+ }
+ }
+}
+
+void Window::mouseReleaseEvent(QMouseEvent *event)
+{
+ if (m_lastPos != QPoint(-1, -1)) {
+ QPainter p(&m_image);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.drawLine(m_lastPos, event->pos());
+ m_lastPos = QPoint(-1, -1);
+ }
+
+ scheduleRender();
+}
+
+void Window::exposeEvent(QExposeEvent *)
+{
+ scheduleRender();
+}
+
+void Window::resizeEvent(QResizeEvent *)
+{
+ QImage old = m_image;
+
+ //qDebug() << "Window::resizeEvent" << width << height;
+
+ int width = qMax(geometry().width(), old.width());
+ int height = qMax(geometry().height(), old.height());
+
+ if (width > old.width() || height > old.height()) {
+ m_image = QImage(width, height, QImage::Format_RGB32);
+ m_image.fill(colorTable[(m_backgroundColorIndex) % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba());
+
+ QPainter p(&m_image);
+ p.drawImage(0, 0, old);
+ }
+
+ render();
+}
+
+void Window::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Backspace:
+ m_text.chop(1);
+ break;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ m_text.append('\n');
+ break;
+ default:
+ m_text.append(event->text());
+ break;
+ }
+ scheduleRender();
+}
+
+void Window::scheduleRender()
+{
+ if (!m_renderTimer)
+ m_renderTimer = startTimer(1);
+}
+
+void Window::timerEvent(QTimerEvent *)
+{
+ render();
+ killTimer(m_renderTimer);
+ m_renderTimer = 0;
+}
+
+void Window::render()
+{
+ QRect rect(QPoint(), geometry().size());
+
+ m_backingStore->resize(rect.size());
+
+ m_backingStore->beginPaint(rect);
+
+ QPaintDevice *device = m_backingStore->paintDevice();
+
+ QPainter p(device);
+ p.drawImage(0, 0, m_image);
+
+ QFont font;
+ font.setPixelSize(32);
+
+ p.setFont(font);
+ p.drawText(rect, 0, m_text);
+
+ // draw grid:
+ int gridSpace = 80;
+
+ for (int y = 0; y < geometry().height() + gridSpace; y+= gridSpace) {
+ int offset = scrollOffset.y() % gridSpace;
+ //int color = ((y + offset) %255);// + scrollOffset.y()) % 255);
+ p.drawLine(0, y + offset, geometry().width(), y + offset);
+ //p.setBrush(QColor(color,0, 0));
+ //p.fillRect(0, y + offset, geometry().width(), gridSpace,QColor(color,0, 0));
+ }
+
+ for (int x = 0; x < geometry().width() + gridSpace; x+= gridSpace) {
+ p.drawLine(x + scrollOffset.x() % gridSpace, 0, x + scrollOffset.x() % gridSpace, geometry().height());
+ }
+
+ m_backingStore->endPaint();
+ m_backingStore->flush(rect);
+}
+
+
diff --git a/tests/manual/cocoa/wheelevent/window.h b/tests/manual/cocoa/wheelevent/window.h
new file mode 100644
index 0000000000..523c9f3dc9
--- /dev/null
+++ b/tests/manual/cocoa/wheelevent/window.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite 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 <QWindow>
+#include <QImage>
+
+class Window : public QWindow
+{
+public:
+ Window(QWindow *parent = 0);
+ Window(QScreen *screen);
+
+protected:
+ void mousePressEvent(QMouseEvent *);
+ void mouseMoveEvent(QMouseEvent *);
+ void mouseReleaseEvent(QMouseEvent *);
+ void wheelEvent(QWheelEvent *event);
+
+ void keyPressEvent(QKeyEvent *);
+
+ void exposeEvent(QExposeEvent *);
+ void resizeEvent(QResizeEvent *);
+
+ void timerEvent(QTimerEvent *);
+
+private:
+ void render();
+ void scheduleRender();
+ void initialize();
+
+ QString m_text;
+ QImage m_image;
+ QPoint m_lastPos;
+ int m_backgroundColorIndex;
+ QBackingStore *m_backingStore;
+ int m_renderTimer;
+ QPoint scrollOffset;
+};
diff --git a/tests/manual/gestures/graphicsview/graphicsview.pro b/tests/manual/gestures/graphicsview/graphicsview.pro
index a40c323eb3..c5f6fe0764 100644
--- a/tests/manual/gestures/graphicsview/graphicsview.pro
+++ b/tests/manual/gestures/graphicsview/graphicsview.pro
@@ -1,12 +1,3 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Mon Sep 7 13:26:43 2009
-# #####################################################################
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
SOURCES += main.cpp \
imageitem.cpp \
gestures.cpp \
diff --git a/tests/manual/lance/lance.pro b/tests/manual/lance/lance.pro
index 7eee7ec2de..e24d3f2fa3 100644
--- a/tests/manual/lance/lance.pro
+++ b/tests/manual/lance/lance.pro
@@ -4,7 +4,6 @@ TEMPLATE = app
INCLUDEPATH += . $$LANCELOT_DIR
QT += core-private gui-private
-# Input
HEADERS += widgets.h \
interactivewidget.h \
$$LANCELOT_DIR/paintcommands.h
diff --git a/tests/manual/qgraphicslayout/flicker/flicker.pro b/tests/manual/qgraphicslayout/flicker/flicker.pro
index 323a30f7bf..2e09826022 100644
--- a/tests/manual/qgraphicslayout/flicker/flicker.pro
+++ b/tests/manual/qgraphicslayout/flicker/flicker.pro
@@ -1,8 +1,2 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
HEADERS += window.h
SOURCES += main.cpp window.cpp
diff --git a/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro
index d73124c8f9..fd21007793 100644
--- a/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro
+++ b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -1,13 +1,10 @@
CONFIG += testcase
TEMPLATE = app
TARGET = tst_qhttpnetworkconnection
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/manual/qimagereader/qimagereader.pro b/tests/manual/qimagereader/qimagereader.pro
index b8293b9552..28dcadcbfa 100644
--- a/tests/manual/qimagereader/qimagereader.pro
+++ b/tests/manual/qimagereader/qimagereader.pro
@@ -1,8 +1 @@
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
SOURCES += main.cpp
diff --git a/tests/manual/qlocale/qlocale.pro b/tests/manual/qlocale/qlocale.pro
index e9f17f4f9f..4eaddedcf0 100644
--- a/tests/manual/qlocale/qlocale.pro
+++ b/tests/manual/qlocale/qlocale.pro
@@ -1,8 +1,2 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
HEADERS += currency.h calendar.h dateformats.h numberformats.h languages.h window.h miscellaneous.h info.h
SOURCES += currency.cpp main.cpp calendar.cpp dateformats.cpp numberformats.cpp languages.cpp window.cpp miscellaneous.cpp info.cpp
diff --git a/tests/manual/qnetworkaccessmanager/qget/qget.pro b/tests/manual/qnetworkaccessmanager/qget/qget.pro
index 341f772b51..1f2b497171 100644
--- a/tests/manual/qnetworkaccessmanager/qget/qget.pro
+++ b/tests/manual/qnetworkaccessmanager/qget/qget.pro
@@ -2,6 +2,5 @@ TEMPLATE = app
QT = core network
CONFIG += console
-# Input
SOURCES += qget.cpp
HEADERS += qget.h
diff --git a/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro b/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro
index 613fcd85e4..7ad271ce46 100644
--- a/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro
+++ b/tests/manual/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro
@@ -1,13 +1,10 @@
CONFIG += testcase
TEMPLATE = app
TARGET = tst_qnetworkconfigurationmanager
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/manual/qnetworkreply/qnetworkreply.pro b/tests/manual/qnetworkreply/qnetworkreply.pro
index 479a1e63bc..17f48c6544 100644
--- a/tests/manual/qnetworkreply/qnetworkreply.pro
+++ b/tests/manual/qnetworkreply/qnetworkreply.pro
@@ -1,13 +1,10 @@
CONFIG += testcase
TEMPLATE = app
TARGET = tst_qnetworkreply
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tests/manual/qtabletevent/device_information/qtabletevent.pro b/tests/manual/qtabletevent/device_information/qtabletevent.pro
index e0ed549004..8251d73094 100644
--- a/tests/manual/qtabletevent/device_information/qtabletevent.pro
+++ b/tests/manual/qtabletevent/device_information/qtabletevent.pro
@@ -1,13 +1,5 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Mon Aug 10 17:02:09 2009
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp\
+SOURCES += \
+ main.cpp \
tabletwidget.cpp
-HEADERS += tabletwidget.h
+HEADERS += \
+ tabletwidget.h
diff --git a/tests/manual/qtabletevent/event_compression/event_compression.pro b/tests/manual/qtabletevent/event_compression/event_compression.pro
index 273fd6c1b0..fd2521e44f 100644
--- a/tests/manual/qtabletevent/event_compression/event_compression.pro
+++ b/tests/manual/qtabletevent/event_compression/event_compression.pro
@@ -1,7 +1,5 @@
-TEMPLATE = app
QT += testlib
-# Input
SOURCES += main.cpp \
mousestatwidget.cpp
HEADERS += mousestatwidget.h
diff --git a/tests/manual/qwidget_zorder/qwidget_zorder.pro b/tests/manual/qwidget_zorder/qwidget_zorder.pro
index 5526f9161f..28dcadcbfa 100644
--- a/tests/manual/qwidget_zorder/qwidget_zorder.pro
+++ b/tests/manual/qwidget_zorder/qwidget_zorder.pro
@@ -1,6 +1 @@
-TEMPLATE = app
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
SOURCES += main.cpp
diff --git a/tests/manual/repaint/mainwindow/mainwindow.pro b/tests/manual/repaint/mainwindow/mainwindow.pro
index c269d57eff..db6b2d280c 100644
--- a/tests/manual/repaint/mainwindow/mainwindow.pro
+++ b/tests/manual/repaint/mainwindow/mainwindow.pro
@@ -1,15 +1,2 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Nov 8 15:46:28 2006
-######################################################################
-
-TEMPLATE = app
-TARGET = mainwindow
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
HEADERS += ../shared/shared.h
SOURCES += main.cpp
-CONFIG += qt warn_on debug create_prl link_prl
-OBJECTS_DIR = .obj/debug-shared
-MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/scrollarea/scrollarea.pro b/tests/manual/repaint/scrollarea/scrollarea.pro
index e1a40ad6ad..db6b2d280c 100644
--- a/tests/manual/repaint/scrollarea/scrollarea.pro
+++ b/tests/manual/repaint/scrollarea/scrollarea.pro
@@ -1,15 +1,2 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Nov 8 15:28:57 2006
-######################################################################
-
-TEMPLATE = app
-TARGET = scrollarea
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
HEADERS += ../shared/shared.h
SOURCES += main.cpp
-CONFIG += qt warn_on debug create_prl link_prl
-OBJECTS_DIR = .obj/debug-shared
-MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/splitter/splitter.pro b/tests/manual/repaint/splitter/splitter.pro
index 0afc0630ba..db6b2d280c 100644
--- a/tests/manual/repaint/splitter/splitter.pro
+++ b/tests/manual/repaint/splitter/splitter.pro
@@ -1,15 +1,2 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Nov 8 15:39:53 2006
-######################################################################
-
-TEMPLATE = app
-TARGET = splitter
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
HEADERS += ../shared/shared.h
SOURCES += main.cpp
-CONFIG += qt warn_on debug create_prl link_prl
-OBJECTS_DIR = .obj/debug-shared
-MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/tableview/tableview.pro b/tests/manual/repaint/tableview/tableview.pro
index 4fccf4abc9..4097c95739 100644
--- a/tests/manual/repaint/tableview/tableview.pro
+++ b/tests/manual/repaint/tableview/tableview.pro
@@ -1,8 +1,2 @@
HEADERS +=../shared/shared.h
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
SOURCES += main.cpp
diff --git a/tests/manual/repaint/task141091/task141091.pro b/tests/manual/repaint/task141091/task141091.pro
index db89bd35b8..82ead4b6c2 100644
--- a/tests/manual/repaint/task141091/task141091.pro
+++ b/tests/manual/repaint/task141091/task141091.pro
@@ -1,12 +1,3 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue Mar 6 13:44:00 2007
-######################################################################
+CONFIG += console
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-CONFIG+=console
-
-# Input
SOURCES += main.cpp
diff --git a/tests/manual/repaint/toplevel/toplevel.pro b/tests/manual/repaint/toplevel/toplevel.pro
index 568ea8e062..c2cc19f67d 100644
--- a/tests/manual/repaint/toplevel/toplevel.pro
+++ b/tests/manual/repaint/toplevel/toplevel.pro
@@ -1,16 +1,4 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue Nov 7 10:15:42 2006
-######################################################################
-
-TEMPLATE = app
-TARGET = toplevel
-DEPENDPATH += .
-INCLUDEPATH += .
CONFIG += console
-# Input
HEADERS += ../shared/shared.h
SOURCES += main.cpp
-CONFIG += qt warn_on debug create_prl link_prl
-OBJECTS_DIR = .obj/debug-shared
-MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/widget/widget.pro b/tests/manual/repaint/widget/widget.pro
index c9d8f872e8..db6b2d280c 100644
--- a/tests/manual/repaint/widget/widget.pro
+++ b/tests/manual/repaint/widget/widget.pro
@@ -1,15 +1,2 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue Nov 7 11:16:05 2006
-######################################################################
-
-TEMPLATE = app
-TARGET = widget
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
HEADERS += ../shared/shared.h
SOURCES += main.cpp
-CONFIG += qt warn_on debug create_prl link_prl
-OBJECTS_DIR = .obj/debug-shared
-MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/socketengine/socketengine.pro b/tests/manual/socketengine/socketengine.pro
index 24523e9ca4..808502c22a 100644
--- a/tests/manual/socketengine/socketengine.pro
+++ b/tests/manual/socketengine/socketengine.pro
@@ -1,13 +1,10 @@
CONFIG += testcase
TEMPLATE = app
TARGET = tst_socketengine
-DEPENDPATH += .
-INCLUDEPATH += .
QT -= gui
QT += network testlib
CONFIG += release
-# Input
SOURCES += main.cpp
diff --git a/tools/configure/Makefile.mingw b/tools/configure/Makefile.mingw
index 5951cb4e92..086dd71a85 100644
--- a/tools/configure/Makefile.mingw
+++ b/tools/configure/Makefile.mingw
@@ -74,10 +74,38 @@ $(TARGET): $(OBJECTS)
$(OBJECTS): $(PCH)
-CHK_DIR_EXISTS = test -d
-MKDIR=mkdir -p
+# SHELL is the full path of sh.exe, unless
+# 1) it is found in the current directory
+# 2) it is not found at all
+# 3) it is overridden on the command line with an existing file
+# ... otherwise it is always sh.exe. Specifically, SHELL from the
+# environment has no effect.
+#
+# This check will fail if SHELL is explicitly set to a not
+# sh-compatible shell. This is not a problem, because configure.bat
+# will not do that.
+ifeq ($(SHELL), sh.exe)
+ ifeq ($(wildcard $(CURDIR)/sh.exe), )
+ SH = 0
+ else
+ SH = 1
+ endif
+else
+ SH = 1
+endif
+
+ifeq ($(SH), 1)
+ CHK_DIR_EXISTS = test -d
+ CHK_DIR_EXISTS_GLUE = ||
+ MKDIR = mkdir -p
+else
+ CHK_DIR_EXISTS = if not exist
+ CHK_DIR_EXISTS_GLUE =
+ MKDIR = md
+endif
+
$(PCH): $(CONFSRC)/configure_pch.h
- @$(CHK_DIR_EXISTS) $(RAW_PCH).gch || $(MKDIR) $(RAW_PCH).gch
+ @$(CHK_DIR_EXISTS) $(RAW_PCH).gch $(CHK_DIR_EXISTS_GLUE) $(MKDIR) $(RAW_PCH).gch
$(CXX) -x c++-header -c $(CXXFLAGS_BARE) -o $@ $<
VPATH = $(CONFSRC):$(TOOLSRC)/shared/windows:$(CORESRC)/global:$(CORESRC)/kernel:$(CORESRC)/tools:$(CORESRC)/codecs:$(CORESRC)/io:$(CORESRC)/xml:$(CORESRC)/plugin
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index 80542e7697..b9af9eca8f 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -76,9 +76,13 @@ struct CompilerInfo{
{CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"},
{CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe
{CC_NET2003, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2003 (7.1)", "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe
+ {CC_NET2003, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2003 (7.1)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe
{CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe
+ {CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe
+ {CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2010, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2010 (10.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe
+ {CC_NET2010, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2010 (10.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe
{CC_UNKNOWN, "Unknown", 0, 0},
};
@@ -158,8 +162,18 @@ Compiler Environment::detectCompiler()
QStringList::iterator it;
for(it = pathlist.begin(); it != pathlist.end(); ++it) {
if((*it).contains(productPath)) {
- ++installed;
- detectedCompiler = compiler_info[i].compiler;
+ if (detectedCompiler != compiler_info[i].compiler) {
+ ++installed;
+ detectedCompiler = compiler_info[i].compiler;
+ }
+ /* else {
+
+ We detected the same compiler again, which happens when
+ configure is build with the 64-bit compiler. Skip the
+ duplicate so that we don't think it's installed twice.
+
+ }
+ */
break;
}
}
@@ -171,8 +185,18 @@ Compiler Environment::detectCompiler()
for(int i = 0; compiler_info[i].compiler; ++i) {
QString executable = QString(compiler_info[i].executable).toLower();
if (executable.length() && Environment::detectExecutable(executable)) {
- ++installed;
- detectedCompiler = compiler_info[i].compiler;
+ if (detectedCompiler != compiler_info[i].compiler) {
+ ++installed;
+ detectedCompiler = compiler_info[i].compiler;
+ }
+ /* else {
+
+ We detected the same compiler again, which happens when
+ configure is build with the 64-bit compiler. Skip the
+ duplicate so that we don't think it's installed twice.
+
+ }
+ */
break;
}
}
diff --git a/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro
index 9d5f1cf7f9..99723b7c0f 100644
--- a/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro
+++ b/util/corelib/qurl-generateTLDs/qurl-generateTLDs.pro
@@ -1,9 +1,3 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
QT = core
-# Input
SOURCES += main.cpp
diff --git a/util/unicode/codecs/big5/big5.pro b/util/unicode/codecs/big5/big5.pro
index 84cf33033c..a42176bb6b 100644
--- a/util/unicode/codecs/big5/big5.pro
+++ b/util/unicode/codecs/big5/big5.pro
@@ -1,6 +1,4 @@
-TEMPLATE = app
CONFIG -= moc
-# Input
SOURCES += main.cpp
RESOURCES += big5.qrc