summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/.qmake.conf6
-rw-r--r--config.tests/unix/gstreamer/gstreamer.pro3
-rw-r--r--config.tests/unix/icu/icu.pro16
-rwxr-xr-xconfig.tests/unix/makeabs14
-rw-r--r--config.tests/unix/pps/pps.cpp (renamed from src/gui/accessible/qaccessible2_p.h)15
-rw-r--r--config.tests/unix/pps/pps.pro3
-rwxr-xr-xconfigure2234
-rw-r--r--dist/changes-5.1.07
-rw-r--r--dist/changes-5.2.0537
-rw-r--r--doc/global/externalsites/qtcreator.qdoc52
-rw-r--r--doc/global/html-footer.qdocconf30
-rw-r--r--doc/global/manifest-meta.qdocconf109
-rw-r--r--doc/global/qt-cpp-defines.qdocconf1
-rw-r--r--doc/global/template/style/offline.css50
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.cpp4
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.h16
-rw-r--r--examples/qtconcurrent/imagescaling/main.cpp20
-rw-r--r--examples/qtconcurrent/progressdialog/main.cpp21
-rw-r--r--examples/qtconcurrent/runfunction/main.cpp22
-rw-r--r--examples/qtconcurrent/wordcount/main.cpp22
-rw-r--r--examples/threads/doc/src/queuedcustomtype.qdoc7
-rw-r--r--examples/threads/doc/src/semaphores.qdoc2
-rw-r--r--examples/threads/doc/src/waitconditions.qdoc2
-rw-r--r--examples/tools/doc/src/customtype.qdoc4
-rw-r--r--examples/widgets/doc/src/padnavigator.qdoc4
-rw-r--r--examples/widgets/doc/src/wiggly.qdoc4
-rw-r--r--examples/widgets/tutorials/threads/clock/clock.pro10
-rw-r--r--examples/widgets/tutorials/threads/clock/clockthread.cpp66
-rw-r--r--examples/widgets/tutorials/threads/clock/clockthread.h64
-rw-r--r--examples/widgets/tutorials/threads/clock/main.cpp67
-rw-r--r--examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp63
-rw-r--r--examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.pro14
-rw-r--r--examples/widgets/tutorials/threads/hellothread/hellothread.cpp50
-rw-r--r--examples/widgets/tutorials/threads/hellothread/hellothread.h53
-rw-r--r--examples/widgets/tutorials/threads/hellothread/hellothread.pro14
-rw-r--r--examples/widgets/tutorials/threads/hellothread/main.cpp52
-rw-r--r--examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp65
-rw-r--r--examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.pro14
-rw-r--r--examples/widgets/tutorials/threads/movedobject/main.cpp69
-rw-r--r--examples/widgets/tutorials/threads/movedobject/movedobject.pro15
-rw-r--r--examples/widgets/tutorials/threads/movedobject/thread.cpp100
-rw-r--r--examples/widgets/tutorials/threads/movedobject/thread.h67
-rw-r--r--examples/widgets/tutorials/threads/movedobject/workerobject.cpp87
-rw-r--r--examples/widgets/tutorials/threads/movedobject/workerobject.h64
-rw-r--r--examples/widgets/tutorials/threads/threads.pro8
-rw-r--r--examples/widgets/tutorials/tutorials.pro2
-rw-r--r--mkspecs/android-g++/qmake.conf1
-rw-r--r--mkspecs/features/android/android_deployment_settings.prf12
-rw-r--r--mkspecs/features/create_cmake.prf20
-rw-r--r--mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in16
-rw-r--r--mkspecs/features/dbuscommon.pri1
-rw-r--r--mkspecs/features/default_post.prf2
-rw-r--r--mkspecs/features/exclusive_builds.prf109
-rw-r--r--mkspecs/features/exclusive_builds_post.prf160
-rw-r--r--mkspecs/features/mac/default_post.prf11
-rw-r--r--mkspecs/features/mac/default_pre.prf12
-rw-r--r--mkspecs/features/mac/sdk.prf6
-rw-r--r--mkspecs/features/qfeatures.prf4
-rw-r--r--mkspecs/features/qt.prf63
-rw-r--r--mkspecs/features/qt_android_deps.prf13
-rw-r--r--mkspecs/features/qt_build_config.prf8
-rw-r--r--mkspecs/features/qt_common.prf3
-rw-r--r--mkspecs/features/qt_functions.prf136
-rw-r--r--mkspecs/features/qt_installs.prf7
-rw-r--r--mkspecs/features/qt_module.prf13
-rw-r--r--mkspecs/features/qt_module_pris.prf123
-rw-r--r--mkspecs/features/qt_tool.prf2
-rw-r--r--mkspecs/features/resolve_config.prf19
-rw-r--r--mkspecs/features/resolve_target.prf2
-rw-r--r--mkspecs/linux-icc/qmake.conf3
-rw-r--r--mkspecs/macx-clang-32/Info.plist.app2
-rw-r--r--mkspecs/macx-clang/Info.plist.app2
-rw-r--r--mkspecs/macx-g++-32/Info.plist.app2
-rw-r--r--mkspecs/macx-g++/Info.plist.app2
-rw-r--r--mkspecs/macx-g++40/Info.plist.app2
-rw-r--r--mkspecs/macx-g++42/Info.plist.app2
-rw-r--r--mkspecs/macx-icc/Info.plist.app2
-rwxr-xr-xmkspecs/macx-ios-clang/Info.plist.app2
-rw-r--r--mkspecs/macx-ios-clang/features/default_post.prf220
-rw-r--r--mkspecs/macx-ios-clang/features/default_pre.prf4
-rw-r--r--mkspecs/macx-ios-clang/features/qt.prf11
-rw-r--r--mkspecs/macx-llvm/Info.plist.app2
-rw-r--r--mkspecs/win32-msvc2005/qplatformdefs.h2
-rw-r--r--mkspecs/win32-msvc2013/qmake.conf2
-rw-r--r--qmake/doc/qmake.qdocconf3
-rw-r--r--qmake/doc/src/qmake-manual.qdoc2
-rw-r--r--qmake/generators/integrity/gbuild.cpp1
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp40
-rw-r--r--qmake/generators/makefile.cpp22
-rw-r--r--qmake/generators/makefile.h1
-rw-r--r--qmake/generators/unix/unixmake2.cpp20
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp13
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp18
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp20
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h1
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp49
-rw-r--r--qmake/library/qmakebuiltins.cpp58
-rw-r--r--qmake/library/qmakeevaluator.cpp81
-rw-r--r--qmake/library/qmakeevaluator.h1
-rw-r--r--qmake/library/qmakeglobals.h4
-rw-r--r--qmake/main.cpp3
-rw-r--r--qmake/option.cpp12
-rw-r--r--qmake/option.h1
-rw-r--r--qmake/property.cpp4
-rw-r--r--qmake/qmake.pri15
-rw-r--r--qmake/qmake.pro38
-rw-r--r--qtbase.pro75
-rw-r--r--src/3rdparty/angle/src/libEGL/Surface.cpp2
-rw-r--r--src/3rdparty/angle/src/third_party/trace_event/trace_event.h2
-rwxr-xr-xsrc/3rdparty/sha3/KeccakF-1600-opt64.c8
-rwxr-xr-xsrc/3rdparty/sha3/KeccakSponge.h8
-rw-r--r--src/3rdparty/xcb/include/xcb/xkb.h4
-rw-r--r--src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch15
-rw-r--r--src/android/jar/jar.pri1
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java152
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtEditText.java23
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java83
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java425
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java35
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtSurface.java32
-rw-r--r--src/android/java/AndroidManifest.xml8
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java106
-rw-r--r--src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch28
-rw-r--r--src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch35
-rw-r--r--src/angle/src/common/common.pri6
-rw-r--r--src/angle/src/libEGL/libEGL.pro6
-rw-r--r--src/angle/src/libGLESv2/libGLESv2.pro8
-rw-r--r--src/concurrent/concurrent.pro2
-rw-r--r--src/concurrent/doc/qtconcurrent.qdocconf2
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp4
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp4
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp2
-rw-r--r--src/concurrent/qtconcurrentfilter.cpp28
-rw-r--r--src/concurrent/qtconcurrentmap.cpp34
-rw-r--r--src/concurrent/qtconcurrentmedian.h4
-rw-r--r--src/concurrent/qtconcurrentrun.cpp26
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in9
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp2
-rw-r--r--src/corelib/corelib.pro8
-rw-r--r--src/corelib/doc/images/thread_clock.pngbin5964 -> 0 bytes
-rw-r--r--src/corelib/doc/images/threadsandobjects.pngbin66096 -> 0 bytes
-rw-r--r--src/corelib/doc/images/threadvisual-example.pngbin16823 -> 0 bytes
-rw-r--r--src/corelib/doc/qtcore.qdocconf4
-rw-r--r--src/corelib/doc/snippets/code/doc_src_resources.cpp15
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp4
-rw-r--r--src/corelib/doc/snippets/qtracer/ftracer.cpp180
-rw-r--r--src/corelib/doc/snippets/qtracer/main.cpp59
-rw-r--r--src/corelib/doc/snippets/qtracer/qtracer.pro2
-rw-r--r--src/corelib/doc/src/custom-types.qdoc7
-rw-r--r--src/corelib/doc/src/objectmodel/object.qdoc3
-rw-r--r--src/corelib/doc/src/objectmodel/signalsandslots.qdoc2
-rw-r--r--src/corelib/doc/src/plugins-howto.qdoc5
-rw-r--r--src/corelib/doc/src/resource-system.qdoc34
-rw-r--r--src/corelib/doc/src/threads-basics.qdoc365
-rw-r--r--src/corelib/doc/src/threads.qdoc828
-rw-r--r--src/corelib/global/global.pri1
-rw-r--r--src/corelib/global/qcompilerdetection.h21
-rw-r--r--src/corelib/global/qconfig-large.h28
-rw-r--r--src/corelib/global/qconfig-medium.h45
-rw-r--r--src/corelib/global/qconfig-minimal.h108
-rw-r--r--src/corelib/global/qconfig-nacl.h125
-rw-r--r--src/corelib/global/qconfig-small.h26
-rw-r--r--src/corelib/global/qfeatures.h686
-rw-r--r--src/corelib/global/qfeatures.txt228
-rw-r--r--src/corelib/global/qflags.h16
-rw-r--r--src/corelib/global/qglobal.cpp112
-rw-r--r--src/corelib/global/qglobal.h23
-rw-r--r--src/corelib/global/qlibraryinfo.cpp4
-rw-r--r--src/corelib/global/qlogging.cpp2
-rw-r--r--src/corelib/global/qlogging.h2
-rw-r--r--src/corelib/global/qsysinfo.h15
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/io/qdir.cpp15
-rw-r--r--src/corelib/io/qfileinfo.cpp2
-rw-r--r--src/corelib/io/qfileselector.cpp32
-rw-r--r--src/corelib/io/qfileselector.h2
-rw-r--r--src/corelib/io/qlockfile_unix.cpp17
-rw-r--r--src/corelib/io/qloggingcategory.cpp323
-rw-r--r--src/corelib/io/qloggingcategory.h76
-rw-r--r--src/corelib/io/qloggingregistry.cpp8
-rw-r--r--src/corelib/io/qsettings.cpp4
-rw-r--r--src/corelib/io/qsettings_mac.cpp3
-rw-r--r--src/corelib/io/qstandardpaths.cpp7
-rw-r--r--src/corelib/io/qstandardpaths.h3
-rw-r--r--src/corelib/io/qstandardpaths_blackberry.cpp1
-rw-r--r--src/corelib/io/qstandardpaths_ios.mm136
-rw-r--r--src/corelib/io/qstandardpaths_mac.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp10
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/io/qurl.h36
-rw-r--r--src/corelib/kernel/kernel.pri3
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm30
-rw-r--r--src/corelib/kernel/qcore_mac_p.h4
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp82
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h5
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry.cpp23
-rw-r--r--src/corelib/kernel/qjni.cpp58
-rw-r--r--src/corelib/kernel/qjni_p.h4
-rw-r--r--src/corelib/kernel/qjnihelpers.cpp2
-rw-r--r--src/corelib/kernel/qmath.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp55
-rw-r--r--src/corelib/kernel/qobject_impl.h2
-rw-r--r--src/corelib/kernel/qobject_p.h1
-rw-r--r--src/corelib/kernel/qvariant.cpp62
-rw-r--r--src/corelib/kernel/qwineventnotifier.h2
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp6
-rw-r--r--src/corelib/plugin/quuid.h4
-rw-r--r--src/corelib/thread/qbasicatomic.h5
-rw-r--r--src/corelib/thread/qreadwritelock.cpp2
-rw-r--r--src/corelib/thread/qthread_win.cpp2
-rw-r--r--src/corelib/tools/qbytearray.cpp2
-rw-r--r--src/corelib/tools/qcollator.cpp42
-rw-r--r--src/corelib/tools/qcollator.h24
-rw-r--r--src/corelib/tools/qcollator_icu.cpp5
-rw-r--r--src/corelib/tools/qcollator_macx.cpp5
-rw-r--r--src/corelib/tools/qcollator_posix.cpp5
-rw-r--r--src/corelib/tools/qcollator_win.cpp5
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp49
-rw-r--r--src/corelib/tools/qdatetime.cpp19
-rw-r--r--src/corelib/tools/qlocale.cpp10
-rw-r--r--src/corelib/tools/qlocale_blackberry.cpp17
-rw-r--r--src/corelib/tools/qmap.cpp6
-rw-r--r--src/corelib/tools/qstring.cpp8
-rw-r--r--src/corelib/tools/qstring.h6
-rw-r--r--src/corelib/tools/qtimezone.cpp126
-rw-r--r--src/corelib/tools/qtimezone.h24
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp26
-rw-r--r--src/corelib/tools/qtimezoneprivate_mac.mm57
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h11
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp259
-rw-r--r--src/corelib/tools/qtimezoneprivate_win.cpp177
-rw-r--r--src/corelib/tools/qvector.cpp6
-rw-r--r--src/corelib/tools/tools.pri1
-rw-r--r--src/corelib/xml/qxmlstream.cpp7
-rw-r--r--src/gui/Qt5GuiConfigExtras.cmake.in40
-rw-r--r--src/gui/accessible/accessible.pri1
-rw-r--r--src/gui/accessible/qaccessible.cpp41
-rw-r--r--src/gui/accessible/qaccessible.h72
-rw-r--r--src/gui/doc/qtgui.qdocconf2
-rw-r--r--src/gui/image/qimage.cpp7
-rw-r--r--src/gui/image/qimageiohandler.cpp40
-rw-r--r--src/gui/image/qimagewriter.cpp2
-rw-r--r--src/gui/image/qpixmap.cpp2
-rw-r--r--src/gui/kernel/qevent.cpp15
-rw-r--r--src/gui/kernel/qguiapplication.cpp80
-rw-r--r--src/gui/kernel/qguiapplication.h1
-rw-r--r--src/gui/kernel/qkeysequence_p.h1
-rw-r--r--src/gui/kernel/qopenglcontext.cpp12
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp42
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h19
-rw-r--r--src/gui/kernel/qplatformintegration.cpp31
-rw-r--r--src/gui/kernel/qplatformintegration.h9
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformtheme.cpp28
-rw-r--r--src/gui/kernel/qplatformwindow.cpp25
-rw-r--r--src/gui/kernel/qstylehints.cpp3
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp4
-rw-r--r--src/gui/kernel/qwindow.cpp24
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp7
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h5
-rw-r--r--src/gui/opengl/opengl.pri22
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp8
-rw-r--r--src/gui/opengl/qopenglgradientcache.cpp24
-rw-r--r--src/gui/opengl/qopenglpixeltransferoptions.h10
-rw-r--r--src/gui/opengl/qopengltexture.cpp144
-rw-r--r--src/gui/opengl/qopengltexture.h21
-rw-r--r--src/gui/opengl/qopengltexturecache.cpp30
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h3
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp39
-rw-r--r--src/gui/opengl/qopengltexturehelper.cpp19
-rw-r--r--src/gui/opengl/qopengltexturehelper_p.h8
-rw-r--r--src/gui/painting/qbrush.cpp4
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp1
-rw-r--r--src/gui/painting/qpaintengine.h6
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp16
-rw-r--r--src/gui/painting/qpainter.cpp7
-rw-r--r--src/gui/painting/qpdf.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp12
-rw-r--r--src/gui/text/qfont.cpp9
-rw-r--r--src/gui/text/qfont_p.h5
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp1
-rw-r--r--src/gui/text/qfontengine.cpp3
-rw-r--r--src/gui/text/qfontengine_ft.cpp52
-rw-r--r--src/gui/text/qfontengine_ft_p.h2
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qfontmetrics.cpp2
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextdocument_p.cpp76
-rw-r--r--src/gui/text/qtextdocument_p.h2
-rw-r--r--src/gui/text/qtextengine.cpp6
-rw-r--r--src/gui/text/qtexthtmlparser.cpp6
-rw-r--r--src/gui/text/qtextlist.cpp4
-rw-r--r--src/gui/text/qtexttable.cpp14
-rw-r--r--src/gui/text/text.pri144
-rw-r--r--src/network/access/access.pri12
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp10
-rw-r--r--src/network/access/qnetworkreplynsurlconnectionimpl.mm449
-rw-r--r--src/network/access/qnetworkreplynsurlconnectionimpl_p.h89
-rw-r--r--src/network/bearer/qnetworkconfiguration.cpp1
-rw-r--r--src/network/doc/qtnetwork.qdocconf2
-rw-r--r--src/network/kernel/kernel.pri2
-rw-r--r--src/network/kernel/qauthenticator.cpp5
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp52
-rw-r--r--src/network/socket/socket.pri2
-rw-r--r--src/network/ssl/qssl.cpp2
-rw-r--r--src/network/ssl/qsslconfiguration.cpp24
-rw-r--r--src/network/ssl/qsslconfiguration.h4
-rw-r--r--src/network/ssl/qsslcontext.cpp4
-rw-r--r--src/network/ssl/qsslsocket.cpp2
-rw-r--r--src/network/ssl/ssl.pri2
-rw-r--r--src/opengl/qgl.cpp38
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience.cpp29
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp15
-rw-r--r--src/platformsupport/fbconvenience/qfbwindow.cpp10
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm17
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp2
-rw-r--r--src/platformsupport/input/evdevtouch/evdevtouch.pri2
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp35
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.h3
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp64
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h1
-rw-r--r--src/plugins/platforms/android/opengl/opengl.pro6
-rw-r--r--src/plugins/platforms/android/src/androidjniaccessibility.cpp2
-rw-r--r--src/plugins/platforms/android/src/androidjniinput.cpp51
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.cpp84
-rw-r--r--src/plugins/platforms/android/src/androidjnimain.h6
-rw-r--r--src/plugins/platforms/android/src/androidjnimenu.cpp36
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp2
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp (renamed from src/plugins/platforms/qnx/qqnxrootwindow.h)54
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h (renamed from config.tests/unix/gstreamer/gstreamer.cpp)29
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp32
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h3
-rw-r--r--src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp5
-rw-r--r--src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp73
-rw-r--r--src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h8
-rw-r--r--src/plugins/platforms/android/src/qandroidinputcontext.cpp5
-rw-r--r--src/plugins/platforms/android/src/qandroidinputcontext.h1
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp204
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h77
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformintegration.cpp24
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformintegration.h5
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenu.cpp10
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenu.h1
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformmenubar.cpp2
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformtheme.cpp20
-rw-r--r--src/plugins/platforms/android/src/qandroidplatformtheme.h3
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp7
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp35
-rw-r--r--src/plugins/platforms/android/src/raster/qandroidplatformwindow.h4
-rw-r--r--src/plugins/platforms/android/src/src.pri2
-rw-r--r--src/plugins/platforms/cocoa/images/sizeallcursor.pngbin0 -> 703 bytes
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm13
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.h5
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm79
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm95
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm140
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm12
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm27
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaresources.qrc2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm40
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm7
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm70
-rw-r--r--src/plugins/platforms/cocoa/qnsviewaccessibility.mm2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.cpp5
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfscompositor.cpp7
-rw-r--r--src/plugins/platforms/eglfs/qeglfscompositor.h6
-rw-r--r--src/plugins/platforms/eglfs/qeglfscursor.cpp5
-rw-r--r--src/plugins/platforms/eglfs/qeglfscursor.h7
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp58
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp17
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h1
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp6
-rw-r--r--src/plugins/platforms/ios/qiosapplicationdelegate.h1
-rw-r--r--src/plugins/platforms/ios/qiosapplicationdelegate.mm26
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.mm10
-rw-r--r--src/plugins/platforms/ios/qioscontext.h8
-rw-r--r--src/plugins/platforms/ios/qioscontext.mm24
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.h2
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm38
-rw-r--r--src/plugins/platforms/ios/qiosglobal.h10
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm23
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.h9
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm156
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm7
-rw-r--r--src/plugins/platforms/ios/qiosscreen.h11
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm146
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.h1
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm52
-rw-r--r--src/plugins/platforms/ios/qioswindow.h20
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm384
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.cpp6
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.h4
-rw-r--r--src/plugins/platforms/kms/qkmsscreen.h3
-rw-r--r--src/plugins/platforms/qnx/qnx.pro19
-rw-r--r--src/plugins/platforms/qnx/qqnxeglwindow.cpp29
-rw-r--r--src/plugins/platforms/qnx/qqnxeglwindow.h6
-rw-r--r--src/plugins/platforms/qnx/qqnxglcontext.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp19
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.h5
-rw-r--r--src/plugins/platforms/qnx/qqnxnativeinterface.cpp19
-rw-r--r--src/plugins/platforms/qnx/qqnxnativeinterface.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterwindow.cpp16
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterwindow.h7
-rw-r--r--src/plugins/platforms/qnx/qqnxrootwindow.cpp268
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp151
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.h10
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp108
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.h17
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventthread.cpp40
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventthread.h13
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp182
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.h32
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp2
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp1
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp1
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h5
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp19
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.h1
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp91
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.h2
-rw-r--r--src/plugins/platforms/windows/qwindowssessionmanager.cpp34
-rw-r--r--src/plugins/platforms/windows/qwindowssessionmanager.h13
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp19
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp80
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h5
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp27
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp25
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h4
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2theme.cpp12
-rw-r--r--src/printsupport/dialogs/dialogs.pri2
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp6
-rw-r--r--src/printsupport/dialogs/qprintdialog_win.cpp10
-rw-r--r--src/printsupport/doc/qtprintsupport.qdocconf2
-rw-r--r--src/printsupport/kernel/kernel.pri2
-rw-r--r--src/printsupport/kernel/qplatformprintplugin.cpp22
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp128
-rw-r--r--src/printsupport/kernel/qprinter.cpp2
-rw-r--r--src/printsupport/kernel/qprinterinfo.cpp29
-rw-r--r--src/printsupport/kernel/qprinterinfo_p.h13
-rw-r--r--src/sql/doc/qtsql.qdocconf2
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp4
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp2
-rw-r--r--src/sql/kernel/qsqldatabase.cpp1
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp2
-rw-r--r--src/sql/models/qsqltablemodel.cpp2
-rw-r--r--src/testlib/doc/qttestlib.qdocconf2
-rw-r--r--src/testlib/qtestcase.cpp9
-rw-r--r--src/testlib/qtestlog.cpp1
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp29
-rw-r--r--src/tools/qdoc/config.cpp2
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp8
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.cpp3
-rw-r--r--src/tools/qdoc/doc/files/qtgui.qdocconf2
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc234
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc56
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-intro.qdoc4
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc157
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc70
-rw-r--r--src/tools/qdoc/generator.cpp10
-rw-r--r--src/tools/qdoc/generator.h1
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp8
-rw-r--r--src/tools/qdoc/main.cpp21
-rw-r--r--src/tools/qdoc/node.cpp7
-rw-r--r--src/tools/qdoc/node.h2
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp39
-rw-r--r--src/tools/qdoc/qdocdatabase.h2
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp49
-rw-r--r--src/tools/qdoc/qmlparser/qqmljs.g84
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsast.cpp24
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsast_p.h160
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsastfwd_p.h4
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h8
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsengine_p.h1
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsglobal_p.h4
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsgrammar.cpp1670
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsgrammar_p.h43
-rw-r--r--src/tools/qdoc/qmlparser/qqmljskeywords_p.h11
-rw-r--r--src/tools/qdoc/qmlparser/qqmljslexer.cpp76
-rw-r--r--src/tools/qdoc/qmlparser/qqmljslexer_p.h4
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsparser.cpp481
-rw-r--r--src/tools/qdoc/qmlparser/qqmljsparser_p.h9
-rw-r--r--src/tools/qdoc/qmlvisitor.cpp37
-rw-r--r--src/tools/qdoc/qmlvisitor.h4
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp100
-rw-r--r--src/widgets/dialogs/qcolordialog.h3
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h5
-rw-r--r--src/widgets/dialogs/qdialog.cpp24
-rw-r--r--src/widgets/dialogs/qdialog_p.h3
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp33
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h2
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp66
-rw-r--r--src/widgets/dialogs/qmessagebox.h1
-rw-r--r--src/widgets/dialogs/qwizard.cpp41
-rw-r--r--src/widgets/doc/qtwidgets.qdocconf2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/layout.qdoc4
-rw-r--r--src/widgets/doc/src/widgets-tutorial.qdoc2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp5
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp5
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp11
-rw-r--r--src/widgets/itemviews/qabstractitemview.h2
-rw-r--r--src/widgets/itemviews/qheaderview.cpp9
-rw-r--r--src/widgets/itemviews/qheaderview.h2
-rw-r--r--src/widgets/itemviews/qlistview.cpp10
-rw-r--r--src/widgets/itemviews/qlistview.h2
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.h4
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp45
-rw-r--r--src/widgets/itemviews/qtreeview.h5
-rw-r--r--src/widgets/itemviews/qtreeview_p.h2
-rw-r--r--src/widgets/kernel/qapplication.cpp13
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
-rw-r--r--src/widgets/kernel/qlayout.cpp28
-rw-r--r--src/widgets/kernel/qlayout.h4
-rw-r--r--src/widgets/kernel/qwidget.cpp22
-rw-r--r--src/widgets/kernel/qwidget.h2
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp6
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h8
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp11
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp24
-rw-r--r--src/widgets/kernel/qwindowcontainer_p.h1
-rw-r--r--src/widgets/kernel/win.pri2
-rw-r--r--src/widgets/styles/qandroidstyle.cpp22
-rw-r--r--src/widgets/styles/qcommonstyle.cpp2
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm10
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp43
-rw-r--r--src/widgets/widgets/qdockwidget.cpp8
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp19
-rw-r--r--src/widgets/widgets/qkeysequenceedit.h4
-rw-r--r--src/widgets/widgets/qkeysequenceedit_p.h5
-rw-r--r--src/widgets/widgets/qlineedit.cpp6
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp13
-rw-r--r--src/widgets/widgets/qlineedit_p.h3
-rw-r--r--src/widgets/widgets/qmdiarea.cpp5
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp5
-rw-r--r--src/widgets/widgets/qscrollarea.h3
-rw-r--r--src/widgets/widgets/qtabbar.cpp23
-rw-r--r--src/widgets/widgets/qtabbar.h1
-rw-r--r--src/widgets/widgets/qtextedit.cpp15
-rw-r--r--src/xml/doc/qtxml.qdocconf4
-rw-r--r--src/xml/sax/qxml.cpp63
-rw-r--r--sync.profile2
-rwxr-xr-xtests/auto/android/runtests_androiddeployqt.pl38
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp2
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp15
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+android/test2 (renamed from tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+blackberry/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+ios/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+linux/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+mac/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+mac/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+wince/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+windows/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/test20
-rw-r--r--tests/auto/corelib/io/qfileselector/qfileselector.qrc22
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp30
-rw-r--r--tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp1
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp10
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp8
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp38
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp97
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp113
-rw-r--r--tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp1
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp12
-rw-r--r--tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp12
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp2
-rw-r--r--tests/auto/corelib/tools/qcollator/qcollator.pro7
-rw-r--r--tests/auto/corelib/tools/qcollator/tst_qcollator.cpp (renamed from src/gui/text/qpfutil.cpp)72
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp11
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp49
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp8
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp9
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp94
-rw-r--r--tests/auto/corelib/tools/tools.pro1
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp16
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp7
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp31
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp4
-rw-r--r--tests/auto/opengl/qgl/qgl.pro1
-rw-r--r--tests/auto/opengl/qglthreads/tst_qglthreads.cpp12
-rw-r--r--tests/auto/other/macgui/guitest.cpp25
-rw-r--r--tests/auto/other/macgui/guitest.h3
-rw-r--r--tests/auto/other/qobjectrace/tst_qobjectrace.cpp76
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp79
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp9
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp68
-rw-r--r--tests/auto/tools/moc/moc.pro3
-rw-r--r--tests/auto/tools/moc/single-quote-digit-separator-n3781.h58
-rw-r--r--tests/auto/tools/qdbuscpp2xml/test1.h11
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp9
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp30
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp42
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp14
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp12
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp154
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp30
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp58
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp14
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp170
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp29
-rw-r--r--tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp24
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp3
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp8
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp53
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp58
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/xmldocs/1-levels-nested-dtd.xml12
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/xmldocs/2-levels-nested-dtd.xml13
-rw-r--r--tests/auto/xml/sax/qxmlsimplereader/xmldocs/internal-entity-polynomial-attribute.xml13
-rw-r--r--tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro1
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp4
-rw-r--r--tests/manual/cocoa/qt_on_cocoa/main.mm2
-rw-r--r--tests/manual/dialogs/dialogs.pro6
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp49
-rw-r--r--tests/manual/dialogs/fontdialogpanel.cpp2
-rw-r--r--tests/manual/dialogs/main.cpp4
-rw-r--r--tests/manual/dialogs/messageboxpanel.cpp4
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp417
-rw-r--r--tests/manual/dialogs/printdialogpanel.h95
-rw-r--r--tests/manual/dialogs/utils.cpp85
-rw-r--r--tests/manual/dialogs/utils.h88
-rw-r--r--tests/manual/widgets/itemviews/autoResizePrecision/tablehorz/testtable1.cpp3
-rw-r--r--tests/manual/widgets/itemviews/autoResizePrecision/tablevert/testtable2.cpp3
-rw-r--r--tests/manual/widgets/itemviews/autoResizePrecision/treeview/testtree.cpp4
-rw-r--r--tools/configure/configureapp.cpp153
-rw-r--r--tools/configure/configureapp.h1
-rw-r--r--tools/configure/main.cpp3
-rw-r--r--util/accessibilityinspector/screenreader.cpp1
-rwxr-xr-xutil/scripts/make_qfeatures_dot_h198
-rwxr-xr-xutil/scripts/unix_to_dos16
662 files changed, 13775 insertions, 10958 deletions
diff --git a/config.tests/.qmake.conf b/config.tests/.qmake.conf
new file mode 100644
index 0000000000..71e6817656
--- /dev/null
+++ b/config.tests/.qmake.conf
@@ -0,0 +1,6 @@
+mingw {
+ TMPPATH = $$(INCLUDE)
+ QMAKE_INCDIR_POST += $$split(TMPPATH, $$QMAKE_DIRLIST_SEP)
+ TMPPATH = $$(LIB)
+ QMAKE_LIBDIR_POST += $$split(TMPPATH, $$QMAKE_DIRLIST_SEP)
+}
diff --git a/config.tests/unix/gstreamer/gstreamer.pro b/config.tests/unix/gstreamer/gstreamer.pro
deleted file mode 100644
index 7d4aa8e2e5..0000000000
--- a/config.tests/unix/gstreamer/gstreamer.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = gstreamer.cpp
-CONFIG -= qt
-LIBS += -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10
diff --git a/config.tests/unix/icu/icu.pro b/config.tests/unix/icu/icu.pro
index 002c4840d5..2c1b431f92 100644
--- a/config.tests/unix/icu/icu.pro
+++ b/config.tests/unix/icu/icu.pro
@@ -1,4 +1,16 @@
SOURCES = icu.cpp
+CONFIG += console
CONFIG -= qt dylib
-unix:LIBS += -licuuc -licui18n
-win32:LIBS += -licuin
+win32 {
+ CONFIG(static, static|shared) {
+ CONFIG(debug, debug|release) {
+ LIBS += -lsicuind -lsicuucd -lsicudtd
+ } else {
+ LIBS += -lsicuin -lsicuuc -lsicudt
+ }
+ } else {
+ LIBS += -licuin -licuuc
+ }
+} else {
+ LIBS += -licui18n -licuuc
+}
diff --git a/config.tests/unix/makeabs b/config.tests/unix/makeabs
index 4df26f769f..d2f65d19e9 100755
--- a/config.tests/unix/makeabs
+++ b/config.tests/unix/makeabs
@@ -15,13 +15,13 @@ elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then
true
else
RES="$PWD/$FILE"
- test -d "$RES" && RES="$RES/"
- RES=`echo "$RES" | sed "s,/\(\./\)*,/,g"`
-
-# note: this will only strip 1 /path/../ from RES, i.e. given /a/b/c/../../../, it returns /a/b/../../
- RES=`echo "$RES" | sed "s,\(/[^/]*/\)\.\./,/,g"`
-
- RES=`echo "$RES" | sed "s,//,/,g" | sed "s,/$,,"`
fi
+RES=$RES/
+while true; do
+ nres=`echo "$RES" | sed "s,/[^/][^/]*/\.\./,/,g; s,/\./,/,g"`
+ test x"$nres" = x"$RES" && break
+ RES=$nres
+done
+RES=`echo "$RES" | sed "s,//,/,g; s,/$,,"`
echo $RES #return
diff --git a/src/gui/accessible/qaccessible2_p.h b/config.tests/unix/pps/pps.cpp
index bb5ddf6edf..3f00509973 100644
--- a/src/gui/accessible/qaccessible2_p.h
+++ b/config.tests/unix/pps/pps.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,7 +39,12 @@
**
****************************************************************************/
-#ifndef QACCESSIBLE2_H
-#define QACCESSIBLE2_H
+#include <sys/pps.h>
-#endif
+int main(int, char **)
+{
+ pps_decoder_t decoder;
+
+ pps_decoder_initialize(&decoder, NULL);
+ return 0;
+}
diff --git a/config.tests/unix/pps/pps.pro b/config.tests/unix/pps/pps.pro
new file mode 100644
index 0000000000..21bdeedbfb
--- /dev/null
+++ b/config.tests/unix/pps/pps.pro
@@ -0,0 +1,3 @@
+SOURCES = pps.cpp
+CONFIG -= qt
+LIBS += -lpps
diff --git a/configure b/configure
index 2933ff6401..c3297a691a 100755
--- a/configure
+++ b/configure
@@ -53,12 +53,38 @@ relpath=`(cd "$relpath"; /bin/pwd)`
# the current directory is the "build tree" or "object tree"
outpath=`/bin/pwd`
-#license file location
-LICENSE_FILE="$QT_LICENSE_FILE"
-[ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license"
-if [ -f "$LICENSE_FILE" ]; then
- tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp"
- diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp"
+# where to find which..
+unixtests="$relpath/config.tests/unix"
+mactests="$relpath/config.tests/mac"
+WHICH="$unixtests/which.test"
+
+PERL=`$WHICH perl 2>/dev/null`
+
+# find out which awk we want to use, prefer gawk, then nawk, then regular awk
+AWK=
+for e in gawk nawk awk; do
+ if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
+ AWK=$e
+ break
+ fi
+done
+
+# find a make command
+if [ -z "$MAKE" ]; then
+ MAKE=
+ for mk in gmake make; do
+ if "$WHICH" $mk >/dev/null 2>&1; then
+ MAKE=`"$WHICH" $mk`
+ break
+ fi
+ done
+ if [ -z "$MAKE" ]; then
+ echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
+ echo >&2 "Cannot proceed."
+ exit 1
+ fi
+ # export MAKE, we need it later in the config.tests
+ export MAKE
fi
# do this early so we don't store it in config.status
@@ -93,6 +119,13 @@ shellEscape()
echo "$@" | sed 's/ /\ /g'
}
+shellQuoteLines()
+{
+ # The call of the outer echo makes the shell word-split the output of
+ # the nested pipe, thus effectively converting newlines to spaces.
+ echo `echo "$1" | sed 's,^[^ ]* .*$,"&",'`
+}
+
# Adds a new qmake variable to the cache
# Usage: QMakeVar mode varname contents
# where mode is one of: set, add, del
@@ -295,7 +328,7 @@ getXQMakeConf()
{
if [ -z "$xspecvals" ]; then
xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" | extractQMakeVariables "!host_build"`
- if [ "$BUILD_ON_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi
+ if [ "$XPLATFORM_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi
fi
getSingleQMakeVariable "$1" "$xspecvals"
}
@@ -450,10 +483,8 @@ fi
#-------------------------------------------------------------------------------
BUILD_ON_MAC=no
-PLATFORM_MAC=no
if [ -d /System/Library/Frameworks/Carbon.framework ]; then
BUILD_ON_MAC=yes
- PLATFORM_MAC=maybe
fi
BUILD_ON_MSYS=no
HOST_DIRLIST_SEP=":"
@@ -514,315 +545,6 @@ if [ -z "$QT_MAJOR_VERSION" ]; then
fi
#-------------------------------------------------------------------------------
-# check the license
-#-------------------------------------------------------------------------------
-COMMERCIAL_USER=ask
-CFG_DEV=no
-CFG_RTOS_ENABLED=yes
-EditionString=Commercial
-
-earlyArgParse()
-{
- # parse the arguments, setting things to "yes" or "no"
- while [ "$#" -gt 0 ]; do
- CURRENT_OPT="$1"
- UNKNOWN_ARG=no
- case "$1" in
- #Autoconf style options
- --enable-*)
- VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
- VAL=yes
- ;;
- --disable-*)
- VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
- VAL=no
- ;;
- --*=*)
- VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
- VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
- ;;
- --no-*)
- VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
- VAL=no
- ;;
- -h|help|--help|-help)
- if [ "$VAL" = "yes" ]; then
- OPT_HELP="$VAL"
- COMMERCIAL_USER="no" #doesn't matter we will display the help
- else
- UNKNOWN_OPT=yes
- COMMERCIAL_USER="no" #doesn't matter we will display the help
- fi
- ;;
- --*)
- VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
- VAL=yes
- ;;
- -*)
- VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
- VAL="unknown"
- ;;
- *)
- UNKNOWN_ARG=yes
- ;;
- esac
- if [ "$UNKNOWN_ARG" = "yes" ]; then
- shift
- continue
- fi
- shift
-
- UNKNOWN_OPT=no
- case "$VAR" in
- developer-build)
- CFG_DEV="yes"
- ;;
- commercial)
- COMMERCIAL_USER="yes"
- ;;
- opensource)
- COMMERCIAL_USER="no"
- ;;
- *)
- UNKNOWN_OPT=yes
- ;;
- esac
- done
-}
-
-earlyArgParse "$@"
-
-if [ "$COMMERCIAL_USER" = "ask" ]; then
- while true; do
- echo "Which edition of Qt do you want to use ?"
- echo
- echo "Type 'c' if you want to use the Commercial Edition."
- echo "Type 'o' if you want to use the Open Source Edition."
- echo
- read commercial
- echo
- if [ "$commercial" = "c" ]; then
- COMMERCIAL_USER="yes"
- break
- elif [ "$commercial" = "o" ]; then
- COMMERCIAL_USER="no"
- break
- fi
- done
-fi
-
-if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
- # Commercial preview release
- [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
- Licensee="Preview"
- Edition="Preview"
- QT_EDITION="QT_EDITION_DESKTOP"
- LicenseType="Technology Preview"
-elif [ $COMMERCIAL_USER = "yes" ]; then
- # one of commercial editions
- [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
-
- # read in the license file
- if [ -f "$LICENSE_FILE" ]; then
- . "$LICENSE_FILE" >/dev/null 2>&1
- if [ -z "$LicenseKeyExt" ]; then
- echo
- echo "You are using an old license file."
- echo
- echo "Please install the license file supplied by Digia,"
- echo "or install the Qt Open Source Edition if you intend to"
- echo "develop free software."
- exit 1
- fi
- if [ -z "$Licensee" ]; then
- echo
- echo "Invalid license key. Please check the license key."
- exit 1
- fi
- else
- if [ -z "$LicenseKeyExt" ]; then
- echo
- echo $ECHO_N "Please enter your license key: $ECHO_C"
- read LicenseKeyExt
- Licensee="Unknown user"
- fi
- fi
-
- # Key verification
- echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
- && LicenseValid="yes" \
- || LicenseValid="no"
- if [ "$LicenseValid" != "yes" ]; then
- echo
- echo "Invalid license key. Please check the license key."
- exit 1
- fi
- ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
- PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
- LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
- LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
-
- # determine which edition we are licensed to use
- case "$LicenseTypeCode" in
- F4M)
- LicenseType="Commercial"
- case $ProductCode in
- F)
- Edition="Universal"
- QT_EDITION="QT_EDITION_UNIVERSAL"
- ;;
- B)
- Edition="FullFramework"
- EditionString="Full Framework"
- QT_EDITION="QT_EDITION_DESKTOP"
- ;;
- L)
- Edition="GUIFramework"
- EditionString="GUI Framework"
- QT_EDITION="QT_EDITION_DESKTOPLIGHT"
- ;;
- esac
- ;;
- Z4M|R4M|Q4M)
- LicenseType="Evaluation"
- QMakeVar add DEFINES QT_EVAL
- case $ProductCode in
- B)
- Edition="Evaluation"
- QT_EDITION="QT_EDITION_EVALUATION"
- ;;
- esac
- ;;
- esac
- if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
- echo
- echo "Invalid license key. Please check the license key."
- exit 1
- fi
-
- # verify that we are licensed to use Qt on this platform
- LICENSE_EXTENSION=
- case "$PlatformCode" in
- *L)
- CFG_RTOS_ENABLED=yes
- PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
- ;;
- *)
- CFG_RTOS_ENABLED=no
- PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
- ;;
- esac
- ### EMBEDDED_QPA logic missing ###
- case "$PlatformCode,$PLATFORM_MAC" in
- X9,* | XC,* | XU,* | XW,* | XM,*)
- # Qt All-OS
- LICENSE_EXTENSION="-ALLOS"
- ;;
- 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
- # Qt for Embedded Linux
- LICENSE_EXTENSION="-EMBEDDED"
- ;;
- 6M,* | N7,* | N9,* | NX,*)
- # Embedded no-deploy
- LICENSE_EXTENSION="-EMBEDDED"
- ;;
- FM,* | LM,yes | ZM,no)
- # Desktop
- LICENSE_EXTENSION="-DESKTOP"
- ;;
- *)
- Platform=Linux/X11
- [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
- echo
- echo "You are not licensed for the $Platform platform."
- echo
- echo "Please use the contact form at http://qt.digia.com/contact-us"
- echo "to upgrade your license to include the $Platform platform, or install"
- echo "the Qt Open Source Edition if you intend to develop free software."
- exit 1
- ;;
- esac
-
- if test -r "$relpath/.LICENSE"; then
- # Generic, non-final license
- LICENSE_EXTENSION=""
- line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
- case "$line" in
- *BETA*)
- Edition=Beta
- ;;
- *TECHNOLOGY?PREVIEW*)
- Edition=Preview
- ;;
- *EVALUATION*)
- Edition=Evaluation
- ;;
- *)
- echo >&2 "Invalid license files; cannot continue"
- exit 1
- ;;
- esac
- Licensee="$Edition"
- EditionString="$Edition"
- QT_EDITION="QT_EDITION_DESKTOP"
- fi
-
- case "$LicenseFeatureCode" in
- B|G|L|Y)
- # US
- case "$LicenseType" in
- Commercial)
- cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
- ;;
- Evaluation)
- cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
- ;;
- esac
- ;;
- 2|4|5|F)
- # non-US
- case "$LicenseType" in
- Commercial)
- cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
- ;;
- Evaluation)
- cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
- ;;
- esac
- ;;
- *)
- echo
- echo "Invalid license key. Please check the license key."
- exit 1
- ;;
- esac
- case "$LicenseFeatureCode" in
- 4|B|F|Y)
- CFG_RTOS_ENABLED=yes
- ;;
- 2|5|G|L)
- CFG_RTOS_ENABLED=no
- ;;
- esac
- if [ '!' -f "$outpath/LICENSE" ]; then
- echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
- echo "this software has disappeared."
- echo
- echo "Sorry, you are not licensed to use this software."
- echo "Try re-installing."
- echo
- exit 1
- fi
-elif [ $COMMERCIAL_USER = "no" ]; then
- # Open Source edition - may only be used under the terms of the GPL or LGPL.
- [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
- Licensee="Open Source"
- Edition="OpenSource"
- EditionString="Open Source"
- QT_EDITION="QT_EDITION_OPENSOURCE"
-fi
-
-#-------------------------------------------------------------------------------
# initalize variables
#-------------------------------------------------------------------------------
@@ -907,6 +629,7 @@ CFG_JAVASCRIPTCORE_JIT=auto
CFG_PKGCONFIG=auto
CFG_STACK_PROTECTOR_STRONG=auto
CFG_SLOG2=auto
+CFG_PPS=auto
CFG_QNX_IMF=auto
CFG_SYSTEM_PROXIES=no
@@ -939,7 +662,6 @@ CFG_CUPS=auto
CFG_ICONV=auto
CFG_DBUS=auto
CFG_GLIB=auto
-CFG_GSTREAMER=auto
CFG_QGTKSTYLE=auto
CFG_LARGEFILE=auto
CFG_OPENSSL=auto
@@ -979,6 +701,8 @@ RPATH_FLAGS=
W_FLAGS=
QCONFIG_FLAGS=
XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
+XPLATFORM_MAC=no
+XPLATFORM_IOS=no
XPLATFORM_ANDROID=no
XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
XPLATFORM_MAEMO=no
@@ -1001,6 +725,11 @@ QPA_PLATFORM_GUARD=yes
CFG_CXX11=auto
CFG_DIRECTWRITE=no
CFG_WERROR=auto
+CFG_QREAL=double
+OPT_MAC_SDK=
+COMMERCIAL_USER=ask
+LICENSE_FILE=
+CFG_DEV=no
# initalize variables used for installation
QT_INSTALL_PREFIX=
@@ -1045,13 +774,17 @@ QT_LIBS_DBUS=
QT_CFLAGS_GLIB=
QT_LIBS_GLIB=
-# flags for GStreamer (X11 only)
-QT_CFLAGS_GSTREAMER=
-QT_LIBS_GSTREAMER=
-
# default qpa platform
QT_QPA_DEFAULT_PLATFORM=
+# Android vars
+CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
+CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
+CFG_DEFAULT_ANDROID_PLATFORM=android-9
+CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a
+CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.8
+CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST
+
#-------------------------------------------------------------------------------
# check SQL drivers available in this package
#-------------------------------------------------------------------------------
@@ -1062,15 +795,6 @@ CFG_SQL_oci=no
CFG_SQL_db2=no
CFG_SQL_AVAILABLE=
-
-# Android vars
-CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
-CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
-CFG_DEFAULT_ANDROID_PLATFORM=android-9
-CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a
-CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.8
-CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST
-
if [ -d "$relpath/src/plugins/sqldrivers" ]; then
for a in "$relpath/src/plugins/sqldrivers/"*; do
if [ -d "$a" ]; then
@@ -1166,6 +890,7 @@ while [ "$#" -gt 0 ]; do
-mysql_config| \
-qpa| \
-qconfig| \
+ -qreal| \
-android-sdk| \
-android-ndk| \
-android-ndk-platform| \
@@ -1319,7 +1044,6 @@ while [ "$#" -gt 0 ]; do
esac
if [ "$UNKNOWN_ARG" = "yes" ]; then
echo "$1: unknown argument"
- OPT_HELP=yes
ERROR=yes
shift
continue
@@ -1417,6 +1141,9 @@ while [ "$#" -gt 0 ]; do
qconfig)
CFG_QCONFIG="$VAL"
;;
+ qreal)
+ CFG_QREAL="$VAL"
+ ;;
sysroot)
CFG_SYSROOT="$VAL"
;;
@@ -1488,6 +1215,7 @@ while [ "$#" -gt 0 ]; do
sdk)
if [ "$BUILD_ON_MAC" = "yes" ]; then
DeviceVar set !host_build:QMAKE_MAC_SDK "$VAL"
+ OPT_MAC_SDK="$VAL"
else
UNKNOWN_OPT=yes
fi
@@ -1646,8 +1374,14 @@ while [ "$#" -gt 0 ]; do
force-debug-info)
CFG_FORCEDEBUGINFO="$VAL"
;;
- developer-build|commercial|opensource)
- # These switches have been dealt with already
+ developer-build)
+ CFG_DEV="yes"
+ ;;
+ commercial)
+ COMMERCIAL_USER="yes"
+ ;;
+ opensource)
+ COMMERCIAL_USER="no"
;;
static)
if [ "$VAL" = "yes" ]; then
@@ -2044,9 +1778,9 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
- gstreamer)
+ pps)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_GSTREAMER="$VAL"
+ CFG_PPS="$VAL"
else
UNKNOWN_OPT=yes
fi
@@ -2200,7 +1934,11 @@ while [ "$#" -gt 0 ]; do
break
fi
done
- [ "$found" = yes ] || ERROR=yes
+ if [ "$found" != "yes" ]; then
+ echo "$CURRENT_OPT: unknown argument"
+ ERROR=yes
+ continue
+ fi
if [ "$VAR" = "sql" ]; then
# set the CFG_SQL_driver
@@ -2224,10 +1962,6 @@ while [ "$#" -gt 0 ]; do
QMakeVar del "${IN_VAR}s" "$VAL"
QMakeVar del "${PLUG_VAR}s" "$VAL"
fi
- if [ "$ERROR" = "yes" ]; then
- echo "$CURRENT_OPT: unknown argument"
- OPT_HELP=yes
- fi
;;
v|verbose)
if [ "$VAL" = "yes" ]; then
@@ -2401,131 +2135,386 @@ while [ "$#" -gt 0 ]; do
esac
if [ "$UNKNOWN_OPT" = "yes" ]; then
echo "${CURRENT_OPT}: invalid command-line switch"
- OPT_HELP=yes
ERROR=yes
fi
done
-
-# update QT_CONFIG to show our current predefined configuration
-case "$CFG_QCONFIG" in
-minimal|small|medium|large|full)
- # these are a sequence of increasing functionality
- for c in minimal small medium large full; do
- QT_CONFIG="$QT_CONFIG $c-config"
- [ "$CFG_QCONFIG" = $c ] && break
- done
- ;;
-*)
- # not known to be sufficient for anything
- if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ] && [ '!' -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
- echo >&2 "Error: configuration file not found:"
- echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
- echo >&2 " or"
- echo >&2 " `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"`"
- OPT_HELP=yes
- fi
-esac
+[ "x$ERROR" = "xyes" ] && exit 1
#-------------------------------------------------------------------------------
-# build tree initialization
+# help - interactive parts of the script _after_ this section please
#-------------------------------------------------------------------------------
-# where to find which..
-unixtests="$relpath/config.tests/unix"
-mactests="$relpath/config.tests/mac"
-WHICH="$unixtests/which.test"
+if [ "$OPT_HELP" = "yes" ]; then
+ cat <<EOF
+Usage: $relconf [options]
-PERL=`$WHICH perl 2>/dev/null`
+Installation options:
-# find out which awk we want to use, prefer gawk, then nawk, then regular awk
-AWK=
-for e in gawk nawk awk; do
- if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then
- AWK=$e
- break
- fi
-done
+ These are optional, but you may specify install directories.
-### skip this if the user just needs help...
-if [ "$OPT_HELP" != "yes" ]; then
+ -prefix <dir> ...... This will install everything relative to <dir>
+ (default /usr/local/Qt-${QT_VERSION}, \$PWD if -developer-build is active)
-# is this a shadow build?
-if [ "$OPT_SHADOW" = "maybe" ]; then
- OPT_SHADOW=no
- if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
- if [ -h "$outpath" ]; then
- [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
- else
- OPT_SHADOW=yes
- fi
- fi
-fi
-if [ "$OPT_SHADOW" = "yes" ]; then
- if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
- echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
- echo >&2 "Cannot proceed."
- exit 1
- fi
- [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
-fi
+ -extprefix <dir> ... When -sysroot is used, install everything to <dir>,
+ rather than into SYSROOT/PREFIX.
-if [ "$PLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then
- echo
- echo "WARNING: -debug-and-release is not supported outside of Mac OS X."
- echo "Qt can be built in release mode with separate debug information, so"
- echo "-debug-and-release is not necessary anymore"
- echo
-fi
+ -hostprefix [dir] .. Tools and libraries needed when developing
+ applications are installed in [dir]. If [dir] is
+ not given, the current build directory will be used.
+ (default EXTPREFIX)
-if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then
- echo "Error: -no-xkbcommon is not supported on XCB platform plugin."
- exit 101
-fi
+ You may use these to separate different parts of the install:
-if [ "$CFG_SILENT" = "yes" ]; then
- QMAKE_CONFIG="$QMAKE_CONFIG silent"
-fi
+ -bindir <dir> ......... User executables will be installed to <dir>
+ (default PREFIX/bin)
+ -headerdir <dir> ...... Headers will be installed to <dir>
+ (default PREFIX/include)
+ -libdir <dir> ......... Libraries will be installed to <dir>
+ (default PREFIX/lib)
+ -archdatadir <dir> .... Arch-dependent data used by Qt will be installed to <dir>
+ (default PREFIX)
+ -plugindir <dir> ...... Plugins will be installed to <dir>
+ (default ARCHDATADIR/plugins)
+ -libexecdir <dir> ..... Program executables will be installed to <dir>
+ (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW)
+ -importdir <dir> ...... Imports for QML1 will be installed to <dir>
+ (default ARCHDATADIR/imports)
+ -qmldir <dir> ......... Imports for QML2 will be installed to <dir>
+ (default ARCHDATADIR/qml)
+ -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir>
+ (default PREFIX)
+ -docdir <dir> ......... Documentation will be installed to <dir>
+ (default DATADIR/doc)
+ -translationdir <dir> . Translations of Qt programs will be installed to <dir>
+ (default DATADIR/translations)
+ -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
+ (default PREFIX/etc/xdg)
+ -examplesdir <dir> .... Examples will be installed to <dir>
+ (default PREFIX/examples)
+ -testsdir <dir> ....... Tests will be installed to <dir>
+ (default PREFIX/tests)
-# if the source tree is different from the build tree,
-# symlink or copy part of the sources
-if [ "$OPT_SHADOW" = "yes" ]; then
- echo "Preparing build tree..."
+ -hostbindir <dir> .. Host executables will be installed to <dir>
+ (default HOSTPREFIX/bin)
+ -hostlibdir <dir> .. Host libraries will be installed to <dir>
+ (default HOSTPREFIX/lib)
+ -hostdatadir <dir> . Data used by qmake will be installed to <dir>
+ (default HOSTPREFIX)
- [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
+Configure options:
- mkdir -p "$outpath/mkspecs"
-fi
+ The defaults (*) are usually acceptable. A plus (+) denotes a default value
+ that needs to be evaluated. If the evaluation succeeds, the feature is
+ included. Here is a short explanation of each option:
-# symlink fonts to be able to run application from build directory
-if [ ! -d "${outpath}/lib/fonts" ]; then
- if [ "$PLATFORM" = "$XPLATFORM" ]; then
- mkdir -p "${outpath}/lib"
- ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
- fi
-fi
+ * -release ........... Compile and link Qt with debugging turned off.
+ -debug ............. Compile and link Qt with debugging turned on.
+ -debug-and-release . Compile and link two versions of Qt, with and without
+ debugging turned on (Mac only).
-# find a make command
-if [ -z "$MAKE" ]; then
- MAKE=
- for mk in gmake make; do
- if "$WHICH" $mk >/dev/null 2>&1; then
- MAKE=`"$WHICH" $mk`
- break
- fi
- done
- if [ -z "$MAKE" ]; then
- echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
- echo >&2 "Cannot proceed."
- exit 1
- fi
- # export MAKE, we need it later in the config.tests
- export MAKE
-fi
+ -force-debug-info .. Create symbol files for release builds.
+
+ -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
+
+ -opensource ........ Compile and link the Open-Source Edition of Qt.
+ -commercial ........ Compile and link the Commercial Edition of Qt.
+
+ -confirm-license ... Automatically acknowledge the license (use with
+ either -opensource or -commercial)
+
+ -no-c++11 .......... Do not compile Qt with C++11 support enabled.
+ + -c++11 ............. Compile Qt with C++11 support enabled.
+
+ * -shared ............ Create and use shared Qt libraries.
+ -static ............ Create and use static Qt libraries.
+
+ * -process ........... Generate only a top-level Makefile.
+ -fully-process ..... Generate Makefiles for the entire Qt tree.
+ -dont-process ...... Do not generate any Makefiles.
+
+ -no-largefile ...... Disables large file support.
+ + -largefile ......... Enables Qt to access files larger than 4 GB.
+
+ -no-accessibility .. Do not compile Accessibility support.
+ Disabling accessibility is not recommended, as it will break QStyle
+ and may break other internal parts of Qt.
+ With this switch you create a source incompatible version of Qt,
+ which is unsupported.
+ + -accessibility ..... Compile Accessibility support.
+
+ -no-sql-<driver> ... Disable SQL <driver> entirely.
+ -qt-sql-<driver> ... Enable a SQL <driver> in the Qt SQL module, by default
+ none are turned on.
+ -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
+ at run time.
+
+ Possible values for <driver>:
+ [$CFG_SQL_AVAILABLE ]
+
+ -system-sqlite ..... Use sqlite from the operating system.
+
+ -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
+ + -javascript-jit .... Build the JavaScriptCore JIT compiler.
+
+ -no-qml-debug ...... Do not build the in-process QML debugging support.
+ + -qml-debug ......... Build the QML debugging support.
+
+ -platform target ... The operating system and compiler you are building
+ on (default detected from host system).
+
+ See the README file for a list of supported
+ operating systems and compilers.
+
+ -no-sse2 ........... Do not compile with use of SSE2 instructions.
+ -no-sse3 ........... Do not compile with use of SSE3 instructions.
+ -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
+ -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions.
+ -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions.
+ -no-avx ............ Do not compile with use of AVX instructions.
+ -no-avx2 ........... Do not compile with use of AVX2 instructions.
+ -no-neon ........... Do not compile with use of NEON instructions.
+ -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions.
+ -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions.
+
+ -qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'.
+ -qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so.
+
+ -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool.
+ -gcov .............. Instrument Qt with the GCov code coverage tool.
+
+ -D <string> ........ Add an explicit define to the preprocessor.
+ -I <string> ........ Add an explicit include path.
+ -L <string> ........ Add an explicit library path.
+
+ + -pkg-config ........ Use pkg-config to detect include and library paths. By default,
+ configure determines whether to use pkg-config or not with
+ some heuristics such as checking the environment variables.
+ -no-pkg-config ..... Disable use of pkg-config.
+ -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability
+ detection heuristic).
+
+ -help, -h .......... Display this information.
+
+Third Party Libraries:
+
+ -qt-zlib ........... Use the zlib bundled with Qt.
+ + -system-zlib ....... Use zlib from the operating system.
+ See http://www.gzip.org/zlib
+
+ -no-gif ............ Do not compile GIF reading support.
+
+ -no-libpng ......... Do not compile PNG support.
+ -qt-libpng ......... Use the libpng bundled with Qt.
+ + -system-libpng ..... Use libpng from the operating system.
+ See http://www.libpng.org/pub/png
+
+ -no-libjpeg ........ Do not compile JPEG support.
+ -qt-libjpeg ........ Use the libjpeg bundled with Qt.
+ + -system-libjpeg .... Use libjpeg from the operating system.
+ See http://www.ijg.org
+
+ -no-freetype ....... Do not compile in Freetype2 support.
+ -qt-freetype ....... Use the libfreetype bundled with Qt.
+ + -system-freetype.... Use the libfreetype provided by the system (enabled if -fontconfig is active).
+ See http://www.freetype.org
+
+ * -no-harfbuzz ....... Do not compile HarfBuzz-NG support.
+ -qt-harfbuzz ....... (experimental) Use HarfBuzz-NG bundled with Qt
+ to do text shaping. It can still be disabled
+ by setting QT_HARFBUZZ environment variable to "old".
+ -system-harfbuzz ... (experimental) Use HarfBuzz-NG from the operating system
+ to do text shaping. It can still be disabled
+ by setting QT_HARFBUZZ environment variable to "old".
+
+ -no-openssl ........ Do not compile support for OpenSSL.
+ + -openssl ........... Enable run-time OpenSSL support.
+ -openssl-linked .... Enabled linked OpenSSL support.
+
+ -qt-pcre ........... Use the PCRE library bundled with Qt.
+ + -system-pcre ....... Use the PCRE library from the operating system.
+
+ -qt-xcb ............ Use xcb- libraries bundled with Qt.
+ (libxcb.so will still be used from operating system).
+ + -system-xcb ........ Use xcb- libraries from the operating system.
+
+ -qt-xkbcommon ...... Use the xkbcommon library bundled with Qt.
+ + -system-xkbcommon .. Use the xkbcommon library from the operating system.
+
+ -no-xinput2 ........ Do not compile XInput2 support.
+ * -xinput2 ........... Compile XInput2 support.
+
+ -no-glib ........... Do not compile Glib support.
+ + -glib .............. Compile Glib support.
+
+Additional options:
+
+ -make <part> ....... Add part to the list of parts to be built at make time.
+ (defaults to: $QT_DEFAULT_BUILD_PARTS)
+ -nomake <part> ..... Exclude part from the list of parts to be built.
+
+ -skip <module> ..... Exclude an entire module from the build.
+
+ -no-compile-examples ... Install only the sources of examples.
+
+ -no-gui ............ Don't build the Qt GUI module and dependencies.
+ + -gui ............... Build the Qt GUI module and dependencies.
+
+ -no-widgets ........ Don't build the Qt Widgets module and dependencies.
+ + -widgets ........... Build the Qt Widgets module and dependencies.
+
+ -R <string> ........ Add an explicit runtime library path to the Qt
+ libraries.
+ -l <string> ........ Add an explicit library.
+
+ -no-rpath .......... Do not use the library install path as a runtime
+ library path.
+ + -rpath ............. Link Qt libraries and executables using the library
+ install path as a runtime library path. Equivalent
+ to -R install_libpath
+
+ -continue .......... Continue as far as possible if an error occurs.
+
+ -verbose, -v ....... Print verbose information about each step of the
+ configure process.
+
+ -silent ............ Reduce the build output so that warnings and errors
+ can be seen more easily.
+
+ * -no-optimized-qmake ... Do not build qmake optimized.
+ -optimized-qmake ...... Build qmake optimized.
+
+ -no-nis ............ Do not compile NIS support.
+ * -nis ............... Compile NIS support.
+
+ -no-cups ........... Do not compile CUPS support.
+ * -cups .............. Compile CUPS support.
+ Requires cups/cups.h and libcups.so.2.
+
+ -no-iconv .......... Do not compile support for iconv(3).
+ * -iconv ............. Compile support for iconv(3).
+
+ -no-icu ............ Do not compile support for ICU libraries.
+ + -icu ............... Compile support for ICU libraries.
+
+ -no-fontconfig ..... Do not compile FontConfig support.
+ + -fontconfig ........ Compile FontConfig support.
+
+ -no-strip .......... Do not strip binaries and libraries of unneeded symbols.
+ * -strip ............. Strip binaries and libraries of unneeded symbols when installing.
+
+ * -no-pch ............ Do not use precompiled header support.
+ -pch ............... Use precompiled header support.
+
+ -no-dbus ........... Do not compile the Qt D-Bus module.
+ + -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1.
+ -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1.
+
+ -reduce-relocations ..... Reduce relocations in the libraries through extra
+ linker optimizations (Qt/X11 and Qt for Embedded Linux only;
+ experimental; needs GNU ld >= 2.18).
+
+ -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
+
+ -device <name> ............... Cross-compile for device <name> (experimental)
+ -device-option <key=value> ... Add device specific options for the device mkspec
+ (experimental)
+
+ -no-separate-debug-info . Do not store debug information in a separate file.
+ * -separate-debug-info .... Strip debug information into a separate file.
+
+ -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
+ * -xcb ............... Compile Xcb support.
+
+ -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
+ * -eglfs ............. Compile EGLFS support.
+
+ -no-directfb ....... Do not compile DirectFB support.
+ * -directfb .......... Compile DirectFB support.
+
+ -no-linuxfb ........ Do not compile Linux Framebuffer support.
+ * -linuxfb ........... Compile Linux Framebuffer support.
+
+ -no-kms ............ Do not compile KMS support.
+ * -kms ............... Compile KMS support (Requires EGL).
+
+ -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows).
+
+ -xplatform target ... The target platform when cross-compiling.
+
+ -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.
+ -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler
+
+ -no-feature-<feature> Do not compile in <feature>.
+ -feature-<feature> .. Compile in <feature>. The available features
+ are described in src/corelib/global/qfeatures.txt
+
+ -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
+ default ($CFG_QCONFIG).
+
+ -qreal [double|float] typedef qreal to the specified type. The default is double.
+ Note that changing this flag affects binary compatibility.
+
+ -no-opengl .......... Do not support OpenGL.
+ -opengl <api> ....... Enable OpenGL support
+ With no parameter, this will attempt to auto-detect
+ OpenGL ES 2, or regular desktop OpenGL.
+ Use es2 for <api> to override auto-detection.
+
+ * -no-system-proxies .. Do not use system network proxies by default.
+ -system-proxies ..... Use system network proxies by default.
+
+ -no-warnings-are-errors Make warnings be treated normally
+ -warnings-are-errors Make warnings be treated as errors
+ (enabled if -developer-build is active)
+
+QNX/Blackberry options:
+
+ -no-slog2 .......... Do not compile with slog2 support.
+ -slog2 ............. Compile with slog2 support.
+
+ -no-pps ............ Do not compile with pps support.
+ -pps ............... Compile with pps support.
+
+MacOS/iOS options:
+
+ -Fstring ........... Add an explicit framework path.
+ -fw string ......... Add an explicit framework.
+
+ * -framework ......... Build Qt as a series of frameworks and
+ link tools against those frameworks.
+ -no-framework ...... Do not build Qt as a series of frameworks.
+
+ -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be
+ one of the available SDKs as listed by 'xcodebuild -showsdks'.
+ Note that the argument applies only to Qt libraries and applications built
+ using the target mkspec - not host tools such as qmake, moc, rcc, etc.
+
+Android options:
-fi ### help
+ -android-sdk path .............. The Android SDK root path.
+ (default \$ANDROID_SDK_ROOT)
+
+ -android-ndk path .............. The Android NDK root path.
+ (default \$ANDROID_NDK_ROOT)
+
+ -android-ndk-platform .......... Sets the android platform
+ (default $CFG_DEFAULT_ANDROID_PLATFORM)
+
+ -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.)
+ (default \$ANDROID_NDK_HOST)
+
+ -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips)
+ (default $CFG_DEFAULT_ANDROID_TARGET_ARCH)
+
+ -android-toolchain-version ..... Sets the android toolchain version
+ (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION)
+EOF
+
+ exit 0
+fi # Help
#-------------------------------------------------------------------------------
-# auto-detect all that hasn't been specified in the arguments
+# platform detection
#-------------------------------------------------------------------------------
if [ -z "$PLATFORM" ]; then
@@ -2685,7 +2674,6 @@ if [ -z "$PLATFORM" ]; then
PLATFORM=unsupported/qnx-g++
;;
*)
- if [ "$OPT_HELP" != "yes" ]; then
echo >&2
echo " The build script does not currently recognize all" >&2
echo " platforms supported by Qt." >&2
@@ -2693,14 +2681,15 @@ if [ -z "$PLATFORM" ]; then
echo " set the system/compiler combination you use." >&2
echo >&2
exit 2
- fi
esac
fi
[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
-case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
case "$XPLATFORM" in
+ *win32-g++*)
+ XPLATFORM_MINGW=yes
+ ;;
*-maemo*)
XPLATFORM_MAEMO=yes
;;
@@ -2708,8 +2697,12 @@ case "$XPLATFORM" in
XPLATFORM_QNX=yes
;;
*ios*)
+ XPLATFORM_MAC=yes
XPLATFORM_IOS=yes
;;
+ *macx*)
+ XPLATFORM_MAC=yes
+ ;;
# XPLATFORM_ANDROID should not be set for unsupported/android-g++
*unsupported*)
;;
@@ -2718,6 +2711,443 @@ case "$XPLATFORM" in
;;
esac
+#-------------------------------------------------------------------------------
+# check the license
+#-------------------------------------------------------------------------------
+
+if [ "$COMMERCIAL_USER" = "ask" ]; then
+ while true; do
+ echo "Which edition of Qt do you want to use ?"
+ echo
+ echo "Type 'c' if you want to use the Commercial Edition."
+ echo "Type 'o' if you want to use the Open Source Edition."
+ echo
+ read commercial
+ echo
+ if [ "$commercial" = "c" ]; then
+ COMMERCIAL_USER="yes"
+ break
+ elif [ "$commercial" = "o" ]; then
+ COMMERCIAL_USER="no"
+ break
+ fi
+ done
+fi
+
+CFG_RTOS_ENABLED=yes
+EditionString=Commercial
+if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then
+ # Commercial preview release
+ Licensee="Preview"
+ Edition="Preview"
+ QT_EDITION="QT_EDITION_DESKTOP"
+ LicenseType="Technology Preview"
+elif [ $COMMERCIAL_USER = "yes" ]; then
+ # one of commercial editions
+
+ # read in the license file
+ [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$QT_LICENSE_FILE"
+ [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license"
+ if [ -f "$LICENSE_FILE" ]; then
+ tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp"
+ diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp"
+ . "$LICENSE_FILE" >/dev/null 2>&1
+ if [ -z "$LicenseKeyExt" ]; then
+ echo
+ echo "You are using an old license file."
+ echo
+ echo "Please install the license file supplied by Digia,"
+ echo "or install the Qt Open Source Edition if you intend to"
+ echo "develop free software."
+ exit 1
+ fi
+ if [ -z "$Licensee" ]; then
+ echo
+ echo "Invalid license key. Please check the license key."
+ exit 1
+ fi
+ else
+ if [ -z "$LicenseKeyExt" ]; then
+ echo
+ echo $ECHO_N "Please enter your license key: $ECHO_C"
+ read LicenseKeyExt
+ Licensee="Unknown user"
+ fi
+ fi
+
+ # Key verification
+ echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \
+ && LicenseValid="yes" \
+ || LicenseValid="no"
+ if [ "$LicenseValid" != "yes" ]; then
+ echo
+ echo "Invalid license key. Please check the license key."
+ exit 1
+ fi
+ ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
+ PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
+ LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
+ LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
+
+ # determine which edition we are licensed to use
+ case "$LicenseTypeCode" in
+ F4M)
+ LicenseType="Commercial"
+ case $ProductCode in
+ F)
+ Edition="Universal"
+ QT_EDITION="QT_EDITION_UNIVERSAL"
+ ;;
+ B)
+ Edition="FullFramework"
+ EditionString="Full Framework"
+ QT_EDITION="QT_EDITION_DESKTOP"
+ ;;
+ L)
+ Edition="GUIFramework"
+ EditionString="GUI Framework"
+ QT_EDITION="QT_EDITION_DESKTOPLIGHT"
+ ;;
+ esac
+ ;;
+ Z4M|R4M|Q4M)
+ LicenseType="Evaluation"
+ QMakeVar add DEFINES QT_EVAL
+ case $ProductCode in
+ B)
+ Edition="Evaluation"
+ QT_EDITION="QT_EDITION_EVALUATION"
+ ;;
+ esac
+ ;;
+ esac
+ if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then
+ echo
+ echo "Invalid license key. Please check the license key."
+ exit 1
+ fi
+
+ # verify that we are licensed to use Qt on this platform
+ LICENSE_EXTENSION=
+ case "$PlatformCode" in
+ *L)
+ CFG_RTOS_ENABLED=yes
+ PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
+ ;;
+ *)
+ CFG_RTOS_ENABLED=no
+ PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
+ ;;
+ esac
+ ### EMBEDDED_QPA logic missing ###
+ case "$PlatformCode,$XPLATFORM_MAC" in
+ X9,* | XC,* | XU,* | XW,* | XM,*)
+ # Qt All-OS
+ LICENSE_EXTENSION="-ALLOS"
+ ;;
+ 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
+ # Qt for Embedded Linux
+ LICENSE_EXTENSION="-EMBEDDED"
+ ;;
+ 6M,* | N7,* | N9,* | NX,*)
+ # Embedded no-deploy
+ LICENSE_EXTENSION="-EMBEDDED"
+ ;;
+ FM,* | LM,yes | ZM,no)
+ # Desktop
+ LICENSE_EXTENSION="-DESKTOP"
+ ;;
+ *)
+ Platform=Linux/X11
+ [ "$XPLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
+ echo
+ echo "You are not licensed for the $Platform platform."
+ echo
+ echo "Please use the contact form at http://qt.digia.com/contact-us"
+ echo "to upgrade your license to include the $Platform platform, or install"
+ echo "the Qt Open Source Edition if you intend to develop free software."
+ exit 1
+ ;;
+ esac
+
+ if test -r "$relpath/.LICENSE"; then
+ # Generic, non-final license
+ LICENSE_EXTENSION=""
+ line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE`
+ case "$line" in
+ *BETA*)
+ Edition=Beta
+ ;;
+ *TECHNOLOGY?PREVIEW*)
+ Edition=Preview
+ ;;
+ *EVALUATION*)
+ Edition=Evaluation
+ ;;
+ *)
+ echo >&2 "Invalid license files; cannot continue"
+ exit 1
+ ;;
+ esac
+ Licensee="$Edition"
+ EditionString="$Edition"
+ QT_EDITION="QT_EDITION_DESKTOP"
+ fi
+
+ case "$LicenseFeatureCode" in
+ B|G|L|Y)
+ # US
+ case "$LicenseType" in
+ Commercial)
+ cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE"
+ ;;
+ Evaluation)
+ cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE"
+ ;;
+ esac
+ ;;
+ 2|4|5|F)
+ # non-US
+ case "$LicenseType" in
+ Commercial)
+ cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE"
+ ;;
+ Evaluation)
+ cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE"
+ ;;
+ esac
+ ;;
+ *)
+ echo
+ echo "Invalid license key. Please check the license key."
+ exit 1
+ ;;
+ esac
+ case "$LicenseFeatureCode" in
+ 4|B|F|Y)
+ CFG_RTOS_ENABLED=yes
+ ;;
+ 2|5|G|L)
+ CFG_RTOS_ENABLED=no
+ ;;
+ esac
+ if [ '!' -f "$outpath/LICENSE" ]; then
+ echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with"
+ echo "this software has disappeared."
+ echo
+ echo "Sorry, you are not licensed to use this software."
+ echo "Try re-installing."
+ echo
+ exit 1
+ fi
+elif [ $COMMERCIAL_USER = "no" ]; then
+ # Open Source edition - may only be used under the terms of the GPL or LGPL.
+ Licensee="Open Source"
+ Edition="OpenSource"
+ EditionString="Open Source"
+ QT_EDITION="QT_EDITION_OPENSOURCE"
+fi
+echo
+echo "This is the Qt ${EditionString} Edition."
+echo
+
+if [ "$CFG_RTOS_ENABLED" = "no" ]; then
+ case `basename "$XPLATFORM"` in
+ qnx-* | vxworks-*)
+ echo ""
+ echo "You are not licensed for Qt for `basename $XPLATFORM`."
+ echo ""
+ echo "Please use the contact form at http://qt.digia.com/contact-us"
+ echo "to upgrade your license to include this platform, or install"
+ echo "the Qt Open Source Edition if you intend to develop free software."
+ exit 1
+ ;;
+ esac
+fi
+
+if [ "$Edition" = "OpenSource" ]; then
+ while true; do
+ echo "You are licensed to use this software under the terms of"
+ echo "the Lesser GNU General Public License (LGPL) versions 2.1."
+ if [ -f "$relpath/LICENSE.GPL3" ]; then
+ echo "You are also licensed to use this software under the terms of"
+ echo "the GNU General Public License (GPL) versions 3."
+ affix="either"
+ else
+ affix="the"
+ fi
+ echo
+ if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
+ echo "You have already accepted the terms of the $LicenseType license."
+ acceptance=yes
+ else
+ if [ -f "$relpath/LICENSE.GPL3" ]; then
+ echo "Type '3' to view the GNU General Public License version 3."
+ fi
+ echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
+ echo "Type 'yes' to accept this license offer."
+ echo "Type 'no' to decline this license offer."
+ echo
+ echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C"
+ read acceptance
+ fi
+ echo
+ if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
+ break
+ elif [ "$acceptance" = "no" ]; then
+ echo "You are not licensed to use this software."
+ echo
+ exit 1
+ elif [ "$acceptance" = "3" ]; then
+ more "$relpath/LICENSE.GPL3"
+ elif [ "$acceptance" = "L" ]; then
+ more "$relpath/LICENSE.LGPL"
+ fi
+ done
+elif [ "$Edition" = "Preview" ]; then
+ TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
+ while true; do
+
+ if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
+ echo "You have already accepted the terms of the $LicenseType license."
+ acceptance=yes
+ else
+ echo "You are licensed to use this software under the terms of"
+ echo "the $TheLicense"
+ echo
+ echo "Type '?' to read the Preview License."
+ echo "Type 'yes' to accept this license offer."
+ echo "Type 'no' to decline this license offer."
+ echo
+ echo $ECHO_N "Do you accept the terms of the license? $ECHO_C"
+ read acceptance
+ fi
+ echo
+ if [ "$acceptance" = "yes" ]; then
+ break
+ elif [ "$acceptance" = "no" ] ;then
+ echo "You are not licensed to use this software."
+ echo
+ exit 0
+ elif [ "$acceptance" = "?" ]; then
+ more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
+ fi
+ done
+elif [ "$Edition" != "OpenSource" ]; then
+ if [ -n "$ExpiryDate" ]; then
+ ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
+ [ -z "$ExpiryDate" ] && ExpiryDate="0"
+ Today=`date +%Y%m%d`
+ if [ "$Today" -gt "$ExpiryDate" ]; then
+ case "$LicenseType" in
+ Commercial|Academic|Educational)
+ echo
+ echo "WARNING WARNING WARNING WARNING"
+ echo
+ echo " Your support and upgrade period has expired."
+ echo
+ echo " You may continue to use your last licensed release"
+ echo " of Qt under the terms of your existing license"
+ echo " agreement. But you are not entitled to technical"
+ echo " support, nor are you entitled to use any more recent"
+ echo " Qt releases."
+ echo
+ echo " Please use the contact form at http://qt.digia.com/contact-us"
+ echo " to renew your support and upgrades for this license."
+ echo
+ echo "WARNING WARNING WARNING WARNING"
+ echo
+ sleep 3
+ ;;
+ Evaluation|*)
+ echo
+ echo "NOTICE NOTICE NOTICE NOTICE"
+ echo
+ echo " Your Evaluation license has expired."
+ echo
+ echo " You are no longer licensed to use this software. Please"
+ echo " use the contact form at http://qt.digia.com/contact-us to"
+ echo " purchase license, or install the Qt Open Source Edition"
+ echo " if you intend to develop free software."
+ echo
+ echo "NOTICE NOTICE NOTICE NOTICE"
+ echo
+ exit 1
+ ;;
+ esac
+ fi
+ fi
+ TheLicense=`head -n 1 "$outpath/LICENSE"`
+ while true; do
+ if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
+ echo "You have already accepted the terms of the $TheLicense."
+ acceptance=yes
+ else
+ echo "You are licensed to use this software under the terms of"
+ echo "the $TheLicense."
+ echo
+ echo "Type '?' to view the $TheLicense."
+ echo "Type 'yes' to accept this license offer."
+ echo "Type 'no' to decline this license offer."
+ echo
+ echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
+ read acceptance
+ fi
+ echo
+ if [ "$acceptance" = "yes" ]; then
+ break
+ elif [ "$acceptance" = "no" ]; then
+ echo "You are not licensed to use this software."
+ echo
+ exit 1
+ else [ "$acceptance" = "?" ]
+ more "$outpath/LICENSE"
+ fi
+ done
+fi
+
+#-------------------------------------------------------------------------------
+# command line and environment validation
+#-------------------------------------------------------------------------------
+
+# update QT_CONFIG to show our current predefined configuration
+CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h
+case "$CFG_QCONFIG" in
+minimal|small|medium|large|full)
+ # these are a sequence of increasing functionality
+ for c in minimal small medium large full; do
+ QT_CONFIG="$QT_CONFIG $c-config"
+ [ "$CFG_QCONFIG" = $c ] && break
+ done
+ [ "$CFG_QCONFIG" = full ] && CFG_QCONFIG_PATH=
+ ;;
+*)
+ # not known to be sufficient for anything
+ if [ ! -f "$CFG_QCONFIG_PATH" ]; then
+ CFG_QCONFIG_PATH=`"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"`
+ if [ ! -f "$CFG_QCONFIG_PATH" ]; then
+ echo >&2 "Error: configuration file not found:"
+ echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
+ echo >&2 " or"
+ echo >&2 " $CFG_QCONFIG_PATH"
+ exit 1
+ fi
+ fi
+esac
+
+if [ "$XPLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then
+ echo
+ echo "WARNING: -debug-and-release is not supported outside of Mac OS X."
+ echo "Qt can be built in release mode with separate debug information, so"
+ echo "-debug-and-release is not necessary anymore"
+ echo
+fi
+
+if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then
+ echo "Error: -no-xkbcommon is not supported on XCB platform plugin."
+ exit 101
+fi
+
if [ "$XPLATFORM_ANDROID" = "yes" ]; then
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
case $PLATFORM in
@@ -2743,7 +3173,6 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then
esac
fi
- if [ "$OPT_HELP" != "yes" ]; then
if [ -z "$CFG_DEFAULT_ANDROID_NDK_ROOT" ]; then
echo
echo "Can not find Android NDK. Please use -android-ndk option to specify one"
@@ -2774,7 +3203,6 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then
DeviceVar set DEFAULT_ANDROID_NDK_HOST "$CFG_DEFAULT_ANDROID_NDK_HOST"
DeviceVar set DEFAULT_ANDROID_TARGET_ARCH "$CFG_DEFAULT_ANDROID_TARGET_ARCH"
DeviceVar set DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION "$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION"
- fi
fi
if [ -d "$PLATFORM" ]; then
@@ -2837,26 +3265,46 @@ if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
exit 2
fi
-if [ "$UNAME_SYSTEM" = "SunOS" ]; then
- # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
- if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
- sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new"
- mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf"
+#-------------------------------------------------------------------------------
+# build tree initialization
+#-------------------------------------------------------------------------------
+
+# is this a shadow build?
+if [ "$OPT_SHADOW" = "maybe" ]; then
+ OPT_SHADOW=no
+ if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then
+ if [ -h "$outpath" ]; then
+ [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes
+ else
+ OPT_SHADOW=yes
+ fi
fi
fi
+if [ "$OPT_SHADOW" = "yes" ]; then
+ if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
+ echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
+ echo >&2 "Cannot proceed."
+ exit 1
+ fi
+ [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
+fi
-if [ "$CFG_RTOS_ENABLED" = "no" ]; then
- case `basename "$XPLATFORM"` in
- qnx-* | vxworks-*)
- echo ""
- echo "You are not licensed for Qt for `basename $XPLATFORM`."
- echo ""
- echo "Please use the contact form at http://qt.digia.com/contact-us"
- echo "to upgrade your license to include this platform, or install"
- echo "the Qt Open Source Edition if you intend to develop free software."
- exit 1
- ;;
- esac
+# if the source tree is different from the build tree,
+# symlink or copy part of the sources
+if [ "$OPT_SHADOW" = "yes" ]; then
+ echo "Preparing build tree..."
+
+ [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin"
+
+ mkdir -p "$outpath/mkspecs"
+fi
+
+# symlink fonts to be able to run application from build directory
+if [ ! -d "${outpath}/lib/fonts" ]; then
+ if [ "$PLATFORM" = "$XPLATFORM" ]; then
+ mkdir -p "${outpath}/lib"
+ ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
+ fi
fi
#-------------------------------------------------------------------------------
@@ -2865,7 +3313,7 @@ fi
# detect build style
if [ "$CFG_DEBUG" = "auto" ]; then
- if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
+ if [ "$XPLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
CFG_DEBUG_RELEASE=yes
CFG_DEBUG=yes
elif [ "$CFG_DEV" = "yes" ]; then
@@ -2890,11 +3338,18 @@ if [ "$XPLATFORM_IOS" = "yes" ]; then
CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples tests"
CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store
CFG_CXX11="no" # C++11 support disabled for now
- CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtconnectivity qtdoc qtgraphicaleffects qtlocation qtmacextras qtmultimedia qtquickcontrols qtserialport qttools qtwebkit qtwebkit-examples"
+ CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtconnectivity qtdoc qtlocation qtmacextras qtserialport qttools qtwebkit qtwebkit-examples"
+
+ # If the user passes -sdk on the command line we build a SDK-specific Qt build.
+ # Otherwise we build a joined simulator and device build, which is the default.
+ if [ -z "$OPT_MAC_SDK" ]; then
+ QT_CONFIG="$QT_CONFIG build_all"
+ QTCONFIG_CONFIG="$QTCONFIG_CONFIG iphonesimulator_and_iphoneos"
+ fi
fi
# disable GTK style support auto-detection on Mac
-if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_QGTKSTYLE" = "auto" ]; then
+if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_QGTKSTYLE" = "auto" ]; then
CFG_QGTKSTYLE=no
fi
@@ -2902,7 +3357,7 @@ QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`
TEST_COMPILER=$QMAKE_CONF_COMPILER
-if [ "$OPT_HELP" != "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ] ; then
+if [ "$XPLATFORM_ANDROID" = "yes" ] ; then
ANDROID_NDK_TOOLS_PREFIX=
ANDROID_PLATFORM_ARCH=
case $CFG_DEFAULT_ANDROID_TARGET_ARCH in
@@ -3021,7 +3476,7 @@ if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2>
fi
# find the default framework value
-if [ "$BUILD_ON_MAC" = "yes" ]; then
+if [ "$XPLATFORM_MAC" = "yes" ]; then
if [ "$CFG_FRAMEWORK" = "auto" ]; then
CFG_FRAMEWORK="$CFG_SHARED"
elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then
@@ -3034,35 +3489,26 @@ else
CFG_FRAMEWORK=no
fi
-# auto-detect default include and library search paths
-unset tty
-[ "$OPT_VERBOSE" = "yes" ] && tty=/dev/stderr
+# Auto-detect default include and library search paths.
-eval `LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK '
+# Use intermediate variable to get around backtick/quote nesting problems.
+awkprog='
BEGIN { ORS = ""; FS = "="; incs = 0; libs = 0; }
function normalize(dir)
{
do {
odir = dir
- gsub(/\\/[^\\/]+\\/\\.\\./, "", dir)
+ gsub(/\/[^\/]+\/\.\./, "", dir)
} while (dir != odir);
do {
odir = dir
- gsub(/\\/\\./, "", dir)
+ gsub(/\/\./, "", dir)
} while (dir != odir);
sub("/$", "", dir);
return dir;
}
-function quote(s)
-{
- # We only handle spaces
- if (match(s, " ") != 0)
- return "\\\\\"" s "\\\\\"";
- return s;
-}
-
# extract include paths from indented lines between
# #include <...> search starts here:
# and
@@ -3070,7 +3516,7 @@ function quote(s)
/^\#include </ { yup=1; print "DEFAULT_INCDIRS=\""; next }
/^End of search/ { yup=0; print "\"\n" }
/ \(framework directory\)$/ { next }
-yup { print quote(normalize(substr($0, 2))) " "; ++incs }
+yup { print normalize(substr($0, 2)) "\n"; ++incs }
# extract from one line like LIBRARY_PATH=/one/path:/another/path:...
$1 == "LIBRARY_PATH" {
@@ -3079,7 +3525,7 @@ $1 == "LIBRARY_PATH" {
for (lib in library_paths) {
dir = normalize(library_paths[lib]);
if (!(dir in dirs)) {
- print quote(dir) " ";
+ print dir "\n";
dirs[dir] = 1;
}
}
@@ -3088,10 +3534,14 @@ $1 == "LIBRARY_PATH" {
END {
if (incs == 0)
- print "DEFAULT_INCDIRS=\"/usr/include /usr/local/include\"\n";
+ print "DEFAULT_INCDIRS=\"/usr/include\n/usr/local/include\"\n";
if (libs == 0)
- print "DEFAULT_LIBDIRS=\"/lib /usr/lib\"\n";
-}' | tee $tty`
+ print "DEFAULT_LIBDIRS=\"/lib\n/usr/lib\"\n";
+}'
+
+unset tty
+[ "$OPT_VERBOSE" = "yes" ] && tty=/dev/stderr
+eval "`LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK "$awkprog" | tee $tty`"
unset tty
#setup the build parts
@@ -3194,7 +3644,7 @@ fi
QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"`
if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
- if [ "$BUILD_ON_MAC" = "yes" ]; then
+ if [ "$XPLATFORM_MAC" = "yes" ]; then
QT_INSTALL_SETTINGS=/Library/Preferences/Qt
else
QT_INSTALL_SETTINGS=$QT_INSTALL_PREFIX/etc/xdg
@@ -3289,669 +3739,8 @@ if [ "$CFG_COMPILE_EXAMPLES" = "yes" ]; then
fi
#-------------------------------------------------------------------------------
-# help - interactive parts of the script _after_ this section please
-#-------------------------------------------------------------------------------
-
-# next, emit a usage message if something failed.
-if [ "$OPT_HELP" = "yes" ]; then
- [ "x$ERROR" = "xyes" ] && echo
- if [ "$CFG_NIS" = "no" ]; then
- NSY=" "
- NSN="*"
- else
- NSY="*"
- NSN=" "
- fi
- if [ "$CFG_CUPS" = "no" ]; then
- CUY=" "
- CUN="*"
- else
- CUY="*"
- CUN=" "
- fi
- if [ "$CFG_ICONV" = "no" ]; then
- CIY=" "
- CIN="*"
- else
- CIY="*"
- CIN=" "
- fi
- if [ "$CFG_LARGEFILE" = "no" ]; then
- LFSY=" "
- LFSN="*"
- else
- LFSY="*"
- LFSN=" "
- fi
- if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then
- PHY=" "
- PHN="*"
- else
- PHY="*"
- PHN=" "
- fi
-
- if [ "$CFG_XCB" = "no" ]; then
- XCBY=" "
- XCBN="*"
- else
- XCBY="*"
- XCBN=" "
- fi
-
- if [ "$CFG_EGLFS" = "no" ]; then
- EGLFSY=" "
- EGLFSN="*"
- else
- EGLFSY="*"
- EGLFSN=" "
- fi
-
- if [ "$CFG_DIRECTFB" = "no" ]; then
- DFBY=" "
- DFBN="*"
- else
- DFBY="*"
- DFBN=" "
- fi
-
- if [ "$CFG_LINUXFB" = "no" ]; then
- LFBY=" "
- LFBN="*"
- else
- LFBY="*"
- LFBN=" "
- fi
-
- if [ "$CFG_KMS" = "no" ]; then
- KMSY=" "
- KMSN="*"
- else
- KMSY="*"
- KMSN=" "
- fi
-
- if [ "$CFG_XINPUT2" = "no" ]; then
- X2Y=" "
- X2N="*"
- else
- X2Y="*"
- X2N=" "
- fi
-
- if [ "$CFG_DBUS" = "no" ]; then
- DBY=" "
- DBN="+"
- else
- DBY="+"
- DBN=" "
- fi
-
- if [ "$CFG_SEPARATE_DEBUG_INFO" = "no" ]; then
- SBY=" "
- SBN="*"
- else
- SBY="*"
- SBN=" "
- fi
-
- if [ "$CFG_GLIB" = "no" ]; then
- GBY=" "
- GBN="+"
- else
- GBY="+"
- GBN=" "
- fi
-
- cat <<EOF
-Usage: $relconf [options]
-
-Installation options:
-
- These are optional, but you may specify install directories.
-
- -prefix <dir> ...... This will install everything relative to <dir>
- (default $QT_INSTALL_PREFIX)
-
- -extprefix <dir> ... When -sysroot is used, install everything to <dir>,
- rather than into SYSROOT/PREFIX.
-
- -hostprefix [dir] .. Tools and libraries needed when developing
- applications are installed in [dir]. If [dir] is
- not given, the current build directory will be used.
- (default EXTPREFIX)
-
- You may use these to separate different parts of the install:
-
- -bindir <dir> ......... User executables will be installed to <dir>
- (default PREFIX/bin)
- -headerdir <dir> ...... Headers will be installed to <dir>
- (default PREFIX/include)
- -libdir <dir> ......... Libraries will be installed to <dir>
- (default PREFIX/lib)
- -archdatadir <dir> .... Arch-dependent data used by Qt will be installed to <dir>
- (default PREFIX)
- -plugindir <dir> ...... Plugins will be installed to <dir>
- (default ARCHDATADIR/plugins)
- -libexecdir <dir> ..... Program executables will be installed to <dir>
- (default ARCHDATADIR/$QT_INSTALL_LIBEXECS_DIRNAME)
- -importdir <dir> ...... Imports for QML1 will be installed to <dir>
- (default ARCHDATADIR/imports)
- -qmldir <dir> ......... Imports for QML2 will be installed to <dir>
- (default ARCHDATADIR/qml)
- -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir>
- (default PREFIX)
- -docdir <dir> ......... Documentation will be installed to <dir>
- (default DATADIR/doc)
- -translationdir <dir> . Translations of Qt programs will be installed to <dir>
- (default DATADIR/translations)
- -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
- (default PREFIX/etc/xdg)
- -examplesdir <dir> .... Examples will be installed to <dir>
- (default PREFIX/examples)
- -testsdir <dir> ....... Tests will be installed to <dir>
- (default PREFIX/tests)
-
- -hostbindir <dir> .. Host executables will be installed to <dir>
- (default HOSTPREFIX/bin)
- -hostlibdir <dir> .. Host libraries will be installed to <dir>
- (default HOSTPREFIX/lib)
- -hostdatadir <dir> . Data used by qmake will be installed to <dir>
- (default HOSTPREFIX)
-
-Configure options:
-
- The defaults (*) are usually acceptable. A plus (+) denotes a default value
- that needs to be evaluated. If the evaluation succeeds, the feature is
- included. Here is a short explanation of each option:
-
- * -release ........... Compile and link Qt with debugging turned off.
- -debug ............. Compile and link Qt with debugging turned on.
- -debug-and-release . Compile and link two versions of Qt, with and without
- debugging turned on (Mac only).
-
- -force-debug-info .. Create symbol files for release builds.
-
- -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting)
-
- -opensource ........ Compile and link the Open-Source Edition of Qt.
- -commercial ........ Compile and link the Commercial Edition of Qt.
-
- -confirm-license ... Automatically acknowledge the license (use with
- either -opensource or -commercial)
-
- -no-c++11 .......... Do not compile Qt with C++11 support enabled.
- + -c++11 ............. Compile Qt with C++11 support enabled.
-
- * -shared ............ Create and use shared Qt libraries.
- -static ............ Create and use static Qt libraries.
-
- * -process ........... Generate only a top-level Makefile.
- -fully-process ..... Generate Makefiles for the entire Qt tree.
- -dont-process ...... Do not generate any Makefiles.
-
- -no-largefile ...... Disables large file support.
- + -largefile ......... Enables Qt to access files larger than 4 GB.
-
- -no-accessibility .. Do not compile Accessibility support.
- Disabling accessibility is not recommended, as it will break QStyle
- and may break other internal parts of Qt.
- With this switch you create a source incompatible version of Qt,
- which is unsupported.
- + -accessibility ..... Compile Accessibility support.
-
- -no-sql-<driver> ... Disable SQL <driver> entirely.
- -qt-sql-<driver> ... Enable a SQL <driver> in the Qt SQL module, by default
- none are turned on.
- -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
- at run time.
-
- Possible values for <driver>:
- [ $CFG_SQL_AVAILABLE ]
-
- -system-sqlite ..... Use sqlite from the operating system.
-
- -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
- + -javascript-jit .... Build the JavaScriptCore JIT compiler.
-
- -no-qml-debug ...... Do not build the in-process QML debugging support.
- + -qml-debug ......... Build the QML debugging support.
-
- -platform target ... The operating system and compiler you are building
- on ($PLATFORM).
-
- See the README file for a list of supported
- operating systems and compilers.
-
- -no-sse2 ........... Do not compile with use of SSE2 instructions.
- -no-sse3 ........... Do not compile with use of SSE3 instructions.
- -no-ssse3 .......... Do not compile with use of SSSE3 instructions.
- -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions.
- -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions.
- -no-avx ............ Do not compile with use of AVX instructions.
- -no-avx2 ........... Do not compile with use of AVX2 instructions.
- -no-neon ........... Do not compile with use of NEON instructions.
- -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions.
- -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions.
-
- -qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'.
- -qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so.
-
- -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool.
- -gcov .............. Instrument Qt with the GCov code coverage tool.
-
- -D <string> ........ Add an explicit define to the preprocessor.
- -I <string> ........ Add an explicit include path.
- -L <string> ........ Add an explicit library path.
-
- + -pkg-config ........ Use pkg-config to detect include and library paths. By default,
- configure determines whether to use pkg-config or not with
- some heuristics such as checking the environment variables.
- -no-pkg-config ..... Disable use of pkg-config.
- -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability
- detection heuristic).
-
- -help, -h .......... Display this information.
-
-Third Party Libraries:
-
- -qt-zlib ........... Use the zlib bundled with Qt.
- + -system-zlib ....... Use zlib from the operating system.
- See http://www.gzip.org/zlib
-
- -no-gif ............ Do not compile GIF reading support.
-
- -no-libpng ......... Do not compile PNG support.
- -qt-libpng ......... Use the libpng bundled with Qt.
- + -system-libpng ..... Use libpng from the operating system.
- See http://www.libpng.org/pub/png
-
- -no-libjpeg ........ Do not compile JPEG support.
- -qt-libjpeg ........ Use the libjpeg bundled with Qt.
- + -system-libjpeg .... Use libjpeg from the operating system.
- See http://www.ijg.org
-
- -no-freetype ....... Do not compile in Freetype2 support.
- -qt-freetype ....... Use the libfreetype bundled with Qt.
- + -system-freetype.... Use the libfreetype provided by the system (enabled if -fontconfig is active).
- See http://www.freetype.org
-
- * -no-harfbuzz ....... Do not compile HarfBuzz-NG support.
- -qt-harfbuzz ....... (experimental) Use HarfBuzz-NG bundled with Qt
- to do text shaping. It can still be disabled
- by setting QT_HARFBUZZ environment variable to "old".
- -system-harfbuzz ... (experimental) Use HarfBuzz-NG from the operating system
- to do text shaping. It can still be disabled
- by setting QT_HARFBUZZ environment variable to "old".
-
- -no-openssl ........ Do not compile support for OpenSSL.
- + -openssl ........... Enable run-time OpenSSL support.
- -openssl-linked .... Enabled linked OpenSSL support.
-
- -qt-pcre ........... Use the PCRE library bundled with Qt.
- + -system-pcre ....... Use the PCRE library from the operating system.
-
- -qt-xcb ............ Use xcb- libraries bundled with Qt.
- (libxcb.so will still be used from operating system).
- + -system-xcb ........ Use xcb- libraries from the operating system.
-
- -qt-xkbcommon ...... Use the xkbcommon library bundled with Qt.
- + -system-xkbcommon .. Use the xkbcommon library from the operating system.
-
-Additional options:
-
- -make <part> ....... Add part to the list of parts to be built at make time.
- (defaults to: $QT_DEFAULT_BUILD_PARTS)
- -nomake <part> ..... Exclude part from the list of parts to be built.
-
- -skip <module> ..... Exclude an entire module from the build.
-
- -no-compile-examples ... Install only the sources of examples.
-
- -no-gui ............ Don't build the Qt GUI module and dependencies.
- + -gui ............... Build the Qt GUI module and dependencies.
-
- -no-widgets ........ Don't build the Qt Widgets module and dependencies.
- + -widgets ........... Build the Qt Widgets module and dependencies.
-
- -R <string> ........ Add an explicit runtime library path to the Qt
- libraries.
- -l <string> ........ Add an explicit library.
-
- -no-rpath .......... Do not use the library install path as a runtime
- library path.
- + -rpath ............. Link Qt libraries and executables using the library
- install path as a runtime library path. Equivalent
- to -R install_libpath
-
- -continue .......... Continue as far as possible if an error occurs.
-
- -verbose, -v ....... Print verbose information about each step of the
- configure process.
-
- -silent ............ Reduce the build output so that warnings and errors
- can be seen more easily.
-
- * -no-optimized-qmake ... Do not build qmake optimized.
- -optimized-qmake ...... Build qmake optimized.
-
- $NSN -no-nis ............ Do not compile NIS support.
- $NSY -nis ............... Compile NIS support.
-
- $CUN -no-cups ........... Do not compile CUPS support.
- $CUY -cups .............. Compile CUPS support.
- Requires cups/cups.h and libcups.so.2.
-
- $CIN -no-iconv .......... Do not compile support for iconv(3).
- $CIY -iconv ............. Compile support for iconv(3).
-
- -no-icu ............ Do not compile support for ICU libraries.
- + -icu ............... Compile support for ICU libraries.
-
- -no-fontconfig ..... Do not compile FontConfig support.
- + -fontconfig ........ Compile FontConfig support.
-
- -no-strip .......... Do not strip binaries and libraries of unneeded symbols.
- * -strip ............. Strip binaries and libraries of unneeded symbols when installing.
-
- $PHN -no-pch ............ Do not use precompiled header support.
- $PHY -pch ............... Use precompiled header support.
-
- $DBN -no-dbus ........... Do not compile the Qt D-Bus module.
- $DBY -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1.
- -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1.
-
- -reduce-relocations ..... Reduce relocations in the libraries through extra
- linker optimizations (Qt/X11 and Qt for Embedded Linux only;
- experimental; needs GNU ld >= 2.18).
-
- -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
-
- -device <name> ............... Cross-compile for device <name> (experimental)
- -device-option <key=value> ... Add device specific options for the device mkspec
- (experimental)
-
- $SBN -no-separate-debug-info . Do not store debug information in a separate file.
- $SBY -separate-debug-info .... Strip debug information into a separate file.
-
- $XCBN -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
- $XCBY -xcb ............... Compile Xcb support.
-
- $EGLFSN -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
- $EGLFSY -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support).
-
- $DFBN -no-directfb ....... Do not compile DirectFB support.
- $DFBY -directfb .......... Compile DirectFB support.
-
- $LFBN -no-linuxfb ........ Do not compile Linux Framebuffer support.
- $LFBY -linuxfb ........... Compile Linux Framebuffer support.
-
- $KMSN -no-kms ............ Do not compile KMS support.
- $KMSY -kms ............... Compile KMS support (Requires EGL and OpenGL ES 2 support).
-
- -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows).
-
- -xplatform target ... The target platform when cross-compiling.
-
- -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.
- -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler
-
- -no-feature-<feature> Do not compile in <feature>.
- -feature-<feature> .. Compile in <feature>. The available features
- are described in src/corelib/global/qfeatures.txt
-
- -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
- default ($CFG_QCONFIG).
-
- -no-opengl .......... Do not support OpenGL.
- -opengl <api> ....... Enable OpenGL support
- With no parameter, this will attempt to auto-detect
- OpenGL ES 2, or regular desktop OpenGL.
- Use es2 for <api> to override auto-detection.
-
- * -no-system-proxies .. Do not use system network proxies by default.
- -system-proxies ..... Use system network proxies by default.
-
- -no-warnings-are-errors Make warnings be treated normally
- -warnings-are-errors Make warnings be treated as errors
- (enabled if -developer-build is active)
-
- $GBN -no-glib ........... Do not compile Glib support.
- $GBY -glib .............. Compile Glib support.
-EOF
-
-if [ "$XPLATFORM_MAEMO" = "yes" ]; then
- cat << EOF
-
- $X2N -no-xinput2 ........ Do not compile XInput2 support.
- $X2Y -xinput2 ........... Compile XInput2 support.
-
-EOF
-
-fi
-
-if [ "$XPLATFORM_QNX" = "yes" ]; then
- cat << EOF
-
- -no-slog2 .......... Do not compile with slog2 support.
- -slog2 ............. Compile with slog2 support.
-no-imf ............ Do not compile with imf support.
-imf ............... Compile with imf support.
-
-EOF
-
-fi
-
-if [ "$BUILD_ON_MAC" = "yes" ]; then
- cat << EOF
-
-Qt/Mac only:
-
- -Fstring ........... Add an explicit framework path.
- -fw string ......... Add an explicit framework.
-
- * -framework ......... Build Qt as a series of frameworks and
- link tools against those frameworks.
- -no-framework ...... Do not build Qt as a series of frameworks.
-
- -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be
- one of the available SDKs as listed by 'xcodebuild -showsdks'.
-
-EOF
-fi
-
-if [ "$XPLATFORM_ANDROID" = "yes" ]; then
- cat << EOF
-
-Android options:
- -android-sdk path .............. The Android SDK root path.
- (default $CFG_DEFAULT_ANDROID_SDK_ROOT)
-
- -android-ndk path .............. The Android NDK root path.
- (default $CFG_DEFAULT_ANDROID_NDK_ROOT)
-
- -android-ndk-platform .......... Sets the android platform
- (default $CFG_DEFAULT_ANDROID_PLATFORM)
-
- -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.)
- (default $CFG_DEFAULT_ANDROID_NDK_HOST)
-
- -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips)
- (default $CFG_DEFAULT_ANDROID_TARGET_ARCH)
-
- -android-toolchain-version ..... Sets the android toolchain version
- (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION)
-EOF
-
-fi
-
- [ "x$ERROR" = "xyes" ] && exit 1
- exit 0
-fi # Help
-
-
-# -----------------------------------------------------------------------------
-# LICENSING, INTERACTIVE PART
-# -----------------------------------------------------------------------------
-
-echo
-echo "This is the Qt ${EditionString} Edition."
-echo
-
-if [ "$Edition" = "OpenSource" ]; then
- while true; do
- echo "You are licensed to use this software under the terms of"
- echo "the Lesser GNU General Public License (LGPL) versions 2.1."
- if [ -f "$relpath/LICENSE.GPL3" ]; then
- echo "You are also licensed to use this software under the terms of"
- echo "the GNU General Public License (GPL) versions 3."
- affix="either"
- else
- affix="the"
- fi
- echo
- if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
- echo "You have already accepted the terms of the $LicenseType license."
- acceptance=yes
- else
- if [ -f "$relpath/LICENSE.GPL3" ]; then
- echo "Type '3' to view the GNU General Public License version 3."
- fi
- echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
- echo "Type 'yes' to accept this license offer."
- echo "Type 'no' to decline this license offer."
- echo
- echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C"
- read acceptance
- fi
- echo
- if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
- break
- elif [ "$acceptance" = "no" ]; then
- echo "You are not licensed to use this software."
- echo
- exit 1
- elif [ "$acceptance" = "3" ]; then
- more "$relpath/LICENSE.GPL3"
- elif [ "$acceptance" = "L" ]; then
- more "$relpath/LICENSE.LGPL"
- fi
- done
-elif [ "$Edition" = "Preview" ]; then
- TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"`
- while true; do
-
- if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
- echo "You have already accepted the terms of the $LicenseType license."
- acceptance=yes
- else
- echo "You are licensed to use this software under the terms of"
- echo "the $TheLicense"
- echo
- echo "Type '?' to read the Preview License."
- echo "Type 'yes' to accept this license offer."
- echo "Type 'no' to decline this license offer."
- echo
- echo $ECHO_N "Do you accept the terms of the license? $ECHO_C"
- read acceptance
- fi
- echo
- if [ "$acceptance" = "yes" ]; then
- break
- elif [ "$acceptance" = "no" ] ;then
- echo "You are not licensed to use this software."
- echo
- exit 0
- elif [ "$acceptance" = "?" ]; then
- more "$relpath/LICENSE.PREVIEW.COMMERCIAL"
- fi
- done
-elif [ "$Edition" != "OpenSource" ]; then
- if [ -n "$ExpiryDate" ]; then
- ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"`
- [ -z "$ExpiryDate" ] && ExpiryDate="0"
- Today=`date +%Y%m%d`
- if [ "$Today" -gt "$ExpiryDate" ]; then
- case "$LicenseType" in
- Commercial|Academic|Educational)
- echo
- echo "WARNING WARNING WARNING WARNING"
- echo
- echo " Your support and upgrade period has expired."
- echo
- echo " You may continue to use your last licensed release"
- echo " of Qt under the terms of your existing license"
- echo " agreement. But you are not entitled to technical"
- echo " support, nor are you entitled to use any more recent"
- echo " Qt releases."
- echo
- echo " Please use the contact form at http://qt.digia.com/contact-us"
- echo " to renew your support and upgrades for this license."
- echo
- echo "WARNING WARNING WARNING WARNING"
- echo
- sleep 3
- ;;
- Evaluation|*)
- echo
- echo "NOTICE NOTICE NOTICE NOTICE"
- echo
- echo " Your Evaluation license has expired."
- echo
- echo " You are no longer licensed to use this software. Please"
- echo " use the contact form at http://qt.digia.com/contact-us to"
- echo " purchase license, or install the Qt Open Source Edition"
- echo " if you intend to develop free software."
- echo
- echo "NOTICE NOTICE NOTICE NOTICE"
- echo
- exit 1
- ;;
- esac
- fi
- fi
- TheLicense=`head -n 1 "$outpath/LICENSE"`
- while true; do
- if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
- echo "You have already accepted the terms of the $TheLicense."
- acceptance=yes
- else
- echo "You are licensed to use this software under the terms of"
- echo "the $TheLicense."
- echo
- echo "Type '?' to view the $TheLicense."
- echo "Type 'yes' to accept this license offer."
- echo "Type 'no' to decline this license offer."
- echo
- echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C"
- read acceptance
- fi
- echo
- if [ "$acceptance" = "yes" ]; then
- break
- elif [ "$acceptance" = "no" ]; then
- echo "You are not licensed to use this software."
- echo
- exit 1
- else [ "$acceptance" = "?" ]
- more "$outpath/LICENSE"
- fi
- done
-fi
-
-# this should be moved somewhere else
-case "$PLATFORM" in
-aix-*)
- AIX_VERSION=`uname -v`
- if [ "$AIX_VERSION" -lt "5" ]; then
- QMakeVar add QMAKE_LIBS_X11 -lbind
- fi
- ;;
-*)
- ;;
-esac
-
-#-------------------------------------------------------------------------------
# generate qconfig.cpp
#-------------------------------------------------------------------------------
[ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global"
@@ -4401,7 +4190,7 @@ if [ "$CFG_CXX11" != "no" ]; then
# Configure detects compiler features based on cross compiler, so we need
# to explicitly disable C++11 on Mac to avoid breaking builds where the
# host compiler does not support it.
- if [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ]; then
+ if [ "$BUILD_ON_MAC" = "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ]; then
CFG_CXX11="no"
elif compileTest common/c++11 "C++11"; then
CFG_CXX11="yes"
@@ -4585,6 +4374,14 @@ if [ "$XPLATFORM_QNX" = "yes" ]; then
CFG_QNX_IMF=no
fi
fi
+ if [ "$CFG_PPS" != "no" ]; then
+ if compileTest unix/pps "pps"; then
+ CFG_PPS=yes
+ QMAKE_CONFIG="$QMAKE_CONFIG qqnx_pps"
+ else
+ CFG_PPS=no
+ fi
+ fi
fi
if [ "$CFG_ZLIB" = "auto" ]; then
@@ -4644,11 +4441,6 @@ if [ "$CFG_EGLFS" = "yes" ]; then
echo "The EGLFS plugin requires EGL support and cannot be built"
exit 101
fi
- if [ "$CFG_OPENGL" != "es2" ]; then
- echo "The EGLFS plugin requires OpenGL ES 2 support and cannot be built"
- exit 101
- fi
- CFG_OPENGL="es2"
CFG_EGL=yes
fi
@@ -4657,10 +4449,6 @@ if [ "$CFG_KMS" = "yes" ]; then
echo "The KMS plugin requires EGL support and cannot be built"
exit 101
fi
- if [ "$CFG_OPENGL" != "es2" ]; then
- echo "The KMS plugin requires OpenGL ES 2 support and cannot be built"
- exit 101
- fi
fi
# auto-detect SQL-modules support
@@ -4749,7 +4537,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
;;
odbc)
if [ "$CFG_SQL_odbc" != "no" ]; then
- if ( [ "$BUILD_ON_MAC" != "yes" ] || [ "$XPLATFORM_MINGW" = "yes" ] ) && compileTest unix/odbc "ODBC"; then
+ if [ "$XPLATFORM_MAC" != "yes" ] && compileTest unix/odbc "ODBC"; then
if [ "$CFG_SQL_odbc" = "auto" ]; then
CFG_SQL_odbc=plugin
fi
@@ -5050,31 +4838,6 @@ elif [ "$CFG_GLIB" = "no" ]; then
CFG_QGTKSTYLE=no
fi
-# ### Vestige
-if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
- if [ -n "$PKG_CONFIG" ]; then
- QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
- QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
- fi
- if compileTest unix/gstreamer "GStreamer" $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER; then
- CFG_GSTREAMER=yes
- QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
- QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
- else
- if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
- echo "Gstreamer support cannot be enabled due to functionality tests!"
- echo " Turn on verbose messaging (-v) to $0 to see the final report."
- echo " If you believe this message is in error you may use the continue"
- echo " switch (-continue) to $0 to continue."
- exit 101
- else
- CFG_GSTREAMER=no
- fi
- fi
-elif [ "$CFG_GLIB" = "no" ]; then
- CFG_GSTREAMER=no
-fi
-
# auto-detect libicu support
if [ "$CFG_ICU" != "no" ]; then
if compileTest unix/icu "ICU"; then
@@ -5192,7 +4955,7 @@ if [ "$XPLATFORM_MINGW" = "yes" ]; then
fi
fi # X11/MINGW OpenGL
-if [ "$BUILD_ON_MAC" = "yes" ]; then
+if [ "$XPLATFORM_MAC" = "yes" ]; then
if [ "$CFG_COREWLAN" = "auto" ]; then
if compileTest mac/corewlan "CoreWlan"; then
CFG_COREWLAN=yes
@@ -5521,17 +5284,10 @@ elif [ "$CFG_XKBCOMMON" = "no" ]; then
fi
# EGL Support
-if [ "$CFG_OPENGL" != "es2" ]; then
- if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "desktop" ]; then
- echo "EGL support was requested but Qt is being configured for desktop OpenGL."
+if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then
+ echo "EGL support was requested but OpenGL support is disabled."
echo "Either disable EGL support or enable OpenGL ES support."
exit 101
- elif [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then
- echo "EGL support was requested but OpenGL ES support is disabled."
- echo "Either disable EGL support or enable OpenGL ES support."
- exit 101
- fi
- CFG_EGL=no
elif [ "$CFG_EGL" != "no" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
@@ -5554,7 +5310,7 @@ elif [ "$CFG_EGL" != "no" ]; then
fi
if [ "$CFG_EGLFS" != "no" ]; then
- if [ "$CFG_OPENGL" = "es2" ] && [ "$XPLATFORM_QNX" = "no" ]; then
+ if [ "$XPLATFORM_QNX" = "no" ]; then
CFG_EGLFS="$CFG_EGL"
else
CFG_EGLFS="no"
@@ -5562,7 +5318,7 @@ if [ "$CFG_EGLFS" != "no" ]; then
fi
if [ "$CFG_KMS" = "yes" ]; then
- if [ "$CFG_OPENGL" = "es2" ] && [ "$CFG_EGL" = "yes" ]; then
+ if [ "$CFG_EGL" = "yes" ]; then
CFG_KMS="yes"
else
CFG_KMS="no"
@@ -5594,7 +5350,7 @@ if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
if [ "$XPLATFORM_MINGW" = "yes" ]; then
QT_QPA_DEFAULT_PLATFORM="windows"
- elif [ "$BUILD_ON_MAC" = "yes" ]; then
+ elif [ "$XPLATFORM_MAC" = "yes" ]; then
QT_QPA_DEFAULT_PLATFORM="cocoa"
elif [ "$UNAME_SYSTEM" = "QNX" ]; then
QT_QPA_DEFAULT_PLATFORM="qnx"
@@ -5621,7 +5377,7 @@ if [ "$CFG_KMS" = "yes" ]; then
QT_CONFIG="$QT_CONFIG kms"
fi
-if [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then
+if [ "$XPLATFORM_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then
if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_KMS" = "no" ]; then
if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_KMS" = "auto" ] ); then
@@ -5896,6 +5652,10 @@ fi
[ "$CFG_CXX11" = "yes" ] && QT_CONFIG="$QT_CONFIG c++11"
+if [ "$CFG_SILENT" = "yes" ]; then
+ QMAKE_CONFIG="$QMAKE_CONFIG silent"
+fi
+
# disable accessibility
if [ "$CFG_ACCESSIBILITY" = "no" ]; then
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY"
@@ -5942,26 +5702,14 @@ else
fi
if [ "$CFG_OPENGL" = "es2" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES"
-fi
-
-if [ "$CFG_OPENGL" = "es2" ]; then
- QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2"
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES QT_OPENGL_ES_2"
QT_CONFIG="$QT_CONFIG opengles2"
fi
-# build up the variables for output
-if [ "$CFG_DEBUG" = "yes" ]; then
- QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
-elif [ "$CFG_DEBUG" = "no" ]; then
- QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
-fi
if [ "$CFG_SHARED" = "yes" ]; then
- QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
QT_CONFIG="$QT_CONFIG shared"
QTCONFIG_CONFIG="$QTCONFIG_CONFIG shared"
elif [ "$CFG_SHARED" = "no" ]; then
- QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
QT_CONFIG="$QT_CONFIG static"
QTCONFIG_CONFIG="$QTCONFIG_CONFIG static"
fi
@@ -5971,15 +5719,6 @@ QMAKE_CONFIG="$QMAKE_CONFIG qpa"
QT_CONFIG="$QT_CONFIG qpa"
QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
-if [ "$XPLATFORM_MINGW" != "yes" ]; then
- # Do not set this here for Windows. Let qmake do it so
- # debug and release precompiled headers are kept separate.
- QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR"
-fi
-QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR"
-QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
-QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
-QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG largefile"
fi
@@ -6090,7 +5829,7 @@ if [ "$CFG_WIDGETS" = "no" ]; then
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS"
fi
-if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
+if [ "$XPLATFORM_MAC" = "yes" ]; then
#On Mac we implicitly link against libz, so we
#never use the 3rdparty stuff.
[ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
@@ -6107,7 +5846,6 @@ fi
[ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
[ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv"
[ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib"
-[ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
[ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
[ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
@@ -6120,7 +5858,7 @@ fi
[ '!' -z "$DEFINES" ] && QMakeVar add DEFINES "$DEFINES"
[ '!' -z "$L_FLAGS" ] && QMakeVar add LIBS "$L_FLAGS"
-if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
+if [ "$XPLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
if [ "$CFG_RPATH" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
fi
@@ -6383,11 +6121,7 @@ full)
*)
tmpconfig="$outpath/src/corelib/global/qconfig.h.new"
echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig"
- if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then
- cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig"
- elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then
- cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig"
- fi
+ cat "$CFG_QCONFIG_PATH" >>"$tmpconfig"
echo "#endif" >>"$tmpconfig"
;;
esac
@@ -6417,11 +6151,15 @@ if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
fi
+if [ "$CFG_QREAL" != double ]; then
+ echo "#define QT_COORD_TYPE $CFG_QREAL" >>"$outpath/src/corelib/global/qconfig.h.new"
+fi
+
if [ "$CFG_FRAMEWORK" = "yes" ]; then
echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new"
fi
-if [ "$BUILD_ON_MAC" = "yes" ]; then
+if [ "$XPLATFORM_MAC" = "yes" ]; then
cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
#if defined(__LP64__)
# define QT_POINTER_SIZE 8
@@ -6496,7 +6234,6 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
[ "$CFG_CUPS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS"
[ "$CFG_ICONV" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV"
[ "$CFG_GLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB"
-[ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER"
[ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK"
[ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC"
[ "$CFG_MREMAP" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP"
@@ -6661,8 +6398,8 @@ host_build {
QT_TARGET_ARCH = $CFG_ARCH
} else {
QT_ARCH = $CFG_ARCH
- QMAKE_DEFAULT_LIBDIRS = $DEFAULT_LIBDIRS
- QMAKE_DEFAULT_INCDIRS = $DEFAULT_INCDIRS
+ QMAKE_DEFAULT_LIBDIRS = `shellQuoteLines "$DEFAULT_LIBDIRS"`
+ QMAKE_DEFAULT_INCDIRS = `shellQuoteLines "$DEFAULT_INCDIRS"`
}
QT_EDITION = $Edition
QT_CONFIG += $QT_CONFIG
@@ -6744,6 +6481,17 @@ echo "QT_BUILD_PARTS += $CFG_BUILD_PARTS" >> "$QTMODULE.tmp"
if [ -n "$CFG_SKIP_MODULES" ]; then
echo "QT_SKIP_MODULES += $CFG_SKIP_MODULES" >> "$QTMODULE.tmp"
fi
+DISABLED_FEATURES=
+for cfg in $QCONFIG_FLAGS; do
+ ncfg=${cfg#QT_NO_}
+ if [ x$ncfg != x$cfg ]; then
+ DISABLED_FEATURES="$DISABLED_FEATURES $ncfg"
+ fi
+done
+if [ -n "$DISABLED_FEATURES" ]; then
+ echo "QT_NO_DEFINES = $DISABLED_FEATURES" >> "$QTMODULE.tmp"
+fi
+echo "QT_QCONFIG_PATH = ${CFG_QCONFIG_PATH#$relpath/src/corelib/global/}" >> "$QTMODULE.tmp"
cat >>"$QTMODULE.tmp" <<EOF
host_build {
@@ -6752,6 +6500,7 @@ host_build {
QT_CPU_FEATURES.$CFG_ARCH = $CFG_CPUFEATURES
}
EOF
+echo "QT_COORD_TYPE = $CFG_QREAL" >> "$QTMODULE.tmp"
if [ -n "$QT_CFLAGS_PSQL" ]; then
echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp"
@@ -6933,12 +6682,10 @@ report_support_plugin " GIF .................." "$CFG_GIF" qt QtGui
report_support_plugin " JPEG ................." "$CFG_JPEG" "$CFG_LIBJPEG" QtGui
report_support_plugin " PNG .................." "$CFG_PNG" "$CFG_LIBPNG" QtGui
report_support " Glib ..................." "$CFG_GLIB"
-report_support " GStreamer .............." "$CFG_GSTREAMER"
report_support " GTK theme .............." "$CFG_QGTKSTYLE"
report_support " Large File ............." "$CFG_LARGEFILE"
-report_support " libudev ................" "$CFG_LIBUDEV"
report_support " Networking:"
-[ "$BUILD_ON_MAC" = "yes" ] && \
+[ "$XPLATFORM_MAC" = "yes" ] && \
report_support " CoreWlan ............." "$CFG_COREWLAN"
report_support " getaddrinfo .........." "$CFG_GETADDRINFO"
report_support " getifaddrs ..........." "$CFG_GETIFADDRS"
@@ -6978,6 +6725,7 @@ report_support " Session management ....." "$CFG_SM"
if [ "$XPLATFORM_QNX" = "yes" ]; then
report_support " SLOG2 .................." "$CFG_SLOG2"
report_support " IMF ...................." "$CFG_QNX_IMF"
+ report_support " PPS ...................." "$CFG_PPS"
fi
report_support " SQL drivers:"
report_support " DB2 .................." "$CFG_SQL_db2" plugin "plugin" yes "built into QtSql"
@@ -7015,11 +6763,15 @@ if [ "$ORIG_CFG_XKBCOMMON" != qt ] && [ "$CFG_XKBCOMMON" = qt ]; then
echo "NOTE: libxkbcommon 0.2.0 (or higher) not found on the system, will use "
echo "the bundled version from 3rd party directory."
fi
+if [ "$CFG_QREAL" = double ] && [ "$CFG_ARCH" = arm ]; then
+ echo "NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1."
+ echo "Configure with '-qreal float' to create a build that is binary compatible with 5.1."
+fi
exec 1>&3 3>&- # restore stdout
cat $outpath/config.summary # display config feedback to user
-if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
+if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
echo
echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
echo "if you want a pure debug build."
diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0
index bc0db0b9c8..8ba4547f93 100644
--- a/dist/changes-5.1.0
+++ b/dist/changes-5.1.0
@@ -99,6 +99,13 @@ QtNetwork
- QHostInfo:
* Allow QHostInfo::lookupHost() with no receiver to warm the DNS cache.
+
+QtSql
+-----
+This changelog as released was missing QtSql changes.
+Please refer to changes-5.2.0 for QtSql 5.1.0 changes.
+
+
QtWidgets
---------
diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0
index a3a7db8190..f513d64626 100644
--- a/dist/changes-5.2.0
+++ b/dist/changes-5.2.0
@@ -16,36 +16,69 @@ Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
-* Library *
+* Important Behavior Changes *
****************************************************************************
-QtWidgets
----------
-
-- QAbstractScrollArea now has a SizeAdjustPolicy. If it is set to AdjustToContents
- it will make use of the new protected viewportSizeHint() (binary compatible since it
- was reserved in Qt5). This function returns a suggested size based on contents.
+ - Qt is now compiled with qreal typedef'ed to double on all
+ platforms. qreal was a float on ARM chipsets before. This guarantees more
+ consistent behavior between all platforms Qt supports, but is binary
+ incompatible to Qt 5.1 on ARM. The old behavior can be restored by
+ passing -qreal float to configure.
+ - The supported date range in QDateTime has been reduced to about +/- 292
+ million years, the range supported by the number of msecs since the Unix
+ epoch of 1 Jan 1970 as stored in a qint64, and as able to be used in the
+ setMSecsSinceEpoch() and toMSecsSinceEpoch() methods.
-- QTreeView now has setTreePosition to allow the treestructure to show data from other
- columns than logicalindex zero.
+ - QUrl and QUrlQuery:
+ * [QTBUG-31660] QUrl no longer considers all delimiter characters
+ equivalent to their percent-encoded forms. Now, both classes always
+ keep all delimiters exactly as they were in the original URL text.
+ * [QTBUG-31660] QUrl no longer decodes %7B and %7D to "{" and "}" in the
+ output of toString()
+ * QUrl no longer supports QUrl::FullyDecoded mode in authority() and
+ userInfo(), nor QUrl::DecodedMode in setAuthority() and setUserInfo().
+ * [QTBUG-31945] QUrl no longer decodes %23 found in the fragment to "#"
+ in the output of toString(QUrl::FullyEncoded) or toEncoded()
+ * QUrl now defaults to decoded mode in the getters and setters for
+ userName, password, host, topLevelDomain, path and fileName. This
+ means a '%' in one of those fields is now returned (or set) as '%'
+ rather than "%25". In the unlikely case where the former behavior was
+ expected, pass PrettyDecoded to the getter and TolerantMode to the
+ setter.
+ * QUrl now normalizes the path given in setPath, removing ./ and ../ and
+ duplicate slashes.
-- [QTBUG-4206] QTableView resizeToContents will now adjust to actual contents
- and not just visible area. QHeaderView::setAutoResizePrecision() has been
- introduced to control how precise the autoResize should be.
+****************************************************************************
+* Library *
+****************************************************************************
-- QFileDialog::setDefaultSuffix() removes leading dot characters.
+QtCore
+------
-- QSizePolicy got a retainSizeWhenHidden attribute.
+ - Added QCollator, a class to collate Unicode strings.
+ - Added QCommandLineParser, a class to parse command lines.
+ - Added QFileSelector, a class to select platform-specific file assets.
+ - Added QLoggingCategory and related functions for logging
+ - [QTBUG-23946] Fixed a bug that prevented Qt from being built in a
+ namespace on Mac OS X.
+ - Updated the locale database to CLDR 23.1
+ - Added support for ARMv8 64-bit mode.
-- [QTBUG-31602] QSpinBox size calculation will now be fixed when stylesheets are
- used.
+ - Metatype system (QMetaType & QVariant):
+ * Qt now handles metatypes automatically for std::vector, std::list,
+ std::pair and std::map
+ * The metatype system now supports registering explicit conversion
+ functions via QMetaType::registerConverter
+ * The metatype system now supports iteration over a container type via
+ QSequentialIterable and QAssociativeIterable
+ * Registering the same type name twice will now print only a warning (as
+ opposed to aborting the execution of the program)
-QtCore
-------
-- [QTBUG-30250] QTime, QDateTime:
- When calling QTime::toString(Qt::TextDate) and QTime::toString(Qt::ISODate),
- milliseconds are now included in the returned string. This also applies to
- QDateTime::toString(Qt::TextDate) and QDateTime::toString(ISODate).
+ - Qt Containers:
+ * In debug mode, the Qt containers will now verify whether the iterators
+ passed to most mutating functions belong to the iterator in question.
+ * Fixed a number of bugs that would modify shared containers when calling
+ erase(), under corner-case conditions.
- QtAlgorithms
With STL no longer being optional for building and using Qt, a number of parts
@@ -76,30 +109,458 @@ QtCore
- qLess (std::less)
- qGreater (std::greater)
+ - QByteArray:
+ * Added QByteArray::Base64Url and QByteArray::OmitTrailingEquals flags
+ for QByteArray::toBase64 and fromBase64.
+ * [QTBUG-34694] Fixed a bug that would cause QByteArray to overflow some
+ size calculations.
+
+ - QCoreApplication:
+ * [QTBUG-15379][QTBUG-30628] Fixed a bug that caused Qt to mis-parse a
+ command-line argument like -DKEY=\"VALUE\" on Windows.
+
+ - QDateTime:
+ * [QTBUG-26161][QTBUG-29666] Fully implement support for Qt::TimeSpec of
+ Qt::OffsetFromUTC, added new methods for offsetFromUTC(),
+ toTimeSpec(), and toOffsetFromUTC().
+ * Added convenience methods for fromMSecsSinceEpoch() and fromTime_t()
+ to take time spec to be used in returned datetime.
+ * Add method timeZoneAbbreviation() to return effective time zone
+ abbreviation.
+ * The debug datastream is now an ISO-like format instead of Qt::TextDate
+ * The Standard Time to Daylight Time transition for Qt::LocalTime is now
+ handled correctly. Any date set in the "missing" hour is now
+ considered invalid. All date math results that fall into the missing
+ hour will be automatically adjusted to a valid time in the following
+ hour.
+ * Added new method isDaylightTime() to return if the datetime is in
+ Daylight Time or not.
+ * Added support for a new Qt::TimeZone spec to be used with QTimeZone to
+ define times in a specific time zone.
+ * Added Qt::RFC2822Date format that can be passed to QDateTime and
+ QLocale formatters and parsers.
+ * Fixed a bug that caused QDate::toString() to return empty for dates
+ with years beyond 9999.
+
+ - QFileSystemWatcher:
+ * [QTBUG-33211] Fixed a bug that caused QFileSystemWatcher to emit change
+ notifications with the wrong path on Linux.
+
+ - QJson:
+ * [QTBUG-33229] The Writer and the Parser now fully accept non-character
+ unicode points.
+ * The Writer will no longer write inf, -inf and nan for infinites and NaN
+ values, which resulted in parsing back as strings. Instead, it will now
+ output null.
+ * The Writer now emits numeric values with full numeric precision. This
+ also allows QJson to support integer values with no loss of precision
+ up to 2^53.
+
+ - QJsonValue:
+ * Added QJsonValue::toInt(). QJsonValue can store 32-bit signed integers
+ with no loss of precision.
+
+ - QObject:
+ * New-style signal connections to functors, lambdas, and static functions
+ now works with a receiver object. The connection will be removed when
+ the either the sender or receiver objects are destroyed.
+
+ - QPluginLoader:
+ * QPluginLoader will no longer load the plugins on Mac OS X and iOS
+ systems when scanning for valid plugins.
+ * Added QPluginLoader::staticPlugins(), which returns the list of
+ built-in plugins (linked to the executable and any loaded libraries).
+
+ - QProcess:
+ * [QTBUG-32958] Fixed a bug that would cause QProcess to crash if
+ waitForStarted() were called after an unsuccessful start()
+ * Added QProcess::nullDevice(), which returns the platform's "blackhole"
+ device (/dev/null on Unix, NUL on Windows). This can be used with
+ QProcess::setStandardOutputFile.
+ * Added enum values QProcess::ForwardedOutputChannel and
+ QProcess::ForwardedErrorChannel, which allow for more fine-grained
+ control over which channel is forwarded and which one is captured.
+ * Added QProcess::ForwardedInputChannel, which allows for stdin to be
+ forwarded to this process's input.
+ * [QTBUG-32979] On Unix, QProcess now correctly forwards the siginfo_t
+ and context parameters of the signal handler to the previous handler.
+
+ - QScopedPointer:
+ * Added QScopedPointerDeleteLater, a new class that can be used as the
+ second template to QScopedPointer and will call deleteLater() on the
+ pointer when it goes out of scope.
+
+ - QSocketNotifier:
+ * Fixed a bug that caused socket notifiers not to be re-enabled after
+ they had been activated on BlackBerry.
+
+ - QStandardPaths:
+ * QStandardPaths::enableTestMode is deprecated and is replaced by
+ QStandardPaths::setTestModeEnabled.
+ * Added QStandardPaths::GenericConfigLocation, which refers to a location
+ where applications can store config files to be shared with other
+ applications.
+
+ - QThread:
+ * Added an advisory interrupt mechanism (QThread::requestInterruption and
+ QThread::isInterruptionRequested).
+
+ - QThreadPool:
+ * Added method clear() to remove any queued QRunnables.
+ * Fixed a number of race conditions.
+
+ - QTime:
+ * [QTBUG-30250] When calling QTime::toString(Qt::TextDate) and
+ QTime::toString(Qt::ISODate), milliseconds are now included in
+ the returned string. This also applies to
+ QDateTime::toString(Qt::TextDate) and
+ QDateTime::toString(ISODate).
+ * Added new methods fromMSecsSinceStartOfDay() to create a new QTime
+ from an msecs value, and msecsSinceStartOfDay() to return the QTime as
+ the number of msecs since the start of the day.
+
+ - QTimeZone:
+ * Added new QTimeZone class to support time tone calculations using the
+ host platform time zone database and the Olsen time zone ID's.
+
+ - QUrl:
+ * [QTBUG-33229] QUrl now fully accepts non-character unicode points;
+ they are encoded as percent characters; they can also be pretty
+ decoded
+ * Added QUrl::RemoveFilename flag which can be passed to path(),
+ authority() and toString() and will cause the filename part of the path
+ (the contents after the last '/') to be removed.
+ * Added QUrl::fileName(), which returns just the filename part of the
+ path.
+ * Added QUrl::NormalizePathSegments flag, which will cause QUrl to
+ remove "/./" or "/../" sequences as much as possible. It will not
+ remove "/../" from the beginning of the path.
+ * Added QUrl::adjusted(), which returns a new QUrl with certain parts of
+ the original URL removed or normalized.
+ * Added QUrl::matches(), which can be used to compare parts of two URLs
+ or to compare two URLs after normalization.
+
+ - QUtf8:
+ * [QTBUG-33229] UTF-8 now accepts non-character unicode points; these
+ are not replaced by the replacement character anymore
+
+ - QVariant:
+ * Fixed QVariant::canConvert with longlong
+ * Variant containing enum types can now be converted to integer
+ * [QTBUG-33981] Fixed a bug that would cause QPolygonF to be saved or
+ loaded incorrectly in QDataStream.
+
+QtDBus
+------
+
+ - Improved error handling so as to give more feedback to the developer when
+ certain marshalling or demarshalling actions fail.
+ - [QTBUG-27809] Fixed some race conditions related to delivering method
+ reply deliveries.
+ - Fixed a bug that made non-slot invokables not get listed in the
+ auto-generated introspections.
+
+QtDeclarative
+-------------
+
+ - ColorDialog:
+ * Added currentColor property.
+
+ - [QTBUG-32928] ShortcutOverride events now work for QQuickItem
+ subclasses
+
QtGui
-----
-- [QTBUG-28228] Session Management:
- The new QPlatformSessionManager class brings back the session management
- functionality. It allows the implementation of platform specific behavior
- related to session management. For platform that don't support this
- feature the default behavior has not changed.
- Both X11 and Windows session management are supported.
+
+ - Accessibility classes are now public allowing accessibility
+ information for custom widgets/QQuickItems
+
+ - Session Management:
+ * [QTBUG-28228] The new QPlatformSessionManager class brings back
+ the session management functionality. It allows the
+ implementation of platform specific behavior related to session
+ management. For platform that don't support this feature the
+ default behavior has not changed. Both X11 and Windows session
+ management are supported.
+
+ - QPolygonF:
+ * When a QVariant holds a QPolygonF() then it will be correctly seen as
+ a null QVariant.
+
+ - [QTBUG-27349] Reintroduced command line argument for positioning
+ windows (-geometry on X11, -qwindowgeometry on other platforms)
QtNetwork
---------
-- API was added to store and resume TLS session tickets.
+ - API was added to store and resume TLS session tickets.
+ - The minimum support openssl version has been increased to openssl
+ 1.0. The code to support older versions has not been removed, but is no
+ longer supported.
+ - An off-by-one error in NTLM proxy authentication has been fixed.
+ - Various improvements to reduce the memory used by qtnetwork have been
+ made.
+ - Improved support for HTTP proxy authentication.
+ - Support for preconnecting to servers before making HTTP and HTTPS
+ connections. This allows for much reduced latency when the hosts to be
+ connected to are known.
+
+QtPrintSupport
+--------------
+
+ - QPrintDialog:
+ * Added support for setting CUPS job options in the print dialog.
+ * Added support for setting CUPS Banner pages in the print dialog.
+ * Added support for setting CUPS Page Set (even/odd pages only) in the
+ print dialog.
+ * Added support for setting CUPS Pages Per Sheet and Pages Per Sheet
+ Layout options
+ * Added CUPS server-side print range support for apps that can't support
+ print range option themselves
+
+QtSql
+-----
+
+Changes in Qt 5.1.0 (missing from released changelog dist/changes-5.1.0)
+ - [QTBUG-28088] Remove dependency of DB driver headers on qsqlcachedresult_p.h.
+ - Deprecate QSqlError setters. The constructor is sufficient, since it has
+ a parameter for each member variable.
+ - Rename the SQL driver header files to _p.h (make private)
+ The drivers were never public API. They were exposed by mistake in
+ public headers. What's more, they have #include'd a private header
+ (qsqlcachedresult_p.h) since at least Qt 4.5.1. That means no one used
+ those headers in Qt 4 (private headers weren't installed then) and
+ it's unlikely anyone did in 5.0.
+ - ODBC: Implemented lastInsertId() for some ODBC compatible databases.
+ - PSQL: Make lastInsertID work for tables without OIDs.
+ - [QTBUG-14904] SQLITE: Fix for Sql query aliases with dots
+ - [QTBUG-2192] ODBC: fix loss of milliseconds when binding QDateTime
+ - [QTBUG-30076] PSQL: escape backslashes only when server requires it
+ IMPORTANT: Applications that implemented their own workarounds must be
+ updated to avoid misbehavior and SQL injection vulnerabilities.
+ - [QTBUG-10569] ODBC: fixed QODBCResult::exec() return value for DELETE
+ operations when no rows are affected.
+ - ODBC: Fixed loss of column metadata on SQL_NO_DATA.
+ - QSqlTableModel: expose methods for getting primary values.
+ - ODBC: Fixed possible cause of spurious errors (commit af35ee291a1bbbc8)
+
+Changes in Qt 5.2.0
+ - [QTBUG-29261] IBASE: Construct a valid QTime when creating timestamps for
+ iBase SQL driver.
+ - [QTBUG-33389] PSQL: Format QDateTime following ISO8601.
+ - Add QSQLITE_OPEN_URI option to QSQLITE driver
+
+QtWidgets
+---------
+
+ - [QTBUG-30255] Fixed a bug where spans across empty cells in a grid
+ layout got broken.
+ - [QTBUG-32788] Properly handles Qt::WidgetWithChildrenShortcut
+ shortcuts in MDI subwindows now.
+ - [QTBUG-33078] QWidget::setWindowOpacity() now works when called
+ before QWidget::show().
+ - [QTBUG-33247] Changed accessible trees and tables to always expose
+ hidden headers, instead of only exposing the visible headers.
+ - [QTBUG-34007] Fixed a crash in tablet support.
+ - Fixed a bug where the maximum size hint of a layout with spans was
+ wrong.
+ - Item delegates now cycle through all three states of tri-state
+ checkboxes, the same way QCheckBox itself does.
+
+ - QAbstractItemView:
+ * [QTBUG-7232] In ItemViews scrollbars will now by default only
+ scroll 1 pixel when scrollMode is set to scrollPerPixel. That is
+ it will (when scrollMode is scrollPerPixel) do what is stated in
+ the documentation, and no longer automatically adjust the
+ scrollbar's singleStep. The user can now control that value.
+
+ - QAbstractScrollArea:
+ * QAbstractScrollArea now has a SizeAdjustPolicy. If it is set to
+ AdjustToContents it will make use of the protected viewportSizeHint()
+ virtual function. This function returns a suggested size based on
+ contents. Note that although the viewportSizeHint() virtual function
+ was reserved in 5.0, user code was not supposed to be overriding it
+ (as the function was private and undocumented). Code that was
+ overriding viewportSizeHint() needs to be recompiled against 5.2 for
+ this feature to work correctly.
+
+ - QColorDialog:
+ * Added a web color QLineEdit.
+ * [QTBUG-14332] Added a screen color picker button.
+ * [QTBUG-31998] Does no longer create widgets when using the
+ platform dialog.
+
+ - QComboBox:
+ * Added currentData() convenience function which allows to retrieve
+ the user data set for the current item.
+
+ - QCompleter:
+ * [QTBUG-3414] Added filterMode property.
+
+ - QDesktopWidget:
+ * [QTBUG-32567] Fixed emission of workAreaResized() signal.
+
+ - QDialogButtonBox:
+ * Added a (StandardButtons,QWidget*) constructor.
+
+ - QDockWidget:
+ * [QTBUG-31044] The position of a dock widget is now kept when
+ undocking.
+ * [QTBUG-32260] Fixed a bug where visibilityChanged was signaled
+ wrongly in certain multi-screen setups.
+
+ - QFileDialog:
+ * setDefaultSuffix() now removes leading dot characters.
+ * Introduced DontUseCustomDirectoryIcons. This improves the file
+ dialog performance under Windows for the case where there are
+ lots of folders. Went from taking 60 seconds to 2 seconds, on a
+ SDCard with 10k folders.
+ * Added setMimeTypeFilters() for mimetype-based filtering, as an
+ alternative to pattern matching.
+ * Fixed removing of directories containing hidden or system files.
+ * Added QUrl-based API for remote files.
+ * [QTBUG-13182] Improved performance on Windows by
+ + not resolving NTFS symlinks (15x speedup on pessimistic
+ workloads) and
+ + using extensions over calling GetFileAttributesEx() in certain
+ cases.
+ * [QTBUG-29403] Fixed potential crash in destructor of
+ ~QFileInfoGather in threaded applications.
+ * [QTBUG-34132] QFileDialog does no longer instantiate widgets if a
+ native dialog will be used instead. Therefore some accessors
+ which previously returned unused objects will now return null.
+ As before, you can set the DontUseNativeDialog option to ensure
+ that widgets will be created and used instead.
+ * [QTBUG-33039] Does no longer create widgets when using the
+ platform dialog.
+
+ - QFontDialog:
+ * Now has finer-grained control over the types of fonts listed,
+ similar to what QFontComboBox already had.
+
+ - QGraphicsView etc
+ * Fixed a crash in QGraphicsProxyWidget.
+ * [QTBUG-8061] Allow handling of mouseDoubleClickEvent in
+ QGraphicsItems.
+ * [QTBUG-19036] Make QGraphicsScene::items(QPointF) work using
+ Qt::{Contains,Intersets}ItemBoundingRect with items that contain
+ the point in the bounding rectangle, but not their (custom)
+ shape.
+
+ - QHeaderView:
+ * [QTBUG-4346] A maximumSize for sections has been introduced. The
+ maximum section size is by default the largest possible section
+ size which in Qt 5.2 has been limited to 1048575 pixels.
+
+ - QInputDialog:
+ * Added getMultiLineText static method.
+
+ - QLineEdit:
+ * Keep placeholderText visible when focused, until text is added.
+ * Context-menu actions now have icons.
+ * Made it possible to add side widgets.
+ * Made it possible to add a clear button commonly used for item
+ view filtering as a side widget
+
+ - QListView:
+ * [QTBUG-1180] Dragging an item outside the QListView in icon mode
+ no longer loses the icon. Also fixed a bug where under certain
+ conditions code overriding QAbstractItemView::viewOptions() would
+ not be called.
+
+ - QMenuBar:
+ * [QTBUG-32807] Menus now close again on second click.
+
+ - QMessageBox:
+ * May use native message boxes on some platforms now.
+ * [QTBUG-6731] It is now possible to select some or all text from a
+ QMessageBox and copy it to the clipboard.
+
+ - QSizePolicy:
+ * Added a retainSizeWhenHidden attribute.
+
+ - QSpinBox:
+ * Values can now be displayed in different bases
+ (cf. displayIntegerBase property)
+ * [QTBUG-31602] Size calculation will now be fixed when stylesheets
+ are used.
+
+ - QSplitter:
+ * Now gets the default value of opaqueResize property from (new)
+ QStyle::SH_Splitter_OpaqueResize styleHint.
+
+ - QSystemTrayIcon:
+ * [QTBUG-31762] Fixed position of system tray icon on Linux/X11
+ (except Unity).
+ * [QTBUG-33461] Increased the maximum length of a system tray
+ tooltip on Windows to what it was in Qt 4.
+
+ - QTableView:
+ * [QTBUG-4206] resizeToContents will now adjust to actual contents
+ and not just visible area. QHeaderView::setAutoResizePrecision()
+ has been introduced to control how precise the autoResize should
+ be.
+
+ - QTextEdit:
+ * Added placeholderText akin to QLineEdit.
+ * Context-menu actions now have icons.
+
+ - QTreeView:
+ * QTreeView now has setTreePosition to allow the treestructure to
+ show data from other columns than logicalindex zero.
+
+ - QWindowContainer:
+ * [QTBUG-32177] Sets active window correctly now.
+
+ - QWizard:
+ * [QTBUG-29924] Gave all buttons an objectName().
+
+****************************************************************************
+* Platform Specific Changes *
+****************************************************************************
+
+
+Android
+-------
+
+ - Project structure and deployment has changed with the introduction of
+ androiddeployqt. Source and build files are no longer mixed, and the
+ build files for the APK package should not be touched. Customizing
+ the build files is possible. Read the documentation for androiddeployqt
+ for more information.
+ - Status bar visibility is now controlled by Qt, so the window state will
+ override settings in the AndroidManifest.xml. The default is still to
+ show the status bar (QWindow::showMaximized()). Use
+ QWindow::showFullScreen() to hide it.
+ - Implemented support for accessibility on Android.
+
+OS X
+----
-- The minimum support openssl version has been increased to openssl 1.0. The
- code to support older versions has not been removed, but is no longer
- supported.
+ - Qt for OS X is now identified by the macro Q_OS_OSX. This complements the
+ existing Q_OS_DARWIN macro (which identifies the open source kernel and
+ could identify non-Apple products) and Q_OS_MAC, which is defined for
+ both OS X and iOS. The old macro Q_OS_MACX is now deprecated.
+ - Qt no longer complains about new versions of OS X that haven't been
+ released yet. This will allow Qt 5.2 and future versions to build on
+ future versions yet to be released. Note that those versions are not
+ supported until official announcement by the Qt Project.
+ - Added a number of functions to QtCore to convert to and from
+ CFString/NSString and QString, CFURL/NSURL and QUrl.
-- An off-by-one error in NTLM proxy authentication has been fixed.
+Windows
+-------
-- Various improvements to reduce the memory used by qtnetwork have been made.
+ - [QTBUG-33409][QTBUG-8764][QTBUG-10032] Fixed virtual key mapping on
+ Windows.
+ - QCoreApplication::arguments() changed the handling of single quotes, double quotes
+ and the backslash character, in order to match what argv[] contains.
+ In particular, single quotes are no longer removed from the argument string.
+ (QTBUG-15379, QTBUG-30628)
-- Improved support for HTTP proxy authentication.
+X11
+---
-- Support for preconnecting to servers before making HTTP and HTTPS
- connections. This allows for much reduced latency when the hosts to be
- connected to are known.
+ - [QTBUG-31762] Fix position of system tray icon (except Unity)
+ - [QTBUG-27349] Reintroduced command line argument for positioning
+ windows (-geometry)
diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc
index 9ac80eb831..0a6e8dc5d1 100644
--- a/doc/global/externalsites/qtcreator.qdoc
+++ b/doc/global/externalsites/qtcreator.qdoc
@@ -30,6 +30,10 @@
\title Qt Creator: Deploying Applications to QNX Devices
*/
/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-developing-baremetal.html
+ \title Qt Creator: Connecting Bare Metal Devices
+*/
+/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-developing-bb10.html
\title Qt Creator: Connecting BlackBerry 10 Devices
*/
@@ -46,32 +50,8 @@
\title Qt Creator: Connecting Embedded Linux Devices
*/
/*!
- \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-maemo.html
- \title Qt Creator: Publishing Qt Content for Maemo Devices
-*/
-/*!
- \externalpage http://qt-project.org/doc/qtcreator/creator-maemo-emulator.html
- \title Qt Creator: Using Maemo or MeeGo Harmattan Emulator
-*/
-/*!
- \externalpage http://qt-project.org/doc/qtcreator/creator-developing-meego.html
- \title Qt Creator: Connecting MeeGo Harmattan Devices
-*/
-/*!
- \externalpage http://qt-project.org/doc/qtcreator/creator-developing-maemo.html
- \title Qt Creator: Connecting Maemo Devices
-*/
-/*!
- \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-meego.html
- \title Qt Creator: Publishing Qt Content for MeeGo Harmattan Devices
-*/
-/*!
- \externalpage http://qt-project.org/doc/qtcreator/creator-publishing-to-maemo-extras.html
- \title Qt Creator: Publishing Maemo Applications to Extras-devel
-*/
-/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-deployment-maemo.html
- \title Qt Creator: Deploying Applications to Linux-Based Devices
+ \title Qt Creator: Deploying Applications to Embedded Linux Devices
*/
/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-faq.html
@@ -118,14 +98,6 @@
\title Qt Creator: Creating Screens
*/
/*!
- \externalpage http://qt-project.org/doc/qtcreator/quick-animations.html
- \title Qt Creator: Animating Screens
-*/
-/*!
- \externalpage http://qt-project.org/doc/qtcreator/quick-user-interaction.html
- \title Qt Creator: Adding User Interaction Methods
-*/
-/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-qml-application.html
\title Qt Creator: Creating a Qt Quick Application
*/
@@ -142,10 +114,6 @@
\title Qt Creator: Developing Qt Quick Applications
*/
/*!
- \externalpage http://qt-project.org/doc/qtcreator/quick-application-logic.html
- \title Qt Creator: Implementing Application Logic
-*/
-/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-using-qt-quick-designer.html
\title Qt Creator: Using Qt Quick Designer
*/
@@ -369,6 +337,12 @@
\externalpage http://qt-project.org/doc/qtcreator/creator-deploying-android.html
\title Qt Creator: Deploying Applications to Android Devices
*/
+
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-developing-ios.html
+ \title Qt Creator: Connecting iOS devices
+*/
+
/*!
\externalpage http://qt-project.org/doc/qtcreator/creator-developing-android.html
\title Qt Creator: Connecting Android Devices
@@ -489,3 +463,7 @@
\externalpage http://qt-project.org/doc/qtcreator/creator-configuring.html
\title Qt Creator: Configuring Qt Creator
*/
+/*!
+ \externalpage http://qt-project.org/doc/qtcreator/creator-debuggers.html
+ \title Qt Creator: Adding Debuggers
+*/
diff --git a/doc/global/html-footer.qdocconf b/doc/global/html-footer.qdocconf
index 6c26dc7c29..c53eb2f599 100644
--- a/doc/global/html-footer.qdocconf
+++ b/doc/global/html-footer.qdocconf
@@ -7,24 +7,14 @@ HTML.footer = \
" </div>\n" \
"</div>\n" \
"<div class=\"footer\">\n" \
- " <div class=\"qt13a-copyright\" id=\"copyright\">\n" \
- " <div class=\"qt13a-container\">\n" \
- " <p>\n" \
- " <acronym title=\"Copyright\">&copy;</acronym> 2013 Digia Plc and/or its\n" \
- " subsidiaries. Documentation contributions included herein are the copyrights of\n" \
- " their respective owners.</p>\n" \
- " <p>\n" \
- " The documentation provided herein is licensed under the terms of the\n" \
- " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \
- " License version 1.3</a> as published by the Free Software Foundation.</p>\n" \
- " <p>\n" \
- " Documentation sources may be obtained from <a href=\"http://www.qt-project.org\">\n" \
- " www.qt-project.org</a>.</p>\n" \
- " <p>\n" \
- " Digia, Qt and their respective logos are trademarks of Digia Plc \n" \
- " in Finland and/or other countries worldwide. All other trademarks are property\n" \
- " of their respective owners. <a title=\"Privacy Policy\"\n" \
- " href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \
- " </div>\n" \
- " </div>\n" \
+ " <p>\n" \
+ " <acronym title=\"Copyright\">&copy;</acronym> 2013 Digia Plc and/or its\n" \
+ " subsidiaries. Documentation contributions included herein are the copyrights of\n" \
+ " their respective owners.<br>" \
+ " The documentation provided herein is licensed under the terms of the" \
+ " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation" \
+ " License version 1.3</a> as published by the Free Software Foundation.<br>" \
+ " Digia, Qt and their respective logos are trademarks of Digia Plc " \
+ " in Finland and/or other countries worldwide. All other trademarks are property\n" \
+ " of their respective owners. </p>\n" \
"</div>\n" \
diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf
index 93cd7ddc55..fb0f5c200b 100644
--- a/doc/global/manifest-meta.qdocconf
+++ b/doc/global/manifest-meta.qdocconf
@@ -32,7 +32,7 @@
# manifestmeta.global.names = *
# manifestmeta.global.tags = qt5
-manifestmeta.filters = highlighted webkit1 webkit2 android thumbnail
+manifestmeta.filters = highlighted webkit1 webkit2 android thumbnail ios
manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \
"QtQuick/Qt Quick Demo - Photo Surface" \
@@ -125,8 +125,11 @@ manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \
"QtLinguist/Arrow Pad Example" \
"QtGui/Raster Window Example" \
"QtGui/Analog Clock Window Example" \
- "QtMultimediaWidgets/Video Widget Example" \
- "QtMultimediaWidgets/Media Player Example" \
+ "QtAndroidExtras/Qt Notifier" \
+ "QtMultimedia/QML Video Shader Effects Example" \
+ "QtMultimedia/QML Video Example" \
+ "QtMultimedia/QML Camera Example" \
+ "QtMultimedia/Audio Output Example" \
"QtSVG/Text Object Example" \
"QtQML/Qt Quick Examples - XMLHttpRequest" \
"QtQuick/Qt Quick Particles Examples - *" \
@@ -138,6 +141,9 @@ manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \
"QtQuick/Qt Quick Examples - Animation" \
"QtQuick/Qt Quick Examples - Shader Effects" \
"QtQuick/Qt Quick Examples - Canvas" \
+ "QtQuick/Qt Quick Examples - MouseArea" \
+ "QtQuick/Qt Quick Examples - Positioners" \
+ "QtQuick/Qt Quick Examples - Right to Left" \
"QtWidgets/Interview" \
"QtWidgets/Spreadsheet" \
"QtWidgets/Pixelator Example" \
@@ -164,11 +170,106 @@ manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \
"QtQML/Extending QML - Methods Example" \
"QtQML/Extending QML - Signal Support Example" \
"QtQML/Extending QML - Attached Properties Example" \
- "QtQuick/Qt Quick Examples - Window and Screen" \
"QtWidgets/Address Book Example"
manifestmeta.android.tags = android
+manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
+ "QtCore/Mandelbrot Example" \
+ "QtCore/Queued Custom Type Example" \
+ "QtGui/Analog Clock Window Example" \
+ "QtGui/OpenGL Window Example" \
+ "QtGui/Raster Window Example" \
+ "QtNetwork/Loopback Example" \
+ "QtNetwork/Network Chat Example" \
+ "QtNetwork/Torrent Example" \
+ "QtOpenGL/2D Painting Example" \
+ "QtOpenGL/Textures Example" \
+ "QtWidgets/Animated Tiles Example" \
+ "QtWidgets/Application Chooser Example" \
+ "QtWidgets/Easing Curves Example" \
+ "QtWidgets/Move Blocks Example" \
+ "QtWidgets/States Example" \
+ "QtWidgets/Class Wizard Example" \
+ "QtWidgets/Find Files Example" \
+ "QtWidgets/License Wizard Example" \
+ "QtWidgets/Standard Dialogs Example" \
+ "QtWidgets/Tab Dialog Example" \
+ "QtWidgets/Trivial Wizard Example" \
+ "QtWidgets/Draggable Text Example" \
+ "QtWidgets/Fridge Magnets Example" \
+ "QtWidgets/Blur Picker Effect Example" \
+ "QtWidgets/Fade Message Effect Example" \
+ "QtWidgets/Lighting Effect Example" \
+ "QtWidgets/Anchor Layout Example" \
+ "QtWidgets/Basic Graphics Layouts Example" \
+ "QtWidgets/40000 Chips" \
+ "QtWidgets/Colliding Mice Example" \
+ "QtWidgets/Diagram Scene Example" \
+ "QtWidgets/Elastic Nodes Example" \
+ "QtWidgets/Embedded Dialogs" \
+ "QtWidgets/Graphics View Flow Layout Example" \
+ "QtWidgets/Simple Anchor Layout Example" \
+ "QtWidgets/Weather Anchor Layout Example" \
+ "QtWidgets/Address Book Example" \
+ "QtWidgets/Basic Sort/Filter Model Example" \
+ "QtWidgets/Chart Example" \
+ "QtWidgets/Custom Sort/Filter Model Example" \
+ "QtWidgets/Dir View Example" \
+ "QtWidgets/Editable Tree Model Example" \
+ "QtWidgets/Frozen Column Example" \
+ "QtWidgets/Interview" \
+ "QtWidgets/Simple Tree Model Example" \
+ "QtWidgets/Simple Widget Mapper Example" \
+ "QtWidgets/Basic Layouts Example" \
+ "QtWidgets/Border Layout Example" \
+ "QtWidgets/Flow Layout Example" \
+ "QtWidgets/Basic Drawing Example" \
+ "QtWidgets/Concentric Circles Example" \
+ "QtWidgets/Font Sampler Example" \
+ "QtWidgets/Gradients" \
+ "QtWidgets/Image Composition Example" \
+ "QtWidgets/Painter Paths Example" \
+ "QtWidgets/Transformations Example" \
+ "QtWidgets/Calendar Example" \
+ "QtWidgets/Order Form Example" \
+ "QtWidgets/Syntax Highlighter Example" \
+ "QtWidgets/Text Edit" \
+ "QtWidgets/Traffic Light Example" \
+ "QtWidgets/Two-way Button Example" \
+ "QtWidgets/Completer Example" \
+ "QtWidgets/Custom Completer Example" \
+ "QtWidgets/Undo Framework" \
+ "QtWidgets/Analog Clock Example" \
+ "QtWidgets/Calculator Example" \
+ "QtWidgets/Calendar Widget Example" \
+ "QtWidgets/Character Map Example" \
+ "QtWidgets/Code Editor Example" \
+ "QtWidgets/Digital Clock Example" \
+ "QtWidgets/Elided Label Example" \
+ "QtWidgets/Line Edits Example" \
+ "QtWidgets/Scribble Example" \
+ "QtWidgets/Shaped Clock Example" \
+ "QtWidgets/Sliders Example" \
+ "QtWidgets/Validators Example" \
+ "QtWidgets/Window Flags Example" \
+ "QtWidgets/Wiggly Example" \
+ "QtQuick/Qt Quick Examples - Animation" \
+ "QtQuick/Qt Quick Examples - Canvas" \
+ "QtQuick/Qt Quick Examples - Drag and Drop" \
+ "QtQuick/Qt Quick Examples - Image Elements" \
+ "QtQuick/Qt Quick Examples - MouseArea" \
+ "QtQuick/Qt Quick Examples - Positioners" \
+ "QtQuick/Qt Quick Examples - Right to Left" \
+ "QtQuick/Scene Graph - OpenGL Under QML" \
+ "QtQuick/Qt Quick Examples - Shader Effects" \
+ "QtQuick/Qt Quick Examples - Text" \
+ "QtQuick/Qt Quick Examples - Touch Interaction" \
+ "QtQuick/Qt Quick Examples - Views" \
+ "QtQuick/Qt Quick Examples - Window and Screen"
+
+manifestmeta.ios.tags = ios
+
# add a generic thumbnail image to examples that do not have any images in their documentation
manifestmeta.thumbnail.attributes = "imageUrl:qthelp\://org.qt-project.qtdoc.$QT_VERSION_TAG/qtdoc/images/qt-codesample.png"
diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf
index b1738e129f..528b0cd561 100644
--- a/doc/global/qt-cpp-defines.qdocconf
+++ b/doc/global/qt-cpp-defines.qdocconf
@@ -15,6 +15,7 @@ defines += Q_QDOC \
Q_NO_USING_KEYWORD \
__cplusplus \
Q_COMPILER_INITIALIZER_LISTS \
+ Q_COMPILER_UNIFORM_INIT \
Q_COMPILER_RVALUE_REFS
Cpp.ignoretokens += \
diff --git a/doc/global/template/style/offline.css b/doc/global/template/style/offline.css
index 5dc4908aff..81e11aac0b 100644
--- a/doc/global/template/style/offline.css
+++ b/doc/global/template/style/offline.css
@@ -192,7 +192,29 @@ footer and license
*/
.footer {
- text-align: center
+ text-align: left;
+ margin-top: 50px;
+ padding-left: 5px;
+ margin-bottom: 10px;
+ font-size: 10px;
+ border-top: 1px solid #999;
+ padding-top: 11px;
+}
+
+.footer p {
+ line-height: 14px;
+ font-size: 11px;
+}
+
+.footer a[href*="http://"], a[href*="ftp://"], a[href*="https://"] {
+ font-weight: bold;
+}
+
+.footerNavi {
+ width: auto;
+ text-align: right;
+ margin-top: 50px;
+ z-index: 1;
}
.navigationbar {
@@ -244,16 +266,6 @@ footer and license
padding-right: 17px;
}
-/*
------------
-footer and license
------------
-*/
-
-.footer {
- text-align: center
-}
-
#buildversion {
font-style: italic;
font-size: small;
@@ -492,22 +504,6 @@ ol {
padding: 20px 20px 20px 20px;
}
-.footer {
- margin-top: 50px;
- padding-left: 5px;
- margin-bottom: 10px;
- font-size: 10px;
- border-top: 1px solid #999;
- padding-top: 11px;
-}
-
-.footerNavi {
- width: auto;
- text-align: right;
- margin-top: 50px;
- z-index: 1;
-}
-
.memItemLeft {
padding-right: 3px
}
diff --git a/examples/qtconcurrent/imagescaling/imagescaling.cpp b/examples/qtconcurrent/imagescaling/imagescaling.cpp
index 01083edb4e..9cc8ef655d 100644
--- a/examples/qtconcurrent/imagescaling/imagescaling.cpp
+++ b/examples/qtconcurrent/imagescaling/imagescaling.cpp
@@ -40,8 +40,6 @@
#include "imagescaling.h"
#include "math.h"
-#ifndef QT_NO_CONCURRENT
-
const int imageSize = 100;
QImage scale(const QString &imageFileName)
@@ -141,5 +139,3 @@ void Images::finished()
cancelButton->setEnabled(false);
pauseButton->setEnabled(false);
}
-
-#endif // QT_NO_CONCURRENT
diff --git a/examples/qtconcurrent/imagescaling/imagescaling.h b/examples/qtconcurrent/imagescaling/imagescaling.h
index 3c02db05b9..a84e2bdb6d 100644
--- a/examples/qtconcurrent/imagescaling/imagescaling.h
+++ b/examples/qtconcurrent/imagescaling/imagescaling.h
@@ -43,8 +43,6 @@
#include <QtWidgets>
#include <QtConcurrent>
-#ifndef QT_NO_CONCURRENT
-
class Images : public QWidget
{
Q_OBJECT
@@ -65,18 +63,4 @@ private:
QFutureWatcher<QImage> *imageScaling;
};
-#else
-
-// Dummy class required because QT_NO_CONCURRENT is not set when moc is run.
-class Images : public QWidget
-{
-Q_OBJECT
-public Q_SLOTS:
- void open() {}
- void showImage(int) {}
- void finished() {}
-};
-
-#endif // QT_NO_CONCURRENT
-
#endif // IMAGESCALING_H
diff --git a/examples/qtconcurrent/imagescaling/main.cpp b/examples/qtconcurrent/imagescaling/main.cpp
index ccdea2e771..442c8a4771 100644
--- a/examples/qtconcurrent/imagescaling/main.cpp
+++ b/examples/qtconcurrent/imagescaling/main.cpp
@@ -40,8 +40,6 @@
#include <QtWidgets>
#include <QtConcurrent>
-#ifndef QT_NO_CONCURRENT
-
#include "imagescaling.h"
int main(int argc, char *argv[])
@@ -53,21 +51,3 @@ int main(int argc, char *argv[])
return app.exec();
}
-
-#else
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QString text("Qt Concurrent is not supported on this platform");
-
- QLabel *label = new QLabel(text);
- label->setWordWrap(true);
-
- label->show();
- qDebug() << text;
-
- app.exec();
-}
-
-#endif
diff --git a/examples/qtconcurrent/progressdialog/main.cpp b/examples/qtconcurrent/progressdialog/main.cpp
index c646105db6..01d4aef256 100644
--- a/examples/qtconcurrent/progressdialog/main.cpp
+++ b/examples/qtconcurrent/progressdialog/main.cpp
@@ -41,8 +41,6 @@
#include <QtWidgets>
#include <QtConcurrent>
-#ifndef QT_NO_CONCURRENT
-
using namespace QtConcurrent;
const int iterations = 20;
@@ -88,22 +86,3 @@ int main(int argc, char **argv)
// Query the future to check if was canceled.
qDebug() << "Canceled?" << futureWatcher.future().isCanceled();
}
-
-#else
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QString text("Qt Concurrent is not yet supported on this platform");
-
- QLabel *label = new QLabel(text);
- label->setWordWrap(true);
-
- label->show();
- qDebug() << text;
-
- app.exec();
-}
-
-#endif
-
diff --git a/examples/qtconcurrent/runfunction/main.cpp b/examples/qtconcurrent/runfunction/main.cpp
index 0e62bd0a75..85c5e1267a 100644
--- a/examples/qtconcurrent/runfunction/main.cpp
+++ b/examples/qtconcurrent/runfunction/main.cpp
@@ -44,8 +44,6 @@
#include <qtconcurrentrun.h>
#include <QApplication>
-#ifndef QT_NO_CONCURRENT
-
using namespace QtConcurrent;
void hello(QString name)
@@ -61,23 +59,3 @@ int main(int argc, char **argv)
f1.waitForFinished();
f2.waitForFinished();
}
-
-#else
-
-#include <QLabel>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QString text("Qt Concurrent is not yet supported on this platform");
-
- QLabel *label = new QLabel(text);
- label->setWordWrap(true);
-
- label->show();
- qDebug() << text;
-
- app.exec();
-}
-
-#endif
diff --git a/examples/qtconcurrent/wordcount/main.cpp b/examples/qtconcurrent/wordcount/main.cpp
index 635951fd4a..408e92dbb3 100644
--- a/examples/qtconcurrent/wordcount/main.cpp
+++ b/examples/qtconcurrent/wordcount/main.cpp
@@ -50,8 +50,6 @@
#include <qtconcurrentmap.h>
-#ifndef QT_NO_CONCURRENT
-
using namespace QtConcurrent;
/*
@@ -155,23 +153,3 @@ int main(int argc, char** argv)
}
qDebug() << "MapReduce speedup x" << ((double)singleThreadTime - (double)mapReduceTime) / (double)mapReduceTime + 1;
}
-
-#else
-
-#include <QLabel>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QString text("Qt Concurrent is not yet supported on this platform");
-
- QLabel *label = new QLabel(text);
- label->setWordWrap(true);
-
- label->show();
- qDebug() << text;
-
- app.exec();
-}
-
-#endif
diff --git a/examples/threads/doc/src/queuedcustomtype.qdoc b/examples/threads/doc/src/queuedcustomtype.qdoc
index ffeb3dd805..40ec2668de 100644
--- a/examples/threads/doc/src/queuedcustomtype.qdoc
+++ b/examples/threads/doc/src/queuedcustomtype.qdoc
@@ -42,8 +42,9 @@
\section1 Overview
- In the \l{Custom Type Sending Example}, we showed how to use a custom type
- with signal-slot communication within the same thread.
+ In the \l{Custom Type Example}, we showed how to integrate custom types with
+ the meta-object system, enabling them to be stored in QVariant objects, written
+ out in debugging information and used in signal-slot communication.
In this example, we create a new value class, \c Block, and register it
with the meta-object system to enable us to send instances of it between
@@ -152,7 +153,7 @@
meta-object system so that it can be used with signal-slot connections
between threads. For ordinary communication involving direct signals and
slots, it is enough to simply declare the type in the way described in the
- \l{Custom Type Sending Example}.
+ \l{Custom Type Example}.
In practice, both the Q_DECLARE_METATYPE() macro and the qRegisterMetaType()
template function can be used to register custom types, but
diff --git a/examples/threads/doc/src/semaphores.qdoc b/examples/threads/doc/src/semaphores.qdoc
index 494ed7592a..e90045f824 100644
--- a/examples/threads/doc/src/semaphores.qdoc
+++ b/examples/threads/doc/src/semaphores.qdoc
@@ -54,7 +54,7 @@
An alternative to using QSemaphore to solve the producer-consumer
problem is to use QWaitCondition and QMutex. This is what the
- \l{threads/waitconditions}{Wait Conditions} example does.
+ \l{Wait Conditions Example} does.
\section1 Global Variables
diff --git a/examples/threads/doc/src/waitconditions.qdoc b/examples/threads/doc/src/waitconditions.qdoc
index 1439824a78..25c9ce88fb 100644
--- a/examples/threads/doc/src/waitconditions.qdoc
+++ b/examples/threads/doc/src/waitconditions.qdoc
@@ -54,7 +54,7 @@
An alternative to using QWaitCondition and QMutex to solve the
producer-consumer problem is to use QSemaphore. This is what the
- \l{threads/semaphores}{Semaphores} example does.
+ \l{Semaphores Example} does.
\section1 Global Variables
diff --git a/examples/tools/doc/src/customtype.qdoc b/examples/tools/doc/src/customtype.qdoc
index 6e6d08fb35..e016933e04 100644
--- a/examples/tools/doc/src/customtype.qdoc
+++ b/examples/tools/doc/src/customtype.qdoc
@@ -132,8 +132,8 @@
\section1 Further Reading
The custom \c Message type can also be used with direct signal-slot
- connections; see the \l{Custom Type Sending Example} for a demonstration
- of this.
+ connections.
+
To register a custom type for use with queued signals and slots, such as
those used in cross-thread communication, see the
\l{Queued Custom Type Example}.
diff --git a/examples/widgets/doc/src/padnavigator.qdoc b/examples/widgets/doc/src/padnavigator.qdoc
index 55a6b5e4ac..391ef62587 100644
--- a/examples/widgets/doc/src/padnavigator.qdoc
+++ b/examples/widgets/doc/src/padnavigator.qdoc
@@ -32,8 +32,8 @@
\brief Demonstrates how to create animated user interface
The Pad Navigator Example shows how you can use Graphics View together with
- embedded widgets and Qt's \l{State Machine Framework} to create a simple
- but useful, dynamic, animated user interface.
+ embedded widgets and Qt's \l{The State Machine Framework}{state machine
+ framework} to create a simple but useful, dynamic, animated user interface.
\image padnavigator-example.png
diff --git a/examples/widgets/doc/src/wiggly.qdoc b/examples/widgets/doc/src/wiggly.qdoc
index 9430a3ed36..c2b920decd 100644
--- a/examples/widgets/doc/src/wiggly.qdoc
+++ b/examples/widgets/doc/src/wiggly.qdoc
@@ -42,8 +42,8 @@
time has passed, it sends a QTimerEvent to a QObject of our
choice. This makes QBasicTimer a more lightweight alternative to
QTimer. Qt's built-in widgets use it internally, and it is
- provided in Qt's API for highly-optimized applications (e.g.,
- \l{Qt for Embedded Linux} applications).
+ provided in Qt's API for highly-optimized applications (such as
+ embedded applications).
The example consists of two classes:
diff --git a/examples/widgets/tutorials/threads/clock/clock.pro b/examples/widgets/tutorials/threads/clock/clock.pro
deleted file mode 100644
index 041c02bea8..0000000000
--- a/examples/widgets/tutorials/threads/clock/clock.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT += widgets
-CONFIG += console
-TEMPLATE = app
-SOURCES += main.cpp \
- clockthread.cpp
-HEADERS += clockthread.h
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/clock
-INSTALLS += target
diff --git a/examples/widgets/tutorials/threads/clock/clockthread.cpp b/examples/widgets/tutorials/threads/clock/clockthread.cpp
deleted file mode 100644
index 5068a9b14a..0000000000
--- a/examples/widgets/tutorials/threads/clock/clockthread.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "clockthread.h"
-
- //This class starts another thread where it emits a signal for every new second.
-
-//! [1]
-// clock/clockthread.cpp
-void ClockThread::run()
-{
- QTimer timer;
- connect(&timer, SIGNAL(timeout()), this, SLOT(timerHit()), Qt::DirectConnection);
- timer.setInterval(10);
- timer.start(); // puts one event in the threads event queue
- exec();
- timer.stop();
-}
-
-void ClockThread::timerHit()
-{
- QString newTime= QDateTime::currentDateTime().toString("ddd MMMM d yy, hh:mm:ss");
- if(m_lastTime != newTime ){
- m_lastTime = newTime;
- emit sendTime(newTime) ;
- }
-}
-//! [1]
diff --git a/examples/widgets/tutorials/threads/clock/clockthread.h b/examples/widgets/tutorials/threads/clock/clockthread.h
deleted file mode 100644
index 9d3b06ddd8..0000000000
--- a/examples/widgets/tutorials/threads/clock/clockthread.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CLOCKTHREAD_H
-#define CLOCKTHREAD_H
-
-#include <QString>
-#include <QThread>
-
-
-
-//! [1]
-// clock/clockthread.h
-class ClockThread : public QThread
-{
- Q_OBJECT
-signals:
- void sendTime(QString time);
-private:
- void run();
- QString m_lastTime;
-private slots:
- void timerHit();
-
-};
-//! [1]
-#endif // CLOCKTHREAD_H \ No newline at end of file
diff --git a/examples/widgets/tutorials/threads/clock/main.cpp b/examples/widgets/tutorials/threads/clock/main.cpp
deleted file mode 100644
index f90318027c..0000000000
--- a/examples/widgets/tutorials/threads/clock/main.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "clockthread.h"
-
-//A clock that does time formatting in another thread
-
-//! [1]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- // build gui
- QWidget widget;
- QLabel *label = new QLabel;
- QHBoxLayout *layout = new QHBoxLayout(&widget);
- layout->addWidget(label);
- widget.setWindowTitle("clock");
-
- //instantiate thread object
- ClockThread clockThread;
- QObject::connect(&clockThread, SIGNAL(sendTime(QString)), label, SLOT(setText(QString)), Qt::QueuedConnection);
- clockThread.start();
- widget.show();
- app.exec();
- clockThread.quit();
- clockThread.wait();
- return 0;
-}
-//! [1]
diff --git a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp b/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp
deleted file mode 100644
index 773c685ba0..0000000000
--- a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include <QtConcurrent>
-
-/*
- says hello from main thread and secondary thread using QtConcurrent
-*/
-
-//! [1]
-// helloconcurrent/main.cpp
-void hello()
-{
- qDebug() << "Hello from thread " << QThread::currentThread();
-}
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- QFuture<void> future = QtConcurrent::run(hello);
- qDebug() << "hello from GUI thread " << QThread::currentThread();
- future.waitForFinished();
- return 0;
-}
-//! [1]
diff --git a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.pro b/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.pro
deleted file mode 100644
index 7e6da1133c..0000000000
--- a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT -= gui
-QT += concurrent
-
-CONFIG += console
-CONFIG -= app_bundle
-TEMPLATE = app
-SOURCES += helloconcurrent.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/helloconcurrent
-INSTALLS += target
-
-
-
diff --git a/examples/widgets/tutorials/threads/hellothread/hellothread.cpp b/examples/widgets/tutorials/threads/hellothread/hellothread.cpp
deleted file mode 100644
index 1b5088e0db..0000000000
--- a/examples/widgets/tutorials/threads/hellothread/hellothread.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include "hellothread.h"
-/*
- * demonstrates use of QThread, says hello in another thread and terminates
- */
-
-void HelloThread::run()
-{
- qDebug() << "hello from worker thread " << thread()->currentThreadId();
-}
diff --git a/examples/widgets/tutorials/threads/hellothread/hellothread.h b/examples/widgets/tutorials/threads/hellothread/hellothread.h
deleted file mode 100644
index 281f2c6cb5..0000000000
--- a/examples/widgets/tutorials/threads/hellothread/hellothread.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HELLOTHREAD_H
-#define HELLOTHREAD_H
-
-#include <QThread>
-
-class HelloThread : public QThread
-{
- Q_OBJECT
-private:
- void run();
-};
-
-#endif // HELLOTHREAD_H
diff --git a/examples/widgets/tutorials/threads/hellothread/hellothread.pro b/examples/widgets/tutorials/threads/hellothread/hellothread.pro
deleted file mode 100644
index 40fd33b146..0000000000
--- a/examples/widgets/tutorials/threads/hellothread/hellothread.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT -= gui
-
-CONFIG += console
-CONFIG -= app_bundle
-TEMPLATE = app
-SOURCES += main.cpp \
- hellothread.cpp
-HEADERS += hellothread.h
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/hellothread
-INSTALLS += target
-
-
diff --git a/examples/widgets/tutorials/threads/hellothread/main.cpp b/examples/widgets/tutorials/threads/hellothread/main.cpp
deleted file mode 100644
index 8b4b00874f..0000000000
--- a/examples/widgets/tutorials/threads/hellothread/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include "hellothread.h"
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- HelloThread thread;
- thread.start();
- qDebug() << "hello from GUI thread " << app.thread()->currentThreadId();
- thread.wait(); // do not exit before the thread is completed!
- return 0;
-}
diff --git a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp b/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp
deleted file mode 100644
index f904159fe4..0000000000
--- a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtCore>
-// A hello world program to demonstrate the use of the global thread pool
-
-//! [1]
-// hellothreadpool/main.cpp
-class Work : public QRunnable
-{
-public:
- void run()
- {
- qDebug() << "Hello from thread " << QThread::currentThread();
- }
-};
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- Work work;
- work.setAutoDelete(false);
- QThreadPool *threadPool = QThreadPool::globalInstance();
- threadPool->start(&work);
- qDebug() << "hello from GUI thread " << QThread::currentThread();
- threadPool->waitForDone();
- return 0;
-}
-//! [1]
diff --git a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.pro b/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.pro
deleted file mode 100644
index d5404a5134..0000000000
--- a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-QT -= gui
-
-CONFIG += console
-CONFIG -= app_bundle
-TEMPLATE = app
-SOURCES += hellothreadpool.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/hellothreadpool
-INSTALLS += target
-
-
-
-
diff --git a/examples/widgets/tutorials/threads/movedobject/main.cpp b/examples/widgets/tutorials/threads/movedobject/main.cpp
deleted file mode 100644
index 2894707fda..0000000000
--- a/examples/widgets/tutorials/threads/movedobject/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include "workerobject.h"
-#include "thread.h"
-
-/*
- * moves a class derived from QObject (WorkerObject) to another thread
- * and calls methods over thread boundaries.
- */
-
-//![1]
-// movedobject/main.cpp
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- Thread thread;
- qDebug() << "main thread ID: " << app.thread()->currentThreadId();
- WorkerObject *worker = new WorkerObject;
- thread.launchWorker(worker);
- QMetaObject::invokeMethod(worker, "doWork", Qt::QueuedConnection);
- QMetaObject::invokeMethod(worker, "startPolling", Qt::QueuedConnection, Q_ARG(int, 500));
- //let application produce output for 3 seconds and quit
- QTimer::singleShot(3000, &app, SLOT(quit()));
- app.exec();
- thread.stop();
- thread.wait();
- delete worker;
- return 0;
-}
-//![1]
diff --git a/examples/widgets/tutorials/threads/movedobject/movedobject.pro b/examples/widgets/tutorials/threads/movedobject/movedobject.pro
deleted file mode 100644
index b2ea7e5366..0000000000
--- a/examples/widgets/tutorials/threads/movedobject/movedobject.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-QT += widgets
-CONFIG += console
-CONFIG -= app_bundle
-TEMPLATE = app
-SOURCES += main.cpp \
- workerobject.cpp \
- thread.cpp
-
-HEADERS += \
- workerobject.h \
- thread.h
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/movedobject
-INSTALLS += target
diff --git a/examples/widgets/tutorials/threads/movedobject/thread.cpp b/examples/widgets/tutorials/threads/movedobject/thread.cpp
deleted file mode 100644
index 2b6c2ffbd6..0000000000
--- a/examples/widgets/tutorials/threads/movedobject/thread.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "thread.h"
-
-/*
- * QThread derived class with additional capability to move a QObject to the
- * new thread, to stop the thread and move the QObject back to the thread where
- *it came from.
- */
-
-Thread::Thread( QObject *parent)
- : QThread (parent)
-{
- //we need a class that receives signals from other threads and emits a signal in response
- shutDownHelper=new QSignalMapper;
- shutDownHelper->setMapping(this,0);
- connect(this, SIGNAL(started()), this, SLOT(setReadyStatus() ), Qt::DirectConnection);
- connect(this, SIGNAL(aboutToStop()), shutDownHelper, SLOT(map()) );
-}
-
-//------------------------------------------------------
-Thread::~Thread()
-{
- delete shutDownHelper;
-}
-
-//------------------------------------------------------
-// starts thread, moves worker to this thread and blocks
-void Thread::launchWorker(QObject *worker)
-{
- this->worker = worker;
- start();
- worker->moveToThread(this);
- shutDownHelper->moveToThread(this);
- connect(shutDownHelper, SIGNAL(mapped(int) ), this, SLOT(stopExecutor()), Qt::DirectConnection );
- mutex.lock();
- waitCondition.wait(&mutex);
-}
-
-//------------------------------------------------------
-// puts a command to stop processing in the event queue of worker thread
-void Thread::stop()
-{
- emit aboutToStop();
-}
-
-//------------------------------------------------------
-
-// methods above this line should be called in gui thread context
-// methods below this line are private and will be run in secondary thread context
-
-//------------------------------------------------------
-void Thread::stopExecutor() //secondary thread context
-{
- exit();
-}
-
-//------------------------------------------------------
-void Thread::setReadyStatus()
-{
- waitCondition.wakeAll();
-}
diff --git a/examples/widgets/tutorials/threads/movedobject/thread.h b/examples/widgets/tutorials/threads/movedobject/thread.h
deleted file mode 100644
index e95d480ca8..0000000000
--- a/examples/widgets/tutorials/threads/movedobject/thread.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef THREAD_H
-#define THREAD_H
-
-#include <QtCore>
-
-class Thread :public QThread
-{
- Q_OBJECT
-public:
- Thread( QObject *parent=0);
- ~Thread();
- void stop();
- void launchWorker(QObject *worker);
-private:
- QObject *worker;
- QSignalMapper *shutDownHelper;
- QWaitCondition waitCondition;
- QMutex mutex;
-private slots:
- void stopExecutor();
- void setReadyStatus();
-signals:
- void aboutToStop();
-};
-
-#endif // THREAD_H
diff --git a/examples/widgets/tutorials/threads/movedobject/workerobject.cpp b/examples/widgets/tutorials/threads/movedobject/workerobject.cpp
deleted file mode 100644
index a630042f9a..0000000000
--- a/examples/widgets/tutorials/threads/movedobject/workerobject.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtCore>
-#include "workerobject.h"
-
-/*
- * represents an object that lives in another thread where it polls a resource
- * and communicates with the gui thread
- */
-
-WorkerObject::WorkerObject(QObject *parent)
- : QObject(parent)
-{
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(poll()));
-}
-
-//---------------------------------------------------------------
-void WorkerObject::doWork()
-{
-
- qDebug() << "doing work in thread " << thread()->currentThreadId() ;
-}
-
-//---------------------------------------------------------------
-WorkerObject::~WorkerObject()
-{
- qDebug() << "destruction WorkerObject in thread " << thread()->currentThreadId();
-}
-
-//---------------------------------------------------------------
-void WorkerObject::startPolling(int milliseconds)
-{
- count=0;
- timer->start(milliseconds);
-}
-
-//---------------------------------------------------------------
-void WorkerObject::stopPolling()
-{
- timer->stop();
-}
-
-//---------------------------------------------------------------
-void WorkerObject::poll()
-{
- qDebug() << QString("timer hit %1").arg(count);
- count++;
-}
-
diff --git a/examples/widgets/tutorials/threads/movedobject/workerobject.h b/examples/widgets/tutorials/threads/movedobject/workerobject.h
deleted file mode 100644
index 251a935282..0000000000
--- a/examples/widgets/tutorials/threads/movedobject/workerobject.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef WORKEROBJECT_H
-#define WORKEROBJECT_H
-
-#include <QtCore>
-
-class WorkerObject : public QObject
-{
- Q_OBJECT
-public:
- explicit WorkerObject(QObject *parent = 0);
- ~WorkerObject();
-public slots:
- void doWork();
- void startPolling(int milliseconds);
- void stopPolling();
-private slots:
- void poll();
-private:
- QTimer *timer;
- int count;
-};
-
-#endif // WORKEROBJECT_H
diff --git a/examples/widgets/tutorials/threads/threads.pro b/examples/widgets/tutorials/threads/threads.pro
deleted file mode 100644
index 19718d760c..0000000000
--- a/examples/widgets/tutorials/threads/threads.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS = hellothread \
- hellothreadpool \
- clock \
- movedobject
-
-qtHaveModule(concurrent): SUBDIRS += helloconcurrent
diff --git a/examples/widgets/tutorials/tutorials.pro b/examples/widgets/tutorials/tutorials.pro
index cf94830551..2eb87cdbd5 100644
--- a/examples/widgets/tutorials/tutorials.pro
+++ b/examples/widgets/tutorials/tutorials.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS += threads addressbook widgets modelview gettingStarted
+SUBDIRS += addressbook widgets modelview gettingStarted
diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf
index 11d62a1efb..e3fa924e23 100644
--- a/mkspecs/android-g++/qmake.conf
+++ b/mkspecs/android-g++/qmake.conf
@@ -4,7 +4,6 @@ QMAKE_PLATFORM = android
QMAKE_COMPILER = gcc
CONFIG += android_install unversioned_soname android_deployment_settings
-DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf
index a903ed025d..5bc1fd14c9 100644
--- a/mkspecs/features/android/android_deployment_settings.prf
+++ b/mkspecs/features/android/android_deployment_settings.prf
@@ -47,18 +47,6 @@ contains(TEMPLATE, ".*app"):!build_pass:!android-no-sdk {
!isEmpty(ANDROID_PACKAGE_SOURCE_DIR): \
FILE_CONTENT += " \"android-package-source-directory\": $$emitString($$ANDROID_PACKAGE_SOURCE_DIR),"
- !isEmpty(ANDROID_PACKAGE): \
- FILE_CONTENT += " \"android-package\": $$emitString($$ANDROID_PACKAGE),"
-
- !isEmpty(ANDROID_MINIMUM_VERSION): \
- FILE_CONTENT += " \"android-minimum-version\": $$ANDROID_MINIMUM_VERSION,"
-
- !isEmpty(ANDROID_TARGET_VERSION): \
- FILE_CONTENT += " \"android-target-version\": $$ANDROID_TARGET_VERSION,"
-
- !isEmpty(ANDROID_APP_NAME): \
- FILE_CONTENT += " \"android-app-name\": $$emitString($$ANDROID_APP_NAME),"
-
!isEmpty(ANDROID_EXTRA_LIBS): \
FILE_CONTENT += " \"android-extra-libs\": $$emitString($$join(ANDROID_EXTRA_LIBS, ",")),"
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 4643c3915c..19b26460a0 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -51,7 +51,7 @@ contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
}
-!exists($$first(QT.$${MODULE}.private_includes)): CMAKE_NO_PRIVATE_INCLUDES = true
+!exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true
CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
@@ -111,15 +111,15 @@ if(build_all|CONFIG(debug, debug|release)): CMAKE_DEBUG_TYPE = debug
if(build_all|CONFIG(release, debug|release)): CMAKE_RELEASE_TYPE = release
contains(CONFIG, plugin) {
- equals(PLUGIN_TYPE, bearer): PLUGIN_MODULE_NAME = network
- else:equals(PLUGIN_TYPE, sqldrivers): PLUGIN_MODULE_NAME = sql
- else:equals(PLUGIN_TYPE, accessible): PLUGIN_MODULE_NAME = widgets
- else:equals(PLUGIN_TYPE, imageformats): PLUGIN_MODULE_NAME = gui
- else:equals(PLUGIN_TYPE, platforminputcontexts): PLUGIN_MODULE_NAME = gui
- else:equals(PLUGIN_TYPE, platformthemes): PLUGIN_MODULE_NAME = gui
- else:equals(PLUGIN_TYPE, generic): PLUGIN_MODULE_NAME = gui
- else:equals(PLUGIN_TYPE, platforms): PLUGIN_MODULE_NAME = gui
- else: return()
+ PLUGIN_MODULE_NAME =
+ for (mod, QT_MODULES) {
+ types = $$replace(QT.$${mod}.plugin_types, /.*$, )
+ contains(types, $$PLUGIN_TYPE) {
+ PLUGIN_MODULE_NAME = $$mod
+ break()
+ }
+ }
+ isEmpty(PLUGIN_MODULE_NAME): return()
CMAKE_MODULE_NAME = $$cmakeModuleName($$PLUGIN_MODULE_NAME)
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
index 0cdaafee7f..dce981e059 100644
--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
@@ -95,7 +95,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
)
!!ELSE
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
+ set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
!!ENDIF
!!ELSE
!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
@@ -106,7 +106,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
)
!!ELSE
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
+ set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
!!ENDIF
!!ELSE
set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\")
@@ -116,7 +116,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
\"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
)
!!ELSE
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
+ set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
!!ENDIF
!!ENDIF
!!ENDIF
@@ -124,8 +124,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
!!ENDIF
!!ELSE
- set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS)
- set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
+ set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"\")
+ set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
!!ENDIF
foreach(_dir ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
@@ -163,6 +163,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
set(_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT EXACT)
endif()
+ set(Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS \"\")
+
foreach(_module_dep ${_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES})
if (NOT Qt5${_module_dep}_FOUND)
find_package(Qt5${_module_dep}
@@ -188,9 +190,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS)
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS)
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS)
- if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
- list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
- endif()
+ list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS)
set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\")
diff --git a/mkspecs/features/dbuscommon.pri b/mkspecs/features/dbuscommon.pri
index 6e1e5659c3..2f2e6b831f 100644
--- a/mkspecs/features/dbuscommon.pri
+++ b/mkspecs/features/dbuscommon.pri
@@ -67,6 +67,7 @@ for(group, groups) {
$${group}_source.name = DBUSXML2CPP $${dbus_TYPE} SOURCE ${QMAKE_FILE_IN}
$${group}_source.variable_out = SOURCES
$${group}_source.input = $$input_list
+ $${group}_source.depends = $$eval($${group}_header.output) # this actually belongs to the object file
$${group}_moc.commands = $$moc_header.commands
$${group}_moc.output = $$moc_header.output
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index 4501b2a568..8eb7101acc 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -6,6 +6,8 @@ contains(TEMPLATE, ".*(lib|app)"):CONFIG += have_target
load(resolve_config)
+exclusive_builds: load(exclusive_builds_post)
+
# If the TARGET looks like a path, split it into DESTDIR and the resulting TARGET
target_dir_part = $$dirname(TARGET)
!isEmpty(target_dir_part) {
diff --git a/mkspecs/features/exclusive_builds.prf b/mkspecs/features/exclusive_builds.prf
index c45ff22c06..4d88dcd15e 100644
--- a/mkspecs/features/exclusive_builds.prf
+++ b/mkspecs/features/exclusive_builds.prf
@@ -1,92 +1,37 @@
-# fixExclusiveOutputDirs(1config, 2config)
-# Change all output paths that references 2config to have the string 1config in them
-defineTest(fixExclusiveOutputDirs) {
- firstBuild = $$1
- secondBuild = $$2
- count(ARGS, 2, greaterThan):isEqual($$list($$lower($$3)), false):appendFirstBuild = false
- else:appendFirstBuild = true
- isEmpty(QMAKE_DIR_REPLACE):QMAKE_DIR_REPLACE += OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR
- lessThan(firstBuild, $$secondBuild):eval($${firstBuild}_and_$${secondBuild}_target:QMAKE_DIR_REPLACE += DESTDIR)
- else:eval($${secondBuild}_and_$${firstBuild}_target:QMAKE_DIR_REPLACE += DESTDIR)
- for(fix, QMAKE_DIR_REPLACE) {
- isEmpty($$fix)|isEqual($$fix, .) {
- eval($$fix = $${firstBuild})
- } else:contains($$list($$first($$fix)), .*$${secondBuild}.*) {
- eval($$fix ~= s/$${secondBuild}/$${firstBuild}/gi)
- } else:isEqual(appendFirstBuild, true):!contains($$list($$first($$fix)), .*$${firstBuild}.*) {
- contains($$list($${first($$fix)}), .*/$):eval($$fix = $${first($$fix)}$${firstBuild})
- else:eval($$fix = $${first($$fix)}-$${firstBuild})
- }
- export($$fix)
- }
- return(true)
-}
-
-# addExclusiveBuilds(1config, 1name, 2config, 2name)
-# Adds two BUILDS which are exclusive to each other.
defineTest(addExclusiveBuilds) {
- firstBuild = $$1
- firstBuildName = $$2
- secondBuild = $$3
- secondBuildName = $$4
+ lessThan(ARGC, 2): \
+ error("addExclusiveBuilds() requires at least two arguments")
- contains(TEMPLATE, subdirs) {
- eval(sub_$${firstBuildName}.target = $$firstBuild)
- export(sub_$${firstBuildName}.target)
- eval(sub_$${firstBuildName}.CONFIG = recursive)
- export(sub_$${firstBuildName}.CONFIG)
- eval(sub_$${secondBuildName}.target = $$secondBuild)
- export(sub_$${secondBuildName}.target)
- eval(sub_$${secondBuildName}.CONFIG = recursive)
- export(sub_$${secondBuildName}.CONFIG)
- QMAKE_EXTRA_TARGETS += sub_$${firstBuildName} sub_$${secondBuildName}
- export(QMAKE_EXTRA_TARGETS)
- } else:!build_pass {
- first_BUILDS =
- second_BUILDS =
- suffix_BUILDS = Build
+ !$$join(ARGS, _and_):!fix_output_dirs: \
+ return(true)
- isEmpty(BUILDS): BUILDPERMUTATIONS = $$suffix_BUILDS
- else: BUILDPERMUTATIONS = $$BUILDS
+ for(build, ARGS) {
+ isEmpty($${build}.name) {
+ $${build}.name = $$title($$build)
+ export($${build}.name)
+ }
+ isEmpty($${build}.target) {
+ $${build}.target = $$lower($$build)
+ export($${build}.target)
+ }
+ isEmpty($${build}.dir_affix) {
+ $${build}.dir_affix = $$lower($$build)
+ export($${build}.dir_affix)
+ }
- for(permutation, BUILDPERMUTATIONS) {
- permutation ~= s/$${suffix_BUILDS}$//
- isEmpty(permutation): permutationName =
- else: permutationName = -$$permutation
- # Makefile target rule
- eval($${firstBuildName}$${permutation}.target = $${firstBuild}$$lower($${permutationName}))
- export($${firstBuildName}$${permutation}.target)
- # IDE name
- eval($${firstBuildName}$${permutation}.name = $${firstBuildName}$${permutationName})
- export($${firstBuildName}$${permutation}.name)
- # prl import CONFIG option
- eval($${firstBuildName}$${permutation}.PRL_CONFIG = $${firstBuild}$${permutation})
- export($${firstBuildName}$${permutation}.PRL_CONFIG)
- # Individual CONFIG option
- eval($${firstBuildName}$${permutation}.CONFIG = $${firstBuild} $${firstBuildName}Build $$eval($${permutation}.CONFIG))
- export($${firstBuildName}$${permutation}.CONFIG)
+ $${build}.exclusive = $$ARGS
+ export($${build}.exclusive)
- eval($${secondBuildName}$${permutation}.target = $${secondBuild}$$lower($${permutationName}))
- export($${secondBuildName}$${permutation}.target)
- eval($${secondBuildName}$${permutation}.name = $${secondBuildName}$${permutationName})
- export($${secondBuildName}$${permutation}.name)
- eval($${secondBuildName}$${permutation}.PRL_CONFIG = $${secondBuild}$${permutation})
- export($${secondBuildName}$${permutation}.PRL_CONFIG)
- eval($${secondBuildName}$${permutation}.CONFIG = $${secondBuild} $${secondBuildName}Build $$eval($${permutation}.CONFIG))
- export($${secondBuildName}$${permutation}.CONFIG)
+ QMAKE_EXCLUSIVE_BUILDS += $$build
+ }
- first_BUILDS += $${firstBuildName}$${permutation}
- second_BUILDS += $${secondBuildName}$${permutation}
- }
+ CONFIG *= exclusive_builds
+ export(CONFIG)
- # A mutual exclusive block.
- CONFIG($${firstBuild}, $${firstBuild}|$${secondBuild}): BUILDS = $$first_BUILDS $$second_BUILDS
- else: BUILDS = $$second_BUILDS $$first_BUILDS
- export(BUILDS)
- } else {
- eval($${firstBuildName}Build:fixExclusiveOutputDirs($$firstBuild, $$secondBuild, false))
- eval($${secondBuildName}Build:fixExclusiveOutputDirs($$secondBuild, $$firstBuild, false))
- }
+ export(QMAKE_EXCLUSIVE_BUILDS)
return(true)
}
+
+# Default directories to process
+QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR DESTDIR
diff --git a/mkspecs/features/exclusive_builds_post.prf b/mkspecs/features/exclusive_builds_post.prf
new file mode 100644
index 0000000000..936085af0b
--- /dev/null
+++ b/mkspecs/features/exclusive_builds_post.prf
@@ -0,0 +1,160 @@
+
+contains(TEMPLATE, subdirs) {
+ for(build, QMAKE_EXCLUSIVE_BUILDS) {
+ prepareRecursiveTarget($$build)
+ QMAKE_EXTRA_TARGETS += $$build
+ }
+} else {
+ # Recursively combines a list of exclusive builds into combinations
+ # of non-exclusive builds (separated by a ':' character), eg the
+ # list [debug, release, static, shared] will result in the four
+ # combinations [debug:static, debug:shared, release:static,
+ # release:shared].
+ defineReplace(combineExclusiveBuilds) {
+ permutationBuilds = $$1
+ existingBuilds = $$2
+
+ isEmpty(permutationBuilds): \
+ # Exit-condition, no more recursing
+ return($$existingBuilds)
+
+ # Choose the first build of the permutations and use the set of exclusive
+ # builds associated with that build as the list of existing builds. This
+ # partitions the permutations into one set of exclusive builds + the rest
+ # of the unknown permutations.
+ newExistingBuilds = $$eval($$first(permutationBuilds).exclusive)
+ permutationBuilds -= $$newExistingBuilds
+
+ # Recursively compute the combination of these two sets
+ recursiveCombination = $$combineExclusiveBuilds($$permutationBuilds, $$newExistingBuilds)
+
+ isEmpty(existingBuilds): \
+ # No need to combine further
+ return($$recursiveCombination)
+
+ result =
+ for(existingBuild, existingBuilds) {
+ for(combination, recursiveCombination): \
+ result += "$${existingBuild}:$${combination}"
+ }
+ return($$result)
+ }
+
+ buildCombinations = $$combineExclusiveBuilds($$QMAKE_EXCLUSIVE_BUILDS)
+
+ for(combination, buildCombinations) {
+ builds = $$split(combination, :)
+ key =
+ config =
+ target =
+ priority =
+ for(build, builds) {
+ key = $${key}$$eval($${build}.name)
+ config *= $$eval($${build}.CONFIG) $${build} $$eval($${build}.name)Build
+ target += $$eval($${build}.target)
+
+ # If a build has been prioritized through CONFIG we prefer that
+ CONFIG($$build, $$join($${build}.exclusive, |)): \
+ priority += 1
+ }
+
+ $${key}.name = $$key
+ $${key}.target = $$join(target, -)
+ $${key}.CONFIG = $$config
+ $${key}.builds = $$builds
+
+ BUILDS.$$size(priority) += $$key
+
+ # Add makefile targets for each exclusive build that will aggregate all targets
+ # that include the exclusive build. This matches the targets in the SUBDIR files
+ # so that you can recursivly build a single exclusive build.
+ !build_pass:count(builds, 1, >) {
+ for(build, builds) {
+ $${build}.depends += $$eval($${key}.target)
+ QMAKE_EXTRA_TARGETS *= $$build
+ }
+ }
+ }
+
+ BUILDS =
+ priority =
+ for(ever) {
+ # Keep the order in BUILDS matching the priority from CONFIG, so that the first
+ # entry in BUILDS will be the first/default target when not CONFIG(build_all).
+ BUILDS = $$eval(BUILDS.$$size(priority)) $$BUILDS
+ count(BUILDS, $$size(buildCombinations), >=): break()
+ priority += 1
+ }
+
+ build_pass|fix_output_dirs {
+ !build_pass {
+ # The builds are sorted by priority based on the current config
+ # so choosing the first one gives us the most appropriate build.
+ BUILD_PASS = $$first(BUILDS)
+ }
+
+ for(dir, QMAKE_DIR_REPLACE) {
+
+ # Limit builds to ones that should affect the current $$dir
+ builds =
+ for(build, $${BUILD_PASS}.builds) {
+ equals(dir, DESTDIR) {
+ !$$join($${build}.exclusive, _and_)_target: \
+ next()
+ }
+
+ builds += $$build
+ }
+
+ isEmpty(builds): \
+ next()
+
+ affixes =
+ for(build, builds): \
+ affixes += $$eval($${build}.dir_affix)
+ full_dir_affix = $$join(affixes, -)
+
+ isEmpty($$dir)|isEqual($$dir, .) {
+ # Use affix directly
+ $$dir = $$full_dir_affix
+ next()
+ }
+
+ contains(QMAKE_DIR_REPLACE_SANE, $$dir) {
+ # Suffix output dir
+ $$dir = $$clean_path($$eval($$dir)/$$full_dir_affix)
+ } else {
+ # "Compatibility mode" with QTBUG-491
+ for(build, builds) {
+ did_replace = false
+ build_affix = $$eval($${build}.dir_affix)
+ for(exclusive, $${build}.exclusive) {
+ equals(exclusive, $$build): \
+ next()
+
+ exclusive_affix = $$eval($${exclusive}.dir_affix)
+ contains($$dir, .*$${exclusive_affix}.*) {
+ $$dir ~= s/$${exclusive_affix}/$${build_affix}/gi
+ did_replace = true
+ }
+ }
+ $$did_replace: next()
+
+ # Append (as subdir or as suffix)
+ !build_pass {
+ dir_affix = $$eval($${build}.dir_affix)
+ !contains($$dir, .*$${dir_affix}.*) {
+ contains($$dir, .*/$) {
+ # Subdir
+ $$dir = $$eval($$dir)$$dir_affix
+ } else {
+ # Suffix
+ $$dir = $$eval($$dir)-$${dir_affix}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
index b183814e63..c3addf9319 100644
--- a/mkspecs/features/mac/default_post.prf
+++ b/mkspecs/features/mac/default_post.prf
@@ -19,13 +19,10 @@ qt:!isEmpty(QT_CONFIG) {
contains(QT_CONFIG, static):contains(QT_CONFIG, c++11): CONFIG += c++11
}
-isEmpty(_QMAKE_CACHE_) {
- warning("No .qmake.cache is present. This significantly slows down qmake with this makespec.")
- warning("Call 'cache()' in the top-level project file to rectify this problem.")
-} else {
- cache(QMAKE_XCODE_DEVELOPER_PATH)
- cache(QMAKE_XCODE_VERSION)
-}
+cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+cache(QMAKE_XCODE_VERSION, stash)
+
+QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
# Ensure that we process sdk.prf first, as it will update QMAKE_CXX
# and friends that other features/extra compilers may depend on.
diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
index c0596d5ef0..c031403930 100644
--- a/mkspecs/features/mac/default_pre.prf
+++ b/mkspecs/features/mac/default_pre.prf
@@ -24,8 +24,16 @@ isEmpty(QMAKE_XCODE_VERSION) {
unset(xcode_version)
}
-# These two variables are used by the xcode_dynamic_library_suffix
+isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
+ QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
+ exists($$QMAKE_XCODE_PREFERENCES_FILE): \
+ QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
+
+ !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
+ cache(QMAKE_TARGET_BUNDLE_PREFIX)
+}
+
+# This variable is used by the xcode_dynamic_library_suffix
# feature, which allows Xcode to choose the Qt libraries to link to
# at build time, depending on the current Xcode SDK and configuration.
-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
index 788fa5b362..5b5186a14b 100644
--- a/mkspecs/features/mac/sdk.prf
+++ b/mkspecs/features/mac/sdk.prf
@@ -8,7 +8,7 @@ contains(QMAKE_MAC_SDK, .*/.*): \
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) {
QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null")
isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'")
- !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set, QMAKE_MAC_SDK_PATH)
+ cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set stash, QMAKE_MAC_SDK_PATH)
} else {
QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)
}
@@ -41,7 +41,7 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_
isEmpty(sysrooted): next()
$$tool = $$sysrooted $$member(value, 1, -1)
- !isEmpty(_QMAKE_CACHE_): cache($$tool_variable, set, $$tool)
+ cache($$tool_variable, set stash, $$tool)
}
isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
@@ -52,7 +52,7 @@ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) {
"sed 's/.*Value: \\(.*\\)/\\1/'")
isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'")
- !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set, QMAKE_MAC_PLATFORM_NAME)
+ cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set stash, QMAKE_MAC_PLATFORM_NAME)
} else {
QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name)
}
diff --git a/mkspecs/features/qfeatures.prf b/mkspecs/features/qfeatures.prf
new file mode 100644
index 0000000000..15ef5c5be0
--- /dev/null
+++ b/mkspecs/features/qfeatures.prf
@@ -0,0 +1,4 @@
+# This file needs to be loaded explicitly, as the evaluation is relatively
+# expensive, and not many projects will actually need it.
+QMAKE_QT_FEATURES = $$[QT_HOST_DATA/get]/mkspecs/qfeatures.pri
+include($$QMAKE_QT_FEATURES) | error("Failed to load $$QMAKE_QT_FEATURES")
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 04375d4ce1..83a8778654 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -62,7 +62,7 @@ qaxserver {
unset(using_privates)
qtAddModules(QT, LIBS)
qtAddModules(QT_PRIVATE, LIBS_PRIVATE)
-!isEmpty(using_privates):!auto_use_privates:!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
+!isEmpty(using_privates):!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
message("This project is using private headers and will therefore be tied to this specific Qt module build version.")
message("Running this project against other versions of the Qt modules may crash at any arbitrary point.")
message("This is not a bug, but a result of using Qt internals. You have been warned!")
@@ -74,13 +74,16 @@ wince*:static:gui {
}
# static builds: link qml import plugins into the app.
-if(contains(QT, qml)|contains(QT_PRIVATE, qml)): \
+qt_module_deps = $$QT $$QT_PRIVATE
+qt_module_deps = $$replace(qt_module_deps, -private$, _private)
+qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
+contains(qt_module_deps, qml): \
contains(QT_CONFIG, static):contains(TEMPLATE, .*app):!host_build:!no_import_scan {
# run qmlimportscanner
qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner)
for (MODULE, QT_MODULES) {
PATH = $$eval(QT.$${MODULE}.qml)
- !isEmpty(PATH): QMLPATHS += $$PATH
+ !isEmpty(PATH):exists($$PATH): QMLPATHS += $$PATH
}
QMLPATHS = $$unique(QMLPATHS)
for (QMLPATH, QMLPATHS): \
@@ -96,7 +99,7 @@ if(contains(QT, qml)|contains(QT_PRIVATE, qml)): \
for (key, IMPORTS._KEYS_): {
PATH = $$eval(IMPORTS.$${key}.path)
PLUGIN = $$eval(IMPORTS.$${key}.plugin)
- !isEmpty(PATH):!isEmpty(PLUGIN): LIBS *= -L$$PATH -l$$PLUGIN
+ !isEmpty(PATH):!isEmpty(PLUGIN): LIBS *= -L$$PATH -l$${PLUGIN}$$qtPlatformTargetSuffix()
}
# create qml_plugin_import.cpp
@@ -124,33 +127,37 @@ if(contains(QT, qml)|contains(QT_PRIVATE, qml)): \
QMAKE_CLEAN += $$QML_IMPORT_CPP
# copy qml files. this part is platform spesific.
- macx {
- # copy to Contents/Resources in the bundle.
- QmlImports.path = Contents/Resources/
- QmlImports.files *= $$QMLPATHS
- QMAKE_BUNDLE_DATA += QmlImports
+ mac {
+ osx {
+ # Note: user can override QMAKE_BUNDLE_QML from pro file to change target bundle path
+ isEmpty(QMAKE_QML_BUNDLE_PATH):QMAKE_QML_BUNDLE_PATH = "Resources/qt_qml"
+ qmlTargetPath = $$OUT_PWD/$${TARGET}.app/Contents/$$QMAKE_QML_BUNDLE_PATH
+ qtconfTargetPath = $$OUT_PWD/$${TARGET}.app/Contents/Resources/qt.conf
+ } else {
+ # iOS: flat bundle layout (no Contents/Resources)
+ isEmpty(QMAKE_QML_BUNDLE_PATH):QMAKE_QML_BUNDLE_PATH = "qt_qml"
+ qmlTargetPath = $CODESIGNING_FOLDER_PATH/$$QMAKE_QML_BUNDLE_PATH
+ qtconfTargetPath = $CODESIGNING_FOLDER_PATH/qt.conf
+ }
- # place qt.conf in Contents/Resources in the app bundle
- QT_CONF_CONTENTS = \
- "[Paths]" \
- "Imports = Resources/qml" \
- "Qml2Imports = Resources/qml"
- QT_CONF = "$$OUT_PWD/$${TARGET}.app/Contents/Resources/qt.conf"
- write_file($$QT_CONF, QT_CONF_CONTENTS)|error("Aborting.")
- } else: ios {
- # flat bundle layout (no Contents/Resources)
- QmlImports.files *= $$QMLPATHS
- QMAKE_BUNDLE_DATA += QmlImports
-
- # write qt.conf to OUT_PWD and make xcode copy it via QMAKE_BUNDLE_DATA
+ # set import path in qt.conf to point to the bundeled qml:
QT_CONF_CONTENTS = \
"[Paths]" \
- "Imports = qml" \
- "Qml2Imports = qml"
- QT_CONF = "$$OUT_PWD/qt.conf"
- write_file($$QT_CONF, QT_CONF_CONTENTS)|error("Aborting.")
- QtConf.files = $$QT_CONF
- QMAKE_BUNDLE_DATA += QtConf
+ "Imports = $$QMAKE_QML_BUNDLE_PATH" \
+ "Qml2Imports = $$QMAKE_QML_BUNDLE_PATH"
+ write_file("$$OUT_PWD/qt.conf", QT_CONF_CONTENTS)|error("Aborting.")
+
+ # write qt.conf and copy each qml import dir into the bundle.
+ # But strip away archives and other files that are not needed:
+ !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
+ QMAKE_POST_LINK += \
+ "cp $$OUT_PWD/qt.conf $$qtconfTargetPath; " \
+ "test -d $$qmlTargetPath && rm -r $$qmlTargetPath; " \
+ "mkdir -p $$qmlTargetPath && " \
+ "for p in $$QMLPATHS; do" \
+ "rsync -r --exclude='*.a' --exclude='*.prl' --exclude='*.qmltypes' "
+ macx-xcode: QMAKE_POST_LINK += "$p/ $$qmlTargetPath; done"
+ else: QMAKE_POST_LINK += "\$\$p/ $$qmlTargetPath; done"
}
}
}
diff --git a/mkspecs/features/qt_android_deps.prf b/mkspecs/features/qt_android_deps.prf
index 96337da9de..7ec7bad047 100644
--- a/mkspecs/features/qt_android_deps.prf
+++ b/mkspecs/features/qt_android_deps.prf
@@ -64,6 +64,19 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml
}
}
+ !isEmpty(ANDROID_PERMISSIONS) {
+ for (ANDROID_PERMISSION, ANDROID_PERMISSIONS) {
+ FILE_CONTENT += "<permission name=\"$$ANDROID_PERMISSION\" />"
+ }
+ }
+
+ !isEmpty(ANDROID_FEATURES) {
+ for (ANDROID_FEATURE, ANDROID_FEATURES) {
+ FILE_CONTENT += "<feature name=\"$$ANDROID_FEATURE\" />"
+ }
+ }
+
+
!isEmpty(FILE_CONTENT) {
FILE_CONTENT = "<rules><dependencies><lib name=\"$$TARGET\"><depends>" $$FILE_CONTENT "</depends></lib></dependencies></rules>"
write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.")
diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf
index a29e09cbc5..faa7a44f67 100644
--- a/mkspecs/features/qt_build_config.prf
+++ b/mkspecs/features/qt_build_config.prf
@@ -20,6 +20,14 @@
debug(1, "Not loading qmodule.pri twice")
}
+PRECOMPILED_DIR = .pch
+OBJECTS_DIR = .obj
+MOC_DIR = .moc
+RCC_DIR = .rcc
+UI_DIR = .uic
+
+QMAKE_DIR_REPLACE_SANE = PRECOMPILED_DIR OBJECTS_DIR MOC_DIR RCC_DIR UI_DIR
+
# force_independent can be set externally. prefix_build not.
!exists($$[QT_HOST_DATA]/.qmake.cache): \
CONFIG += prefix_build force_independent
diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
index 746e2878a7..22d66e8907 100644
--- a/mkspecs/features/qt_common.prf
+++ b/mkspecs/features/qt_common.prf
@@ -9,6 +9,9 @@
# We mean it.
#
+QMAKE_DIR_REPLACE_SANE += DESTDIR
+CONFIG -= debug_and_release_target
+
contains(QT_CONFIG, c++11): CONFIG += c++11
contains(TEMPLATE, .*lib) {
# module and plugins
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index f1f7c00b9e..1dacfedd02 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -1,11 +1,16 @@
defineReplace(qtPlatformTargetSuffix) {
+ ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos): \
+ suffix = _iphonesimulator
+ else: \
+ suffix =
+
CONFIG(debug, debug|release) {
!debug_and_release|build_pass {
- mac:return(_debug)
- win32:return(d)
+ mac: return($${suffix}_debug)
+ win32: return($${suffix}d)
}
}
- return()
+ return($$suffix)
}
defineReplace(qtLibraryTarget) {
@@ -28,7 +33,7 @@ defineTest(qtAddLibrary) {
# Reverse-engineer the module name from the library name.
for(var, QT_MODULES) {
isEqual(QT.$${var}.name, $$1) {
- qtAddModule($$var, , LIBS)
+ qtAddModule($$var, LIBS)
return(true)
}
}
@@ -48,12 +53,12 @@ defineTest(qtProcessModuleFlags) {
# qt module
defineTest(qtHaveModule) {
- !isEmpty(QT.$${1}.name): \
+ !isEmpty(QT.$$replace(1, -, _).name): \
return(true)
return(false)
}
-# qt module, UsePrivate flag, libs variable
+# qt module, libs variable
defineTest(qtAddModule) {
MODULE_NAME = $$eval(QT.$${1}.name)
MODULE_INCLUDES = $$eval(QT.$${1}.includes)
@@ -61,8 +66,10 @@ defineTest(qtAddModule) {
MODULE_CONFIG = $$eval(QT.$${1}.module_config)
MODULE_MAJOR_VERSION = $$eval(QT.$${1}.MAJOR_VERSION)
- contains(MODULE_CONFIG, internal_module):!if(auto_use_privates|isEqual(2, UsePrivate)): \
- error("Module $$1 has no public API.")
+ contains(MODULE_CONFIG, internal_module) {
+ using_privates = true
+ export(using_privates)
+ }
qtProcessModuleFlags(CONFIG, QT.$${1}.CONFIG)
qtProcessModuleFlags(DEFINES, QT.$${1}.DEFINES)
@@ -77,80 +84,75 @@ defineTest(qtAddModule) {
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
INCLUDEPATH *= $$FRAMEWORK_INCLUDE
}
- auto_use_privates|isEqual(2, UsePrivate): \
+ contains(MODULE_CONFIG, internal_module): \
INCLUDEPATH += \
$$FRAMEWORK_INCLUDE/$$eval(QT.$${1}.VERSION) \
$$FRAMEWORK_INCLUDE/$$eval(QT.$${1}.VERSION)/$$MODULE_NAME
QMAKE_FRAMEWORKPATH *= $${MODULE_LIBS}
- LINKAGE += -framework $${MODULE_NAME}$${QT_LIBINFIX}
+ export(QMAKE_FRAMEWORKPATH)
+ !contains(MODULE_CONFIG, no_link): \
+ LINKAGE += -framework $${MODULE_NAME}$${QT_LIBINFIX}
} else {
INCLUDEPATH *= $$MODULE_INCLUDES
- auto_use_privates|isEqual(2, UsePrivate): \
- INCLUDEPATH += $$eval(QT.$${1}.private_includes)
}
+ export(INCLUDEPATH)
- # Re-insert the major version in the library name (cf qtLibraryTarget above)
- # unless it's a framework build
- !mac|!contains(MODULE_CONFIG, lib_bundle): \
- MODULE_NAME ~= s,^Qt,Qt$$MODULE_MAJOR_VERSION,
-
- win32 {
- # Make sure the version number isn't appended again to the lib name
- ver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE
- dver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE
- $$ver_var = 0
- $$dver_var = 0
- export($$ver_var)
- export($$dver_var)
- }
+ # Only link to this module if a libs directory is set, else this is just a module
+ # to give access to sources or include files, and not for linking.
+ !isEmpty(MODULE_LIBS):!contains(MODULE_CONFIG, no_link) {
+
+ # Re-insert the major version in the library name (cf qtLibraryTarget above)
+ # unless it's a framework build
+ !mac|!contains(MODULE_CONFIG, lib_bundle): \
+ MODULE_NAME ~= s,^Qt,Qt$$MODULE_MAJOR_VERSION,
+
+ win32 {
+ # Make sure the version number isn't appended again to the lib name
+ ver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE
+ dver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE
+ $$ver_var = 0
+ $$dver_var = 0
+ export($$ver_var)
+ export($$dver_var)
+ }
- isEmpty(LINKAGE) {
- !isEmpty(MODULE_LIBS_ADD): LINKAGE = -L$$MODULE_LIBS_ADD
- lib = $${MODULE_NAME}$${QT_LIBINFIX}$$qtPlatformTargetSuffix()
- LINKAGE += -l$$lib
+ isEmpty(LINKAGE) {
+ !isEmpty(MODULE_LIBS_ADD): \
+ LINKAGE = -L$$MODULE_LIBS_ADD
+ lib = $${MODULE_NAME}$${QT_LIBINFIX}$$qtPlatformTargetSuffix()
+ LINKAGE += -l$$lib
- contains(QT_CONFIG, rpath): QMAKE_RPATHDIR *= $$eval(QT.$${1}.rpath)
+ contains(QT_CONFIG, rpath) {
+ QMAKE_RPATHDIR *= $$eval(QT.$${1}.rpath)
+ export(QMAKE_RPATHDIR)
+ }
+
+ contains(MODULE_CONFIG, staticlib) {
+ PRE_TARGETDEPS *= $$MODULE_LIBS/$${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB}
+ export(PRE_TARGETDEPS)
+ }
+ }
+
+ $$2 += $$LINKAGE
+ export($$2)
- contains(MODULE_CONFIG, staticlib): \
- PRE_TARGETDEPS *= $$MODULE_LIBS/$${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB}
- }
- # Only link to this module if a libs directory is set, else this is just a module
- # to give access to sources or include files, and not for linking.
- !isEmpty(MODULE_LIBS) {
!isEmpty(QMAKE_LSB) {
- !isEmpty(MODULE_LIBS_ADD): QMAKE_LFLAGS *= --lsb-libpath=$$MODULE_LIBS_ADD
- QMAKE_LIBDIR *= /opt/lsb/lib
+ !isEmpty(MODULE_LIBS_ADD): \
+ QMAKE_LFLAGS *= --lsb-libpath=$$MODULE_LIBS_ADD
QMAKE_LFLAGS *= --lsb-shared-libs=$${MODULE_NAME}$${QT_LIBINFIX}
+ QMAKE_LIBDIR *= /opt/lsb/lib
+ export(QMAKE_LFLAGS)
+ export(QMAKE_LIBDIR)
}
- $$3 += $$LINKAGE
}
- export($$3)
- export(INCLUDEPATH)
- export(QMAKE_FRAMEWORKPATH)
- export(QMAKE_LFLAGS)
- export(QMAKE_LIBDIR)
- export(QMAKE_RPATHDIR)
- export(QMAKE_RPATHLINKDIR)
- export(PRE_TARGETDEPS)
}
# qt variable, libs variable
defineTest(qtAddModules) {
- # Figure out from which modules we're wanting to use the private headers
- NEWQT =
- for(QTLIB, $$1) {
- QTLIBRAW = $$replace(QTLIB, -private$, )
- !isEqual(QTLIBRAW, $$QTLIB) {
- want_var = QT.$${QTLIBRAW}.want_private
- $$want_var = UsePrivate
- using_privates = true
- NEWQT += $$eval(QT.$${QTLIBRAW}.private_depends)
- }
- NEWQT += $$QTLIBRAW
- contains(QT.$${QTLIBRAW}.CONFIG, auto_use_privates): CONFIG += auto_use_privates
- }
+ # qmake variables cannot contain dashes, so normalize the names first
+ $$1 = $$replace($$1, -private$, _private)
# Topological resolution of modules based on their QT.<module>.depends variable
- $$1 = $$resolve_depends(NEWQT, "QT.")
+ $$1 = $$resolve_depends($$1, "QT.")
# Finally actually add the modules
unset(BAD_QT)
for(QTLIB, $$1) {
@@ -165,11 +167,9 @@ defineTest(qtAddModules) {
next()
}
- qtAddModule($$QTLIB, $$eval(QT.$${QTLIB}.want_private), $$2)
+ qtAddModule($$QTLIB, $$2)
}
- !isEmpty(BAD_QT):error("Unknown module(s) in $$1: $$BAD_QT")
-
- export(using_privates)
+ !isEmpty(BAD_QT):error("Unknown module(s) in $$1: $$replace(BAD_QT, _private$, -private)")
}
defineTest(qtAddRpathLink) {
@@ -178,7 +178,7 @@ defineTest(qtAddRpathLink) {
# This means that paths of direct dependencies (QT & QT_PRIVATE)
# don't need to appear here. However, their private dependencies'
# paths OTOH need to be put there.
- pubqt = $$replace(1, -private$, )
+ pubqt = $$replace(1, -private$, _private)
pubdep = $$resolve_depends(pubqt, "QT.")
privdep = $$resolve_depends(pubqt, "QT.", ".depends" ".private_depends" ".run_depends")
privdep -= $$pubdep
@@ -246,7 +246,7 @@ defineTest(qtAddToolEnv) {
# target variable, dependency var name, [non-empty: prepare for system(), not make]
defineTest(qtAddTargetEnv) {
- deps = $$replace($$2, -private$, )
+ deps = $$replace($$2, -private$, _private)
deps = $$resolve_depends(deps, "QT.", ".depends" ".private_depends" ".run_depends")
!isEmpty(deps) {
for(dep, deps) {
diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf
index e82b499009..7cacca9935 100644
--- a/mkspecs/features/qt_installs.prf
+++ b/mkspecs/features/qt_installs.prf
@@ -50,7 +50,12 @@ qt_install_module {
pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
pritarget.files = $$MODULE_PRI
INSTALLS += pritarget
- } else {
+ } else: isEmpty(MODULE_PRIVATE_PRI) {
warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
}
+ !isEmpty(MODULE_PRIVATE_PRI) {
+ privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
+ privpritarget.files = $$MODULE_PRIVATE_PRI
+ INSTALLS += privpritarget
+ }
}
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index b614112fd7..5068f7028f 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -44,7 +44,10 @@ ucmodule = $$upper($$MODULE)
isEmpty(MODULE_INCNAME): MODULE_INCNAME = $$TARGET
-MODULE_DEPENDS = $$replace(QT, -private$, )
+internal_module: \
+ MODULE_DEPENDS = $$replace(QT, -private$, _private)
+else: \
+ MODULE_DEPENDS = $$replace(QT, -private$, )
MODULE_DEPENDS = $$unique(MODULE_DEPENDS)
contains(TARGET, QtAddOn.*): \
@@ -55,14 +58,14 @@ MODULE_DEFINES = $$MODULE_DEFINE $$MODULE_DEFINES
load(qt_module_pris)
-INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}.private_includes)
+INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.includes)
!no_module_headers: load(qt_module_headers)
#other
TEMPLATE = lib
-DESTDIR = $$eval(QT.$${MODULE}.libs)
-win32:!wince*:!prefix_build: DLLDESTDIR = $$eval(QT.$${MODULE}.bins)
+DESTDIR = $$eval(QT.$${MODULE_ID}.libs)
+win32:!wince*:!prefix_build: DLLDESTDIR = $$eval(QT.$${MODULE_ID}.bins)
CONFIG += qmake_cache target_qt
@@ -92,7 +95,7 @@ mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) {
#QMAKE_FRAMEWORK_VERSION = 4.0
CONFIG += lib_bundle sliced_bundle qt_framework
CONFIG -= qt_install_headers #no need to install these as well
- !debug_and_release|if(build_all:CONFIG(release, debug|release)) {
+ !debug_and_release|!build_all|CONFIG(release, debug|release) {
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
FRAMEWORK_HEADERS.path = Headers
diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf
index 90e5288524..900ade9b6e 100644
--- a/mkspecs/features/qt_module_pris.prf
+++ b/mkspecs/features/qt_module_pris.prf
@@ -19,11 +19,25 @@ load(qt_build_paths)
CONFIG += split_incpath
force_independent|split_incpath: \
CONFIG += need_fwd_pri
-MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri
+mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
need_fwd_pri: \
- MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri
+ mod_inst_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst
else: \
- MODULE_PRI = $$MODULE_FWD_PRI
+ mod_inst_pfx = $$mod_work_pfx
+!internal_module {
+ MODULE_ID = $$MODULE
+ MODULE_PRIVATE_PRI = $$mod_inst_pfx/qt_lib_$${MODULE}_private.pri
+ mods_to_load = $$MODULE $${MODULE}_private
+} else {
+ MODULE_ID = $${MODULE}_private
+ mods_to_load = $${MODULE}_private
+}
+need_fwd_pri: \
+ pris_to_load = $$MODULE_ID
+else: \
+ pris_to_load = $$mods_to_load
+MODULE_PRI = $$mod_inst_pfx/qt_lib_$${MODULE_ID}.pri
+MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
!build_pass {
@@ -34,20 +48,14 @@ else: \
module_libs = "\$\$QT_MODULE_LIB_BASE"
unix:!static {
host_build: \
- module_rpath = "QT.$${MODULE}.rpath = $$[QT_HOST_LIBS]"
+ module_rpath = "QT.$${MODULE_ID}.rpath = $$[QT_HOST_LIBS]"
else: \
- module_rpath = "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]"
+ module_rpath = "QT.$${MODULE_ID}.rpath = $$[QT_INSTALL_LIBS/raw]"
} else {
module_rpath =
}
- !isEmpty(QT_FOR_PRIVATE) {
- contains(QT_FOR_PRIVATE, .*-private$):error("QT_FOR_PRIVATE may not contain *-private.")
- module_privdep = "QT.$${MODULE}.private_depends = $$QT_FOR_PRIVATE"
- } else {
- module_privdep =
- }
!isEmpty(QT_PRIVATE): \
- module_rundep = "QT.$${MODULE}.run_depends = $$unique($$list($$replace(QT_PRIVATE, -private$, )))"
+ module_rundep = "QT.$${MODULE_ID}.run_depends = $$replace(QT_PRIVATE, -private$, _private)"
else: \
module_rundep =
static: \
@@ -58,10 +66,8 @@ else: \
module_build_type =
internal_module: \
module_build_type += internal_module
- !isEmpty(module_build_type): \
- module_build_type = "QT.$${MODULE}.module_config = $$module_build_type"
!isEmpty(MODULE_CONFIG): \
- module_config = "QT.$${MODULE}.CONFIG = $$MODULE_CONFIG"
+ module_config = "QT.$${MODULE_ID}.CONFIG = $$MODULE_CONFIG"
else: \
module_config =
!no_module_headers:!minimal_syncqt {
@@ -74,46 +80,52 @@ else: \
$$MODULE_BASE_OUTDIR/include)
MODULE_INCLUDES += $$MODULE_AUX_INCLUDES
MODULE_PRIVATE_INCLUDES += $$MODULE_PRIVATE_AUX_INCLUDES
- internal_module {
- MODULE_PRIVATE_INCLUDES = $$MODULE_INCLUDES $$MODULE_PRIVATE_INCLUDES
- MODULE_INCLUDES =
- MODULE_PRIVATE_SHADOW_INCLUDES = $$MODULE_SHADOW_INCLUDES
- MODULE_SHADOW_INCLUDES =
- }
- split_incpath {
- !isEmpty(MODULE_SHADOW_INCLUDES): \
- MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE}.includes += $$MODULE_SHADOW_INCLUDES"
- !isEmpty(MODULE_PRIVATE_SHADOW_INCLUDES): \
- MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE}.private_includes += $$MODULE_PRIVATE_SHADOW_INCLUDES"
- }
+ internal_module: \
+ MODULE_INCLUDES += $$MODULE_PRIVATE_INCLUDES
+ split_incpath: \
+ MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE_ID}.includes += $$MODULE_SHADOW_INCLUDES"
MODULE_PRI_CONT = \
- "QT.$${MODULE}.VERSION = $${VERSION}" \
- "QT.$${MODULE}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \
- "QT.$${MODULE}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \
- "QT.$${MODULE}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \
+ "QT.$${MODULE_ID}.VERSION = $${VERSION}" \
+ "QT.$${MODULE_ID}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \
+ "QT.$${MODULE_ID}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \
+ "QT.$${MODULE_ID}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \
"" \
- "QT.$${MODULE}.name = $$TARGET" \
- "QT.$${MODULE}.libs = $$module_libs" \
+ "QT.$${MODULE_ID}.name = $$TARGET" \
+ "QT.$${MODULE_ID}.libs = $$module_libs" \
$$module_rpath \
- "QT.$${MODULE}.private_includes = $$MODULE_PRIVATE_INCLUDES"
+ "QT.$${MODULE_ID}.includes = $$MODULE_INCLUDES"
!host_build: MODULE_PRI_CONT += \
- "QT.$${MODULE}.includes = $$MODULE_INCLUDES" \
- "QT.$${MODULE}.bins = \$\$QT_MODULE_BIN_BASE" \
- "QT.$${MODULE}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \
- "QT.$${MODULE}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \
- "QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE" \
- "QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE"
+ "QT.$${MODULE_ID}.bins = \$\$QT_MODULE_BIN_BASE" \
+ "QT.$${MODULE_ID}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \
+ "QT.$${MODULE_ID}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \
+ "QT.$${MODULE_ID}.imports = \$\$QT_MODULE_IMPORT_BASE" \
+ "QT.$${MODULE_ID}.qml = \$\$QT_MODULE_QML_BASE" \
+ $$join(MODULE_PLUGIN_TYPES, " ", "QT.$${MODULE_ID}.plugin_types = ")
MODULE_PRI_CONT += \
- "QT.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
- $$module_privdep \
+ "QT.$${MODULE_ID}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
$$module_rundep \
- $$module_build_type \
+ "QT.$${MODULE_ID}.module_config =$$join(module_build_type, " ", " ")" \
$$module_config \
- "QT.$${MODULE}.DEFINES = $$MODULE_DEFINES" \ # assume sufficient quoting
+ "QT.$${MODULE_ID}.DEFINES = $$MODULE_DEFINES" \ # assume sufficient quoting
"" \
"QT_MODULES += $$MODULE"
write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
- MODULE_PRI_FILES = $$MODULE_PRI
+ !internal_module {
+ module_build_type += internal_module no_link
+ MODULE_PRIVATE_PRI_CONT = \
+ "QT.$${MODULE}_private.VERSION = $${VERSION}" \
+ "QT.$${MODULE}_private.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \
+ "QT.$${MODULE}_private.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \
+ "QT.$${MODULE}_private.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \
+ "" \
+ "QT.$${MODULE}_private.name = $${TARGET}" \ # Same name as base module
+ "QT.$${MODULE}_private.libs = $$module_libs" \
+ "QT.$${MODULE}_private.includes = $$MODULE_PRIVATE_INCLUDES" \
+ "QT.$${MODULE}_private.depends = $$replace($$list($$MODULE $$QT_FOR_PRIVATE), -private$, _private)" \
+ "QT.$${MODULE}_private.module_config =$$join(module_build_type, " ", " ")"
+ write_file($$MODULE_PRIVATE_PRI, MODULE_PRIVATE_PRI_CONT)|error("Aborting.")
+ }
+ MODULE_PRI_FILES = $$MODULE_PRI $$MODULE_PRIVATE_PRI
need_fwd_pri {
@@ -132,8 +144,10 @@ else: \
"QT_MODULE_HOST_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \
"QT_MODULE_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \
"QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \
- "include($$MODULE_PRI)" \
- $$MODULE_FWD_PRI_CONT_SUFFIX
+ "include($$MODULE_PRI)"
+ !internal_module: MODULE_FWD_PRI_CONT += \
+ "include($$MODULE_PRIVATE_PRI)"
+ MODULE_FWD_PRI_CONT += $$MODULE_FWD_PRI_CONT_SUFFIX
write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
MODULE_PRI_FILES += $$MODULE_FWD_PRI
@@ -155,12 +169,15 @@ else: \
# Then, inject the new module into the current cache state
!contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI): \ # before the actual include()!
cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, MODULE_PRI_FILES)
- include($$MODULE_FWD_PRI)
- for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \
- name depends private_depends module_config CONFIG DEFINES sources \
- includes private_includes bins libs libexecs plugins imports qml \
- rpath_link rpath_link_private \
- )):defined(QT.$${MODULE}.$$var, var):cache(QT.$${MODULE}.$$var, transient)
+ for(pri, pris_to_load): \
+ include($$mod_work_pfx/qt_lib_$${pri}.pri)
+ for(mod, mods_to_load) {
+ for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \
+ name depends module_config CONFIG DEFINES sources \
+ includes bins libs libexecs plugins imports qml \
+ rpath_link \
+ )):defined(QT.$${mod}.$$var, var):cache(QT.$${mod}.$$var, transient)
+ }
cache(QT_MODULES, transient)
} # !build_pass
diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf
index f0f0fe567b..f0864f9e74 100644
--- a/mkspecs/features/qt_tool.prf
+++ b/mkspecs/features/qt_tool.prf
@@ -19,7 +19,7 @@ CONFIG += console
!build_pass:if(!host_build|!force_bootstrap|force_independent) {
isEmpty(MODULE):MODULE = $$TARGET
- !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, )
+ !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, _private)
load(qt_build_paths)
diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf
index 3884598a94..7835fe4f7c 100644
--- a/mkspecs/features/resolve_config.prf
+++ b/mkspecs/features/resolve_config.prf
@@ -22,14 +22,8 @@ CONFIG(static, static|shared) {
contains(TEMPLATE, ".*lib"): CONFIG += dll
}
-static_and_shared {
- !macx-xcode: addExclusiveBuilds(static, Static, shared, Shared)
-} else: fix_output_dirs {
- static: \
- fixExclusiveOutputDirs(static, shared)
- else: \
- fixExclusiveOutputDirs(shared, static)
-}
+!macx-xcode: \
+ addExclusiveBuilds(shared, static)
CONFIG(debug, debug|release): \
CONFIG -= release
@@ -37,14 +31,7 @@ else: \
CONFIG -= debug
!macx-xcode {
- debug_and_release {
- addExclusiveBuilds(debug, Debug, release, Release)
- } else: fix_output_dirs {
- debug: \
- fixExclusiveOutputDirs(debug, release)
- else: \
- fixExclusiveOutputDirs(release, debug)
- }
+ addExclusiveBuilds(debug, release)
} else {
# The Xcode generator always generates project files with
# debug and release configurations, regardless of whether
diff --git a/mkspecs/features/resolve_target.prf b/mkspecs/features/resolve_target.prf
index 22d7722ce3..fe5808940a 100644
--- a/mkspecs/features/resolve_target.prf
+++ b/mkspecs/features/resolve_target.prf
@@ -11,6 +11,8 @@
load(resolve_config)
+exclusive_builds: load(exclusive_builds_post)
+
QMAKE_RESOLVED_TARGET = $$absolute_path($$DESTDIR, $$OUT_PWD)/
win32 {
diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf
index 7876ef1c34..ee5f1f0ea4 100644
--- a/mkspecs/linux-icc/qmake.conf
+++ b/mkspecs/linux-icc/qmake.conf
@@ -13,6 +13,7 @@ QMAKE_LEXFLAGS =
QMAKE_YACC = yacc
QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS =
+QMAKE_CFLAGS_APP = -fPIE
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -w1 -Wall -Wcheck -wd1572,873,2259,2261
QMAKE_CFLAGS_WARN_OFF = -w
@@ -33,6 +34,7 @@ QMAKE_CFLAGS_AVX2 += -xCORE-AVX2
QMAKE_CXX = icpc
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
+QMAKE_CXXFLAGS_APP = $$QMAKE_CFLAGS_APP
QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
@@ -63,6 +65,7 @@ QMAKE_LFLAGS_SONAME = -Wl,-soname,
QMAKE_LFLAGS_THREAD =
QMAKE_LFLAGS_NOUNDEF = -Wl,-z,defs
QMAKE_LFLAGS_RPATH = -Wl,-rpath,
+QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link,
QMAKE_LFLAGS_CXX11 =
QMAKE_LIBS =
diff --git a/mkspecs/macx-clang-32/Info.plist.app b/mkspecs/macx-clang-32/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-clang-32/Info.plist.app
+++ b/mkspecs/macx-clang-32/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-clang/Info.plist.app b/mkspecs/macx-clang/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-clang/Info.plist.app
+++ b/mkspecs/macx-clang/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-g++-32/Info.plist.app b/mkspecs/macx-g++-32/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-g++-32/Info.plist.app
+++ b/mkspecs/macx-g++-32/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-g++/Info.plist.app b/mkspecs/macx-g++/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-g++/Info.plist.app
+++ b/mkspecs/macx-g++/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-g++40/Info.plist.app b/mkspecs/macx-g++40/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-g++40/Info.plist.app
+++ b/mkspecs/macx-g++40/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-g++42/Info.plist.app b/mkspecs/macx-g++42/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-g++42/Info.plist.app
+++ b/mkspecs/macx-g++42/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-icc/Info.plist.app b/mkspecs/macx-icc/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-icc/Info.plist.app
+++ b/mkspecs/macx-icc/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/macx-ios-clang/Info.plist.app b/mkspecs/macx-ios-clang/Info.plist.app
index 91f4b3d07e..5a0a631d7f 100755
--- a/mkspecs/macx-ios-clang/Info.plist.app
+++ b/mkspecs/macx-ios-clang/Info.plist.app
@@ -13,7 +13,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@BUNDLEIDENTIFIER@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleName</key>
diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf
index 0d38c058c9..0a35b1167d 100644
--- a/mkspecs/macx-ios-clang/features/default_post.prf
+++ b/mkspecs/macx-ios-clang/features/default_post.prf
@@ -1,6 +1,21 @@
-equals(TEMPLATE, app) {
+# In case the user sets the SDK manually
+contains(QMAKE_MAC_SDK, ^iphonesimulator.*) {
+ iphonesimulator_and_iphoneos: \
+ error("iOS simulator is handled automatically for iphonesimulator_and_iphoneos")
+
+ CONFIG += iphonesimulator
+}
+
+# Resolve config so we don't need to use CONFIG() later on
+CONFIG(iphonesimulator, iphonesimulator|iphoneos) {
+ CONFIG -= iphoneos
+} else {
+ CONFIG -= iphonesimulator
+ CONFIG += iphoneos
+}
+equals(TEMPLATE, app) {
# If the application uses Qt, it needs to be an application bundle
# to be able to deploy and run on iOS. The only exception to this
# is if you're working with a jailbroken device and can run the
@@ -8,47 +23,150 @@ equals(TEMPLATE, app) {
# use-case we care about, so no need to complicate the logic.
qt: CONFIG *= app_bundle
- # Application bundles require building through Xcode
- app_bundle:!macx-xcode {
- # For Qt applications we want Xcode project files as the generated output,
- # but since qmake doesn't handle the transition between makefiles and Xcode
- # project files (which happens when using subdirs), we create a wrapper
- # makefile that takes care of generating the Xcode project, and allows
- # building by calling out to xcodebuild.
- TEMPLATE = aux
-
- CONFIG =
- SOURCES =
- OBJECTIVE_SOURCES =
- RESOURCES =
- INSTALLS =
- QMAKE_EXTRA_COMPILERS =
- QMAKE_EXTRA_TARGETS =
-
- TARGET_XCODE_PROJECT_DIR = $${TARGET}.xcodeproj
-
- system("cd $$system_quote($$OUT_PWD) && $${QMAKE_QMAKE} $$system_quote($$_PRO_FILE_) -spec macx-xcode")
-
- # We use xcodebuild to do the actual build, but filter out the verbose
- # output that shows all environment variables for each build step.
- xcodebuild_build.commands = "@bash -o pipefail -c 'xcodebuild | grep -v setenv'"
- QMAKE_EXTRA_TARGETS += xcodebuild_build
- all.depends = xcodebuild_build
- QMAKE_EXTRA_TARGETS += all
-
- # We do the same for the clean action
- xcodebuild_clean.commands = "@xcodebuild clean"
- QMAKE_EXTRA_TARGETS += xcodebuild_clean
- clean.depends = xcodebuild_clean
- QMAKE_EXTRA_TARGETS += clean
-
- # And distclean
- xcodebuild_distclean.commands = "$(DEL_FILE) -R $$TARGET_XCODE_PROJECT_DIR"
- xcodebuild_distclean.depends = xcodebuild_clean
- QMAKE_EXTRA_TARGETS += xcodebuild_distclean
- distclean.depends = xcodebuild_distclean
- QMAKE_EXTRA_TARGETS += distclean
+ app_bundle {
+ macx-xcode {
+ # There is no way to genereate Xcode projects that are limited to either
+ # simulator or device builds, so iphonesimulator_and_iphoneos is always
+ # effectivly active, even if the user disabled it explicitly.
+ # The Xcode generator doesn't support multiple BUILDS though (exclusive
+ # builds), so we have to manually set up the simulator suffix.
+ library_suffix_iphonesimulator.name = "$${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING}[sdk=iphonesimulator*]"
+ library_suffix_iphonesimulator.value = "_iphonesimulator$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})"
+ QMAKE_MAC_XCODE_SETTINGS += library_suffix_iphonesimulator
+ CONFIG *= xcode_dynamic_library_suffix
+ } else {
+ # For Qt applications we want Xcode project files as the generated output,
+ # but since qmake doesn't handle the transition between makefiles and Xcode
+ # project files (which happens when using subdirs), we create a wrapper
+ # makefile that takes care of generating the Xcode project, and allows
+ # building by calling out to xcodebuild.
+ TEMPLATE = aux
+
+ SOURCES =
+ OBJECTIVE_SOURCES =
+ RESOURCES =
+ INSTALLS =
+ QMAKE_EXTRA_COMPILERS =
+ QMAKE_EXTRA_TARGETS =
+
+ !build_pass {
+ CONFIG += debug_and_release
+ load(resolve_config)
+
+ CONFIG += iphonesimulator_and_iphoneos
+ iphonesimulator.name = Simulator
+ iphoneos.name = Device
+ addExclusiveBuilds(iphonesimulator, iphoneos)
+
+ load(exclusive_builds_post)
+
+ xcode_distclean.commands = "$(DEL_FILE) -R $${TARGET}.xcodeproj"
+ xcode_distclean.depends = \
+ debug-iphonesimulator-distclean debug-iphoneos-distclean \
+ release-iphonesimulator-distclean release-iphoneos-distclean
+ QMAKE_EXTRA_TARGETS += xcode_distclean
+ distclean.depends = xcode_distclean
+ QMAKE_EXTRA_TARGETS += distclean
+
+ args =
+ for(arg, QMAKE_ARGS): \
+ args += $$system_quote($$arg)
+ system("cd $$system_quote($$OUT_PWD) && $$QMAKE_QMAKE $$args $$system_quote($$_PRO_FILE_) -spec macx-xcode")
+
+ } else {
+ load(resolve_config)
+
+ iphonesimulator: \
+ sdk = iphonesimulator
+ else: \
+ sdk = iphoneos
+
+ debug: \
+ cfg = debug
+ else: \
+ cfg = release
+
+ for(action, $$list(build install clean)) {
+ equals(action, build) {
+ action_target_suffix =
+ action_target = all
+ } else {
+ action_target_suffix = -$$action
+ action_target = $$action
+ }
+
+ target = $${sdk}-$${cfg}$${action_target_suffix}
+
+ $${target}.commands = "@bash -o pipefail -c 'xcodebuild $$action -sdk $$sdk -configuration $$title($$cfg) | grep -v setenv'"
+ QMAKE_EXTRA_TARGETS += $$target
+
+ $${action_target}.depends += $$target
+ QMAKE_EXTRA_TARGETS *= $${action_target}
+ }
+
+ xcode_build_dir_distclean.commands = "$(DEL_FILE) -R $$title($$cfg)-$${sdk}"
+ xcode_build_dir_distclean.depends = clean
+ QMAKE_EXTRA_TARGETS += xcode_build_dir_distclean
+ distclean.depends = xcode_build_dir_distclean
+ QMAKE_EXTRA_TARGETS += distclean
+ }
+
+ CONFIG =
+ }
+ }
+} else: equals(TEMPLATE, lib) {
+ iphonesimulator.name = Simulator
+ iphoneos.name = Device
+ addExclusiveBuilds(iphonesimulator, iphoneos)
+
+ iphonesimulator_and_iphoneos:iphonesimulator {
+ QT_ARCH = i386
+ QMAKE_MAC_SDK ~= s,^iphoneos,iphonesimulator,
+
+ # Since the CPU feature detection done by configure is limited to one
+ # target at the moment, we disable SIMD support for simulator.
+ CONFIG -= simd
}
+} else: equals(TEMPLATE, subdirs) {
+ # Prevent recursion into host_builds
+ for(subdir, SUBDIRS) {
+ contains($${subdir}.CONFIG, host_build) {
+ $${subdir}.CONFIG += no_iphoneos_target no_iphonesimulator_target
+
+ # Other targets which we do want to recurse into may depend on this target,
+ # for example corelib depends on moc, rcc, bootstrap, etc, and other libs
+ # may depend on host-tools that are needed to build the lib, so we resolve
+ # the final target name and redirect it to the base target, so that the
+ # dependency chain is not broken for the other targets.
+
+ !isEmpty($${subdir}.target) {
+ target = $$eval($${subdir}.target)
+ } else {
+ !isEmpty($${subdir}.file): \
+ file = $$eval($${subdir}.file)
+ else: !isEmpty($${subdir}.subdir): \
+ file = $$eval($${subdir}.subdir)
+ else: \
+ file = $$subdir
+
+ target = sub-$$file
+ }
+
+ target ~= s,[^a-zA-Z0-9_],-,
+
+ $${target}-iphonesimulator.depends = $$target
+ $${target}-iphoneos.depends = $$target
+ QMAKE_EXTRA_TARGETS += $${target}-iphonesimulator $${target}-iphoneos
+ }
+ }
+
+ prepareRecursiveTarget(iphonesimulator)
+ prepareRecursiveTarget(iphoneos)
+ QMAKE_EXTRA_TARGETS += iphonesimulator iphoneos
+
+} else: equals(TEMPLATE, aux) {
+ # Dummy targets for the 'aux' TEMPLATE, so we can always recurse
+ QMAKE_EXTRA_TARGETS *= iphonesimulator iphoneos
}
macx-xcode {
@@ -57,15 +175,21 @@ macx-xcode {
QMAKE_MAC_XCODE_SETTINGS += ios_device_family
}
-# Be more specific about which architecture we're targeting
-equals(QT_ARCH, arm): \
- actual_archs = $$QMAKE_IOS_DEVICE_ARCHS
-else: \
- actual_archs = $$QMAKE_IOS_SIMULATOR_ARCHS
-
macx-xcode {
- QMAKE_XCODE_ARCHS = $$actual_archs
+ arch_iphoneos.name = "ARCHS[sdk=iphoneos*]"
+ arch_iphoneos.value = $$QMAKE_IOS_DEVICE_ARCHS
+ arch_iphonesimulator.name = "ARCHS[sdk=iphonesimulator*]"
+ arch_iphonesimulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS
+
+ QMAKE_MAC_XCODE_SETTINGS += arch_iphoneos arch_iphonesimulator
+ unset(QMAKE_XCODE_ARCHS)
} else {
+# Be more specific about which architecture we're targeting
+ equals(QT_ARCH, arm): \
+ actual_archs = $$QMAKE_IOS_DEVICE_ARCHS
+ else: \
+ actual_archs = $$QMAKE_IOS_SIMULATOR_ARCHS
+
for(arch, actual_archs): \
arch_flags += -arch $$arch
diff --git a/mkspecs/macx-ios-clang/features/default_pre.prf b/mkspecs/macx-ios-clang/features/default_pre.prf
index b37f67495c..3501f5eae0 100644
--- a/mkspecs/macx-ios-clang/features/default_pre.prf
+++ b/mkspecs/macx-ios-clang/features/default_pre.prf
@@ -1,6 +1,10 @@
load(default_pre)
+# In case Qt was built for a specific SDK
+!iphonesimulator_and_iphoneos:contains(QMAKE_MAC_SDK, ^iphonesimulator.*): \
+ CONFIG += iphonesimulator
+
# Check for supported Xcode versions
lessThan(QMAKE_XCODE_VERSION, "4.3"): \
error("This mkspec requires Xcode 4.3 or later")
diff --git a/mkspecs/macx-ios-clang/features/qt.prf b/mkspecs/macx-ios-clang/features/qt.prf
index 2897c62819..9202a70a5a 100644
--- a/mkspecs/macx-ios-clang/features/qt.prf
+++ b/mkspecs/macx-ios-clang/features/qt.prf
@@ -31,14 +31,19 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) {
# able to add symbolic breakpoints for 'main', not caring that the symbol is actually
# called 'qt_main' now.
- isEmpty(OBJECTS_DIR): \
- OBJECTS_DIR = .
+ macx-xcode {
+ objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}/${CURRENT_ARCH}"
+ } else {
+ objects_dir = $$OBJECTS_DIR
+ isEmpty(objects_dir): \
+ objects_dir = .
+ }
!isEmpty(QMAKE_PRE_LINK): \
QMAKE_PRE_LINK += ";"
QMAKE_PRE_LINK += \
- "for f in $(find $${OBJECTS_DIR} -name '*.o'); do" \
+ "for f in $(find $${objects_dir} -name '*.o'); do" \
"(nm $f | grep -q 'T _main' && cp $f $f.original" \
"&& ld -r -alias _main _qt_main -unexported_symbol _main $f.original -o $f)" \
"|| true" \
diff --git a/mkspecs/macx-llvm/Info.plist.app b/mkspecs/macx-llvm/Info.plist.app
index 187a8e0aa4..8e44bd7f60 100644
--- a/mkspecs/macx-llvm/Info.plist.app
+++ b/mkspecs/macx-llvm/Info.plist.app
@@ -15,7 +15,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.@EXECUTABLE@</string>
+ <string>@BUNDLEIDENTIFIER@</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
diff --git a/mkspecs/win32-msvc2005/qplatformdefs.h b/mkspecs/win32-msvc2005/qplatformdefs.h
index c6feb4895d..c7370f1c63 100644
--- a/mkspecs/win32-msvc2005/qplatformdefs.h
+++ b/mkspecs/win32-msvc2005/qplatformdefs.h
@@ -81,6 +81,8 @@
#define QT_STAT_MASK _S_IFMT
#if defined(_S_IFLNK)
# define QT_STAT_LNK _S_IFLNK
+#else
+# define QT_STAT_LNK 0120000
#endif
#define QT_FILENO _fileno
#define QT_OPEN ::_open
diff --git a/mkspecs/win32-msvc2013/qmake.conf b/mkspecs/win32-msvc2013/qmake.conf
index 89d2dd45a4..7ca261f1d4 100644
--- a/mkspecs/win32-msvc2013/qmake.conf
+++ b/mkspecs/win32-msvc2013/qmake.conf
@@ -21,7 +21,7 @@ QMAKE_LEX = flex
QMAKE_LEXFLAGS =
QMAKE_YACC = byacc
QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t
+QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t -FS
QMAKE_CFLAGS_WARN_ON = -W3
QMAKE_CFLAGS_WARN_OFF = -W0
QMAKE_CFLAGS_RELEASE = -O2 -MD
diff --git a/qmake/doc/qmake.qdocconf b/qmake/doc/qmake.qdocconf
index 537c6b3e65..a5bd089a5d 100644
--- a/qmake/doc/qmake.qdocconf
+++ b/qmake/doc/qmake.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QMake
description = QMake Manual
-url = http://qt-project.org/doc/qt-$QT_VER/qmake
+url = http://qt-project.org/doc/qt-$QT_VER
qhp.projects = qmake
@@ -75,4 +75,3 @@ depends += \
qtx11extras \
qtxml \
qtxmlpatterns
-
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index d7624c2dc3..2eaf2cfc54 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -2773,7 +2773,7 @@
Basic test functions are implemented as built-in functions.
- \section2 cache(variablename, [set|add|sub] [transient] [super], [source variablename])
+ \section2 cache(variablename, [set|add|sub] [transient] [super|stash], [source variablename])
This is an internal function that you will typically not need.
diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp
index 8a3a75b7d9..e8e992b694 100644
--- a/qmake/generators/integrity/gbuild.cpp
+++ b/qmake/generators/integrity/gbuild.cpp
@@ -417,6 +417,7 @@ QString GBuildMakefileGenerator::writeOne(QString filename, QString pathtoremove
bool
GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const
{
+ Q_UNUSED(build)
debug_msg(1, "file is %s", file.fileName().toLatin1().constData());
QFileInfo fi(file);
if (fi.filePath().isEmpty())
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 524603aa63..2674f31d03 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -463,12 +463,12 @@ ProjectBuilderSources::files(QMakeProject *project) const
{
QStringList ret = project->values(ProKey(key)).toQStringList();
if(key == "QMAKE_INTERNAL_INCLUDED_FILES") {
+ QStringList newret;
for(int i = 0; i < ret.size(); ++i) {
- QStringList newret;
if(!ret.at(i).endsWith(Option::prf_ext))
newret.append(ret.at(i));
- ret = newret;
}
+ ret = newret;
}
if(key == "SOURCES" && project->first("TEMPLATE") == "app" && !project->isEmpty("ICON"))
ret.append(project->first("ICON").toQString());
@@ -1260,11 +1260,33 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n"
<< "\t\t};\n";
+ {
+ QString aggregate_target_key = keyFor(pbx_dir + "QMAKE_PBX_AGGREGATE_TARGET");
+ project->values("QMAKE_PBX_TARGETS").append(aggregate_target_key);
+ t << "\t\t" << aggregate_target_key << " = {\n"
+ << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES"), SettingsAsList, 4) << ";\n"
+ << "\t\t\t" << writeSettings("dependencies", ProStringList(), SettingsAsList, 4) << ";\n"
+ << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST_TARGET"), SettingsNoQuote) << ";\n"
+ << "\t\t\t" << writeSettings("isa", "PBXAggregateTarget", SettingsNoQuote) << ";\n"
+ << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList) << ";\n"
+ << "\t\t\t" << writeSettings("productName", "Qt Preprocess") << ";\n"
+ << "\t\t\t" << writeSettings("name", "Qt Preprocess") << ";\n"
+ << "\t\t};\n";
+
+ QString aggregate_target_dep_key = keyFor(pbx_dir + "QMAKE_PBX_AGGREGATE_TARGET_DEP");
+ t << "\t\t" << aggregate_target_dep_key << " = {\n"
+ << "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";\n"
+ << "\t\t\t" << writeSettings("target", aggregate_target_key) << ";\n"
+ << "\t\t};\n";
+
+ project->values("QMAKE_PBX_TARGET_DEPENDS").append(aggregate_target_dep_key);
+ }
+
//TARGET
QString target_key = keyFor(pbx_dir + "QMAKE_PBX_TARGET");
- project->values("QMAKE_PBX_TARGETS").append(target_key);
+ project->values("QMAKE_PBX_TARGETS").prepend(target_key);
t << "\t\t" << target_key << " = {\n"
- << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES") + project->values("QMAKE_PBX_BUILDPHASES"),
+ << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_BUILDPHASES"),
SettingsAsList, 4) << ";\n";
t << "\t\t\t" << writeSettings("dependencies", project->values("QMAKE_PBX_TARGET_DEPENDS"), SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("productReference", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) << ";\n";
@@ -1367,7 +1389,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if ((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) ||
(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") &&
project->isActiveConfig("lib_bundle"))) {
- QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString());
+ QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), Option::output_dir, input_dir);
if (plist.isEmpty())
plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
if (exists(plist)) {
@@ -1382,7 +1404,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
} else {
plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString());
}
- plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", QLatin1String("${PRODUCT_NAME:rfc1034identifier}"));
+ QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
+ if (bundlePrefix.isEmpty())
+ bundlePrefix = "com.yourcompany";
+ plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", bundlePrefix + "." + QLatin1String("${PRODUCT_NAME:rfc1034identifier}"));
if (!project->values("VERSION").isEmpty()) {
plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." +
project->first("VER_MIN"));
@@ -1397,6 +1422,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";\n";
}
}
+ } else {
+ warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
}
}
@@ -1770,6 +1797,7 @@ ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where)
QString ProjectBuilderMakefileGenerator::sourceTreeForFile(const QString &where)
{
+ Q_UNUSED(where)
// We always use absolute paths, instead of maintaining the SRCROOT
// build variable and making files relative to that.
return QLatin1String("<absolute>");
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 9ebaf60843..d88c6e447a 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -43,6 +43,9 @@
#include "option.h"
#include "cachekeys.h"
#include "meta.h"
+
+#include <ioutils.h>
+
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
@@ -52,6 +55,7 @@
#include <qbuffer.h>
#include <qsettings.h>
#include <qdatetime.h>
+
#if defined(Q_OS_UNIX)
#include <unistd.h>
#else
@@ -92,7 +96,7 @@ bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const
QString MakefileGenerator::mkdir_p_asstring(const QString &dir, bool escape) const
{
- QString edir = escape ? escapeFilePath(dir) : dir;
+ QString edir = escape ? escapeFilePath(Option::fixPathToTargetOS(dir, false, false)) : dir;
return "@" + makedir.arg(edir);
}
@@ -2261,7 +2265,7 @@ QString MakefileGenerator::buildArgs()
{
QString ret;
- foreach (const QString &arg, Option::qmake_args)
+ foreach (const QString &arg, Option::globals->qmake_args)
ret += " " + escapeFilePath(arg);
return ret;
}
@@ -3270,7 +3274,11 @@ MakefileGenerator::writePkgConfigFile()
}
}
t << "Description: " << desc << endl;
- t << "Version: " << project->first("VERSION") << endl;
+ ProString version = project->first("QMAKE_PKGCONFIG_VERSION");
+ if (version.isEmpty())
+ version = project->first("VERSION");
+ if (!version.isEmpty())
+ t << "Version: " << version << endl;
// libs
t << "Libs: ";
@@ -3341,11 +3349,17 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
if (!match.isEmpty() /*&& match != replace*/)
- ret += " -e \"s," + match + "," + replace + ",g\"";
+ ret += " -e " + shellQuote("s," + match + "," + replace + ",g");
}
ret += " \"" + src + "\" >\"" + dst + "\"";
}
return ret;
}
+QString MakefileGenerator::shellQuote(const QString &str)
+{
+ return isWindowsShell() ? QMakeInternal::IoUtils::shellQuoteWin(str)
+ : QMakeInternal::IoUtils::shellQuoteUnix(str);
+}
+
QT_END_NAMESPACE
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 09327c599c..4b8a96c15f 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -271,6 +271,7 @@ public:
virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; }
virtual bool openOutput(QFile &, const QString &build) const;
bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); }
+ QString shellQuote(const QString &str);
};
inline void MakefileGenerator::setNoIO(bool o)
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 2373059f79..35639a33bf 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -285,13 +285,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << odir << ".deps/%.d: " << pwd << "/%.cpp\n\t";
if(project->isActiveConfig("echo_depend_creation"))
t << "@echo Creating depend for $<\n\t";
- t << mkdir_p_asstring("$(@D)") << "\n\t"
+ t << mkdir_p_asstring("$(@D)", false) << "\n\t"
<< "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n";
t << odir << ".deps/%.d: " << pwd << "/%.c\n\t";
if(project->isActiveConfig("echo_depend_creation"))
t << "@echo Creating depend for $<\n\t";
- t << mkdir_p_asstring("$(@D)") << "\n\t"
+ t << mkdir_p_asstring("$(@D)", false) << "\n\t"
<< "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n";
static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", 0 };
@@ -502,7 +502,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
incr_lflags += var("QMAKE_LFLAGS_RELEASE");
t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)\n\t";
if(!destdir.isEmpty())
- t << mkdir_p_asstring(destdir) << "\n\t";
+ t << mkdir_p_asstring(destdir, false) << "\n\t";
t << "$(LINK) " << incr_lflags << " " << var("QMAKE_LINK_O_FLAG") << incr_target_dir <<
" $(INCREMENTAL_OBJECTS)\n";
//communicated below
@@ -528,7 +528,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< " " << var("POST_TARGETDEPS");
}
if(!destdir.isEmpty())
- t << "\n\t" << mkdir_p_asstring(destdir);
+ t << "\n\t" << mkdir_p_asstring(destdir, false);
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" << var("QMAKE_PRE_LINK");
@@ -685,7 +685,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->first("QMAKE_PKGINFO").isEmpty()) {
ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO"));
- QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents");
+ QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents";
t << pkginfo << ": \n\t";
if(!destdir.isEmpty())
t << mkdir_p_asstring(destdir) << "\n\t";
@@ -697,7 +697,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
bundledFiles << resources;
- QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources");
+ QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources";
t << resources << ": \n\t";
t << mkdir_p_asstring(destdir) << "\n\t";
t << "@touch " << resources << "\n\t\n";
@@ -710,7 +710,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
t << info_plist_out << ": \n\t";
if(!destdir.isEmpty())
- t << mkdir_p_asstring(destdir) << "\n\t";
+ t << mkdir_p_asstring(destdir, false) << "\n\t";
ProStringList commonSedArgs;
if (!project->values("VERSION").isEmpty())
commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" ";
@@ -804,7 +804,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
project->first("OBJECTS_DIR")) + ddir,
Option::output_dir, Option::output_dir));
t << "dist: \n\t"
- << mkdir_p_asstring(ddir_c) << "\n\t"
+ << mkdir_p_asstring(ddir_c, false) << "\n\t"
<< "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && ";
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
@@ -920,7 +920,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
<< destdir << "$(TARGET2) $(TARGETA)\n";
} else {
- t << "\t-$(DEL_FILE) $(TARGET) \n";
+ t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
}
t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n");
{
@@ -1266,6 +1266,8 @@ void UnixMakefileGenerator::init2()
alldeps += path + Option::dir_sep + fileInfo(files[file].toQString()).fileName();
}
}
+ } else {
+ warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
}
}
}
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index a83f8f364b..f5a6e15a7b 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -147,6 +147,7 @@ const char _HeapReserveSize[] = "HeapReserveSize";
const char _IgnoreAllDefaultLibraries[] = "IgnoreAllDefaultLibraries";
const char _IgnoreEmbeddedIDL[] = "IgnoreEmbeddedIDL";
const char _IgnoreImportLibrary[] = "IgnoreImportLibrary";
+const char _ImageHasSafeExceptionHandlers[] = "ImageHasSafeExceptionHandlers";
const char _IgnoreSpecificDefaultLibraries[] = "IgnoreSpecificDefaultLibraries";
const char _IgnoreStandardIncludePath[] = "IgnoreStandardIncludePath";
const char _ImportLibrary[] = "ImportLibrary";
@@ -1494,6 +1495,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool)
<< attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
<< attrTagT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL)
<< attrTagT(_IgnoreImportLibrary, tool.IgnoreImportLibrary)
+ << attrTagT(_ImageHasSafeExceptionHandlers, tool.ImageHasSafeExceptionHandlers)
<< attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreDefaultLibraryNames, ";")
<< attrTagS(_ImportLibrary, tool.ImportLibrary)
<< attrTagS(_KeyContainer, tool.KeyContainer)
@@ -1760,9 +1762,6 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu
else
root = new XTreeNode;
- QString name, extfilter;
- triState parse;
-
for (int i = 0; i < project.SingleProjects.count(); ++i) {
VCFilter filter;
const VCProjectSingleConfig &singleCfg = project.SingleProjects.at(i);
@@ -1792,14 +1791,6 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu
// Merge all files in this filter to root tree
for (int x = 0; x < filter.Files.count(); ++x)
root->addElement(filter.Files.at(x));
-
- // Save filter setting from first filter. Next filters
- // may differ but we cannot handle that. (ex. extfilter)
- if (name.isEmpty()) {
- name = filter.Name;
- extfilter = filter.Filter;
- parse = filter.ParseFiles;
- }
}
if (!root->hasElements())
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index f50b3dd0d0..6d148e41a2 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -113,9 +113,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
qPrintable(variables["QMAKESPEC"].first().toQString()));
return false;
}
- }
-#ifdef Q_OS_WIN
- else if (project->isActiveConfig(QStringLiteral("winrt"))) {
+ } else if (project->isActiveConfig(QStringLiteral("winrt"))) {
QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
QString compiler;
QString compilerArch;
@@ -143,6 +141,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
+ const bool isPhone = project->isActiveConfig(QStringLiteral("winphone"));
+#ifdef Q_OS_WIN
QString regKeyPrefix;
#if !defined(Q_OS_WIN64) && _WIN32_WINNT >= 0x0501
BOOL isWow64;
@@ -160,7 +160,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
- const bool isPhone = project->isActiveConfig(QStringLiteral("winphone"));
regKey = regKeyPrefix
+ (isPhone ? QStringLiteral("Microsoft\\Microsoft SDKs\\WindowsPhone\\v")
: QStringLiteral("Microsoft\\Microsoft SDKs\\Windows\\v"))
@@ -170,6 +169,10 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
fprintf(stderr, "Failed to find the Windows Kit installation directory.\n");
return false;
}
+#else
+ const QString vcInstallDir = "/fake/vc_install_dir";
+ const QString kitDir = "/fake/sdk_install_dir";
+#endif // Q_OS_WIN
QStringList incDirs;
QStringList libDirs;
@@ -209,7 +212,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
t << "\nLIB = " << nmakePathList(libDirs);
t << "\nPATH = " << nmakePathList(binDirs) << '\n';
}
-#endif // Q_OS_WIN
}
writeNmakeParts(t);
return MakefileGenerator::writeMakefile(t);
@@ -251,8 +253,10 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t)
if(targetdir.right(1) != Option::dir_sep)
targetdir += Option::dir_sep;
- if(t == "target" && project->first("TEMPLATE") == "lib") {
- if(project->isActiveConfig("shared") && project->isActiveConfig("debug")) {
+ if (project->isActiveConfig("debug")) {
+ if (t == "dlltarget"
+ || (project->first("TEMPLATE") == "lib"
+ && project->isActiveConfig("shared"))) {
QString pdb_target = getPdbTarget();
pdb_target.remove('"');
QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 09213bec8e..019bb2504d 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -1172,6 +1172,7 @@ VCLinkerTool::VCLinkerTool()
IgnoreAllDefaultLibraries(unset),
IgnoreEmbeddedIDL(unset),
IgnoreImportLibrary(_True),
+ ImageHasSafeExceptionHandlers(unset),
LargeAddressAware(addrAwareDefault),
LinkDLL(unset),
LinkIncremental(linkIncrementalDefault),
@@ -1198,7 +1199,6 @@ VCLinkerTool::VCLinkerTool()
TurnOffAssemblyGeneration(unset),
TypeLibraryResourceID(0),
GenerateManifest(unset),
- GenerateWindowsMetadata(unset),
EnableUAC(unset),
UACUIAccess(unset),
SectionAlignment(-1),
@@ -1206,7 +1206,8 @@ VCLinkerTool::VCLinkerTool()
AllowIsolation(unset),
AssemblyDebug(unset),
CLRUnmanagedCodeCheck(unset),
- DelaySign(unset)
+ DelaySign(unset),
+ GenerateWindowsMetadata(unset)
{
}
@@ -1654,11 +1655,12 @@ bool VCLinkerTool::parseOption(const char* option)
StackCommitSize = both[1].toLongLong();
}
break;
- case 0x75AA4D8: // /SAFESH:{NO}
- {
+ case 0x75AA4D8: // /SAFESEH:{NO}
+ if (config->CompilerVersion >= NET2010)
+ ImageHasSafeExceptionHandlers = (option[8] == ':') ? _False : _True;
+ else
AdditionalOptions += option;
- break;
- }
+ break;
case 0x9B3C00D:
case 0x78dc00d: // /SUBSYSTEM:{CONSOLE|EFI_APPLICATION|EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|NATIVE|POSIX|WINDOWS|WINDOWSCE}[,major[.minor]]
{
@@ -2119,9 +2121,9 @@ VCPreLinkEventTool::VCPreLinkEventTool()
// VCConfiguration --------------------------------------------------
VCConfiguration::VCConfiguration()
- : ATLMinimizesCRunTimeLibraryUsage(unset),
- WinRT(false),
+ : WinRT(false),
WinPhone(false),
+ ATLMinimizesCRunTimeLibraryUsage(unset),
BuildBrowserInformation(unset),
CharacterSet(charSetNotSet),
ConfigurationType(typeApplication),
@@ -2859,7 +2861,7 @@ void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QSt
root = new TreeNode;
QString name, extfilter, guid;
- triState parse;
+ triState parse = unset;
for (int i = 0; i < project.SingleProjects.count(); ++i) {
VCFilter filter;
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index 4e19a43a8c..58b528301c 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -615,6 +615,7 @@ public:
QStringList IgnoreDefaultLibraryNames;
triState IgnoreEmbeddedIDL;
triState IgnoreImportLibrary;
+ triState ImageHasSafeExceptionHandlers;
QString ImportLibrary;
addressAwarenessType LargeAddressAware;
triState LinkDLL;
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index a30129fa27..934902fd4a 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -124,17 +124,17 @@ DotNET which_dotnet_version()
// Fallback to .NET 2002
current_version = NET2002;
- QStringList warnPath;
+ const DotNetCombo *lowestInstalledVersion = 0;
QHash<DotNET, QString> installPaths;
int installed = 0;
int i = 0;
for(; dotNetCombo[i].version; ++i) {
QString path = qt_readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey);
if (!path.isEmpty() && installPaths.value(dotNetCombo[i].version) != path) {
- installPaths.insert(dotNetCombo[i].version, path);
+ lowestInstalledVersion = &dotNetCombo[i];
+ installPaths.insert(lowestInstalledVersion->version, path);
++installed;
- current_version = dotNetCombo[i].version;
- warnPath += QString("%1").arg(dotNetCombo[i].versionStr);
+ current_version = lowestInstalledVersion->version;
}
}
@@ -143,35 +143,20 @@ DotNET which_dotnet_version()
// More than one version installed, search directory path
QString paths = qgetenv("PATH");
- QStringList pathlist = paths.toLower().split(";");
-
- i = installed = 0;
- for(; dotNetCombo[i].version; ++i) {
- QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey).toLower();
- if (productPath.isEmpty())
- continue;
- QStringList::iterator it;
- for(it = pathlist.begin(); it != pathlist.end(); ++it) {
- if((*it).contains(productPath)) {
- ++installed;
- current_version = dotNetCombo[i].version;
- warnPath += QString("%1 in path").arg(dotNetCombo[i].versionStr);
- break;
- }
+ const QStringList pathlist = paths.split(QLatin1Char(';'));
+ foreach (const QString &path, pathlist) {
+ for (i = 0; dotNetCombo[i].version; ++i) {
+ const QString productPath = installPaths.value(dotNetCombo[i].version);
+ if (productPath.isEmpty())
+ continue;
+ if (path.startsWith(productPath, Qt::CaseInsensitive))
+ return dotNetCombo[i].version;
}
}
- switch(installed) {
- case 1:
- break;
- case 0:
- warn_msg(WarnLogic, "Generator: MSVC.NET: Found more than one version of Visual Studio, but"
- " none in your path! Fallback to lowest version (%s)", warnPath.join(", ").toLatin1().data());
- break;
- default:
- warn_msg(WarnLogic, "Generator: MSVC.NET: Found more than one version of Visual Studio in"
- " your path! Fallback to lowest version (%s)", warnPath.join(", ").toLatin1().data());
- break;
- }
+
+ warn_msg(WarnLogic, "Generator: MSVC.NET: Found more than one version of Visual Studio, but"
+ " none in your PATH. Falling back to lowest version (%s)",
+ qPrintable(lowestInstalledVersion->versionStr));
return current_version;
#endif
@@ -514,7 +499,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
// We want to store it as the .lib name.
if (newDep->target.endsWith(".dll"))
newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
- projGuids.insert(val.first, newDep->target);
+ projGuids.insert(newDep->orig_target, newDep->target);
if (val.second.size()) {
const ProStringList depends = val.second;
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index 9cefbc8572..96de34fd14 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -1590,11 +1590,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
case T_CACHE: {
if (args.count() > 3) {
- evalError(fL1S("cache(var, [set|add|sub] [transient] [super], [srcvar]) requires one to three arguments."));
+ evalError(fL1S("cache(var, [set|add|sub] [transient] [super|stash], [srcvar]) requires one to three arguments."));
return ReturnFalse;
}
bool persist = true;
- bool super = false;
+ enum { TargetStash, TargetCache, TargetSuper } target = TargetCache;
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
ProKey srcvar;
if (args.count() >= 2) {
@@ -1603,7 +1603,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (m_tmp3 == QLatin1String("transient")) {
persist = false;
} else if (m_tmp3 == QLatin1String("super")) {
- super = true;
+ target = TargetSuper;
+ } else if (m_tmp3 == QLatin1String("stash")) {
+ target = TargetStash;
} else if (m_tmp3 == QLatin1String("set")) {
mode = CacheSet;
} else if (m_tmp3 == QLatin1String("add")) {
@@ -1642,7 +1644,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
m_option->mutex.lock();
#endif
QMakeBaseEnv *baseEnv =
- m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, hostBuild));
+ m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, m_stashfile, hostBuild));
#ifdef PROEVALUATOR_THREAD_SAFE
// It's ok to unlock this before locking baseEnv,
// as we have no intention to initialize the env.
@@ -1675,21 +1677,23 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
removeEach(&newval, diffval);
}
if (oldval != newval) {
- baseEval->valuesRef(dstvar) = newval;
- if (super) {
- do {
- if (dstvar == QLatin1String("QMAKEPATH")) {
- baseEval->m_qmakepath = newval.toQStringList();
- baseEval->updateMkspecPaths();
- } else if (dstvar == QLatin1String("QMAKEFEATURES")) {
- baseEval->m_qmakefeatures = newval.toQStringList();
- } else {
- break;
- }
- baseEval->updateFeaturePaths();
- if (hostBuild == m_hostBuild)
- m_featureRoots = baseEval->m_featureRoots;
- } while (false);
+ if (target != TargetStash || !m_stashfile.isEmpty()) {
+ baseEval->valuesRef(dstvar) = newval;
+ if (target == TargetSuper) {
+ do {
+ if (dstvar == QLatin1String("QMAKEPATH")) {
+ baseEval->m_qmakepath = newval.toQStringList();
+ baseEval->updateMkspecPaths();
+ } else if (dstvar == QLatin1String("QMAKEFEATURES")) {
+ baseEval->m_qmakefeatures = newval.toQStringList();
+ } else {
+ break;
+ }
+ baseEval->updateFeaturePaths();
+ if (hostBuild == m_hostBuild)
+ m_featureRoots = baseEval->m_featureRoots;
+ } while (false);
+ }
}
changed = true;
}
@@ -1720,16 +1724,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
varstr += QLatin1Char('\n');
}
QString fn;
- if (super) {
+ if (target == TargetSuper) {
if (m_superfile.isEmpty()) {
- m_superfile = m_outputDir + QLatin1String("/.qmake.super");
+ m_superfile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.super"));
printf("Info: creating super cache file %s\n", qPrintable(m_superfile));
valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
}
fn = m_superfile;
- } else {
+ } else if (target == TargetCache) {
if (m_cachefile.isEmpty()) {
- m_cachefile = m_outputDir + QLatin1String("/.qmake.cache");
+ m_cachefile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.cache"));
printf("Info: creating cache file %s\n", qPrintable(m_cachefile));
valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
// We could update m_{source,build}Root and m_featureRoots here, or even
@@ -1739,6 +1743,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
// The sub-projects will find the new cache all by themselves.
}
fn = m_cachefile;
+ } else {
+ fn = m_stashfile;
+ if (fn.isEmpty())
+ fn = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.stash"));
+ if (!m_vfs->exists(fn)) {
+ printf("Info: creating stash file %s\n", qPrintable(fn));
+ valuesRef(ProKey("_QMAKE_STASH_")) << ProString(fn);
+ }
}
return writeFile(fL1S("cache "), fn, QIODevice::Append, varstr);
}
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index c4dca12900..f46eb75670 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -79,19 +79,19 @@ QT_BEGIN_NAMESPACE
#define fL1S(s) QString::fromLatin1(s)
-QMakeBaseKey::QMakeBaseKey(const QString &_root, bool _hostBuild)
- : root(_root), hostBuild(_hostBuild)
+QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild)
+ : root(_root), stash(_stash), hostBuild(_hostBuild)
{
}
uint qHash(const QMakeBaseKey &key)
{
- return qHash(key.root) ^ (uint)key.hostBuild;
+ return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild;
}
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
{
- return one.root == two.root && one.hostBuild == two.hostBuild;
+ return one.root == two.root && one.stash == two.stash && one.hostBuild == two.hostBuild;
}
QMakeBaseEnv::QMakeBaseEnv()
@@ -982,6 +982,8 @@ void QMakeEvaluator::loadDefaults()
vars[ProKey("_DATE_")] << ProString(QDateTime::currentDateTime().toString());
if (!m_option->qmake_abslocation.isEmpty())
vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation);
+ if (!m_option->qmake_args.isEmpty())
+ vars[ProKey("QMAKE_ARGS")] = ProStringList(m_option->qmake_args);
#if defined(Q_OS_WIN32)
vars[ProKey("QMAKE_HOST.os")] << ProString("Windows");
@@ -1137,6 +1139,19 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
dir = qdfi.path();
}
+ dir = m_outputDir;
+ forever {
+ QString stashfile = dir + QLatin1String("/.qmake.stash");
+ if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) {
+ m_stashfile = QDir::cleanPath(stashfile);
+ break;
+ }
+ QFileInfo qdfi(dir);
+ if (qdfi.isRoot())
+ break;
+ dir = qdfi.path();
+ }
+
return true;
}
@@ -1186,23 +1201,18 @@ bool QMakeEvaluator::loadSpec()
QMakeEvaluator evaluator(m_option, m_parser, m_vfs, m_handler);
evaluator.m_sourceRoot = m_sourceRoot;
evaluator.m_buildRoot = m_buildRoot;
- if (!m_superfile.isEmpty()) {
- valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
- if (evaluator.evaluateFile(
- m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
- return false;
+
+ if (!m_superfile.isEmpty() && evaluator.evaluateFile(
+ m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
+ return false;
}
- if (!m_conffile.isEmpty()) {
- valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile);
- if (evaluator.evaluateFile(
- m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
- return false;
+ if (!m_conffile.isEmpty() && evaluator.evaluateFile(
+ m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
+ return false;
}
- if (!m_cachefile.isEmpty()) {
- valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
- if (evaluator.evaluateFile(
- m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
- return false;
+ if (!m_cachefile.isEmpty() && evaluator.evaluateFile(
+ m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
+ return false;
}
if (qmakespec.isEmpty()) {
if (!m_hostBuild)
@@ -1236,19 +1246,31 @@ bool QMakeEvaluator::loadSpec()
cool:
m_qmakespec = QDir::cleanPath(qmakespec);
- if (!m_superfile.isEmpty()
- && evaluateFile(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
- return false;
+ if (!m_superfile.isEmpty()) {
+ valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
+ if (evaluateFile(
+ m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue)
+ return false;
}
if (!loadSpecInternal())
return false;
- if (!m_conffile.isEmpty()
- && evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
- return false;
+ if (!m_conffile.isEmpty()) {
+ valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile);
+ if (evaluateFile(
+ m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
+ return false;
}
- if (!m_cachefile.isEmpty()
- && evaluateFile(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
- return false;
+ if (!m_cachefile.isEmpty()) {
+ valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
+ if (evaluateFile(
+ m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
+ return false;
+ }
+ if (!m_stashfile.isEmpty() && m_vfs->exists(m_stashfile)) {
+ valuesRef(ProKey("_QMAKE_STASH_")) << ProString(m_stashfile);
+ if (evaluateFile(
+ m_stashfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
+ return false;
}
return true;
}
@@ -1327,7 +1349,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
#ifdef PROEVALUATOR_THREAD_SAFE
m_option->mutex.lock();
#endif
- QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_hostBuild)];
+ QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_stashfile, m_hostBuild)];
if (!*baseEnvPtr)
*baseEnvPtr = new QMakeBaseEnv;
QMakeBaseEnv *baseEnv = *baseEnvPtr;
@@ -1354,6 +1376,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
baseEval->m_superfile = m_superfile;
baseEval->m_conffile = m_conffile;
baseEval->m_cachefile = m_cachefile;
+ baseEval->m_stashfile = m_stashfile;
baseEval->m_sourceRoot = m_sourceRoot;
baseEval->m_buildRoot = m_buildRoot;
baseEval->m_hostBuild = m_hostBuild;
diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h
index c1e7037762..de13033481 100644
--- a/qmake/library/qmakeevaluator.h
+++ b/qmake/library/qmakeevaluator.h
@@ -298,6 +298,7 @@ public:
QString m_superfile;
QString m_conffile;
QString m_cachefile;
+ QString m_stashfile;
QString m_sourceRoot;
QString m_buildRoot;
QStringList m_qmakepath;
diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h
index b305b495bc..1f217138b4 100644
--- a/qmake/library/qmakeglobals.h
+++ b/qmake/library/qmakeglobals.h
@@ -66,9 +66,10 @@ class QMakeEvaluator;
class QMakeBaseKey
{
public:
- QMakeBaseKey(const QString &_root, bool _hostBuild);
+ QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild);
QString root;
+ QString stash;
bool hostBuild;
};
@@ -117,6 +118,7 @@ public:
QProcessEnvironment environment;
#endif
QString qmake_abslocation;
+ QStringList qmake_args;
QString qmakespec, xqmakespec;
QString user_template, user_template_prefix;
diff --git a/qmake/main.cpp b/qmake/main.cpp
index b1929e0d21..79e3739f56 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -106,7 +106,7 @@ static int doSed(int argc, char **argv)
}
}
if (phase == 1
- && (c == QLatin1Char('+') || c == QLatin1Char('?')
+ && (c == QLatin1Char('+') || c == QLatin1Char('?') || c == QLatin1Char('|')
|| c == QLatin1Char('{') || c == QLatin1Char('}')
|| c == QLatin1Char('(') || c == QLatin1Char(')'))) {
// translate sed rx to QRegExp
@@ -133,6 +133,7 @@ static int doSed(int argc, char **argv)
SedSubst subst;
subst.from = QRegExp(phases.at(0));
subst.to = phases.at(1);
+ subst.to.replace("\\\\", "\\"); // QString::replace(rx, sub) groks \1, but not \\.
substs << subst;
}
} else if (argv[i][0] == '-' && argv[i][1] != 0) {
diff --git a/qmake/option.cpp b/qmake/option.cpp
index da52542a7d..7b93144d82 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -82,7 +82,6 @@ char Option::field_sep;
Option::QMAKE_MODE Option::qmake_mode = Option::QMAKE_GENERATE_NOTHING;
//all modes
-QStringList Option::qmake_args;
int Option::warn_level = WarnLogic | WarnDeprecated;
int Option::debug_level = 0;
QFile Option::output;
@@ -436,7 +435,7 @@ Option::init(int argc, char **argv)
return ret;
//return ret == QMAKE_CMDLINE_SHOW_USAGE ? usage(argv[0]) : false;
}
- Option::qmake_args = args;
+ globals->qmake_args = args;
}
globals->commitCommandLineArguments(cmdstate);
globals->debugLevel = Option::debug_level;
@@ -532,12 +531,11 @@ Option::fixString(QString string, uchar flags)
string = QDir::cleanPath(string);
}
- bool localSep = (flags & Option::FixPathToLocalSeparators) != 0;
- bool targetSep = (flags & Option::FixPathToTargetSeparators) != 0;
- bool normalSep = (flags & Option::FixPathToNormalSeparators) != 0;
-
// either none or only one active flag
- Q_ASSERT(localSep + targetSep + normalSep <= 1);
+ Q_ASSERT(((flags & Option::FixPathToLocalSeparators) != 0) +
+ ((flags & Option::FixPathToTargetSeparators) != 0) +
+ ((flags & Option::FixPathToNormalSeparators) != 0) <= 1);
+
//fix separators
if (flags & Option::FixPathToNormalSeparators) {
string = string.replace('\\', '/');
diff --git a/qmake/option.h b/qmake/option.h
index af8e3b7ab8..d0436fe844 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -178,7 +178,6 @@ struct Option
static QMAKE_MODE qmake_mode;
//all modes
- static QStringList qmake_args;
static QFile output;
static QString output_dir;
static int debug_level;
diff --git a/qmake/property.cpp b/qmake/property.cpp
index 38d454cb5d..e50485ce19 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -81,7 +81,7 @@ static const struct {
QMakeProperty::QMakeProperty() : settings(0)
{
- for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) {
+ for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) {
QString name = QString::fromLatin1(propList[i].name);
m_values[ProKey(name + "/src")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectiveSourcePaths);
m_values[ProKey(name + "/get")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectivePaths);
@@ -155,7 +155,7 @@ QMakeProperty::exec()
fprintf(stdout, "%s:%s\n", qPrintable(key), qPrintable(val));
}
QStringList specialProps;
- for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++)
+ for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++)
specialProps.append(QString::fromLatin1(propList[i].name));
specialProps.append("QMAKE_VERSION");
#ifdef QT_VERSION_STR
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index 5012bd0206..661b787a55 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -1,6 +1,3 @@
-SKIP_DEPENDS += qconfig.h qmodules.h
-DEFINES += QT_NO_TEXTCODEC QT_NO_LIBRARY QT_NO_COMPRESS QT_NO_UNICODETABLES \
- QT_NO_GEOM_VARIANT QT_NO_DATASTREAM
#qmake code
SOURCES += project.cpp property.cpp main.cpp \
@@ -37,7 +34,6 @@ contains(QT_EDITION, OpenSource) {
}
bootstrap { #Qt code
- DEFINES+=QT_NO_THREAD
SOURCES+= \
qbitarray.cpp \
qbuffer.cpp \
@@ -160,7 +156,16 @@ bootstrap { #Qt code
CFLAGS += -fhonor-std
LFLAGS += -lcpp
}
- DEFINES *= QT_NO_QOBJECT QT_CRYPTOGRAPHICHASH_ONLY_SHA1
+
+ DEFINES += \
+ QT_BOOTSTRAPPED \
+ QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_NO_COMPONENT QT_NO_COMPRESS \
+ QT_NO_THREAD QT_NO_QOBJECT QT_NO_GEOM_VARIANT QT_NO_DATASTREAM \
+ QT_CRYPTOGRAPHICHASH_ONLY_SHA1 QT_JSON_READONLY
+
+ INCLUDEPATH += \
+ $$QT.core.includes $$QT.core_private.includes \
+ $$shadowed(../src/corelib/global)
} else {
CONFIG += qt
QT = core
diff --git a/qmake/qmake.pro b/qmake/qmake.pro
index e680942716..89d6ea5fc1 100644
--- a/qmake/qmake.pro
+++ b/qmake/qmake.pro
@@ -4,24 +4,21 @@
option(host_build)
CONFIG += console bootstrap
-CONFIG -= qt shared app_bundle uic
-DEFINES += QT_BUILD_QMAKE QT_BOOTSTRAPPED \
+CONFIG -= qt
+DEFINES += \
+ QT_BUILD_QMAKE \
PROEVALUATOR_FULL
-DESTDIR = ../bin/
-OBJECTS_DIR = .
-MOC_DIR = .
-
-#guts
-VPATH += $$QT_SOURCE_TREE/src/corelib/global \
- $$QT_SOURCE_TREE/src/corelib/tools \
- $$QT_SOURCE_TREE/src/corelib/kernel \
- $$QT_SOURCE_TREE/src/corelib/codecs \
- $$QT_SOURCE_TREE/src/corelib/plugin \
- $$QT_SOURCE_TREE/src/corelib/xml \
- $$QT_SOURCE_TREE/src/corelib/io \
- $$QT_SOURCE_TREE/src/corelib/json \
- $$QT_SOURCE_TREE/tools/shared/windows
+VPATH += \
+ ../src/corelib/global \
+ ../src/corelib/tools \
+ ../src/corelib/kernel \
+ ../src/corelib/codecs \
+ ../src/corelib/plugin \
+ ../src/corelib/xml \
+ ../src/corelib/io \
+ ../src/corelib/json \
+ ../tools/shared/windows
INCLUDEPATH += . \
library \
@@ -30,11 +27,8 @@ INCLUDEPATH += . \
generators/win32 \
generators/mac \
generators/integrity \
- $$QT_SOURCE_TREE/include \
- $$QT_SOURCE_TREE/include/QtCore \
- $$QT_SOURCE_TREE/include/QtCore/$$QT_VERSION \
- $$QT_SOURCE_TREE/include/QtCore/$$QT_VERSION/QtCore \
- $$QT_SOURCE_TREE/tools/shared \
- $$QT_SOURCE_TREE/qmake
+ ../tools/shared
include(qmake.pri)
+
+load(qt_app)
diff --git a/qtbase.pro b/qtbase.pro
index d3b03d1fba..9091fba4e0 100644
--- a/qtbase.pro
+++ b/qtbase.pro
@@ -103,10 +103,83 @@ prefix_build|!equals(PWD, $$OUT_PWD) {
}
+# Generate qfeatures.h
+features =
+lines = $$cat("src/corelib/global/qfeatures.txt", lines)
+for (line, lines) {
+ t = $$replace(line, "^Feature: (\\S+)\\s*$", "\\1")
+ !isEqual(t, $$line) {
+ feature = $$t
+ features += $$t
+ } else {
+ t = $$replace(line, "^Requires: (.*)$", "\\1")
+ !isEqual(t, $$line) {
+ features.$${feature}.depends = $$replace(t, \\s+$, )
+ } else {
+ t = $$replace(line, "^Name: (.*)$", "\\1")
+ !isEqual(t, $$line) {
+ features.$${feature}.name = $$replace(t, \\s+$, )
+ }
+ }
+ }
+}
+features = $$sort_depends(features, features.)
+features = $$reverse(features)
+FEATURES_H = \
+ "/*" \
+ " * All feature dependencies." \
+ " *" \
+ " * This list is generated by qmake from <qtbase>/src/corelib/global/qfeatures.txt" \
+ " */"
+FEATURES_PRI =
+for (ft, features) {
+ !isEmpty(features.$${ft}.depends) {
+ FEATURES_H += \
+ "$${LITERAL_HASH}if !defined(QT_NO_$$ft) && ($$join($$list($$split(features.$${ft}.depends)), ") || defined(QT_NO_", "defined(QT_NO_", ")"))" \
+ "$${LITERAL_HASH} define QT_NO_$$ft" \
+ "$${LITERAL_HASH}endif"
+ FEATURES_PRI += \
+ "contains(QT_DISABLED_FEATURES, "^($$lower($$join($$list($$replace(features.$${ft}.depends, _, -)), "|")))$"): \\" \
+ " QT_DISABLED_FEATURES += $$lower($$replace(ft, _, -))"
+ }
+}
+write_file($$OUT_PWD/src/corelib/global/qfeatures.h, FEATURES_H)|error("Aborting.")
+# Create forwarding header
+FWD_FEATURES_H = \
+ '$${LITERAL_HASH}include "../../src/corelib/global/qfeatures.h"'
+write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error("Aborting.")
+
+no_features =
+lines = $$cat($$absolute_path($$QT_QCONFIG_PATH, $$PWD/src/corelib/global), lines)
+for (line, lines) {
+ # We ignore all defines that don't follow the #ifndef + indent pattern.
+ # This makes it possible to have unchecked defines which are no features.
+ t = $$replace(line, "^$${LITERAL_HASH} define QT_NO_(\\S+)\\s*$", "\\1")
+ !isEqual(t, $$line) {
+ isEmpty(features.$${t}.name): \
+ error("$$QT_QCONFIG_PATH disables unknown feature $$t")
+ no_features += $$t
+ }
+}
+for (def, QT_NO_DEFINES) {
+ !isEmpty(features.$${def}.name): \
+ no_features += $$def
+}
+no_features = $$unique(no_features)
+
+# Can't simply add these to QT_CONFIG, as e.g., contains(QT_CONFIG, accessibility) matches no-accessibililty.
+FEATURES_PRI = \
+ "$${LITERAL_HASH} Features disabled by configure:" \
+ "QT_DISABLED_FEATURES =$$lower($$join($$list($$replace(no_features, _, -)), " ", " "))" \
+ "$$escape_expand(\\n)$${LITERAL_HASH} Dependencies derived from <qtbase>/src/corelib/global/qfeatures.txt:" \
+ $$FEATURES_PRI \
+ "QT_DISABLED_FEATURES = \$\$unique(QT_DISABLED_FEATURES)"
+write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error("Aborting.")
+
#mkspecs
mkspecs.path = $$[QT_HOST_DATA]/mkspecs
mkspecs.files = \
- $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri \
+ $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qfeatures.pri \
$$files($$PWD/mkspecs/*)
mkspecs.files -= $$PWD/mkspecs/modules
INSTALLS += mkspecs
diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
index abc6d7d3b9..ee8d4800ae 100644
--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
+++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
@@ -20,6 +20,8 @@
#include "libEGL/main.h"
#include "libEGL/Display.h"
+#include <algorithm>
+
#if defined(ANGLE_OS_WINRT)
#include <windows.foundation.h>
#include <windows.ui.core.h>
diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
index 113b126a77..72d354dd64 100644
--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
@@ -589,7 +589,7 @@ const unsigned long long noEventId = 0;
class TraceID {
public:
explicit TraceID(const void* id, unsigned char* flags) :
- m_data(static_cast<unsigned long long>(reinterpret_cast<unsigned long>(id)))
+ m_data(reinterpret_cast<unsigned long long>(id))
{
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64.c b/src/3rdparty/sha3/KeccakF-1600-opt64.c
index 0432f1ab18..7bd442ef69 100755
--- a/src/3rdparty/sha3/KeccakF-1600-opt64.c
+++ b/src/3rdparty/sha3/KeccakF-1600-opt64.c
@@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/
typedef unsigned char UINT8;
typedef unsigned long long int UINT64;
+#if defined(UseSSE) || defined(UseXOP)
#if defined(__GNUC__)
#define ALIGN __attribute__ ((aligned(32)))
#elif defined(_MSC_VER)
#define ALIGN __declspec(align(32))
-#else
-#define ALIGN
+#endif
+#endif
+
+#ifndef ALIGN
+# define ALIGN
#endif
#if defined(UseSSE)
diff --git a/src/3rdparty/sha3/KeccakSponge.h b/src/3rdparty/sha3/KeccakSponge.h
index a545cacb30..8bb11a8a1d 100755
--- a/src/3rdparty/sha3/KeccakSponge.h
+++ b/src/3rdparty/sha3/KeccakSponge.h
@@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/
#define KeccakMaximumRate 1536
#define KeccakMaximumRateInBytes (KeccakMaximumRate/8)
+#if defined(UseSSE) || defined(UseXOP)
#if defined(__GNUC__)
#define ALIGN __attribute__ ((aligned(32)))
#elif defined(_MSC_VER)
#define ALIGN __declspec(align(32))
-#else
-#define ALIGN
+#endif
+#endif
+
+#ifndef ALIGN
+# define ALIGN
#endif
ALIGN typedef struct spongeStateStruct {
diff --git a/src/3rdparty/xcb/include/xcb/xkb.h b/src/3rdparty/xcb/include/xcb/xkb.h
index 44b0a8d1ae..0180ec8b58 100644
--- a/src/3rdparty/xcb/include/xcb/xkb.h
+++ b/src/3rdparty/xcb/include/xcb/xkb.h
@@ -114,8 +114,8 @@ typedef enum xcb_xkb_control_t {
XCB_XKB_CONTROL_GROUPS_WRAP = 134217728,
XCB_XKB_CONTROL_INTERNAL_MODS = 268435456,
XCB_XKB_CONTROL_IGNORE_LOCK_MODS = 536870912,
- XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824,
- XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648
+ XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824u,
+ XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648u
} xcb_xkb_control_t;
typedef enum xcb_xkb_axfb_opt_t {
diff --git a/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch b/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch
new file mode 100644
index 0000000000..240c20d2ac
--- /dev/null
+++ b/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch
@@ -0,0 +1,15 @@
+diff --git a/src/3rdparty/xcb/include/xcb/xkb.h b/src/3rdparty/xcb/include/xcb/xkb.h
+index 44b0a8d..0180ec8 100644
+--- a/src/3rdparty/xcb/include/xcb/xkb.h
++++ b/src/3rdparty/xcb/include/xcb/xkb.h
+@@ -114,8 +114,8 @@ typedef enum xcb_xkb_control_t {
+ XCB_XKB_CONTROL_GROUPS_WRAP = 134217728,
+ XCB_XKB_CONTROL_INTERNAL_MODS = 268435456,
+ XCB_XKB_CONTROL_IGNORE_LOCK_MODS = 536870912,
+- XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824,
+- XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648
++ XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824u,
++ XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648u
+ } xcb_xkb_control_t;
+
+ typedef enum xcb_xkb_axfb_opt_t {
diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri
index 19501d7b29..5906231c73 100644
--- a/src/android/jar/jar.pri
+++ b/src/android/jar/jar.pri
@@ -9,6 +9,7 @@ JAVASOURCES += \
$$PATHPREFIX/QtEditText.java \
$$PATHPREFIX/QtInputConnection.java \
$$PATHPREFIX/QtLayout.java \
+ $$PATHPREFIX/QtMessageDialogHelper.java \
$$PATHPREFIX/QtNative.java \
$$PATHPREFIX/QtNativeLibrariesDir.java \
$$PATHPREFIX/QtSurface.java
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 11af4d4280..3dcffeb07d 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -42,13 +42,6 @@
package org.qtproject.qt5.android;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -57,6 +50,8 @@ import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.ResultReceiver;
import android.text.method.MetaKeyKeyListener;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -66,11 +61,19 @@ import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.Surface;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
-import android.view.Surface;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Iterator;
public class QtActivityDelegate
{
@@ -109,8 +112,9 @@ public class QtActivityDelegate
private boolean m_quitApp = true;
private Process m_debuggerProcess = null; // debugger process
- public boolean m_keyboardIsVisible = false;
- public boolean m_keyboardIsHiding = false;
+ private boolean m_keyboardIsVisible = false;
+ public boolean m_backKeyPressedSent = false;
+
public QtLayout getQtLayout()
{
@@ -173,6 +177,13 @@ public class QtActivityDelegate
private final int ApplicationInactive = 0x2;
private final int ApplicationActive = 0x4;
+ public void setKeyboardVisibility(boolean visibility)
+ {
+ if (m_keyboardIsVisible == visibility)
+ return;
+ m_keyboardIsVisible = visibility;
+ QtNative.keyboardVisibilityChanged(m_keyboardIsVisible);
+ }
public void resetSoftwareKeyboard()
{
if (m_imm == null)
@@ -181,6 +192,7 @@ public class QtActivityDelegate
@Override
public void run() {
m_imm.restartInput(m_editText);
+ m_editText.m_optionsChanged = false;
}
}, 5);
}
@@ -253,15 +265,25 @@ public class QtActivityDelegate
m_editText.postDelayed(new Runnable() {
@Override
public void run() {
- m_imm.showSoftInput(m_editText, 0);
- m_keyboardIsVisible = true;
- m_keyboardIsHiding = false;
- m_editText.postDelayed(new Runnable() {
+ m_imm.showSoftInput(m_editText, 0, new ResultReceiver(new Handler()) {
@Override
- public void run() {
- m_imm.restartInput(m_editText);
+ protected void onReceiveResult(int resultCode, Bundle resultData) {
+ switch (resultCode) {
+ case InputMethodManager.RESULT_SHOWN:
+ case InputMethodManager.RESULT_UNCHANGED_SHOWN:
+ setKeyboardVisibility(true);
+ break;
+ case InputMethodManager.RESULT_HIDDEN:
+ case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
+ setKeyboardVisibility(false);
+ break;
+ }
}
- }, 25);
+ });
+ if (m_editText.m_optionsChanged) {
+ m_imm.restartInput(m_editText);
+ m_editText.m_optionsChanged = false;
+ }
}
}, 15);
}
@@ -270,9 +292,21 @@ public class QtActivityDelegate
{
if (m_imm == null)
return;
- m_imm.hideSoftInputFromWindow(m_editText.getWindowToken(), 0);
- m_keyboardIsVisible = false;
- m_keyboardIsHiding = false;
+ m_imm.hideSoftInputFromWindow(m_editText.getWindowToken(), 0, new ResultReceiver( new Handler()){
+ @Override
+ protected void onReceiveResult(int resultCode, Bundle resultData) {
+ switch (resultCode) {
+ case InputMethodManager.RESULT_SHOWN:
+ case InputMethodManager.RESULT_UNCHANGED_SHOWN:
+ setKeyboardVisibility(true);
+ break;
+ case InputMethodManager.RESULT_HIDDEN:
+ case InputMethodManager.RESULT_UNCHANGED_HIDDEN:
+ setKeyboardVisibility(false);
+ break;
+ }
+ }
+ });
}
public boolean isSoftwareKeyboardVisible()
@@ -362,7 +396,7 @@ public class QtActivityDelegate
+ "\tNECESSITAS_API_LEVEL=" + necessitasApiLevel
+ "\tHOME=" + m_activity.getFilesDir().getAbsolutePath()
+ "\tTMPDIR=" + m_activity.getFilesDir().getAbsolutePath();
- if (android.os.Build.VERSION.SDK_INT < 14)
+ if (Build.VERSION.SDK_INT < 14)
additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Droid Sans;Droid Sans Fallback";
else
additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Roboto;Droid Sans;Droid Sans Fallback";
@@ -378,6 +412,7 @@ public class QtActivityDelegate
m_applicationParameters = loaderParams.getString(APPLICATION_PARAMETERS_KEY);
else
m_applicationParameters = "";
+ setActionBarVisibility(false);
return true;
}
@@ -585,9 +620,9 @@ public class QtActivityDelegate
}
m_layout = new QtLayout(m_activity);
m_surface = new QtSurface(m_activity, 0);
- m_editText = new QtEditText(m_activity);
+ m_editText = new QtEditText(m_activity, this);
m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE);
- m_layout.addView(m_surface,0);
+ m_layout.addView(m_surface, 0);
m_activity.setContentView(m_layout,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
@@ -717,8 +752,12 @@ public class QtActivityDelegate
}
m_lastChar = lc;
- if (keyCode != KeyEvent.KEYCODE_BACK)
- QtNative.keyDown(keyCode, c, event.getMetaState());
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
+ m_backKeyPressedSent = !m_keyboardIsVisible;
+ if (!m_backKeyPressedSent)
+ return true;
+ }
+ QtNative.keyDown(keyCode, c, event.getMetaState());
return true;
}
@@ -737,8 +776,9 @@ public class QtActivityDelegate
}
}
- if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible && !m_keyboardIsHiding) {
+ if (keyCode == KeyEvent.KEYCODE_BACK && !m_backKeyPressedSent) {
hideSoftwareKeyboard();
+ setKeyboardVisibility(false);
return true;
}
@@ -775,7 +815,10 @@ public class QtActivityDelegate
public boolean onPrepareOptionsMenu(Menu menu)
{
m_opionsMenuIsVisible = true;
- return QtNative.onPrepareOptionsMenu(menu);
+ boolean res = QtNative.onPrepareOptionsMenu(menu);
+ if (!res || menu.size() == 0)
+ setActionBarVisibility(false);
+ return res;
}
public boolean onOptionsItemSelected(MenuItem item)
@@ -791,8 +834,17 @@ public class QtActivityDelegate
public void resetOptionsMenu()
{
- if (m_opionsMenuIsVisible)
- m_activity.closeOptionsMenu();
+ setActionBarVisibility(true);
+ if (Build.VERSION.SDK_INT > 10) {
+ try {
+ Activity.class.getMethod("invalidateOptionsMenu").invoke(m_activity);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ else
+ if (m_opionsMenuIsVisible)
+ m_activity.closeOptionsMenu();
}
private boolean m_contextMenuVisible = false;
public void onCreateContextMenu(ContextMenu menu,
@@ -833,4 +885,46 @@ public class QtActivityDelegate
{
m_activity.closeContextMenu();
}
+
+ private boolean hasPermanentMenuKey()
+ {
+ try {
+ return Build.VERSION.SDK_INT < 11 || (Build.VERSION.SDK_INT >= 14 &&
+ (Boolean)ViewConfiguration.class.getMethod("hasPermanentMenuKey").invoke(ViewConfiguration.get(m_activity)));
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ private Object getActionBar()
+ {
+ try {
+ return Activity.class.getMethod("getActionBar").invoke(m_activity);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private void setActionBarVisibility(boolean visible)
+ {
+ if (hasPermanentMenuKey() || !visible) {
+ if (Build.VERSION.SDK_INT > 10 && getActionBar() != null) {
+ try {
+ Class.forName("android.app.ActionBar").getMethod("hide").invoke(getActionBar());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ } else {
+ if (Build.VERSION.SDK_INT > 10 && getActionBar() != null)
+ try {
+ Class.forName("android.app.ActionBar").getMethod("show").invoke(getActionBar());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java
index b95e0c070c..593746aac9 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java
@@ -50,33 +50,47 @@ import android.view.inputmethod.InputConnection;
public class QtEditText extends View
{
- QtInputConnection m_inputConnection;
int m_initialCapsMode = 0;
int m_imeOptions = 0;
int m_inputType = InputType.TYPE_CLASS_TEXT;
+ boolean m_optionsChanged = false;
+ QtActivityDelegate m_activityDelegate;
public void setImeOptions(int m_imeOptions)
{
+ if (m_imeOptions == this.m_imeOptions)
+ return;
this.m_imeOptions = m_imeOptions;
+ m_optionsChanged = true;
}
public void setInitialCapsMode(int m_initialCapsMode)
{
+ if (m_initialCapsMode == this.m_initialCapsMode)
+ return;
this.m_initialCapsMode = m_initialCapsMode;
+ m_optionsChanged = true;
}
public void setInputType(int m_inputType)
{
+ if (m_inputType == this.m_inputType)
+ return;
this.m_inputType = m_inputType;
+ m_optionsChanged = true;
}
- public QtEditText(Context context)
+ public QtEditText(Context context, QtActivityDelegate activityDelegate)
{
super(context);
setFocusable(true);
setFocusableInTouchMode(true);
- m_inputConnection = new QtInputConnection(this);
+ m_activityDelegate = activityDelegate;
+ }
+ public QtActivityDelegate getActivityDelegate()
+ {
+ return m_activityDelegate;
}
@Override
@@ -86,8 +100,9 @@ public class QtEditText extends View
outAttrs.imeOptions = m_imeOptions;
outAttrs.initialCapsMode = m_initialCapsMode;
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
- return m_inputConnection;
+ return new QtInputConnection(this);
}
+
// // DEBUG CODE
// @Override
// protected void onDraw(Canvas canvas) {
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java
index f251369737..4b2d50ca1f 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java
@@ -43,8 +43,6 @@
package org.qtproject.qt5.android;
import android.content.Context;
-import android.os.Build;
-import android.view.View;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.ExtractedText;
@@ -82,6 +80,22 @@ class QtNativeInputConnection
static native boolean paste();
}
+class HideKeyboardRunnable implements Runnable {
+ private QtInputConnection m_connection;
+ HideKeyboardRunnable(QtInputConnection connection)
+ {
+ m_connection = connection;
+ }
+
+ @Override
+ public void run() {
+ if (m_connection.getInputState() == QtInputConnection.InputStates.Hiding) {
+ QtNative.activityDelegate().setKeyboardVisibility(false);
+ m_connection.reset();
+ }
+ }
+}
+
public class QtInputConnection extends BaseInputConnection
{
private static final int ID_SELECT_ALL = android.R.id.selectAll;
@@ -92,67 +106,83 @@ public class QtInputConnection extends BaseInputConnection
private static final int ID_SWITCH_INPUT_METHOD = android.R.id.switchInputMethod;
private static final int ID_ADD_TO_DICTIONARY = android.R.id.addToDictionary;
- View m_view;
- boolean m_closing;
- public QtInputConnection(View targetView)
+
+ enum InputStates { Visible, FinishComposing, Hiding };
+
+ private QtEditText m_view = null;
+ private InputStates m_inputState = InputStates.Visible;
+
+ public void reset()
+ {
+ m_inputState = InputStates.Visible;
+ }
+
+ public InputStates getInputState()
+ {
+ return m_inputState;
+ }
+
+ private void setClosing(boolean closing)
+ {
+ if (closing && m_inputState == InputStates.Hiding)
+ return;
+
+ if (closing && m_inputState == InputStates.FinishComposing && m_view.getActivityDelegate().isSoftwareKeyboardVisible()) {
+ m_view.postDelayed(new HideKeyboardRunnable(this), 100);
+ m_inputState = InputStates.Hiding;
+ } else {
+ if (m_inputState == InputStates.Hiding)
+ QtNative.activityDelegate().setKeyboardVisibility(true);
+ m_inputState = closing ? InputStates.FinishComposing : InputStates.Visible;
+ }
+ }
+
+ public QtInputConnection(QtEditText targetView)
{
super(targetView, true);
m_view = targetView;
- m_closing = false;
}
@Override
public boolean beginBatchEdit()
{
- m_closing = false;
+ setClosing(false);
return true;
}
@Override
public boolean endBatchEdit()
{
- m_closing = false;
+// setClosing(false);
return true;
}
@Override
public boolean commitCompletion(CompletionInfo text)
{
- m_closing = false;
+ setClosing(false);
return QtNativeInputConnection.commitCompletion(text.getText().toString(), text.getPosition());
}
@Override
public boolean commitText(CharSequence text, int newCursorPosition)
{
- m_closing = false;
+ setClosing(false);
return QtNativeInputConnection.commitText(text.toString(), newCursorPosition);
}
@Override
public boolean deleteSurroundingText(int leftLength, int rightLength)
{
- m_closing = false;
+ setClosing(false);
return QtNativeInputConnection.deleteSurroundingText(leftLength, rightLength);
}
@Override
public boolean finishComposingText()
{
- if (m_closing) {
- QtNative.activityDelegate().m_keyboardIsHiding = true;
- m_view.postDelayed(new Runnable() {
- @Override
- public void run() {
- if (QtNative.activityDelegate().m_keyboardIsHiding)
- QtNative.activityDelegate().m_keyboardIsVisible=false;
- }
- }, 5000); // it seems finishComposingText comes musch faster than onKeyUp event,
- // so we must delay hide notification
- m_closing = false;
- } else {
- m_closing = true;
- }
+ // on some/all android devices hide event is not coming, but instead finishComposingText() is called twice
+ setClosing(true);
return QtNativeInputConnection.finishComposingText();
}
@@ -234,18 +264,21 @@ public class QtInputConnection extends BaseInputConnection
@Override
public boolean setComposingText(CharSequence text, int newCursorPosition)
{
+ setClosing(false);
return QtNativeInputConnection.setComposingText(text.toString(), newCursorPosition);
}
@Override
public boolean setComposingRegion(int start, int end)
{
+ setClosing(false);
return QtNativeInputConnection.setComposingRegion(start, end);
}
@Override
public boolean setSelection(int start, int end)
{
+ setClosing(false);
return QtNativeInputConnection.setSelection(start, end);
}
}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java
new file mode 100644
index 0000000000..6ee1304c12
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java
@@ -0,0 +1,425 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the Android port of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 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, Digia gives you certain additional
+ ** rights. These rights are described in the Digia 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.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+
+package org.qtproject.qt5.android;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.os.Build;
+import android.text.ClipboardManager;
+import android.util.TypedValue;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.ScrollView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+
+class QtNativeDialogHelper
+{
+ static native void dialogResult(long handler, int buttonID);
+}
+
+class ButtonStruct implements View.OnClickListener
+{
+ ButtonStruct(QtMessageDialogHelper dialog, int id, String text)
+ {
+ m_dialog = dialog;
+ m_id = id;
+ m_text = text;
+ }
+ QtMessageDialogHelper m_dialog;
+ private int m_id;
+ String m_text;
+
+ @Override
+ public void onClick(View view) {
+ QtNativeDialogHelper.dialogResult(m_dialog.handler(), m_id);
+ }
+}
+
+public class QtMessageDialogHelper
+{
+
+ public QtMessageDialogHelper(Activity activity)
+ {
+ m_activity = activity;
+ }
+
+
+ public void setIcon(int icon)
+ {
+ m_icon = icon;
+
+ }
+
+ private Drawable getIconDrawable()
+ {
+ if (m_icon == 0)
+ return null;
+
+ if (Build.VERSION.SDK_INT > 10) {
+ try {
+ TypedValue typedValue = new TypedValue();
+ m_theme.resolveAttribute(Class.forName("android.R$attr").getDeclaredField("alertDialogIcon").getInt(null), typedValue, true);
+ return m_activity.getResources().getDrawable(typedValue.resourceId);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ // Information, Warning, Critical, Question
+ switch (m_icon)
+ {
+ case 1: // Information
+ try {
+ return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_info").getInt(null));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ break;
+ case 2: // Warning
+// try {
+// return Class.forName("android.R$drawable").getDeclaredField("stat_sys_warning").getInt(null);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// break;
+ case 3: // Critical
+ try {
+ return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_alert").getInt(null));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ break;
+ case 4: // Question
+ try {
+ return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_menu_help").getInt(null));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ break;
+ }
+ return null;
+ }
+
+ public void setTile(String title)
+ {
+ m_title = title;
+ }
+
+ public void setText(String text)
+ {
+ m_text = text;
+ }
+
+ public void setInformativeText(String informativeText)
+ {
+ m_informativeText = informativeText;
+ }
+
+ public void setDetailedText(String text)
+ {
+ m_detailedText = text;
+ }
+
+ public void addButton(int id, String text)
+ {
+ if (m_buttonsList == null)
+ m_buttonsList = new ArrayList<ButtonStruct>();
+ m_buttonsList.add(new ButtonStruct(this, id, text));
+ }
+
+ private void setTextAppearance(TextView view, String attr, String style)
+ {
+ try {
+ int[] attrs = (int[]) Class.forName("android.R$styleable").getDeclaredField("TextAppearance").get(null);
+ final TypedArray a = m_theme.obtainStyledAttributes(null,
+ attrs,
+ Class.forName("android.R$attr").getDeclaredField(attr).getInt(null),
+ Class.forName("android.R$style").getDeclaredField(style).getInt(null));
+ final int textSize = a.getDimensionPixelSize(
+ Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textSize").getInt(null), 0);
+ if (textSize != 0)
+ view.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
+
+ final int textColor = a.getColor(
+ Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textColor").getInt(null), 0x3138);
+ if (textColor != 0x3138)
+ view.setTextColor(textColor);
+
+ a.recycle();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private Drawable getStyledDrawable(String drawable) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException
+ {
+ int[] attrs = {Class.forName("android.R$attr").getDeclaredField(drawable).getInt(null)};
+ final TypedArray a = m_theme.obtainStyledAttributes(attrs);
+ Drawable d = a.getDrawable(0);
+ a.recycle();
+ return d;
+ }
+
+
+ public void show(long handler)
+ {
+ m_handler = handler;
+ m_activity.runOnUiThread( new Runnable() {
+ @Override
+ public void run() {
+ if (m_dialog != null && m_dialog.isShowing())
+ m_dialog.dismiss();
+
+ m_dialog = new AlertDialog.Builder(m_activity).create();
+ m_theme = m_dialog.getWindow().getContext().getTheme();
+
+ if (m_title != null)
+ m_dialog.setTitle(m_title);
+ m_dialog.setOnCancelListener( new DialogInterface.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialogInterface) {
+ QtNativeDialogHelper.dialogResult(handler(), -1);
+ }
+ });
+ m_dialog.setCancelable(m_buttonsList == null);
+ m_dialog.setCanceledOnTouchOutside(m_buttonsList == null);
+ m_dialog.setIcon(getIconDrawable());
+ ScrollView scrollView = new ScrollView(m_activity);
+ RelativeLayout dialogLayout = new RelativeLayout(m_activity);
+ int id = 1;
+ View lastView = null;
+ View.OnLongClickListener copyText = new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View view) {
+ TextView tv = (TextView)view;
+ if (tv != null) {
+ ClipboardManager cm = (android.text.ClipboardManager) m_activity.getSystemService(Context.CLIPBOARD_SERVICE);
+ cm.setText(tv.getText());
+ }
+ return true;
+ }
+ };
+ if (m_text != null)
+ {
+ TextView view = new TextView(m_activity);
+ view.setId(id++);
+ view.setOnLongClickListener(copyText);
+ view.setLongClickable(true);
+
+ view.setText(m_text);
+ setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium");
+
+ RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
+ layout.setMargins(16, 8, 16, 8);
+ layout.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ dialogLayout.addView(view, layout);
+ lastView = view;
+ }
+
+ if (m_informativeText != null)
+ {
+ TextView view= new TextView(m_activity);
+ view.setId(id++);
+ view.setOnLongClickListener(copyText);
+ view.setLongClickable(true);
+
+ view.setText(m_informativeText);
+ setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium");
+
+ RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
+ layout.setMargins(16, 8, 16, 8);
+ if (lastView != null)
+ layout.addRule(RelativeLayout.BELOW, lastView.getId());
+ else
+ layout.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ dialogLayout.addView(view, layout);
+ lastView = view;
+ }
+
+ if (m_detailedText != null)
+ {
+ TextView view= new TextView(m_activity);
+ view.setId(id++);
+ view.setOnLongClickListener(copyText);
+ view.setLongClickable(true);
+
+ view.setText(m_detailedText);
+ setTextAppearance(view, "textAppearanceSmall", "TextAppearance_Small");
+
+ RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
+ layout.setMargins(16, 8, 16, 8);
+ if (lastView != null)
+ layout.addRule(RelativeLayout.BELOW, lastView.getId());
+ else
+ layout.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ dialogLayout.addView(view, layout);
+ lastView = view;
+ }
+
+ if (m_buttonsList != null)
+ {
+ LinearLayout buttonsLayout = new LinearLayout(m_activity);
+ buttonsLayout.setOrientation(LinearLayout.HORIZONTAL);
+ buttonsLayout.setId(id++);
+ boolean firstButton = true;
+ for (ButtonStruct button: m_buttonsList)
+ {
+ Button bv;
+ if (Build.VERSION.SDK_INT > 10) {
+ try {
+ bv = new Button(m_activity, null, Class.forName("android.R$attr").getDeclaredField("borderlessButtonStyle").getInt(null));
+ } catch (Exception e) {
+ bv = new Button(m_activity);
+ e.printStackTrace();
+ }
+ } else {
+ bv = new Button(m_activity);
+ }
+
+ bv.setText(button.m_text);
+ bv.setOnClickListener(button);
+ if (!firstButton) // first button
+ {
+ LinearLayout.LayoutParams layout = null;
+ View spacer = new View(m_activity);
+ if (Build.VERSION.SDK_INT > 10) {
+ try {
+ layout = new LinearLayout.LayoutParams(1, RelativeLayout.LayoutParams.MATCH_PARENT);
+ spacer.setBackgroundDrawable(getStyledDrawable("dividerVertical"));
+ buttonsLayout.addView(spacer, layout);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ LinearLayout.LayoutParams layout = null;
+ layout = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT, 1.0f);
+ buttonsLayout.addView(bv, layout);
+ firstButton = false;
+ }
+
+ if (Build.VERSION.SDK_INT > 10) {
+ try {
+ View horizontalDevider = new View(m_activity);
+ horizontalDevider.setId(id++);
+ horizontalDevider.setBackgroundDrawable(getStyledDrawable("dividerHorizontal"));
+ RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 1);
+ relativeParams.setMargins(0, 10, 0, 0);
+ if (lastView != null) {
+ relativeParams.addRule(RelativeLayout.BELOW, lastView.getId());
+ }
+ else
+ relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ dialogLayout.addView(horizontalDevider, relativeParams);
+ lastView = horizontalDevider;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
+ if (lastView != null) {
+ relativeParams.addRule(RelativeLayout.BELOW, lastView.getId());
+ }
+ else
+ relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ if (Build.VERSION.SDK_INT < 11)
+ relativeParams.setMargins(2, 12, 2, 4);
+ else
+ relativeParams.setMargins(2, 0, 2, 0);
+ dialogLayout.addView(buttonsLayout, relativeParams);
+ }
+ scrollView.addView(dialogLayout);
+ m_dialog.setView(scrollView);
+ m_dialog.show();
+ }
+ });
+ }
+
+ public void hide()
+ {
+ m_activity.runOnUiThread( new Runnable() {
+ @Override
+ public void run() {
+ if (m_dialog != null && m_dialog.isShowing())
+ m_dialog.dismiss();
+ reset();
+ }
+ });
+ }
+
+ public long handler()
+ {
+ return m_handler;
+ }
+
+ public void reset()
+ {
+ m_icon = 0;
+ m_title = null;
+ m_text = null;
+ m_informativeText = null;
+ m_detailedText = null;
+ m_buttonsList = null;
+ m_dialog = null;
+ m_handler = 0;
+ }
+
+ private Activity m_activity;
+ private int m_icon = 0;
+ private String m_title, m_text, m_informativeText, m_detailedText;
+ private ArrayList<ButtonStruct> m_buttonsList;
+ private AlertDialog m_dialog;
+ private long m_handler = 0;
+ private Resources.Theme m_theme;
+}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 1385c90e3e..57f3642b56 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -50,7 +50,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import android.os.Build;
import android.text.ClipboardManager;
import android.util.Log;
import android.view.ContextMenu;
@@ -110,9 +109,13 @@ public class QtNative
public static void openURL(String url)
{
- Uri uri = Uri.parse(url);
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- activity().startActivity(intent);
+ try {
+ Uri uri = Uri.parse(url);
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ activity().startActivity(intent);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
// this method loads full path libs
@@ -419,30 +422,21 @@ public class QtNative
private static boolean isSoftwareKeyboardVisible()
{
- Semaphore semaphore = new Semaphore(1);
- Boolean ret = false;
- class RunnableRes implements Runnable {
- @SuppressWarnings("unused")
- Boolean returnValue = null;
- Semaphore semaphore = null;
- RunnableRes(Boolean ret, Semaphore sem) {
- semaphore = sem;
- returnValue = ret;
- }
+ final Semaphore semaphore = new Semaphore(0);
+ final Boolean[] ret = {false};
+ runAction(new Runnable() {
@Override
public void run() {
- returnValue = m_activityDelegate.isSoftwareKeyboardVisible();
+ ret[0] = m_activityDelegate.isSoftwareKeyboardVisible();
semaphore.release();
}
- }
-
- runAction(new RunnableRes(ret, semaphore));
+ });
try {
semaphore.acquire();
} catch (Exception e) {
e.printStackTrace();
}
- return ret;
+ return ret[0];
}
private static void setFullScreen(final boolean fullScreen)
@@ -458,7 +452,7 @@ public class QtNative
private static void registerClipboardManager()
{
- final Semaphore semaphore = new Semaphore(1);
+ final Semaphore semaphore = new Semaphore(0);
runAction(new Runnable() {
@Override
public void run() {
@@ -569,6 +563,7 @@ public class QtNative
// keyboard methods
public static native void keyDown(int key, int unicode, int modifier);
public static native void keyUp(int key, int unicode, int modifier);
+ public static native void keyboardVisibilityChanged(boolean visibility);
// keyboard methods
// surface methods
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
index cd0bddf2c8..c499dc3898 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
@@ -117,21 +117,23 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
// Initialize Accessibility
// The accessibility code depends on android API level 16, so dynamically resolve it
- try {
- final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate";
- Class<?> qtDelegateClass = Class.forName(a11yDelegateClassName);
- Constructor constructor = qtDelegateClass.getConstructor(Class.forName("android.view.View"));
- m_accessibilityDelegate = constructor.newInstance(this);
-
- Class a11yDelegateClass = Class.forName("android.view.View$AccessibilityDelegate");
- Method setDelegateMethod = this.getClass().getMethod("setAccessibilityDelegate", a11yDelegateClass);
- setDelegateMethod.invoke(this, m_accessibilityDelegate);
- } catch (ClassNotFoundException e) {
- // Class not found is fine since we are compatible with Android API < 16, but the function will
- // only be available with that API level.
- } catch (Exception e) {
- // Unknown exception means something went wrong.
- Log.w("Qt A11y", "Unknown exception: " + e.toString());
+ if (android.os.Build.VERSION.SDK_INT >= 16) {
+ try {
+ final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate";
+ Class<?> qtDelegateClass = Class.forName(a11yDelegateClassName);
+ Constructor constructor = qtDelegateClass.getConstructor(Class.forName("android.view.View"));
+ m_accessibilityDelegate = constructor.newInstance(this);
+
+ Class a11yDelegateClass = Class.forName("android.view.View$AccessibilityDelegate");
+ Method setDelegateMethod = this.getClass().getMethod("setAccessibilityDelegate", a11yDelegateClass);
+ setDelegateMethod.invoke(this, m_accessibilityDelegate);
+ } catch (ClassNotFoundException e) {
+ // Class not found is fine since we are compatible with Android API < 16, but the function will
+ // only be available with that API level.
+ } catch (Exception e) {
+ // Unknown exception means something went wrong.
+ Log.w("Qt A11y", "Unknown exception: " + e.toString());
+ }
}
}
diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml
index 6463793e0b..cfad4553ee 100644
--- a/src/android/java/AndroidManifest.xml
+++ b/src/android/java/AndroidManifest.xml
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
-<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1">
+<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name">
- <activity android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden|navigation|screenSize"
+ <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
android:name="org.qtproject.qt5.android.bindings.QtActivity"
android:label="@string/app_name"
android:screenOrientation="unspecified">
@@ -34,8 +34,10 @@
<!-- Splash screen -->
</activity>
</application>
- <!-- %%INSERT_USES_SDK%% -->
+ <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+ <!-- %%INSERT_PERMISSIONS -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <!-- %%INSERT_FEATURES -->
</manifest>
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
index 9c7b57a4f5..7c741edfda 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
@@ -56,6 +56,7 @@ import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
@@ -79,6 +80,7 @@ import android.view.ActionMode;
import android.view.ActionMode.Callback;
//@ANDROID-11
+
public class QtActivity extends Activity
{
private final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished
@@ -113,28 +115,37 @@ public class QtActivity extends Activity
// for more details.
private static final String REPOSITORY_KEY = "repository"; // use this key to overwrite the default ministro repsitory
+ private static final String ANDROID_THEMES_KEY = "android.themes"; // themes that your application uses
+
- private static final String APPLICATION_PARAMETERS = null; // use this variable to pass any parameters to your application,
+ public String APPLICATION_PARAMETERS = null; // use this variable to pass any parameters to your application,
// the parameters must not contain any white spaces
// and must be separated with "\t"
// e.g "-param1\t-param2=value2\t-param3\tvalue3"
- private String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\t";
+ public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\tQT_USE_ANDROID_NATIVE_DIALOGS=1\t";
// use this variable to add any environment variables to your application.
// the env vars must be separated with "\t"
// e.g. "ENV_VAR1=1\tENV_VAR2=2\t"
// Currently the following vars are used by the android plugin:
- // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available,
- // note that the android style plugin in Qt 5.1 is not fully functional.
-
- private static final String QT_ANDROID_THEME = "light"; // sets the default theme to light. Possible values are:
- // * "" - for the device default dark theme
- // * "light" - for the device default light theme
- // * "holo" - for the holo dark theme
- // * "holo_light" - for the holo light theme
+ // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available.
+ // * QT_USE_ANDROID_NATIVE_DIALOGS -1 to use the android native dialogs.
+
+ public String[] QT_ANDROID_THEMES = null; // A list with all themes that your application want to use.
+ // The name of the theme must be the same with any theme from
+ // http://developer.android.com/reference/android/R.style.html
+ // The most used themes are:
+ // * "Theme" - (fallback) check http://developer.android.com/reference/android/R.style.html#Theme
+ // * "Theme_Black" - check http://developer.android.com/reference/android/R.style.html#Theme_Black
+ // * "Theme_Light" - (default for API <=10) check http://developer.android.com/reference/android/R.style.html#Theme_Light
+ // * "Theme_Holo" - check http://developer.android.com/reference/android/R.style.html#Theme_Holo
+ // * "Theme_Holo_Light" - (default for API 11-13) check http://developer.android.com/reference/android/R.style.html#Theme_Holo_Light
+ // * "Theme_DeviceDefault" - check http://developer.android.com/reference/android/R.style.html#Theme_DeviceDefault
+ // * "Theme_DeviceDefault_Light" - (default for API 14+) check http://developer.android.com/reference/android/R.style.html#Theme_DeviceDefault_Light
+
+ public String QT_ANDROID_DEFAULT_THEME = null; // sets the default theme.
private static final int INCOMPATIBLE_MINISTRO_VERSION = 1; // Incompatible Ministro version. Ministro needs to be upgraded.
- private static final String DISPLAY_DPI_KEY = "display.dpi";
private static final int BUFFER_SIZE = 1024;
private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings
@@ -153,6 +164,21 @@ public class QtActivity extends Activity
// this repository is used to push Qt snapshots.
private String[] m_qtLibs = null; // required qt libs
+ public QtActivity()
+ {
+ if (Build.VERSION.SDK_INT <= 10) {
+ QT_ANDROID_THEMES = new String[] {"Theme_Light"};
+ QT_ANDROID_DEFAULT_THEME = "Theme_Light";
+ }
+ else if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) {
+ QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"};
+ QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light";
+ } else {
+ QT_ANDROID_THEMES = new String[] {"Theme_DeviceDefault_Light"};
+ QT_ANDROID_DEFAULT_THEME = "Theme_DeviceDefault_Light";
+ }
+ }
+
// this function is used to load and start the loader
private void loadApplication(Bundle loaderParams)
{
@@ -237,23 +263,24 @@ public class QtActivity extends Activity
private ServiceConnection m_ministroConnection=new ServiceConnection() {
private IMinistro m_service = null;
- @Override
+ @Override
public void onServiceConnected(ComponentName name, IBinder service)
{
m_service = IMinistro.Stub.asInterface(service);
try {
- if (m_service!=null) {
- Bundle parameters= new Bundle();
+ if (m_service != null) {
+ Bundle parameters = new Bundle();
parameters.putStringArray(REQUIRED_MODULES_KEY, m_qtLibs);
parameters.putString(APPLICATION_TITLE_KEY, (String)QtActivity.this.getTitle());
parameters.putInt(MINIMUM_MINISTRO_API_KEY, MINISTRO_API_LEVEL);
parameters.putInt(MINIMUM_QT_VERSION_KEY, QT_VERSION);
parameters.putString(ENVIRONMENT_VARIABLES_KEY, ENVIRONMENT_VARIABLES);
- if (null!=APPLICATION_PARAMETERS)
+ if (APPLICATION_PARAMETERS != null)
parameters.putString(APPLICATION_PARAMETERS_KEY, APPLICATION_PARAMETERS);
parameters.putStringArray(SOURCES_KEY, m_sources);
parameters.putString(REPOSITORY_KEY, m_repository);
- parameters.putInt(DISPLAY_DPI_KEY, QtActivity.this.getResources().getDisplayMetrics().densityDpi);
+ if (QT_ANDROID_THEMES != null)
+ parameters.putStringArray(ANDROID_THEMES_KEY, QT_ANDROID_THEMES);
m_service.requestLoader(m_ministroCallback, parameters);
}
} catch (RemoteException e) {
@@ -261,19 +288,19 @@ public class QtActivity extends Activity
}
}
- private IMinistroCallback m_ministroCallback = new IMinistroCallback.Stub() {
- // this function is called back by Ministro.
- @Override
- public void loaderReady(final Bundle loaderParams) throws RemoteException {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- unbindService(m_ministroConnection);
- loadApplication(loaderParams);
- }
- });
- }
- };
+ private IMinistroCallback m_ministroCallback = new IMinistroCallback.Stub() {
+ // this function is called back by Ministro.
+ @Override
+ public void loaderReady(final Bundle loaderParams) throws RemoteException {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ unbindService(m_ministroConnection);
+ loadApplication(loaderParams);
+ }
+ });
+ }
+ };
@Override
public void onServiceDisconnected(ComponentName name) {
@@ -683,13 +710,30 @@ public class QtActivity extends Activity
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ try {
+ setTheme(Class.forName("android.R$style").getDeclaredField(QT_ANDROID_DEFAULT_THEME).getInt(null));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ if (Build.VERSION.SDK_INT > 10) {
+ try {
+ requestWindowFeature(Window.class.getField("FEATURE_ACTION_BAR").getInt(null));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ }
+
if (QtApplication.m_delegateObject != null && QtApplication.onCreate != null) {
QtApplication.invokeDelegateMethod(QtApplication.onCreate, savedInstanceState);
return;
}
- ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_THEME
+
+ ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_DEFAULT_THEME
+ "/\tQT_ANDROID_THEME_DISPLAY_DPI=" + getResources().getDisplayMetrics().densityDpi + "\t";
- requestWindowFeature(Window.FEATURE_NO_TITLE);
+
try {
m_activityInfo = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
} catch (NameNotFoundException e) {
diff --git a/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch b/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch
new file mode 100644
index 0000000000..cf32a20d46
--- /dev/null
+++ b/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch
@@ -0,0 +1,28 @@
+From 4863cf64cd332a5fcefe453634c3c5ef62cb758c Mon Sep 17 00:00:00 2001
+From: Friedemann Kleint <Friedemann.Kleint@digia.com>
+Date: Thu, 24 Oct 2013 12:49:59 +0300
+Subject: [PATCH] ANGLE: Fix compilation with MSVC2013.
+
+Add missing include for std::min(), std::max().
+
+Change-Id: I740e5db94f9f958ac65de8dd7baab7e203482637
+---
+ src/3rdparty/angle/src/libEGL/Surface.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp
+index b47a7bc..83fbbf5 100644
+--- a/src/3rdparty/angle/src/libEGL/Surface.cpp
++++ b/src/3rdparty/angle/src/libEGL/Surface.cpp
+@@ -20,6 +20,8 @@
+ #include "libEGL/main.h"
+ #include "libEGL/Display.h"
+
++#include <algorithm>
++
+ namespace egl
+ {
+
+--
+1.8.3.msysgit.0
+
diff --git a/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch b/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch
new file mode 100644
index 0000000000..0420694c91
--- /dev/null
+++ b/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch
@@ -0,0 +1,35 @@
+From 821c28d387b332bf16b6ea35ec22a77d3ba41632 Mon Sep 17 00:00:00 2001
+From: Kai Koehne <kai.koehne@digia.com>
+Date: Mon, 28 Oct 2013 10:27:53 +0100
+Subject: [PATCH] Fix compilation with MinGW gcc 64 bit
+
+Fix compilation of ANGLE with gcc 4.8.0 64 bit: The
+
+ reinterpret_cast<unsigned long>(void*)
+
+was causing
+
+ error: cast from 'const void*' to 'long unsigned int' loses precision
+
+Task-number: QTBUG-34395
+Change-Id: Ibde75dd4b5536f3827bdf0ab02a15e93a1a8a4f0
+---
+ src/3rdparty/angle/src/third_party/trace_event/trace_event.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+index 113b126..72d354d 100644
+--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
++++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h
+@@ -589,7 +589,7 @@ const unsigned long long noEventId = 0;
+ class TraceID {
+ public:
+ explicit TraceID(const void* id, unsigned char* flags) :
+- m_data(static_cast<unsigned long long>(reinterpret_cast<unsigned long>(id)))
++ m_data(reinterpret_cast<unsigned long long>(id))
+ {
+ *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
+ }
+--
+1.8.3.msysgit.0
+
diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
index 12e26a9a68..58ad88673a 100644
--- a/src/angle/src/common/common.pri
+++ b/src/angle/src/common/common.pri
@@ -4,10 +4,10 @@ INCLUDEPATH += \
$$ANGLE_DIR/src \
$$ANGLE_DIR/include
-LIBS = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI
+LIBS_PRIVATE = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI
# DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK.
-win32-msvc2012|winrt {
+win32-msvc2012|win32-msvc2013|winrt {
FXC = fxc.exe
} else {
DX_DIR = $$(DXSDK_DIR)
@@ -36,7 +36,7 @@ win32-msvc2012|winrt {
# Similarly we want the MinGW linker to use the import libraries shipped with the compiler
# instead of those from the SDK which cause a crash on startup.
- LIBS += -L\"$$DXLIB_DIR\"
+ LIBS_PRIVATE += -L\"$$DXLIB_DIR\"
}
}
diff --git a/src/angle/src/libEGL/libEGL.pro b/src/angle/src/libEGL/libEGL.pro
index 3781bd7868..b5854189f9 100644
--- a/src/angle/src/libEGL/libEGL.pro
+++ b/src/angle/src/libEGL/libEGL.pro
@@ -4,11 +4,11 @@ TARGET = $$qtLibraryTarget(libEGL)
include(../common/common.pri)
angle_d3d11 {
- LIBS += -ld3d11
+ LIBS_PRIVATE += -ld3d11
} else {
- LIBS += -ld3d9
+ LIBS_PRIVATE += -ld3d9
}
-LIBS += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2)
+LIBS_PRIVATE += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2)
HEADERS += \
$$ANGLE_DIR/src/libEGL/Config.h \
diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro
index b39ce781e1..5b3a49ed56 100644
--- a/src/angle/src/libGLESv2/libGLESv2.pro
+++ b/src/angle/src/libGLESv2/libGLESv2.pro
@@ -8,18 +8,18 @@ INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libGLESv2
# Remember to adapt tools/configure/configureapp.cpp if the Direct X version changes.
angle_d3d11 {
- LIBS += -ldxgi -ld3d11
+ LIBS_PRIVATE += -ldxgi -ld3d11
} else {
- LIBS += -ld3d9
+ LIBS_PRIVATE += -ld3d9
}
-LIBS += -ldxguid
+LIBS_PRIVATE += -ldxguid
STATICLIBS = translator_common translator_hlsl preprocessor
for(libname, STATICLIBS) {
# Appends 'd' to the library for debug builds and builds up the fully
# qualified path to pass to the linker.
staticlib = $$QT_BUILD_TREE/lib/$${QMAKE_PREFIX_STATICLIB}$$qtLibraryTarget($$libname).$${QMAKE_EXTENSION_STATICLIB}
- LIBS += $$staticlib
+ LIBS_PRIVATE += $$staticlib
PRE_TARGETDEPS += $$staticlib
}
diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro
index 53b6bd0472..2b8fef2d6a 100644
--- a/src/concurrent/concurrent.pro
+++ b/src/concurrent/concurrent.pro
@@ -39,5 +39,5 @@ HEADERS += \
HEADERS += \
contains(QT_CONFIG, clock-gettime) {
- linux-*|hpux-*|solaris-*:LIBS *= -lrt
+ linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt
}
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf
index 9d89192946..e45047cb51 100644
--- a/src/concurrent/doc/qtconcurrent.qdocconf
+++ b/src/concurrent/doc/qtconcurrent.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtConcurrent
description = Qt Concurrent Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtconcurrent
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = qtconcurrent
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
index 7160f80b34..9afcdc9740 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
@@ -136,7 +136,7 @@ bool QString::contains(const QRegExp &regexp) const;
//! [10]
-boost::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace
+std::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace
//! [10]
@@ -147,7 +147,7 @@ bool contains(const QString &string)
//! [12]
QStringList strings = ...;
-boost::bind(static_cast<bool(QString::*)(const QRegExp&)>( &QString::contains ), QRegExp("..." ));
+std::bind(static_cast<bool(QString::*)(const QRegExp&)>( &QString::contains ), QRegExp("..." ));
//! [12]
//! [13]
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
index 756ca3902c..634c03e808 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
@@ -149,7 +149,7 @@ QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const;
//! [11]
-boost::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation)
+std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation)
//! [11]
@@ -160,7 +160,7 @@ QImage scaledToWith(const QImage &image)
//! [13]
QList<QImage> images = ...;
-QFuture<QImage> thumbnails = QtConcurrent::mapped(images, boost::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation));
+QFuture<QImage> thumbnails = QtConcurrent::mapped(images, std::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation));
//! [13]
//! [14]
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
index 7288fc642b..8922e41f34 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp
@@ -93,6 +93,6 @@ future.waitForFinished();
//! [6]
void someFunction(int arg1, double arg2);
-QFuture<void> future = QtConcurrent::run(boost::bind(someFunction, 1, 2.0));
+QFuture<void> future = QtConcurrent::run(std::bind(someFunction, 1, 2.0));
...
//! [6]
diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp
index 22a1243c18..ab0227983d 100644
--- a/src/concurrent/qtconcurrentfilter.cpp
+++ b/src/concurrent/qtconcurrentfilter.cpp
@@ -40,15 +40,10 @@
****************************************************************************/
/*!
- \headerfile <QtConcurrentFilter>
+ \page qtconcurrentfilter.html
\title Concurrent Filter and Filter-Reduce
\ingroup thread
- \brief The <QtConcurrentFilter> header provides concurrent Filter and
- Filter-Reduce.
-
- These functions are a part of the \l {Qt Concurrent} framework.
-
The QtConcurrent::filter(), QtConcurrent::filtered() and
QtConcurrent::filteredReduced() functions filter items in a sequence such
as a QList or a QVector in parallel. QtConcurrent::filter() modifies a
@@ -56,6 +51,8 @@
containing the filtered content, and QtConcurrent::filteredReduced()
returns a single result.
+ These functions are a part of the \l {Qt Concurrent} framework.
+
Each of the above functions have a blocking variant that returns the final
result instead of a QFuture. You use them in the same way as the
asynchronous variants.
@@ -155,15 +152,11 @@
\section2 Using Bound Function Arguments
- Note that Qt does not provide support for bound functions. This is
- provided by 3rd party libraries like
- \l{http://www.boost.org/libs/bind/bind.html}{Boost} or
- \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {C++ TR1 Library Extensions}.
-
If you want to use a filter function takes more than one argument, you can
- use boost::bind() or std::tr1::bind() to transform it onto a function that
- takes one argument.
+ use std::bind() to transform it onto a function that takes one argument. If
+ C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
+ {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
+ {std::tr1::bind()} are suitable replacements.
As an example, we use QString::contains():
@@ -177,7 +170,7 @@
\snippet code/src_concurrent_qtconcurrentfilter.cpp 10
- The return value from boost::bind() is a function object (functor) with
+ The return value from std::bind() is a function object (functor) with
the following signature:
\snippet code/src_concurrent_qtconcurrentfilter.cpp 11
@@ -190,7 +183,6 @@
/*!
\fn QFuture<void> QtConcurrent::filter(Sequence &sequence, FilterFunction filterFunction)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true, the item is kept in \a sequence;
@@ -199,7 +191,6 @@
/*!
\fn QFuture<T> QtConcurrent::filtered(const Sequence &sequence, FilterFunction filterFunction)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item in \a sequence and returns a
new Sequence of kept items. If \a filterFunction returns \c true, a copy of
@@ -209,7 +200,6 @@
/*!
\fn QFuture<T> QtConcurrent::filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item from \a begin to \a end and
returns a new Sequence of kept items. If \a filterFunction returns \c true, a
@@ -219,7 +209,6 @@
/*!
\fn QFuture<T> QtConcurrent::filteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true for an item, that item is then passed to
@@ -236,7 +225,6 @@
/*!
\fn QFuture<T> QtConcurrent::filteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentFilter>
Calls \a filterFunction once for each item from \a begin to \a end. If
\a filterFunction returns \c true for an item, that item is then passed to
diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp
index da2a601ae2..fc904a4d59 100644
--- a/src/concurrent/qtconcurrentmap.cpp
+++ b/src/concurrent/qtconcurrentmap.cpp
@@ -68,14 +68,10 @@
*/
/*!
- \headerfile <QtConcurrentMap>
+ \page qtconcurrentmap.html
\title Concurrent Map and Map-Reduce
\ingroup thread
- \brief The <QtConcurrentMap> header provides concurrent Map and MapReduce.
-
- These functions are a part of the \l {Qt Concurrent} framework.
-
The QtConcurrent::map(), QtConcurrent::mapped() and
QtConcurrent::mappedReduced() functions run computations in parallel on
the items in a sequence such as a QList or a QVector. QtConcurrent::map()
@@ -83,6 +79,8 @@
sequence containing the modified content, and QtConcurrent::mappedReduced()
returns a single result.
+ These functions are a part of the \l {Qt Concurrent} framework.
+
Each of the above functions has a blocking variant that returns
the final result instead of a QFuture. You use them in the same
way as the asynchronous variants.
@@ -204,15 +202,11 @@
\section2 Using Bound Function Arguments
- Note that Qt does not provide support for bound functions. This is
- provided by 3rd party libraries like
- \l{http://www.boost.org/libs/bind/bind.html}{Boost} or
- \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}{C++
- TR1 Library Extensions}.
-
If you want to use a map function that takes more than one argument you can
- use boost::bind() or std::tr1::bind() to transform it onto a function that
- takes one argument.
+ use std::bind() to transform it onto a function that takes one argument. If
+ C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
+ {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
+ {std::tr1::bind()} are suitable replacements.
As an example, we'll use QImage::scaledToWidth():
@@ -226,7 +220,7 @@
\snippet code/src_concurrent_qtconcurrentmap.cpp 11
- The return value from boost::bind() is a function object (functor) with
+ The return value from std::bind() is a function object (functor) with
the following signature:
\snippet code/src_concurrent_qtconcurrentmap.cpp 12
@@ -239,7 +233,6 @@
/*!
\fn QFuture<void> QtConcurrent::map(Sequence &sequence, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item in \a sequence. The \a function is
passed a reference to the item, so that any modifications done to the item
@@ -248,7 +241,6 @@
/*!
\fn QFuture<void> QtConcurrent::map(Iterator begin, Iterator end, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item from \a begin to \a end. The
\a function is passed a reference to the item, so that any modifications
@@ -257,7 +249,6 @@
/*!
\fn QFuture<T> QtConcurrent::mapped(const Sequence &sequence, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item in \a sequence and returns a future
with each mapped item as a result. You can use QFuture::const_iterator or
@@ -266,7 +257,6 @@
/*!
\fn QFuture<T> QtConcurrent::mapped(ConstIterator begin, ConstIterator end, MapFunction function)
- \relates <QtConcurrentMap>
Calls \a function once for each item from \a begin to \a end and returns a
future with each mapped item as a result. You can use
@@ -278,8 +268,6 @@
MapFunction mapFunction, ReduceFunction reduceFunction,
QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item in \a sequence. The return value of
each \a mapFunction is passed to \a reduceFunction.
@@ -293,8 +281,6 @@
ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction,
QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item from \a begin to \a end. The return
value of each \a mapFunction is passed to \a reduceFunction.
@@ -361,8 +347,6 @@
/*!
\fn T QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item in \a sequence. The return value of
each \a mapFunction is passed to \a reduceFunction.
@@ -378,8 +362,6 @@
/*!
\fn T QtConcurrent::blockingMappedReduced(ConstIterator begin, ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
- \relates <QtConcurrentMap>
-
Calls \a mapFunction once for each item from \a begin to \a end. The return
value of each \a mapFunction is passed to \a reduceFunction.
diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h
index 29342e6402..b39b3ed32b 100644
--- a/src/concurrent/qtconcurrentmedian.h
+++ b/src/concurrent/qtconcurrentmedian.h
@@ -90,7 +90,7 @@ public:
dirty = true;
}
- values[currentIndex] = qMove(value);
+ values[currentIndex] = value;
}
bool isMedianValid() const
@@ -105,7 +105,7 @@ public:
QVector<T> copy = values;
typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end();
std::nth_element(begin, mid, end);
- currentMedian = qMove(*mid);
+ currentMedian = *mid;
}
return currentMedian;
}
diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp
index 4398e1a91f..c71fc9048f 100644
--- a/src/concurrent/qtconcurrentrun.cpp
+++ b/src/concurrent/qtconcurrentrun.cpp
@@ -40,19 +40,15 @@
****************************************************************************/
/*!
- \headerfile <QtConcurrentRun>
- \title Asynchronous Run
-
- \brief The <QtConcurrentRun> header provides a way to run a function in a
- separate thread.
-
+ \page qtconcurrentrun.html
+ \title Concurrent Run
\ingroup thread
- This function is a part of the \l {Qt Concurrent} framework.
-
The QtConcurrent::run() function runs a function in a separate thread.
The return value of the function is made available through the QFuture API.
+ This function is a part of the \l {Qt Concurrent} framework.
+
\section1 Running a Function in a Separate Thread
To run a function in another thread, use QtConcurrent::run():
@@ -110,15 +106,12 @@
\section2 Using Bound Function Arguments
- Note that Qt does not provide support for bound functions. This is
- provided by 3rd party libraries like
- \l{http://www.boost.org/libs/bind/bind.html}{Boost} or
- \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
- {C++ TR1 Library Extensions}.
+ You can use std::bind() to \e bind a number of arguments to a function when
+ called. If C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html}
+ {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}
+ {std::tr1::bind()} are suitable replacements.
- You can use boost::bind() or std::tr1::bind() to \e bind a number of
- arguments to a function when called. There are number of reasons for doing
- this:
+ There are number of reasons for binding:
\list
\li To call a function that takes more than 5 arguments.
@@ -136,7 +129,6 @@
/*!
\fn QFuture<T> QtConcurrent::run(Function function, ...);
- \relates <QtConcurrentRun>
Runs \a function in a separate thread. The thread is taken from the global
QThreadPool. Note that the function may not run immediately; the function
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 2d87783107..9bda70ec07 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -51,8 +51,9 @@ set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_MAJOR_VERSION 5)
+set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_COORD_TYPE $$QT_COORD_TYPE)
set_property(TARGET Qt5::Core APPEND PROPERTY
- COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION
+ COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION QT_COORD_TYPE
)
include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5CoreConfigExtrasMkspecDir.cmake\")
@@ -80,6 +81,12 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE)
!!ENDIF
+!!IF !isEmpty(CMAKE_DISABLED_FEATURES)
+set(Qt5_DISABLED_FEATURES
+ $$CMAKE_DISABLED_FEATURES
+)
+!!ENDIF
+
set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
!!IF contains(QT_CONFIG, reduce_exports)
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 42debea782..1c84e3dbc9 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -303,8 +303,6 @@ QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs)
/*!
\property QSequentialAnimationGroup::currentAnimation
Returns the animation in the current time.
-
- \sa currentAnimationChanged()
*/
QAbstractAnimation *QSequentialAnimationGroup::currentAnimation() const
{
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 1ed55bb0c8..b513149e7c 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -20,8 +20,7 @@ ANDROID_JAR_DEPENDENCIES = \
jar/QtAndroid.jar \
jar/QtAndroidAccessibility.jar
ANDROID_LIB_DEPENDENCIES = \
- plugins/platforms/android/libqtforandroid.so \
- libs/libgnustl_shared.so
+ plugins/platforms/android/libqtforandroid.so
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
jar/QtAndroid-bundled.jar \
jar/QtAndroidAccessibility-bundled.jar
@@ -49,7 +48,7 @@ mac|darwin {
LIBS_PRIVATE += -framework CoreServices
}
LIBS_PRIVATE += -framework CoreFoundation
- LIBS += -framework Foundation
+ LIBS_PRIVATE += -framework Foundation
}
win32:DEFINES-=QT_NO_CAST_TO_ASCII
DEFINES += $$MODULE_DEFINES
@@ -80,6 +79,9 @@ cmake_umbrella_config_version_file.input = $$PWD/../../mkspecs/features/data/cma
cmake_umbrella_config_version_file.output = $$DESTDIR/cmake/Qt5/Qt5ConfigVersion.cmake
load(cmake_functions)
+load(qfeatures)
+
+CMAKE_DISABLED_FEATURES = $$join(QT_DISABLED_FEATURES, "$$escape_expand(\\n) ")
CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA/src], $$[QT_INSTALL_PREFIX])
contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*"):!isEmpty(CMAKE_HOST_DATA_DIR) {
diff --git a/src/corelib/doc/images/thread_clock.png b/src/corelib/doc/images/thread_clock.png
deleted file mode 100644
index b8a8aa0a39..0000000000
--- a/src/corelib/doc/images/thread_clock.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/threadsandobjects.png b/src/corelib/doc/images/threadsandobjects.png
deleted file mode 100644
index 8357d2532a..0000000000
--- a/src/corelib/doc/images/threadsandobjects.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/threadvisual-example.png b/src/corelib/doc/images/threadvisual-example.png
deleted file mode 100644
index 2a49874719..0000000000
--- a/src/corelib/doc/images/threadvisual-example.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index fdd46995c5..9ab66c6645 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtCore
description = Qt Core Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtcore
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = core
@@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtcore/qtcore.tags
-depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner
+depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml
headerdirs += ..
diff --git a/src/corelib/doc/snippets/code/doc_src_resources.cpp b/src/corelib/doc/snippets/code/doc_src_resources.cpp
index 482c25a222..8ac7b0e970 100644
--- a/src/corelib/doc/snippets/code/doc_src_resources.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_resources.cpp
@@ -44,11 +44,24 @@ QResource::registerResource("/path/to/myresource.rcc");
//! [5]
+MyClass::MyClass() : BaseClass()
+{
+ Q_INIT_RESOURCE(resources);
+
+ QFile file("qrc:/myfile.dat");
+ ...
+}
+//! [5]
+
+
+//! [6]
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Q_INIT_RESOURCE(graphlib);
+
+ QFile file("qrc:/graph.png");
...
return app.exec();
}
-//! [5]
+//! [6]
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp
index 003fce580b..9210d2737f 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp
@@ -416,7 +416,7 @@ text.data(); // returns "Qt is great!"
//! [46]
QString tmp = "test";
QByteArray text = tmp.toLocal8Bit();
-char *data = new char[text.size()]
+char *data = new char[text.size()];
strcpy(data, text.data());
delete [] data;
//! [46]
@@ -424,7 +424,7 @@ delete [] data;
//! [47]
QString tmp = "test";
QByteArray text = tmp.toLocal8Bit();
-char *data = new char[text.size() + 1]
+char *data = new char[text.size() + 1];
strcpy(data, text.data());
delete [] data;
//! [47]
diff --git a/src/corelib/doc/snippets/qtracer/ftracer.cpp b/src/corelib/doc/snippets/qtracer/ftracer.cpp
deleted file mode 100644
index b12e3ed9c3..0000000000
--- a/src/corelib/doc/snippets/qtracer/ftracer.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <QCoreApplication>
-#include <QLoggingCategory>
-
-
-//![1]
-QLoggingCategory theFooArea("foo");
-QLoggingCategory theBarArea("bar");
-QLoggingCategory theBazArea("baz");
-//![1]
-
-// Note: These locations are Ubuntu specific.
-
-// Note: To make the example work with user permissions, make sure
-// the files are user-writable and the path leading there accessible.
-
-const char traceSwitch[] = "/sys/kernel/debug/tracing/tracing_on";
-const char traceSink[] = "/sys/kernel/debug/tracing/trace_marker";
-
-// The base class only serves as a facility to share code
-// between the "single line" data logging aspect and the
-// scoped "measuring" aspect.
-
-// Both aspects and the base class could be combined into
-// a single tracer serving both purposes, but are split
-// here for clarity.
-
-// Error handling is left as an exercise.
-
-//![2]
-class MyTracerBase : public QTracer
-{
-public:
- MyTracerBase() {
- enable = ::open(traceSwitch, O_WRONLY);
- marker = ::open(traceSink, O_WRONLY);
- }
-
- ~MyTracerBase() {
- ::close(enable);
- ::close(marker);
- }
-
-protected:
- int enable;
- int marker;
-};
-//![2]
-
-
-//![2]
-class MyTracer : public MyTracerBase
-{
-public:
- void start() { ::write(marker, "B", 1); }
- void end() { ::write(marker, "E", 1); }
-};
-//![2]
-
-
-//![3]
-class MyDataLogger : public MyTracerBase
-{
-public:
- MyDataLogger() {
- buf[0] = 0;
- pos = 0;
- }
-
- void record(int i) { pos += sprintf(buf + pos, "%d", i); }
- void record(const char *msg) { pos += sprintf(buf + pos, "%s", msg); }
- void end() { ::write(marker, buf, pos); pos = 0; }
-
-private:
- char buf[100];
- int pos;
-};
-//![3]
-
-// Simplest possible example for "measuring".
-//![4]
-int foo(int i)
-{
- qCTraceGuard(theFooArea);
- // Here could be some lengthy code.
- return i * i;
-}
-//![4]
-
-// We can switch on/off tracing dynamically.
-// The tracer will be temporarily switched off at the third call
-// and re-enabled at the eighth.
-//![5]
-int bar(int i)
-{
- static int n = 0;
- ++n;
- if (n == 3)
- theBarArea.setEnabled(QtTraceMsg, false);
- if (n == 8)
- theBarArea.setEnabled(QtTraceMsg, true);
-
- qCTraceGuard(theBarArea);
- return i * i;
-}
-//![5]
-
-// An example to create "complex" log messages.
-//![6]
-int baz(int i)
-{
- qCTrace(theBazArea) << 32 << "some stuff";
-
- return i * i;
-}
-//![6]
-
-
-
-//![7]
-namespace {
-static struct Init
-{
- Init() {
- tracer.addToCategory(theFooArea);
- tracer.addToCategory(theBarArea);
- logger.addToCategory(theBazArea);
- }
-
- MyTracer tracer;
- MyDataLogger logger;
-
-} initializer;
-}
-//![7]
diff --git a/src/corelib/doc/snippets/qtracer/main.cpp b/src/corelib/doc/snippets/qtracer/main.cpp
deleted file mode 100644
index 758a2bbdb8..0000000000
--- a/src/corelib/doc/snippets/qtracer/main.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-int foo(int i);
-int bar(int i);
-int baz(int i);
-
-int main()
-{
- int s = 0;
- for (int i = 0; i != 10; ++i)
- s += foo(i);
-
- for (int i = 0; i != 10; ++i)
- s += bar(i);
-
- for (int i = 0; i != 10; ++i)
- s += baz(i);
-
- return s;
-}
-
diff --git a/src/corelib/doc/snippets/qtracer/qtracer.pro b/src/corelib/doc/snippets/qtracer/qtracer.pro
deleted file mode 100644
index 254e22be76..0000000000
--- a/src/corelib/doc/snippets/qtracer/qtracer.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-
-SOURCES += ftracer.cpp main.cpp
diff --git a/src/corelib/doc/src/custom-types.qdoc b/src/corelib/doc/src/custom-types.qdoc
index cbf347a2f7..ed846aee83 100644
--- a/src/corelib/doc/src/custom-types.qdoc
+++ b/src/corelib/doc/src/custom-types.qdoc
@@ -155,10 +155,9 @@
The Q_DECLARE_METATYPE() macro and qRegisterMetaType() function documentation
contain more detailed information about their uses and limitations.
- The \l{Custom Type Example}{Custom Type},
- \l{Custom Type Sending Example}{Custom Type Sending}
- and \l{Queued Custom Type Example}{Queued Custom Type} examples show how to
- implement a custom type with the features outlined in this document.
+ The \l{Custom Type Example}{Custom Type} and \l{Queued Custom Type Example}
+ {Queued Custom Type} examples show how to implement a custom type with the
+ features outlined in this document.
The \l{Debugging Techniques} document provides an overview of the debugging
mechanisms discussed above.
diff --git a/src/corelib/doc/src/objectmodel/object.qdoc b/src/corelib/doc/src/objectmodel/object.qdoc
index 89a781da39..8d24096b7a 100644
--- a/src/corelib/doc/src/objectmodel/object.qdoc
+++ b/src/corelib/doc/src/objectmodel/object.qdoc
@@ -46,7 +46,8 @@
\li queryable and designable \l{Qt's Property System}{object
properties}
\li powerful \l{The Event System}{events and event filters}
- \li contextual \l{i18n}{string translation for internationalization}
+ \li contextual \l{Internationalization with Qt}{string translation for
+ internationalization}
\li sophisticated interval driven \l {Timers}{timers} that make it possible
to elegantly integrate many tasks in an event-driven GUI
\li hierarchical and queryable \l{Object Trees & Ownership}{object
diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
index dd93b80cae..e894d547d0 100644
--- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
+++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
@@ -275,7 +275,7 @@
and slot members, as well as pointers to these functions.
The meta-object contains additional information such as the
- object's \l{QObject::className()}{class name}. You can
+ object's \l{QMetaObject::className()}{class name}. You can
also check if an object \l{QObject::inherits()}{inherits}
a specific class, for example:
diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc
index 2dbf1f8141..7565d610cc 100644
--- a/src/corelib/doc/src/plugins-howto.qdoc
+++ b/src/corelib/doc/src/plugins-howto.qdoc
@@ -35,10 +35,7 @@
These \l{Qt Core} classes deal with shared libraries, (e.g. .so and DLL
files), and with Qt plugins.
- See the \l{How to Create Qt Plugins} page for more information..
-
- See also the \l{ActiveQt framework} for Windows.
-
+ See the \l{How to Create Qt Plugins} page for more information.
*/
/*!
diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc
index 5ef6bb285c..91ce8afcf8 100644
--- a/src/corelib/doc/src/resource-system.qdoc
+++ b/src/corelib/doc/src/resource-system.qdoc
@@ -184,15 +184,39 @@
path list is empty at startup; call QDir::addSearchPath() to
add paths to it.
- If you have resources in a static library, you might need to
- force initialization of your resources by calling \l
- Q_INIT_RESOURCE() with the base name of the \c .qrc file. For
- example:
+ \section1 Using Resources in a Library
+
+ If you have resources in a library, you need to force initialization
+ of your resources by calling \l Q_INIT_RESOURCE() with the base name
+ of the \c .qrc file. For example:
\snippet code/doc_src_resources.cpp 5
+ This ensures that the resources are linked into the final application
+ binary in the case of static linking. You should put the initialization
+ code close to where the resources are used in your library, so that
+ clients of your library will only link in the resources if they use
+ the feature of the library that depends on them.
+
+ Note: As the resource initializers generated by rcc are declared in the
+ global namespace, your calls to \l Q_INIT_RESOURCE() also need to be done
+ outside of any namespace.
+
+ If the library includes resources that are not used internally, but
+ instead exposed to clients of the library, the initialization needs
+ to happen in the application code. For example:
+
+ \snippet code/doc_src_resources.cpp 6
+
+ As before, this ensures that the resources are linked into the final
+ application binary in the case of static linking, but also triggers
+ loading of the library in the case of dynamic linking, such as plugins.
+
Similarly, if you must unload a set of resources explicitly
(because a plugin is being unloaded or the resources are not valid
any longer), you can force removal of your resources by calling
- Q_CLEANUP_RESOURCE() with the same base name as above.
+ \l Q_CLEANUP_RESOURCE() with the same base name as above.
+
+ Note: The use of \l Q_INIT_RESOURCE() and \l Q_CLEANUP_RESOURCE() is
+ not necessary when the resource is built as part of the application.
*/
diff --git a/src/corelib/doc/src/threads-basics.qdoc b/src/corelib/doc/src/threads-basics.qdoc
deleted file mode 100644
index 4f381421b4..0000000000
--- a/src/corelib/doc/src/threads-basics.qdoc
+++ /dev/null
@@ -1,365 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page thread-basics.html
- \ingroup tutorials
- \startpage {index.html}{Qt Reference Documentation}
-
- \title Threading Basics
- \brief An introduction to threads
-
- \section1 What Are Threads?
-
- Threads are about doing things in parallel, just like processes. So how do
- threads differ from processes? While you are making calculations on a
- spreadsheet, there may also be a media player running on the same desktop
- playing your favorite song. Here is an example of two processes working in
- parallel: one running the spreadsheet program; one running a media player.
- Multitasking is a well known term for this. A closer look at the media
- player reveals that there are again things going on in parallel within one
- single process. While the media player is sending music to the audio driver,
- the user interface with all its bells and whistles is being constantly
- updated. This is what threads are for -- concurrency within one single
- process.
-
- So how is concurrency implemented? Parallel work on single core CPUs is an
- illusion which is somewhat similar to the illusion of moving images in
- cinema.
- For processes, the illusion is produced by interrupting the processor's
- work on one process after a very short time. Then the processor moves on to
- the next process. In order to switch between processes, the current program
- counter is saved and the next processor's program counter is loaded. This
- is not sufficient because the same needs to be done with registers and
- certain architecture and OS specific data.
-
- Just as one CPU can power two or more processes, it is also possible to let
- the CPU run on two different code segments of one single process. When a
- process starts, it always executes one code segment and therefore the
- process is said to have one thread. However, the program may decide to
- start a second thread. Then, two different code sequences are processed
- simultaneously inside one process. Concurrency is achieved on single core
- CPUs by repeatedly saving program counters and registers then loading the
- next thread's program counters and registers. No cooperation from the
- program is required to cycle between the active threads. A thread may be in
- any state when the switch to the next thread occurs.
-
- The current trend in CPU design is to have several cores. A typical
- single-threaded application can make use of only one core. However, a
- program with multiple threads can be assigned to multiple cores, making
- things happen in a truly concurrent way. As a result, distributing work
- to more than one thread can make a program run much faster on multicore
- CPUs because additional cores can be used.
-
- \section2 GUI Thread and Worker Thread
-
- As mentioned, each program has one thread when it is started. This thread
- is called the "main thread" (also known as the "GUI thread" in Qt
- applications). The Qt GUI must run in this thread. All widgets and several
- related classes, for example QPixmap, don't work in secondary threads.
- A secondary thread is commonly referred to as a "worker thread" because it
- is used to offload processing work from the main thread.
-
- \section2 Simultaneous Access to Data
-
- Each thread has its own stack, which means each thread has its own call
- history and local variables. Unlike processes, threads share the same
- address space. The following diagram shows how the building blocks of
- threads are located in memory. Program counter and registers of inactive
- threads are typically kept in kernel space. There is a shared copy of the
- code and a separate stack for each thread.
-
- \image threadvisual-example.png "Thread visualization"
-
- If two threads have a pointer to the same object, it is possible that both
- threads will access that object at the same time and this can potentially
- destroy the object's integrity. It's easy to imagine the many things that
- can go wrong when two methods of the same object are executed
- simultaneously.
-
- Sometimes it is necessary to access one object from different threads;
- for example, when objects living in different threads need to communicate.
- Since threads use the same address space, it is easier and faster for
- threads to exchange data than it is for processes. Data does not have to be
- serialized and copied. Passing pointers is possible, but there must be a
- strict coordination of what thread touches which object. Simultaneous
- execution of operations on one object must be prevented. There are several
- ways of achieving this and some of them are described below.
-
- So what can be done safely? All objects created in a thread can be used
- safely within that thread provided that other threads don't have references
- to them and objects don't have implicit coupling with other threads. Such
- implicit coupling may happen when data is shared between instances as with
- static members, singletons or global data. Familiarize yourself with the
- concept of \l{Reentrancy and Thread-Safety}{thread safe and reentrant}
- classes and functions.
-
- \section1 Using Threads
-
- There are basically two use cases for threads:
-
- \list
- \li Make processing faster by making use of multicore processors.
- \li Keep the GUI thread or other time critical threads responsive by
- offloading long lasting processing or blocking calls to other threads.
- \endlist
-
- \section2 When to Use Alternatives to Threads
-
- Developers need to be very careful with threads. It is easy to start other
- threads, but very hard to ensure that all shared data remains consistent.
- Problems are often hard to find because they may only show up once in a
- while or only on specific hardware configurations. Before creating threads
- to solve certain problems, possible alternatives should be considered.
-
- \table
- \header
- \li Alternative
- \li Comment
- \row
- \li QEventLoop::processEvents()
- \li Calling QEventLoop::processEvents() repeatedly during a
- time-consuming calculation prevents GUI blocking. However, this
- solution doesn't scale well because the call to processEvents() may
- occur too often, or not often enough, depending on hardware.
- \row
- \li QTimer
- \li Background processing can sometimes be done conveniently using a
- timer to schedule execution of a slot at some point in the future.
- A timer with an interval of 0 will time out as soon as there are no
- more events to process.
- \row
- \li QSocketNotifier QNetworkAccessManager QIODevice::readyRead()
- \li This is an alternative to having one or multiple threads, each with
- a blocking read on a slow network connection. As long as the
- calculation in response to a chunk of network data can be executed
- quickly, this reactive design is better than synchronous waiting in
- threads. Reactive design is less error prone and energy efficient
- than threading. In many cases there are also performance benefits.
- \endtable
-
- In general, it is recommended to only use safe and tested paths and to
- avoid introducing ad-hoc threading concepts. The QtConcurrent module provides an easy
- interface for distributing work to all of the processor's cores. The
- threading code is completely hidden in the QtConcurrent framework, so you
- don't have to take care of the details. However, QtConcurrent can't be used
- when communication with the running thread is needed, and it shouldn't be
- used to handle blocking operations.
-
- \section2 Which Qt Thread Technology Should You Use?
-
- See the \l{Multithreading Technologies in Qt} page for an introduction to the
- different approaches to multithreading to Qt, and for guidelines on how to
- choose among them.
-
-
- \section1 Qt Thread Basics
-
- The following sections describe how QObjects interact with threads, how
- programs can safely access data from multiple threads, and how asynchronous
- execution produces results without blocking a thread.
-
- \section2 QObject and Threads
-
- As mentioned above, developers must always be careful when calling objects'
- methods from other threads. \l{QObject#Thread Affinity}{Thread affinity}
- does not change this situation.
- Qt documentation marks several methods as thread-safe.
- \l{QCoreApplication::}{postEvent()} is a noteworthy example. A thread-safe
- method may be called from different threads simultaneously.
-
- In cases where there is usually no concurrent access to methods, calling
- non-thread-safe methods of objects in other threads may work thousands
- of times before a concurrent access occurs, causing unexpected behavior.
- Writing test code does not entirely ensure thread correctness, but it is
- still important.
- On Linux, Valgrind and Helgrind can help detect threading errors.
-
- \section2 Protecting the Integrity of Data
-
- When writing a multithread application, extra care must be taken to avoid
- data corruption. See \l{Synchronizing Threads} for a discussion on how to
- use threads safely.
-
- \section2 Dealing with Asynchronous Execution
-
- One way to obtain a worker thread's result is by waiting for the thread
- to terminate. In many cases, however, a blocking wait isn't acceptable. The
- alternative to a blocking wait are asynchronous result deliveries with
- either posted events or queued signals and slots. This generates a certain
- overhead because an operation's result does not appear on the next source
- line, but in a slot located somewhere else in the source file. Qt
- developers are used to working with this kind of asynchronous behavior
- because it is much similar to the kind of event-driven programming used in
- GUI applications.
-
- \section1 Examples
-
- This tutorial comes with examples for Qt's three basic ways of working with
- threads. Two more examples show how to communicate with a running thread
- and how a QObject can be placed in another thread, providing service to the
- main thread.
-
- \list
- \li Using QThread as shown \l{Qt thread basics}{above}
- \li \l{Example 1: Using the Thread Pool}{Using the global QThreadPool}
- \li \l{Example 2: Using QtConcurrent}{Using QtConcurrent}
- \li \l{Example 3: Clock}{Communication with the GUI thread}
- \li \l{Example 4: A Permanent Thread}{A permanent QObject in another thread
- provides service to the main thread}
- \endlist
-
- The following examples can all be compiled and run independently. The source can
- be found in the examples directory: examples/tutorials/threads/
-
- \section2 Example 1: Using the Thread Pool
-
- Creating and destroying threads frequently can be expensive. To avoid the
- cost of thread creation, a thread pool can be used. A thread pool is a
- place where threads can be parked and fetched. We can write the same
- "hello thread" program as \l{Qt Thread Basics}{above} using the global
- thread pool. We derive a class from QRunnable. The code we want to run in
- another thread needs to be placed in the reimplemented QRunnable::run()
- method.
-
- \snippet ../widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp 1
-
- We instantiate Work in main(), locate the global thread pool and use the
- QThreadPool::start() method. Now the thread pool runs our worker in another
- thread. Using the thread pool has a performance advantage because threads
- are not destroyed after they have finished running. They are kept in a pool
- and wait to be used again later.
-
- \section2 Example 2: Using QtConcurrent
-
- \snippet ../widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp 1
-
- We write a global function hello() to implement the work. QtConcurrent::run()
- is used to run the function in another thread. The result is a QFuture.
- QFuture provides a method called \l{QFuture::}{waitForFinished()}, which
- blocks until the calculation is completed. The real power of QtConcurrent
- becomes visible when data can be made available in a container. QtConcurrent
- provides several functions that are able to process itemized data on all
- available cores simultaneously. The use of QtConcurrent is very similar to
- applying an STL algorithm to an STL container.
- \l{examples-threadandconcurrent.html}{QtConcurrent Map} is a very short and
- clear example about how a container of images can be scaled on all available
- cores. The image scaling example uses the blocking variants of the functions
- used. For every blocking function there is also a non-blocking, asynchronous
- counterpart. Getting results asynchronously is implemented with QFuture and
- QFutureWatcher.
-
- \section2 Example 3: Clock
-
- \image thread_clock.png "clock"
-
- We want to produce a clock application. The application has a GUI and a
- worker thread. The worker thread checks every 10 milliseconds what time it
- is. If the formatted time has changed, the result will be sent to the GUI
- thread where it is displayed.
-
- Of course, this is an overly complicated way of designing a clock and,
- actually, a separate thread is unnecessary. We would be better off placing
- the timer in the main thread because the calculation made in the timer slot
- is very short-lived. This example is purely for instructional use and shows
- how to communicate from a worker thread to a GUI thread. Note that
- communication in this direction is easy. We only need to add a signal
- to QThread and make a queued signal/slot connection to the main thread.
- Communication from the GUI to the worker thread is shown in the next
- example.
-
- \snippet ../widgets/tutorials/threads/clock/main.cpp 1
-
- We've connected the \c clockThread with the label. The connection must be a
- queued signal-slot connection because we want to put the call in the event
- loop.
-
- \snippet ../widgets/tutorials/threads/clock/clockthread.h 1
-
- We have derived a class from QThread and declared the \c sendTime() signal.
-
- \snippet ../widgets/tutorials/threads/clock/clockthread.cpp 1
-
- The trickiest part of this example is that the timer is connected to its
- slot via a direct connection. A default connection would produce a queued
- signal-slot connection because the connected objects live in different
- threads; remember that QThread does not live in the thread it creates.
-
- Still it is safe to access ClockThread::timerHit() from the worker thread
- because ClockThread::timerHit() is private and only touches local variables
- and a private member that isn't touched by public methods.
- QDateTime::currentDateTime() isn't marked as thread-safe in Qt
- documentation, however we can get away with using it in this small
- example because we know that the QDateTime::currentDateTime() static
- method isn't used in any other threads.
-
- \section2 Example 4: A Permanent Thread
-
- This example shows how it is possible to have a QObject in a worker thread
- that accepts requests from the GUI thread, does polling using a timer and
- continuously reports results back to the GUI thread. The actual work
- including the polling must be implemented in a class derived from QObject.
- We have called this class \c WorkerObject in the code shown below. The
- thread-specific code is hidden in a class called \c Thread, derived from
- QThread.
- \c Thread has two additional public members. The \c launchWorker() member
- takes the worker object and moves it to another thread with a started event
- loop.
- The call blocks for a very short moment until the thread creation operation
- is completed, allowing the worker object to be used again on the next line.
- The \c Thread class's code is short but somewhat involved, so we only show
- how to use the class.
-
- \snippet ../widgets/tutorials/threads/movedobject/main.cpp 1
-
- QMetaObject::invokeMethod() calls a slot via the event loop. The worker
- object's methods should not be called directly after the object has been
- moved to another thread. We let the worker thread do some work and polling,
- and use a timer to shut the application down after 3 seconds. Shutting the
- worker down needs some care. We call \c{Thread::stop()} to exit the event
- loop. We wait for the thread to terminate and, after this has occurred, we
- delete the worker.
-
- \section1 Digging Deeper
-
- Threading is a very complicated subject. Qt offers more classes for
- threading than we have presented in this tutorial. The following materials
- can help you go into the subject in more depth:
-
- \list
- \li Good video tutorials about threads with Qt can be found in the material
- from the \l{Training Day at Qt Developer Days 2009}.
- \li The \l{Thread Support in Qt} document is a good starting point into
- the reference documentation.
- \li Qt comes with several additional examples for
- \l{Threading and Concurrent Programming Examples}{QThread and QtConcurrent}.
- \li Several good books describe how to work with Qt threads. The most
- extensive coverage can be found in \e{Advanced Qt Programming} by Mark
- Summerfield, Prentice Hall - roughly 70 of 500 pages cover QThread and
- QtConcurrent.
- \endlist
-*/
diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc
deleted file mode 100644
index 890fd9f6ff..0000000000
--- a/src/corelib/doc/src/threads.qdoc
+++ /dev/null
@@ -1,828 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \group thread
- \title Threading Classes
-
- These \l{Qt Core} classes provide threading support to applications.
- The \l{Thread Support in Qt} page covers how to use these classes.
-*/
-
-/*!
- \page threads.html
- \title Thread Support in Qt
- \ingroup qt-basic-concepts
- \brief A detailed discussion of thread handling in Qt.
-
- \ingroup frameworks-technologies
-
- \nextpage Multithreading Technologies in Qt
-
- Qt provides thread support in the form of platform-independent
- threading classes, a thread-safe way of posting events, and
- signal-slot connections across threads. This makes it easy to
- develop portable multithreaded Qt applications and take advantage
- of multiprocessor machines. Multithreaded programming is also a
- useful paradigm for performing time-consuming operations without
- freezing the user interface of an application.
-
- Earlier versions of Qt offered an option to build the library
- without thread support. Since Qt 4.0, threads are always enabled.
-
- \section1 Topics:
-
- \list
- \li \l{Recommended Reading}
- \li \l{The Threading Classes}
- \li \l{Multithreading Technologies in Qt}
- \li \l{Synchronizing Threads}
- \li \l{Reentrancy and Thread-Safety}
- \li \l{Threads and QObjects}
- \li \l{Thread-Support in Qt Modules}
- \endlist
-
- \section1 Recommended Reading
-
- This document is intended for an audience that has knowledge of,
- and experience with, multithreaded applications. If you are new
- to threading see our Recommended Reading list:
-
- \list
- \li \l {http://www.amazon.com/Threads-Primer-Guide-Multithreaded-Programming/dp/0134436989}{Threads Primer: A Guide to Multithreaded Programming}
- \li \l {http://www.amazon.com/Thread-Time-MultiThreaded-Programming-Guide/dp/0131900676}{Thread Time: The Multithreaded Programming Guide}
- \li \l {http://www.amazon.com/Pthreads-Programming-Standard-Multiprocessing-Nutshell/dp/1565921151a}{Pthreads Programming: A POSIX Standard for Better Multiprocessing}
- \li \l {http://www.amazon.com/WIN32-Multithreaded-Programming-Aaron-Cohen/dp/1565922964}{Win32 Multithreaded Programming}
- \endlist
-
- \section1 The Threading Classes
-
- These classes are relevant to threaded applications.
-
- \annotatedlist thread
-
-\omit
- \list
- \li QThread provides the means to start a new thread.
- \li QThreadStorage provides per-thread data storage.
- \li QThreadPool manages a pool of threads that run QRunnable objects.
- \li QRunnable is an abstract class representing a runnable object.
- \li QMutex provides a mutual exclusion lock, or mutex.
- \li QMutexLocker is a convenience class that automatically locks
- and unlocks a QMutex.
- \li QReadWriteLock provides a lock that allows simultaneous read access.
- \li QReadLocker and QWriteLocker are convenience classes that automatically
- lock and unlock a QReadWriteLock.
- \li QSemaphore provides an integer semaphore (a generalization of a mutex).
- \li QWaitCondition provides a way for threads to go to sleep until
- woken up by another thread.
- \li QAtomicInt provides atomic operations on integers.
- \li QAtomicPointer provides atomic operations on pointers.
- \endlist
-\endomit
-
- \note Qt's threading classes are implemented with native threading APIs;
- e.g., Win32 and pthreads. Therefore, they can be used with threads of the
- same native API.
-*/
-
-/*!
- \page threads-technologies.html
- \title Multithreading Technologies in Qt
- \ingroup qt-basic-concepts
- \brief An overview and comparison of different ways to use threads in Qt.
-
- \ingroup frameworks-technologies
-
- \contentspage Thread Support in Qt
- \previouspage Thread Support in Qt
- \nextpage Synchronizing Threads
-
- Qt offers many classes and functions for working with threads. Below are
- four different approaches that Qt programmers can use to implement
- multithreaded applications.
-
-
- \section1 QThread: Low-Level API with Optional Event Loops
-
- QThread is the foundation of all thread control in Qt. Each QThread
- instance represents and controls one thread.
-
- QThread can either be instantiated directly or subclassed. Instantiating a
- QThread provides a parallel event loop, allowing QObject slots to be invoked
- in a secondary thread. Subclassing a QThread allows the application to initialize
- the new thread before starting its event loop, or to run parallel code
- without an event loop.
-
- See the \l{QThread}{QThread class reference} and the \l{Threading and
- Concurrent Programming Examples}{threading examples} for demonstrations on
- how to use QThread.
-
-
- \section1 QThreadPool and QRunnable: Reusing Threads
-
- Creating and destroying threads frequently can be expensive. To reduce this
- overhead, existing threads can be reused for new tasks. QThreadPool is a
- collection of reuseable QThreads.
-
- To run code in one of a QThreadPool's threads, reimplement QRunnable::run()
- and instantiate the subclassed QRunnable. Use QThreadPool::start() to put
- the QRunnable in the QThreadPool's run queue. When a thread becomes available,
- the code within QRunnable::run() will execute in that thread.
-
- Each Qt application has a global thread pool, which is accessible through
- QThreadPool::globalInstance(). This global thread pool automatically maintains
- an optimal number of threads based on the number of cores in the CPU. However,
- a separate QThreadPool can be created and managed explicitly.
-
-
- \section1 Qt Concurrent: Using a High-level API
-
- The \l{Qt Concurrent} module provides high-level functions that deal with some
- common parallel computation patterns: map, filter, and reduce. Unlike using
- QThread and QRunnable, these functions never require the use of \l{Synchronizing
- Threads#Low-Level Synchronization Primitives}{low-level threading primitives}
- such as mutexes or semaphores. Instead, they return a QFuture object which can
- be used to retrieve the functions' results when they are ready. QFuture can
- also be used to query computation progress and to pause/resume/cancel the
- computation. For convenience, QFutureWatcher enables interactions with
- \l{QFuture}s via signals and slots.
-
- \l{Qt Concurrent}'s map, filter and reduce algorithms automatically distribute
- computation across all available processor cores, so applications written today
- will continue to scale when deployed later on a system with more cores.
-
- This module also provides the QtConcurrent::run() function, which can run any
- function in another thread. However, QtConcurrent::run() only supports a subset
- of features available to the map, filter and reduce functions. The QFuture
- can be used to retrieve the function's return value and to check if the thread
- is running. However, a call to QtConcurrent::run() uses one thread only, cannot
- be paused/resumed/canceled, and cannot be queried for progress.
-
- See the \l{Qt Concurrent} module documentation for details on the individual functions.
-
-
- \section1 WorkerScript: Threading in QML
-
- The WorkerScript QML type lets JavaScript code run in parallel with the GUI
- thread.
-
- Each WorkerScript instance can have one \c{.js} script attached to it. When
- WorkerScript::sendMessage() is called, the script will run in a separate thread
- (and a separate \l{QQmlContext}{QML context}). When the script finishes
- running, it can send a reply back to the GUI thread which will invoke the
- WorkerScript::onMessage() signal handler.
-
- Using a WorkerScript is similar to using a worker QObject that has been moved
- to another thread. Data is transferred between threads via signals.
-
- See the WorkerScript documentation for details on how to implement the script,
- and for a list of data types that can be passed between threads.
-
-
- \section1 Choosing an Appropriate Approach
-
- As demonstrated above, Qt provides different solutions for developing threaded
- applications. The right solution for a given application depends on the purpose
- of the new thread and the thread's lifetime. Below is a comparison of Qt's
- threading technologies, followed by recommended solutions for some example use cases.
-
- \section2 Comparison of Solutions
-
- \table
- \header
- \li Feature
- \li QThread
- \li QRunnable and QThreadPool
- \li QtConcurrent::run()
- \li Qt Concurrent (Map, Filter, Reduce)
- \li WorkerScript
- \row
- \li API
- \li C++
- \li C++
- \li C++
- \li C++
- \li QML
- \row
- \li Thread priority can be specified
- \li Yes
- \li Yes
- \li
- \li
- \li
- \row
- \li Thread can run an event loop
- \li Yes
- \li
- \li
- \li
- \li
- \row
- \li Thread can receive data updates through signals
- \li Yes (received by a worker QObject)
- \li
- \li
- \li
- \li Yes (received by WorkerScript)
- \row
- \li Thread can be controlled using signals
- \li Yes (received by QThread)
- \li
- \li
- \li Yes (received by QFutureWatcher)
- \li
- \row
- \li Thread can be monitored through a QFuture
- \li
- \li
- \li Partially
- \li Yes
- \li
- \row
- \li Built-in ability to pause/resume/cancel
- \li
- \li
- \li
- \li Yes
- \li
- \endtable
-
-
- \section2 Example Use Cases
-
- \table
- \header
- \li Lifetime of thread
- \li Operation
- \li Solution
- \row
- \li One call
- \li Run a new linear function within another thread, optionally with progress
- updates during the run.
- \li Qt provides different solutions:
- \list
- \li Place the function in a reimplementation of QThread::run() and
- start the QThread. Emit signals to update progress. OR
- \li Place the function in a reimplementation of QRunnable::run() and
- add the QRunnable to a QThreadPool. Write to a \l{Synchronizing
- Threads}{thread-safe variable} to update progress. OR
- \li Run the function using QtConcurrent::run(). Write to a \l{Synchronizing
- Threads}{thread-safe variable} to update progress.
- \endlist
- \row
- \li One call
- \li Run an existing function within another thread and get its return value.
- \li Run the function using QtConcurrent::run(). Have a QFutureWatcher emit
- the \l{QFutureWatcher::}{finished()} signal when the function has
- returned, and call QFutureWatcher::result() to get the function's return
- value.
- \row
- \li One call
- \li Perform an operation on all items of a container, using all available
- cores. For example, producing thumbnails from a list of images.
- \li Use Qt Concurrent's \l{QtConcurrent::}{filter()} function to select
- container elements, and the \l{QtConcurrent::}{map()} function to apply
- an operation to each element. To fold the output into a single result,
- use \l{QtConcurrent::}{filteredReduced()} and
- \l{QtConcurrent::}{mappedReduced()} instead.
- \row
- \li One call/Permanent
- \li Perfrom a long computation in a pure QML application, and update the GUI
- when the results are ready.
- \li Place the computation code in a \c{.js} script and attach it to a
- WorkerScript instance. Call \l{WorkerScript::}{sendMessage()} to start the
- computation in a new thread. Let the script call WorkerScript::sendMessage()
- too, to pass the result back to the GUI thread. Handle the result in
- \l{WorkerScript::}{onMessage} and update the GUI there.
- \row
- \li Permanent
- \li Have an object living in another thread that can perform different
- tasks upon request and/or can receive new data to work with.
- \li Subclass a QObject to create a worker. Instantiate this worker object
- and a QThread. Move the worker to the new thread. Send commands or
- data to the worker object over queued signal-slot connections.
- \row
- \li Permanent
- \li Repeatedly perform an expensive operation in another thread, where the
- thread does not need to receive any signals or events.
- \li Write the infinite loop directly within a reimplementation of QThread::run().
- Start the thread without an event loop. Let the thread emit signals to
- send data back to the GUI thread.
- \endtable
-*/
-
-/*!
- \page threads-synchronizing.html
- \title Synchronizing Threads
-
- \previouspage Multithreading Technologies in Qt
- \contentspage Thread Support in Qt
- \nextpage Reentrancy and Thread-Safety
-
- While the purpose of threads is to allow code to run in parallel,
- there are times where threads must stop and wait for other
- threads. For example, if two threads try to write to the same
- variable simultaneously, the result is undefined. The principle of
- forcing threads to wait for one another is called \e{mutual exclusion}.
- It is a common technique for protecting shared resources such as data.
-
- Qt provides low-level primitives as well as high-level mechanisms
- for synchronizing threads.
-
- \section1 Low-Level Synchronization Primitives
-
- QMutex is the basic class for enforcing mutual exclusion. A thread
- locks a mutex in order to gain access to a shared resource. If a second
- thread tries to lock the mutex while it is already locked, the second
- thread will be put to sleep until the first thread completes its task
- and unlocks the mutex.
-
- QReadWriteLock is similar to QMutex, except that it distinguishes
- between "read" and "write" access. When a piece of data is not being
- written to, it is safe for multiple threads to read from it simultaneously.
- A QMutex forces multiple readers to take turns to read shared data, but a
- QReadWriteLock allows simultaneous reading, thus improving parallelism.
-
- QSemaphore is a generalization of QMutex that protects a certain
- number of identical resources. In contrast, a QMutex protects
- exactly one resource. The \l{Semaphores Example} shows a typical application
- of semaphores: synchronizing access to a circular buffer between a producer
- and a consumer.
-
- QWaitCondition synchronizes threads not by enforcing mutual exclusion but by
- providing a \e{condition variable}. While the other primitives make threads
- wait until a resource is unlocked, QWaitCondition makes threads wait until a
- particular condition has been met. To allow the waiting threads to proceed,
- call \l{QWaitCondition::wakeOne()}{wakeOne()} to wake one randomly
- selected thread or \l{QWaitCondition::wakeAll()}{wakeAll()} to wake them all
- simultaneously. The \l{Wait Conditions Example} shows how to solve the
- producer-consumer problem using QWaitCondition instead of QSemaphore.
-
- \note Qt's synchronization classes rely on the use of properly
- aligned pointers. For instance, you cannot use packed classes with
- MSVC.
-
- These synchronization classes can be used to make a method thread safe.
- However, doing so incurs a performance penalty, which is why most Qt methods
- are not made thread safe.
-
- \section2 Risks
-
- If a thread locks a resource but does not unlock it, the application may
- freeze because the resource will become permanently unavailable to other threads.
- This can happen, for example, if a an exception is thrown and forces the current
- function to return without releasing its lock.
-
- Another similar scenario is a \e{deadlock}. For example, suppose that
- thread A is waiting for thread B to unlock a resource. If thread B is also
- waiting for thread A to unlock a different resource, then both threads will
- end up waiting forever, so the application will freeze.
-
- \section2 Convenience classes
-
- QMutexLocker, QReadLocker and QWriteLocker are convenience classes that make it
- easier to use QMutex and QReadWriteLock. They lock a resource when they are
- constructed, and automatically unlock it when they are destroyed. They are
- designed to simplify code that use QMutex and QReadWriteLocker, thus reducing
- the chances that a resource becomes permanently locked by accident.
-
- \section1 High-Level Event Queues
-
- Qt's \l{The Event System}{event system} is very useful for inter-thread
- communication. Every thread may have its own event loop. To call a slot (or
- any \l{Q_INVOKABLE}{invokable} method) in another thread, place that call in
- the target thread's event loop. This lets the target thread finish its current
- task before the slot starts running, while the original thread continues
- running in parallel.
-
- To place an invocation in an event loop, make a queued \l{Signals & Slots}
- {signal-slot} connection. Whenever the signal is emitted, its arguments will
- be recorded by the event system. The thread that the signal receiver
- \l{QObject#Thread Affinity}{lives in} will then run the slot. Alternatively,
- call QMetaObject::invokeMethod() to achieve the same effect without signals.
- In both cases, a \l{Qt::QueuedConnection}{queued connection} must be used
- because a \l{Qt::DirectConnection}{direct connection} bypasses the event
- system and runs the method immediately in the current thread.
-
- There is no risk of deadlocks when using the event system for thread
- synchronization, unlike using low-level primitives. However, the event system
- does not enforce mutual exclusion. If invokable methods access shared data,
- they must still be protected with low-level primitives.
-
- Having said that, Qt's event system, along with \l{Implicit Sharing}{implicitly
- shared} data structures, offers an alternative to traditional thread locking.
- If signals and slots are used exclusively and no variables are shared between
- threads, a multithreaded program can do without low-level primitives altogether.
-
- \sa QThread::exec(), {Threads and QObjects}
-*/
-
-/*!
- \page threads-reentrancy.html
- \title Reentrancy and Thread-Safety
-
- \keyword reentrant
- \keyword thread-safe
-
- \previouspage Synchronizing Threads
- \contentspage Thread Support in Qt
- \nextpage Threads and QObjects
-
- Throughout the documentation, the terms \e{reentrant} and
- \e{thread-safe} are used to mark classes and functions to indicate
- how they can be used in multithread applications:
-
- \list
- \li A \e thread-safe function can be called simultaneously from
- multiple threads, even when the invocations use shared data,
- because all references to the shared data are serialized.
- \li A \e reentrant function can also be called simultaneously from
- multiple threads, but only if each invocation uses its own data.
- \endlist
-
- Hence, a \e{thread-safe} function is always \e{reentrant}, but a
- \e{reentrant} function is not always \e{thread-safe}.
-
- By extension, a class is said to be \e{reentrant} if its member
- functions can be called safely from multiple threads, as long as
- each thread uses a \e{different} instance of the class. The class
- is \e{thread-safe} if its member functions can be called safely
- from multiple threads, even if all the threads use the \e{same}
- instance of the class.
-
- \note Qt classes are only documented as \e{thread-safe} if they
- are intended to be used by multiple threads. If a function is not
- marked as thread-safe or reentrant, it should not be used from
- different threads. If a class is not marked as thread-safe or
- reentrant then a specific instance of that class should not be
- accessed from different threads.
-
- \section1 Reentrancy
-
- C++ classes are often reentrant, simply because they only access
- their own member data. Any thread can call a member function on an
- instance of a reentrant class, as long as no other thread can call
- a member function on the \e{same} instance of the class at the
- same time. For example, the \c Counter class below is reentrant:
-
- \snippet threads/threads.cpp 3
- \snippet threads/threads.cpp 4
-
- The class isn't thread-safe, because if multiple threads try to
- modify the data member \c n, the result is undefined. This is
- because the \c ++ and \c -- operators aren't always atomic.
- Indeed, they usually expand to three machine instructions:
-
- \list 1
- \li Load the variable's value in a register.
- \li Increment or decrement the register's value.
- \li Store the register's value back into main memory.
- \endlist
-
- If thread A and thread B load the variable's old value
- simultaneously, increment their register, and store it back, they
- end up overwriting each other, and the variable is incremented
- only once!
-
- \section1 Thread-Safety
-
- Clearly, the access must be serialized: Thread A must perform
- steps 1, 2, 3 without interruption (atomically) before thread B
- can perform the same steps; or vice versa. An easy way to make
- the class thread-safe is to protect all access to the data
- members with a QMutex:
-
- \snippet threads/threads.cpp 5
- \snippet threads/threads.cpp 6
-
- The QMutexLocker class automatically locks the mutex in its
- constructor and unlocks it when the destructor is invoked, at the
- end of the function. Locking the mutex ensures that access from
- different threads will be serialized. The \c mutex data member is
- declared with the \c mutable qualifier because we need to lock
- and unlock the mutex in \c value(), which is a const function.
-
- \section1 Notes on Qt Classes
-
- Many Qt classes are \e{reentrant}, but they are not made
- \e{thread-safe}, because making them thread-safe would incur the
- extra overhead of repeatedly locking and unlocking a QMutex. For
- example, QString is reentrant but not thread-safe. You can safely
- access \e{different} instances of QString from multiple threads
- simultaneously, but you can't safely access the \e{same} instance
- of QString from multiple threads simultaneously (unless you
- protect the accesses yourself with a QMutex).
-
- Some Qt classes and functions are thread-safe. These are mainly
- the thread-related classes (e.g. QMutex) and fundamental functions
- (e.g. QCoreApplication::postEvent()).
-
- \note Terminology in the multithreading domain isn't entirely
- standardized. POSIX uses definitions of reentrant and thread-safe
- that are somewhat different for its C APIs. When using other
- object-oriented C++ class libraries with Qt, be sure the
- definitions are understood.
-*/
-
-/*!
- \page threads-qobject.html
- \title Threads and QObjects
-
- \previouspage Reentrancy and Thread Safety
- \contentspage Thread Support in Qt
- \nextpage Thread-Support in Qt Modules
-
- QThread inherits QObject. It emits signals to indicate that the
- thread started or finished executing, and provides a few slots as
- well.
-
- More interesting is that \l{QObject}s can be used in multiple
- threads, emit signals that invoke slots in other threads, and
- post events to objects that "live" in other threads. This is
- possible because each thread is allowed to have its own event
- loop.
-
- \section1 QObject Reentrancy
-
- QObject is reentrant. Most of its non-GUI subclasses, such as
- QTimer, QTcpSocket, QUdpSocket and QProcess, are also
- reentrant, making it possible to use these classes from multiple
- threads simultaneously. Note that these classes are designed to be
- created and used from within a single thread; creating an object
- in one thread and calling its functions from another thread is not
- guaranteed to work. There are three constraints to be aware of:
-
- \list
- \li \e{The child of a QObject must always be created in the thread
- where the parent was created.} This implies, among other
- things, that you should never pass the QThread object (\c
- this) as the parent of an object created in the thread (since
- the QThread object itself was created in another thread).
-
- \li \e{Event driven objects may only be used in a single thread.}
- Specifically, this applies to the \l{timers.html}{timer
- mechanism} and the \l{QtNetwork}{network module}. For example,
- you cannot start a timer or connect a socket in a thread that
- is not the \l{QObject::thread()}{object's thread}.
-
- \li \e{You must ensure that all objects created in a thread are
- deleted before you delete the QThread.} This can be done
- easily by creating the objects on the stack in your
- \l{QThread::run()}{run()} implementation.
- \endlist
-
- Although QObject is reentrant, the GUI classes, notably QWidget
- and all its subclasses, are not reentrant. They can only be used
- from the main thread. As noted earlier, QCoreApplication::exec()
- must also be called from that thread.
-
- In practice, the impossibility of using GUI classes in other
- threads than the main thread can easily be worked around by
- putting time-consuming operations in a separate worker thread and
- displaying the results on screen in the main thread when the
- worker thread is finished. This is the approach used for
- implementing the \l{threads/mandelbrot}{Mandelbrot} and
- the \l{network/blockingfortuneclient}{Blocking Fortune Client}
- example.
-
- \section1 Per-Thread Event Loop
-
- Each thread can have its own event loop. The initial thread
- starts its event loops using QCoreApplication::exec(); other
- threads can start an event loop using QThread::exec(). Like
- QCoreApplication, QThread provides an
- \l{QThread::exit()}{exit(int)} function and a
- \l{QThread::quit()}{quit()} slot.
-
- An event loop in a thread makes it possible for the thread to use
- certain non-GUI Qt classes that require the presence of an event
- loop (such as QTimer, QTcpSocket, and QProcess). It also makes it
- possible to connect signals from any threads to slots of a
- specific thread. This is explained in more detail in the
- \l{Signals and Slots Across Threads} section below.
-
- \image threadsandobjects.png Threads, objects, and event loops
-
- A QObject instance is said to \e live in the thread in which it
- is created. Events to that object are dispatched by that thread's
- event loop. The thread in which a QObject lives is available using
- QObject::thread().
-
- Note that for QObjects that are created before QApplication,
- QObject::thread() returns zero. This means that the main thread
- will only handle posted events for these objects; other event
- processing is not done at all for objects with no thread. Use the
- QObject::moveToThread() function to change the thread affinity for
- an object and its children (the object cannot be moved if it has a
- parent).
-
- Calling \c delete on a QObject from a thread other than the one
- that \e owns the object (or accessing the object in other ways) is
- unsafe, unless you guarantee that the object isn't processing
- events at that moment. Use QObject::deleteLater() instead, and a
- \l{QEvent::DeferredDelete}{DeferredDelete} event will be posted,
- which the event loop of the object's thread will eventually pick
- up. By default, the thread that \e owns a QObject is the thread
- that \e creates the QObject, but not after QObject::moveToThread()
- has been called.
-
- If no event loop is running, events won't be delivered to the
- object. For example, if you create a QTimer object in a thread but
- never call \l{QThread::exec()}{exec()}, the QTimer will never emit
- its \l{QTimer::timeout()}{timeout()} signal. Calling
- \l{QObject::deleteLater()}{deleteLater()} won't work
- either. (These restrictions apply to the main thread as well.)
-
- You can manually post events to any object in any thread at any
- time using the thread-safe function
- QCoreApplication::postEvent(). The events will automatically be
- dispatched by the event loop of the thread where the object was
- created.
-
- Event filters are supported in all threads, with the restriction
- that the monitoring object must live in the same thread as the
- monitored object. Similarly, QCoreApplication::sendEvent()
- (unlike \l{QCoreApplication::postEvent()}{postEvent()}) can only
- be used to dispatch events to objects living in the thread from
- which the function is called.
-
- \section1 Accessing QObject Subclasses from Other Threads
-
- QObject and all of its subclasses are not thread-safe. This
- includes the entire event delivery system. It is important to keep
- in mind that the event loop may be delivering events to your
- QObject subclass while you are accessing the object from another
- thread.
-
- If you are calling a function on an QObject subclass that doesn't
- live in the current thread and the object might receive events,
- you must protect all access to your QObject subclass's internal
- data with a mutex; otherwise, you may experience crashes or other
- undesired behavior.
-
- Like other objects, QThread objects live in the thread where the
- object was created -- \e not in the thread that is created when
- QThread::run() is called. It is generally unsafe to provide slots
- in your QThread subclass, unless you protect the member variables
- with a mutex.
-
- On the other hand, you can safely emit signals from your
- QThread::run() implementation, because signal emission is
- thread-safe.
-
- \section1 Signals and Slots Across Threads
-
- Qt supports these signal-slot connection types:
-
- \list
-
- \li \l{Qt::AutoConnection}{Auto Connection} (default) If the signal is
- emitted in the thread which the receiving object has affinity then
- the behavior is the same as the Direct Connection. Otherwise,
- the behavior is the same as the Queued Connection."
-
- \li \l{Qt::DirectConnection}{Direct Connection} The slot is invoked
- immediately, when the signal is emitted. The slot is executed
- in the emitter's thread, which is not necessarily the
- receiver's thread.
-
- \li \l{Qt::QueuedConnection}{Queued Connection} The slot is invoked
- when control returns to the event loop of the receiver's
- thread. The slot is executed in the receiver's thread.
-
- \li \l{Qt::BlockingQueuedConnection}{Blocking Queued Connection}
- The slot is invoked as for the Queued Connection, except the
- current thread blocks until the slot returns. \note Using this
- type to connect objects in the same thread will cause deadlock.
-
- \li \l{Qt::UniqueConnection}{Unique Connection} The behavior is the
- same as the Auto Connection, but the connection is made only if
- it does not duplicate an existing connection. i.e., if the same
- signal is already connected to the same slot for the same pair
- of objects, then the connection is not made and connect()
- returns \c false.
-
- \endlist
-
- The connection type can be specified by passing an additional
- argument to \l{QObject::connect()}{connect()}. Be aware that
- using direct connections when the sender and receiver live in
- different threads is unsafe if an event loop is running in the
- receiver's thread, for the same reason that calling any function
- on an object living in another thread is unsafe.
-
- QObject::connect() itself is thread-safe.
-
- The \l{threads/mandelbrot}{Mandelbrot} example uses a queued
- connection to communicate between a worker thread and the main
- thread. To avoid freezing the main thread's event loop (and, as a
- consequence, the application's user interface), all the
- Mandelbrot fractal computation is done in a separate worker
- thread. The thread emits a signal when it is done rendering the
- fractal.
-
- Similarly, the \l{network/blockingfortuneclient}{Blocking Fortune
- Client} example uses a separate thread for communicating with
- a TCP server asynchronously.
-*/
-
-/*!
- \page threads-modules.html
- \title Thread-Support in Qt Modules
-
- \previouspage Threads and QObjects
- \contentspage Thread Support in Qt
-
- \section1 Threads and the SQL Module
-
- A connection can only be used from within the thread that created it.
- Moving connections between threads or creating queries from a different
- thread is not supported.
-
- In addition, the third party libraries used by the QSqlDrivers can impose
- further restrictions on using the SQL Module in a multithreaded program.
- Consult the manual of your database client for more information
-
- \section1 Painting in Threads
-
- QPainter can be used in a thread to paint onto QImage, QPrinter, and
- QPicture paint devices. Painting onto QPixmaps and QWidgets is \e not
- supported. On Mac OS X the automatic progress dialog will not be
- displayed if you are printing from outside the GUI thread.
-
- Any number of threads can paint at any given time, however only
- one thread at a time can paint on a given paint device. In other
- words, two threads can paint at the same time if each paints onto
- separate QImages, but the two threads cannot paint onto the same
- QImage at the same time.
-
- \section1 Threads and Rich Text Processing
-
- The QTextDocument, QTextCursor, and \l{richtext.html}{all related classes} are reentrant.
-
- Note that a QTextDocument instance created in the GUI thread may
- contain QPixmap image resources. Use QTextDocument::clone() to
- create a copy of the document, and pass the copy to another thread for
- further processing (such as printing).
-
- \section1 Threads and the SVG module
-
- The QSvgGenerator and QSvgRenderer classes in the QtSvg module
- are reentrant.
-
- \section1 Threads and Implicitly Shared Classes
-
- Qt uses an optimization called \l{implicit sharing} for many of
- its value class, notably QImage and QString. Beginning with Qt 4,
- implicit shared classes can safely be copied across threads, like
- any other value classes. They are fully
- \l{Reentrancy and Thread-Safety}{reentrant}. The implicit sharing
- is really \e implicit.
-
- In many people's minds, implicit sharing and multithreading are
- incompatible concepts, because of the way the reference counting
- is typically done. Qt, however, uses atomic reference counting to
- ensure the integrity of the shared data, avoiding potential
- corruption of the reference counter.
-
- Note that atomic reference counting does not guarantee
- \l{Reentrancy and Thread-Safety}{thread-safety}. Proper locking should be used
- when sharing an instance of an implicitly shared class between
- threads. This is the same requirement placed on all
- \l{Reentrancy and Thread-Safety}{reentrant} classes, shared or not. Atomic reference
- counting does, however, guarantee that a thread working on its
- own, local instance of an implicitly shared class is safe. We
- recommend using \l{Signals and Slots Across Threads}{signals and
- slots} to pass data between threads, as this can be done without
- the need for any explicit locking.
-
- To sum it up, implicitly shared classes in Qt 4 are really \e
- implicitly shared. Even in multithreaded applications, you can
- safely use them as if they were plain, non-shared, reentrant
- value-based classes.
-*/
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index a0842a946d..fd031469f6 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -31,6 +31,7 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
# configure creates these, not syncqt, so we need to manually inject them
qconfig_h_files = \
+ $$OUT_PWD/global/qfeatures.h \
$$OUT_PWD/global/qconfig.h \
$$QT_BUILD_TREE/include/QtCore/QtConfig
targ_headers.files += $$qconfig_h_files
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 102a6487ee..2b957782e8 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -470,6 +470,7 @@
* N2659 Q_COMPILER_THREAD_LOCAL
* N2765 Q_COMPILER_UDL
* N2442 Q_COMPILER_UNICODE_STRINGS
+ * N2640 Q_COMPILER_UNIFORM_INIT
* N2544 Q_COMPILER_UNRESTRICTED_UNIONS
* N1653 Q_COMPILER_VARIADIC_MACROS
* N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES
@@ -507,6 +508,7 @@
// constexpr support is only partial
//# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_INITIALIZER_LISTS
+# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_NOEXCEPT
# endif
# if __INTEL_COMPILER >= 1400
@@ -581,6 +583,7 @@
# endif
# if __has_feature(cxx_generalized_initializers)
# define Q_COMPILER_INITIALIZER_LISTS
+# define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */
# endif
# if __has_feature(cxx_lambdas)
# define Q_COMPILER_LAMBDA
@@ -653,6 +656,7 @@
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_INITIALIZER_LISTS
+# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
@@ -726,8 +730,9 @@
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
-// MSVC has std::initilizer_list, but does not support the braces initialization
+// MSVC's library has std::initilizer_list, but the compiler does not support the braces initialization
//# define Q_COMPILER_INITIALIZER_LISTS
+//# define Q_COMPILER_UNIFORM_INIT
# endif
# if _MSC_VER >= 1700
/* C++11 features supported in VC11 = VC2012: */
@@ -738,6 +743,20 @@
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_ATOMICS
# endif /* VC 11 */
+# if _MSC_VER >= 1800
+ /* C++11 features in VC12 = VC2013 */
+# define Q_COMPILER_DEFAULT_MEMBERS
+# define Q_COMPILER_DELETE_MEMBERS
+# define Q_COMPILER_DELEGATING_CONSTRUCTORS
+# define Q_COMPILER_EXPLICIT_CONVERSIONS
+# define Q_COMPILER_NONSTATIC_MEMBER_INIT
+# define Q_COMPILER_INITIALIZER_LISTS
+// implemented in principle, but has a bug that makes it unusable: http://connect.microsoft.com/VisualStudio/feedback/details/802058/c-11-unified-initialization-fails-with-c-style-arrays
+// #define Q_COMPILER_UNIFORM_INIT
+# define Q_COMPILER_RAW_STRINGS
+# define Q_COMPILER_TEMPLATE_ALIAS
+# define Q_COMPILER_VARIADIC_TEMPLATES
+# endif /* VC 12 */
#endif /* Q_CC_MSVC */
#ifdef __cplusplus
diff --git a/src/corelib/global/qconfig-large.h b/src/corelib/global/qconfig-large.h
index 584be07067..0c1fcbf7da 100644
--- a/src/corelib/global/qconfig-large.h
+++ b/src/corelib/global/qconfig-large.h
@@ -56,11 +56,6 @@
# define QT_NO_PROGRESSDIALOG
#endif
-/* Fonts */
-#ifndef QT_NO_QWS_QPF
-# define QT_NO_QWS_QPF
-#endif
-
/* Images */
#ifndef QT_NO_IMAGEFORMAT_BMP
# define QT_NO_IMAGEFORMAT_BMP
@@ -76,9 +71,6 @@
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
-#ifndef QT_NO_TRANSLATION_UTF8
-# define QT_NO_TRANSLATION_UTF8
-#endif
/* ItemViews */
#ifndef QT_NO_TABLEVIEW
@@ -101,23 +93,14 @@
#ifndef QT_NO_PROPERTIES
# define QT_NO_PROPERTIES
#endif
-#ifndef QT_NO_SOUND
-# define QT_NO_SOUND
-#endif
/* Networking */
-#ifndef QT_NO_HOSTINFO
-# define QT_NO_HOSTINFO
-#endif
#ifndef QT_NO_HTTP
# define QT_NO_HTTP
#endif
#ifndef QT_NO_UDPSOCKET
# define QT_NO_UDPSOCKET
#endif
-#ifndef QT_NO_URLINFO
-# define QT_NO_URLINFO
-#endif
#ifndef QT_NO_FTP
# define QT_NO_FTP
#endif
@@ -136,18 +119,7 @@
# define QT_NO_CUPS
#endif
-/* Qt for Embedded Linux */
-#ifndef QT_NO_QWS_SOUNDSERVER
-# define QT_NO_QWS_SOUNDSERVER
-#endif
-
/* Styles */
-#ifndef QT_NO_STYLE_MOTIF
-# define QT_NO_STYLE_MOTIF
-#endif
-#ifndef QT_NO_STYLE_CDE
-# define QT_NO_STYLE_CDE
-#endif
#ifndef QT_NO_STYLE_STYLESHEET
# define QT_NO_STYLE_STYLESHEET
#endif
diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h
index 132c8ce45c..e5ab33faed 100644
--- a/src/corelib/global/qconfig-medium.h
+++ b/src/corelib/global/qconfig-medium.h
@@ -58,14 +58,6 @@
#ifndef QT_NO_PROGRESSDIALOG
# define QT_NO_PROGRESSDIALOG
#endif
-#ifndef QT_NO_TABDIALOG
-# define QT_NO_TABDIALOG
-#endif
-
-/* Fonts */
-#ifndef QT_NO_QWS_QPF
-# define QT_NO_QWS_QPF
-#endif
/* Images */
#ifndef QT_NO_IMAGEFORMAT_BMP
@@ -91,9 +83,6 @@
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
-#ifndef QT_NO_TRANSLATION_UTF8
-# define QT_NO_TRANSLATION_UTF8
-#endif
/* ItemViews */
#ifndef QT_NO_TABLEVIEW
@@ -125,20 +114,11 @@
#ifndef QT_NO_SHORTCUT
# define QT_NO_SHORTCUT
#endif
-#ifndef QT_NO_SOUND
-# define QT_NO_SOUND
-#endif
#ifndef QT_NO_WHEELEVENT
# define QT_NO_WHEELEVENT
#endif
/* Networking */
-#ifndef QT_NO_COP
-# define QT_NO_COP
-#endif
-#ifndef QT_NO_HOSTINFO
-# define QT_NO_HOSTINFO
-#endif
#ifndef QT_NO_HTTP
# define QT_NO_HTTP
#endif
@@ -151,9 +131,6 @@
#ifndef QT_NO_UDPSOCKET
# define QT_NO_UDPSOCKET
#endif
-#ifndef QT_NO_URLINFO
-# define QT_NO_URLINFO
-#endif
#ifndef QT_NO_FTP
# define QT_NO_FTP
#endif
@@ -172,24 +149,7 @@
# define QT_NO_CUPS
#endif
-/* Qt for Embedded Linux */
-#ifndef QT_NO_QWSEMBEDWIDGET
-# define QT_NO_QWSEMBEDWIDGET
-#endif
-#ifndef QT_NO_QWS_SOUNDSERVER
-# define QT_NO_QWS_SOUNDSERVER
-#endif
-#ifndef QT_NO_QWS_PROPERTIES
-# define QT_NO_QWS_PROPERTIES
-#endif
-
/* Styles */
-#ifndef QT_NO_STYLE_MOTIF
-# define QT_NO_STYLE_MOTIF
-#endif
-#ifndef QT_NO_STYLE_CDE
-# define QT_NO_STYLE_CDE
-#endif
#ifndef QT_NO_STYLE_STYLESHEET
# define QT_NO_STYLE_STYLESHEET
#endif
@@ -281,8 +241,3 @@
#ifndef QT_NO_TREEWIDGET
# define QT_NO_TREEWIDGET
#endif
-
-/* Windows */
-#ifndef QT_NO_WIN_ACTIVEQT
-# define QT_NO_WIN_ACTIVEQT
-#endif
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
index cc5ac9987c..b27f3271c1 100644
--- a/src/corelib/global/qconfig-minimal.h
+++ b/src/corelib/global/qconfig-minimal.h
@@ -75,9 +75,6 @@
#ifndef QT_NO_PROGRESSDIALOG
# define QT_NO_PROGRESSDIALOG
#endif
-#ifndef QT_NO_TABDIALOG
-# define QT_NO_TABDIALOG
-#endif
#ifndef QT_NO_WIZARD
# define QT_NO_WIZARD
#endif
@@ -109,9 +106,6 @@
#ifndef QT_NO_FREETYPE
# define QT_NO_FREETYPE
#endif
-#ifndef QT_NO_QWS_QPF2
-# define QT_NO_QWS_QPF2
-#endif
/* Images */
#ifndef QT_NO_IMAGEFORMATPLUGIN
@@ -146,9 +140,6 @@
#ifndef QT_NO_BIG_CODECS
# define QT_NO_BIG_CODECS
#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
-# define QT_NO_QWS_INPUTMETHODS
-#endif
#ifndef QT_NO_TEXTCODEC
# define QT_NO_TEXTCODEC
#endif
@@ -158,9 +149,6 @@
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
-#ifndef QT_NO_TRANSLATION_UTF8
-# define QT_NO_TRANSLATION_UTF8
-#endif
/* ItemViews */
#ifndef QT_NO_ITEMVIEWS
@@ -228,9 +216,6 @@
#ifndef QT_NO_SHORTCUT
# define QT_NO_SHORTCUT
#endif
-#ifndef QT_NO_SOUND
-# define QT_NO_SOUND
-#endif
#ifndef QT_NO_SYSTEMSEMAPHORE
# define QT_NO_SYSTEMSEMAPHORE
#endif
@@ -257,12 +242,6 @@
#endif
/* Networking */
-#ifndef QT_NO_COP
-# define QT_NO_COP
-#endif
-#ifndef QT_NO_HOSTINFO
-# define QT_NO_HOSTINFO
-#endif
#ifndef QT_NO_HTTP
# define QT_NO_HTTP
#endif
@@ -275,9 +254,6 @@
#ifndef QT_NO_UDPSOCKET
# define QT_NO_UDPSOCKET
#endif
-#ifndef QT_NO_URLINFO
-# define QT_NO_URLINFO
-#endif
#ifndef QT_NO_FTP
# define QT_NO_FTP
#endif
@@ -286,12 +262,6 @@
#ifndef QT_NO_COLORNAMES
# define QT_NO_COLORNAMES
#endif
-#ifndef QT_NO_DIRECTPAINTER
-# define QT_NO_DIRECTPAINTER
-#endif
-#ifndef QT_NO_PAINTONSCREEN
-# define QT_NO_PAINTONSCREEN
-#endif
#ifndef QT_NO_PAINT_DEBUG
# define QT_NO_PAINT_DEBUG
#endif
@@ -305,73 +275,6 @@
# define QT_NO_CUPS
#endif
-/* Qt for Embedded Linux */
-#ifndef QT_NO_QWSEMBEDWIDGET
-# define QT_NO_QWSEMBEDWIDGET
-#endif
-#ifndef QT_NO_QWS_ALPHA_CURSOR
-# define QT_NO_QWS_ALPHA_CURSOR
-#endif
-#ifndef QT_NO_QWS_CURSOR
-# define QT_NO_QWS_CURSOR
-#endif
-#ifndef QT_NO_QWS_DECORATION_DEFAULT
-# define QT_NO_QWS_DECORATION_DEFAULT
-#endif
-#ifndef QT_NO_QWS_DECORATION_STYLED
-# define QT_NO_QWS_DECORATION_STYLED
-#endif
-#ifndef QT_NO_QWS_DECORATION_WINDOWS
-# define QT_NO_QWS_DECORATION_WINDOWS
-#endif
-#ifndef QT_NO_QWS_MANAGER
-# define QT_NO_QWS_MANAGER
-#endif
-#ifndef QT_NO_QWS_KEYBOARD
-# define QT_NO_QWS_KEYBOARD
-#endif
-#ifndef QT_NO_QWS_MOUSE
-# define QT_NO_QWS_MOUSE
-#endif
-#ifndef QT_NO_QWS_MOUSE_AUTO
-# define QT_NO_QWS_MOUSE_AUTO
-#endif
-#ifndef QT_NO_QWS_MOUSE_MANUAL
-# define QT_NO_QWS_MOUSE_MANUAL
-#endif
-#ifndef QT_NO_QWS_MULTIPROCESS
-# define QT_NO_QWS_MULTIPROCESS
-#endif
-#ifndef QT_NO_QWS_SOUNDSERVER
-# define QT_NO_QWS_SOUNDSERVER
-#endif
-#ifndef QT_NO_QWS_PROPERTIES
-# define QT_NO_QWS_PROPERTIES
-#endif
-#ifndef QT_NO_QWS_PROXYSCREEN
-# define QT_NO_QWS_PROXYSCREEN
-#endif
-#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
-# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
-#endif
-
-/* SVG */
-#ifndef QT_NO_SVG
-# define QT_NO_SVG
-#endif
-#ifndef QT_NO_GRAPHICSSVGITEM
-# define QT_NO_GRAPHICSSVGITEM
-#endif
-#ifndef QT_NO_SVGGENERATOR
-# define QT_NO_SVGGENERATOR
-#endif
-#ifndef QT_NO_SVGRENDERER
-# define QT_NO_SVGRENDERER
-#endif
-#ifndef QT_NO_SVGWIDGET
-# define QT_NO_SVGWIDGET
-#endif
-
/* Styles */
#ifndef QT_NO_STYLE_FUSION
# define QT_NO_STYLE_FUSION
@@ -402,9 +305,6 @@
#ifndef QT_NO_DESKTOPSERVICES
# define QT_NO_DESKTOPSERVICES
#endif
-#ifndef QT_NO_SCRIPT
-# define QT_NO_SCRIPT
-#endif
#ifndef QT_NO_SYSTEMTRAYICON
# define QT_NO_SYSTEMTRAYICON
#endif
@@ -485,9 +385,6 @@
#ifndef QT_NO_SPLITTER
# define QT_NO_SPLITTER
#endif
-#ifndef QT_NO_SIGNALMAPPER
-# define QT_NO_SIGNALMAPPER
-#endif
#ifndef QT_NO_SIZEGRIP
# define QT_NO_SIZEGRIP
#endif
@@ -563,8 +460,3 @@
#ifndef QT_NO_VALIDATOR
# define QT_NO_VALIDATOR
#endif
-
-/* Windows */
-#ifndef QT_NO_WIN_ACTIVEQT
-# define QT_NO_WIN_ACTIVEQT
-#endif
diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h
index c2854b26c3..22dd56e772 100644
--- a/src/corelib/global/qconfig-nacl.h
+++ b/src/corelib/global/qconfig-nacl.h
@@ -72,9 +72,6 @@
#ifndef QT_NO_FILESYSTEMWATCHER
# define QT_NO_FILESYSTEMWATCHER
#endif
-#ifndef QT_NO_FSFILEENGINE
-# define QT_NO_FSFILEENGINE
-#endif
#ifndef QT_NO_FILESYSTEMMODEL
# define QT_NO_FILESYSTEMMODEL
#endif
@@ -94,11 +91,6 @@
# define QT_NO_LIBRARY
#endif
-/* Fonts */
-#ifndef QT_NO_QWS_QPF2
-# define QT_NO_QWS_QPF2
-#endif
-
/* Images */
#ifndef QT_NO_IMAGEFORMATPLUGIN
# define QT_NO_IMAGEFORMATPLUGIN
@@ -114,9 +106,6 @@
#ifndef QT_NO_BIG_CODECS
# define QT_NO_BIG_CODECS
#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
-# define QT_NO_QWS_INPUTMETHODS
-#endif
#ifndef QT_NO_TEXTCODEC
# define QT_NO_TEXTCODEC
#endif
@@ -126,9 +115,6 @@
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
-#ifndef QT_NO_TRANSLATION_UTF8
-# define QT_NO_TRANSLATION_UTF8
-#endif
/* ItemViews */
@@ -158,9 +144,6 @@
#ifndef QT_NO_SHAREDMEMORY
# define QT_NO_SHAREDMEMORY
#endif
-#ifndef QT_NO_SOUND
-# define QT_NO_SOUND
-#endif
#ifndef QT_NO_SYSTEMLOCALE
# define QT_NO_SYSTEMSEMAPHORE
#endif
@@ -187,12 +170,6 @@
#endif
/* Networking */
-#ifndef QT_NO_COP
-# define QT_NO_COP
-#endif
-#ifndef QT_NO_HOSTINFO
-# define QT_NO_HOSTINFO
-#endif
#ifndef QT_NO_HTTP
# define QT_NO_HTTP
#endif
@@ -205,9 +182,6 @@
#ifndef QT_NO_UDPSOCKET
# define QT_NO_UDPSOCKET
#endif
-#ifndef QT_NO_URLINFO
-# define QT_NO_URLINFO
-#endif
#ifndef QT_NO_FTP
# define QT_NO_FTP
#endif
@@ -216,12 +190,6 @@
#ifndef QT_NO_COLORNAMES
# define QT_NO_COLORNAMES
#endif
-#ifndef QT_NO_DIRECTPAINTER
-# define QT_NO_DIRECTPAINTER
-#endif
-#ifndef QT_NO_PAINTONSCREEN
-# define QT_NO_PAINTONSCREEN
-#endif
#ifndef QT_NO_PAINT_DEBUG
# define QT_NO_PAINT_DEBUG
#endif
@@ -235,92 +203,7 @@
# define QT_NO_CUPS
#endif
-/* Qt for Embedded Linux */
-#ifndef QT_NO_QWSEMBEDWIDGET
-# define QT_NO_QWSEMBEDWIDGET
-#endif
-#ifndef QT_NO_QWS_ALPHA_CURSOR
-# define QT_NO_QWS_ALPHA_CURSOR
-#endif
-#ifndef QT_NO_QWS_CURSOR
-# define QT_NO_QWS_CURSOR
-#endif
-#ifndef QT_NO_QWS_DECORATION_DEFAULT
-# define QT_NO_QWS_DECORATION_DEFAULT
-#endif
-#ifndef QT_NO_QWS_DECORATION_STYLED
-# define QT_NO_QWS_DECORATION_STYLED
-#endif
-#ifndef QT_NO_QWS_DECORATION_WINDOWS
-# define QT_NO_QWS_DECORATION_WINDOWS
-#endif
-#ifndef QT_NO_QWS_MANAGER
-# define QT_NO_QWS_MANAGER
-#endif
-#ifndef QT_NO_QWS_KEYBOARD
-# define QT_NO_QWS_KEYBOARD
-#endif
-#ifndef QT_NO_QWS_MOUSE
-# define QT_NO_QWS_MOUSE
-#endif
-#ifndef QT_NO_QWS_MOUSE_AUTO
-# define QT_NO_QWS_MOUSE_AUTO
-#endif
-#ifndef QT_NO_QWS_MOUSE_MANUAL
-# define QT_NO_QWS_MOUSE_MANUAL
-#endif
-#ifndef QT_NO_QWS_MULTIPROCESS
-# define QT_NO_QWS_MULTIPROCESS
-#endif
-#ifndef QT_NO_QWS_SOUNDSERVER
-# define QT_NO_QWS_SOUNDSERVER
-#endif
-#ifndef QT_NO_QWS_PROPERTIES
-# define QT_NO_QWS_PROPERTIES
-#endif
-#ifndef QT_NO_QWS_PROXYSCREEN
-# define QT_NO_QWS_PROXYSCREEN
-#endif
-#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
-# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION
-#endif
-#ifndef QT_NO_QWS_LINUXFB
-# define QT_NO_QWS_LINUXFB
-#endif
-#ifndef QT_NO_QWS_MOUSE_PC
-# define QT_NO_QWS_MOUSE_PC
-#endif
-#ifndef QT_NO_QWS_MOUSE_LINUXTP
-# define QT_NO_QWS_MOUSE_LINUXTP
-#endif
-#ifndef QT_NO_QWS_QPF
-# define QT_NO_QWS_QPF
-#endif
-
-/* SVG */
-#ifndef QT_NO_SVG
-# define QT_NO_SVG
-#endif
-#ifndef QT_NO_GRAPHICSSVGITEM
-# define QT_NO_GRAPHICSSVGITEM
-#endif
-#ifndef QT_NO_SVGGENERATOR
-# define QT_NO_SVGGENERATOR
-#endif
-#ifndef QT_NO_SVGRENDERER
-# define QT_NO_SVGRENDERER
-#endif
-#ifndef QT_NO_SVGWIDGET
-# define QT_NO_SVGWIDGET
-#endif
-
/* Styles */
-#ifndef QT_NO_STYLE_MOTIF
-# define QT_NO_STYLE_MOTIF
-#endif
-#ifndef QT_NO_STYLE_CDE
-# define QT_NO_STYLE_CDE
-#endif
#ifndef QT_NO_STYLE_STYLESHEET
# define QT_NO_STYLE_STYLESHEET
#endif
@@ -347,14 +230,6 @@
#ifndef QT_NO_DESKTOPSERVICES
# define QT_NO_DESKTOPSERVICES
#endif
-#ifndef QT_NO_SCRIPT
-# define QT_NO_SCRIPT
-#endif
#ifndef QT_NO_SYSTEMTRAYICON
# define QT_NO_SYSTEMTRAYICON
#endif
-
-/* Windows */
-#ifndef QT_NO_WIN_ACTIVEQT
-# define QT_NO_WIN_ACTIVEQT
-#endif
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
index f730b3d5d2..8a0e769383 100644
--- a/src/corelib/global/qconfig-small.h
+++ b/src/corelib/global/qconfig-small.h
@@ -64,9 +64,6 @@
#ifndef QT_NO_PROGRESSDIALOG
# define QT_NO_PROGRESSDIALOG
#endif
-#ifndef QT_NO_TABDIALOG
-# define QT_NO_TABDIALOG
-#endif
/* File I/O */
#ifndef QT_NO_SETTINGS
@@ -105,9 +102,6 @@
#endif
/* Internationalization */
-#ifndef QT_NO_QWS_INPUTMETHODS
-# define QT_NO_QWS_INPUTMETHODS
-#endif
#ifndef QT_NO_TEXTCODEC
# define QT_NO_TEXTCODEC
#endif
@@ -117,9 +111,6 @@
#ifndef QT_NO_TRANSLATION
# define QT_NO_TRANSLATION
#endif
-#ifndef QT_NO_TRANSLATION_UTF8
-# define QT_NO_TRANSLATION_UTF8
-#endif
/* ItemViews */
#ifndef QT_NO_DIRMODEL
@@ -163,20 +154,11 @@
#ifndef QT_NO_SHORTCUT
# define QT_NO_SHORTCUT
#endif
-#ifndef QT_NO_SOUND
-# define QT_NO_SOUND
-#endif
#ifndef QT_NO_WHEELEVENT
# define QT_NO_WHEELEVENT
#endif
/* Networking */
-#ifndef QT_NO_COP
-# define QT_NO_COP
-#endif
-#ifndef QT_NO_HOSTINFO
-# define QT_NO_HOSTINFO
-#endif
#ifndef QT_NO_HTTP
# define QT_NO_HTTP
#endif
@@ -195,14 +177,6 @@
# define QT_NO_CUPS
#endif
-/* Qt for Embedded Linux */
-#ifndef QT_NO_QWS_SOUNDSERVER
-# define QT_NO_QWS_SOUNDSERVER
-#endif
-#ifndef QT_NO_QWS_PROPERTIES
-# define QT_NO_QWS_PROPERTIES
-#endif
-
/* Styles */
#ifndef QT_NO_STYLE_FUSION
# define QT_NO_STYLE_FUSION
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
deleted file mode 100644
index 17dd600265..0000000000
--- a/src/corelib/global/qfeatures.h
+++ /dev/null
@@ -1,686 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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, Digia gives you certain additional
-** rights. These rights are described in the Digia 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.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- * All features and their dependencies.
- *
- * This list is generated from $QTDIR/src/corelib/global/qfeatures.txt
- * by $QTSRCDIR/util/scripts/make_qfeatures_dot_h
- */
-
-// QAction
-//#define QT_NO_ACTION
-
-// QClipboard
-//#define QT_NO_CLIPBOARD
-
-// Color Names
-//#define QT_NO_COLORNAMES
-
-// QtConcurrent
-//#define QT_NO_CONCURRENT
-
-// CssParser
-//#define QT_NO_CSSPARSER
-
-// QCursor
-//#define QT_NO_CURSOR
-
-// QDesktopServices
-//#define QT_NO_DESKTOPSERVICES
-
-// Document Object Model
-//#define QT_NO_DOM
-
-// Effects
-//#define QT_NO_EFFECTS
-
-// QFileSystemIterator
-//#define QT_NO_FILESYSTEMITERATOR
-
-// QFileSystemWatcher
-//#define QT_NO_FILESYSTEMWATCHER
-
-// Freetype Font Engine
-//#define QT_NO_FREETYPE
-
-// Gesture
-//#define QT_NO_GESTURES
-
-// QGroupBox
-//#define QT_NO_GROUPBOX
-
-// QHostInfo
-//#define QT_NO_HOSTINFO
-
-// BMP Image Format
-//#define QT_NO_IMAGEFORMAT_BMP
-
-// JPEG Image Format
-//#define QT_NO_IMAGEFORMAT_JPEG
-
-// PNG Image Format
-//#define QT_NO_IMAGEFORMAT_PNG
-
-// PPM Image Format
-//#define QT_NO_IMAGEFORMAT_PPM
-
-// XBM Image Format
-//#define QT_NO_IMAGEFORMAT_XBM
-
-// XPM Image Format
-//#define QT_NO_IMAGEFORMAT_XPM
-
-// QImage::createHeuristicMask()
-//#define QT_NO_IMAGE_HEURISTIC_MASK
-
-// Image Text
-//#define QT_NO_IMAGE_TEXT
-
-// QKeySequenceEdit
-//#define QT_NO_KEYSEQUENCEEDIT
-
-// QLCDNumber
-//#define QT_NO_LCDNUMBER
-
-// QLibrary
-//#define QT_NO_LIBRARY
-
-// QLineEdit
-//#define QT_NO_LINEEDIT
-
-// QMessageBox
-//#define QT_NO_MESSAGEBOX
-
-// QMovie
-//#define QT_NO_MOVIE
-
-// QNetworkInterface
-//#define QT_NO_NETWORKINTERFACE
-
-// QNetworkProxy
-//#define QT_NO_NETWORKPROXY
-
-// Qt::WA_PaintOnScreen
-//#define QT_NO_PAINTONSCREEN
-
-// Painting Debug Utilities
-//#define QT_NO_PAINT_DEBUG
-
-// QPicture
-//#define QT_NO_PICTURE
-
-// QProcess
-//#define QT_NO_PROCESS
-
-// QProgressBar
-//#define QT_NO_PROGRESSBAR
-
-// Properties
-//#define QT_NO_PROPERTIES
-
-// QRegularExpression
-//#define QT_NO_REGULAREXPRESSION
-
-// Resize Handler
-//#define QT_NO_RESIZEHANDLER
-
-// QRubberBand
-//#define QT_NO_RUBBERBAND
-
-// Session Manager
-//#define QT_NO_SESSIONMANAGER
-
-// QSettings
-//#define QT_NO_SETTINGS
-
-// QSharedMemory
-//#define QT_NO_SHAREDMEMORY
-
-// QShortcut
-//#define QT_NO_SHORTCUT
-
-// QSizeGrip
-//#define QT_NO_SIZEGRIP
-
-// QSlider
-//#define QT_NO_SLIDER
-
-// Spin Widget
-//#define QT_NO_SPINWIDGET
-
-// Splash screen widget
-//#define QT_NO_SPLASHSCREEN
-
-// QStackedWidget
-//#define QT_NO_STACKEDWIDGET
-
-// QStatusBar
-//#define QT_NO_STATUSBAR
-
-// Status Tip
-//#define QT_NO_STATUSTIP
-
-// QWindowsStyle
-//#define QT_NO_STYLE_WINDOWS
-
-// QSystemSemaphore
-//#define QT_NO_SYSTEMSEMAPHORE
-
-// QSystemTrayIcon
-//#define QT_NO_SYSTEMTRAYICON
-
-// QTabletEvent
-//#define QT_NO_TABLETEVENT
-
-// QTemporaryFile
-//#define QT_NO_TEMPORARYFILE
-
-// QTextCodec
-//#define QT_NO_TEXTCODEC
-
-// Text Date
-//#define QT_NO_TEXTDATE
-
-// HtmlParser
-//#define QT_NO_TEXTHTMLPARSER
-
-// QToolTip
-//#define QT_NO_TOOLTIP
-
-// Translation
-//#define QT_NO_TRANSLATION
-
-// QUdpSocket
-//#define QT_NO_UDPSOCKET
-
-// QUndoCommand
-//#define QT_NO_UNDOCOMMAND
-
-// QValidator
-//#define QT_NO_VALIDATOR
-
-// QWheelEvent
-//#define QT_NO_WHEELEVENT
-
-//
-//#define QT_NO_XMLSTREAM
-
-// Animation
-#if !defined(QT_NO_ANIMATION) && (defined(QT_NO_PROPERTIES))
-#define QT_NO_ANIMATION
-#endif
-
-// Big Codecs
-#if !defined(QT_NO_BIG_CODECS) && (defined(QT_NO_TEXTCODEC))
-#define QT_NO_BIG_CODECS
-#endif
-
-// QButtonGroup
-#if !defined(QT_NO_BUTTONGROUP) && (defined(QT_NO_GROUPBOX))
-#define QT_NO_BUTTONGROUP
-#endif
-
-// Codecs
-#if !defined(QT_NO_CODECS) && (defined(QT_NO_TEXTCODEC))
-#define QT_NO_CODECS
-#endif
-
-// QDate/QTime/QDateTime
-#if !defined(QT_NO_DATESTRING) && (defined(QT_NO_TEXTDATE))
-#define QT_NO_DATESTRING
-#endif
-
-// QDial
-#if !defined(QT_NO_DIAL) && (defined(QT_NO_SLIDER))
-#define QT_NO_DIAL
-#endif
-
-// Drag and drop
-#if !defined(QT_NO_DRAGANDDROP) && (defined(QT_NO_IMAGEFORMAT_XPM))
-#define QT_NO_DRAGANDDROP
-#endif
-
-// File Transfer Protocol
-#if !defined(QT_NO_FTP) && (defined(QT_NO_TEXTDATE))
-#define QT_NO_FTP
-#endif
-
-// Hyper Text Transfer Protocol
-#if !defined(QT_NO_HTTP) && (defined(QT_NO_HOSTINFO))
-#define QT_NO_HTTP
-#endif
-
-// iconv
-#if !defined(QT_NO_ICONV) && (defined(QT_NO_TEXTCODEC))
-#define QT_NO_ICONV
-#endif
-
-// QInputContext
-#if !defined(QT_NO_IM) && (defined(QT_NO_LIBRARY))
-#define QT_NO_IM
-#endif
-
-// QImageIOPlugin
-#if !defined(QT_NO_IMAGEFORMATPLUGIN) && (defined(QT_NO_LIBRARY))
-#define QT_NO_IMAGEFORMATPLUGIN
-#endif
-
-// QKeySequenceEdit
-#if !defined(QT_NO_KEYSEQUENCEEDIT) && (defined(QT_NO_SHORTCUT))
-#define QT_NO_KEYSEQUENCEEDIT
-#endif
-
-// QLocalServer
-#if !defined(QT_NO_LOCALSERVER) && (defined(QT_NO_TEMPORARYFILE))
-#define QT_NO_LOCALSERVER
-#endif
-
-// QPdf
-#if !defined(QT_NO_PDF) && (defined(QT_NO_TEMPORARYFILE))
-#define QT_NO_PDF
-#endif
-
-// QMenu
-#if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION))
-#define QT_NO_MENU
-#endif
-
-// QNetworkDiskCache
-#if !defined(QT_NO_NETWORKDISKCACHE) && (defined(QT_NO_TEMPORARYFILE))
-#define QT_NO_NETWORKDISKCACHE
-#endif
-
-// QProgressDialog
-#if !defined(QT_NO_PROGRESSDIALOG) && (defined(QT_NO_PROGRESSBAR))
-#define QT_NO_PROGRESSDIALOG
-#endif
-
-// QScrollBar
-#if !defined(QT_NO_SCROLLBAR) && (defined(QT_NO_SLIDER))
-#define QT_NO_SCROLLBAR
-#endif
-
-// SOCKS5
-#if !defined(QT_NO_SOCKS5) && (defined(QT_NO_NETWORKPROXY))
-#define QT_NO_SOCKS5
-#endif
-
-// QSplitter
-#if !defined(QT_NO_SPLITTER) && (defined(QT_NO_RUBBERBAND))
-#define QT_NO_SPLITTER
-#endif
-
-// State machine
-#if !defined(QT_NO_STATEMACHINE) && (defined(QT_NO_PROPERTIES))
-#define QT_NO_STATEMACHINE
-#endif
-
-// QFusionStyle
-#if !defined(QT_NO_STYLE_FUSION) && (defined(QT_NO_IMAGEFORMAT_XPM))
-#define QT_NO_STYLE_FUSION
-#endif
-
-// QWindowsXPStyle
-#if !defined(QT_NO_STYLE_WINDOWSXP) && (defined(QT_NO_STYLE_WINDOWS))
-#define QT_NO_STYLE_WINDOWSXP
-#endif
-
-// QToolButton
-#if !defined(QT_NO_TOOLBUTTON) && (defined(QT_NO_ACTION))
-#define QT_NO_TOOLBUTTON
-#endif
-
-// QUndoStack
-#if !defined(QT_NO_UNDOSTACK) && (defined(QT_NO_UNDOCOMMAND))
-#define QT_NO_UNDOSTACK
-#endif
-
-// QWizard
-#if !defined(QT_NO_WIZARD) && (defined(QT_NO_PROPERTIES))
-#define QT_NO_WIZARD
-#endif
-
-// QXmlStreamReader
-#if !defined(QT_NO_XMLSTREAMREADER) && (defined(QT_NO_XMLSTREAM))
-#define QT_NO_XMLSTREAMREADER
-#endif
-
-// QXmlStreamWriter
-#if !defined(QT_NO_XMLSTREAMWRITER) && (defined(QT_NO_XMLSTREAM))
-#define QT_NO_XMLSTREAMWRITER
-#endif
-
-// Context menu
-#if !defined(QT_NO_CONTEXTMENU) && (defined(QT_NO_MENU))
-#define QT_NO_CONTEXTMENU
-#endif
-
-// QPrinter
-#if !defined(QT_NO_PRINTER) && (defined(QT_NO_PICTURE) || defined(QT_NO_TEMPORARYFILE))
-#define QT_NO_PRINTER
-#endif
-
-// QScrollArea
-#if !defined(QT_NO_SCROLLAREA) && (defined(QT_NO_SCROLLBAR))
-#define QT_NO_SCROLLAREA
-#endif
-
-// QWindowsCEStyle
-#if !defined(QT_NO_STYLE_WINDOWSCE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM))
-#define QT_NO_STYLE_WINDOWSCE
-#endif
-
-// QWindowsMobileStyle
-#if !defined(QT_NO_STYLE_WINDOWSMOBILE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM))
-#define QT_NO_STYLE_WINDOWSMOBILE
-#endif
-
-// QWindowsVistaStyle
-#if !defined(QT_NO_STYLE_WINDOWSVISTA) && (defined(QT_NO_STYLE_WINDOWSXP))
-#define QT_NO_STYLE_WINDOWSVISTA
-#endif
-
-// QTabBar
-#if !defined(QT_NO_TABBAR) && (defined(QT_NO_TOOLBUTTON))
-#define QT_NO_TABBAR
-#endif
-
-// OdfWriter
-#if !defined(QT_NO_TEXTODFWRITER) && (defined(QT_NO_XMLSTREAMWRITER))
-#define QT_NO_TEXTODFWRITER
-#endif
-
-// Translation (UTF-8 representation)
-#if !defined(QT_NO_TRANSLATION_UTF8) && (defined(QT_NO_TRANSLATION) || defined(QT_NO_TEXTCODEC))
-#define QT_NO_TRANSLATION_UTF8
-#endif
-
-// QUndoGroup
-#if !defined(QT_NO_UNDOGROUP) && (defined(QT_NO_UNDOSTACK))
-#define QT_NO_UNDOGROUP
-#endif
-
-// QWhatsThis
-#if !defined(QT_NO_WHATSTHIS) && (defined(QT_NO_TOOLBUTTON))
-#define QT_NO_WHATSTHIS
-#endif
-
-// Bearer Management
-#if !defined(QT_NO_BEARERMANAGEMENT) && (defined(QT_NO_LIBRARY) || defined(QT_NO_NETWORKINTERFACE) || defined(QT_NO_PROPERTIES))
-#define QT_NO_BEARERMANAGEMENT
-#endif
-
-// Qt D-Bus module
-#if !defined(QT_NO_DBUS) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_XMLSTREAMREADER))
-#define QT_NO_DBUS
-#endif
-
-// QGraphicsView
-#if !defined(QT_NO_GRAPHICSVIEW) && (defined(QT_NO_SCROLLAREA))
-#define QT_NO_GRAPHICSVIEW
-#endif
-
-// QMdiArea
-#if !defined(QT_NO_MDIAREA) && (defined(QT_NO_SCROLLAREA))
-#define QT_NO_MDIAREA
-#endif
-
-// QSpinBox
-#if !defined(QT_NO_SPINBOX) && (defined(QT_NO_SPINWIDGET) || defined(QT_NO_LINEEDIT) || defined(QT_NO_VALIDATOR))
-#define QT_NO_SPINBOX
-#endif
-
-// QStyleSheetStyle
-#if !defined(QT_NO_STYLE_STYLESHEET) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_PROPERTIES) || defined(QT_NO_CSSPARSER))
-#define QT_NO_STYLE_STYLESHEET
-#endif
-
-// QColorDialog
-#if !defined(QT_NO_COLORDIALOG) && (defined(QT_NO_SPINBOX))
-#define QT_NO_COLORDIALOG
-#endif
-
-// Common UNIX Printing System
-#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY))
-#define QT_NO_CUPS
-#endif
-
-// QGraphicsEffect
-#if !defined(QT_NO_GRAPHICSEFFECT) && (defined(QT_NO_GRAPHICSVIEW))
-#define QT_NO_GRAPHICSEFFECT
-#endif
-
-// The Model/View Framework
-#if !defined(QT_NO_ITEMVIEWS) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_SCROLLAREA))
-#define QT_NO_ITEMVIEWS
-#endif
-
-// QMenuBar
-#if !defined(QT_NO_MENUBAR) && (defined(QT_NO_MENU) || defined(QT_NO_TOOLBUTTON))
-#define QT_NO_MENUBAR
-#endif
-
-// QTabWidget
-#if !defined(QT_NO_TABWIDGET) && (defined(QT_NO_TABBAR) || defined(QT_NO_STACKEDWIDGET))
-#define QT_NO_TABWIDGET
-#endif
-
-// QTextEdit
-#if !defined(QT_NO_TEXTEDIT) && (defined(QT_NO_SCROLLAREA) || defined(QT_NO_PROPERTIES))
-#define QT_NO_TEXTEDIT
-#endif
-
-// QErrorMessage
-#if !defined(QT_NO_ERRORMESSAGE) && (defined(QT_NO_TEXTEDIT))
-#define QT_NO_ERRORMESSAGE
-#endif
-
-// QListView
-#if !defined(QT_NO_LISTVIEW) && (defined(QT_NO_ITEMVIEWS))
-#define QT_NO_LISTVIEW
-#endif
-
-// QMainWindow
-#if !defined(QT_NO_MAINWINDOW) && (defined(QT_NO_MENU) || defined(QT_NO_RESIZEHANDLER) || defined(QT_NO_TOOLBUTTON))
-#define QT_NO_MAINWINDOW
-#endif
-
-// QAbstractProxyModel
-#if !defined(QT_NO_PROXYMODEL) && (defined(QT_NO_ITEMVIEWS))
-#define QT_NO_PROXYMODEL
-#endif
-
-// QStandardItemModel
-#if !defined(QT_NO_STANDARDITEMMODEL) && (defined(QT_NO_ITEMVIEWS))
-#define QT_NO_STANDARDITEMMODEL
-#endif
-
-// QStringListModel
-#if !defined(QT_NO_STRINGLISTMODEL) && (defined(QT_NO_ITEMVIEWS))
-#define QT_NO_STRINGLISTMODEL
-#endif
-
-// QSyntaxHighlighter
-#if !defined(QT_NO_SYNTAXHIGHLIGHTER) && (defined(QT_NO_TEXTEDIT))
-#define QT_NO_SYNTAXHIGHLIGHTER
-#endif
-
-// QTableView
-#if !defined(QT_NO_TABLEVIEW) && (defined(QT_NO_ITEMVIEWS))
-#define QT_NO_TABLEVIEW
-#endif
-
-// QTextBrowser
-#if !defined(QT_NO_TEXTBROWSER) && (defined(QT_NO_TEXTEDIT))
-#define QT_NO_TEXTBROWSER
-#endif
-
-// QToolBox
-#if !defined(QT_NO_TOOLBOX) && (defined(QT_NO_TOOLBUTTON) || defined(QT_NO_SCROLLAREA))
-#define QT_NO_TOOLBOX
-#endif
-
-// QTreeView
-#if !defined(QT_NO_TREEVIEW) && (defined(QT_NO_ITEMVIEWS))
-#define QT_NO_TREEVIEW
-#endif
-
-// Accessibility
-#if !defined(QT_NO_ACCESSIBILITY) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_MENUBAR))
-#define QT_NO_ACCESSIBILITY
-#endif
-
-// QColumnView
-#if !defined(QT_NO_COLUMNVIEW) && (defined(QT_NO_LISTVIEW))
-#define QT_NO_COLUMNVIEW
-#endif
-
-// QCompleter
-#if !defined(QT_NO_COMPLETER) && (defined(QT_NO_PROXYMODEL))
-#define QT_NO_COMPLETER
-#endif
-
-// QDataWidgetMapper
-#if !defined(QT_NO_DATAWIDGETMAPPER) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_PROPERTIES))
-#define QT_NO_DATAWIDGETMAPPER
-#endif
-
-// QIdentityProxyModel
-#if !defined(QT_NO_IDENTITYPROXYMODEL) && (defined(QT_NO_PROXYMODEL))
-#define QT_NO_IDENTITYPROXYMODEL
-#endif
-
-// QListWidget
-#if !defined(QT_NO_LISTWIDGET) && (defined(QT_NO_LISTVIEW))
-#define QT_NO_LISTWIDGET
-#endif
-
-// QSortFilterProxyModel
-#if !defined(QT_NO_SORTFILTERPROXYMODEL) && (defined(QT_NO_PROXYMODEL))
-#define QT_NO_SORTFILTERPROXYMODEL
-#endif
-
-// QTableWidget
-#if !defined(QT_NO_TABLEWIDGET) && (defined(QT_NO_TABLEVIEW))
-#define QT_NO_TABLEWIDGET
-#endif
-
-// QToolBar
-#if !defined(QT_NO_TOOLBAR) && (defined(QT_NO_MAINWINDOW))
-#define QT_NO_TOOLBAR
-#endif
-
-// QTreeWidget
-#if !defined(QT_NO_TREEWIDGET) && (defined(QT_NO_TREEVIEW))
-#define QT_NO_TREEWIDGET
-#endif
-
-// QDirModel
-#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_FILESYSTEMMODEL))
-#define QT_NO_DIRMODEL
-#endif
-
-// QDockwidget
-#if !defined(QT_NO_DOCKWIDGET) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_MAINWINDOW))
-#define QT_NO_DOCKWIDGET
-#endif
-
-// QUndoView
-#if !defined(QT_NO_UNDOVIEW) && (defined(QT_NO_UNDOSTACK) || defined(QT_NO_LISTVIEW))
-#define QT_NO_UNDOVIEW
-#endif
-
-// QCompleter
-#if !defined(QT_NO_FSCOMPLETER) && (defined(QT_NO_FILESYSTEMMODEL) || defined(QT_NO_COMPLETER))
-#define QT_NO_FSCOMPLETER
-#endif
-
-// QComboBox
-#if !defined(QT_NO_COMBOBOX) && (defined(QT_NO_LINEEDIT) || defined(QT_NO_STANDARDITEMMODEL) || defined(QT_NO_LISTVIEW))
-#define QT_NO_COMBOBOX
-#endif
-
-// QPrintPreviewWidget
-#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER) || defined(QT_NO_MAINWINDOW))
-#define QT_NO_PRINTPREVIEWWIDGET
-#endif
-
-// QCalendarWidget
-#if !defined(QT_NO_CALENDARWIDGET) && (defined(QT_NO_TABLEVIEW) || defined(QT_NO_MENU) || defined(QT_NO_TEXTDATE) || defined(QT_NO_SPINBOX) || defined(QT_NO_TOOLBUTTON))
-#define QT_NO_CALENDARWIDGET
-#endif
-
-// QDateTimeEdit
-#if !defined(QT_NO_DATETIMEEDIT) && (defined(QT_NO_CALENDARWIDGET) || defined(QT_NO_DATESTRING))
-#define QT_NO_DATETIMEEDIT
-#endif
-
-// QInputDialog
-#if !defined(QT_NO_INPUTDIALOG) && (defined(QT_NO_COMBOBOX) || defined(QT_NO_SPINBOX) || defined(QT_NO_STACKEDWIDGET))
-#define QT_NO_INPUTDIALOG
-#endif
-
-// QFontComboBox
-#if !defined(QT_NO_FONTCOMBOBOX) && (defined(QT_NO_COMBOBOX) || defined(QT_NO_STRINGLISTMODEL))
-#define QT_NO_FONTCOMBOBOX
-#endif
-
-// QFontDialog
-#if !defined(QT_NO_FONTDIALOG) && (defined(QT_NO_STRINGLISTMODEL) || defined(QT_NO_COMBOBOX) || defined(QT_NO_VALIDATOR) || defined(QT_NO_GROUPBOX))
-#define QT_NO_FONTDIALOG
-#endif
-
-// QPrintDialog
-#if !defined(QT_NO_PRINTDIALOG) && (defined(QT_NO_PRINTER) || defined(QT_NO_COMBOBOX) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_SPINBOX) || defined(QT_NO_TREEVIEW) || defined(QT_NO_TABWIDGET))
-#define QT_NO_PRINTDIALOG
-#endif
-
-// QFileDialog
-#if !defined(QT_NO_FILEDIALOG) && (defined(QT_NO_DIRMODEL) || defined(QT_NO_TREEVIEW) || defined(QT_NO_COMBOBOX) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_TOOLTIP) || defined(QT_NO_SPLITTER) || defined(QT_NO_STACKEDWIDGET) || defined(QT_NO_PROXYMODEL))
-#define QT_NO_FILEDIALOG
-#endif
-
-// QPrintPreviewDialog
-#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG) || defined(QT_NO_TOOLBAR))
-#define QT_NO_PRINTPREVIEWDIALOG
-#endif
-
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index ec54c7bdbf..84c9379bbc 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -1,3 +1,11 @@
+# Generic entry format
+#Feature: UPPERCASENAME (for the #define)
+#Description: One sentence description of what this does.
+#Section: Categorization
+#Requires: UPPERCASENAME...
+#Name: CamelCaseName (often a class name)
+#SeeAlso: UPPERCASENAME... (currently unused)
+
# Kernel
Feature: PROPERTIES
@@ -5,147 +13,127 @@ Description: Supports scripting Qt-based applications.
Section: Kernel
Requires:
Name: Properties
-SeeAlso: ???
Feature: TEXTHTMLPARSER
Description: Parser for HTML
Section: Kernel
Requires:
Name: HtmlParser
-SeeAlso: ???
Feature: TEXTODFWRITER
Description: Provides an ODF writer
Section: Kernel
Requires: XMLSTREAMWRITER
Name: OdfWriter
-SeeAlso: ???
Feature: CSSPARSER
Description: Parser for Style Sheets
Section: Kernel
Requires:
Name: CssParser
-SeeAlso: ???
Feature: REGULAREXPRESSION
Description: Perl-compatible regular expression APIs
Section: Kernel
Requires:
Name: QRegularExpression
-SeeAlso: ???
Feature: CONCURRENT
Description: Provides a high-level multi-threaded APIs
Section: Kernel
Requires:
Name: QtConcurrent
-SeeAlso: ???
Feature: DRAGANDDROP
Description: Supports the drag and drop mechansim.
Section: Kernel
Requires: IMAGEFORMAT_XPM
Name: Drag and drop
-SeeAlso: ???
Feature: SESSIONMANAGER
Description: Supports session management.
Section: Kernel
Requires:
Name: Session Manager
-SeeAlso: ???
Feature: SHORTCUT
Description: Supports keyboard accelerators and shortcuts.
Section: Kernel
Requires:
Name: QShortcut
-SeeAlso: ???
Feature: ACTION
Description: Supports widget actions.
Section: Kernel
Requires:
Name: QAction
-SeeAlso: ???
Feature: CURSOR
Description: Supports mouse cursors.
Section: Kernel
Requires:
Name: QCursor
-SeeAlso: ???
Feature: CLIPBOARD
Description: Supports cut and paste operations.
Section: Kernel
Requires:
Name: QClipboard
-SeeAlso: ???
Feature: WHEELEVENT
Description: Supports wheel events.
Section: Kernel
Requires:
Name: QWheelEvent
-SeeAlso: ???
Feature: TABLETEVENT
Description: Supports tablet events.
Section: Kernel
Requires:
Name: QTabletEvent
-SeeAlso: ???
Feature: EFFECTS
Description: Supports special widget effects (e.g. fading and scrolling).
Section: Kernel
Requires:
Name: Effects
-SeeAlso: ???
Feature: SHAREDMEMORY
Description: Provides access to a shared memory segment.
Section: Kernel
Requires:
Name: QSharedMemory
-SeeAlso: ???
Feature: SYSTEMSEMAPHORE
Description: Provides a general counting system semaphore.
Section: Kernel
Requires:
Name: QSystemSemaphore
-SeeAlso: ???
Feature: XMLSTREAM
Description: Provides a simple streaming API for XML.
Section: Kernel
Requires:
-Name:
-SeeAlso: ???
+Name: XML Streaming APIs
Feature: XMLSTREAMREADER
Description: Provides a well-formed XML parser with a simple streaming API.
Section: Kernel
Requires: XMLSTREAM
Name: QXmlStreamReader
-SeeAlso: ???
Feature: XMLSTREAMWRITER
Description: Provides a XML writer with a simple streaming API.
Section: Kernel
Requires: XMLSTREAM
Name: QXmlStreamWriter
-SeeAlso: ???
Feature: IM
Description: Inputmethods with QInputContext
Section: Kernel
Requires: LIBRARY
Name: QInputContext
-SeeAlso: ???
+
# Data structures
Feature: TEXTDATE
@@ -153,14 +141,12 @@ Description: Supports month and day names in dates.
Section: Data structures
Requires:
Name: Text Date
-SeeAlso: ???
Feature: DATESTRING
Description: Supports convertion between dates and strings.
Section: Data structures
Requires: TEXTDATE
Name: QDate/QTime/QDateTime
-SeeAlso: ???
# File I/O
@@ -169,58 +155,48 @@ Description: Supports external process invocation.
Section: File I/O
Requires:
Name: QProcess
-SeeAlso: ???
Feature: TEMPORARYFILE
Description: Provides an I/O device that operates on temporary files.
Section: File I/O
Requires:
Name: QTemporaryFile
-SeeAlso: ???
Feature: LIBRARY
Description: Supports a shared library wrapper.
Section: File I/O
Requires:
Name: QLibrary
-SeeAlso: ???
Feature: SETTINGS
Description: Supports persistent application settings.
Section: File I/O
Requires:
Name: QSettings
-SeeAlso: ???
Feature: DOM
Description: Supports the Document Object Model.
Section: File I/O
Requires:
Name: Document Object Model
-SeeAlso: ???
Feature: FILESYSTEMMODEL
Description: Provides a data model for the local filesystem.
Section: File I/O
Requires:
Name: QFileSystemModel
-SeeAlso: ???
Feature: FILESYSTEMWATCHER
-Description: Provides an interface for monitoring files and directories
-for modications.
+Description: Provides an interface for monitoring files and directories for modications.
Section: File I/O
Requires:
Name: QFileSystemWatcher
-SeeAlso: ???
Feature: FILESYSTEMITERATOR
Description: Provides fast file-system iteration.
-for modications.
Section: File I/O
Requires:
Name: QFileSystemIterator
-SeeAlso: ???
# Widgets
@@ -229,326 +205,282 @@ Description: Supports views using tree models.
Section: Widgets
Requires: TREEVIEW
Name: QTreeWidget
-SeeAlso: ???
Feature: LISTWIDGET
Description: Supports item-based list widgets.
Section: Widgets
Requires: LISTVIEW
Name: QListWidget
-SeeAlso: ???
Feature: TABLEWIDGET
Description: Supports item-based table views.
Section: Widgets
Requires: TABLEVIEW
Name: QTableWidget
-SeeAlso: ???
Feature: DATETIMEEDIT
Description: Supports editing dates and times.
Section: Widgets
Requires: CALENDARWIDGET DATESTRING
Name: QDateTimeEdit
-SeeAlso: ???
Feature: STACKEDWIDGET
Description: Supports stacked widgets.
Section: Widgets
Requires:
Name: QStackedWidget
-SeeAlso: ???
Feature: TEXTBROWSER
Description: Supports HTML document browsing.
Section: Widgets
Requires: TEXTEDIT
Name: QTextBrowser
-SeeAlso: ???
Feature: SPLASHSCREEN
Description: Supports splash screens that can be shown during application startup.
Section: Widgets
Requires:
Name: Splash screen widget
-SeeAlso: ???
Feature: SPLITTER
Description: Supports user controlled splitter widgets.
Section: Widgets
Requires: RUBBERBAND
Name: QSplitter
-SeeAlso: ???
Feature: LCDNUMBER
Description: Supports LCD-like digits.
Section: Widgets
Requires:
Name: QLCDNumber
-SeeAlso: ???
Feature: MENU
Description: Supports popup-menus.
Section: Widgets
Requires: ACTION
Name: QMenu
-SeeAlso: ???
Feature: LINEEDIT
Description: Supports single-line edits.
Section: Widgets
Requires:
Name: QLineEdit
-SeeAlso: ???
Feature: SPINBOX
Description: Supports spin boxes handling integers and discrete sets of values.
Section: Widgets
Requires: SPINWIDGET LINEEDIT VALIDATOR
Name: QSpinBox
-SeeAlso: ???
Feature: TABBAR
Description: Supports tab bars, e.g. for use in tabbed dialogs.
Section: Widgets
Requires: TOOLBUTTON
Name: QTabBar
-SeeAlso: ???
Feature: TABWIDGET
Description: Supports stacking tabbed widgets.
Section: Widgets
Requires: TABBAR STACKEDWIDGET
Name: QTabWidget
-SeeAlso: ???
Feature: COMBOBOX
Description: Supports comboboxes presenting a list of options to the user.
Section: Widgets
Requires: LINEEDIT STANDARDITEMMODEL LISTVIEW
Name: QComboBox
-SeeAlso: ???
Feature: FONTCOMBOBOX
Description: Supports a combobox that lets the user select a font family.
Section: Widgets
Requires: COMBOBOX STRINGLISTMODEL
Name: QFontComboBox
-SeeAlso: ???
Feature: TOOLBUTTON
Description: Supports quick-access buttons to commands and options.
Section: Widgets
Requires: ACTION
Name: QToolButton
-SeeAlso: ???
Feature: TOOLBAR
Description: Supports movable panels containing a set of controls.
Section: Widgets
Requires: MAINWINDOW
Name: QToolBar
-SeeAlso: ???
Feature: TOOLBOX
-Description: Supports columns of tabbed widget items.
+Description: Supports columns of tabbed widget items.
Section: Widgets
Requires: TOOLBUTTON SCROLLAREA
Name: QToolBox
-SeeAlso: ???
Feature: GROUPBOX
Description: Supports group box frames.
Section: Widgets
Requires:
Name: QGroupBox
-SeeAlso: ???
Feature: BUTTONGROUP
Description: Supports organizing groups of button widgets.
Section: Widgets
Requires: GROUPBOX
Name: QButtonGroup
-SeeAlso: ???
Feature: MAINWINDOW
Description: Supports main application windows.
Section: Widgets
Requires: MENU RESIZEHANDLER TOOLBUTTON
Name: QMainWindow
-SeeAlso: ???
Feature: DOCKWIDGET
-Description: Supports docking widgets inside a QMainWindow or floated as
-a top-level window on the desktop.
+Description: Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop.
Section: Widgets
Requires: RUBBERBAND MAINWINDOW
Name: QDockwidget
-SeeAlso: ???
Feature: MDIAREA
Description: Provides an area in which MDI windows are displayed.
Section: Widgets
Requires: SCROLLAREA
Name: QMdiArea
-SeeAlso: ???
Feature: RESIZEHANDLER
Description: Supports an internal resize handler.
Section: Widgets
Requires:
Name: Resize Handler
-SeeAlso: ???
Feature: STATUSBAR
Description: Supports presentation of status information.
Section: Widgets
Requires:
Name: QStatusBar
-SeeAlso: ???
Feature: MENUBAR
Description: Supports pull-down menu items.
Section: Widgets
Requires: MENU TOOLBUTTON
Name: QMenuBar
-SeeAlso: ???
Feature: CONTEXTMENU
Description: Supports pop-up menus on right mouse click
Section: Widgets
Requires: MENU
Name: Context menu
-SeeeAlso: ???
Feature: PROGRESSBAR
Description: Supports presentation of operation progress.
Section: Widgets
Requires:
Name: QProgressBar
-SeeAlso: ???
Feature: SLIDER
Description: Supports sliders controlling a bounded value.
Section: Widgets
Requires:
Name: QSlider
-SeeAlso: ???
Feature: SCROLLBAR
-Description: Supports scrollbars allowing the user access parts of a
-document that is larger than the widget used to display it.
+Description: Supports scrollbars allowing the user access parts of a document that is larger than the widget used to display it.
Section: Widgets
Requires: SLIDER
Name: QScrollBar
-SeeAlso: ???
Feature: DIAL
Description: Supports rounded range control, e.g. like a speedometer.
Section: Widgets
Requires: SLIDER
Name: QDial
-SeeAlso: ???
Feature: SCROLLAREA
Description: Supports scrolling views onto widgets.
Section: Widgets
Requires: SCROLLBAR
Name: QScrollArea
-SeeAlso: ???
Feature: GRAPHICSVIEW
Description: Supports the graphicsview classes.
Section: Widgets
Requires: SCROLLAREA
Name: QGraphicsView
-SeeAlso: ???
Feature: GRAPHICSEFFECT
Description: Supports the graphicseffect classes.
Section: Widgets
Requires: GRAPHICSVIEW
Name: QGraphicsEffect
-SeeAlso: ???
Feature: SPINWIDGET
Description: Supports spinbox control widgets.
Section: Widgets
Requires:
Name: Spin Widget
-SeeAlso: ???
Feature: TEXTEDIT
Description: Supports rich text editing.
Section: Widgets
Requires: SCROLLAREA PROPERTIES
Name: QTextEdit
-SeeAlso: ???
Feature: SYNTAXHIGHLIGHTER
Description: Supports custom syntax highlighting.
Section: Widgets
Requires: TEXTEDIT
Name: QSyntaxHighlighter
-SeeAlso: ???
Feature: RUBBERBAND
Description: Supports using rubberbands to indicate selections and boundaries.
Section: Widgets
Requires:
Name: QRubberBand
-SeeAlso: ???
Feature: TOOLTIP
Description: Supports presentation of tooltips.
Section: Widgets
Requires:
Name: QToolTip
-SeeAlso: ???
Feature: STATUSTIP
Description: Supports status tip functionality and events.
Section: Widgets
Requires:
Name: Status Tip
-SeeAlso: ???
Feature: WHATSTHIS
Description: Supports displaying "What's this" help.
Section: Widgets
Requires: TOOLBUTTON
Name: QWhatsThis
-SeeAlso: ???
Feature: VALIDATOR
Description: Supports validation of input text.
Section: Widgets
Requires:
Name: QValidator
-SeeAlso: ???
Feature: SIZEGRIP
Description: Supports corner-grips for resizing a top-level windows.
Section: Widgets
Requires:
Name: QSizeGrip
-SeeAlso: ???
Feature: CALENDARWIDGET
-Description: Provides a monthly based calendar widget allowing the user to select
-a date.
+Description: Provides a monthly based calendar widget allowing the user to select a date.
Section: Widgets
Requires: TABLEVIEW MENU TEXTDATE SPINBOX TOOLBUTTON
Name: QCalendarWidget
-SeeAlso: ???
Feature: PRINTPREVIEWWIDGET
Description: Provides a widget for previewing page layouts for printer output.
-a date.
Section: Widgets
Requires: GRAPHICSVIEW PRINTER MAINWINDOW
Name: QPrintPreviewWidget
-SeeAlso: ???
+
+Feature: KEYSEQUENCEEDIT
+Description: Provides a widget for editing QKeySequences
+Section: Widgets
+Requires: LINEEDIT SHORTCUT
+Name: QKeySequenceEdit
# Dialogs
@@ -558,158 +490,134 @@ informative messages and simple questions.
Section: Dialogs
Requires:
Name: QMessageBox
-SeeAlso: ???
Feature: COLORDIALOG
Description: Supports a dialog widget for specifying colors.
Section: Dialogs
Requires: SPINBOX
Name: QColorDialog
-SeeAlso: ???
Feature: FILEDIALOG
Description: Supports a dialog widget for selecting files or directories.
Section: Dialogs
Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET PROXYMODEL
Name: QFileDialog
-SeeAlso: ???
Feature: FONTDIALOG
Description: Supports a dialog widget for selecting fonts.
Section: Dialogs
Requires: STRINGLISTMODEL COMBOBOX VALIDATOR GROUPBOX
Name: QFontDialog
-SeeAlso: ???
Feature: PRINTDIALOG
Description: Supports a dialog widget for specifying printer configuration.
Section: Dialogs
Requires: PRINTER COMBOBOX BUTTONGROUP SPINBOX TREEVIEW TABWIDGET
Name: QPrintDialog
-SeeAlso: ???
Feature: PRINTPREVIEWDIALOG
Description: Provides a dialog for previewing and configuring page layouts for printer output.
Section: Dialogs
Requires: PRINTPREVIEWWIDGET PRINTDIALOG TOOLBAR
Name: QPrintPreviewDialog
-SeeAlso: ???
Feature: PROGRESSDIALOG
Description: Supports feedback on the progress of a slow operation.
Section: Dialogs
Requires: PROGRESSBAR
Name: QProgressDialog
-SeeAlso: ???
Feature: INPUTDIALOG
Description: Supports a simple convenience dialog to get a single value from the user.
Section: Dialogs
Requires: COMBOBOX SPINBOX STACKEDWIDGET
Name: QInputDialog
-SeeAlso: ???
Feature: ERRORMESSAGE
-Description: Supports an error message display dialog.
+Description: Supports an error message display dialog.
Section: Dialogs
Requires: TEXTEDIT
Name: QErrorMessage
-SeeAlso: ???
Feature: WIZARD
Description: Provides a framework for wizards.
Section: Dialogs
Requires: PROPERTIES
Name: QWizard
-SeeAlso: ???
# ItemViews
Feature: ITEMVIEWS
-Description: Supports the model/view architecture managing the relationship
-between data and the way it is presented to the user.
+Description: Supports the model/view architecture managing the relationship between data and the way it is presented to the user.
Section: ItemViews
Requires: RUBBERBAND SCROLLAREA
Name: The Model/View Framework
-SeeAlso: ???
Feature: DIRMODEL
Description: Supports a data model for the local filesystem.
Section: ItemViews
Requires: ITEMVIEWS FILESYSTEMMODEL
Name: QDirModel
-SeeAlso: ???
Feature: STANDARDITEMMODEL
Description: Supports a generic model for storing custom data.
Section: ItemViews
Requires: ITEMVIEWS
Name: QStandardItemModel
-SeeAlso: ???
Feature: PROXYMODEL
Description: Supports processing of data passed between another model and a view.
Section: ItemViews
Requires: ITEMVIEWS
Name: QAbstractProxyModel
-SeeAlso: ???
Feature: SORTFILTERPROXYMODEL
-Description: Supports sorting and filtering of data passed between
-another model and a view.
+Description: Supports sorting and filtering of data passed between another model and a view.
Section: ItemViews
Requires: PROXYMODEL
Name: QSortFilterProxyModel
-SeeAlso: ???
Feature: IDENTITYPROXYMODEL
Description: Supports proxying a source model unmodified.
Section: ItemViews
Requires: PROXYMODEL
Name: QIdentityProxyModel
-SeeAlso: ???
Feature: STRINGLISTMODEL
Description: Supports a model that supplies strings to views.
Section: ItemViews
Requires: ITEMVIEWS
Name: QStringListModel
-SeeAlso: ???
Feature: LISTVIEW
Description: Supports a list or icon view onto a model.
Section: ItemViews
Requires: ITEMVIEWS
Name: QListView
-SeeAlso: ???
Feature: TABLEVIEW
Description: Supports a default model/view implementation of a table view.
Section: ItemViews
Requires: ITEMVIEWS
Name: QTableView
-SeeAlso: ???
Feature: TREEVIEW
Description: Supports a default model/view implementation of a tree view.
Section: ItemViews
Requires: ITEMVIEWS
Name: QTreeView
-SeeAlso: ???
Feature: DATAWIDGETMAPPER
Description: Provides mapping between a section of a data model to widgets.
Section: ItemViews
Requires: ITEMVIEWS PROPERTIES
Name: QDataWidgetMapper
-SeeAlso: ???
Feature: COLUMNVIEW
Description: Provides a model/view implementation of a column view.
Section: ItemViews
Requires: LISTVIEW
Name: QColumnView
-SeeAlso: ???
# Styles
@@ -718,49 +626,42 @@ Description: Supports a Microsoft Windows-like look and feel.
Section: Styles
Requires:
Name: QWindowsStyle
-SeeAlso: ???
Feature: STYLE_FUSION
Description: Supports a modern platform independent widget style.
Section: Styles
Requires: IMAGEFORMAT_XPM
Name: QFusionStyle
-SeeAlso: ???
Feature: STYLE_WINDOWSXP
Description: Supports a Microsoft WindowsXP-like look and feel.
Section: Styles
Requires: STYLE_WINDOWS
Name: QWindowsXPStyle
-SeeAlso: ???
Feature: STYLE_WINDOWSVISTA
Description: Supports a Microsoft WindowsVista-like look and feel.
Section: Styles
Requires: STYLE_WINDOWSXP
Name: QWindowsVistaStyle
-SeeAlso: ???
Feature: STYLE_WINDOWSCE
Description: WindowsCE look and feel
Section: Styles
Requires: STYLE_WINDOWS IMAGEFORMAT_XPM
Name: QWindowsCEStyle
-SeeAlso: ???
Feature: STYLE_WINDOWSMOBILE
Description: WindowsMobile look and feel
Section: Styles
Requires: STYLE_WINDOWS IMAGEFORMAT_XPM
Name: QWindowsMobileStyle
-SeeAlso: ???
Feature: STYLE_STYLESHEET
Description:
Section: Styles
Requires: STYLE_WINDOWS PROPERTIES CSSPARSER
Name: QStyleSheetStyle
-SeeAlso: ???
# Images
@@ -769,70 +670,60 @@ Description: Supports writing an image format plugin.
Section: Images
Requires: LIBRARY
Name: QImageIOPlugin
-SeeAlso: ???
Feature: MOVIE
Description: Supports animated images.
Section: Images
Requires:
Name: QMovie
-SeeAlso: ???
Feature: IMAGEFORMAT_BMP
-Description: Supports Microsoft's Bitmap image file format.
+Description: Supports Microsoft's Bitmap image file format.
Section: Images
Requires:
Name: BMP Image Format
-SeeAlso: ???
Feature: IMAGEFORMAT_PPM
Description: Supports the Portable Pixmap image file format.
Section: Images
Requires:
Name: PPM Image Format
-SeeAlso: ???
Feature: IMAGEFORMAT_XBM
Description: Supports the X11 Bitmap image file format.
Section: Images
Requires:
Name: XBM Image Format
-SeeAlso: ???
Feature: IMAGEFORMAT_XPM
Description: Supports the X11 Pixmap image file format.
Section: Images
Requires:
Name: XPM Image Format
-SeeAlso: ???
Feature: IMAGEFORMAT_PNG
Description: Supports the Portable Network Graphics image file format.
Section: Images
Requires:
Name: PNG Image Format
-SeeAlso: ???
Feature: IMAGEFORMAT_JPEG
Description: Supports the Joint Photographic Experts Group image file format.
Section: Images
Requires:
Name: JPEG Image Format
-SeeAlso: ???
Feature: IMAGE_HEURISTIC_MASK
Description: Supports creating a 1-bpp heuristic mask for images.
Section: Images
Requires:
Name: QImage::createHeuristicMask()
-SeeAlso: ???
Feature: IMAGE_TEXT
Description: Supports image file text strings.
Section: Images
Requires:
Name: Image Text
-SeeAlso: ???
# Painting
@@ -841,50 +732,36 @@ Description: Supports recording and replaying QPainter commands.
Section: Painting
Requires:
Name: QPicture
-SeeAlso: ???
Feature: COLORNAMES
-Description: Supports color names such as "red", used by QColor
-and by some HTML documents.
+Description: Supports color names such as "red", used by QColor and by some HTML documents.
Section: Painting
Requires:
Name: Color Names
-SeeAlso: ???
Feature: PDF
Description: Supports pdf format
Section: Painting
Requires: TEMPORARYFILE
Name: QPdf
-SeeAlso: ???
Feature: PRINTER
Description: Supports printing
Section: Painting
Requires: PICTURE TEMPORARYFILE
Name: QPrinter
-SeeAlso: ???
Feature: CUPS
Description Supports the Common UNIX Printing System
Section: Painting
Requires: PRINTER LIBRARY
Name: Common UNIX Printing System
-SeeAlso: ???
-
-Feature: PAINTONSCREEN
-Description: Supports the Qt::WA_PaintOnScreen widget attribute.
-Section: Painting
-Requires:
-Name: Qt::WA_PaintOnScreen
-SeeAlso: ???
Feature: PAINT_DEBUG
Description: Debug painting with the environment variables QT_FLUSH_UPDATE and QT_FLUSH_PAINT
Section: Painting
Requires:
Name: Painting Debug Utilities
-SeeAlso: ???
# Fonts
@@ -893,7 +770,6 @@ Description: Supports the FreeType 2 font engine (and its supported font formats
Section: Fonts
Requires:
Name: Freetype Font Engine
-SeeAlso: ???
# Internationalization
@@ -902,114 +778,86 @@ Description: Supports translations using QObject::tr().
Section: Internationalization
Requires:
Name: Translation
-SeeAlso: ???
-
-Feature: TRANSLATION_UTF8
-Description: Supports translations using QObject::trUtf8().
-Section: Internationalization
-Requires: TRANSLATION TEXTCODEC
-Name: Translation (UTF-8 representation)
-SeeAlso: ???
Feature: TEXTCODEC
Description: Supports conversions between text encodings.
Section: Internationalization
Requires:
Name: QTextCodec
-SeeAlso: ???
Feature: CODECS
Description: Supports non-unicode text conversions.
Section: Internationalization
Requires: TEXTCODEC
Name: Codecs
-SeeAlso: ???
Feature: BIG_CODECS
Description: Supports big codecs, e.g. CJK.
Section: Internationalization
Requires: TEXTCODEC
Name: Big Codecs
-SeeAlso: ???
Feature: ICONV
Description: Supports conversions between text encodings using iconv.
Section: Internationalization
Requires: TEXTCODEC
Name: iconv
-SeeAlso: ???
# Networking
-Feature: HOSTINFO
-Description: Supports host name lookups.
-Section: Networking
-Requires:
-Name: QHostInfo
-SeeAlso: ???
-
Feature: FTP
Description: Supports FTP file access.
Section: Networking
Requires: TEXTDATE
Name: File Transfer Protocol
-SeeAlso: ???
Feature: HTTP
Description: Supports HTTP file access.
Section: Networking
-Requires: HOSTINFO
+Requires:
Name: Hyper Text Transfer Protocol
-SeeAlso: ???
Feature: UDPSOCKET
Description: Supports User Datagram Protocol sockets.
Section: Networking
Requires:
Name: QUdpSocket
-SeeAlso: ???
Feature: NETWORKPROXY
Description: Supports configuring network layer proxy support to the Qt network classes.
Section: Networking
Requires:
Name: QNetworkProxy
-SeeAlso: ???
Feature: SOCKS5
Description: Supports SOCKS v5 network proxy.
Section: Networking
Requires: NETWORKPROXY
-Name: SOCKS5
-SeeAlso: ???
+Name: SOCKS5
Feature: NETWORKINTERFACE
Description: Supports listing the host's IP addresses and network interfaces
Section: Networking
Requires:
Name: QNetworkInterface
-SeeAlso: ???
Feature: NETWORKDISKCACHE
Description: Supports a disk cache for network resources
Section: Networking
Requires: TEMPORARYFILE
Name: QNetworkDiskCache
-SeeAlso: ???
Feature: BEARERMANAGEMENT
Description: Provides bearer management support
Section: Networking
Requires: LIBRARY NETWORKINTERFACE PROPERTIES
Name: Bearer Management
-SeeAlso: ???
Feature: LOCALSERVER
Description: Supports a local socket based server
Section: Networking
Requires: TEMPORARYFILE
Name: QLocalServer
-SeeAlso: ???
# Utilities
@@ -1018,84 +866,72 @@ Description: Provides completions based on an item model.
Section: Utilities
Requires: PROXYMODEL
Name: QCompleter
-SeeAlso: ???
Feature: FSCOMPLETER
Description: Provides completions based on an item model.
Section: Utilities
Requires: FILESYSTEMMODEL COMPLETER
Name: QCompleter
-SeeAlso: ???
Feature: DESKTOPSERVICES
Description: Provides methods for accessing common desktop services.
Section: Utilities
Requires:
Name: QDesktopServices
-SeeAlso: ???
Feature: SYSTEMTRAYICON
Description: Provides an icon for an application in the system tray.
Section: Utilities
Requires:
Name: QSystemTrayIcon
-SeeAlso: ???
Feature: UNDOCOMMAND
Description: Applies (redo or) undo of a single change in a document.
Section: Utilities
Requires:
Name: QUndoCommand
-SeeAlso: ???
Feature: UNDOSTACK
Description: Provides the ability to (redo or) undo a list of changes in a document.
Section: Utilities
Requires: UNDOCOMMAND
Name: QUndoStack
-SeeAlso: ???
Feature: UNDOGROUP
Description:
Section: Utilities
Requires: UNDOSTACK
Name: QUndoGroup
-SeeAlso: ???
Feature: UNDOVIEW
Description: A widget which shows the contents of an undo stack.
Section: Utilities
Requires: UNDOSTACK LISTVIEW
Name: QUndoView
-SeeAlso: ???
Feature: ACCESSIBILITY
Description: Provides accessibility support.
Section: Utilities
Requires: PROPERTIES MENUBAR
Name: Accessibility
-SeeAlso: ???
Feature: ANIMATION
Description: Provides a framework for animations.
Section: Utilities
Requires: PROPERTIES
Name: Animation
-SeeAlso: ???
Feature: STATEMACHINE
Description: Provides hierarchical finite state machines.
Section: Utilities
Requires: PROPERTIES
Name: State machine
-SeeAlso: ???
Feature: GESTURES
Description: Provides a framework for gestures.
Section: Utilities
Requires:
Name: Gesture
-SeeAlso: ???
# D-Bus
@@ -1104,5 +940,11 @@ Description: Provides classes for D-Bus.
Section: D-Bus
Requires: PROPERTIES XMLSTREAMREADER
Name: Qt D-Bus module
-SeeAlso: ???
+# XML Patterns
+
+Feature: XMLSCHEMA
+Description: Provides XML schema validation.
+Section: Xml Patterns
+Requires:
+Name: XML Schema APIs
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index 5b7edbafa6..dd4222b89f 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -111,14 +111,14 @@ public:
Q_DECL_CONSTEXPR inline operator Int() const { return i; }
- Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); }
- Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | Int(f))); }
- Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); }
- Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ Int(f))); }
- Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); }
- Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); }
- Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & Int(f))); }
- Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); }
+ Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(QFlag(i | f.i)); }
+ Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(QFlag(i | Int(f))); }
+ Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(QFlag(i ^ f.i)); }
+ Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(QFlag(i ^ Int(f))); }
+ Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(QFlag(i & mask)); }
+ Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(QFlag(i & mask)); }
+ Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(QFlag(i & Int(f))); }
+ Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(QFlag(~i)); }
Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 6f74c7de88..f72d27c2e5 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -88,6 +88,14 @@ Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n);
Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
#endif
+// Statically check assumptions about the environment we're running
+// in. The idea here is to error or warn if otherwise implicit Qt
+// assumptions are not fulfilled on new hardware or compilers
+// (if this list becomes too long, consider factoring into a separate file)
+Q_STATIC_ASSERT_X(sizeof(int) == 4, "Qt assumes that int is 32 bits");
+Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits");
+
+
/*!
\class QFlag
\inmodule QtCore
@@ -721,10 +729,6 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
A message generated by the qCritical() function.
\value QtFatalMsg
A message generated by the qFatal() function.
- \value QtTraceMsg
- Used by the qCTrace() macro. Trace events are usually passed only
- to dedicated \a QTracer objects, and do not appear in the installed
- message handler.
\value QtSystemMsg
@@ -981,8 +985,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
/*!
\fn QSysInfo::MacVersion QSysInfo::macVersion()
- Returns the version of Mac OS X on which the application is run (Mac OS X
- Only).
+ Returns the version of Darwin (OS X or iOS) on which the application is run.
*/
/*!
@@ -1018,6 +1021,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value WV_VISTA Windows Vista, Windows Server 2008 (operating system version 6.0)
\value WV_WINDOWS7 Windows 7, Windows Server 2008 R2 (operating system version 6.1)
\value WV_WINDOWS8 Windows 8 (operating system version 6.2)
+ \value WV_WINDOWS8_1 Windows 8.1 (operating system version 6.3), introduced in Qt 5.2
Alternatively, you may use the following macros which correspond directly to the Windows operating system version number:
@@ -1028,6 +1032,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value WV_6_0 Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008
\value WV_6_1 Operating system version 6.1, corresponds to Windows 7 and Windows Server 2008 R2
\value WV_6_2 Operating system version 6.2, corresponds to Windows 8
+ \value WV_6_3 Operating system version 6.3, corresponds to Windows 8.1, introduced in Qt 5.2
CE-based versions:
@@ -1050,7 +1055,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\enum QSysInfo::MacVersion
This enum provides symbolic names for the various versions of the
- OS X operating system. On OS X, the
+ Darwin operating system, covering both OS X and iOS. The
QSysInfo::MacintoshVersion variable gives the version of the
system on which the application is run.
@@ -1078,6 +1083,15 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value MV_MOUNTAINLION Apple codename for MV_10_8
\value MV_MAVERICKS Apple codename for MV_10_9
+ \value MV_IOS iOS (any)
+ \value MV_IOS_4_3 iOS 4.3
+ \value MV_IOS_5_0 iOS 5.0
+ \value MV_IOS_5_1 iOS 5.1
+ \value MV_IOS_6_0 iOS 6.0
+ \value MV_IOS_6_1 iOS 6.1
+ \value MV_IOS_7_0 iOS 7.0
+ \value MV_IOS_7_1 iOS 7.1
+
\sa WinVersion
*/
@@ -1700,13 +1714,15 @@ static const unsigned int qt_one = 1;
const int QSysInfo::ByteOrder = ((*((unsigned char *) &qt_one) == 0) ? BigEndian : LittleEndian);
#endif
-#if defined(Q_OS_MACX)
+#if defined(Q_OS_MAC)
QT_BEGIN_INCLUDE_NAMESPACE
#include "private/qcore_mac_p.h"
#include "qnamespace.h"
QT_END_INCLUDE_NAMESPACE
+#if defined(Q_OS_OSX)
+
Q_CORE_EXPORT OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref)
{
return FSPathMakeRef(reinterpret_cast<const UInt8 *>(file.toUtf8().constData()), fsref, 0);
@@ -1722,17 +1738,17 @@ Q_CORE_EXPORT void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding e
Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) {
return QCFString(CFStringCreateWithPascalString(0, pstr, CFStringGetSystemEncoding()));
}
-#endif // defined(Q_OS_MACX)
-
-#if defined(Q_OS_MAC)
+#endif // defined(Q_OS_OSX)
QSysInfo::MacVersion QSysInfo::macVersion()
{
-#ifdef Q_OS_MACX
+#if defined(Q_OS_OSX)
SInt32 gestalt_version;
if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2);
}
+#elif defined(Q_OS_IOS)
+ return qt_ios_version(); // qtcore_mac_objc.mm
#endif
return QSysInfo::MV_Unknown;
}
@@ -1744,6 +1760,38 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "qt_windows.h"
QT_END_INCLUDE_NAMESPACE
+#ifndef Q_OS_WINRT
+static inline OSVERSIONINFO winOsVersion()
+{
+ OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
+ // GetVersionEx() has been deprecated in Windows 8.1 and will return
+ // only Windows 8 from that version on.
+# if defined(_MSC_VER) && _MSC_VER >= 1800
+# pragma warning( push )
+# pragma warning( disable : 4996 )
+# endif
+ GetVersionEx(&result);
+# if defined(_MSC_VER) && _MSC_VER >= 1800
+# pragma warning( pop )
+# endif
+# ifndef Q_OS_WINCE
+ if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) {
+ // This could be Windows 8.1 or higher. Note that as of Windows 9,
+ // the major version needs to be checked as well.
+ DWORDLONG conditionMask = 0;
+ VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
+ OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion,
+ result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
+ for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
+ result.dwMinorVersion = checkVersion.dwMinorVersion;
+ }
+# endif // !Q_OS_WINCE
+ return result;
+}
+#endif // !Q_OS_WINRT
+
QSysInfo::WinVersion QSysInfo::windowsVersion()
{
#ifndef VER_PLATFORM_WIN32s
@@ -1766,9 +1814,7 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
winver = QSysInfo::WV_WINDOWS8;
#else
winver = QSysInfo::WV_NT;
- OSVERSIONINFO osver;
- osver.dwOSVersionInfoSize = sizeof(osver);
- GetVersionEx(&osver);
+ const OSVERSIONINFO osver = winOsVersion();
#ifdef Q_OS_WINCE
DWORD qt_cever = 0;
qt_cever = osver.dwMajorVersion * 100;
@@ -1814,6 +1860,8 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
winver = QSysInfo::WV_WINDOWS7;
} else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 2) {
winver = QSysInfo::WV_WINDOWS8;
+ } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 3) {
+ winver = QSysInfo::WV_WINDOWS8_1;
} else {
qWarning("Qt: Untested Windows version %d.%d detected!",
int(osver.dwMajorVersion), int(osver.dwMinorVersion));
@@ -2389,9 +2437,14 @@ void qsrand(uint seed)
srand(seed);
}
#elif defined(Q_OS_ANDROID)
- QJNIObjectPrivate random = QJNIObjectPrivate("java/util/Random",
- "(J)V",
- jlong(seed));
+ if (randomTLS->hasLocalData()) {
+ randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed));
+ return;
+ }
+
+ QJNIObjectPrivate random("java/util/Random",
+ "(J)V",
+ jlong(seed));
if (!random.isValid()) {
srand(seed);
return;
@@ -2444,19 +2497,20 @@ int qrand()
if (!randomStorage)
return rand();
- QJNIObjectPrivate random;
- if (!randomStorage->hasLocalData()) {
- random = QJNIObjectPrivate("java/util/Random",
- "(J)V",
- jlong(1));
- if (!random.isValid())
- return rand();
-
- randomStorage->setLocalData(random);
- } else {
- random = randomStorage->localData();
+ if (randomStorage->hasLocalData()) {
+ return randomStorage->localData().callMethod<jint>("nextInt",
+ "(I)I",
+ RAND_MAX);
}
+ QJNIObjectPrivate random("java/util/Random",
+ "(J)V",
+ jlong(1));
+
+ if (!random.isValid())
+ return rand();
+
+ randomStorage->setLocalData(random);
return random.callMethod<jint>("nextInt", "(I)I", RAND_MAX);
#else
// On Windows srand() and rand() already use Thread-Local-Storage
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index b654ba3ac8..da5f65fafb 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -55,12 +55,11 @@
*/
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-#if !defined(QT_BUILD_MOC) && !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE)
+#if !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE)
#include <QtCore/qconfig.h>
-#endif
-
#include <QtCore/qfeatures.h>
#define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE))
+#endif
/* These two macros makes it possible to turn the builtin line expander into a
* string literal. */
@@ -198,6 +197,8 @@ typedef quint64 qulonglong;
# define QT_POINTER_SIZE 4
# elif defined(Q_OS_ANDROID)
# define QT_POINTER_SIZE 4 // ### Add auto-detection to Windows configure
+# elif !defined(QT_BOOTSTRAPPED)
+# error could not determine QT_POINTER_SIZE
# endif
#endif
@@ -212,11 +213,8 @@ typedef unsigned int uint;
typedef unsigned long ulong;
QT_END_INCLUDE_NAMESPACE
-// This logic must match the one in qmetatype.h
#if defined(QT_COORD_TYPE)
typedef QT_COORD_TYPE qreal;
-#elif defined(QT_NO_FPU) || defined(Q_PROCESSOR_ARM) || defined(Q_OS_WINCE)
-typedef float qreal;
#else
typedef double qreal;
#endif
@@ -333,9 +331,6 @@ typedef double qreal;
# define Q_AUTOTEST_EXPORT
#endif
-#define Q_INIT_RESOURCE_EXTERN(name) \
- extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) ();
-
#define Q_INIT_RESOURCE(name) \
do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0)
@@ -530,6 +525,16 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
# define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) \
(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < osx) || \
(defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios)
+
+# define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \
+ QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios)
+# define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) \
+ QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, __IPHONE_NA)
+
+# define QT_IOS_DEPLOYMENT_TARGET_BELOW(ios) \
+ QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios)
+# define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) \
+ QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, __IPHONE_NA)
#endif
/*
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index a279498e93..22a9980812 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -225,7 +225,7 @@ QLibraryInfo::QLibraryInfo()
QString
QLibraryInfo::licensee()
{
- const char *str = QT_CONFIGURE_LICENSEE;
+ const char * volatile str = QT_CONFIGURE_LICENSEE;
return QString::fromLocal8Bit(str);
}
@@ -238,7 +238,7 @@ QLibraryInfo::licensee()
QString
QLibraryInfo::licensedProducts()
{
- const char *str = QT_CONFIGURE_LICENSED_PRODUCTS;
+ const char * volatile str = QT_CONFIGURE_LICENSED_PRODUCTS;
return QString::fromLatin1(str);
}
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 0a261acc77..cc20891c76 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -816,7 +816,6 @@ Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogCont
case QtWarningMsg: message.append(QLatin1String("warning")); break;
case QtCriticalMsg:message.append(QLatin1String("critical")); break;
case QtFatalMsg: message.append(QLatin1String("fatal")); break;
- case QtTraceMsg: message.append(QLatin1String("trace")); break;
}
} else if (token == fileTokenC) {
if (context.file)
@@ -874,7 +873,6 @@ static void android_default_message_handler(QtMsgType type,
{
android_LogPriority priority;
switch (type) {
- case QtTraceMsg:
case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break;
case QtWarningMsg: priority = ANDROID_LOG_WARN; break;
case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break;
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index 68a24d0397..2b798f9ea0 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class QDebug;
class QNoDebug;
-enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtTraceMsg, QtSystemMsg = QtCriticalMsg };
+enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg };
class QMessageLogContext
{
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index a6accdfebc..38735c12de 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -96,6 +96,7 @@ public:
WV_VISTA = 0x0080,
WV_WINDOWS7 = 0x0090,
WV_WINDOWS8 = 0x00a0,
+ WV_WINDOWS8_1 = 0x00b0,
WV_NT_based = 0x00f0,
/* version numbers */
@@ -106,6 +107,7 @@ public:
WV_6_0 = WV_VISTA,
WV_6_1 = WV_WINDOWS7,
WV_6_2 = WV_WINDOWS8,
+ WV_6_3 = WV_WINDOWS8_1,
WV_CE = 0x0100,
WV_CENET = 0x0200,
@@ -118,6 +120,7 @@ public:
#endif
#ifdef Q_OS_MAC
+# define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor)
enum MacVersion {
MV_Unknown = 0x0000,
@@ -144,7 +147,17 @@ public:
MV_SNOWLEOPARD = MV_10_6,
MV_LION = MV_10_7,
MV_MOUNTAINLION = MV_10_8,
- MV_MAVERICKS = MV_10_9
+ MV_MAVERICKS = MV_10_9,
+
+ /* iOS */
+ MV_IOS = 1 << 8,
+ MV_IOS_4_3 = Q_MV_IOS(4, 3),
+ MV_IOS_5_0 = Q_MV_IOS(5, 0),
+ MV_IOS_5_1 = Q_MV_IOS(5, 1),
+ MV_IOS_6_0 = Q_MV_IOS(6, 0),
+ MV_IOS_6_1 = Q_MV_IOS(6, 1),
+ MV_IOS_7_0 = Q_MV_IOS(7, 0),
+ MV_IOS_7_1 = Q_MV_IOS(7, 1)
};
static const MacVersion MacintoshVersion;
static MacVersion macVersion();
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 701f79d21e..0ec3d949b9 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -137,6 +137,8 @@ win32 {
mac {
macx {
SOURCES += io/qstandardpaths_mac.cpp
+ } else:ios {
+ OBJECTIVE_SOURCES += io/qstandardpaths_ios.mm
} else {
SOURCES += io/qstandardpaths_unix.cpp
}
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index bb2b2e99f3..624f45caaf 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1863,9 +1863,12 @@ bool QDir::setCurrent(const QString &path)
*/
/*!
- Returns the absolute path of the application's current directory.
+ Returns the absolute path of the application's current directory. The
+ current directory is the last directory set with QDir::setCurrent() or, if
+ that was never called, the directory at which this application was started
+ at by the parent process.
- \sa current(), setCurrent(), homePath(), rootPath(), tempPath()
+ \sa current(), setCurrent(), homePath(), rootPath(), tempPath(), QCoreApplication::applicationDirPath()
*/
QString QDir::currentPath()
{
@@ -2205,10 +2208,10 @@ QStringList QDir::nameFiltersFromString(const QString &nameFilter)
\relates QDir
Initializes the resources specified by the \c .qrc file with the
- specified base \a name. Normally, Qt resources are loaded
- automatically at startup. The Q_INIT_RESOURCE() macro is
- necessary on some platforms for resources stored in a static
- library.
+ specified base \a name. Normally, when resources are built as part
+ of the application, the resources are loaded automatically at
+ startup. The Q_INIT_RESOURCE() macro is necessary on some platforms
+ for resources stored in a static library.
For example, if your application's resources are listed in a file
called \c myapp.qrc, you can ensure that the resources are
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 897af352c9..2cf97ef94e 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -682,7 +682,7 @@ bool QFileInfo::exists() const
\note If \a file is a symlink that points to a non-existing
file, false is returned.
- \note Using this function is faster for than using
+ \note Using this function is faster than using
\c QFileInfo(file).exists() for file system access.
*/
bool QFileInfo::exists(const QString &file)
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index d67ea80e51..72e4198fb0 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -348,22 +348,30 @@ void QFileSelectorPrivate::updateSelectors()
QStringList QFileSelectorPrivate::platformSelectors()
{
QStringList ret;
-#if defined(Q_OS_LINUX_ANDROID)
+#if defined(Q_OS_WIN)
+ ret << QStringLiteral("windows");
+# if defined(Q_OS_WINCE)
+ ret << QStringLiteral("wince");
+# endif
+#elif defined(Q_OS_UNIX)
+ ret << QStringLiteral("unix");
+# if defined(Q_OS_LINUX_ANDROID)
ret << QStringLiteral("android");
-#elif defined(Q_OS_BLACKBERRY)
+# elif defined(Q_OS_BLACKBERRY)
ret << QStringLiteral("blackberry");
-#elif defined(Q_OS_IOS)
+# elif defined(Q_OS_QNX)
+ ret << QStringLiteral("qnx");
+# elif defined(Q_OS_IOS)
ret << QStringLiteral("ios");
-#elif defined(Q_OS_WINCE)
- ret << QStringLiteral("wince");
-#elif defined(Q_OS_WIN)
- ret << QStringLiteral("windows");
-#elif defined(Q_OS_LINUX)
+# elif defined(Q_OS_LINUX)
ret << QStringLiteral("linux");
-#elif defined(Q_OS_OSX)
- ret << QStringLiteral("osx");
-#elif defined(Q_OS_UNIX)
- ret << QStringLiteral("generic_unix");
+# elif defined(Q_OS_MAC)
+ ret << QStringLiteral("mac");
+# else
+ struct utsname u;
+ if (uname(&u) != -1)
+ ret << QString::fromLatin1(u.sysname).toLower();
+# endif
#endif
return ret;
}
diff --git a/src/corelib/io/qfileselector.h b/src/corelib/io/qfileselector.h
index 9afd985757..cb5f71faae 100644
--- a/src/corelib/io/qfileselector.h
+++ b/src/corelib/io/qfileselector.h
@@ -52,7 +52,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject
{
Q_OBJECT
public:
- QFileSelector(QObject *parent = 0);
+ explicit QFileSelector(QObject *parent = 0);
~QFileSelector();
QString select(const QString &filePath) const;
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index dc8817706c..d1ef9c1770 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -54,16 +54,17 @@
#include <sys/file.h> // flock
#include <sys/types.h> // kill
#include <signal.h> // kill
+#include <unistd.h> // gethostname
QT_BEGIN_NAMESPACE
-static QString localHostName() // from QHostInfo::localHostName()
+static QByteArray localHostName() // from QHostInfo::localHostName(), modified to return a QByteArray
{
- char hostName[512];
- if (gethostname(hostName, sizeof(hostName)) == -1)
- return QString();
- hostName[sizeof(hostName) - 1] = '\0';
- return QString::fromLocal8Bit(hostName);
+ QByteArray hostName(512, Qt::Uninitialized);
+ if (gethostname(hostName.data(), hostName.size()) == -1)
+ return QByteArray();
+ hostName.truncate(strlen(hostName.data()));
+ return hostName;
}
// ### merge into qt_safe_write?
@@ -145,7 +146,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
// Use operator% from the fast builder to avoid multiple memory allocations.
QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n'
% qAppName().toUtf8() % '\n'
- % localHostName().toUtf8() % '\n';
+ % localHostName() % '\n';
const QByteArray lockFileName = QFile::encodeName(fileName);
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644);
@@ -190,7 +191,7 @@ bool QLockFilePrivate::isApparentlyStale() const
QString hostname, appname;
if (!getLockInfo(&pid, &hostname, &appname))
return false;
- if (hostname == localHostName()) {
+ if (hostname == QString::fromLocal8Bit(localHostName())) {
if (::kill(pid, 0) == -1 && errno == ESRCH)
return true; // PID doesn't exist anymore
}
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 8d337ec630..93a98b1835 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -75,10 +75,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
\l isCriticalEnabled(), \l isTraceEnabled(), as well as \l isEnabled()
to check whether messages for the given message type should be logged.
- \note The qCDebug(), qCWarning(), qCCritical(), qCTrace() and
- qCTraceGuard() macros prevent arguments from being evaluated if the
- respective message types are not enabled for the category, so explicit
- checking is not needed:
+ \note The qCDebug(), qCWarning(), qCCritical() macros prevent arguments
+ from being evaluated if the respective message types are not enabled for the
+ category, so explicit checking is not needed:
\snippet qloggingcategory/main.cpp 4
@@ -103,14 +102,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
\snippet qloggingcategory/main.cpp 3
*/
-typedef QVector<QTracer *> Tracers;
-
-class QLoggingCategoryPrivate
-{
-public:
- Tracers tracers;
-};
-
/*!
Constructs a QLoggingCategory object with the provided \a category name.
The object becomes the local identifier for the category.
@@ -118,16 +109,15 @@ public:
If \a category is \c{0}, the category name is changed to \c "default".
*/
QLoggingCategory::QLoggingCategory(const char *category)
- : d(new QLoggingCategoryPrivate),
+ : d(0),
name(0),
enabledDebug(false),
enabledWarning(true),
- enabledCritical(true),
- enabledTrace(false),
- placeholder1(false),
- placeholder2(false),
- placeholder3(false)
+ enabledCritical(true)
{
+ Q_UNUSED(d);
+ Q_UNUSED(placeholder);
+
bool isDefaultCategory
= (category == 0) || (strcmp(category, qtDefaultCategoryName) == 0);
@@ -151,7 +141,6 @@ QLoggingCategory::~QLoggingCategory()
{
if (QLoggingRegistry *reg = QLoggingRegistry::instance())
reg->unregisterCategory(this);
- delete d;
}
/*!
@@ -194,18 +183,6 @@ QLoggingCategory::~QLoggingCategory()
*/
/*!
- \fn bool QLoggingCategory::isTraceEnabled() const
-
- Returns \c true if the tracers associated with this category should
- receive messages. Returns \c false otherwise.
-
- \note The \l qCTrace() and \l qCTraceGuard() macros already do this check
- before executing any
- code. However, calling this method may be useful to avoid
- expensive generation of data that is only used for debug output.
-*/
-
-/*!
Returns \c true if a message of type \a msgtype for the category should be
shown. Returns \c false otherwise.
*/
@@ -215,7 +192,6 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
case QtDebugMsg: return enabledDebug;
case QtWarningMsg: return enabledWarning;
case QtCriticalMsg: return enabledCritical;
- case QtTraceMsg: return enabledTrace;
case QtFatalMsg: return true;
}
return false;
@@ -237,7 +213,6 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
case QtDebugMsg: enabledDebug = enable; break;
case QtWarningMsg: enabledWarning = enable; break;
case QtCriticalMsg: enabledCritical = enable; break;
- case QtTraceMsg: enabledTrace = enable; break;
case QtFatalMsg: break;
}
}
@@ -313,7 +288,7 @@ QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter)
where \c <category> is the name of the category, potentially with \c{*} as a
wildcard symbol at the start and/or the end. The optional \c <type> must
- be either \c debug, \c warning, \c critical, or \c trace.
+ be either \c debug, \c warning, or \c critical.
Example:
@@ -395,56 +370,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
*/
/*!
- \relates QLoggingCategory
- \macro qCTrace(category)
- \since 5.2
-
- Returns an output stream for trace messages in the logging category
- \a category.
-
- The macro expands to code that checks whether
- \l QLoggingCategory::isTraceEnabled() evaluates to \c true.
- If so, the stream arguments are processed and sent to the \l QTracer objects
- registered with the category.
-
- \note Arguments are not processed if trace output for the category is not
- enabled, so do not rely on any side effects.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 6
-
- \sa qCTraceGuard() QTraceGuard
-*/
-
-/*!
- \relates QLoggingCategory
- \macro qCTraceGuard(category)
- \since 5.2
-
- The macro expands to code that creates a guard object with automatic
- storage. The guard constructor checks whether
- \l QLoggingCategory::isTraceEnabled() evaluates to \c true.
- If so, the stream arguments are processed and the \c{start()}
- functions of the \l QTracer objects registered with the \a category are
- called.
-
- The guard destructor also checks whether the category is enabled for
- tracing and if so, the \c{end()}
- functions of the \l QTracer objects registered with the \a category are called.
-
- \note Arguments are always processed, even if trace output for the
- category is disabled. They will, however, in that case not be passed
- to the \c{record()} functions of the registered tracers.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 4
-
- \sa qCTrace() QTracer
-*/
-
-/*!
\macro Q_DECLARE_LOGGING_CATEGORY(name)
\relates QLoggingCategory
\since 5.2
@@ -469,234 +394,4 @@ void QLoggingCategory::setFilterRules(const QString &rules)
This macro must be used outside of a class or method.
*/
-
-/*!
- \class QTracer
- \inmodule QtCore
- \since 5.2
-
- \brief The QTracer class provides an interface for handling
- trace events associated with a logging category.
-
- \c QTracer objects are registered with logging categories.
- Multiple \c QTracer objects
- can be registered with the same category, and the same
- \c QTracer object can be registered with different categories.
-
- If code containing \c qCTrace is executed, and the associated
- logging category is enabled for tracing, all \c QTracer objects
- that are registered with the category are notified.
-
- \c QTracer objects
-*/
-
-/*!
- \fn QTracer::QTracer()
-
- Constructs a tracer object.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 2
-*/
-
-/*!
- \fn QTracer::~QTracer()
-
- Destroys the tracer object.
-*/
-
-/*!
- Registers this tracer for the \a category.
-
- The tracer will later be notified of messages of type
- \c QtTraceMsg, as long as that message type
- is enabled in the category.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 1
- \codeline
- \snippet qtracer/ftracer.cpp 7
-*/
-
-void QTracer::addToCategory(QLoggingCategory &category)
-{
- category.d->tracers.append(this);
-}
-
-/*!
- \fn void QTracer::start()
-
- This function is invoked when a tracing activity starts,
- typically from the constructor of a \c QTraceGuard object
- defined by \c qCTrace() or \c qCTraceGuard().
-
- The base implementation does nothing. \c QTracer subclasses
- are advised to override it if needed.
-
- \sa qCTrace(), qCTraceGuard()
-*/
-
-/*!
- \fn void QTracer::end()
-
- This function is invoked when a tracing activity ends,
- typically from the destructor of a \c QTraceGuard object
- defined by \c qCTrace() or \c qCTraceGuard().
-
- The base implementation does nothing. It is common for
- \c QTracer subclasses to override it to perform flushing
- of collected data.
-
- \sa qCTrace(), qCTraceGuard()
-*/
-
-/*!
- \fn void QTracer::record(int data)
-
- This function is invoked during a tracing activity to
- pass integer \a data to the \c QTracer object.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 3
-*/
-
-/*!
- \fn void QTracer::record(const char *data)
-
- This function is invoked during a tracing activity to
- pass string \a data to the \c QTracer object.
-*/
-
-/*!
- \fn void QTracer::record(const QVariant &data)
-
- This function is invoked during a tracing activity to
- pass abitrary (non-integer, non-string) \a data to
- the \c QTracer object.
-*/
-
-/*!
- \class QTraceGuard
- \since 5.2
- \inmodule QtCore
-
- \brief The QTraceGuard class facilitates notifications to
- \c QTracer objects.
-
- \c QTraceGuard objects are typically implicitly created on the
- stack when using the \c qCTrace or \c qCTraceGuard macros and
- are associated to a \c QLoggingCategory.
-
- The constructor of a \c QTraceGuard objects checks whether
- its associated category is enabled, and if so, informs all
- \c QTracer objects registered with the category that a
- tracing activity starts.
-
- The destructor of a \c QTraceGuard objects checks whether
- its associated category is enabled, and if so, informs all
- \c QTracer objects registered with the category that a
- tracing activity ended.
-
- A \c QTraceGuard object created by \c qCTrace will be destroyed
- at the end of the full expression, a guard created by
- \c qCTraceGuard at the end of the block containing the macro.
-
- During the lifetime of a QTraceGuard object, its \c operator<<()
- can be used to pass additional data to the active tracers.
- The fast path handles only \c int and \c{const char *} data,
- but it is possible to use arbitrary values wrapped in \c QVariants.
-
- \sa QTracer
-*/
-
-/*!
- \fn QTraceGuard::QTraceGuard(QLoggingCategory &category)
- \internal
-
- Constructs a trace guard object relaying to \a category.
-*/
-
-/*!
- \fn QTraceGuard::~QTraceGuard()
- \internal
-
- Destroys the trace guard object.
-*/
-
-/*!
- \internal
-
- Calls \c start() on all registered tracers.
-*/
-
-void QTraceGuard::start()
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->start();
-}
-
-/*!
- \internal
-
- Calls \c end() on all registered tracers.
-*/
-
-void QTraceGuard::end()
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->end();
-}
-
-
-/*!
- \internal
-
- This function is called for int parameters passed to the
- qCTrace stream.
-*/
-
-QTraceGuard &QTraceGuard::operator<<(int msg)
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->record(msg);
- return *this;
-}
-
-/*!
- \internal
-
- This function is called for string parameters passed to the
- qCTrace stream.
-*/
-
-QTraceGuard &QTraceGuard::operator<<(const char *msg)
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->record(msg);
- return *this;
-}
-
-
-/*!
- \internal
-
- This function is called for QVariant parameters passed to the
- qCTrace stream.
-*/
-
-QTraceGuard &QTraceGuard::operator<<(const QVariant &msg)
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->record(msg);
- return *this;
-}
-
QT_END_NAMESPACE
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index 7a119f4937..15c0519827 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -44,14 +44,9 @@
#include <QtCore/qglobal.h>
#include <QtCore/qdebug.h>
-#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE
-class QTracer;
-class QTraceGuard;
-class QLoggingCategoryPrivate;
-
class Q_CORE_EXPORT QLoggingCategory
{
Q_DISABLE_COPY(QLoggingCategory)
@@ -65,7 +60,6 @@ public:
bool isDebugEnabled() const { return enabledDebug; }
bool isWarningEnabled() const { return enabledWarning; }
bool isCriticalEnabled() const { return enabledCritical; }
- bool isTraceEnabled() const { return enabledTrace; }
const char *categoryName() const { return name; }
@@ -80,66 +74,13 @@ public:
static void setFilterRules(const QString &rules);
private:
- friend class QLoggingCategoryPrivate;
- friend class QLoggingRegistry;
- friend class QTraceGuard;
- friend class QTracer;
-
- QLoggingCategoryPrivate *d;
+ void *d; // reserved for future use
const char *name;
bool enabledDebug;
bool enabledWarning;
bool enabledCritical;
- bool enabledTrace;
- // reserve space for future use
- bool placeholder1;
- bool placeholder2;
- bool placeholder3;
-};
-
-class Q_CORE_EXPORT QTracer
-{
- Q_DISABLE_COPY(QTracer)
-public:
- QTracer() {}
- virtual ~QTracer() {}
-
- void addToCategory(QLoggingCategory &category);
-
- virtual void start() {}
- virtual void end() {}
- virtual void record(int) {}
- virtual void record(const char *) {}
- virtual void record(const QVariant &) {}
-};
-
-class Q_CORE_EXPORT QTraceGuard
-{
- Q_DISABLE_COPY(QTraceGuard)
-public:
- QTraceGuard(QLoggingCategory &category)
- {
- target = category.isTraceEnabled() ? &category : 0;
- if (target)
- start();
- }
-
- ~QTraceGuard()
- {
- if (target)
- end();
- }
-
- QTraceGuard &operator<<(int msg);
- QTraceGuard &operator<<(const char *msg);
- QTraceGuard &operator<<(const QVariant &msg);
-
-private:
- void start();
- void end();
-
- QLoggingCategory *target;
+ bool placeholder[5]; // reserve for future use
};
#define Q_DECLARE_LOGGING_CATEGORY(name) \
@@ -154,7 +95,7 @@ private:
}
#define qCDebug(category) \
- for (bool enabled = category().isDebugEnabled(); enabled; enabled = false) \
+ for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug()
#define qCWarning(category) \
for (bool enabled = category().isWarningEnabled(); enabled; enabled = false) \
@@ -162,17 +103,6 @@ private:
#define qCCritical(category) \
for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical()
-#define qCTrace(category) \
- for (bool enabled = category.isTraceEnabled(); enabled; enabled = false) \
- QTraceGuard(category)
-
-
-#define Q_TRACE_GUARD_NAME_HELPER(line) qTraceGuard ## line
-#define Q_TRACE_GUARD_NAME(line) Q_TRACE_GUARD_NAME_HELPER(line)
-
-#define qCTraceGuard(category) \
- QTraceGuard Q_TRACE_GUARD_NAME(__LINE__)(category);
-
#if defined(QT_NO_DEBUG_OUTPUT)
# undef qCDebug
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 885b51709d..a82e6f65f4 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -86,9 +86,6 @@ int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const
case QtCriticalMsg:
fullCategory += QLatin1String(".critical");
break;
- case QtTraceMsg:
- fullCategory += QLatin1String(".trace");
- break;
default:
break;
}
@@ -291,7 +288,6 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
bool debug = (cat->categoryName() == qtDefaultCategoryName);
bool warning = true;
bool critical = true;
- bool trace = true;
QString categoryName = QLatin1String(cat->categoryName());
QLoggingRegistry *reg = QLoggingRegistry::instance();
@@ -305,15 +301,11 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
filterpass = item.pass(categoryName, QtCriticalMsg);
if (filterpass != 0)
critical = (filterpass > 0);
- filterpass = item.pass(categoryName, QtTraceMsg);
- if (filterpass != 0)
- trace = (filterpass > 0);
}
cat->setEnabled(QtDebugMsg, debug);
cat->setEnabled(QtWarningMsg, warning);
cat->setEnabled(QtCriticalMsg, critical);
- cat->setEnabled(QtTraceMsg, trace);
}
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index a0910869c6..8b67fc1962 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -900,7 +900,9 @@ StNormal:
++j;
}
-#ifndef QT_NO_TEXTCODEC
+#ifdef QT_NO_TEXTCODEC
+ Q_UNUSED(codec)
+#else
if (codec) {
stringResult += codec->toUnicode(str.constData() + i, j - i);
} else
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index f6b14c3027..23cff6af27 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -691,7 +691,8 @@ bool QConfFileSettingsPrivate::writePlistFile(const QString &fileName,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
- QCFType<CFDataRef> xmlData = CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList);
+ QCFType<CFDataRef> xmlData = CFPropertyListCreateData(
+ kCFAllocatorDefault, propertyList, kCFPropertyListXMLFormat_v1_0, 0, 0);
SInt32 code;
return CFURLWriteDataAndPropertiesToResource(urlFromFileName(fileName), xmlData, 0, &code);
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 5e2428527c..1181d1b980 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -139,6 +139,9 @@ QT_BEGIN_NAMESPACE
\value DownloadLocation Returns a directory for user's downloaded files. This is a generic value.
If no directory specific for downloads exists, a sensible fallback for storing user
documents is returned.
+ \value GenericConfigLocation Returns a directory location where user-specific
+ configuration files shared between multiple applications should be written.
+ This is a generic value and the returned path is never empty.
The following table gives examples of paths on different operating systems.
The first path is the writable path (unless noted). Other, additional
@@ -499,6 +502,8 @@ QString QStandardPaths::displayName(StandardLocation type)
return QCoreApplication::translate("QStandardPaths", "Runtime");
case ConfigLocation:
return QCoreApplication::translate("QStandardPaths", "Configuration");
+ case GenericConfigLocation:
+ return QCoreApplication::translate("QStandardPaths", "Shared Configuration");
case GenericCacheLocation:
return QCoreApplication::translate("QStandardPaths", "Shared Cache");
case DownloadLocation:
@@ -522,7 +527,7 @@ QString QStandardPaths::displayName(StandardLocation type)
or writing to the current user's configuration.
This affects the locations into which test programs might write files:
- GenericDataLocation, DataLocation, ConfigLocation,
+ GenericDataLocation, DataLocation, ConfigLocation, GenericConfigLocation,
GenericCacheLocation, CacheLocation.
Other locations are not affected.
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index df9089ace7..08d6d7b50c 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -69,7 +69,8 @@ public:
RuntimeLocation,
ConfigLocation,
DownloadLocation,
- GenericCacheLocation
+ GenericCacheLocation,
+ GenericConfigLocation
};
static QString writableLocation(StandardLocation type);
diff --git a/src/corelib/io/qstandardpaths_blackberry.cpp b/src/corelib/io/qstandardpaths_blackberry.cpp
index a801c2fba3..815756ff9a 100644
--- a/src/corelib/io/qstandardpaths_blackberry.cpp
+++ b/src/corelib/io/qstandardpaths_blackberry.cpp
@@ -75,6 +75,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case GenericCacheLocation:
return QDir::homePath() + testModeInsert() + QLatin1String("/Cache");
case ConfigLocation:
+ case GenericConfigLocation:
return QDir::homePath() + testModeInsert() + QLatin1String("/Settings");
case GenericDataLocation:
return sharedRoot + testModeInsert() + QLatin1String("/misc");
diff --git a/src/corelib/io/qstandardpaths_ios.mm b/src/corelib/io/qstandardpaths_ios.mm
new file mode 100644
index 0000000000..e2100045a6
--- /dev/null
+++ b/src/corelib/io/qstandardpaths_ios.mm
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#import <UIKit/UIKit.h>
+
+#include "qstandardpaths.h"
+
+#ifndef QT_NO_STANDARDPATHS
+
+QT_BEGIN_NAMESPACE
+
+static QString pathForDirectory(NSSearchPathDirectory directory)
+{
+ return QString::fromNSString(
+ [NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES) lastObject]);
+}
+
+static QString bundlePath()
+{
+ return QString::fromNSString([[NSBundle mainBundle] bundlePath]);
+}
+
+QString QStandardPaths::writableLocation(StandardLocation type)
+{
+ QString location;
+
+ switch (type) {
+ case DesktopLocation:
+ location = pathForDirectory(NSDesktopDirectory);
+ break;
+ case DocumentsLocation:
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ case FontsLocation:
+ location = bundlePath() + QLatin1String("/.fonts");
+ break;
+ case ApplicationsLocation:
+ location = pathForDirectory(NSApplicationDirectory);
+ break;
+ case MusicLocation:
+ location = pathForDirectory(NSMusicDirectory);
+ break;
+ case MoviesLocation:
+ location = pathForDirectory(NSMoviesDirectory);
+ break;
+ case PicturesLocation:
+ location = pathForDirectory(NSPicturesDirectory);
+ break;
+ case TempLocation:
+ location = QString::fromNSString(NSTemporaryDirectory());
+ break;
+ case HomeLocation:
+ location = bundlePath();
+ break;
+ case DataLocation:
+ case GenericDataLocation:
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ case CacheLocation:
+ case GenericCacheLocation:
+ location = pathForDirectory(NSCachesDirectory);
+ break;
+ case ConfigLocation:
+ case GenericConfigLocation:
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ case DownloadLocation:
+ location = pathForDirectory(NSDownloadsDirectory);
+ break;
+ default:
+ break;
+ }
+
+ switch (type) {
+ case RuntimeLocation:
+ break;
+ default:
+ // All other types must return something, so use the document directory
+ // as a reasonable fall-back (which will always exist).
+ if (location.isEmpty())
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ }
+
+ return location;
+}
+
+QStringList QStandardPaths::standardLocations(StandardLocation type)
+{
+ QStringList dirs;
+ const QString localDir = writableLocation(type);
+ dirs.prepend(localDir);
+ return dirs;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STANDARDPATHS
diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp
index 6744bfeab4..0efdfae253 100644
--- a/src/corelib/io/qstandardpaths_mac.cpp
+++ b/src/corelib/io/qstandardpaths_mac.cpp
@@ -58,6 +58,7 @@ OSType translateLocation(QStandardPaths::StandardLocation type)
{
switch (type) {
case QStandardPaths::ConfigLocation:
+ case QStandardPaths::GenericConfigLocation:
return kPreferencesFolderType;
case QStandardPaths::DesktopLocation:
return kDesktopFolderType;
@@ -149,6 +150,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (type == CacheLocation)
appendOrganizationAndApp(path);
return path;
+ case GenericConfigLocation:
case ConfigLocation:
return qttestDir + QLatin1String("/Preferences");
default:
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index 61e2e03a3d..1b9078f712 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -103,6 +103,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
return xdgDataHome;
}
case ConfigLocation:
+ case GenericConfigLocation:
{
// http://standards.freedesktop.org/basedir-spec/latest/
QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME"));
@@ -277,6 +278,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
QStringList dirs;
switch (type) {
case ConfigLocation:
+ case GenericConfigLocation:
{
// http://standards.freedesktop.org/basedir-spec/latest/
const QString xdgConfigDirs = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS"));
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index d4e0779381..6a79c7c00b 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -99,7 +99,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
wchar_t path[MAX_PATH];
switch (type) {
- case ConfigLocation: // same as DataLocation, on Windows
+ case ConfigLocation: // same as DataLocation, on Windows (oversight, but too late to fix it)
+ case GenericConfigLocation: // same as GenericDataLocation, on Windows
case DataLocation:
case GenericDataLocation:
#if defined Q_OS_WINCE
@@ -111,7 +112,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (isTestModeEnabled())
result += QLatin1String("/qttest");
#ifndef QT_BOOTSTRAPPED
- if (type != GenericDataLocation) {
+ if (type != GenericDataLocation && type != GenericConfigLocation) {
if (!QCoreApplication::organizationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::organizationName();
if (!QCoreApplication::applicationName().isEmpty())
@@ -188,12 +189,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
if (SHGetSpecialFolderPath) {
wchar_t path[MAX_PATH];
switch (type) {
- case ConfigLocation: // same as DataLocation, on Windows
+ case ConfigLocation: // same as DataLocation, on Windows (oversight, but too late to fix it)
+ case GenericConfigLocation: // same as GenericDataLocation, on Windows
case DataLocation:
case GenericDataLocation:
if (SHGetSpecialFolderPath(0, path, CSIDL_COMMON_APPDATA, FALSE)) {
QString result = convertCharArray(path);
- if (type != GenericDataLocation) {
+ if (type != GenericDataLocation && type != GenericConfigLocation) {
#ifndef QT_BOOTSTRAPPED
if (!QCoreApplication::organizationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::organizationName();
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index fe5faa2be7..77aa3c4821 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3586,7 +3586,7 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const
else if (d->fragment != url.d->fragment)
return false;
- if (!(d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask))
+ if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask))
return false;
// Compare paths, after applying path-related options
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index e7edb4365e..602e91ce30 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -51,8 +51,10 @@
#include <QtCore/qglobal.h>
#ifdef Q_OS_MAC
-Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
Q_FORWARD_DECLARE_CF_TYPE(CFURL);
+# ifdef __OBJC__
+Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
+# endif
#endif
QT_BEGIN_NAMESPACE
@@ -84,36 +86,36 @@ public:
inline QUrlTwoFlags &operator^=(E1 f) { i ^= f; return *this; }
inline QUrlTwoFlags &operator^=(E2 f) { i ^= f; return *this; }
- Q_DECL_CONSTEXPR inline operator QFlags<E1>() const { return E1(i); }
- Q_DECL_CONSTEXPR inline operator QFlags<E2>() const { return E2(i); }
+ Q_DECL_CONSTEXPR inline operator QFlags<E1>() const { return QFlag(i); }
+ Q_DECL_CONSTEXPR inline operator QFlags<E2>() const { return QFlag(i); }
Q_DECL_CONSTEXPR inline operator int() const { return i; }
Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(QUrlTwoFlags f) const
- { return QUrlTwoFlags(E1(i | f.i)); }
+ { return QUrlTwoFlags(QFlag(i | f.i)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E1 f) const
- { return QUrlTwoFlags(E1(i | f)); }
+ { return QUrlTwoFlags(QFlag(i | f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E2 f) const
- { return QUrlTwoFlags(E2(i | f)); }
+ { return QUrlTwoFlags(QFlag(i | f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(QUrlTwoFlags f) const
- { return QUrlTwoFlags(E1(i ^ f.i)); }
+ { return QUrlTwoFlags(QFlag(i ^ f.i)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E1 f) const
- { return QUrlTwoFlags(E1(i ^ f)); }
+ { return QUrlTwoFlags(QFlag(i ^ f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E2 f) const
- { return QUrlTwoFlags(E2(i ^ f)); }
+ { return QUrlTwoFlags(QFlag(i ^ f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(int mask) const
- { return QUrlTwoFlags(E1(i & mask)); }
+ { return QUrlTwoFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(uint mask) const
- { return QUrlTwoFlags(E1(i & mask)); }
+ { return QUrlTwoFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E1 f) const
- { return QUrlTwoFlags(E1(i & f)); }
+ { return QUrlTwoFlags(QFlag(i & f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E2 f) const
- { return QUrlTwoFlags(E2(i & f)); }
+ { return QUrlTwoFlags(QFlag(i & f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator~() const
- { return QUrlTwoFlags(E1(~i)); }
+ { return QUrlTwoFlags(QFlag(~i)); }
- inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
- inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+ Q_DECL_CONSTEXPR inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+ Q_DECL_CONSTEXPR inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
};
template<typename E1, typename E2>
@@ -265,8 +267,10 @@ public:
#if defined(Q_OS_MAC) || defined(Q_QDOC)
static QUrl fromCFURL(CFURLRef url);
CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED;
+# if defined(__OBJC__) || defined(Q_QDOC)
static QUrl fromNSURL(const NSURL *url);
NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED;
+# endif
#endif
#if QT_DEPRECATED_SINCE(5,0)
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 998bf56874..4c43f292fb 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -110,6 +110,9 @@ mac:!nacl {
kernel/qcore_mac.cpp
OBJECTIVE_SOURCES += \
kernel/qcore_mac_objc.mm
+
+ # We need UIKit for UIDevice
+ ios: LIBS_PRIVATE += -framework UIKit
}
nacl {
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
index 7b9eb67969..73f8296021 100644
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -41,6 +41,10 @@
#include <private/qcore_mac_p.h>
+#ifdef Q_OS_IOS
+#import <UIKit/UIKit.h>
+#endif
+
QT_BEGIN_NAMESPACE
NSString *QCFString::toNSString(const QString &string)
@@ -54,5 +58,31 @@ QString QCFString::toQString(const NSString *nsstr)
return toQString(reinterpret_cast<CFStringRef>(nsstr));
}
+#ifdef Q_OS_IOS
+QSysInfo::MacVersion qt_ios_version()
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ int major = 0, minor = 0;
+ NSArray *components = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
+ switch ([components count]) {
+ case 3:
+ // We don't care about the patch version
+ case 2:
+ minor = [[components objectAtIndex:1] intValue];
+ // fall through
+ case 1:
+ major = [[components objectAtIndex:0] intValue];
+ break;
+ default:
+ Q_UNREACHABLE();
+ }
+
+ [pool release];
+
+ return QSysInfo::MacVersion(Q_MV_IOS(major, minor));
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index fa911fb967..f491be9768 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -143,6 +143,10 @@ private:
QString string;
};
+#ifdef Q_OS_IOS
+QSysInfo::MacVersion qt_ios_version();
+#endif
+
QT_END_NAMESPACE
#endif // QCORE_MAC_P_H
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 00e98a69bc..e83a6e2ac4 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -151,23 +151,21 @@ QString QCoreApplicationPrivate::macMenuBarName()
#endif
QString QCoreApplicationPrivate::appName() const
{
- static QBasicMutex applicationNameMutex;
- QMutexLocker locker(&applicationNameMutex);
-
- if (applicationName.isNull()) {
+ QString applicationName;
#ifdef Q_OS_MAC
- applicationName = macMenuBarName();
+ applicationName = macMenuBarName();
#endif
- if (applicationName.isEmpty() && argv[0]) {
- char *p = strrchr(argv[0], '/');
- applicationName = QString::fromLocal8Bit(p ? p + 1 : argv[0]);
- }
+ if (applicationName.isEmpty() && argv[0]) {
+ char *p = strrchr(argv[0], '/');
+ applicationName = QString::fromLocal8Bit(p ? p + 1 : argv[0]);
}
return applicationName;
}
#endif
+QString *QCoreApplicationPrivate::cachedApplicationFilePath = 0;
+
bool QCoreApplicationPrivate::checkInstance(const char *function)
{
bool b = (QCoreApplication::self != 0);
@@ -433,6 +431,7 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate()
#ifdef Q_OS_WIN
delete [] origArgv;
#endif
+ QCoreApplicationPrivate::clearApplicationFilePath();
}
#ifndef QT_NO_QOBJECT
@@ -1041,7 +1040,7 @@ bool QCoreApplication::closingDown()
You can call this function occasionally when your program is busy
performing a long operation (e.g. copying a file).
- In event you are running a local loop which calls this function
+ In the event that you are running a local loop which calls this function
continuously, without an event loop, the
\l{QEvent::DeferredDelete}{DeferredDelete} events will
not be processed. This can affect the behaviour of widgets,
@@ -1898,6 +1897,20 @@ QString QCoreApplication::translate(const char *context, const char *sourceText,
#endif //QT_NO_TRANSLATE
+// Makes it possible to point QCoreApplication to a custom location to ensure
+// the directory is added to the patch, and qt.conf and deployed plugins are
+// found from there. This is for use cases in which QGuiApplication is
+// instantiated by a library and not by an application executable, for example,
+// Active X servers.
+
+void QCoreApplicationPrivate::setApplicationFilePath(const QString &path)
+{
+ if (QCoreApplicationPrivate::cachedApplicationFilePath)
+ *QCoreApplicationPrivate::cachedApplicationFilePath = path;
+ else
+ QCoreApplicationPrivate::cachedApplicationFilePath = new QString(path);
+}
+
/*!
Returns the directory that contains the application executable.
@@ -1953,20 +1966,28 @@ QString QCoreApplication::applicationFilePath()
}
QCoreApplicationPrivate *d = self->d_func();
- if (!d->cachedApplicationFilePath.isNull())
- return d->cachedApplicationFilePath;
+
+ static char *procName = d->argv[0];
+ if (qstrcmp(procName, d->argv[0]) != 0) {
+ // clear the cache if the procname changes, so we reprocess it.
+ QCoreApplicationPrivate::clearApplicationFilePath();
+ procName = d->argv[0];
+ }
+
+ if (QCoreApplicationPrivate::cachedApplicationFilePath)
+ return *QCoreApplicationPrivate::cachedApplicationFilePath;
#if defined(Q_OS_WIN)
- d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath();
- return d->cachedApplicationFilePath;
+ QCoreApplicationPrivate::setApplicationFilePath(QFileInfo(qAppFileName()).filePath());
+ return *QCoreApplicationPrivate::cachedApplicationFilePath;
#elif defined(Q_OS_BLACKBERRY)
if (!arguments().isEmpty()) { // args is never empty, but the navigator can change behaviour some day
QFileInfo fileInfo(arguments().at(0));
const bool zygotized = fileInfo.exists();
if (zygotized) {
// Handle the zygotized case:
- d->cachedApplicationFilePath = QDir::cleanPath(fileInfo.absoluteFilePath());
- return d->cachedApplicationFilePath;
+ QCoreApplicationPrivate::setApplicationFilePath(QDir::cleanPath(fileInfo.absoluteFilePath()));
+ return *QCoreApplicationPrivate::cachedApplicationFilePath;
}
}
@@ -1974,7 +1995,7 @@ QString QCoreApplication::applicationFilePath()
const size_t maximum_path = static_cast<size_t>(pathconf("/",_PC_PATH_MAX));
char buff[maximum_path+1];
if (_cmdname(buff)) {
- d->cachedApplicationFilePath = QDir::cleanPath(QString::fromLocal8Bit(buff));
+ QCoreApplicationPrivate::setApplicationFilePath(QDir::cleanPath(QString::fromLocal8Bit(buff)));
} else {
qWarning("QCoreApplication::applicationFilePath: _cmdname() failed");
// _cmdname() won't fail, but just in case, fallback to the old method
@@ -1982,18 +2003,19 @@ QString QCoreApplication::applicationFilePath()
QStringList executables = dir.entryList(QDir::Executable | QDir::Files);
if (!executables.empty()) {
//We assume that there is only one executable in the folder
- d->cachedApplicationFilePath = dir.absoluteFilePath(executables.first());
- } else {
- d->cachedApplicationFilePath = QString();
+ QCoreApplicationPrivate::setApplicationFilePath(dir.absoluteFilePath(executables.first()));
}
}
- return d->cachedApplicationFilePath;
+ return *QCoreApplicationPrivate::cachedApplicationFilePath;
#elif defined(Q_OS_MAC)
QString qAppFileName_str = qAppFileName();
if(!qAppFileName_str.isEmpty()) {
QFileInfo fi(qAppFileName_str);
- d->cachedApplicationFilePath = fi.exists() ? fi.canonicalFilePath() : QString();
- return d->cachedApplicationFilePath;
+ if (fi.exists()) {
+ QCoreApplicationPrivate::setApplicationFilePath(fi.canonicalFilePath());
+ return *QCoreApplicationPrivate::cachedApplicationFilePath;
+ }
+ return QString();
}
#endif
#if defined( Q_OS_UNIX )
@@ -2002,8 +2024,8 @@ QString QCoreApplication::applicationFilePath()
// the absolute path of the executable
QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid()));
if (pfi.exists() && pfi.isSymLink()) {
- d->cachedApplicationFilePath = pfi.canonicalFilePath();
- return d->cachedApplicationFilePath;
+ QCoreApplicationPrivate::setApplicationFilePath(pfi.canonicalFilePath());
+ return *QCoreApplicationPrivate::cachedApplicationFilePath;
}
# endif
if (!arguments().isEmpty()) {
@@ -2033,13 +2055,15 @@ QString QCoreApplication::applicationFilePath()
absPath = QDir::cleanPath(absPath);
QFileInfo fi(absPath);
- d->cachedApplicationFilePath = fi.exists() ? fi.canonicalFilePath() : QString();
- } else {
- d->cachedApplicationFilePath = QString();
+ if (fi.exists()) {
+ QCoreApplicationPrivate::setApplicationFilePath(fi.canonicalFilePath());
+ return *QCoreApplicationPrivate::cachedApplicationFilePath;
+ }
}
- return d->cachedApplicationFilePath;
+ return QString();
#endif
+ Q_UNREACHABLE();
}
/*!
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 4b57a7b67d..0c00f396b5 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -83,7 +83,6 @@ public:
~QCoreApplicationPrivate();
QString appName() const;
- mutable QString applicationName;
#ifdef Q_OS_MAC
static QString macMenuBarName();
@@ -140,7 +139,9 @@ public:
QCoreApplicationPrivate::Type application_type;
QString cachedApplicationDirPath;
- QString cachedApplicationFilePath;
+ static QString *cachedApplicationFilePath;
+ static void setApplicationFilePath(const QString &path);
+ static inline void clearApplicationFilePath() { delete cachedApplicationFilePath; cachedApplicationFilePath = 0; }
#ifndef QT_NO_QOBJECT
bool in_exec;
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 418074dc7a..65ca6b0dcb 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -831,6 +831,11 @@ QString decodeMSG(const MSG& msg)
}
break;
#endif
+#ifdef WM_INPUTLANGCHANGE
+ case WM_INPUTLANGCHANGE:
+ parameters = QStringLiteral("Keyboard layout changed");
+ break;
+#endif // WM_INPUTLANGCHANGE
#ifdef WM_NCACTIVATE
case WM_NCACTIVATE:
{
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
index b9137ec139..a52cc60eaa 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp
+++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
@@ -237,9 +237,6 @@ void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifie
return;
}
- // Call the base Unix implementation. Needed to allow select() to be called correctly
- QEventDispatcherUNIX::registerSocketNotifier(notifier);
-
// Register the fd with bps
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
int io_events = ioEvents(sockfd);
@@ -265,6 +262,9 @@ void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifie
const int result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
if (Q_UNLIKELY(result != BPS_SUCCESS))
qWarning() << "QEventDispatcherBlackberry: bps_add_fd failed";
+
+ // Call the base Unix implementation. Needed to allow select() to be called correctly
+ QEventDispatcherUNIX::registerSocketNotifier(notifier);
}
void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notifier)
@@ -280,23 +280,22 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif
return;
}
- // Allow the base Unix implementation to unregister the fd too
+ // Allow the base Unix implementation to unregister the fd too (before call to ioEvents()!)
QEventDispatcherUNIX::unregisterSocketNotifier(notifier);
// Unregister the fd with bps
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
- const int io_events = ioEvents(sockfd);
int result = bps_remove_fd(sockfd);
if (Q_UNLIKELY(result != BPS_SUCCESS))
qWarning() << "QEventDispatcherBlackberry: bps_remove_fd failed" << sockfd;
- // if no other socket notifier is watching sockfd, our job ends here
- if (!io_events)
- return;
-
- result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
- if (Q_UNLIKELY(result != BPS_SUCCESS))
- qWarning("QEventDispatcherBlackberry: bps_add_fd error");
+ const int io_events = ioEvents(sockfd);
+ // if other socket notifier is watching sockfd, readd it
+ if (io_events) {
+ result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
+ if (Q_UNLIKELY(result != BPS_SUCCESS))
+ qWarning("QEventDispatcherBlackberry: bps_add_fd error");
+ }
}
static inline int timespecToMillisecs(const timespec &tv)
diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp
index 54cd2b5a75..4e06d12aee 100644
--- a/src/corelib/kernel/qjni.cpp
+++ b/src/corelib/kernel/qjni.cpp
@@ -162,24 +162,31 @@ static jfieldID getCachedFieldID(JNIEnv *env,
return id;
}
-Q_GLOBAL_STATIC(QThreadStorage<int>, refCount)
+class QJNIEnvironmentPrivateTLS
+{
+public:
+ inline ~QJNIEnvironmentPrivateTLS()
+ {
+ QtAndroidPrivate::javaVM()->DetachCurrentThread();
+ }
+};
+
+Q_GLOBAL_STATIC(QThreadStorage<QJNIEnvironmentPrivateTLS *>, jniEnvTLS)
QJNIEnvironmentPrivate::QJNIEnvironmentPrivate()
: jniEnv(0)
{
JavaVM *vm = QtAndroidPrivate::javaVM();
if (vm->GetEnv((void**)&jniEnv, JNI_VERSION_1_6) == JNI_EDETACHED) {
- if (vm->AttachCurrentThread(&jniEnv, 0) < 0)
+ if (vm->AttachCurrentThread(&jniEnv, 0) != JNI_OK)
return;
}
if (!jniEnv)
return;
- if (!refCount->hasLocalData())
- refCount->setLocalData(1);
- else
- refCount->setLocalData(refCount->localData() + 1);
+ if (!jniEnvTLS->hasLocalData())
+ jniEnvTLS->setLocalData(new QJNIEnvironmentPrivateTLS);
}
JNIEnv *QJNIEnvironmentPrivate::operator->()
@@ -194,16 +201,6 @@ QJNIEnvironmentPrivate::operator JNIEnv* () const
QJNIEnvironmentPrivate::~QJNIEnvironmentPrivate()
{
- if (!jniEnv)
- return;
-
- const int newRef = refCount->localData() - 1;
- refCount->setLocalData(newRef);
-
- if (newRef == 0)
- QtAndroidPrivate::javaVM()->DetachCurrentThread();
-
- jniEnv = 0;
}
QJNIObjectData::QJNIObjectData()
@@ -354,7 +351,9 @@ QJNIObjectPrivate::QJNIObjectPrivate(jobject obj)
QJNIEnvironmentPrivate env;
d->m_jobject = env->NewGlobalRef(obj);
- d->m_jclass = static_cast<jclass>(env->NewGlobalRef(env->GetObjectClass(d->m_jobject)));
+ jclass objectClass = env->GetObjectClass(d->m_jobject);
+ d->m_jclass = static_cast<jclass>(env->NewGlobalRef(objectClass));
+ env->DeleteLocalRef(objectClass);
}
template <>
@@ -1265,7 +1264,10 @@ QJNIObjectPrivate QJNIObjectPrivate::callObjectMethod(const char *methodName,
if (id) {
res = env->CallObjectMethodV(d->m_jobject, id, args);
}
- return res;
+
+ QJNIObjectPrivate obj(res);
+ env->DeleteLocalRef(res);
+ return obj;
}
QJNIObjectPrivate QJNIObjectPrivate::callObjectMethod(const char *methodName,
@@ -1342,7 +1344,9 @@ QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(const char *classNam
}
}
- return res;
+ QJNIObjectPrivate obj(res);
+ env->DeleteLocalRef(res);
+ return obj;
}
QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(const char *className,
@@ -1369,7 +1373,9 @@ QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(jclass clazz,
res = env->CallStaticObjectMethodV(clazz, id, args);
}
- return res;
+ QJNIObjectPrivate obj(res);
+ env->DeleteLocalRef(res);
+ return obj;
}
QJNIObjectPrivate QJNIObjectPrivate::callStaticObjectMethod(jclass clazz,
@@ -1681,7 +1687,9 @@ QJNIObjectPrivate QJNIObjectPrivate::getObjectField(const char *fieldName,
if (id)
res = env->GetObjectField(d->m_jobject, id);
- return res;
+ QJNIObjectPrivate obj(res);
+ env->DeleteLocalRef(res);
+ return obj;
}
QJNIObjectPrivate QJNIObjectPrivate::getStaticObjectField(const char *className,
@@ -1707,7 +1715,9 @@ QJNIObjectPrivate QJNIObjectPrivate::getStaticObjectField(jclass clazz,
if (id)
res = env->GetStaticObjectField(clazz, id);
- return res;
+ QJNIObjectPrivate obj(res);
+ env->DeleteLocalRef(res);
+ return obj;
}
template <>
@@ -2109,7 +2119,9 @@ QJNIObjectPrivate QJNIObjectPrivate::fromString(const QString &string)
QJNIEnvironmentPrivate env;
jstring res = env->NewString(reinterpret_cast<const jchar*>(string.constData()),
string.length());
- return res;
+ QJNIObjectPrivate obj(res);
+ env->DeleteLocalRef(res);
+ return obj;
}
QString QJNIObjectPrivate::toString() const
diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h
index c5bbae26b9..ab98aec1bf 100644
--- a/src/corelib/kernel/qjni_p.h
+++ b/src/corelib/kernel/qjni_p.h
@@ -180,7 +180,9 @@ public:
d = QSharedPointer<QJNIObjectData>(new QJNIObjectData());
QJNIEnvironmentPrivate env;
d->m_jobject = env->NewGlobalRef(jobj);
- d->m_jclass = static_cast<jclass>(env->NewGlobalRef(env->GetObjectClass(jobj)));
+ jclass objectClass = env->GetObjectClass(jobj);
+ d->m_jclass = static_cast<jclass>(env->NewGlobalRef(objectClass));
+ env->DeleteLocalRef(objectClass);
}
return *this;
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index fbcd0606e6..9ec491f6a9 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -94,7 +94,9 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env)
return JNI_ERR;
g_jClassLoader = env->NewGlobalRef(classLoader);
+ env->DeleteLocalRef(classLoader);
g_jActivity = env->NewGlobalRef(activity);
+ env->DeleteLocalRef(activity);
g_javaVM = vm;
return JNI_OK;
diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp
index 8f900e2101..b1860fa24a 100644
--- a/src/corelib/kernel/qmath.cpp
+++ b/src/corelib/kernel/qmath.cpp
@@ -310,8 +310,6 @@ const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = {
\brief The <QtMath> header file includes generic math declarations.
- The global declarations include \l{functions}.
-
These functions are partly convenience definitions for basic
operations, for instance not available in the Standard Template Library et
al.
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 72ce941b6e..29c5a3dd24 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -177,6 +178,7 @@ private:
void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0;
+void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = 0;
void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0;
void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0;
int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0;
@@ -639,7 +641,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object)
\li When a QObject is moved to another thread, all its children
will be automatically moved too.
\li moveToThread() will fail if the QObject has a parent.
- \li If \l{QObject}s are created within QThread::run(), they cannot
+ \li If QObjects are created within QThread::run(), they cannot
become children of the QThread object because the QThread does
not live in the thread that calls QThread::run().
\endlist
@@ -878,8 +880,12 @@ QObject::~QObject()
}
}
- if (d->declarativeData)
- QAbstractDeclarativeData::destroyed(d->declarativeData, this);
+ if (d->declarativeData) {
+ if (QAbstractDeclarativeData::destroyed)
+ QAbstractDeclarativeData::destroyed(d->declarativeData, this);
+ if (QAbstractDeclarativeData::destroyed_qml1)
+ QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
+ }
// set ref to zero to indicate that this object has been deleted
if (d->currentSender != 0)
@@ -920,9 +926,9 @@ QObject::~QObject()
// The destroy operation must happen outside the lock
if (c->isSlotObject) {
+ c->isSlotObject = false;
locker.unlock();
c->slotObj->destroyIfLastRef();
- c->isSlotObject = false;
locker.relock();
}
c->deref();
@@ -937,15 +943,29 @@ QObject::~QObject()
d->connectionLists = 0;
}
- // disconnect all senders
+ /* Disconnect all senders:
+ * This loop basically just does
+ * for (node = d->senders; node; node = node->next) { ... }
+ *
+ * We need to temporarily unlock the receiver mutex to destroy the functors or to lock the
+ * sender's mutex. And when the mutex is released, node->next might be destroyed by another
+ * thread. That's why we set node->prev to &node, that way, if node is destroyed, node will
+ * be updated.
+ */
QObjectPrivate::Connection *node = d->senders;
while (node) {
QObject *sender = node->sender;
+ // Send disconnectNotify before removing the connection from sender's connection list.
+ // This ensures any eventual destructor of sender will block on getting receiver's lock
+ // and not finish until we release it.
+ sender->disconnectNotify(QMetaObjectPrivate::signal(sender->metaObject(), node->signal_index));
QMutex *m = signalSlotLock(sender);
node->prev = &node;
bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m);
//the node has maybe been removed while the mutex was unlocked in relock?
if (!node || node->sender != sender) {
+ // We hold the wrong mutex
+ Q_ASSERT(needToUnlock);
m->unlock();
continue;
}
@@ -954,8 +974,6 @@ QObject::~QObject()
if (senderLists)
senderLists->dirty = true;
- int signal_index = node->signal_index;
-
QtPrivate::QSlotObjectBase *slotObj = Q_NULLPTR;
if (node->isSlotObject) {
slotObj = node->slotObj;
@@ -967,12 +985,12 @@ QObject::~QObject()
m->unlock();
if (slotObj) {
+ if (node)
+ node->prev = &node;
locker.unlock();
slotObj->destroyIfLastRef();
locker.relock();
}
-
- sender->disconnectNotify(QMetaObjectPrivate::signal(sender->metaObject(), signal_index));
}
}
@@ -1557,12 +1575,12 @@ int QObject::startTimer(int interval, Qt::TimerType timerType)
Q_D(QObject);
if (interval < 0) {
- qWarning("QObject::startTimer: QTimer cannot have a negative interval");
+ qWarning("QObject::startTimer: Timers cannot have negative intervals");
return 0;
}
if (!d->threadData->eventDispatcher.load()) {
- qWarning("QObject::startTimer: QTimer can only be used with threads started with QThread");
+ qWarning("QObject::startTimer: Timers can only be used with threads started with QThread");
return 0;
}
int timerId = d->threadData->eventDispatcher.load()->registerTimer(interval, timerType, this);
@@ -1931,7 +1949,7 @@ void QObjectPrivate::setParent_helper(QObject *o)
}
}
}
- if (!isDeletingChildren && declarativeData)
+ if (!isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged)
QAbstractDeclarativeData::parentChanged(declarativeData, q, o);
}
@@ -3236,7 +3254,7 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c,
&& (slot == 0 || (c->isSlotObject && c->slotObj->compare(slot)))))) {
bool needToUnlock = false;
QMutex *receiverMutex = 0;
- if (!receiver) {
+ if (c->receiver) {
receiverMutex = signalSlotLock(c->receiver);
// need to relock this receiver and sender in the correct order
needToUnlock = QOrderedMutexLocker::relock(senderMutex, receiverMutex);
@@ -3253,9 +3271,9 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c,
c->receiver = 0;
if (c->isSlotObject) {
+ c->isSlotObject = false;
senderMutex->unlock();
c->slotObj->destroyIfLastRef();
- c->isSlotObject = false;
senderMutex->lock();
}
@@ -3284,8 +3302,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender,
QObject *s = const_cast<QObject *>(sender);
QMutex *senderMutex = signalSlotLock(sender);
- QMutex *receiverMutex = receiver ? signalSlotLock(receiver) : 0;
- QOrderedMutexLocker locker(senderMutex, receiverMutex);
+ QMutexLocker locker(senderMutex);
QObjectConnectionListVector *connectionLists = QObjectPrivate::get(s)->connectionLists;
if (!connectionLists)
@@ -4213,7 +4230,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
\macro Q_INVOKABLE
\relates QObject
- Apply this macro to definitions of member functions to allow them to
+ Apply this macro to declarations of member functions to allow them to
be invoked via the meta-object system. The macro is written before
the return type, as shown in the following example:
@@ -4230,7 +4247,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
\macro Q_REVISION
\relates QObject
- Apply this macro to definitions of member functions to tag them with a
+ Apply this macro to declarations of member functions to tag them with a
revision number in the meta-object system. The macro is written before
the return type, as shown in the following example:
@@ -4695,7 +4712,7 @@ bool QObjectPrivate::disconnect(const QObject *sender, int signal_index, void **
It can be used to disconnect that connection, or check if
the connection was successful
- \sa QObject::disconnect
+ \sa QObject::disconnect()
*/
/*!
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index 1bbd548be6..d2996e6e4d 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -99,6 +99,8 @@ namespace QtPrivate {
template <typename ArgList, bool Declared = TypesAreDeclaredMetaType<ArgList>::Value > struct ConnectionTypes
{ static const int *types() { return 0; } };
+ template <> struct ConnectionTypes<List<>, true>
+ { static const int *types() { return 0; } };
template <typename... Args> struct ConnectionTypes<List<Args...>, true>
{ static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper<Args>::qt_metatype_id())..., 0 }; return t; } };
#endif
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index f5745515c9..cd2d592cec 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -90,6 +90,7 @@ class Q_CORE_EXPORT QAbstractDeclarativeData
{
public:
static void (*destroyed)(QAbstractDeclarativeData *, QObject *);
+ static void (*destroyed_qml1)(QAbstractDeclarativeData *, QObject *);
static void (*parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *);
static void (*signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **);
static int (*receivers)(QAbstractDeclarativeData *, const QObject *, int);
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index db3b96d202..91ccf3996e 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -221,6 +222,19 @@ static qlonglong qConvertToNumber(const QVariant::Private *d, bool *ok)
return qlonglong(qMetaTypeUNumber(d));
}
+ if (QMetaType::typeFlags(d->type) & QMetaType::IsEnumeration) {
+ switch (QMetaType::sizeOf(d->type)) {
+ case 1:
+ return d->is_shared ? *reinterpret_cast<signed char *>(d->data.shared->ptr) : d->data.sc;
+ case 2:
+ return d->is_shared ? *reinterpret_cast<qint16 *>(d->data.shared->ptr) : d->data.s;
+ case 4:
+ return d->is_shared ? *reinterpret_cast<qint32 *>(d->data.shared->ptr) : d->data.i;
+ case 8:
+ return d->is_shared ? *reinterpret_cast<qint64 *>(d->data.shared->ptr) : d->data.ll;
+ }
+ }
+
*ok = false;
return Q_INT64_C(0);
}
@@ -256,6 +270,19 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok)
return qMetaTypeUNumber(d);
}
+ if (QMetaType::typeFlags(d->type) & QMetaType::IsEnumeration) {
+ switch (QMetaType::sizeOf(d->type)) {
+ case 1:
+ return d->is_shared ? *reinterpret_cast<uchar *>(d->data.shared->ptr) : d->data.uc;
+ case 2:
+ return d->is_shared ? *reinterpret_cast<quint16 *>(d->data.shared->ptr) : d->data.us;
+ case 4:
+ return d->is_shared ? *reinterpret_cast<quint32 *>(d->data.shared->ptr) : d->data.u;
+ case 8:
+ return d->is_shared ? *reinterpret_cast<qint64 *>(d->data.shared->ptr) : d->data.ull;
+ }
+ }
+
*ok = false;
return Q_UINT64_C(0);
}
@@ -888,15 +915,13 @@ static bool customCompare(const QVariant::Private *a, const QVariant::Private *b
static bool customConvert(const QVariant::Private *d, int t, void *result, bool *ok)
{
if (d->type >= QMetaType::User || t >= QMetaType::User) {
- const bool isOk = QMetaType::convert(constData(*d), d->type, result, t);
- if (ok)
- *ok = isOk;
- return isOk;
+ if (QMetaType::convert(constData(*d), d->type, result, t)) {
+ if (ok)
+ *ok = true;
+ return true;
+ }
}
-
- if (ok)
- *ok = false;
- return false;
+ return convert(d, t, result, ok);
}
#if !defined(QT_NO_DEBUG_STREAM)
@@ -2854,8 +2879,13 @@ bool QVariant::canConvert(int targetTypeId) const
if (targetTypeId < 0)
return false;
- if (targetTypeId >= QMetaType::User)
- return canConvertMetaObject(currentType, targetTypeId, d.data.o);
+ if (targetTypeId >= QMetaType::User) {
+ if (QMetaType::typeFlags(targetTypeId) & QMetaType::IsEnumeration) {
+ targetTypeId = QMetaType::Int;
+ } else {
+ return canConvertMetaObject(currentType, targetTypeId, d.data.o);
+ }
+ }
if (currentType == QMetaType::QJsonValue) {
switch (targetTypeId) {
@@ -2888,13 +2918,16 @@ bool QVariant::canConvert(int targetTypeId) const
return true;
// fall through
case QVariant::UInt:
+ case QVariant::LongLong:
+ case QVariant::ULongLong:
return currentType == QMetaType::ULong
|| currentType == QMetaType::Long
|| currentType == QMetaType::UShort
|| currentType == QMetaType::UChar
|| currentType == QMetaType::Char
|| currentType == QMetaType::SChar
- || currentType == QMetaType::Short;
+ || currentType == QMetaType::Short
+ || QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration;
case QVariant::Image:
return currentType == QVariant::Pixmap || currentType == QVariant::Bitmap;
case QVariant::Pixmap:
@@ -2923,7 +2956,9 @@ bool QVariant::canConvert(int targetTypeId) const
case QMetaType::ULong:
case QMetaType::Short:
case QMetaType::UShort:
- return qCanConvertMatrix[QVariant::Int] & (1 << currentType) || currentType == QVariant::Int;
+ return qCanConvertMatrix[QVariant::Int] & (1 << currentType)
+ || currentType == QVariant::Int
+ || QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration;
case QMetaType::QObjectStar:
return canConvertMetaObject(currentType, targetTypeId, d.data.o);
default:
@@ -2974,7 +3009,8 @@ bool QVariant::convert(int targetTypeId)
}
bool isOk = true;
- if (!handlerManager[d.type]->convert(&oldValue.d, targetTypeId, data(), &isOk))
+ int converterType = std::max(oldValue.userType(), targetTypeId);
+ if (!handlerManager[converterType]->convert(&oldValue.d, targetTypeId, data(), &isOk))
isOk = false;
d.is_null = !isOk;
return isOk;
diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h
index 56605d9aaa..cddb9d73be 100644
--- a/src/corelib/kernel/qwineventnotifier.h
+++ b/src/corelib/kernel/qwineventnotifier.h
@@ -45,7 +45,6 @@
#include "QtCore/qobject.h"
#ifdef Q_OS_WIN
-#include "QtCore/qt_windows.h"
QT_BEGIN_NAMESPACE
@@ -54,6 +53,7 @@ class Q_CORE_EXPORT QWinEventNotifier : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWinEventNotifier)
+ typedef Qt::HANDLE HANDLE;
public:
explicit QWinEventNotifier(QObject *parent = 0);
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index aa03395f94..bdea75a3b9 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -53,6 +53,11 @@
#include <QDateTime>
#include <QtEndian>
+static void initResources()
+{
+ Q_INIT_RESOURCE(mimetypes);
+}
+
QT_BEGIN_NAMESPACE
static QString fallbackParent(const QString &mimeTypeName)
@@ -704,6 +709,7 @@ void QMimeBinaryProvider::loadGenericIcon(QMimeTypePrivate &data)
QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db)
: QMimeProviderBase(db), m_loaded(false)
{
+ initResources();
}
bool QMimeXMLProvider::isValid()
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index 31b9890351..a0d2923bed 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -82,7 +82,7 @@ public:
Sha1 = 5 // 0 1 0 1
};
-#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC)
+#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
Q_DECL_CONSTEXPR QUuid() : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
@@ -147,7 +147,7 @@ public:
#if defined(Q_OS_WIN)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
-#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC)
+#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
Q_DECL_CONSTEXPR QUuid(const GUID &guid)
: data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index ddcc25f7b7..782ae90698 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -137,12 +137,11 @@ public:
typename Ops::Type _q_value;
- // Non-atomic API
+ // Everything below is either implemented in ../arch/qatomic_XXX.h or (as fallback) in qgenericatomic.h
+
T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
- // Atomic API, implemented in qatomic_XXX.h
-
T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); }
void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); }
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index e4cdf7a985..ffda3c4fad 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -98,7 +98,7 @@ QT_BEGIN_NAMESPACE
\since 4.4
\value Recursive In this mode, a thread can lock the same
- QReadWriteLock multiple times and the mutex won't be unlocked
+ QReadWriteLock multiple times. The QReadWriteLock won't be unlocked
until a corresponding number of unlock() calls have been made.
\value NonRecursive In this mode, a thread may only lock a
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 3de1e991c1..903e72c151 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -232,7 +232,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread)
qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup);
}
- CreateThread(0, 0, qt_adopted_thread_watcher_function, 0, 0, &qt_adopted_thread_watcher_id);
+ CloseHandle(CreateThread(0, 0, qt_adopted_thread_watcher_function, 0, 0, &qt_adopted_thread_watcher_id));
} else {
SetEvent(qt_adopted_thread_wakeup);
}
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index eb06bd4713..03b10903ab 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -1854,7 +1854,7 @@ QByteArray &QByteArray::remove(int pos, int len)
if (len <= 0 || uint(pos) >= uint(d->size))
return *this;
detach();
- if (pos + len >= d->size) {
+ if (len >= d->size - pos) {
resize(pos);
} else {
memmove(d->data() + pos, d->data() + pos + len, d->size - pos - len);
diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp
index a3a9ef940b..9c97d6b158 100644
--- a/src/corelib/tools/qcollator.cpp
+++ b/src/corelib/tools/qcollator.cpp
@@ -99,7 +99,7 @@ QCollator::QCollator(const QCollator &other)
*/
QCollator::~QCollator()
{
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
@@ -109,14 +109,41 @@ QCollator::~QCollator()
QCollator &QCollator::operator=(const QCollator &other)
{
if (this != &other) {
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
d = other.d;
- d->ref.ref();
+ if (d) d->ref.ref();
}
return *this;
}
+/*
+ \fn void QCollator::QCollator(QCollator &&other)
+
+ Move constructor. Moves from \a other into this collator.
+
+ Note that a moved-from QCollator can only be destroyed or assigned
+ to. The effect of calling other functions than the destructor or
+ one of the assignment operators is undefined.
+*/
+
+/*
+ \fn QCollator &QCollator::operator=(QCollator &&other)
+
+ Move-assigns from \a other to this collator.
+
+ Note that a moved-from QCollator can only be destroyed or assigned
+ to. The effect of calling other functions than the destructor or
+ one of the assignment operators is undefined.
+*/
+
+/*!
+ \fn void QCollator::swap(QCollator &other)
+
+ Swaps this collator with \a other. This function is very fast and
+ never fails.
+*/
+
/*!
\internal
*/
@@ -301,12 +328,13 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other)
}
/*!
- \fn bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
+ \fn bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
+ \relates QCollatorSortKey
- According to the QCollator that created the key, returns \c true if the
- key should be sorted before than \a otherKey; otherwise returns \c false.
+ According to the QCollator that created the keys, returns \c true if \a lhs
+ should be sorted before \a rhs; otherwise returns \c false.
- \sa compare()
+ \sa QCollatorSortKey::compare()
*/
/*!
diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h
index b99fd1c0cc..781e95b10c 100644
--- a/src/corelib/tools/qcollator.h
+++ b/src/corelib/tools/qcollator.h
@@ -61,10 +61,11 @@ public:
QCollatorSortKey &operator=(const QCollatorSortKey &other);
#ifdef Q_COMPILER_RVALUE_REFS
inline QCollatorSortKey &operator=(QCollatorSortKey &&other)
- { qSwap(d, other.d); return *this; }
+ { swap(other); return *this; }
#endif
+ void swap(QCollatorSortKey &other)
+ { d.swap(other.d); }
- bool operator<(const QCollatorSortKey &key) const;
int compare(const QCollatorSortKey &key) const;
protected:
@@ -76,13 +77,27 @@ private:
QCollatorSortKey();
};
+inline bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs)
+{
+ return lhs.compare(rhs) < 0;
+}
+
class Q_CORE_EXPORT QCollator
{
public:
- QCollator(const QLocale &locale = QLocale());
+ explicit QCollator(const QLocale &locale = QLocale());
QCollator(const QCollator &);
~QCollator();
QCollator &operator=(const QCollator &);
+#ifdef Q_COMPILER_RVALUE_REFS
+ QCollator(QCollator &&other)
+ : d(other.d) { other.d = 0; }
+ QCollator &operator=(QCollator &&other)
+ { swap(other); return *this; }
+#endif
+
+ void swap(QCollator &other)
+ { qSwap(d, other.d); }
void setLocale(const QLocale &locale);
QLocale locale() const;
@@ -111,6 +126,9 @@ private:
void detach();
};
+Q_DECLARE_SHARED(QCollatorSortKey)
+Q_DECLARE_SHARED(QCollator)
+
QT_END_NAMESPACE
#endif // QCOLLATOR_P_H
diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp
index 46f830a34c..407a493d25 100644
--- a/src/corelib/tools/qcollator_icu.cpp
+++ b/src/corelib/tools/qcollator_icu.cpp
@@ -151,11 +151,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(result));
}
-bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
-{
- return d->m_key < otherKey.d->m_key;
-}
-
int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const
{
return qstrcmp(d->m_key, otherKey.d->m_key);
diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp
index 8edd190fbe..8985cd4eba 100644
--- a/src/corelib/tools/qcollator_macx.cpp
+++ b/src/corelib/tools/qcollator_macx.cpp
@@ -162,11 +162,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(ret));
}
-bool QCollatorSortKey::operator<(const QCollatorSortKey &key) const
-{
- return compare(key) < 0;
-}
-
int QCollatorSortKey::compare(const QCollatorSortKey &key) const
{
SInt32 order;
diff --git a/src/corelib/tools/qcollator_posix.cpp b/src/corelib/tools/qcollator_posix.cpp
index a43618dcf1..b47b546d01 100644
--- a/src/corelib/tools/qcollator_posix.cpp
+++ b/src/corelib/tools/qcollator_posix.cpp
@@ -135,11 +135,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(result));
}
-bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
-{
- return compare(otherKey) < 0;
-}
-
int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const
{
return std::wcscmp(d->m_key.constData(),
diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp
index 6cc15891f5..9a672a0505 100644
--- a/src/corelib/tools/qcollator_win.cpp
+++ b/src/corelib/tools/qcollator_win.cpp
@@ -179,11 +179,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const
return QCollatorSortKey(new QCollatorSortKeyPrivate(ret));
}
-bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const
-{
- return d->m_key < otherKey.d->m_key;
-}
-
int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const
{
return d->m_key.compare(otherKey.d->m_key);
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index 8054542333..5463e4f0c1 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -845,11 +845,50 @@ static QString wrapText(const QString &names, int longestOptionNameString, const
{
const QLatin1Char nl('\n');
QString text = QStringLiteral(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' ');
- const int leftColumnWidth = text.length();
- const int rightColumnWidth = 79 - leftColumnWidth;
- text += description.left(rightColumnWidth) + nl;
- for (int n = rightColumnWidth; n < description.length(); n += rightColumnWidth)
- text += QStringLiteral(" ").repeated(leftColumnWidth) + description.mid(n, rightColumnWidth) + nl;
+ const int indent = text.length();
+ int lineStart = 0;
+ int lastBreakable = -1;
+ const int max = 79 - indent;
+ int x = 0;
+ const int len = description.length();
+
+ for (int i = 0; i < len; ++i) {
+ ++x;
+ const QChar c = description.at(i);
+ if (c.isSpace())
+ lastBreakable = i;
+
+ int breakAt = -1;
+ int nextLineStart = -1;
+ if (x > max && lastBreakable != -1) {
+ // time to break and we know where
+ breakAt = lastBreakable;
+ nextLineStart = lastBreakable + 1;
+ } else if ((x > max - 1 && lastBreakable == -1) || i == len - 1) {
+ // time to break but found nowhere [-> break here], or end of last line
+ breakAt = i + 1;
+ nextLineStart = breakAt;
+ } else if (c == nl) {
+ // forced break
+ breakAt = i;
+ nextLineStart = i + 1;
+ }
+
+ if (breakAt != -1) {
+ const int numChars = breakAt - lineStart;
+ //qDebug() << "breakAt=" << description.at(breakAt) << "breakAtSpace=" << breakAtSpace << lineStart << "to" << breakAt << description.mid(lineStart, numChars);
+ if (lineStart > 0)
+ text += QString(indent, QLatin1Char(' '));
+ text += description.midRef(lineStart, numChars) + nl;
+ x = 0;
+ lastBreakable = -1;
+ lineStart = nextLineStart;
+ if (lineStart < len && description.at(lineStart).isSpace())
+ ++lineStart; // don't start a line with a space
+ i = lineStart;
+ }
+ }
+
return text;
}
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 6620c55a0f..a95c7f53f7 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2685,10 +2685,10 @@ void QDateTimePrivate::getDateTime(QDate *date, QTime *time) const
{
msecsToTime(m_msecs, date, time);
- if (isNullDate())
+ if (date && isNullDate())
*date = QDate();
- if (isNullTime())
+ if (time && isNullTime())
*time = QTime();
}
@@ -2768,9 +2768,6 @@ void QDateTimePrivate::refreshDateTime()
}
// We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating
- QDate date;
- QTime time;
- getDateTime(&date, &time);
// LocalTime and TimeZone might fall into "missing" DaylightTime transition hour
// Calling toEpochMSecs will adjust the returned date/time if it does
QDate testDate;
@@ -2784,7 +2781,7 @@ void QDateTimePrivate::refreshDateTime()
epochMSecs = zoneMSecsToEpochMSecs(m_msecs, m_timeZone, &testDate, &testTime);
#endif // QT_BOOTSTRAPPED
}
- if (testDate == date && testTime == time) {
+ if (timeToMSecs(testDate, testTime) == m_msecs) {
setValidDateTime();
// Cache the offset to use in toMSecsSinceEpoch()
m_offsetFromUtc = (m_msecs - epochMSecs) / 1000;
@@ -3097,9 +3094,10 @@ bool QDateTime::isValid() const
QDate QDateTime::date() const
{
+ if (d->isNullDate())
+ return QDate();
QDate dt;
- QTime tm;
- d->getDateTime(&dt, &tm);
+ msecsToTime(d->m_msecs, &dt, 0);
return dt;
}
@@ -3111,9 +3109,10 @@ QDate QDateTime::date() const
QTime QDateTime::time() const
{
- QDate dt;
+ if (d->isNullTime())
+ return QTime();
QTime tm;
- d->getDateTime(&dt, &tm);
+ msecsToTime(d->m_msecs, 0, &tm);
return tm;
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index fb233c0640..0eb202c5e2 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -531,7 +531,11 @@ static const QLocaleData *default_data = 0;
static uint default_number_options = 0;
static const QLocaleData *const c_data = locale_data;
-static QLocalePrivate c_private = { c_data, Q_BASIC_ATOMIC_INITIALIZER(1), 0 };
+static QLocalePrivate *c_private()
+{
+ static QLocalePrivate c_locale = { c_data, Q_BASIC_ATOMIC_INITIALIZER(1), 0 };
+ return &c_locale;
+}
#ifndef QT_NO_SYSTEMLOCALE
@@ -700,7 +704,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePriva
static QLocalePrivate *localePrivateByName(const QString &name)
{
if (name == QLatin1String("C"))
- return &c_private;
+ return c_private();
return QLocalePrivate::create(findLocaleData(name));
}
@@ -708,7 +712,7 @@ static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Sc
QLocale::Country country)
{
if (language == QLocale::C)
- return &c_private;
+ return c_private();
const QLocaleData *data = QLocaleData::findLocaleData(language, script, country);
diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp
index e2dfa6c801..48faa73070 100644
--- a/src/corelib/tools/qlocale_blackberry.cpp
+++ b/src/corelib/tools/qlocale_blackberry.cpp
@@ -68,17 +68,20 @@ QBBSystemLocaleData::QBBSystemLocaleData()
, measurementNotifier(0)
, hourNotifier(0)
{
+ // Do not use qWarning to log warnings if qt_safe_open fails to open the pps file
+ // since the user code may install a message handler that invokes QLocale API again
+ // (i.e QDate, QDateTime, ...) which will cause a deadlock.
if ((measurementFd = qt_safe_open(ppsUomPath, O_RDONLY)) == -1)
- qWarning("Failed to open uom pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open uom pps, errno=%d\n", errno);
if ((regionFd = qt_safe_open(ppsRegionLocalePath, O_RDONLY)) == -1)
- qWarning("Failed to open region pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open region pps, errno=%d\n", errno);
if ((languageFd = qt_safe_open(ppsLanguageLocalePath, O_RDONLY)) == -1)
- qWarning("Failed to open language pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open language pps, errno=%d\n", errno);
if ((hourFd = qt_safe_open(ppsHourFormatPath, O_RDONLY)) == -1)
- qWarning("Failed to open hour format pps, errno=%d", errno);
+ fprintf(stderr, "Failed to open hour format pps, errno=%d\n", errno);
// we cannot call this directly, because by the time this constructor is
// called, the event dispatcher has not yet been created, causing the
@@ -186,8 +189,12 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd)
char buffer[ppsBufferSize];
int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1);
+ // This method is called in the ctor(), so do not use qWarning to log warnings
+ // if qt_safe_read fails to read the pps file
+ // since the user code may install a message handler that invokes QLocale API again
+ // (i.e QDate, QDateTime, ...) which will cause a deadlock.
if (bytes == -1) {
- qWarning("Failed to read Locale pps, errno=%d", errno);
+ fprintf(stderr, "Failed to read pps object:%s, errno=%d\n", ppsObject, errno);
return result;
}
// ensure data is null terminated
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index 9aebbb7b3c..22d744f869 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -897,6 +897,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const Key &QMap::firstKey() const
+ \since 5.2
Returns a reference to the smallest key in the map.
This function assumes that the map is not empty.
@@ -907,6 +908,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const Key &QMap::lastKey() const
+ \since 5.2
Returns a reference to the largest key in the map.
This function assumes that the map is not empty.
@@ -917,6 +919,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn T &QMap::first()
+ \since 5.2
Returns a reference to the first value in the map, that is the value mapped
to the smallest key. This function assumes that the map is not empty.
@@ -927,11 +930,13 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const T &QMap::first() const
+ \since 5.2
\overload
*/
/*! \fn T &QMap::last()
+ \since 5.2
Returns a reference to the last value in the map, that is the value mapped
to the largest key. This function assumes that the map is not empty.
@@ -942,6 +947,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*! \fn const T &QMap::last() const
+ \since 5.2
\overload
*/
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 150adfe192..77d002e4d5 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -455,8 +455,8 @@ const QString::Null QString::null = { };
your applications will be easy to translate if you want to expand
your application's market at some point. The two main cases where
QByteArray is appropriate are when you need to store raw binary
- data, and when memory conservation is critical (e.g., with
- \l{Qt for Embedded Linux}).
+ data, and when memory conservation is critical (like in embedded
+ systems).
\tableofcontents
@@ -5048,7 +5048,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2,
On Mac OS X since Qt 4.3, this function compares according the
"Order for sorted lists" setting in the International preferences panel.
- \sa compare(), QTextCodec::locale()
+ \sa compare(), QLocale
*/
/*!
@@ -8463,7 +8463,7 @@ QStringRef QStringRef::appendTo(QString *string) const
On Mac OS X, this function compares according the
"Order for sorted lists" setting in the International prefereces panel.
- \sa compare(), QTextCodec::locale()
+ \sa compare(), QLocale
*/
/*!
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 3933e3978e..798ff2f3e0 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -65,8 +65,10 @@ namespace std
#endif
#ifdef Q_OS_MAC
-Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
Q_FORWARD_DECLARE_CF_TYPE(CFString);
+# ifdef __OBJC__
+Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
+# endif
#endif
QT_BEGIN_NAMESPACE
@@ -682,8 +684,10 @@ public:
#if defined(Q_OS_MAC) || defined(Q_QDOC)
static QString fromCFString(CFStringRef string);
CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED;
+# if defined(__OBJC__) || defined(Q_QDOC)
static QString fromNSString(const NSString *string);
NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED;
+# endif
#endif
// compatibility
struct Null { };
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 9c7c54ea09..24c20b46c7 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -107,7 +107,7 @@ public:
QTimeZoneSingleton() : backend(newBackendTimeZone()) {}
// The backend_tz is the tz to use in static methods such as availableTimeZoneIds() and
- // isTimeZoneIdAvailable() and to create named Olsen time zones. This is usually the host
+ // isTimeZoneIdAvailable() and to create named IANA time zones. This is usually the host
// system, but may be different if the host resources are insufficient or if
// QT_NO_SYSTEMLOCALE is set. A simple UTC backend is used if no alternative is available.
QSharedDataPointer<QTimeZonePrivate> backend;
@@ -137,18 +137,21 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
\section1
- \section2 Olsen Time Zone IDs
+ \section2 IANA Time Zone IDs
- QTimeZone uses the Olsen time zone IDs as defined in the IANA Time Zone
+ QTimeZone uses the IANA time zone IDs as defined in the IANA Time Zone
Database (http://www.iana.org/time-zones). This is to ensure a standard ID
- across all supported platforms. Most platforms support the Olsen IDs
+ across all supported platforms. Most platforms support the IANA IDs
and the IANA Database natively, but for Windows a mapping is required to
the native IDs. See below for more details.
- The Olsen IDs can and do change on a regular basis, and can vary depending
+ The IANA IDs can and do change on a regular basis, and can vary depending
on how recently the host system data was updated. As such you cannot rely
on any given ID existing on any host system. You must use
- availableTimeZoneIds() to determine what Olsen IDs are available.
+ availableTimeZoneIds() to determine what IANA IDs are available.
+
+ The IANA IDs and database are also know as the Olson IDs and database,
+ named after their creator.
\section2 UTC Offset Time Zones
@@ -167,7 +170,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
the current year.
QTimeZone uses a conversion table derived form the Unicode CLDR data to map
- between Olsen IDs and Windows IDs. Depending on your version of Windows
+ between IANA IDs and Windows IDs. Depending on your version of Windows
and Qt, this table may not be able to provide a valid conversion, in which
"UTC" will be returned.
@@ -182,7 +185,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
If you require a QDateTime that uses the current system time zone at any
given moment then you should use a Qt::TimeSpec of Qt::LocalTime.
- The method systemTimeZoneId() returns the current system Olsen time zone
+ The method systemTimeZoneId() returns the current system IANA time zone
ID which on OSX and Linux will always be correct. On Windows this ID is
translated from the the Windows system ID using an internal translation
table and the user's selected country. As a consequence there is a small
@@ -325,7 +328,7 @@ QTimeZone::QTimeZone()
}
/*!
- Creates an instance of the requested time zone \a olsenId.
+ Creates an instance of the requested time zone \a ianaId.
The ID must be one of the available system IDs otherwise an invalid
time zone will be returned.
@@ -333,14 +336,14 @@ QTimeZone::QTimeZone()
\sa availableTimeZoneIds()
*/
-QTimeZone::QTimeZone(const QByteArray &olsenId)
+QTimeZone::QTimeZone(const QByteArray &ianaId)
{
// Try and see if it's a valid UTC offset ID, just as quick to try create as look-up
- d = new QUtcTimeZonePrivate(olsenId);
+ d = new QUtcTimeZonePrivate(ianaId);
// If not a valid UTC offset ID then try create it with the system backend
// Relies on backend not creating valid tz with invalid name
if (!d->isValid())
- d = newBackendTimeZone(olsenId);
+ d = newBackendTimeZone(ianaId);
}
/*!
@@ -361,14 +364,14 @@ QTimeZone::QTimeZone(int offsetSeconds)
}
/*!
- Creates a custom time zone with an ID of \a olsenId and an offset from UTC
+ Creates a custom time zone with an ID of \a ianaId and an offset from UTC
of \a offsetSeconds. The \a name will be the name used by displayName()
for the LongName, the \a abbreviation will be used by displayName() for the
ShortName and by abbreviation(), and the optional \a country will be used
by country(). The \a comment is an optional note that may be displayed in
a GUI to assist users in selecting a time zone.
- The \a olsenId must not be one of the available system IDs returned by
+ The \a ianaId must not be one of the available system IDs returned by
availableTimeZoneIds(). The \a offsetSeconds from UTC must be in the range
-14 hours to +14 hours.
@@ -376,12 +379,12 @@ QTimeZone::QTimeZone(int offsetSeconds)
default value of QLocale::AnyCountry.
*/
-QTimeZone::QTimeZone(const QByteArray &olsenId, int offsetSeconds, const QString &name,
+QTimeZone::QTimeZone(const QByteArray &ianaId, int offsetSeconds, const QString &name,
const QString &abbreviation, QLocale::Country country, const QString &comment)
{
- // olsenId must be a valid ID and must not clash with the standard system names
- if (QTimeZonePrivate::isValidId(olsenId) && !availableTimeZoneIds().contains(olsenId))
- d = new QUtcTimeZonePrivate(olsenId, offsetSeconds, name, abbreviation, country, comment);
+ // ianaId must be a valid ID and must not clash with the standard system names
+ if (QTimeZonePrivate::isValidId(ianaId) && !availableTimeZoneIds().contains(ianaId))
+ d = new QUtcTimeZonePrivate(ianaId, offsetSeconds, name, abbreviation, country, comment);
else
d = 0;
}
@@ -424,13 +427,18 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other)
return *this;
}
+/*
+ \fn void QTimeZone::swap(QTimeZone &other)
+
+ Swaps this timezone with \a other. This function is very fast and
+ never fails.
+*/
+
/*!
\fn QTimeZone &QTimeZone::operator=(QTimeZone &&other)
Move-assigns \a other to this QTimeZone instance, transferring the
ownership of the managed pointer to this instance.
-
- \since 5.2
*/
/*!
@@ -470,10 +478,10 @@ bool QTimeZone::isValid() const
}
/*!
- Returns the Olsen ID for the time zone.
+ Returns the IANA ID for the time zone.
- Olsen IDs are used on all platforms. On Windows these are translated
- from the Windows ID into the closest Olsen ID for the time zone and country.
+ IANA IDs are used on all platforms. On Windows these are translated
+ from the Windows ID into the closest IANA ID for the time zone and country.
*/
QByteArray QTimeZone::id() const
@@ -702,6 +710,9 @@ bool QTimeZone::hasTransitions() const
This is most useful when you have a Transition time and wish to find the
Transition after it.
+ If there is no transition after the given \a afterDateTime then an invalid
+ OffsetData will be returned with an invalid QDateTime.
+
The given \a afterDateTime is exclusive.
\sa hasTransitions(), previousTransition(), transitions()
@@ -720,6 +731,9 @@ QTimeZone::OffsetData QTimeZone::nextTransition(const QDateTime &afterDateTime)
This is most useful when you have a Transition time and wish to find the
Transition before it.
+ If there is no transition before the given \a beforeDateTime then an invalid
+ OffsetData will be returned with an invalid QDateTime.
+
The given \a beforeDateTime is exclusive.
\sa hasTransitions(), nextTransition(), transitions()
@@ -757,7 +771,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime,
// Static methods
/*!
- Returns the current system time zone Olsen ID.
+ Returns the current system time zone IANA ID.
On Windows this ID is translated from the the Windows ID using an internal
translation table and the user's selected country. As a consequence there
@@ -771,20 +785,20 @@ QByteArray QTimeZone::systemTimeZoneId()
}
/*!
- Returns \c true if a given time zone \a olsenId is available on this system.
+ Returns \c true if a given time zone \a ianaId is available on this system.
\sa availableTimeZoneIds()
*/
-bool QTimeZone::isTimeZoneIdAvailable(const QByteArray &olsenId)
+bool QTimeZone::isTimeZoneIdAvailable(const QByteArray &ianaId)
{
// isValidId is not strictly required, but faster to weed out invalid
// IDs as availableTimeZoneIds() may be slow
- return (QTimeZonePrivate::isValidId(olsenId) && (availableTimeZoneIds().contains(olsenId)));
+ return (QTimeZonePrivate::isValidId(ianaId) && (availableTimeZoneIds().contains(ianaId)));
}
/*!
- Returns a list of all available Olsen time zone IDs on this system.
+ Returns a list of all available IANA time zone IDs on this system.
\sa isTimeZoneIdAvailable()
*/
@@ -799,7 +813,7 @@ QList<QByteArray> QTimeZone::availableTimeZoneIds()
}
/*!
- Returns a list of all available Olsen time zone IDs for a given \a country.
+ Returns a list of all available IANA time zone IDs for a given \a country.
As a special case, a \a country of Qt::AnyCountry returns those time zones
that do not have any country related to them, such as UTC. If you require
@@ -819,7 +833,7 @@ QList<QByteArray> QTimeZone::availableTimeZoneIds(QLocale::Country country)
}
/*!
- Returns a list of all available Olsen time zone IDs with a given standard
+ Returns a list of all available IANA time zone IDs with a given standard
time offset of \a offsetSeconds.
\sa isTimeZoneIdAvailable()
@@ -835,79 +849,79 @@ QList<QByteArray> QTimeZone::availableTimeZoneIds(int offsetSeconds)
}
/*!
- Returns the Windows ID equivalent to the given \a olsenId.
+ Returns the Windows ID equivalent to the given \a ianaId.
- \sa windowsIdToDefaultOlsenId(), windowsIdToOlsenIds()
+ \sa windowsIdToDefaultIanaId(), windowsIdToIanaIds()
*/
-QByteArray QTimeZone::olsenIdToWindowsId(const QByteArray &olsenId)
+QByteArray QTimeZone::ianaIdToWindowsId(const QByteArray &ianaId)
{
- return QTimeZonePrivate::olsenIdToWindowsId(olsenId);
+ return QTimeZonePrivate::ianaIdToWindowsId(ianaId);
}
/*!
- Returns the default Olsen ID for a given \a windowsId.
+ Returns the default IANA ID for a given \a windowsId.
- Because a Windows ID can cover several Olsen IDs in several different
- countries, this function returns the most frequently used Olsen ID with no
+ Because a Windows ID can cover several IANA IDs in several different
+ countries, this function returns the most frequently used IANA ID with no
regard for the country and should thus be used with care. It is usually
best to request the default for a specific country.
- \sa olsenIdToWindowsId(), windowsIdToOlsenIds()
+ \sa ianaIdToWindowsId(), windowsIdToIanaIds()
*/
-QByteArray QTimeZone::windowsIdToDefaultOlsenId(const QByteArray &windowsId)
+QByteArray QTimeZone::windowsIdToDefaultIanaId(const QByteArray &windowsId)
{
- return QTimeZonePrivate::windowsIdToDefaultOlsenId(windowsId);
+ return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId);
}
/*!
- Returns the default Olsen ID for a given \a windowsId and \a country.
+ Returns the default IANA ID for a given \a windowsId and \a country.
- Because a Windows ID can cover several Olsen IDs within a given country,
- the most frequently used Olsen ID in that country is returned.
+ Because a Windows ID can cover several IANA IDs within a given country,
+ the most frequently used IANA ID in that country is returned.
- As a special case, QLocale::AnyCountry returns the default of those Olsen IDs
+ As a special case, QLocale::AnyCountry returns the default of those IANA IDs
that do not have any specific country.
- \sa olsenIdToWindowsId(), windowsIdToOlsenIds()
+ \sa ianaIdToWindowsId(), windowsIdToIanaIds()
*/
-QByteArray QTimeZone::windowsIdToDefaultOlsenId(const QByteArray &windowsId,
+QByteArray QTimeZone::windowsIdToDefaultIanaId(const QByteArray &windowsId,
QLocale::Country country)
{
- return QTimeZonePrivate::windowsIdToDefaultOlsenId(windowsId, country);
+ return QTimeZonePrivate::windowsIdToDefaultIanaId(windowsId, country);
}
/*!
- Returns all the Olsen IDs for a given \a windowsId.
+ Returns all the IANA IDs for a given \a windowsId.
The returned list is sorted alphabetically.
- \sa olsenIdToWindowsId(), windowsIdToDefaultOlsenId()
+ \sa ianaIdToWindowsId(), windowsIdToDefaultIanaId()
*/
-QList<QByteArray> QTimeZone::windowsIdToOlsenIds(const QByteArray &windowsId)
+QList<QByteArray> QTimeZone::windowsIdToIanaIds(const QByteArray &windowsId)
{
- return QTimeZonePrivate::windowsIdToOlsenIds(windowsId);
+ return QTimeZonePrivate::windowsIdToIanaIds(windowsId);
}
/*!
- Returns all the Olsen IDs for a given \a windowsId and \a country.
+ Returns all the IANA IDs for a given \a windowsId and \a country.
- As a special case QLocale::AnyCountry returns those Olsen IDs that do
+ As a special case QLocale::AnyCountry returns those IANA IDs that do
not have any specific country.
The returned list is in order of frequency of usage, i.e. larger zones
within a country are listed first.
- \sa olsenIdToWindowsId(), windowsIdToDefaultOlsenId()
+ \sa ianaIdToWindowsId(), windowsIdToDefaultIanaId()
*/
-QList<QByteArray> QTimeZone::windowsIdToOlsenIds(const QByteArray &windowsId,
+QList<QByteArray> QTimeZone::windowsIdToIanaIds(const QByteArray &windowsId,
QLocale::Country country)
{
- return QTimeZonePrivate::windowsIdToOlsenIds(windowsId, country);
+ return QTimeZonePrivate::windowsIdToIanaIds(windowsId, country);
}
#ifndef QT_NO_DATASTREAM
diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h
index 1a6a923cf4..b038d66a65 100644
--- a/src/corelib/tools/qtimezone.h
+++ b/src/corelib/tools/qtimezone.h
@@ -77,9 +77,9 @@ public:
typedef QVector<OffsetData> OffsetDataList;
QTimeZone();
- explicit QTimeZone(const QByteArray &olsenId);
- QTimeZone(int offsetSeconds);
- QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name,
+ explicit QTimeZone(const QByteArray &ianaId);
+ explicit QTimeZone(int offsetSeconds);
+ /*implicit*/ QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name,
const QString &abbreviation, QLocale::Country country = QLocale::AnyCountry,
const QString &comment = QString());
QTimeZone(const QTimeZone &other);
@@ -87,9 +87,12 @@ public:
QTimeZone &operator=(const QTimeZone &other);
#ifdef Q_COMPILER_RVALUE_REFS
- QTimeZone &operator=(QTimeZone &&other) { std::swap(d, other.d); return *this; }
+ QTimeZone &operator=(QTimeZone &&other) { swap(other); return *this; }
#endif
+ void swap(QTimeZone &other)
+ { d.swap(other.d); }
+
bool operator==(const QTimeZone &other) const;
bool operator!=(const QTimeZone &other) const;
@@ -123,18 +126,18 @@ public:
static QByteArray systemTimeZoneId();
- static bool isTimeZoneIdAvailable(const QByteArray &olsenId);
+ static bool isTimeZoneIdAvailable(const QByteArray &ianaId);
static QList<QByteArray> availableTimeZoneIds();
static QList<QByteArray> availableTimeZoneIds(QLocale::Country country);
static QList<QByteArray> availableTimeZoneIds(int offsetSeconds);
- static QByteArray olsenIdToWindowsId(const QByteArray &olsenId);
- static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId);
- static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId,
+ static QByteArray ianaIdToWindowsId(const QByteArray &ianaId);
+ static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId);
+ static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId,
QLocale::Country country);
- static QList<QByteArray> windowsIdToOlsenIds(const QByteArray &windowsId);
- static QList<QByteArray> windowsIdToOlsenIds(const QByteArray &windowsId,
+ static QList<QByteArray> windowsIdToIanaIds(const QByteArray &windowsId);
+ static QList<QByteArray> windowsIdToIanaIds(const QByteArray &windowsId,
QLocale::Country country);
private:
@@ -149,6 +152,7 @@ private:
};
Q_DECLARE_TYPEINFO(QTimeZone::OffsetData, Q_MOVABLE_TYPE);
+Q_DECLARE_SHARED(QTimeZone)
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz);
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index 8d5d60bf37..08a5ce0861 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -264,7 +264,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs)
// If the local msecs is less than the real local time of the transition
// then get the previous transition to use instead
if (forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)) {
- while (forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)) {
+ while (tran.atMSecsSinceEpoch != invalidMSecs()
+ && forLocalMSecs < tran.atMSecsSinceEpoch + (tran.offsetFromUtc * 1000)) {
nextTran = tran;
tran = previousTransition(tran.atMSecsSinceEpoch);
}
@@ -272,7 +273,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs)
// The zone msecs is after the transition, so check it is before the next tran
// If not try use the next transition instead
nextTran = nextTransition(tran.atMSecsSinceEpoch);
- while (forLocalMSecs >= nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)) {
+ while (nextTran.atMSecsSinceEpoch != invalidMSecs()
+ && forLocalMSecs >= nextTran.atMSecsSinceEpoch + (nextTran.offsetFromUtc * 1000)) {
tran = nextTran;
nextTran = nextTransition(tran.atMSecsSinceEpoch);
}
@@ -292,7 +294,8 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs)
// then use the prev tran as we default to the FirstOccurrence
// TODO Check if faster to just always get prev tran, or if faster using 6 hour check.
Data dstTran = previousTransition(tran.atMSecsSinceEpoch);
- if (dstTran.daylightTimeOffset > 0 && diffPrevTran < (dstTran.daylightTimeOffset * 1000))
+ if (dstTran.atMSecsSinceEpoch != invalidMSecs()
+ && dstTran.daylightTimeOffset > 0 && diffPrevTran < (dstTran.daylightTimeOffset * 1000))
tran = dstTran;
} else if (diffNextTran >= 0 && diffNextTran <= (nextTran.daylightTimeOffset * 1000)) {
// If time falls within last hour of standard time then is actually the missing hour
@@ -328,10 +331,11 @@ QTimeZonePrivate::DataList QTimeZonePrivate::transitions(qint64 fromMSecsSinceEp
qint64 toMSecsSinceEpoch) const
{
DataList list;
- if (toMSecsSinceEpoch > fromMSecsSinceEpoch) {
+ if (toMSecsSinceEpoch >= fromMSecsSinceEpoch) {
// fromMSecsSinceEpoch is inclusive but nextTransitionTime() is exclusive so go back 1 msec
Data next = nextTransition(fromMSecsSinceEpoch - 1);
- while (next.atMSecsSinceEpoch <= toMSecsSinceEpoch) {
+ while (next.atMSecsSinceEpoch != invalidMSecs()
+ && next.atMSecsSinceEpoch <= toMSecsSinceEpoch) {
list.append(next);
next = nextTransition(next.atMSecsSinceEpoch);
}
@@ -477,7 +481,7 @@ QString QTimeZonePrivate::isoOffsetFormat(int offsetFromUtc)
.arg(qAbs(mins) % 60, 2, 10, QLatin1Char('0'));
}
-QByteArray QTimeZonePrivate::olsenIdToWindowsId(const QByteArray &id)
+QByteArray QTimeZonePrivate::ianaIdToWindowsId(const QByteArray &id)
{
for (int i = 0; i < zoneDataTableSize; ++i) {
const QZoneData *data = zoneData(i);
@@ -487,7 +491,7 @@ QByteArray QTimeZonePrivate::olsenIdToWindowsId(const QByteArray &id)
return QByteArray();
}
-QByteArray QTimeZonePrivate::windowsIdToDefaultOlsenId(const QByteArray &windowsId)
+QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId)
{
const quint16 windowsIdKey = toWindowsIdKey(windowsId);
for (int i = 0; i < windowsDataTableSize; ++i) {
@@ -498,17 +502,17 @@ QByteArray QTimeZonePrivate::windowsIdToDefaultOlsenId(const QByteArray &windows
return QByteArray();
}
-QByteArray QTimeZonePrivate::windowsIdToDefaultOlsenId(const QByteArray &windowsId,
+QByteArray QTimeZonePrivate::windowsIdToDefaultIanaId(const QByteArray &windowsId,
QLocale::Country country)
{
- const QList<QByteArray> list = windowsIdToOlsenIds(windowsId, country);
+ const QList<QByteArray> list = windowsIdToIanaIds(windowsId, country);
if (list.count() > 0)
return list.first();
else
return QByteArray();
}
-QList<QByteArray> QTimeZonePrivate::windowsIdToOlsenIds(const QByteArray &windowsId)
+QList<QByteArray> QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId)
{
const quint16 windowsIdKey = toWindowsIdKey(windowsId);
QList<QByteArray> list;
@@ -524,7 +528,7 @@ QList<QByteArray> QTimeZonePrivate::windowsIdToOlsenIds(const QByteArray &window
return list;
}
-QList<QByteArray> QTimeZonePrivate::windowsIdToOlsenIds(const QByteArray &windowsId,
+QList<QByteArray> QTimeZonePrivate::windowsIdToIanaIds(const QByteArray &windowsId,
QLocale::Country country)
{
const quint16 windowsIdKey = toWindowsIdKey(windowsId);
diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm
index 8d319aebbd..69d2c42d27 100644
--- a/src/corelib/tools/qtimezoneprivate_mac.mm
+++ b/src/corelib/tools/qtimezoneprivate_mac.mm
@@ -185,15 +185,14 @@ bool QMacTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const
QTimeZonePrivate::Data QMacTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
{
const NSTimeInterval seconds = forMSecsSinceEpoch / 1000.0;
+ NSDate *date = [NSDate dateWithTimeIntervalSince1970:seconds];
Data data;
data.atMSecsSinceEpoch = forMSecsSinceEpoch;
- data.offsetFromUtc = [m_nstz secondsFromGMTForDate:
- [NSDate dateWithTimeIntervalSince1970:seconds]];
- data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:
- [NSDate dateWithTimeIntervalSince1970:seconds]];
+ data.offsetFromUtc = [m_nstz secondsFromGMTForDate:date];
+ data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:date];
data.standardTimeOffset = data.offsetFromUtc - data.daylightTimeOffset;
- data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:
- [NSDate dateWithTimeIntervalSince1970:seconds]]);
+ data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]);
+ [date release];
return data;
}
@@ -213,26 +212,46 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc
{
QTimeZonePrivate::Data tran;
const NSTimeInterval seconds = afterMSecsSinceEpoch / 1000.0;
- NSDate *date = [NSDate dateWithTimeIntervalSince1970:seconds];
- const NSDate *next = [m_nstz nextDaylightSavingTimeTransitionAfterDate:date];
- const NSTimeInterval nextSecs = [next timeIntervalSince1970];
+ NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:seconds];
+ nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
+ const NSTimeInterval nextSecs = [nextDate timeIntervalSince1970];
+ if (nextDate == nil || nextSecs <= seconds) {
+ [nextDate release];
+ return invalidData();
+ }
tran.atMSecsSinceEpoch = nextSecs * 1000;
- tran.offsetFromUtc = [m_nstz secondsFromGMTForDate:
- [NSDate dateWithTimeIntervalSince1970:nextSecs]];
- tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:
- [NSDate dateWithTimeIntervalSince1970:nextSecs]];
+ tran.offsetFromUtc = [m_nstz secondsFromGMTForDate:nextDate];
+ tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:nextDate];
tran.standardTimeOffset = tran.offsetFromUtc - tran.daylightTimeOffset;
- tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]);
- [next release];
- [date release];
+ tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:nextDate]);
+ [nextDate release];
return tran;
}
QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const
{
- // TODO No direct Mac API, so get all transitions since epoch and return the last one
- // Probably slow, need to optimize
- return transitions(0, beforeMSecsSinceEpoch - 1).last();
+ // No direct Mac API, so get all transitions since epoch and return the last one
+ QList<int> secsList;
+ if (beforeMSecsSinceEpoch > 0) {
+ const int endSecs = beforeMSecsSinceEpoch / 1000.0;
+ NSTimeInterval prevSecs = 0;
+ NSTimeInterval nextSecs = 0;
+ NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs];
+ // If invalid may return a nil date or an Epoch date
+ nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
+ nextSecs = [nextDate timeIntervalSince1970];
+ while (nextDate != nil && nextSecs > prevSecs && nextSecs < endSecs) {
+ secsList.append(nextSecs);
+ prevSecs = nextSecs;
+ nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate];
+ nextSecs = [nextDate timeIntervalSince1970];
+ }
+ [nextDate release];
+ }
+ if (secsList.size() >= 1)
+ return data(qint64(secsList.last()) * 1000);
+ else
+ return invalidData();
}
QByteArray QMacTimeZonePrivate::systemTimeZoneId() const
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index 9f99f49fcf..108aec2654 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -146,12 +146,12 @@ public:
static bool isValidId(const QByteArray &olsenId);
static QString isoOffsetFormat(int offsetFromUtc);
- static QByteArray olsenIdToWindowsId(const QByteArray &olsenId);
- static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId);
- static QByteArray windowsIdToDefaultOlsenId(const QByteArray &windowsId,
+ static QByteArray ianaIdToWindowsId(const QByteArray &ianaId);
+ static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId);
+ static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId,
QLocale::Country country);
- static QList<QByteArray> windowsIdToOlsenIds(const QByteArray &windowsId);
- static QList<QByteArray> windowsIdToOlsenIds(const QByteArray &windowsId,
+ static QList<QByteArray> windowsIdToIanaIds(const QByteArray &windowsId);
+ static QList<QByteArray> windowsIdToIanaIds(const QByteArray &windowsId,
QLocale::Country country);
protected:
@@ -309,6 +309,7 @@ private:
bool operator==(const QTzTransitionRule &other) { return (stdOffset == other.stdOffset
&& dstOffset == other.dstOffset && abbreviationIndex == other.abbreviationIndex); }
};
+ Data dataForTzTransition(QTzTransitionTime tran) const;
QList<QTzTransitionTime> m_tranTimes;
QList<QTzTransitionRule> m_tranRules;
QList<QByteArray> m_abbreviations;
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 4bf19178fa..1fb6bb1b5a 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -149,11 +149,13 @@ static QTzHeader parseTzHeader(QDataStream &ds, bool *ok)
if (memcmp(hdr.tzh_magic, TZ_MAGIC, 4) != 0 || ds.status() != QDataStream::Ok)
return hdr;
- // Parse Version, 1 byte, before 2005 was '\0', since 2005 a '2'
+ // Parse Version, 1 byte, before 2005 was '\0', since 2005 a '2', since 2013 a '3'
ds >> ch;
hdr.tzh_version = ch;
- if (ds.status() != QDataStream::Ok || (hdr.tzh_version != '2' && hdr.tzh_version != '\0'))
+ if (ds.status() != QDataStream::Ok
+ || (hdr.tzh_version != '2' && hdr.tzh_version != '\0' && hdr.tzh_version != '3')) {
return hdr;
+ }
// Parse reserved space, 15 bytes
ds.readRawData(hdr.tzh_reserved, 15);
@@ -238,30 +240,31 @@ static QList<QTzType> parseTzTypes(QDataStream &ds, int tzh_typecnt)
return typeList;
}
-static QMap<int, QByteArray> parseTzAbbreviations(QDataStream &ds, int tzh_charcnt)
+static QMap<int, QByteArray> parseTzAbbreviations(QDataStream &ds, int tzh_charcnt, QList<QTzType> typeList)
{
// Parse the abbreviation list which is tzh_charcnt long with '\0' separated strings. The
- // tz_abbrind index points to the first char of the abbreviation in the array, not the
- // occurrence in the list. By parsing char at a time we can track the char index and convert
- // to an occurrence index. By using a map with tz_abbrind as ordered key we get both index
+ // QTzType.tz_abbrind index points to the first char of the abbreviation in the array, not the
+ // occurrence in the list. It can also point to a partial string so we need to use the actual typeList
+ // index values when parsing. By using a map with tz_abbrind as ordered key we get both index
// methods in one data structure and can convert the types afterwards.
QMap<int, QByteArray> map;
quint8 ch;
- QByteArray abbrev;
- // Track the start position of each abbreviation
- int tz_abbrind = 0;
+ QByteArray input;
+ // First parse the full abbrev string
for (int i = 0; i < tzh_charcnt && ds.status() == QDataStream::Ok; ++i) {
ds >> ch;
- if (ds.status() == QDataStream::Ok) {
- if (ch == '\0') {
- // Have reached end of an abbreviation, so add to map
- map[tz_abbrind] = abbrev;
- tz_abbrind = i + 1;
- abbrev.clear();
- } else {
- abbrev.append((char)ch);
- }
- }
+ if (ds.status() == QDataStream::Ok)
+ input.append(char(ch));
+ else
+ return map;
+ }
+ // Then extract all the substrings pointed to by typeList
+ foreach (const QTzType type, typeList) {
+ QByteArray abbrev;
+ for (int i = type.tz_abbrind; input.at(i) != '\0'; ++i)
+ abbrev.append(input.at(i));
+ // Have reached end of an abbreviation, so add to map
+ map[type.tz_abbrind] = abbrev;
}
return map;
}
@@ -371,7 +374,7 @@ static QDate calculatePosixDate(const QByteArray dateRule, int year)
}
}
-static QTime parsePosixTime(const QByteArray timeRule)
+static QTime parsePosixTime(const QByteArray &timeRule)
{
// Format "HH:mm:ss", put check parts count just in case
QList<QByteArray> parts = timeRule.split(':');
@@ -385,7 +388,7 @@ static QTime parsePosixTime(const QByteArray timeRule)
return QTime(2, 0, 0);
}
-static int parsePosixOffset(const QByteArray timeRule)
+static int parsePosixOffset(const QByteArray &timeRule)
{
// Format "[+|-]hh[:mm[:ss]]"
QList<QByteArray> parts = timeRule.split(':');
@@ -399,7 +402,9 @@ static int parsePosixOffset(const QByteArray timeRule)
return 0;
}
-static QList<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray &posixRule, int startYear, int endYear)
+static QList<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray &posixRule,
+ int startYear, int endYear,
+ int lastTranMSecs)
{
QList<QTimeZonePrivate::Data> list;
@@ -443,11 +448,13 @@ static QList<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray
// If only the name part then no transitions
if (parts.count() == 1) {
QTimeZonePrivate::Data data;
- data.atMSecsSinceEpoch = 0;
+ data.atMSecsSinceEpoch = lastTranMSecs;
data.offsetFromUtc = utcOffset;
data.standardTimeOffset = utcOffset;
data.daylightTimeOffset = 0;
data.abbreviation = stdName;
+ list << data;
+ return list;
}
// If not populated the total dst offset is 1 hour
@@ -572,7 +579,7 @@ void QTzTimeZonePrivate::init(const QByteArray &olsenId)
QList<QTzType> typeList = parseTzTypes(ds, hdr.tzh_typecnt);
if (ds.status() != QDataStream::Ok)
return;
- QMap<int, QByteArray> abbrevMap = parseTzAbbreviations(ds, hdr.tzh_charcnt);
+ QMap<int, QByteArray> abbrevMap = parseTzAbbreviations(ds, hdr.tzh_charcnt, typeList);
if (ds.status() != QDataStream::Ok)
return;
parseTzLeapSeconds(ds, hdr.tzh_leapcnt, false);
@@ -583,7 +590,7 @@ void QTzTimeZonePrivate::init(const QByteArray &olsenId)
return;
// If version 2 then parse the second block of data
- if (hdr.tzh_version == '2') {
+ if (hdr.tzh_version == '2' || hdr.tzh_version == '3') {
ok = false;
QTzHeader hdr2 = parseTzHeader(ds, &ok);
if (!ok || ds.status() != QDataStream::Ok)
@@ -594,7 +601,7 @@ void QTzTimeZonePrivate::init(const QByteArray &olsenId)
typeList = parseTzTypes(ds, hdr2.tzh_typecnt);
if (ds.status() != QDataStream::Ok)
return;
- abbrevMap = parseTzAbbreviations(ds, hdr2.tzh_charcnt);
+ abbrevMap = parseTzAbbreviations(ds, hdr2.tzh_charcnt, typeList);
if (ds.status() != QDataStream::Ok)
return;
parseTzLeapSeconds(ds, hdr2.tzh_leapcnt, true);
@@ -682,12 +689,14 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
- return m_icu->displayName(atMSecsSinceEpoch, nameType, locale);
+ // TODO Some valid TZ names are not valid ICU names, use translation table?
+ if (m_icu->isValid())
+ return m_icu->displayName(atMSecsSinceEpoch, nameType, locale);
#else
Q_UNUSED(nameType)
Q_UNUSED(locale)
- return abbreviation(atMSecsSinceEpoch);
#endif // QT_USE_ICU
+ return abbreviation(atMSecsSinceEpoch);
}
QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
@@ -698,19 +707,59 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
- return m_icu->displayName(timeType, nameType, locale);
+ // TODO Some valid TZ names are not valid ICU names, use translation table?
+ if (m_icu->isValid())
+ return m_icu->displayName(timeType, nameType, locale);
#else
Q_UNUSED(timeType)
Q_UNUSED(nameType)
Q_UNUSED(locale)
- const int atMSecsSinceEpoch = QDateTime::currentMSecsSinceEpoch();
- QTimeZonePrivate::Data tran = data(atMSecsSinceEpoch);
- while ((timeType == QTimeZone::StandardTime && tran.daylightTimeOffset != 0)
- || (timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset == 0)) {
- tran = nextTransition(tran.atMSecsSinceEpoch);
- }
- return tran.abbreviation;
#endif // QT_USE_ICU
+ // If no ICU available then have to use abbreviations instead
+ // Abbreviations don't have GenericTime
+ if (timeType == QTimeZone::GenericTime)
+ timeType = QTimeZone::StandardTime;
+
+ // Get current tran, if valid and is what we want, then use it
+ const qint64 currentMSecs = QDateTime::currentMSecsSinceEpoch();
+ QTimeZonePrivate::Data tran = data(currentMSecs);
+ if (tran.atMSecsSinceEpoch != invalidMSecs()
+ && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0)
+ || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) {
+ return tran.abbreviation;
+ }
+
+ // Otherwise get next tran and if valid and is what we want, then use it
+ tran = nextTransition(currentMSecs);
+ if (tran.atMSecsSinceEpoch != invalidMSecs()
+ && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0)
+ || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) {
+ return tran.abbreviation;
+ }
+
+ // Otherwise get prev tran and if valid and is what we want, then use it
+ tran = previousTransition(currentMSecs);
+ if (tran.atMSecsSinceEpoch != invalidMSecs())
+ tran = previousTransition(tran.atMSecsSinceEpoch);
+ if (tran.atMSecsSinceEpoch != invalidMSecs()
+ && ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0)
+ || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0))) {
+ return tran.abbreviation;
+ }
+
+ // Otherwise is strange sequence, so work backwards through trans looking for first match, if any
+ for (int i = m_tranTimes.size() - 1; i >= 0; --i) {
+ if (m_tranTimes.at(i).atMSecsSinceEpoch <= currentMSecs) {
+ tran = dataForTzTransition(m_tranTimes.at(i));
+ if ((timeType == QTimeZone::DaylightTime && tran.daylightTimeOffset != 0)
+ || (timeType == QTimeZone::StandardTime && tran.daylightTimeOffset == 0)) {
+ return tran.abbreviation;
+ }
+ }
+ }
+
+ // Otherwise if no match use current data
+ return data(currentMSecs).abbreviation;
}
QString QTzTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const
@@ -749,35 +798,55 @@ bool QTzTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const
return (daylightTimeOffset(atMSecsSinceEpoch) != 0);
}
+QTimeZonePrivate::Data QTzTimeZonePrivate::dataForTzTransition(QTzTransitionTime tran) const
+{
+ QTimeZonePrivate::Data data;
+ data.atMSecsSinceEpoch = tran.atMSecsSinceEpoch;
+ QTzTransitionRule rule = m_tranRules.at(tran.ruleIndex);
+ data.standardTimeOffset = rule.stdOffset;
+ data.daylightTimeOffset = rule.dstOffset;
+ data.offsetFromUtc = rule.stdOffset + rule.dstOffset;
+ data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex));
+ return data;
+}
+
QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
{
- QTimeZonePrivate::Data data = invalidData();
- int lastTran = m_tranTimes.size() - 1;
- int tran;
- for (tran = lastTran; tran > 0; --tran) {
- if (m_tranTimes.at(tran).atMSecsSinceEpoch <= forMSecsSinceEpoch)
- break;
- }
- // If after the last transition time then we need to use the posix rule if available
- if (tran >= lastTran && !m_posixRule.isEmpty()) {
- QDateTime dt = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch);
- int year = dt.date().year();
- QList<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1, year + 1);
- for (int i = posixTrans.size() - 1; i > 0; --i) {
+ // If the required time is after the last transition and we have a POSIX rule then use it
+ if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch
+ &&!m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) {
+ const int year = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch, Qt::UTC).date().year();
+ const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
+ QList<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
+ year + 1, lastMSecs);
+ for (int i = posixTrans.size() - 1; i >= 0; --i) {
if (posixTrans.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch) {
+ QTimeZonePrivate::Data data;
data = posixTrans.at(i);
data.atMSecsSinceEpoch = forMSecsSinceEpoch;
return data;
}
}
}
- data.atMSecsSinceEpoch = forMSecsSinceEpoch;
- QTzTransitionRule rule = m_tranRules.at(m_tranTimes.at(tran).ruleIndex);
- data.standardTimeOffset = rule.stdOffset;
- data.daylightTimeOffset = rule.dstOffset;
- data.offsetFromUtc = rule.stdOffset + rule.dstOffset;
- data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex));
- return data;
+
+ // Otherwise if we can find a valid tran then use its rule
+ for (int i = m_tranTimes.size() - 1; i >= 0; --i) {
+ if (m_tranTimes.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch) {
+ Data data = dataForTzTransition(m_tranTimes.at(i));
+ data.atMSecsSinceEpoch = forMSecsSinceEpoch;
+ return data;
+ }
+ }
+
+ // Otherwise use the earliest transition we have
+ if (m_tranTimes.size() > 0) {
+ Data data = dataForTzTransition(m_tranTimes.at(0));
+ data.atMSecsSinceEpoch = forMSecsSinceEpoch;
+ return data;
+ }
+
+ // Otherwise we have no rules, so probably an invalid tz, so return invalid data
+ return invalidData();
}
bool QTzTimeZonePrivate::hasTransitions() const
@@ -787,60 +856,54 @@ bool QTzTimeZonePrivate::hasTransitions() const
QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const
{
- int lastTran = m_tranTimes.size() - 1;
- int tran;
- for (tran = 0; tran < lastTran; ++tran) {
- if (m_tranTimes.at(tran).atMSecsSinceEpoch > afterMSecsSinceEpoch)
- break;
- }
- // If after the last transition time then we need to use the posix rule if available
- if (tran >= lastTran && !m_posixRule.isEmpty()) {
- QDateTime dt = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch);
- int year = dt.date().year();
- QList<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1, year + 1);
- for (int i = 0; i < posixTrans.size() - 1; ++i) {
+ // If the required time is after the last transition and we have a POSIX rule then use it
+ if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch
+ &&!m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) {
+ const int year = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch, Qt::UTC).date().year();
+ const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
+ QList<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
+ year + 1, lastMSecs);
+ for (int i = 0; i < posixTrans.size(); ++i) {
if (posixTrans.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch)
return posixTrans.at(i);
}
}
- // Otherwise use the transition we found
- QTimeZonePrivate::Data data;
- data.atMSecsSinceEpoch = m_tranTimes.at(tran).atMSecsSinceEpoch;
- QTzTransitionRule rule = m_tranRules.at(m_tranTimes.at(tran).ruleIndex);
- data.standardTimeOffset = rule.stdOffset;
- data.daylightTimeOffset = rule.dstOffset;
- data.offsetFromUtc = rule.stdOffset + rule.dstOffset;
- data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex));
- return data;
+
+ // Otherwise if we can find a valid tran then use its rule
+ for (int i = 0; i < m_tranTimes.size(); ++i) {
+ if (m_tranTimes.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch) {
+ return dataForTzTransition(m_tranTimes.at(i));
+ }
+ }
+
+ // Otherwise we have no rule, or there is no next transition, so return invalid data
+ return invalidData();
}
QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const
{
- int lastTran = m_tranTimes.size() - 1;
- int tran;
- for (tran = lastTran; tran > 0; --tran) {
- if (m_tranTimes.at(tran).atMSecsSinceEpoch < beforeMSecsSinceEpoch)
- break;
- }
- // If after the last transition time then we need to use the posix rule if available
- if (tran >= lastTran && !m_posixRule.isEmpty()) {
- QDateTime dt = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch);
- int year = dt.date().year();
- QList<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1, year + 1);
- for (int i = posixTrans.size() - 1; i > 0; --i) {
+ // If the required time is after the last transition and we have a POSIX rule then use it
+ if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch
+ &&!m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) {
+ const int year = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch, Qt::UTC).date().year();
+ const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
+ QList<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
+ year + 1, lastMSecs);
+ for (int i = posixTrans.size() - 1; i >= 0; --i) {
if (posixTrans.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch)
return posixTrans.at(i);
}
}
- // Otherwise use the transition we found
- QTimeZonePrivate::Data data;
- data.atMSecsSinceEpoch = m_tranTimes.at(tran).atMSecsSinceEpoch;
- QTzTransitionRule rule = m_tranRules.at(m_tranTimes.at(tran).ruleIndex);
- data.standardTimeOffset = rule.stdOffset;
- data.daylightTimeOffset = rule.dstOffset;
- data.offsetFromUtc = rule.stdOffset + rule.dstOffset;
- data.abbreviation = QString::fromUtf8(m_abbreviations.at(rule.abbreviationIndex));
- return data;
+
+ // Otherwise if we can find a valid tran then use its rule
+ for (int i = m_tranTimes.size() - 1; i >= 0; --i) {
+ if (m_tranTimes.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch) {
+ return dataForTzTransition(m_tranTimes.at(i));
+ }
+ }
+
+ // Otherwise we have no rule, so return invalid data
+ return invalidData();
}
// TODO Could cache the value and monitor the required files for any changes
diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp
index c219a49e1e..04588b2ba8 100644
--- a/src/corelib/tools/qtimezoneprivate_win.cpp
+++ b/src/corelib/tools/qtimezoneprivate_win.cpp
@@ -106,14 +106,6 @@ static QDate msecsToDate(qint64 msecs)
return QDate::fromJulianDay(jd);
}
-static qint64 systemtimeToMsecs(const SYSTEMTIME &systemtime)
-{
- FILETIME utcFileTime;
- SystemTimeToFileTime(&systemtime, &utcFileTime);
- ULONGLONG utcNSecs = (((ULONGLONG) utcFileTime.dwHighDateTime) << 32) + utcFileTime.dwLowDateTime;
- return (utcNSecs - FILETIME_UNIX_EPOCH) / 10000;
-}
-
static bool equalSystemtime(const SYSTEMTIME &t1, const SYSTEMTIME &t2)
{
return (t1.wYear == t2.wYear
@@ -262,6 +254,10 @@ static QByteArray windowsSystemZoneId()
static QDate calculateTransitionLocalDate(const SYSTEMTIME &rule, int year)
{
+ // If month is 0 then there is no date
+ if (rule.wMonth == 0)
+ return QDate();
+
SYSTEMTIME time = rule;
// If the year isn't set, then the rule date is relative
if (time.wYear == 0) {
@@ -277,9 +273,10 @@ static QDate calculateTransitionLocalDate(const SYSTEMTIME &rule, int year)
while (date.month() != time.wMonth)
date = date.addDays(-7);
return date;
- } else {
- return QDate(time.wYear, time.wMonth, time.wDay);
}
+
+ // If the year is set then is an absolute date
+ return QDate(time.wYear, time.wMonth, time.wDay);
}
// Converts a date/time value into msecs
@@ -293,19 +290,25 @@ static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitio
qint64 *stdMSecs, qint64 *dstMSecs)
{
// TODO Consider caching the calculated values
-
- // The local time in Daylight Time when switches to Standard TIme
+ // The local time in Daylight Time when switches to Standard Time
QDate standardDate = calculateTransitionLocalDate(rule.standardTimeRule, year);
QTime standardTime = QTime(rule.standardTimeRule.wHour, rule.standardTimeRule.wMinute,
rule.standardTimeRule.wSecond);
- // The local time in Standard Time when switches to Daylight TIme
+ if (standardDate.isValid() && standardTime.isValid()) {
+ *stdMSecs = timeToMSecs(standardDate, standardTime)
+ + ((rule.standardTimeBias + rule.daylightTimeBias) * 60000);
+ } else {
+ *stdMSecs = QTimeZonePrivate::invalidMSecs();
+ }
+
+ // The local time in Standard Time when switches to Daylight Time
QDate daylightDate = calculateTransitionLocalDate(rule.daylightTimeRule, year);
QTime daylightTime = QTime(rule.daylightTimeRule.wHour, rule.daylightTimeRule.wMinute,
rule.daylightTimeRule.wSecond);
-
- *stdMSecs = timeToMSecs(standardDate, standardTime)
- + ((rule.standardTimeBias + rule.daylightTimeBias) * 60000);
- *dstMSecs = timeToMSecs(daylightDate, daylightTime) + (rule.standardTimeBias * 60000);
+ if (daylightDate.isValid() && daylightTime.isValid())
+ *dstMSecs = timeToMSecs(daylightDate, daylightTime) + (rule.standardTimeBias * 60000);
+ else
+ *dstMSecs = QTimeZonePrivate::invalidMSecs();
}
static QLocale::Country userCountry()
@@ -359,7 +362,7 @@ void QWinTimeZonePrivate::init(const QByteArray &olsenId)
m_windowsId = windowsSystemZoneId();
m_id = systemTimeZoneId();
} else {
- m_windowsId = olsenIdToWindowsId(olsenId);
+ m_windowsId = ianaIdToWindowsId(olsenId);
m_id = olsenId;
}
@@ -473,15 +476,8 @@ bool QWinTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const
QTimeZonePrivate::Data QWinTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
{
- // Convert MSecs to year to get transitions for, but around 31 Dec/1 Jan may not be right year
- // So get the year after we think we want transitions for, to be safe
- QDate date = msecsToDate(forMSecsSinceEpoch);
- int year;
- int month;
- int day;
- date.getDate(&year, &month, &day);
- if ((month == 12 && day == 31) || (month == 1 && day == 1))
- ++year;
+ // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan
+ int year = msecsToDate(forMSecsSinceEpoch).year();
qint64 first;
qint64 second;
@@ -492,21 +488,26 @@ QTimeZonePrivate::Data QWinTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons
do {
// Convert the transition rules into msecs for the year we want to try
rule = ruleForYear(year);
+ // If no transition rules to calculate then no DST, so just use rule for std
+ if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0)
+ break;
calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs);
- first = qMin(stdMSecs, dstMSecs);
- second = qMax(stdMSecs, dstMSecs);
- if (forMSecsSinceEpoch >= second)
+ if (stdMSecs < dstMSecs) {
+ first = stdMSecs;
+ second = dstMSecs;
+ } else {
+ first = dstMSecs;
+ second = stdMSecs;
+ }
+ if (forMSecsSinceEpoch >= second && second != invalidMSecs())
next = second;
- else if (forMSecsSinceEpoch >= first)
+ else if (forMSecsSinceEpoch >= first && first != invalidMSecs())
next = first;
// If didn't fall in this year, try the previous
--year;
- } while (forMSecsSinceEpoch < first && year >= MIN_YEAR);
+ } while (next == maxMSecs() && year >= MIN_YEAR);
- if (next == dstMSecs)
- return ruleToData(rule, forMSecsSinceEpoch, QTimeZone::DaylightTime);
- else
- return ruleToData(rule, forMSecsSinceEpoch, QTimeZone::StandardTime);
+ return ruleToData(rule, forMSecsSinceEpoch, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime);
}
bool QWinTimeZonePrivate::hasTransitions() const
@@ -520,79 +521,105 @@ bool QWinTimeZonePrivate::hasTransitions() const
QTimeZonePrivate::Data QWinTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const
{
- // Convert MSecs to year to get transitions for, but around 31 Dec/1 Jan may not be right year
- // Get the year before we think we want transitions for, to be safe
- QDate date = msecsToDate(afterMSecsSinceEpoch);
- int year;
- int month;
- int day;
- date.getDate(&year, &month, &day);
- if ((month == 12 && day == 31) || (month == 1 && day == 1))
- --year;
+ // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan
+ int year = msecsToDate(afterMSecsSinceEpoch).year();
+ QWinTransitionRule rule;
+ // If the required year falls after the last rule start year and the last rule has no
+ // valid future transition calculations then there is no next transition
+ if (year > m_tranRules.last().startYear) {
+ rule = ruleForYear(year);
+ // If the rules have either a fixed year, or no month, then no future trans
+ if (rule.standardTimeRule.wYear != 0 || rule.daylightTimeRule.wYear != 0
+ || rule.standardTimeRule.wMonth == 0 || rule.daylightTimeRule.wMonth == 0) {
+ return invalidData();
+ }
+ }
+
+ // Otherwise we have a valid rule for the required year that can be used
+ // to calculate this year or next
qint64 first;
qint64 second;
qint64 next = minMSecs();
qint64 stdMSecs;
qint64 dstMSecs;
- QWinTransitionRule rule;
do {
// Convert the transition rules into msecs for the year we want to try
rule = ruleForYear(year);
+ // If no transition rules to calculate then no next transition
+ if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0)
+ return invalidData();
calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs);
// Find the first and second transition for the year
- first = qMin(stdMSecs, dstMSecs);
- second = qMax(stdMSecs, dstMSecs);
+ if (stdMSecs < dstMSecs) {
+ first = stdMSecs;
+ second = dstMSecs;
+ } else {
+ first = dstMSecs;
+ second = stdMSecs;
+ }
if (afterMSecsSinceEpoch < first)
next = first;
else if (afterMSecsSinceEpoch < second)
next = second;
// If didn't fall in this year, try the next
++year;
- } while (afterMSecsSinceEpoch >= second && year <= MAX_YEAR);
+ } while (next == minMSecs() && year <= MAX_YEAR);
- if (next == dstMSecs)
- return ruleToData(rule, next, QTimeZone::DaylightTime);
- else
- return ruleToData(rule, next, QTimeZone::StandardTime);
+ if (next == minMSecs() || next == invalidMSecs())
+ return invalidData();
+
+ return ruleToData(rule, next, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime);
}
QTimeZonePrivate::Data QWinTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const
{
- // Convert MSecs to year to get transitions for, but around 31 Dec/1 Jan may not be right year
- // So get the year after we think we want transitions for, to be safe
- QDate date = msecsToDate(beforeMSecsSinceEpoch);
- int year;
- int month;
- int day;
- date.getDate(&year, &month, &day);
- if ((month == 12 && day == 31) || (month == 1 && day == 1))
- ++year;
+ // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan
+ int year = msecsToDate(beforeMSecsSinceEpoch).year();
+
+ QWinTransitionRule rule;
+ // If the required year falls before the first rule start year and the first rule has no
+ // valid transition calculations then there is no previous transition
+ if (year < m_tranRules.first().startYear) {
+ rule = ruleForYear(year);
+ // If the rules have either a fixed year, or no month, then no previous trans
+ if (rule.standardTimeRule.wYear != 0 || rule.daylightTimeRule.wYear != 0
+ || rule.standardTimeRule.wMonth == 0 || rule.daylightTimeRule.wMonth == 0) {
+ return invalidData();
+ }
+ }
qint64 first;
qint64 second;
qint64 next = maxMSecs();
qint64 stdMSecs;
qint64 dstMSecs;
- QWinTransitionRule rule;
do {
// Convert the transition rules into msecs for the year we want to try
rule = ruleForYear(year);
+ // If no transition rules to calculate then no previous transition
+ if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0)
+ return invalidData();
calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs);
- first = qMin(stdMSecs, dstMSecs);
- second = qMax(stdMSecs, dstMSecs);
- if (beforeMSecsSinceEpoch > second)
+ if (stdMSecs < dstMSecs) {
+ first = stdMSecs;
+ second = dstMSecs;
+ } else {
+ first = dstMSecs;
+ second = stdMSecs;
+ }
+ if (beforeMSecsSinceEpoch > second && second != invalidMSecs())
next = second;
- else if (beforeMSecsSinceEpoch > first)
+ else if (beforeMSecsSinceEpoch > first && first != invalidMSecs())
next = first;
// If didn't fall in this year, try the previous
--year;
- } while (beforeMSecsSinceEpoch < first && year >= MIN_YEAR);
+ } while (next == maxMSecs() && year >= MIN_YEAR);
- if (next == dstMSecs)
- return ruleToData(rule, next, QTimeZone::DaylightTime);
- else
- return ruleToData(rule, next, QTimeZone::StandardTime);
+ if (next == maxMSecs())
+ return invalidData();
+
+ return ruleToData(rule, next, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime);
}
QByteArray QWinTimeZonePrivate::systemTimeZoneId() const
@@ -602,10 +629,10 @@ QByteArray QWinTimeZonePrivate::systemTimeZoneId() const
QByteArray olsenId;
// If we have a real country, then try get a specific match for that country
if (country != QLocale::AnyCountry)
- olsenId = windowsIdToDefaultOlsenId(windowsId, country);
+ olsenId = windowsIdToDefaultIanaId(windowsId, country);
// If we don't have a real country, or there wasn't a specific match, try the global default
if (olsenId.isEmpty()) {
- olsenId = windowsIdToDefaultOlsenId(windowsId);
+ olsenId = windowsIdToDefaultIanaId(windowsId);
// If no global default then probably an unknown Windows ID so return UTC
if (olsenId.isEmpty())
return QByteArrayLiteral("UTC");
@@ -617,7 +644,7 @@ QSet<QByteArray> QWinTimeZonePrivate::availableTimeZoneIds() const
{
QSet<QByteArray> set;
foreach (const QByteArray &winId, availableWindowsIds()) {
- foreach (const QByteArray &olsenId, windowsIdToOlsenIds(winId))
+ foreach (const QByteArray &olsenId, windowsIdToIanaIds(winId))
set << olsenId;
}
return set;
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index b9281c6915..4beb0f939c 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -572,7 +572,7 @@
Provided for compatibility with QList.
- \sa remove(int), QList::removeAt(int)
+ \sa remove(), QList::removeAt()
*/
/*! \fn int QVector::length() const
@@ -597,7 +597,7 @@
Provided for compatibility with QList.
- \sa takeFirst(), takeLast(), QList::takeAt(int)
+ \sa takeFirst(), takeLast(), QList::takeAt()
*/
/*! \fn void QVector::removeFirst()
@@ -621,6 +621,7 @@
*/
/*! \fn T QVector::takeFirst()
+ \since 5.1
Removes the first item in the vector and returns it. This function
assumes the vector is not empty. To avoid failure, call isEmpty()
@@ -630,6 +631,7 @@
*/
/*! \fn T QVector::takeLast()
+ \since 5.1
Removes the last item in the list and returns it. This function
assumes the vector is not empty. To avoid failure, call isEmpty()
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 553797a22f..5de2364fe2 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -14,6 +14,7 @@ HEADERS += \
tools/qcommandlineoption.h \
tools/qcommandlineparser.h \
tools/qcollator.h \
+ tools/qcollator_p.h \
tools/qcontainerfwd.h \
tools/qcryptographichash.h \
tools/qdatetime.h \
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 75ccea94e0..2a26c2ede4 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -41,13 +41,6 @@
#include "QtCore/qxmlstream.h"
-#if defined(QT_BUILD_XML_LIB) && defined(Q_OS_MAC64)
-// No need to define this in the 64-bit Mac libraries.
-// Since Qt 4.4 and previous weren't supported in 64-bit, there are
-// no QXmlStream* symbols to keep compatibility with
-# define QT_NO_XMLSTREAM
-#endif
-
#ifndef QT_NO_XMLSTREAM
#include "qxmlutils_p.h"
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
index 77e456df53..75a2385d57 100644
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ b/src/gui/Qt5GuiConfigExtras.cmake.in
@@ -54,12 +54,17 @@ set(Qt5Gui_OPENGL_LIBRARIES Qt5::Gui_GLESv2)
!!IF !isEmpty(CMAKE_GL_INCDIRS)
+set(_GL_INCDIRS $$CMAKE_GL_INCDIRS)
find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME
- PATHS $$CMAKE_GL_INCDIRS
- NO_DEFAULT_PATH)
+ PATHS ${_GL_INCDIRS}
+!!IF !mac
+ NO_DEFAULT_PATH
+!!ENDIF
+)
if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
- message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"$$CMAKE_GL_INCDIRS\\\".\")
+ message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"${_GL_INCDIRS}\\\".\")
endif()
+unset(_GL_INCDIRS)
_qt5_Gui_check_file_exists(${_qt5gui_OPENGL_INCLUDE_DIR})
@@ -72,13 +77,30 @@ unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)
macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
set(Qt5Gui_${Name}_LIBRARIES)
+!!IF !mac
set(Qt5Gui_${Name}_INCLUDE_DIRS ${IncDirs})
+!!ELSE
+ foreach(_dir ${IncDirs})
+ if (EXISTS ${_dir})
+ list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_dir})
+ else()
+ find_path(_actual_dir ${_dir}) # Look in sdk directories
+ if (_actual_dir)
+ list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_actual_dir})
+ endif()
+ unset(_actual_dir CACHE)
+ endif()
+ endforeach()
+!!ENDIF
foreach(_lib ${Libs})
string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib})
if (NOT TARGET Qt5::Gui_${_cmake_lib_name})
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}
!!IF !isEmpty(CROSS_COMPILE)
- PATHS \"${LibDir}\" NO_DEFAULT_PATH
+ PATHS \"${LibDir}\"
+!!IF !mac
+ NO_DEFAULT_PATH
+!!ENDIF
!!ENDIF
)
!!IF mac
@@ -92,7 +114,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
endif()
endif()
add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
- set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${IncDirs})
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS})
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
@@ -104,7 +126,11 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d
- PATHS \"${LibDir}\" NO_DEFAULT_PATH)
+ PATHS \"${LibDir}\"
+!!IF !mac
+ NO_DEFAULT_PATH
+!!ENDIF
+ )
if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG)
set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
_qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
@@ -118,7 +144,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
endforeach()
if (NOT CMAKE_CROSSCOMPILING)
- foreach(_dir ${IncDirs})
+ foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS})
_qt5_Gui_check_file_exists(${_dir})
endforeach()
endif()
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index 9453ac20d0..615323dbec 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -4,7 +4,6 @@ contains(QT_CONFIG, accessibility) {
HEADERS += \
accessible/qaccessible.h \
accessible/qaccessiblecache_p.h \
- accessible/qaccessible2_p.h \
accessible/qaccessibleobject.h \
accessible/qaccessibleplugin.h \
accessible/qplatformaccessibility.h
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index b8771ec583..5d28512697 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1270,8 +1270,16 @@ QAccessibleInterface::~QAccessibleInterface()
/*! \fn QAccessibleEvent::QAccessibleEvent(QObject *object, QAccessible::Event type)
Constructs a QAccessibleEvent to notify that \a object has changed.
- The event \a type explains what changed.
- */
+ The event \a type describes what changed.
+*/
+
+/*! \fn QAccessibleEvent::QAccessibleEvent(QAccessibleInterface *interface, QAccessible::Event type)
+
+ Constructs a QAccessibleEvent to notify that \a interface has changed.
+ The event \a type describes what changed.
+ Use this function if you already have a QAccessibleInterface or no QObject, otherwise consider
+ the overload taking a \l QObject parameter as it might be cheaper.
+*/
/*! \fn QAccessibleEvent::~QAccessibleEvent()
Destroys the event.
@@ -1293,6 +1301,22 @@ QAccessibleInterface::~QAccessibleInterface()
Returns the child index.
*/
+/*!
+ \internal
+ Returns the uniqueId of the QAccessibleInterface represented by this event.
+
+ In case the object() function returns 0 this is the only way to access the
+ interface.
+*/
+QAccessible::Id QAccessibleEvent::uniqueId() const
+{
+ if (!m_object)
+ return m_uniqueId;
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
+ if (m_child != -1)
+ iface = iface->child(m_child);
+ return QAccessible::uniqueId(iface);
+}
/*!
\class QAccessibleValueChangeEvent
@@ -1530,6 +1554,9 @@ QAccessibleInterface::~QAccessibleInterface()
*/
QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
{
+ if (m_object == 0)
+ return QAccessible::accessibleInterface(m_uniqueId);
+
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
if (!iface || !iface->isValid()) {
static bool hasWarned = false;
@@ -1681,9 +1708,13 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
d << "QAccessibleEvent(null)";
return d;
}
- d.nospace() << "QAccessibleEvent(object=" << hex << ev.object();
- d.nospace() << dec;
- d.nospace() << "child=" << ev.child();
+ d.nospace() << "QAccessibleEvent(";
+ if (ev.object()) {
+ d.nospace() << "object=" << hex << ev.object() << dec;
+ d.nospace() << "child=" << ev.child();
+ } else {
+ d.nospace() << "no object, uniqueId=" << ev.uniqueId();
+ }
d << " event=" << qAccessibleEventString(ev.type());
if (ev.type() == QAccessible::StateChanged) {
QAccessible::State changed = static_cast<const QAccessibleStateChangeEvent*>(&ev)->changedStates();
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index d5b0af550e..25ce161940 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -597,6 +597,7 @@ class Q_GUI_EXPORT QAccessibleEvent
{
Q_DISABLE_COPY(QAccessibleEvent)
public:
+
inline QAccessibleEvent(QObject *obj, QAccessible::Event typ)
: m_type(typ), m_object(obj), m_child(-1)
{
@@ -613,11 +614,27 @@ public:
Q_ASSERT(m_type != QAccessible::TableModelChanged);
}
+ inline QAccessibleEvent(QAccessibleInterface *iface, QAccessible::Event typ)
+ : m_type(typ), m_object(0)
+ {
+ Q_ASSERT(iface);
+ Q_ASSERT(m_type != QAccessible::ValueChanged);
+ Q_ASSERT(m_type != QAccessible::StateChanged);
+ Q_ASSERT(m_type != QAccessible::TextCaretMoved);
+ Q_ASSERT(m_type != QAccessible::TextSelectionChanged);
+ Q_ASSERT(m_type != QAccessible::TextInserted);
+ Q_ASSERT(m_type != QAccessible::TextRemoved);
+ Q_ASSERT(m_type != QAccessible::TextUpdated);
+ Q_ASSERT(m_type != QAccessible::TableModelChanged);
+ m_uniqueId = QAccessible::uniqueId(iface);
+ }
+
virtual ~QAccessibleEvent()
{}
QAccessible::Event type() const { return m_type; }
QObject *object() const { return m_object; }
+ QAccessible::Id uniqueId() const;
void setChild(int chld) { m_child = chld; }
int child() const { return m_child; }
@@ -627,7 +644,11 @@ public:
protected:
QAccessible::Event m_type;
QObject *m_object;
- int m_child;
+ union {
+ int m_child;
+ QAccessible::Id m_uniqueId;
+ };
+
};
class Q_GUI_EXPORT QAccessibleStateChangeEvent :public QAccessibleEvent
@@ -638,6 +659,11 @@ public:
{
m_type = QAccessible::StateChanged;
}
+ inline QAccessibleStateChangeEvent(QAccessibleInterface *iface, QAccessible::State state)
+ : QAccessibleEvent(iface, QAccessible::InvalidEvent), m_changedStates(state)
+ {
+ m_type = QAccessible::StateChanged;
+ }
QAccessible::State changedStates() const {
return m_changedStates;
@@ -657,6 +683,12 @@ public:
{
m_type = QAccessible::TextCaretMoved;
}
+ inline QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos)
+ : QAccessibleEvent(iface, QAccessible::InvalidEvent)
+ , m_cursorPosition(cursorPos)
+ {
+ m_type = QAccessible::TextCaretMoved;
+ }
void setCursorPosition(int position) { m_cursorPosition = position; }
int cursorPosition() const { return m_cursorPosition; }
@@ -675,6 +707,12 @@ public:
{
m_type = QAccessible::TextSelectionChanged;
}
+ inline QAccessibleTextSelectionEvent(QAccessibleInterface *iface, int start, int end)
+ : QAccessibleTextCursorEvent(iface, (start == -1) ? 0 : end)
+ , m_selectionStart(start), m_selectionEnd(end)
+ {
+ m_type = QAccessible::TextSelectionChanged;
+ }
void setSelection(int start, int end) {
m_selectionStart = start;
@@ -698,6 +736,12 @@ public:
{
m_type = QAccessible::TextInserted;
}
+ inline QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text)
+ : QAccessibleTextCursorEvent(iface, position + text.length())
+ , m_position(position), m_text(text)
+ {
+ m_type = QAccessible::TextInserted;
+ }
QString textInserted() const {
return m_text;
@@ -720,6 +764,12 @@ public:
{
m_type = QAccessible::TextRemoved;
}
+ inline QAccessibleTextRemoveEvent(QAccessibleInterface *iface, int position, const QString &text)
+ : QAccessibleTextCursorEvent(iface, position)
+ , m_position(position), m_text(text)
+ {
+ m_type = QAccessible::TextRemoved;
+ }
QString textRemoved() const {
return m_text;
@@ -742,6 +792,12 @@ public:
{
m_type = QAccessible::TextUpdated;
}
+ inline QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText, const QString &text)
+ : QAccessibleTextCursorEvent(iface, position + text.length())
+ , m_position(position), m_oldText(oldText), m_text(text)
+ {
+ m_type = QAccessible::TextUpdated;
+ }
QString textRemoved() const {
return m_oldText;
}
@@ -767,6 +823,12 @@ public:
{
m_type = QAccessible::ValueChanged;
}
+ inline QAccessibleValueChangeEvent(QAccessibleInterface *iface, const QVariant &val)
+ : QAccessibleEvent(iface, QAccessible::InvalidEvent)
+ , m_value(val)
+ {
+ m_type = QAccessible::ValueChanged;
+ }
void setValue(const QVariant & val) { m_value= val; }
QVariant value() const { return m_value; }
@@ -794,6 +856,14 @@ public:
{
m_type = QAccessible::TableModelChanged;
}
+ inline QAccessibleTableModelChangeEvent(QAccessibleInterface *iface, ModelChangeType changeType)
+ : QAccessibleEvent(iface, QAccessible::InvalidEvent)
+ , m_modelChangeType(changeType)
+ , m_firstRow(-1), m_firstColumn(-1), m_lastRow(-1), m_lastColumn(-1)
+ {
+ m_type = QAccessible::TableModelChanged;
+ }
+
void setModelChangeType(ModelChangeType changeType) { m_modelChangeType = changeType; }
ModelChangeType modelChangeType() const { return m_modelChangeType; }
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index ed30172376..a963f55dc8 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtGui
description = Qt GUI Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtgui
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = gui
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 234742e6b9..0916826529 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2324,7 +2324,7 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl
static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied || src->format == QImage::Format_RGBA8888_Premultiplied);
- Q_ASSERT(dest->format == QImage::Format_ARGB32 || src->format == QImage::Format_RGBA8888);
+ Q_ASSERT(dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_RGBA8888);
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
@@ -3853,6 +3853,9 @@ static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QIma
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}, // Format_RGB444
{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB4444_Premultiplied
+ {
0,
0,
0,
@@ -3989,7 +3992,7 @@ void qGamma_correct_back_to_linear_cs(QImage *image)
The specified image conversion \a flags control how the image data
is handled during the conversion process.
- \sa {QImage#Image Format}{Image Format}
+ \sa {Image Formats}
*/
QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) const
{
diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp
index 04e3213c53..d67b22c31e 100644
--- a/src/gui/image/qimageiohandler.cpp
+++ b/src/gui/image/qimageiohandler.cpp
@@ -187,11 +187,15 @@
return this handler.
The json metadata file for the plugin needs to contain information
- about the image formats the plugins supports. For a jpeg plugin, this
- could e.g. look as follows:
+ about the image formats the plugins supports, together with the
+ corresponding MIME types (one for each format). For a jpeg plugin, this
+ could, for example, look as follows:
\code
- { "Keys": [ "jpg", "jpeg" ] }
+ {
+ "Keys": [ "jpg", "jpeg" ],
+ "MimeTypes": [ "image/jpeg", "image/jpeg" ]
+ }
\endcode
Different plugins can support different capabilities. For example,
@@ -537,23 +541,33 @@ QImageIOPlugin::~QImageIOPlugin()
/*! \fn QImageIOPlugin::capabilities(QIODevice *device, const QByteArray &format) const
- Returns the capabilities on the plugin, based on the data in \a
- device and the format \a format. For example, if the
- QImageIOHandler supports the BMP format, and the data in the
- device starts with the characters "BM", this function should
- return \l CanRead. If \a format is "bmp" and the handler supports
- both reading and writing, this function should return \l CanRead |
- \l CanWrite.
+ Returns the capabilities of the plugin, based on the data in \a
+ device and the format \a format. If \a device is \c 0, it should
+ simply report whether the format can be read or written. Otherwise,
+ it should attempt to determine whether the given format (or any
+ format supported by the plugin if \a format is empty) can be read
+ from or written to \a device. It should do this without changing
+ the state of \a device (typically by using QIODevice::peek()).
+
+ For example, if the QImageIOPlugin supports the BMP format, \a format
+ is either empty or \c "bmp", and the data in the device starts with the
+ characters \c "BM", this function should return \l CanRead. If \a format
+ is \c "bmp", \a device is \c 0 and the handler supports both reading and
+ writing, this function should return \l CanRead | \l CanWrite.
+
+ Format names are always given in lower case.
*/
/*!
\fn QImageIOHandler *QImageIOPlugin::create(QIODevice *device, const QByteArray &format) const
Creates and returns a QImageIOHandler subclass, with \a device
- and \a format set. The \a format must come from the list returned by keys().
- Format names are case sensitive.
+ and \a format set. The \a format must come from the values listed
+ in the \c "Keys" entry in the plugin metadata, or be empty. If it is
+ empty, the data in \a device must have been recognized by the
+ capabilities() method (with a likewise empty format).
- \sa keys()
+ Format names are always given in lower case.
*/
#endif // QT_NO_IMAGEFORMATPLUGIN
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index e4065724be..900093b51b 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -772,7 +772,9 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
QList<QByteArray> QImageWriter::supportedMimeTypes()
{
QSet<QByteArray> mimeTypes;
+#ifndef QT_NO_IMAGEFORMAT_BMP
mimeTypes << "image/bmp";
+#endif
#ifndef QT_NO_IMAGEFORMAT_PPM
mimeTypes << "image/x-portable-bitmap";
mimeTypes << "image/x-portable-graymap";
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 5f51358eb2..a620d34553 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
static bool qt_pixmap_thread_test()
{
if (!QCoreApplication::instance()) {
- qFatal("QPixmap: Must construct a QApplication before a QPaintDevice");
+ qFatal("QPixmap: Must construct a QGuiApplication before a QPixmap");
return false;
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 816419d155..ae63b8bc32 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -118,7 +118,7 @@ QInputEvent::~QInputEvent()
Returns the keyboard modifier flags that existed immediately
before the event occurred.
- \sa QApplication::keyboardModifiers()
+ \sa QGuiApplication::keyboardModifiers()
*/
/*! \fn void QInputEvent::setModifiers(Qt::KeyboardModifiers modifiers)
@@ -331,7 +331,7 @@ Qt::MouseEventSource QMouseEvent::source() const
Returns the position of the mouse cursor as a QPointF, relative to the
screen that received the event.
- \sa x(), y(), pos(), localPos(), screenPos()
+ \sa x(), y(), pos(), localPos(), windowPos()
*/
/*!
@@ -1023,7 +1023,7 @@ QKeyEvent::~QKeyEvent()
confuse it by pressing both \uicontrol{Shift} keys simultaneously and
releasing one of them, for example.
- \sa QApplication::keyboardModifiers()
+ \sa QGuiApplication::keyboardModifiers()
*/
Qt::KeyboardModifiers QKeyEvent::modifiers() const
@@ -1375,7 +1375,7 @@ QResizeEvent::~QResizeEvent()
signal when they are deleted.
If the last top-level window is closed, the
- QApplication::lastWindowClosed() signal is emitted.
+ QGuiApplication::lastWindowClosed() signal is emitted.
The isAccepted() function returns \c true if the event's receiver has
agreed to close the widget; call accept() to agree to close the
@@ -1384,7 +1384,7 @@ QResizeEvent::~QResizeEvent()
\sa QWidget::close(), QWidget::hide(), QObject::destroyed(),
QCoreApplication::exec(), QCoreApplication::quit(),
- QApplication::lastWindowClosed()
+ QGuiApplication::lastWindowClosed()
*/
/*!
@@ -2694,9 +2694,8 @@ QDragEnterEvent::~QDragEnterEvent()
is within its boundaries, if it accepts
\l{QWidget::setAcceptDrops()}{drop events} and \l
{QWidget::dragEnterEvent()}{enter events}. The widget should
- examine the event to see what kind of data it
- \l{QDragMoveEvent::provides()}{provides}, and call the accept()
- function to accept the drop if appropriate.
+ examine the event to see what kind of \l{mimeData()}{data} it
+ provides, and call the accept() function to accept the drop if appropriate.
The rectangle supplied by the answerRect() function can be used to restrict
drops to certain parts of the widget. For example, we can check whether the
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index db655bd2ad..9f95f2c234 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1672,41 +1672,36 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
if (e->nullWindow
-#ifdef Q_OS_ANDROID
- || (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back) || e->key == Qt::Key_Menu
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ || e->key == Qt::Key_Back || e->key == Qt::Key_Menu
#endif
) {
window = QGuiApplication::focusWindow();
}
- if (!window
-#ifdef Q_OS_ANDROID
- && e->keyType != QEvent::KeyRelease && e->key != Qt::Key_Back
-#endif
- ) {
- return;
- }
- if (window && window->d_func()->blockedByModalWindow) {
- // a modal window is blocking this window, don't allow key events through
- return;
- }
QKeyEvent ev(e->keyType, e->key, e->modifiers,
e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
e->unicode, e->repeat, e->repeatCount);
ev.setTimestamp(e->timestamp);
-#ifdef Q_OS_ANDROID
- if (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back) {
- if (!window) {
+ // only deliver key events when we have a window, and no modal window is blocking this window
+
+ if (window && !window->d_func()->blockedByModalWindow)
+ QGuiApplication::sendSpontaneousEvent(window, &ev);
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
+ else
+ ev.setAccepted(false);
+
+ static bool backKeyPressAccepted = false;
+ if (e->keyType == QEvent::KeyPress) {
+ backKeyPressAccepted = e->key == Qt::Key_Back && ev.isAccepted();
+ } else if (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back && !backKeyPressAccepted && !ev.isAccepted()) {
+ if (!window)
qApp->quit();
- } else {
- QGuiApplication::sendEvent(window, &ev);
- if (!ev.isAccepted() && e->key == Qt::Key_Back)
- QWindowSystemInterface::handleCloseEvent(window);
- }
- } else
+ else
+ QWindowSystemInterface::handleCloseEvent(window);
+ }
#endif
- QGuiApplication::sendSpontaneousEvent(window, &ev);
}
void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e)
@@ -1834,33 +1829,33 @@ void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePr
return;
QRect newRect = e->newGeometry;
- QRect cr = window->d_func()->geometry;
+ QRect oldRect = e->oldGeometry.isNull() ? window->d_func()->geometry : e->oldGeometry;
- bool isResize = cr.size() != newRect.size();
- bool isMove = cr.topLeft() != newRect.topLeft();
+ bool isResize = oldRect.size() != newRect.size();
+ bool isMove = oldRect.topLeft() != newRect.topLeft();
window->d_func()->geometry = newRect;
if (isResize || window->d_func()->resizeEventPending) {
- QResizeEvent e(newRect.size(), cr.size());
+ QResizeEvent e(newRect.size(), oldRect.size());
QGuiApplication::sendSpontaneousEvent(window, &e);
window->d_func()->resizeEventPending = false;
- if (cr.width() != newRect.width())
+ if (oldRect.width() != newRect.width())
window->widthChanged(newRect.width());
- if (cr.height() != newRect.height())
+ if (oldRect.height() != newRect.height())
window->heightChanged(newRect.height());
}
if (isMove) {
//### frame geometry
- QMoveEvent e(newRect.topLeft(), cr.topLeft());
+ QMoveEvent e(newRect.topLeft(), oldRect.topLeft());
QGuiApplication::sendSpontaneousEvent(window, &e);
- if (cr.x() != newRect.x())
+ if (oldRect.x() != newRect.x())
window->xChanged(newRect.x());
- if (cr.y() != newRect.y())
+ if (oldRect.y() != newRect.y())
window->yChanged(newRect.y());
}
}
@@ -2813,6 +2808,27 @@ bool QGuiApplication::isSavingSession() const
return d->is_saving_session;
}
+/*!
+ \since 5.2
+
+ Function that can be used to sync Qt state with the Window Systems state.
+
+ This function will first empty Qts events by calling QCoreApplication::processEvents(),
+ then the platform plugin will sync up with the windowsystem, and finally Qts events
+ will be delived by another call to QCoreApplication::processEvents();
+
+ This function is timeconsuming and its use is discouraged.
+*/
+void QGuiApplication::sync()
+{
+ QCoreApplication::processEvents();
+ if (QGuiApplicationPrivate::platform_integration
+ && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) {
+ QGuiApplicationPrivate::platform_integration->sync();
+ QCoreApplication::processEvents();
+ }
+}
+
void QGuiApplicationPrivate::commitData()
{
Q_Q(QGuiApplication);
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index bd42f18418..0089d48fa6 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -155,6 +155,7 @@ public:
bool isSavingSession() const;
#endif
+ static void sync();
Q_SIGNALS:
void fontDatabaseChanged();
void screenAdded(QScreen *screen);
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index eac0d4b0a6..3751660500 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -69,6 +69,7 @@ struct Q_AUTOTEST_EXPORT QKeyBinding
class Q_AUTOTEST_EXPORT QKeySequencePrivate
{
public:
+ enum { MaxKeyCount = 4 }; // used in QKeySequenceEdit
inline QKeySequencePrivate() : ref(1)
{
key[0] = key[1] = key[2] = key[3] = 0;
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index ab782fac34..39dd2a2dfa 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -56,9 +56,7 @@
#include <private/qopenglextensions_p.h>
#include <private/qopenglversionfunctionsfactory_p.h>
-#if !defined(QT_OPENGL_ES_2)
#include <private/qopengltexturehelper_p.h>
-#endif
#include <QDebug>
@@ -274,7 +272,7 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
or OpenGL ES 1.x.
For more information about the OpenGL API, refer to the official
- \l{OpenGL documentation}.
+ \l{http://www.opengl.org}{OpenGL documentation}.
For an example of how to use QOpenGLContext see the
\l{OpenGL Window Example}{OpenGL Window} example.
@@ -527,10 +525,8 @@ void QOpenGLContext::destroy()
d->versionFunctions.clear();
qDeleteAll(d->versionFunctionsBackend);
d->versionFunctionsBackend.clear();
-#if !defined(QT_OPENGL_ES_2)
delete d->textureFunctions;
d->textureFunctions = 0;
-#endif
}
/*!
@@ -591,6 +587,8 @@ QOpenGLFunctions *QOpenGLContext::functions() const
/*!
\fn T *QOpenGLContext::versionFunctions() const
+ \overload versionFunctions()
+
Returns a pointer to an object that provides access to all functions for
the version and profile of this context. Before using any of the functions
they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions().
@@ -640,8 +638,6 @@ QOpenGLFunctions *QOpenGLContext::functions() const
Usually one would use the template version of this function to automatically
have the result cast to the correct type.
-
- \sa T *QOpenGLContext::versionFunctions()
*/
QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const
{
@@ -984,7 +980,6 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v)
d->versionFunctionsBackend.remove(v);
}
-#if !defined(QT_OPENGL_ES_2)
/*!
\internal
*/
@@ -1002,7 +997,6 @@ void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs)
Q_D(QOpenGLContext);
d->textureFunctions = textureFuncs;
}
-#endif
/*!
\class QOpenGLContextGroup
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 9756be30df..ce34a2d5a5 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -221,10 +221,8 @@ private:
QOpenGLVersionFunctionsBackend *backend);
void removeFunctionsBackend(const QOpenGLVersionStatus &v);
-#if !defined(QT_OPENGL_ES_2)
QOpenGLTextureHelper* textureFunctions() const;
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
-#endif
void destroy();
};
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index fe5db27117..5ddd718e69 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -693,6 +693,48 @@ QMessageDialogOptions::StandardButtons QMessageDialogOptions::standardButtons()
return d->buttons;
}
+QMessageDialogOptions::ButtonRole QMessageDialogOptions::buttonRole(QMessageDialogOptions::StandardButton button)
+{
+ switch (button) {
+ case Ok:
+ case Save:
+ case Open:
+ case SaveAll:
+ case Retry:
+ case Ignore:
+ return AcceptRole;
+
+ case Cancel:
+ case Close:
+ case Abort:
+ return RejectRole;
+
+ case Discard:
+ return DestructiveRole;
+
+ case Help:
+ return HelpRole;
+
+ case Apply:
+ return ApplyRole;
+
+ case Yes:
+ case YesToAll:
+ return YesRole;
+
+ case No:
+ case NoToAll:
+ return NoRole;
+
+ case RestoreDefaults:
+ case Reset:
+ return ResetRole;
+
+ default:
+ break;
+ }
+ return InvalidRole;
+}
/*!
\class QPlatformMessageDialogHelper
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index ad818c8644..9eeb0a6da4 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -361,6 +361,21 @@ public:
Q_DECLARE_FLAGS(StandardButtons, StandardButton)
+ enum ButtonRole {
+ InvalidRole = -1,
+ AcceptRole,
+ RejectRole,
+ DestructiveRole,
+ ActionRole,
+ HelpRole,
+ YesRole,
+ NoRole,
+ ResetRole,
+ ApplyRole,
+
+ NRoles
+ };
+
QMessageDialogOptions();
QMessageDialogOptions(const QMessageDialogOptions &rhs);
QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs);
@@ -386,6 +401,8 @@ public:
void setStandardButtons(StandardButtons buttons);
StandardButtons standardButtons() const;
+ static ButtonRole buttonRole(StandardButton button);
+
private:
QSharedDataPointer<QMessageDialogOptionsPrivate> d;
};
@@ -400,7 +417,7 @@ public:
void setOptions(const QSharedPointer<QMessageDialogOptions> &options);
Q_SIGNALS:
- void clicked(QMessageDialogOptions::StandardButton button);
+ void clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role);
private:
QSharedPointer<QMessageDialogOptions> m_options;
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 49ac7836cb..26aaf931b3 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -343,6 +343,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::StartDragTime);
case ShowIsFullScreen:
return false;
+ case ShowIsMaximized:
+ return false;
case PasswordMaskDelay:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::PasswordMaskDelay);
case PasswordMaskCharacter:
@@ -362,6 +364,20 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return 0;
}
+Qt::WindowState QPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const
+{
+ // Leave popup-windows as is
+ if (flags & Qt::Popup & ~Qt::Window)
+ return Qt::WindowNoState;
+
+ if (styleHint(QPlatformIntegration::ShowIsFullScreen).toBool())
+ return Qt::WindowFullScreen;
+ else if (styleHint(QPlatformIntegration::ShowIsMaximized).toBool())
+ return Qt::WindowMaximized;
+
+ return Qt::WindowNoState;
+}
+
Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const
{
return QGuiApplication::keyboardModifiers();
@@ -435,4 +451,19 @@ QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(cons
}
#endif
+/*!
+ \since 5.2
+
+ Function to sync the platform integrations state with the window system.
+
+ This is often implemented as a roundtrip from the platformintegration to the window system.
+
+ This function should not call QWindowSystemInterface::flushWindowSystemEvents() or
+ QCoreApplication::processEvents()
+*/
+void QPlatformIntegration::sync()
+{
+
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index d3189f8641..580fc15233 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -94,7 +94,8 @@ public:
ForeignWindows,
NonFullScreenWindows,
NativeWidgets,
- WindowManagement
+ WindowManagement,
+ SyncState
};
virtual ~QPlatformIntegration() { }
@@ -146,10 +147,12 @@ public:
UseRtlExtensions,
SynthesizeMouseFromTouchEvents,
PasswordMaskCharacter,
- SetFocusOnTouchRelease
+ SetFocusOnTouchRelease,
+ ShowIsMaximized
};
virtual QVariant styleHint(StyleHint hint) const;
+ virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const;
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
virtual QList<int> possibleKeys(const QKeyEvent *) const;
@@ -162,6 +165,8 @@ public:
#ifndef QT_NO_SESSIONMANAGER
virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const;
#endif
+
+ virtual void sync();
protected:
void screenAdded(QPlatformScreen *screen);
};
diff --git a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp
index 5d7ff7864d..c4cec40a10 100644
--- a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp
+++ b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp
@@ -130,7 +130,7 @@ QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon()
const QIcon &icon, MessageIcon iconType, int secs)
Shows a balloon message for the entry with the given \a title, message \a msg and \a icon for
the time specified in \a secs. \a iconType is used as a hint for the implementing platform.
- \sa QSystemTrayIcon::showMessage
+ \sa QSystemTrayIcon::showMessage()
*/
/*!
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 562df1c913..1844232efe 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -50,6 +50,7 @@
#include <qtextformat.h>
#include <private/qiconloader_p.h>
#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
QT_BEGIN_NAMESPACE
@@ -399,7 +400,32 @@ QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
{
- return QPlatformTheme::defaultThemeHint(hint);
+ // For theme hints which mirror platform integration style hints, query
+ // the platform integration. The base QPlatformIntegration::styleHint()
+ // function will in turn query QPlatformTheme::defaultThemeHint() if there
+ // is no custom value.
+ switch (hint) {
+ case QPlatformTheme::CursorFlashTime:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime);
+ case QPlatformTheme::KeyboardInputInterval:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval);
+ case QPlatformTheme::KeyboardAutoRepeatRate:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate);
+ case QPlatformTheme::MouseDoubleClickInterval:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval);
+ case QPlatformTheme::StartDragDistance:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance);
+ case QPlatformTheme::StartDragTime:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime);
+ case QPlatformTheme::StartDragVelocity:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity);
+ case QPlatformTheme::PasswordMaskDelay:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay);
+ case QPlatformTheme::PasswordMaskCharacter:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter);
+ default:
+ return QPlatformTheme::defaultThemeHint(hint);
+ }
}
QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 1f9183db44..954d47f18c 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -487,6 +487,27 @@ bool QPlatformWindow::isAlertState() const
return false;
}
+// Return the effective screen for the initial geometry of a window. In a
+// multimonitor-setup, try to find the right screen by checking the transient
+// parent or the mouse cursor for parentless windows (cf QTBUG-34204,
+// QDialog::adjustPosition()).
+static inline const QScreen *effectiveScreen(const QWindow *window)
+{
+ if (!window)
+ return QGuiApplication::primaryScreen();
+ const QScreen *screen = window->screen();
+ if (!screen)
+ return QGuiApplication::primaryScreen();
+ const QList<QScreen *> siblings = screen->virtualSiblings();
+ if (siblings.size() > 1) {
+ const QPoint referencePoint = window->transientParent() ? window->transientParent()->geometry().center() : QCursor::pos();
+ foreach (const QScreen *sibling, siblings)
+ if (sibling->geometry().contains(referencePoint))
+ return sibling;
+ }
+ return screen;
+}
+
/*!
Helper function to get initial geometry on windowing systems which do not
do smart positioning and also do not provide a means of centering a
@@ -511,8 +532,8 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w,
}
if (w->isTopLevel() && qt_window_private(const_cast<QWindow*>(w))->positionAutomatic
&& w->type() != Qt::Popup) {
- if (const QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w)) {
- const QRect availableGeometry = platformScreen->availableGeometry();
+ if (const QScreen *screen = effectiveScreen(w)) {
+ const QRect availableGeometry = screen->availableGeometry();
// Center unless the geometry ( + unknown window frame) is too large for the screen).
if (rect.height() < (availableGeometry.height() * 8) / 9
&& rect.width() < (availableGeometry.width() * 8) / 9) {
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 7899e2540b..8d751d8615 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -270,6 +270,9 @@ int QStyleHints::cursorFlashTime() const
Returns \c true if the platform defaults to windows being fullscreen,
otherwise \c false.
+ \note The platform may still choose to show certain windows non-fullscreen,
+ such as popups or dialogs. This method only returns the default behavior.
+
\sa QWindow::show()
*/
bool QStyleHints::showIsFullScreen() const
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index b8fe55adc0..2b6cb2d949 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -468,7 +468,7 @@ bool QSurfaceFormat::hasAlpha() const
/*!
Set the preferred stencil buffer size to \a size bits.
- \sa stencilBufferSize(), setStencil(), stencil()
+ \sa stencilBufferSize()
*/
void QSurfaceFormat::setStencilBufferSize(int size)
{
@@ -481,7 +481,7 @@ void QSurfaceFormat::setStencilBufferSize(int size)
/*!
Returns the stencil buffer size in bits.
- \sa stencil(), setStencil(), setStencilBufferSize()
+ \sa setStencilBufferSize()
*/
int QSurfaceFormat::stencilBufferSize() const
{
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 13218fa178..2e1d8f9976 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -367,6 +367,10 @@ void QWindowPrivate::setScreen(QScreen *newScreen, bool recreate)
}
}
+void QWindowPrivate::clearFocusObject()
+{
+}
+
/*!
Sets the \a surfaceType of the window.
@@ -982,8 +986,13 @@ Qt::ScreenOrientation QWindow::contentOrientation() const
qreal QWindow::devicePixelRatio() const
{
Q_D(const QWindow);
+
+ // If there is no platform window, do the second best thing and
+ // return the app global devicePixelRatio. This is the highest
+ // devicePixelRatio found on the system screens, and will be
+ // correct for single-display systems (a very common case).
if (!d->platformWindow)
- return 1.0;
+ return qApp->devicePixelRatio();
return d->platformWindow->devicePixelRatio();
}
@@ -1642,17 +1651,18 @@ QObject *QWindow::focusObject() const
/*!
Shows the window.
- This equivalent to calling showFullScreen() or showNormal(), depending
- on whether the platform defaults to windows being fullscreen or not, and
- whether the window is a popup.
+ This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(),
+ depending on the platform's default behavior for the window type and flags.
- \sa showFullScreen(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags()
+ \sa showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags()
*/
void QWindow::show()
{
- bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window;
- if (!isPopup && qApp->styleHints()->showIsFullScreen())
+ Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(d_func()->windowFlags);
+ if (defaultState == Qt::WindowFullScreen)
showFullScreen();
+ else if (defaultState == Qt::WindowMaximized)
+ showMaximized();
else
showNormal();
}
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index f43c1ea8ec..8d8fca3ce6 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -129,6 +129,8 @@ public:
void setScreen(QScreen *newScreen, bool recreate);
+ virtual void clearFocusObject();
+
QWindow::SurfaceType surfaceType;
Qt::WindowFlags windowFlags;
QWindow *parentWindow;
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 07717bb63d..49ff8bcb0d 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -141,9 +141,12 @@ void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect)
+/*!
+ If \a oldRect is null, Qt will use the previously reported geometry instead.
+ */
+void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect, const QRect &oldRect)
{
- QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect);
+ QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect, oldRect);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 0c3494a46d..71feb1bcb7 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -138,7 +138,7 @@ public:
static void handleTouchCancelEvent(QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
- static void handleGeometryChange(QWindow *w, const QRect &newRect);
+ static void handleGeometryChange(QWindow *w, const QRect &newRect, const QRect &oldRect = QRect());
static void handleCloseEvent(QWindow *w, bool *accepted = 0);
static void handleEnterEvent(QWindow *w, const QPointF &local = QPointF(), const QPointF& global = QPointF());
static void handleLeaveEvent(QWindow *w);
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index f0398ffc51..367b0ac11d 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -117,11 +117,12 @@ public:
class GeometryChangeEvent : public WindowSystemEvent {
public:
- GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry)
- : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry)
+ GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry, const QRect &oldGeometry)
+ : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry), oldGeometry(oldGeometry)
{ }
QPointer<QWindow> tlw;
QRect newGeometry;
+ QRect oldGeometry;
};
class EnterEvent : public WindowSystemEvent {
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index 8212c0981f..d249b855f5 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -53,6 +53,17 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglvertexarrayobject.cpp \
opengl/qopengldebug.cpp
+ !wince* {
+ HEADERS += opengl/qopengltexture.h \
+ opengl/qopengltexture_p.h \
+ opengl/qopengltexturehelper_p.h \
+ opengl/qopenglpixeltransferoptions.h
+
+ SOURCES += opengl/qopengltexture.cpp \
+ opengl/qopengltexturehelper.cpp \
+ opengl/qopenglpixeltransferoptions.cpp
+ }
+
!contains(QT_CONFIG, opengles2) {
HEADERS += opengl/qopenglfunctions_1_0.h \
opengl/qopenglfunctions_1_1.h \
@@ -77,11 +88,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglfunctions_4_2_compatibility.h \
opengl/qopenglfunctions_4_3_compatibility.h \
opengl/qopenglqueryhelper_p.h \
- opengl/qopengltimerquery.h \
- opengl/qopengltexture.h \
- opengl/qopengltexture_p.h \
- opengl/qopengltexturehelper_p.h \
- opengl/qopenglpixeltransferoptions.h
+ opengl/qopengltimerquery.h
SOURCES += opengl/qopenglfunctions_1_0.cpp \
opengl/qopenglfunctions_1_1.cpp \
@@ -105,10 +112,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglfunctions_4_1_compatibility.cpp \
opengl/qopenglfunctions_4_2_compatibility.cpp \
opengl/qopenglfunctions_4_3_compatibility.cpp \
- opengl/qopengltimerquery.cpp \
- opengl/qopengltexture.cpp \
- opengl/qopengltexturehelper.cpp \
- opengl/qopenglpixeltransferoptions.cpp
+ opengl/qopengltimerquery.cpp
}
contains(QT_CONFIG, opengles2) {
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index a4ed74637c..0e5a1327b0 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -347,6 +347,9 @@ static int qt_gl_resolve_extensions()
{
int extensions = 0;
QOpenGLExtensionMatcher extensionMatcher;
+ if (extensionMatcher.match("GL_EXT_bgra"))
+ extensions |= QOpenGLExtensions::BGRATextureFormat;
+
#if defined(QT_OPENGL_ES)
if (extensionMatcher.match("GL_OES_mapbuffer"))
extensions |= QOpenGLExtensions::MapBuffer;
@@ -356,10 +359,9 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::ElementIndexUint;
if (extensionMatcher.match("GL_OES_depth24"))
extensions |= QOpenGLExtensions::Depth24;
-
- if (extensionMatcher.match("GL_EXT_bgra"))
+ // TODO: Consider matching GL_APPLE_texture_format_BGRA8888 as well, but it needs testing.
+ if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
-
#else
QSurfaceFormat format = QOpenGLContext::currentContext()->format();
extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer;
diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp
index b48e96cd98..9c4fbbe013 100644
--- a/src/gui/opengl/qopenglgradientcache.cpp
+++ b/src/gui/opengl/qopenglgradientcache.cpp
@@ -152,22 +152,6 @@ GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient
}
-// GL's expects pixels in RGBA (when using GL_RGBA), bin-endian (ABGR on x86).
-// Qt always stores in ARGB reguardless of the byte-order the mancine uses.
-static inline uint qtToGlColor(uint c)
-{
- uint o;
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- o = (c & 0xff00ff00) // alpha & green already in the right place
- | ((c >> 16) & 0x000000ff) // red
- | ((c << 16) & 0x00ff0000); // blue
-#else //Q_BIG_ENDIAN
- o = (c << 8)
- | ((c >> 24) & 0x000000ff);
-#endif // Q_BYTE_ORDER
- return o;
-}
-
//TODO: Let GL generate the texture using an FBO
void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const
{
@@ -184,7 +168,7 @@ void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient
uint current_color = ARGB_COMBINE_ALPHA(colors[0], alpha);
qreal incr = 1.0 / qreal(size);
qreal fpos = 1.5 * incr;
- colorTable[pos++] = qtToGlColor(PREMUL(current_color));
+ colorTable[pos++] = ARGB2RGBA(PREMUL(current_color));
while (fpos <= s.first().first) {
colorTable[pos] = colorTable[pos - 1];
@@ -205,9 +189,9 @@ void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient
int dist = int(256 * ((fpos - s[i].first) * delta));
int idist = 256 - dist;
if (colorInterpolation)
- colorTable[pos] = qtToGlColor(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));
+ colorTable[pos] = ARGB2RGBA(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));
else
- colorTable[pos] = qtToGlColor(PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)));
+ colorTable[pos] = ARGB2RGBA(PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)));
++pos;
fpos += incr;
}
@@ -216,7 +200,7 @@ void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient
Q_ASSERT(s.size() > 0);
- uint last_color = qtToGlColor(PREMUL(ARGB_COMBINE_ALPHA(colors[s.size() - 1], alpha)));
+ uint last_color = ARGB2RGBA(PREMUL(ARGB_COMBINE_ALPHA(colors[s.size() - 1], alpha)));
for (;pos < size; ++pos)
colorTable[pos] = last_color;
diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h
index 1a5d3f00e2..c150e8aff4 100644
--- a/src/gui/opengl/qopenglpixeltransferoptions.h
+++ b/src/gui/opengl/qopenglpixeltransferoptions.h
@@ -60,6 +60,14 @@ public:
QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &);
~QOpenGLPixelTransferOptions();
+#ifdef Q_COMPILER_RVALUE_REFS
+ QOpenGLPixelTransferOptions &operator=(QOpenGLPixelTransferOptions &&other)
+ { swap(other); return *this; }
+#endif
+
+ void swap(QOpenGLPixelTransferOptions &other)
+ { data.swap(other.data); }
+
void setAlignment(int alignment);
int alignment() const;
@@ -88,6 +96,8 @@ private:
QSharedDataPointer<QOpenGLPixelTransferOptionsData> data;
};
+Q_DECLARE_SHARED(QOpenGLPixelTransferOptions)
+
QT_END_NAMESPACE
#endif // QT_NO_OPENGL
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index d5a7399c18..e3fffe5a1c 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -50,6 +50,11 @@
QT_BEGIN_NAMESPACE
+//this is to work around GL_TEXTURE_WRAP_R_OES which also has 0x8072 as value
+#if !defined(GL_TEXTURE_WRAP_R)
+ #define GL_TEXTURE_WRAP_R 0x8072
+#endif
+
QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget,
QOpenGLTexture *qq)
: q_ptr(qq),
@@ -1255,6 +1260,13 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
\value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
\value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
\value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
+
+ \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (OpenGL ES 2 only and when OES_depth_texture is present)
+ \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only)
+ \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only)
+ \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only)
+ \value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only)
+ \value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)
*/
/*!
@@ -1289,6 +1301,10 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
\value BGRA_Integer Equivalent to GL_BGRA_INTEGER
\value Depth Equivalent to GL_DEPTH_COMPONENT
\value DepthStencil Equivalent to GL_DEPTH_STENCIL
+ \value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only)
+ \value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only)
+ \value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only)
+
*/
/*!
@@ -1303,6 +1319,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
\value Int32 Equivalent to GL_INT
\value UInt32 Equivalent to GL_UNSIGNED_INT
\value Float16 Equivalent to GL_HALF_FLOAT
+ \value Float16OES Equivalent to GL_HALF_FLOAT_OES
\value Float32 Equivalent to GL_FLOAT
\value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV
\value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV
@@ -1752,6 +1769,12 @@ void QOpenGLTexture::setFormat(TextureFormat format)
case D32:
case D32F:
case D32FS8X24:
+ case DepthFormat:
+ case AlphaFormat:
+ case RGBFormat:
+ case RGBAFormat:
+ case LuminanceFormat:
+ case LuminanceAlphaFormat:
d->formatClass = FormatClass_Unique;
break;
}
@@ -1825,7 +1848,7 @@ void QOpenGLTexture::setSize(int width, int height, int depth)
/*!
Returns the width of a 1D, 2D or 3D texture.
- \sa height(), depth(), setDimensions()
+ \sa height(), depth(), setSize()
*/
int QOpenGLTexture::width() const
{
@@ -1836,7 +1859,7 @@ int QOpenGLTexture::width() const
/*!
Returns the height of a 2D or 3D texture.
- \sa width(), depth(), setDimensions()
+ \sa width(), depth(), setSize()
*/
int QOpenGLTexture::height() const
{
@@ -1847,7 +1870,7 @@ int QOpenGLTexture::height() const
/*!
Returns the depth of a 3D texture.
- \sa width(), height(), setDimensions()
+ \sa width(), height(), setSize()
*/
int QOpenGLTexture::depth() const
{
@@ -1913,7 +1936,7 @@ int QOpenGLTexture::mipLevels() const
Returns the maximum number of mipmap levels that this texture
can have given the current dimensions.
- \sa setMipLevels(), mipLevels(), setDimensions()
+ \sa setMipLevels(), mipLevels(), setSize()
*/
int QOpenGLTexture::maximumMipLevels() const
{
@@ -2018,7 +2041,7 @@ void QOpenGLTexture::allocateStorage()
The texture format, dimensions, mipmap levels and array layers
cannot be altered once storage ihas been allocated.
- \sa allocateStorage(), setDimensions(), setMipLevels(), setLayers(), setFormat()
+ \sa allocateStorage(), setSize(), setMipLevels(), setLayers(), setFormat()
*/
bool QOpenGLTexture::isStorageAllocated() const
{
@@ -2242,6 +2265,7 @@ bool QOpenGLTexture::hasFeature(Feature feature)
bool supported = false;
switch (feature) {
+#if !defined(QT_OPENGL_ES_2)
case ImmutableMultisampleStorage:
case TextureBuffer:
case StencilTexturing:
@@ -2289,16 +2313,38 @@ bool QOpenGLTexture::hasFeature(Feature feature)
break;
}
+#else
+ case Texture3D:
+ supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"));
+ break;
+ case AnisotropicFiltering:
+ supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic"));
+ break;
+ case NPOTTextures:
+ case NPOTTextureRepeat:
+ supported = f.version() >= qMakePair(3,0);
+ if (!supported) {
+ supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot"));
+ if (!supported)
+ supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two"));
+ }
+ default:
+ break;
+ }
+#endif
+
return supported;
}
/*!
Sets the base mipmap level used for all texture lookups with this texture to \a baseLevel.
+ \note This function has no effect on Qt built for OpenGL ES 2.
\sa mipBaseLevel(), setMipMaxLevel(), setMipLevelRange()
*/
void QOpenGLTexture::setMipBaseLevel(int baseLevel)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2306,6 +2352,10 @@ void QOpenGLTexture::setMipBaseLevel(int baseLevel)
Q_ASSERT(baseLevel <= d->maxLevel);
d->baseLevel = baseLevel;
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel);
+#else
+ Q_UNUSED(baseLevel);
+ qWarning("QOpenGLTexture: Mipmap base level is not supported");
+#endif
}
/*!
@@ -2323,10 +2373,12 @@ int QOpenGLTexture::mipBaseLevel() const
/*!
Sets the maximum mipmap level used for all texture lookups with this texture to \a maxLevel.
+ \note This function has no effect on Qt built for OpenGL ES 2.
\sa mipMaxLevel(), setMipBaseLevel(), setMipLevelRange()
*/
void QOpenGLTexture::setMipMaxLevel(int maxLevel)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2334,6 +2386,10 @@ void QOpenGLTexture::setMipMaxLevel(int maxLevel)
Q_ASSERT(d->baseLevel <= maxLevel);
d->maxLevel = maxLevel;
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel);
+#else
+ Q_UNUSED(maxLevel);
+ qWarning("QOpenGLTexture: Mipmap max level is not supported");
+#endif
}
/*!
@@ -2351,10 +2407,12 @@ int QOpenGLTexture::mipMaxLevel() const
Sets the range of mipmap levels that can be used for texture lookups with this texture
to range from \a baseLevel to \a maxLevel.
+ \note This function has no effect on Qt built for OpenGL ES 2.
\sa setMipBaseLevel(), setMipMaxLevel(), mipLevelRange()
*/
void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->textureId);
@@ -2362,12 +2420,17 @@ void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel)
Q_ASSERT(baseLevel <= maxLevel);
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel);
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel);
+#else
+ Q_UNUSED(baseLevel);
+ Q_UNUSED(maxLevel);
+ qWarning("QOpenGLTexture: Mipmap level range is not supported");
+#endif
}
/*!
Returns the range of mipmap levels that can be used for texture lookups with this texture.
- \sa mipBaseLevel(), mipMaxLevel(), mipLevelRange()
+ \sa mipBaseLevel(), mipMaxLevel()
*/
QPair<int, int> QOpenGLTexture::mipLevelRange() const
{
@@ -2451,11 +2514,12 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel)
This function maps \a component to the output \a value.
+ \note This function has no effect on Mac and Qt built for OpenGL ES 2.
\sa swizzleMask()
*/
void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value)
{
-#if !defined(Q_OS_MAC)
+#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2467,9 +2531,9 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val
d->swizzleMask[component - SwizzleRed] = value;
d->texFuncs->glTextureParameteri(d->textureId, d->target, component, value);
#else
- qWarning("Texture swizzling is not supported");
Q_UNUSED(component);
Q_UNUSED(value);
+ qWarning("QOpenGLTexture: Texture swizzling is not supported");
#endif
}
@@ -2479,7 +2543,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val
void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
SwizzleValue b, SwizzleValue a)
{
-#if !defined(Q_OS_MAC)
+#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2495,11 +2559,11 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
d->swizzleMask[3] = a;
d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
#else
- qWarning("Texture swizzling is not supported");
Q_UNUSED(r);
Q_UNUSED(g);
Q_UNUSED(b);
Q_UNUSED(a);
+ qWarning("QOpenGLTexture: Texture swizzling is not supported");
#endif
}
@@ -2520,11 +2584,12 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon
shader will access the depth component as a single float, as normal. But when
the parameter is set to StencilMode?, the shader will access the stencil component.
+ \note This function has no effect on Mac and Qt built for OpenGL ES 2.
\sa depthStencilMode()
*/
void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
{
-#if !defined(Q_OS_MAC)
+#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2537,7 +2602,7 @@ void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode)
d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_DEPTH_STENCIL_TEXTURE_MODE, mode);
#else
Q_UNUSED(mode);
- qWarning("DepthStencil Mode is not supported");
+ qWarning("QOpenGLTexture: DepthStencil Mode is not supported");
#endif
}
@@ -2706,10 +2771,12 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire
/*!
Sets the border color of the texture to \a color.
+ \note This function has no effect on Mac and Qt built for OpenGL ES 2.
\sa borderColor()
*/
void QOpenGLTexture::setBorderColor(QColor color)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2723,6 +2790,10 @@ void QOpenGLTexture::setBorderColor(QColor color)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
+#else
+ Q_UNUSED(color);
+ qWarning("QOpenGLTexture: Border color is not supported");
+#endif
}
/*!
@@ -2730,6 +2801,7 @@ void QOpenGLTexture::setBorderColor(QColor color)
*/
void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2743,6 +2815,13 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
+#else
+ Q_UNUSED(r);
+ Q_UNUSED(g);
+ Q_UNUSED(b);
+ Q_UNUSED(a);
+ qWarning("QOpenGLTexture: Border color is not supported");
+#endif
}
/*!
@@ -2750,6 +2829,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a)
*/
void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2763,6 +2843,13 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
+#else
+ Q_UNUSED(r);
+ Q_UNUSED(g);
+ Q_UNUSED(b);
+ Q_UNUSED(a);
+ qWarning("QOpenGLTexture: Border color is not supported");
+#endif
// TODO Handle case of using glTextureParameterIiv() based on format
}
@@ -2772,6 +2859,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a)
*/
void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2785,6 +2873,13 @@ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a)
for (int i = 0; i < 4; ++i)
d->borderColor.append(QVariant(values[i]));
d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values);
+#else
+ Q_UNUSED(r);
+ Q_UNUSED(g);
+ Q_UNUSED(b);
+ Q_UNUSED(a);
+ qWarning("QOpenGLTexture: Border color is not supported");
+#endif
// TODO Handle case of using glTextureParameterIuiv() based on format
}
@@ -2862,10 +2957,12 @@ void QOpenGLTexture::borderColor(unsigned int *border) const
Sets the minimum level of detail to \a value. This limits the selection of highest
resolution mipmap (lowest mipmap level). The default value is -1000.
+ \note This function has no effect on Qt built for OpenGL ES 2.
\sa minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange()
*/
void QOpenGLTexture::setMinimumLevelOfDetail(float value)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2873,6 +2970,10 @@ void QOpenGLTexture::setMinimumLevelOfDetail(float value)
Q_ASSERT(value < d->maxLevelOfDetail);
d->minLevelOfDetail = value;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, value);
+#else
+ Q_UNUSED(value);
+ qWarning("QOpenGLTexture: Detail level is not supported");
+#endif
}
/*!
@@ -2890,10 +2991,12 @@ float QOpenGLTexture::minimumLevelOfDetail() const
Sets the maximum level of detail to \a value. This limits the selection of lowest
resolution mipmap (highest mipmap level). The default value is 1000.
+ \note This function has no effect on Qt built for OpenGL ES 2.
\sa maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange()
*/
void QOpenGLTexture::setMaximumLevelOfDetail(float value)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2901,6 +3004,10 @@ void QOpenGLTexture::setMaximumLevelOfDetail(float value)
Q_ASSERT(value > d->minLevelOfDetail);
d->maxLevelOfDetail = value;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, value);
+#else
+ Q_UNUSED(value);
+ qWarning("QOpenGLTexture: Detail level is not supported");
+#endif
}
/*!
@@ -2917,10 +3024,12 @@ float QOpenGLTexture::maximumLevelOfDetail() const
/*!
Sets the minimum and maximum level of detail parameters.
+ \note This function has no effect on Qt built for OpenGL ES 2.
\sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail()
*/
void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
@@ -2930,6 +3039,11 @@ void QOpenGLTexture::setLevelOfDetailRange(float min, float max)
d->maxLevelOfDetail = max;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, min);
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, max);
+#else
+ Q_UNUSED(min);
+ Q_UNUSED(max);
+ qWarning("QOpenGLTexture: Detail level is not supported");
+#endif
}
/*!
@@ -2946,16 +3060,22 @@ QPair<float, float> QOpenGLTexture::levelOfDetailRange() const
/*!
Sets the level of detail bias parameter.
+ \note This function has no effect on Qt built for OpenGL ES 2.
\sa levelofDetailBias()
*/
void QOpenGLTexture::setLevelofDetailBias(float bias)
{
+#if !defined(QT_OPENGL_ES_2)
Q_D(QOpenGLTexture);
d->create();
Q_ASSERT(d->texFuncs);
Q_ASSERT(d->textureId);
d->levelOfDetailBias = bias;
d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_LOD_BIAS, bias);
+#else
+ Q_UNUSED(bias);
+ qWarning("QOpenGLTexture: Detail level is not supported");
+#endif
}
/*!
diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
index e06cf26f60..5c0f8101a6 100644
--- a/src/gui/opengl/qopengltexture.h
+++ b/src/gui/opengl/qopengltexture.h
@@ -96,8 +96,8 @@ public:
DontResetTextureUnit
};
- QOpenGLTexture(Target target);
- QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
+ explicit QOpenGLTexture(Target target);
+ explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
~QOpenGLTexture();
// Creation and destruction
@@ -222,7 +222,16 @@ public:
SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
- SRGB_BP_UNorm = 0x8E8D // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
+ SRGB_BP_UNorm = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
+
+ // ES 2 formats
+ DepthFormat = 0x1902, // GL_DEPTH_COMPONENT
+ AlphaFormat = 0x1906, // GL_ALPHA
+ RGBFormat = 0x1907, // GL_RGB
+ RGBAFormat = 0x1908, // GL_RGBA
+ LuminanceFormat = 0x1909, // GL_LUMINANCE
+ LuminanceAlphaFormat = 0x190A
+
};
// This is not used externally yet but is reserved to allow checking of
@@ -296,7 +305,10 @@ public:
RGBA_Integer = 0x8D99, // GL_RGBA_INTEGER
BGRA_Integer = 0x8D9B, // GL_BGRA_INTEGER
Depth = 0x1902, // GL_DEPTH_COMPONENT
- DepthStencil = 0x84F9 // GL_DEPTH_STENCIL
+ DepthStencil = 0x84F9, // GL_DEPTH_STENCIL
+ Alpha = 0x1906, // GL_ALPHA
+ Luminance = 0x1909, // GL_LUMINANCE
+ LuminanceAlpha = 0x190A // GL_LUMINANCE_ALPHA
};
enum PixelType {
@@ -308,6 +320,7 @@ public:
Int32 = 0x1404, // GL_INT
UInt32 = 0x1405, // GL_UNSIGNED_INT
Float16 = 0x140B, // GL_HALF_FLOAT
+ Float16OES = 0x8D61, // GL_HALF_FLOAT_OES
Float32 = 0x1406, // GL_FLOAT
UInt32_RGB9_E5 = 0x8C3E, // GL_UNSIGNED_INT_5_9_9_9_REV
UInt32_RG11B10F = 0x8C3B, // GL_UNSIGNED_INT_10F_11F_11F_REV
diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp
index 94b82885ff..4238f63cd8 100644
--- a/src/gui/opengl/qopengltexturecache.cpp
+++ b/src/gui/opengl/qopengltexturecache.cpp
@@ -95,10 +95,9 @@ void QOpenGLTextureCacheWrapper::cleanupTexturesForPixmapData(QPlatformPixmap *p
cleanupTexturesForCacheKey(pmd->cacheKey());
}
-QOpenGLTextureCache::QOpenGLTextureCache(QOpenGLContext *ctx, bool useByteSwapImage)
+QOpenGLTextureCache::QOpenGLTextureCache(QOpenGLContext *ctx)
: QOpenGLSharedResource(ctx->shareGroup())
, m_cache(64 * 1024) // 64 MB cache
- , m_useByteSwapImage(useByteSwapImage)
{
}
@@ -152,38 +151,13 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i
return id;
}
-static inline void qgl_byteSwapImage(QImage &img)
-{
- const int width = img.width();
- const int height = img.height();
-
- if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
- {
- for (int i = 0; i < height; ++i) {
- uint *p = (uint *) img.scanLine(i);
- for (int x = 0; x < width; ++x)
- p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
- }
- } else {
- for (int i = 0; i < height; ++i) {
- uint *p = (uint *) img.scanLine(i);
- for (int x = 0; x < width; ++x)
- p[x] = (p[x] << 8) | (p[x] >> 24);
- }
- }
-}
-
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image)
{
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
- QImage tx = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
-
- // Performance could be improved by skipping qgl_byteSwapImage().
- if (m_useByteSwapImage)
- qgl_byteSwapImage(tx);
+ QImage tx = image.convertToFormat(QImage::Format_RGBA8888_Premultiplied);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast<const QImage &>(tx).bits());
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
index d4d3f00069..2e82d5f373 100644
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ b/src/gui/opengl/qopengltexturecache_p.h
@@ -78,7 +78,7 @@ class Q_GUI_EXPORT QOpenGLTextureCache : public QOpenGLSharedResource
public:
static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context);
- QOpenGLTextureCache(QOpenGLContext *, bool useByteSwapImage = true);
+ QOpenGLTextureCache(QOpenGLContext *);
~QOpenGLTextureCache();
GLuint bindTexture(QOpenGLContext *context, const QPixmap &pixmap);
@@ -94,7 +94,6 @@ private:
QMutex m_mutex;
QCache<quint64, QOpenGLCachedTexture> m_cache;
- bool m_useByteSwapImage;
};
QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 506aec0f43..3b62d1d63a 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -43,6 +43,8 @@
#include "qopenglpaintengine_p.h"
#include "private/qopenglengineshadersource_p.h"
#include "qopenglextensions_p.h"
+#include <qrgb.h>
+#include <private/qdrawhelper_p.h>
QT_BEGIN_NAMESPACE
@@ -301,7 +303,17 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
return;
}
- QImage mask = textureMapForGlyph(glyph, subPixelPosition);
+ QImage mask;
+
+ if (m_current_fontengine->hasInternalCaching()) {
+ QImage *alphaMap = m_current_fontengine->lockedAlphaMapForGlyph(glyph, subPixelPosition, QFontEngine::Format_None);
+ if (!alphaMap || alphaMap->isNull())
+ return;
+ mask = alphaMap->copy();
+ m_current_fontengine->unlockAlphaMapForGlyph();
+ } else {
+ mask = textureMapForGlyph(glyph, subPixelPosition);
+ }
const int maskWidth = mask.width();
const int maskHeight = mask.height();
@@ -316,24 +328,27 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
if (mask.format() == QImage::Format_RGB32
// We need to make the alpha component equal to the average of the RGB values.
// This is needed when drawing sub-pixel antialiased text on translucent targets.
+#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN
+ || mask.format() == QImage::Format_ARGB32_Premultiplied
+#endif
) {
for (int y = 0; y < maskHeight; ++y) {
- quint32 *src = (quint32 *) mask.scanLine(y);
+ QRgb *src = (QRgb *) mask.scanLine(y);
for (int x = 0; x < maskWidth; ++x) {
- uchar r = src[x] >> 16;
- uchar g = src[x] >> 8;
- uchar b = src[x];
- quint32 avg;
+ int r = qRed(src[x]);
+ int g = qGreen(src[x]);
+ int b = qBlue(src[x]);
+ int avg;
if (mask.format() == QImage::Format_RGB32)
- avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding.
+ avg = (r + g + b + 1) / 3; // "+1" for rounding.
else // Format_ARGB_Premultiplied
- avg = src[x] >> 24;
+ avg = qAlpha(src[x]);
-#if defined(QT_OPENGL_ES_2)
+ src[x] = qRgba(r, g, b, avg);
+#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN
// swizzle the bits to accommodate for the GL_RGBA upload.
- src[x] = (avg << 24) | (quint32(r) << 0) | (quint32(g) << 8) | (quint32(b) << 16);
+ src[x] = ARGB2RGBA(src[x]);
#endif
- src[x] = (src[x] & 0x00ffffff) | (avg << 24);
}
}
}
@@ -341,7 +356,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture);
if (mask.depth() == 32) {
-#if defined(QT_OPENGL_ES_2)
+#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_RGBA, GL_UNSIGNED_BYTE, mask.bits());
#else
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp
index e09b84cce6..676c0802de 100644
--- a/src/gui/opengl/qopengltexturehelper.cpp
+++ b/src/gui/opengl/qopengltexturehelper.cpp
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
{
// Resolve EXT_direct_state_access entry points if present
+#if !defined(QT_OPENGL_ES_2)
if (context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
@@ -96,6 +97,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D;
CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D;
} else {
+#endif
// Use our own DSA emulation
TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri;
TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv;
@@ -117,9 +119,21 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D;
CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D;
CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D;
+#if defined(QT_OPENGL_ES_2)
+ if (context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) {
+ TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES")));
+ TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES")));
+ CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES")));
+ CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3DOES")));
+ }
+#endif
+
+#if !defined(QT_OPENGL_ES_2)
}
+#endif
// Some DSA functions are part of NV_texture_multisample instead
+#if !defined(QT_OPENGL_ES_2)
if (context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
@@ -127,11 +141,14 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample;
TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample;
} else {
+#endif
TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample;
TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample;
+#if !defined(QT_OPENGL_ES_2)
}
+#endif
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2)
HMODULE handle = GetModuleHandleA("opengl32.dll");
// OpenGL 1.0
diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/gui/opengl/qopengltexturehelper_p.h
index e3abaa80af..fa4bd8120a 100644
--- a/src/gui/opengl/qopengltexturehelper_p.h
+++ b/src/gui/opengl/qopengltexturehelper_p.h
@@ -256,6 +256,7 @@ public:
}
private:
+#if !defined(QT_OPENGL_ES_2)
// DSA wrapper (so we can use pointer to member function as switch)
inline void dsa_TextureParameteri(GLuint texture, GLenum target, GLenum pname, GLint param)
{
@@ -403,6 +404,7 @@ private:
{
CompressedTextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, imageSize, bits);
}
+#endif
// DSA-like API
@@ -899,6 +901,7 @@ public:
int val = 0;
glGetIntegerv(GL_UNPACK_ALIGNMENT, &val);
options.setAlignment(val);
+#if !defined(QT_OPENGL_ES_2)
glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &val);
options.setSkipImages(val);
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &val);
@@ -914,12 +917,14 @@ public:
options.setLeastSignificantByteFirst(b);
glGetBooleanv(GL_UNPACK_SWAP_BYTES, &b);
options.setSwapBytesEnabled(b);
+#endif
return options;
}
inline void setPixelUploadOptions(const QOpenGLPixelTransferOptions &options)
{
glPixelStorei(GL_UNPACK_ALIGNMENT, options.alignment());
+#if !defined(QT_OPENGL_ES_2)
glPixelStorei(GL_UNPACK_SKIP_IMAGES, options.skipImages());
glPixelStorei(GL_UNPACK_SKIP_ROWS, options.skipRows());
glPixelStorei(GL_UNPACK_SKIP_PIXELS, options.skipPixels());
@@ -927,6 +932,7 @@ public:
glPixelStorei(GL_UNPACK_ROW_LENGTH, options.rowLength());
glPixelStorei(GL_UNPACK_LSB_FIRST, options.isLeastSignificantBitFirst());
glPixelStorei(GL_UNPACK_SWAP_BYTES, options.isSwapBytesEnabled());
+#endif
}
private:
@@ -982,6 +988,7 @@ private:
CompressedTextureImage2DMemberFunc CompressedTextureImage2D;
CompressedTextureImage3DMemberFunc CompressedTextureImage3D;
+#if !defined(QT_OPENGL_ES_2)
// Raw function pointers for core and DSA functions
// EXT_direct_state_access used when DSA is available
@@ -1012,6 +1019,7 @@ private:
// Plus some missing ones that are in the NV_texture_multisample extension instead
void (QOPENGLF_APIENTRYP TextureImage3DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
void (QOPENGLF_APIENTRYP TextureImage2DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+#endif
// OpenGL 1.0
void (QOPENGLF_APIENTRYP GetIntegerv)(GLenum pname, GLint *params);
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 38c2dd6498..b35fa38ce0 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -508,7 +508,7 @@ QBrush::QBrush(Qt::GlobalColor color, Qt::BrushStyle style)
The style is set to Qt::TexturePattern. The color will only have
an effect for QBitmaps.
- \sa setColor(), setPixmap()
+ \sa setColor(), setTexture()
*/
QBrush::QBrush(const QColor &color, const QPixmap &pixmap)
@@ -525,7 +525,7 @@ QBrush::QBrush(const QColor &color, const QPixmap &pixmap)
The style is set to Qt::TexturePattern. The color will only have
an effect for QBitmaps.
- \sa setColor(), setPixmap()
+ \sa setColor(), setTexture()
*/
QBrush::QBrush(Qt::GlobalColor color, const QPixmap &pixmap)
{
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index b12fd71563..541b3ef619 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -964,6 +964,7 @@ public:
union Vect_buffer_i { Int32x4 v; int i[4]; };
union Vect_buffer_f { Float32x4 v; float f[4]; };
+ static inline Float32x4 v_dup(double x) { return vdupq_n_f32(float(x)); }
static inline Float32x4 v_dup(float x) { return vdupq_n_f32(x); }
static inline Int32x4 v_dup(int x) { return vdupq_n_s32(x); }
static inline Int32x4 v_dup(uint x) { return vdupq_n_s32(x); }
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index b4dec2929d..18b6d84146 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -247,12 +247,6 @@ private:
friend class QFontEngineBox;
friend class QFontEngineMac;
friend class QFontEngineWin;
-#ifndef QT_NO_QWS_QPF
- friend class QFontEngineQPF1;
-#endif
-#ifndef QT_NO_QWS_QPF2
- friend class QFontEngineQPF;
-#endif
friend class QMacPrintEngine;
friend class QMacPrintEnginePrivate;
friend class QFontEngineQPA;
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 4a26da104d..bdd0d9cd4c 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -308,9 +308,9 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() :
of painting operations in Qt for Embedded Linux.
Note that this functionality is only available in
- \l{Qt for Embedded Linux}.
+ Qt for Embedded Linux.
- In \l{Qt for Embedded Linux}, painting is a pure software
+ In Qt for Embedded Linux, painting is a pure software
implementation. But starting with Qt 4.2, it is
possible to add an accelerated graphics driver to take advantage
of available hardware resources.
@@ -318,19 +318,15 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() :
Hardware acceleration is accomplished by creating a custom screen
driver, accelerating the copying from memory to the screen, and
implementing a custom paint engine accelerating the various
- painting operations. Then a custom paint device (derived from the
- QCustomRasterPaintDevice class) and a custom window surface
- (derived from QWSWindowSurface) must be implemented to make
- \l{Qt for Embedded Linux} aware of the accelerated driver.
+ painting operations. Then a custom paint device and a custom
+ window surface must be implemented to make
+ Qt for Embedded Linux aware of the accelerated driver.
\note The QRasterPaintEngine class does not support 8-bit images.
Instead, they need to be converted to a supported format, such as
QImage::Format_ARGB32_Premultiplied.
- See the \l {Adding an Accelerated Graphics Driver to Qt for Embedded Linux}
- documentation for details.
-
- \sa QCustomRasterPaintDevice, QPaintEngine
+ \sa QPaintEngine
*/
/*!
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 4c02abdfd5..424ed554a2 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -146,17 +146,16 @@ static inline uint line_emulation(uint emulation)
}
#ifndef QT_NO_DEBUG
-static bool qt_painter_thread_test(int devType, const char *what, bool extraCondition = false)
+static bool qt_painter_thread_test(int devType, const char *what)
{
switch (devType) {
case QInternal::Image:
case QInternal::Printer:
case QInternal::Picture:
// can be drawn onto these devices safely from any thread
- if (extraCondition)
- break;
+ break;
default:
- if (!extraCondition && QThread::currentThread() != qApp->thread()) {
+ if (QThread::currentThread() != qApp->thread()) {
qWarning("QPainter: It is not safe to use %s outside the GUI thread", what);
return false;
}
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 9105e8b396..c05f47c59d 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1651,7 +1651,7 @@ void QPdfEnginePrivate::writeInfo()
xprintf("\n/Creator ");
printString(creator);
xprintf("\n/Producer ");
- printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2012 Digia Plc and/or its subsidiary(-ies)"));
+ printString(QString::fromLatin1("Qt " QT_VERSION_STR));
QDateTime now = QDateTime::currentDateTime().toUTC();
QTime t = now.time();
QDate d = now.date();
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 2166ae7975..b953f8d81f 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -152,6 +152,18 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
continue;
if (listItemCoordinates.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition)))
continue;
+
+ // This is a rather crude hack, but it works.
+ // The FreeType font engine is not capable of getting precise metrics for the alphamap
+ // without first rasterizing the glyph. If we force the glyph to be rasterized before
+ // we ask for the alphaMapBoundingBox(), the glyph will be loaded, rasterized and its
+ // proper metrics will be cached and used later.
+ if (fontEngine->hasInternalCaching()) {
+ QImage *locked = fontEngine->lockedAlphaMapForGlyph(glyph, subPixelPosition, format);
+ if (locked)
+ fontEngine->unlockAlphaMapForGlyph();
+ }
+
glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, subPixelPosition, m_transform, format);
#ifdef CACHE_DEBUG
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index a410004c06..49b5a9ba46 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -208,7 +208,7 @@ QFontEngine *QFontPrivate::engineForScript(int script) const
QMutexLocker locker(qt_fontdatabase_mutex());
if (script <= QChar::Script_Latin)
script = QChar::Script_Common;
- if (engineData && engineData->fontCache != QFontCache::instance()) {
+ if (engineData && engineData->fontCacheId != QFontCache::instance()->id()) {
// throw out engineData that came from a different thread
if (!engineData->ref.deref())
delete engineData;
@@ -317,7 +317,7 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other)
QFontEngineData::QFontEngineData()
- : ref(0), fontCache(QFontCache::instance())
+ : ref(0), fontCacheId(QFontCache::instance()->id())
{
memset(engines, 0, QChar::ScriptCount * sizeof(QFontEngine *));
}
@@ -2638,9 +2638,12 @@ void QFontCache::cleanup()
}
#endif // QT_NO_THREAD
+QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(1);
+
QFontCache::QFontCache()
: QObject(), total_cost(0), max_cost(min_cost),
- current_timestamp(0), fast(false), timer_id(-1)
+ current_timestamp(0), fast(false), timer_id(-1),
+ m_id(font_cache_id.fetchAndAddRelaxed(1))
{
}
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 115e866f24..5b7f918e21 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -140,7 +140,7 @@ public:
~QFontEngineData();
QAtomicInt ref;
- QFontCache *fontCache;
+ const int fontCacheId;
QFontEngine *engines[QChar::ScriptCount];
@@ -206,6 +206,8 @@ public:
QFontCache();
~QFontCache();
+ int id() const { return m_id; }
+
void clear();
struct Key {
@@ -263,6 +265,7 @@ private:
uint current_timestamp;
bool fast;
int timer_id;
+ const int m_id;
};
Q_GUI_EXPORT int qt_defaultDpiX();
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 6c0be950dc..fddbb11122 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -184,6 +184,7 @@ QFontEngine *loadSingleEngine(int script,
if (!engine) {
engine = pfdb->fontEngine(def, QChar::Script(script), size->handle);
if (engine) {
+ engine->smoothScalable = style->smoothScalable;
QFontCache::Key key(def,script);
QFontCache::instance()->instance()->insertEngine(key,engine);
}
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 303c85ce75..7d1afbbfb6 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -208,7 +208,8 @@ Q_AUTOTEST_EXPORT QList<QFontEngine *> QFontEngine_stopCollectingEngines()
QFontEngine::QFontEngine()
: ref(0),
font_(0), font_destroy_func(0),
- face_(0), face_destroy_func(0)
+ face_(0), face_destroy_func(0),
+ smoothScalable(false)
{
cache_cost = 0;
fsType = 0;
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 6e14fc23c6..22d2585898 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -112,7 +112,7 @@ QT_BEGIN_NAMESPACE
#endif
#define FLOOR(x) ((x) & -64)
-#define CEIL(x) (((x)+63) & -64)
+#define CEIL(x) (((x)+63) & -64)
#define TRUNC(x) ((x) >> 6)
#define ROUND(x) (((x)+32) & -64)
@@ -124,11 +124,21 @@ public:
QtFreetypeData()
: library(0)
{ }
+ ~QtFreetypeData();
FT_Library library;
QHash<QFontEngine::FaceId, QFreetypeFace *> faces;
};
+QtFreetypeData::~QtFreetypeData()
+{
+ for (QHash<QFontEngine::FaceId, QFreetypeFace *>::ConstIterator iter = faces.begin(); iter != faces.end(); ++iter)
+ iter.value()->cleanup();
+ faces.clear();
+ FT_Done_FreeType(library);
+ library = 0;
+}
+
#ifdef QT_NO_THREAD
Q_GLOBAL_STATIC(QtFreetypeData, theFreetypeData)
@@ -292,23 +302,35 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
return freetype;
}
+void QFreetypeFace::cleanup()
+{
+ if (hbFace && hbFace_destroy_func) {
+ hbFace_destroy_func(hbFace);
+ hbFace = 0;
+ }
+ FT_Done_Face(face);
+ face = 0;
+}
+
void QFreetypeFace::release(const QFontEngine::FaceId &face_id)
{
- QtFreetypeData *freetypeData = qt_getFreetypeData();
if (!ref.deref()) {
- if (hbFace && hbFace_destroy_func) {
- hbFace_destroy_func(hbFace);
- hbFace = 0;
+ if (face) {
+ QtFreetypeData *freetypeData = qt_getFreetypeData();
+
+ cleanup();
+
+ if (freetypeData->faces.contains(face_id))
+ freetypeData->faces.take(face_id);
+
+ if (freetypeData->faces.isEmpty()) {
+ FT_Done_FreeType(freetypeData->library);
+ freetypeData->library = 0;
+ }
}
- FT_Done_Face(face);
- if(freetypeData->faces.contains(face_id))
- freetypeData->faces.take(face_id);
+
delete this;
}
- if (freetypeData->faces.isEmpty()) {
- FT_Done_FreeType(freetypeData->library);
- freetypeData->library = 0;
- }
}
@@ -631,7 +653,8 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd)
#endif
defaultFormat = Format_None;
embeddedbitmap = false;
- cacheEnabled = qEnvironmentVariableIsSet("QT_USE_FT_CACHE");
+ const QByteArray env = qgetenv("QT_NO_FT_CACHE");
+ cacheEnabled = env.isEmpty() || env.toInt() == 0;
m_subPixelPositionCount = 4;
}
@@ -699,7 +722,6 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale));
} else {
- // copied from QFontEngineQPF
// ad hoc algorithm
int score = fontDef.weight * fontDef.pixelSize;
line_thickness = score / 700;
@@ -1742,7 +1764,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
glyphSet = &defaultGlyphSet;
}
}
- Glyph * g = glyphSet ? glyphSet->getGlyph(glyph) : 0;
+ Glyph * g = glyphSet ? glyphSet->getGlyph(glyph, subPixelPosition) : 0;
if (!g || g->format != format) {
face = lockFace();
FT_Matrix m = this->matrix;
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index e64fec2f27..7df66b9678 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -114,9 +114,11 @@ public:
private:
friend class QFontEngineFT;
+ friend class QtFreetypeData;
friend struct QScopedPointerDeleter<QFreetypeFace>;
QFreetypeFace() : _lock(QMutex::Recursive) {}
~QFreetypeFace() {}
+ void cleanup();
QAtomicInt ref;
QMutex _lock;
QByteArray fontData;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index c181d61d73..07be498764 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -302,6 +302,8 @@ public:
inline QVariant userData() const { return m_userData; }
+ bool smoothScalable;
+
protected:
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 58c9addec1..1a66657cbd 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -1587,7 +1587,7 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString&
\li Qt::TextWordBreak breaks the text to fit the rectangle.
\endlist
- These flags are defined in \l{Qt::TextFlags}.
+ These flags are defined in the \l{Qt::TextFlag} enum.
If Qt::TextExpandTabs is set in \a flags, the following behavior is
used to interpret tab characters in the text:
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 180b09be33..82d63237e7 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -2527,7 +2527,7 @@ static bool isOrderedList(int style)
|| style == QTextListFormat::ListUpperAlpha
|| style == QTextListFormat::ListUpperRoman
|| style == QTextListFormat::ListLowerRoman
- ;
+ ;
}
void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index f0910dd52d..4b6ce667fa 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -632,7 +632,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
blockRevision);
if (key+1 != blocks.position(b)) {
-// qDebug("remove_string from %d length %d", key, X->size_array[0]);
+// qDebug("remove_string from %d length %d", key, X->size_array[0]);
Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0])));
w = remove_string(key, X->size_array[0], op);
@@ -641,7 +641,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
dstKey += X->size_array[0];
}
} else {
-// qDebug("remove_block at %d", key);
+// qDebug("remove_block at %d", key);
Q_ASSERT(X->size_array[0] == 1 && isValidBlockSeparator(text.at(X->stringPosition)));
b = blocks.previous(b);
B = 0;
@@ -779,7 +779,7 @@ void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFor
}
void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlock &to,
- const QTextBlockFormat &newFormat, FormatChangeMode mode)
+ const QTextBlockFormat &newFormat, FormatChangeMode mode)
{
beginEditBlock();
@@ -795,7 +795,7 @@ void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlo
QTextBlock it = from;
QTextBlock end = to;
if (end.isValid())
- end = end.next();
+ end = end.next();
for (; it != end; it = it.next()) {
int oldFormat = block(it)->format;
@@ -820,8 +820,8 @@ void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlo
if (group)
group->blockInserted(it);
} else if (group) {
- group->blockFormatChanged(it);
- }
+ group->blockFormatChanged(it);
+ }
}
documentChange(from.position(), to.position() + to.length() - from.position());
@@ -892,14 +892,14 @@ int QTextDocumentPrivate::undoRedo(bool undo)
QTextUndoCommand &c = undoStack[undoState];
int resetBlockRevision = c.pos;
- switch(c.command) {
+ switch (c.command) {
case QTextUndoCommand::Inserted:
remove(c.pos, c.length, (QTextUndoCommand::Operation)c.operation);
PMDEBUG(" erase: from %d, length %d", c.pos, c.length);
c.command = QTextUndoCommand::Removed;
editPos = c.pos;
editLength = 0;
- break;
+ break;
case QTextUndoCommand::Removed:
PMDEBUG(" insert: format %d (from %d, length %d, strpos=%d)", c.format, c.pos, c.length, c.strPos);
insert_string(c.pos, c.strPos, c.length, c.format, (QTextUndoCommand::Operation)c.operation);
@@ -908,33 +908,33 @@ int QTextDocumentPrivate::undoRedo(bool undo)
editLength = 0;
editPos = c.pos;
editLength += c.length;
- break;
- case QTextUndoCommand::BlockInserted:
- case QTextUndoCommand::BlockAdded:
+ break;
+ case QTextUndoCommand::BlockInserted:
+ case QTextUndoCommand::BlockAdded:
remove_block(c.pos, &c.blockFormat, c.command, (QTextUndoCommand::Operation)c.operation);
PMDEBUG(" blockremove: from %d", c.pos);
- if (c.command == QTextUndoCommand::BlockInserted)
- c.command = QTextUndoCommand::BlockRemoved;
- else
- c.command = QTextUndoCommand::BlockDeleted;
+ if (c.command == QTextUndoCommand::BlockInserted)
+ c.command = QTextUndoCommand::BlockRemoved;
+ else
+ c.command = QTextUndoCommand::BlockDeleted;
editPos = c.pos;
editLength = 0;
- break;
- case QTextUndoCommand::BlockRemoved:
- case QTextUndoCommand::BlockDeleted:
+ break;
+ case QTextUndoCommand::BlockRemoved:
+ case QTextUndoCommand::BlockDeleted:
PMDEBUG(" blockinsert: charformat %d blockformat %d (pos %d, strpos=%d)", c.format, c.blockFormat, c.pos, c.strPos);
insert_block(c.pos, c.strPos, c.format, c.blockFormat, (QTextUndoCommand::Operation)c.operation, c.command);
resetBlockRevision += 1;
- if (c.command == QTextUndoCommand::BlockRemoved)
- c.command = QTextUndoCommand::BlockInserted;
- else
- c.command = QTextUndoCommand::BlockAdded;
+ if (c.command == QTextUndoCommand::BlockRemoved)
+ c.command = QTextUndoCommand::BlockInserted;
+ else
+ c.command = QTextUndoCommand::BlockAdded;
if (editPos != (int)c.pos)
editLength = 0;
editPos = c.pos;
editLength += 1;
- break;
- case QTextUndoCommand::CharFormatChanged: {
+ break;
+ case QTextUndoCommand::CharFormatChanged: {
resetBlockRevision = -1; // ## TODO
PMDEBUG(" charFormat: format %d (from %d, length %d)", c.format, c.pos, c.length);
FragmentIterator it = find(c.pos);
@@ -947,9 +947,9 @@ int QTextDocumentPrivate::undoRedo(bool undo)
editLength = 0;
editPos = c.pos;
editLength += c.length;
- break;
- }
- case QTextUndoCommand::BlockFormatChanged: {
+ break;
+ }
+ case QTextUndoCommand::BlockFormatChanged: {
resetBlockRevision = -1; // ## TODO
PMDEBUG(" blockformat: format %d pos %d", c.format, c.pos);
QTextBlock it = blocksFind(c.pos);
@@ -970,9 +970,9 @@ int QTextDocumentPrivate::undoRedo(bool undo)
}
documentChange(it.position(), it.length());
editPos = -1;
- break;
- }
- case QTextUndoCommand::GroupFormatChange: {
+ break;
+ }
+ case QTextUndoCommand::GroupFormatChange: {
resetBlockRevision = -1; // ## TODO
PMDEBUG(" group format change");
QTextObject *object = objectForIndex(c.objectIndex);
@@ -980,22 +980,22 @@ int QTextDocumentPrivate::undoRedo(bool undo)
changeObjectFormat(object, c.format);
c.format = oldFormat;
editPos = -1;
- break;
- }
+ break;
+ }
case QTextUndoCommand::CursorMoved:
editPos = c.pos;
editLength = 0;
break;
- case QTextUndoCommand::Custom:
+ case QTextUndoCommand::Custom:
resetBlockRevision = -1; // ## TODO
if (undo)
c.custom->undo();
else
c.custom->redo();
editPos = -1;
- break;
- default:
- Q_ASSERT(false);
+ break;
+ default:
+ Q_ASSERT(false);
}
if (resetBlockRevision >= 0) {
@@ -1315,9 +1315,9 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr
int removed = qMax(0, -addedOrRemoved);
int diff = 0;
- if(from + removed < docChangeFrom)
+ if (from + removed < docChangeFrom)
diff = docChangeFrom - from - removed;
- else if(from > docChangeFrom + docChangeLength)
+ else if (from > docChangeFrom + docChangeLength)
diff = from - (docChangeFrom + docChangeLength);
int overlap_start = qMax(from, docChangeFrom);
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index b3358161c5..fa22131c9e 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -194,7 +194,7 @@ public:
void setCharFormat(int pos, int length, const QTextCharFormat &newFormat, FormatChangeMode mode = SetFormat);
void setBlockFormat(const QTextBlock &from, const QTextBlock &to,
- const QTextBlockFormat &newFormat, FormatChangeMode mode = SetFormat);
+ const QTextBlockFormat &newFormat, FormatChangeMode mode = SetFormat);
void emitUndoAvailable(bool available);
void emitRedoAvailable(bool available);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 2b0f9ffeb6..6345ed7682 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -3100,7 +3100,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
glyph_pos--;
}
- const QCharAttributes *attrs = attributes();
+ const QCharAttributes *attrs = attributes() + si->position;
logClusters = this->logClusters(si);
clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart);
@@ -3117,11 +3117,11 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
int closestItem = dist > (perItemWidth / 2) ? n + 1 : n;
if (cursorOnCharacter && closestItem > 0)
closestItem--;
- int pos = si->position + clusterStart + closestItem;
+ int pos = clusterStart + closestItem;
// Jump to the next grapheme boundary
while (pos < end && !attrs[pos].graphemeBoundary)
pos++;
- return pos;
+ return si->position + pos;
}
return si->position + end;
}
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index a131503b85..3cb61b9eae 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1896,11 +1896,7 @@ QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
if (nodes.at(node).id == Html_a && nodes.at(node).hasHref)
extraPseudo = "link";
decls = selector.declarationsForNode(n, extraPseudo);
- n = selector.parentNode(n);
- while (!selector.isNullNode(n)) {
- decls = selector.declarationsForNode(n, extraPseudo) + decls;
- n = selector.parentNode(n);
- }
+
return decls;
}
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index f969f66006..15c16f1ec0 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -265,8 +265,8 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
result = QLatin1String("?");
}
- }
- break;
+ }
+ break;
default:
Q_ASSERT(false);
}
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index d77cbf9671..045fe7f957 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -355,12 +355,12 @@ QTextTable *QTextTablePrivate::createTable(QTextDocumentPrivate *pieceTable, int
for (int i = 1; i < rows*cols; ++i) {
d->cells.append(pieceTable->insertBlock(QTextBeginningOfFrame, pos, cellIdx, charIdx));
-// qDebug(" addCell at %d", pos);
+// qDebug(" addCell at %d", pos);
++pos;
}
d->fragment_end = pieceTable->insertBlock(QTextEndOfFrame, pos, cellIdx, charIdx);
-// qDebug(" addEOR at %d", pos);
+// qDebug(" addEOR at %d", pos);
++pos;
d->blockFragmentUpdates = false;
@@ -482,7 +482,7 @@ void QTextTablePrivate::update() const
for (int jj = 0; jj < colspan; ++jj) {
Q_ASSERT(grid[(r+ii)*nCols + c+jj] == 0);
grid[(r+ii)*nCols + c+jj] = fragment;
-// qDebug(" setting cell %d span=%d/%d at %d/%d", fragment, rowspan, colspan, r+ii, c+jj);
+// qDebug(" setting cell %d span=%d/%d at %d/%d", fragment, rowspan, colspan, r+ii, c+jj);
}
}
}
@@ -654,7 +654,7 @@ void QTextTable::resize(int rows, int cols)
int nCols = this->columns();
if (rows == nRows && cols == nCols)
- return;
+ return;
d->pieceTable->beginEditBlock();
@@ -682,7 +682,7 @@ void QTextTable::insertRows(int pos, int num)
{
Q_D(QTextTable);
if (num <= 0)
- return;
+ return;
if (d->dirty)
d->update();
@@ -744,7 +744,7 @@ void QTextTable::insertColumns(int pos, int num)
{
Q_D(QTextTable);
if (num <= 0)
- return;
+ return;
if (d->dirty)
d->update();
@@ -932,7 +932,7 @@ void QTextTable::removeColumns(int pos, int num)
// qDebug() << "-------- removeCols" << pos << num;
if (num <= 0 || pos < 0)
- return;
+ return;
if (d->dirty)
d->update();
if (pos >= d->nCols)
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index 59a6f346e2..2a0e4eff32 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -1,89 +1,89 @@
# Qt kernel module
HEADERS += \
- text/qfont.h \
- text/qfontdatabase.h \
- text/qfontengine_p.h \
- text/qfontengineglyphcache_p.h \
- text/qfontinfo.h \
- text/qfontmetrics.h \
- text/qfont_p.h \
- text/qfontsubset_p.h \
- text/qtextengine_p.h \
- text/qtextlayout.h \
- text/qtextformat.h \
- text/qtextformat_p.h \
- text/qtextobject.h \
- text/qtextobject_p.h \
- text/qtextoption.h \
- text/qfragmentmap_p.h \
- text/qtextdocument.h \
- text/qtextdocument_p.h \
- text/qtexthtmlparser_p.h \
- text/qabstracttextdocumentlayout.h \
- text/qtextdocumentlayout_p.h \
- text/qtextcursor.h \
- text/qtextcursor_p.h \
- text/qtextdocumentfragment.h \
- text/qtextdocumentfragment_p.h \
- text/qtextimagehandler_p.h \
- text/qtexttable.h \
- text/qtextlist.h \
- text/qsyntaxhighlighter.h \
- text/qtextdocumentwriter.h \
- text/qcssparser_p.h \
- text/qtexttable_p.h \
- text/qzipreader_p.h \
- text/qzipwriter_p.h \
- text/qtextodfwriter_p.h \
- text/qstatictext_p.h \
- text/qstatictext.h \
- text/qrawfont.h \
- text/qrawfont_p.h \
+ text/qfont.h \
+ text/qfontdatabase.h \
+ text/qfontengine_p.h \
+ text/qfontengineglyphcache_p.h \
+ text/qfontinfo.h \
+ text/qfontmetrics.h \
+ text/qfont_p.h \
+ text/qfontsubset_p.h \
+ text/qtextengine_p.h \
+ text/qtextlayout.h \
+ text/qtextformat.h \
+ text/qtextformat_p.h \
+ text/qtextobject.h \
+ text/qtextobject_p.h \
+ text/qtextoption.h \
+ text/qfragmentmap_p.h \
+ text/qtextdocument.h \
+ text/qtextdocument_p.h \
+ text/qtexthtmlparser_p.h \
+ text/qabstracttextdocumentlayout.h \
+ text/qtextdocumentlayout_p.h \
+ text/qtextcursor.h \
+ text/qtextcursor_p.h \
+ text/qtextdocumentfragment.h \
+ text/qtextdocumentfragment_p.h \
+ text/qtextimagehandler_p.h \
+ text/qtexttable.h \
+ text/qtextlist.h \
+ text/qsyntaxhighlighter.h \
+ text/qtextdocumentwriter.h \
+ text/qcssparser_p.h \
+ text/qtexttable_p.h \
+ text/qzipreader_p.h \
+ text/qzipwriter_p.h \
+ text/qtextodfwriter_p.h \
+ text/qstatictext_p.h \
+ text/qstatictext.h \
+ text/qrawfont.h \
+ text/qrawfont_p.h \
text/qglyphrun.h \
text/qglyphrun_p.h \
text/qdistancefield_p.h
SOURCES += \
- text/qfont.cpp \
- text/qfontengine.cpp \
- text/qfontsubset.cpp \
- text/qfontmetrics.cpp \
- text/qfontdatabase.cpp \
- text/qtextengine.cpp \
- text/qtextlayout.cpp \
- text/qtextformat.cpp \
- text/qtextobject.cpp \
- text/qtextoption.cpp \
- text/qfragmentmap.cpp \
- text/qtextdocument.cpp \
- text/qtextdocument_p.cpp \
- text/qtexthtmlparser.cpp \
- text/qabstracttextdocumentlayout.cpp \
- text/qtextdocumentlayout.cpp \
- text/qtextcursor.cpp \
- text/qtextdocumentfragment.cpp \
- text/qtextimagehandler.cpp \
- text/qtexttable.cpp \
- text/qtextlist.cpp \
- text/qtextdocumentwriter.cpp \
- text/qsyntaxhighlighter.cpp \
- text/qcssparser.cpp \
- text/qzip.cpp \
- text/qtextodfwriter.cpp \
- text/qstatictext.cpp \
- text/qrawfont.cpp \
+ text/qfont.cpp \
+ text/qfontengine.cpp \
+ text/qfontsubset.cpp \
+ text/qfontmetrics.cpp \
+ text/qfontdatabase.cpp \
+ text/qtextengine.cpp \
+ text/qtextlayout.cpp \
+ text/qtextformat.cpp \
+ text/qtextobject.cpp \
+ text/qtextoption.cpp \
+ text/qfragmentmap.cpp \
+ text/qtextdocument.cpp \
+ text/qtextdocument_p.cpp \
+ text/qtexthtmlparser.cpp \
+ text/qabstracttextdocumentlayout.cpp \
+ text/qtextdocumentlayout.cpp \
+ text/qtextcursor.cpp \
+ text/qtextdocumentfragment.cpp \
+ text/qtextimagehandler.cpp \
+ text/qtexttable.cpp \
+ text/qtextlist.cpp \
+ text/qtextdocumentwriter.cpp \
+ text/qsyntaxhighlighter.cpp \
+ text/qcssparser.cpp \
+ text/qzip.cpp \
+ text/qtextodfwriter.cpp \
+ text/qstatictext.cpp \
+ text/qrawfont.cpp \
text/qglyphrun.cpp \
text/qdistancefield.cpp
SOURCES += \
- text/qfont_qpa.cpp \
- text/qfontengine_qpa.cpp \
- text/qplatformfontdatabase.cpp \
- text/qrawfont_qpa.cpp
+ text/qfont_qpa.cpp \
+ text/qfontengine_qpa.cpp \
+ text/qplatformfontdatabase.cpp \
+ text/qrawfont_qpa.cpp
HEADERS += \
- text/qplatformfontdatabase.h
+ text/qplatformfontdatabase.h
contains(QT_CONFIG, harfbuzz)|contains(QT_CONFIG, system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index 590a37bf15..aaaf05b551 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -64,6 +64,14 @@ SOURCES += \
access/qhttpthreaddelegate.cpp \
access/qhttpmultipart.cpp
-include($$PWD/../../3rdparty/zlib_dependency.pri)
+mac: LIBS_PRIVATE += -framework Security
+
+ios {
+ HEADERS += \
+ access/qnetworkreplynsurlconnectionimpl_p.h
-mac:LIBS_PRIVATE += -framework Security
+ OBJECTIVE_SOURCES += \
+ access/qnetworkreplynsurlconnectionimpl.mm
+}
+
+include($$PWD/../../3rdparty/zlib_dependency.pri)
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 101e1a8c25..980b19b7e4 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -58,6 +58,10 @@
#include "qnetworkreplydataimpl_p.h"
#include "qnetworkreplyfileimpl_p.h"
+#if defined(Q_OS_IOS) && defined(QT_NO_SSL)
+#include "qnetworkreplynsurlconnectionimpl_p.h"
+#endif
+
#include "QtCore/qbuffer.h"
#include "QtCore/qurl.h"
#include "QtCore/qvector.h"
@@ -1159,6 +1163,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
}
}
+// Use NSURLConnection for https on iOS when OpenSSL is disabled.
+#if defined(Q_OS_IOS) && defined(QT_NO_SSL)
+ if (scheme == QLatin1String("https"))
+ return new QNetworkReplyNSURLConnectionImpl(this, request, op, outgoingData);
+#endif
+
#ifndef QT_NO_HTTP
// Since Qt 5 we use the new QNetworkReplyHttpImpl
if (scheme == QLatin1String("http") || scheme == QLatin1String("preconnect-http")
diff --git a/src/network/access/qnetworkreplynsurlconnectionimpl.mm b/src/network/access/qnetworkreplynsurlconnectionimpl.mm
new file mode 100644
index 0000000000..293a505912
--- /dev/null
+++ b/src/network/access/qnetworkreplynsurlconnectionimpl.mm
@@ -0,0 +1,449 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnetworkreplynsurlconnectionimpl_p.h"
+
+#include "QtCore/qdatetime.h"
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qdebug.h>
+#include <Foundation/Foundation.h>
+
+QT_BEGIN_NAMESPACE
+
+// Network reply implementation using NSUrlConnection.
+//
+// Class/object structure:
+//
+// QNetworkReplyNSURLConnectionImpl
+// |- QNetworkReplyNSURLConnectionImplPrivate
+// |- (bytes read)
+// |- (QIODevice and CFStream for async POST data transfer)
+// |- NSURLConnection
+// |- QtNSURLConnectionDelegate <NSURLConnectionDataDelegate>
+// |- NSURLResponse/NSHTTPURLResponse
+// |- (response data)
+//
+// The main entry point is the QNetworkReplyNSURLConnectionImpl constructor, which
+// receives a network request from QNetworkAccessManager. The constructor
+// creates a NSURLRequest and initiates a NSURLConnection with a QtNSURLConnectionDelegate.
+// The delegate callbacks are then called asynchronously as the request completes.
+//
+
+@class QtNSURLConnectionDelegate;
+class QNetworkReplyNSURLConnectionImplPrivate: public QNetworkReplyPrivate
+{
+public:
+ QNetworkReplyNSURLConnectionImplPrivate();
+ virtual ~QNetworkReplyNSURLConnectionImplPrivate();
+
+ Q_DECLARE_PUBLIC(QNetworkReplyNSURLConnectionImpl)
+ NSURLConnection * urlConnection;
+ QtNSURLConnectionDelegate *urlConnectionDelegate;
+ qint64 bytesRead;
+
+ // Sequental outgiong data streaming
+ QIODevice *outgoingData;
+ CFReadStreamRef readStream;
+ CFWriteStreamRef writeStream;
+ CFIndex transferBufferSize;
+
+ // Forwarding functions to the public class.
+ void setFinished();
+ void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value);
+ void setRawHeader(const QByteArray &headerName, const QByteArray &value);
+ void setError(QNetworkReply::NetworkError errorCode, const QString &errorString);
+};
+
+@interface QtNSURLConnectionDelegate : NSObject
+{
+ NSURLResponse *response;
+ NSMutableData *responseData;
+ QNetworkReplyNSURLConnectionImplPrivate * replyprivate;
+}
+
+- (id)initWithQNetworkReplyNSURLConnectionImplPrivate:(QNetworkReplyNSURLConnectionImplPrivate *)a_replyPrivate ;
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_3_0)
+- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
+#endif
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError*)error;
+- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse*)response;
+- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData*)data;
+- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten
+ totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
+- (NSCachedURLResponse*)connection:(NSURLConnection*)connection willCacheResponse:(NSCachedURLResponse*)cachedResponse;
+- (NSURLRequest*)connection:(NSURLConnection*)connection willSendRequest:(NSURLRequest*)request redirectResponse:(NSURLResponse*)redirectResponse;
+- (void)connectionDidFinishLoading:(NSURLConnection*)connection;
+- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection*)connection;
+
+@end
+
+QNetworkReplyNSURLConnectionImplPrivate::QNetworkReplyNSURLConnectionImplPrivate()
+ : QNetworkReplyPrivate()
+ , urlConnection(0)
+ , urlConnectionDelegate(0)
+ , bytesRead(0)
+ , readStream(0)
+ , writeStream(0)
+ , transferBufferSize(4096)
+{
+}
+
+QNetworkReplyNSURLConnectionImplPrivate::~QNetworkReplyNSURLConnectionImplPrivate()
+{
+ [urlConnection release];
+ [urlConnectionDelegate release];
+ if (readStream)
+ CFRelease(readStream);
+ if (writeStream)
+ CFRelease(writeStream);
+}
+
+void QNetworkReplyNSURLConnectionImplPrivate::setFinished()
+{
+ q_func()->setFinished(true);
+}
+
+void QNetworkReplyNSURLConnectionImplPrivate::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
+{
+ q_func()->setHeader(header, value);
+}
+
+void QNetworkReplyNSURLConnectionImplPrivate::setRawHeader(const QByteArray &headerName, const QByteArray &value)
+{
+ q_func()->setRawHeader(headerName, value);
+}
+
+void QNetworkReplyNSURLConnectionImplPrivate::setError(QNetworkReply::NetworkError errorCode, const QString &errorString)
+{
+ q_func()->setError(errorCode, errorString);
+}
+
+void QNetworkReplyNSURLConnectionImpl::readyReadOutgoingData()
+{
+ Q_D(QNetworkReplyNSURLConnectionImpl);
+ int bytesRead = 0;
+ do {
+ char data[d->transferBufferSize];
+ bytesRead = d->outgoingData->read(data, d->transferBufferSize);
+ if (bytesRead <= 0)
+ break;
+ CFIndex bytesWritten = CFWriteStreamWrite(d->writeStream, reinterpret_cast<unsigned char *>(data), bytesRead);
+ if (bytesWritten != bytesRead) {
+ CFErrorRef err = CFWriteStreamCopyError(d->writeStream);
+ qWarning() << "QNetworkReplyNSURLConnectionImpl: CFWriteStreamWrite error"
+ << (err ? QString::number(CFErrorGetCode(err)) : QStringLiteral(""));
+ }
+ } while (bytesRead > 0);
+
+ if (d->outgoingData->atEnd())
+ CFWriteStreamClose(d->writeStream);
+}
+
+@interface QtNSURLConnectionDelegate ()
+
+@property (nonatomic, retain) NSURLResponse* response;
+@property (nonatomic, retain) NSMutableData* responseData;
+
+@end
+
+@implementation QtNSURLConnectionDelegate
+
+@synthesize response;
+@synthesize responseData;
+
+- (id)initWithQNetworkReplyNSURLConnectionImplPrivate:(QNetworkReplyNSURLConnectionImplPrivate *)a_replyPrivate
+{
+ if (self = [super init])
+ replyprivate = a_replyPrivate;
+ return self;
+}
+
+- (void)dealloc
+{
+ [response release];
+ [responseData release];
+ [super dealloc];
+}
+
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_3_0)
+- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+ Q_UNUSED(connection)
+ Q_UNUSED(challenge)
+
+ if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
+ SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
+ SecTrustResultType resultType;
+ SecTrustEvaluate(serverTrust, &resultType);
+ if (resultType == kSecTrustResultUnspecified) {
+ // All good
+ [challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];
+ } else if (resultType == kSecTrustResultRecoverableTrustFailure) {
+ // Certificate verification error, ask user
+ // ### TODO actually ask user
+ // (test site: https://testssl-expire.disig.sk/index.en.html)
+ qWarning() << "QNetworkReplyNSURLConnection: Certificate verification error handlig is"
+ << "not implemented. Connection will time out.";
+ } else {
+ // other error, which the default handler will handle
+ [challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];
+ }
+ }
+
+ [challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];
+}
+#endif
+
+- (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error
+{
+ Q_UNUSED(connection)
+
+ QNetworkReply::NetworkError qtError = QNetworkReply::UnknownNetworkError;
+ if ([error domain] == NSURLErrorDomain) {
+ switch ([error code]) {
+ case NSURLErrorTimedOut: qtError = QNetworkReply::TimeoutError; break;
+ case NSURLErrorUnsupportedURL: qtError = QNetworkReply::ProtocolUnknownError; break;
+ case NSURLErrorCannotFindHost: qtError = QNetworkReply::HostNotFoundError; break;
+ case NSURLErrorCannotConnectToHost: qtError = QNetworkReply::ConnectionRefusedError; break;
+ case NSURLErrorNetworkConnectionLost: qtError = QNetworkReply::NetworkSessionFailedError; break;
+ case NSURLErrorDNSLookupFailed: qtError = QNetworkReply::HostNotFoundError; break;
+ case NSURLErrorNotConnectedToInternet: qtError = QNetworkReply::NetworkSessionFailedError; break;
+ case NSURLErrorUserAuthenticationRequired: qtError = QNetworkReply::AuthenticationRequiredError; break;
+ default: break;
+ }
+ }
+
+ replyprivate->setError(qtError, QString::fromNSString([error localizedDescription]));
+}
+
+- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)aResponse
+{
+ Q_UNUSED(connection)
+ self.response = aResponse;
+ self.responseData = [NSMutableData data];
+
+ // copy headers
+ if ([aResponse isKindOfClass:[NSHTTPURLResponse class]]) {
+ NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)aResponse;
+ NSDictionary *headers = [httpResponse allHeaderFields];
+ for (NSString *key in headers) {
+ NSString *value = [headers objectForKey:key];
+ replyprivate->setRawHeader(QString::fromNSString(key).toUtf8(), QString::fromNSString(value).toUtf8());
+ }
+ } else {
+ if ([aResponse expectedContentLength] != NSURLResponseUnknownLength)
+ replyprivate->setHeader(QNetworkRequest::ContentLengthHeader, [aResponse expectedContentLength]);
+ }
+
+ QMetaObject::invokeMethod(replyprivate->q_func(), "metaDataChanged", Qt::QueuedConnection);
+}
+
+- (void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data
+{
+ Q_UNUSED(connection)
+ [responseData appendData:data];
+
+ if ([response expectedContentLength] != NSURLResponseUnknownLength) {
+ QMetaObject::invokeMethod(replyprivate->q_func(), "downloadProgress", Qt::QueuedConnection,
+ Q_ARG(qint64, qint64([responseData length])),
+ Q_ARG(qint64, qint64([response expectedContentLength])));
+ }
+
+ QMetaObject::invokeMethod(replyprivate->q_func(), "readyRead", Qt::QueuedConnection);
+}
+
+- (void)connection:(NSURLConnection*)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten
+ totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
+{
+ Q_UNUSED(connection)
+ Q_UNUSED(bytesWritten)
+ QMetaObject::invokeMethod(replyprivate->q_func(), "uploadProgress", Qt::QueuedConnection,
+ Q_ARG(qint64, qint64(totalBytesWritten)),
+ Q_ARG(qint64, qint64(totalBytesExpectedToWrite)));
+}
+
+- (NSCachedURLResponse*)connection:(NSURLConnection*)connection willCacheResponse:(NSCachedURLResponse*)cachedResponse
+{
+ Q_UNUSED(connection)
+ return cachedResponse;
+}
+
+- (NSURLRequest*)connection:(NSURLConnection*)connection willSendRequest:(NSURLRequest*)request redirectResponse:(NSURLResponse*)redirectResponse
+{
+ Q_UNUSED(connection)
+ Q_UNUSED(redirectResponse)
+ return request;
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection*)connection
+{
+ Q_UNUSED(connection)
+ replyprivate->setFinished();
+ QMetaObject::invokeMethod(replyprivate->q_func(), "finished", Qt::QueuedConnection);
+}
+
+- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection*)connection
+{
+ Q_UNUSED(connection)
+ return YES;
+}
+
+@end
+
+QNetworkReplyNSURLConnectionImpl::~QNetworkReplyNSURLConnectionImpl()
+{
+}
+
+QNetworkReplyNSURLConnectionImpl::QNetworkReplyNSURLConnectionImpl(QObject *parent,
+ const QNetworkRequest &request, const QNetworkAccessManager::Operation operation, QIODevice* outgoingData)
+ : QNetworkReply(*new QNetworkReplyNSURLConnectionImplPrivate(), parent)
+{
+ setRequest(request);
+ setUrl(request.url());
+ setOperation(operation);
+ QNetworkReply::open(QIODevice::ReadOnly);
+
+ QNetworkReplyNSURLConnectionImplPrivate *d = (QNetworkReplyNSURLConnectionImplPrivate*) d_func();
+
+ QUrl url = request.url();
+ if (url.host() == QLatin1String("localhost"))
+ url.setHost(QString());
+
+ if (url.path().isEmpty())
+ url.setPath(QLatin1String("/"));
+ setUrl(url);
+
+ // Create a NSMutableURLRequest from QNetworkRequest
+ NSMutableURLRequest *nsRequest = [NSMutableURLRequest requestWithURL:request.url().toNSURL()
+ cachePolicy:NSURLRequestUseProtocolCachePolicy
+ timeoutInterval:60.0];
+ // copy headers
+ foreach (const QByteArray &header, request.rawHeaderList()) {
+ QByteArray headerValue = request.rawHeader(header);
+ [nsRequest addValue:QString::fromUtf8(headerValue).toNSString()
+ forHTTPHeaderField:QString::fromUtf8(header).toNSString()];
+ }
+
+ if (operation == QNetworkAccessManager::GetOperation)
+ [nsRequest setHTTPMethod:@"GET"];
+ else if (operation == QNetworkAccessManager::PostOperation)
+ [nsRequest setHTTPMethod:@"POST"];
+ else if (operation == QNetworkAccessManager::PutOperation)
+ [nsRequest setHTTPMethod:@"PUT"];
+ else if (operation == QNetworkAccessManager::DeleteOperation)
+ [nsRequest setHTTPMethod:@"DELETE"];
+ else
+ qWarning() << "QNetworkReplyNSURLConnection: Unsupported netork operation" << operation;
+
+ if (outgoingData) {
+ d->outgoingData = outgoingData;
+ if (outgoingData->isSequential()) {
+ // set up streaming from outgoingData iodevice to request
+ CFStreamCreateBoundPair(kCFAllocatorDefault, &d->readStream, &d->writeStream, d->transferBufferSize);
+ CFWriteStreamOpen(d->writeStream);
+ [nsRequest setHTTPBodyStream:reinterpret_cast<NSInputStream *>(d->readStream)];
+ connect(outgoingData, SIGNAL(readyRead()), this, SLOT(readyReadOutgoingData()));
+ readyReadOutgoingData();
+ } else {
+ // move all data at once
+ QByteArray data = outgoingData->readAll();
+ [nsRequest setHTTPBody:[NSData dataWithBytes:data.constData() length:data.length()]];
+ }
+ }
+
+ // Create connection
+ d->urlConnectionDelegate = [[QtNSURLConnectionDelegate alloc] initWithQNetworkReplyNSURLConnectionImplPrivate:d];
+ d->urlConnection = [[NSURLConnection alloc] initWithRequest:nsRequest delegate:d->urlConnectionDelegate];
+ if (!d->urlConnection) {
+ // ### what type of error is an initWithRequest fail?
+ setError(QNetworkReply::ProtocolUnknownError, QStringLiteral("QNetworkReplyNSURLConnection internal error"));
+ }
+}
+
+void QNetworkReplyNSURLConnectionImpl::close()
+{
+ // No-op? Network ops should continue (especially POSTs)
+ QNetworkReply::close();
+}
+
+void QNetworkReplyNSURLConnectionImpl::abort()
+{
+ Q_D(QNetworkReplyNSURLConnectionImpl);
+ [d->urlConnection cancel];
+ QNetworkReply::close();
+}
+
+qint64 QNetworkReplyNSURLConnectionImpl::bytesAvailable() const
+{
+ Q_D(const QNetworkReplyNSURLConnectionImpl);
+ qint64 available = QNetworkReply::bytesAvailable() +
+ [[d->urlConnectionDelegate responseData] length] -
+ d->bytesRead;
+
+ return available;
+}
+
+bool QNetworkReplyNSURLConnectionImpl::isSequential() const
+{
+ return true;
+}
+
+qint64 QNetworkReplyNSURLConnectionImpl::size() const
+{
+ Q_D(const QNetworkReplyNSURLConnectionImpl);
+ return [[d->urlConnectionDelegate responseData] length];
+}
+
+/*!
+ \internal
+*/
+qint64 QNetworkReplyNSURLConnectionImpl::readData(char *data, qint64 maxlen)
+{
+ Q_D(QNetworkReplyNSURLConnectionImpl);
+ qint64 dataSize = [[d->urlConnectionDelegate responseData] length];
+ qint64 canRead = qMin(maxlen, dataSize - d->bytesRead);
+ const char *sourceBase = static_cast<const char *>([[d->urlConnectionDelegate responseData] bytes]);
+ memcpy(data, sourceBase + d->bytesRead, canRead);
+ d->bytesRead += canRead;
+ return canRead;
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkreplynsurlconnectionimpl_p.h b/src/network/access/qnetworkreplynsurlconnectionimpl_p.h
new file mode 100644
index 0000000000..967eb13246
--- /dev/null
+++ b/src/network/access/qnetworkreplynsurlconnectionimpl_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNETWORKREPLYNSURLCONNECTIONIMPL_H
+#define QNETWORKREPLYNSURLCONNECTIONIMPL_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the Network Access API. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qnetworkreply.h"
+#include "qnetworkreply_p.h"
+#include "qnetworkaccessmanager.h"
+#include <QFile>
+#include <private/qabstractfileengine_p.h>
+
+QT_BEGIN_NAMESPACE
+
+
+class QNetworkReplyNSURLConnectionImplPrivate;
+class QNetworkReplyNSURLConnectionImpl: public QNetworkReply
+{
+ Q_OBJECT
+public:
+ QNetworkReplyNSURLConnectionImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op, QIODevice* outgoingData);
+ virtual ~QNetworkReplyNSURLConnectionImpl();
+ virtual void abort();
+
+ // reimplemented from QNetworkReply
+ virtual void close();
+ virtual qint64 bytesAvailable() const;
+ virtual bool isSequential () const;
+ qint64 size() const;
+
+ virtual qint64 readData(char *data, qint64 maxlen);
+public Q_SLOTS:
+ void readyReadOutgoingData();
+
+ Q_DECLARE_PRIVATE(QNetworkReplyNSURLConnectionImpl)
+};
+
+QT_END_NAMESPACE
+
+#endif // QNetworkReplyNSURLConnectionImpl_H
diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp
index 8d34db19cd..a66b39f733 100644
--- a/src/network/bearer/qnetworkconfiguration.cpp
+++ b/src/network/bearer/qnetworkconfiguration.cpp
@@ -591,7 +591,6 @@ QNetworkConfiguration::BearerType QNetworkConfiguration::bearerTypeFamily() cons
\li Value
\row
\li BearerUnknown
- \li
\li The session is based on an unknown or unspecified bearer type. The value of the
string returned describes the bearer type.
\row
diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf
index f4779ae8fe..33d6c24461 100644
--- a/src/network/doc/qtnetwork.qdocconf
+++ b/src/network/doc/qtnetwork.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtNetwork
description = Qt Network Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtnetwork
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = network
diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
index a4a19988b3..97f52fdb6e 100644
--- a/src/network/kernel/kernel.pri
+++ b/src/network/kernel/kernel.pri
@@ -35,7 +35,7 @@ android {
win32: {
HEADERS += kernel/qnetworkinterface_win_p.h
SOURCES += kernel/qdnslookup_win.cpp kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp
- LIBS += -ldnsapi
+ LIBS_PRIVATE += -ldnsapi
}
integrity:SOURCES += kernel/qdnslookup_unix.cpp kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index e1a24a226f..8c16486878 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -189,7 +189,7 @@ QAuthenticator &QAuthenticator::operator=(const QAuthenticator &other)
d->realm = other.d->realm;
d->method = other.d->method;
d->options = other.d->options;
- } else {
+ } else if (d->phase == QAuthenticatorPrivate::Start) {
delete d;
d = 0;
}
@@ -267,7 +267,8 @@ void QAuthenticator::detach()
return;
}
- d->phase = QAuthenticatorPrivate::Start;
+ if (d->phase == QAuthenticatorPrivate::Done)
+ d->phase = QAuthenticatorPrivate::Start;
}
/*!
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index f1893ae322..e16d7e557e 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -53,6 +53,7 @@
#include <string.h>
#include <qt_windows.h>
#include <wininet.h>
+#include <lmcons.h>
#include "qnetworkfunctions_wince.h"
/*
@@ -115,48 +116,38 @@ typedef HINTERNET (WINAPI * PtrWinHttpOpen)(LPCWSTR, DWORD, LPCWSTR, LPCWSTR,DWO
typedef BOOL (WINAPI * PtrWinHttpGetDefaultProxyConfiguration)(WINHTTP_PROXY_INFO*);
typedef BOOL (WINAPI * PtrWinHttpGetIEProxyConfigForCurrentUser)(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG*);
typedef BOOL (WINAPI * PtrWinHttpCloseHandle)(HINTERNET);
-typedef SC_HANDLE (WINAPI * PtrOpenSCManager)(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess);
-typedef BOOL (WINAPI * PtrEnumServicesStatusEx)(SC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded,
- LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCWSTR pszGroupName);
typedef BOOL (WINAPI * PtrCloseServiceHandle)(SC_HANDLE hSCObject);
static PtrWinHttpGetProxyForUrl ptrWinHttpGetProxyForUrl = 0;
static PtrWinHttpOpen ptrWinHttpOpen = 0;
static PtrWinHttpGetDefaultProxyConfiguration ptrWinHttpGetDefaultProxyConfiguration = 0;
static PtrWinHttpGetIEProxyConfigForCurrentUser ptrWinHttpGetIEProxyConfigForCurrentUser = 0;
static PtrWinHttpCloseHandle ptrWinHttpCloseHandle = 0;
-static PtrOpenSCManager ptrOpenSCManager = 0;
-static PtrEnumServicesStatusEx ptrEnumServicesStatusEx = 0;
-static PtrCloseServiceHandle ptrCloseServiceHandle = 0;
+#ifndef Q_OS_WINCE
static bool currentProcessIsService()
{
- if (!ptrOpenSCManager || !ptrEnumServicesStatusEx|| !ptrCloseServiceHandle)
- return false;
-
- SC_HANDLE hSCM = ptrOpenSCManager(0, 0, SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);
- if (!hSCM)
- return false;
-
- ULONG bufSize = 0;
- ULONG nbServices = 0;
- if (ptrEnumServicesStatusEx(hSCM, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_ACTIVE, 0, bufSize, &bufSize, &nbServices, 0, 0))
- return false; //error case
-
- LPENUM_SERVICE_STATUS_PROCESS info = reinterpret_cast<LPENUM_SERVICE_STATUS_PROCESS>(malloc(bufSize));
- bool foundService = false;
- if (ptrEnumServicesStatusEx(hSCM, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_ACTIVE, (LPBYTE)info, bufSize, &bufSize, &nbServices, 0, 0)) {
- DWORD currProcId = GetCurrentProcessId();
- for (ULONG i = 0; i < nbServices && !foundService; i++) {
- if (info[i].ServiceStatusProcess.dwProcessId == currProcId)
- foundService = true;
+ typedef BOOL (WINAPI *PtrGetUserName)(LPTSTR lpBuffer, LPDWORD lpnSize);
+ typedef BOOL (WINAPI *PtrLookupAccountName)(LPCTSTR lpSystemName, LPCTSTR lpAccountName, PSID Sid,
+ LPDWORD cbSid, LPTSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse);
+ static PtrGetUserName ptrGetUserName = (PtrGetUserName)QSystemLibrary::resolve(QLatin1String("Advapi32"), "GetUserNameW");
+ static PtrLookupAccountName ptrLookupAccountName = (PtrLookupAccountName)QSystemLibrary::resolve(QLatin1String("Advapi32"), "LookupAccountNameW");
+
+ if (ptrGetUserName && ptrLookupAccountName) {
+ wchar_t userName[UNLEN + 1] = L"";
+ DWORD size = UNLEN;
+ if (ptrGetUserName(userName, &size)) {
+ SID_NAME_USE type = SidTypeUser;
+ DWORD dummy = MAX_PATH;
+ wchar_t dummyStr[MAX_PATH] = L"";
+ PSID psid = 0;
+ if (ptrLookupAccountName(NULL, userName, &psid, &dummy, dummyStr, &dummy, &type))
+ return type != SidTypeUser; //returns true if the current user is not a user
}
}
-
- ptrCloseServiceHandle(hSCM);
- free(info);
- return foundService;
+ return false;
}
+#endif // ! Q_OS_WINCE
static QStringList splitSpaceSemicolon(const QString &source)
{
@@ -418,9 +409,6 @@ void QWindowsSystemProxy::init()
ptrWinHttpGetProxyForUrl = (PtrWinHttpGetProxyForUrl)lib.resolve("WinHttpGetProxyForUrl");
ptrWinHttpGetDefaultProxyConfiguration = (PtrWinHttpGetDefaultProxyConfiguration)lib.resolve("WinHttpGetDefaultProxyConfiguration");
ptrWinHttpGetIEProxyConfigForCurrentUser = (PtrWinHttpGetIEProxyConfigForCurrentUser)lib.resolve("WinHttpGetIEProxyConfigForCurrentUser");
- ptrOpenSCManager = (PtrOpenSCManager) QSystemLibrary(L"advapi32").resolve("OpenSCManagerW");
- ptrEnumServicesStatusEx = (PtrEnumServicesStatusEx) QSystemLibrary(L"advapi32").resolve("EnumServicesStatusExW");
- ptrCloseServiceHandle = (PtrCloseServiceHandle) QSystemLibrary(L"advapi32").resolve("CloseServiceHandle");
// Try to obtain the Internet Explorer configuration.
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxyConfig;
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index 0204a92999..c0c6d750d9 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -40,7 +40,7 @@ win32:SOURCES += socket/qnativesocketengine_win.cpp \
socket/qlocalsocket_win.cpp \
socket/qlocalserver_win.cpp
-win32:!wince*:LIBS += -ladvapi32
+win32:!wince*: LIBS_PRIVATE += -ladvapi32
wince*: {
SOURCES -= socket/qlocalsocket_win.cpp \
diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp
index ec771e1f49..5b7274e3e6 100644
--- a/src/network/ssl/qssl.cpp
+++ b/src/network/ssl/qssl.cpp
@@ -164,7 +164,7 @@ QT_BEGIN_NAMESPACE
\value SslOptionDisableSessionSharing Disables SSL session sharing via
the session ID handshake attribute.
\value SslOptionDisableSessionPersistence Disables storing the SSL session
- in ASN.1 format as returned by QSslConfiguration::session(). Enabling
+ in ASN.1 format as returned by QSslConfiguration::sessionTicket(). Enabling
this feature adds memory overhead of approximately 1K per used session
ticket.
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index 8979c48d5d..4aad7c04c5 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -602,19 +602,19 @@ bool QSslConfiguration::testSslOption(QSsl::SslOption option) const
\since 5.2
If QSsl::SslOptionDisableSessionPersistence was turned off, this
- function returns the session used in the SSL handshake in ASN.1
- format, suitable to e.g. be persisted to disk. If no session was
+ function returns the session ticket used in the SSL handshake in ASN.1
+ format, suitable to e.g. be persisted to disk. If no session ticket was
used or QSsl::SslOptionDisableSessionPersistence was not turned off,
this function returns an empty QByteArray.
- \b{Note:} When persisting the session to disk or similar, be
+ \b{Note:} When persisting the session ticket to disk or similar, be
careful not to expose the session to a potential attacker, as
knowledge of the session allows for eavesdropping on data
encrypted with the session parameters.
- \sa setSession(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
+ \sa setSessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
*/
-QByteArray QSslConfiguration::session() const
+QByteArray QSslConfiguration::sessionTicket() const
{
return d->sslSession;
}
@@ -622,16 +622,16 @@ QByteArray QSslConfiguration::session() const
/*!
\since 5.2
- Sets the session to be used in an SSL handshake.
+ Sets the session ticket to be used in an SSL handshake.
QSsl::SslOptionDisableSessionPersistence must be turned off
- for this to work, and \a session must be in ASN.1 format
- as returned by session().
+ for this to work, and \a sessionTicket must be in ASN.1 format
+ as returned by sessionTicket().
- \sa session(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
+ \sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
*/
-void QSslConfiguration::setSession(const QByteArray &session)
+void QSslConfiguration::setSessionTicket(const QByteArray &sessionTicket)
{
- d->sslSession = session;
+ d->sslSession = sessionTicket;
}
/*!
@@ -645,7 +645,7 @@ void QSslConfiguration::setSession(const QByteArray &session)
QSsl::SslOptionDisableSessionPersistence was not turned off,
this function returns -1.
- \sa session(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
+ \sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()
*/
int QSslConfiguration::sessionTicketLifeTimeHint() const
{
diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h
index 949ce70d4c..a48eceb63e 100644
--- a/src/network/ssl/qsslconfiguration.h
+++ b/src/network/ssl/qsslconfiguration.h
@@ -124,8 +124,8 @@ public:
void setSslOption(QSsl::SslOption option, bool on);
bool testSslOption(QSsl::SslOption option) const;
- QByteArray session() const;
- void setSession(const QByteArray &session);
+ QByteArray sessionTicket() const;
+ void setSessionTicket(const QByteArray &sessionTicket);
int sessionTicketLifeTimeHint() const;
static QSslConfiguration defaultConfiguration();
diff --git a/src/network/ssl/qsslcontext.cpp b/src/network/ssl/qsslcontext.cpp
index 6d281c390d..037ee8c672 100644
--- a/src/network/ssl/qsslcontext.cpp
+++ b/src/network/ssl/qsslcontext.cpp
@@ -260,8 +260,8 @@ init_context:
q_SSL_CTX_set_verify_depth(sslContext->ctx, sslContext->sslConfiguration.peerVerifyDepth());
// set persisted session if the user set it
- if (!configuration.session().isEmpty())
- sslContext->setSessionASN1(configuration.session());
+ if (!configuration.sessionTicket().isEmpty())
+ sslContext->setSessionASN1(configuration.sessionTicket());
return sslContext;
}
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 24843e9f92..38b493a769 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -903,7 +903,7 @@ void QSslSocket::setSslConfiguration(const QSslConfiguration &configuration)
d->configuration.peerVerifyMode = configuration.peerVerifyMode();
d->configuration.protocol = configuration.protocol();
d->configuration.sslOptions = configuration.d->sslOptions;
- d->configuration.sslSession = configuration.session();
+ d->configuration.sslSession = configuration.sessionTicket();
d->configuration.sslSessionTicketLifeTimeHint = configuration.sessionTicketLifeTimeHint();
// if the CA certificates were set explicitly (either via
diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
index 0fe231357b..eb8268515e 100644
--- a/src/network/ssl/ssl.pri
+++ b/src/network/ssl/ssl.pri
@@ -45,5 +45,5 @@ android:!android-no-sdk: SOURCES += ssl/qsslsocket_openssl_android.cpp
QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS
LIBS_PRIVATE += $$OPENSSL_LIBS
- windows:LIBS += -lcrypt32
+ win32: LIBS_PRIVATE += -lcrypt32
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 8ee0a8b290..b1fbe2ac71 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2308,10 +2308,18 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
QImage::Format target_format = img.format();
bool premul = options & QGLContext::PremultipliedAlphaBindOption;
+ bool needsbyteswap = true;
GLenum externalFormat;
GLuint pixel_type;
- if (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat)) {
+ if (target_format == QImage::Format_RGBA8888
+ || target_format == QImage::Format_RGBA8888_Premultiplied
+ || target_format == QImage::Format_RGBX8888) {
+ externalFormat = GL_RGBA;
+ pixel_type = GL_UNSIGNED_BYTE;
+ needsbyteswap = false;
+ } else if (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat)) {
externalFormat = GL_BGRA;
+ needsbyteswap = false;
if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2)
pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV;
else
@@ -2338,14 +2346,34 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
#endif
}
break;
+ case QImage::Format_RGBA8888:
+ if (premul) {
+ img = img.convertToFormat(target_format = QImage::Format_RGBA8888_Premultiplied);
+#ifdef QGL_BIND_TEXTURE_DEBUG
+ printf(" - converted RGBA8888 -> RGBA8888_Premultiplied (%d ms) \n", time.elapsed());
+#endif
+ }
+ break;
+ case QImage::Format_RGBA8888_Premultiplied:
+ if (!premul) {
+ img = img.convertToFormat(target_format = QImage::Format_RGBA8888);
+#ifdef QGL_BIND_TEXTURE_DEBUG
+ printf(" - converted RGBA8888_Premultiplied -> RGBA8888 (%d ms) \n", time.elapsed());
+#endif
+ }
+ break;
case QImage::Format_RGB16:
pixel_type = GL_UNSIGNED_SHORT_5_6_5;
externalFormat = GL_RGB;
internalFormat = GL_RGB;
+ needsbyteswap = false;
break;
case QImage::Format_RGB32:
+ case QImage::Format_RGBX8888:
break;
default:
+ // Ideally more formats would be converted directly to an RGBA8888 format,
+ // but we are only guaranteed to have a fast conversion to an ARGB format.
if (img.hasAlphaChannel()) {
img = img.convertToFormat(premul
? QImage::Format_ARGB32_Premultiplied
@@ -2383,10 +2411,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
#endif
}
- if (externalFormat == GL_RGBA) {
+ if (needsbyteswap) {
// The only case where we end up with a depth different from
- // 32 in the switch above is for the RGB16 case, where we set
- // the format to GL_RGB
+ // 32 in the switch above is for the RGB16 case, where we do
+ // not need a byteswap.
Q_ASSERT(img.depth() == 32);
qgl_byteSwapImage(img, pixel_type);
#ifdef QGL_BIND_TEXTURE_DEBUG
@@ -3013,7 +3041,7 @@ bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *contex
If this context is a valid context in an overlay plane, returns
the plane's transparent color. Otherwise returns an \l{QColor::isValid()}{invalid} color.
- The returned color's \l{QColor::pixel()}{pixel} value is
+ The returned color's \l{QColormap::pixel()}{pixel} value is
the index of the transparent color in the colormap of the overlay
plane. (Naturally, the color's RGB values are meaningless.)
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp
index 50baf6f06d..fe6ba2b215 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience.cpp
+++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp
@@ -232,17 +232,28 @@ EGLConfig QEglConfigChooser::chooseConfig()
configureAttributes.append(surfaceType());
configureAttributes.append(EGL_RENDERABLE_TYPE);
- if (m_format.renderableType() == QSurfaceFormat::OpenVG)
+ switch (m_format.renderableType()) {
+ case QSurfaceFormat::OpenVG:
configureAttributes.append(EGL_OPENVG_BIT);
+ break;
#ifdef EGL_VERSION_1_4
- else if (m_format.renderableType() == QSurfaceFormat::OpenGL)
+# if !defined(QT_OPENGL_ES_2)
+ case QSurfaceFormat::DefaultRenderableType:
+# endif
+ case QSurfaceFormat::OpenGL:
configureAttributes.append(EGL_OPENGL_BIT);
+ break;
#endif
- else if (m_format.majorVersion() == 1)
- configureAttributes.append(EGL_OPENGL_ES_BIT);
- else
+ case QSurfaceFormat::OpenGLES:
+ if (m_format.majorVersion() == 1) {
+ configureAttributes.append(EGL_OPENGL_ES_BIT);
+ break;
+ }
+ // fall through
+ default:
configureAttributes.append(EGL_OPENGL_ES2_BIT);
-
+ break;
+ }
configureAttributes.append(EGL_NONE);
EGLConfig cfg = 0;
@@ -336,7 +347,11 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config,
if (referenceFormat.renderableType() == QSurfaceFormat::OpenVG && (renderableType & EGL_OPENVG_BIT))
format.setRenderableType(QSurfaceFormat::OpenVG);
#ifdef EGL_VERSION_1_4
- else if (referenceFormat.renderableType() == QSurfaceFormat::OpenGL && (renderableType & EGL_OPENGL_BIT))
+ else if ((referenceFormat.renderableType() == QSurfaceFormat::OpenGL
+# if !defined(QT_OPENGL_ES_2)
+ || referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType
+# endif
+ ) && (renderableType & EGL_OPENGL_BIT))
format.setRenderableType(QSurfaceFormat::OpenGL);
#endif
else
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index 2bfa7a8a02..ec740b87db 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -49,14 +49,23 @@
static inline void bindApi(const QSurfaceFormat &format)
{
- if (format.renderableType() == QSurfaceFormat::OpenVG)
+ switch (format.renderableType()) {
+ case QSurfaceFormat::OpenVG:
eglBindAPI(EGL_OPENVG_API);
+ break;
#ifdef EGL_VERSION_1_4
- else if (format.renderableType() == QSurfaceFormat::OpenGL)
+# if !defined(QT_OPENGL_ES_2)
+ case QSurfaceFormat::DefaultRenderableType:
+# endif
+ case QSurfaceFormat::OpenGL:
eglBindAPI(EGL_OPENGL_API);
+ break;
#endif
- else
+ case QSurfaceFormat::OpenGLES:
+ default:
eglBindAPI(EGL_OPENGL_ES_API);
+ break;
+ }
}
QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
diff --git a/src/platformsupport/fbconvenience/qfbwindow.cpp b/src/platformsupport/fbconvenience/qfbwindow.cpp
index 8b6186db79..98c16e61c8 100644
--- a/src/platformsupport/fbconvenience/qfbwindow.cpp
+++ b/src/platformsupport/fbconvenience/qfbwindow.cpp
@@ -48,17 +48,14 @@
QT_BEGIN_NAMESPACE
QFbWindow::QFbWindow(QWindow *window)
- : QPlatformWindow(window), mBackingStore(0)
+ : QPlatformWindow(window), mBackingStore(0), mWindowState(Qt::WindowNoState)
{
static QAtomicInt winIdGenerator(1);
mWindowId = winIdGenerator.fetchAndAddRelaxed(1);
-
- platformScreen()->addWindow(this);
}
QFbWindow::~QFbWindow()
{
- platformScreen()->removeWindow(this);
}
QFbScreen *QFbWindow::platformScreen() const
@@ -86,6 +83,11 @@ void QFbWindow::setVisible(bool visible)
setGeometry(platformScreen()->availableGeometry());
}
QPlatformWindow::setVisible(visible);
+
+ if (visible)
+ platformScreen()->addWindow(this);
+ else
+ platformScreen()->removeWindow(this);
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 72486c097d..38c44e3f35 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -305,12 +305,20 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, QChar::Script
return NULL;
}
+static void releaseFontData(void* info, const void* data, size_t size)
+{
+ Q_UNUSED(data);
+ Q_UNUSED(size);
+ delete (QByteArray*)info;
+}
+
QFontEngine *QCoreTextFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
{
Q_UNUSED(hintingPreference);
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(NULL,
- fontData.constData(), fontData.size(), NULL);
+ QByteArray* fontDataCopy = new QByteArray(fontData);
+ QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
+ fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
CGFontRef cgFont = CGFontCreateWithDataProvider(dataProvider);
@@ -474,8 +482,9 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
CTFontRef font = NULL;
if (!fontData.isEmpty()) {
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(NULL,
- fontData.constData(), fontData.size(), NULL);
+ QByteArray* fontDataCopy = new QByteArray(fontData);
+ QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
+ fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
CGFontRef cgFont = CGFontCreateWithDataProvider(dataProvider);
if (cgFont) {
CFErrorRef error;
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index b97923c4b6..0841544208 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -224,7 +224,7 @@ void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtc
{
QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease),
qtcode, modifiers, nativecode + 8, 0, int(modifiers),
- QString(unicode), autoRepeat);
+ (unicode != 0xffff ) ? QString(unicode) : QString(), autoRepeat);
}
QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat)
diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri
index a6b90937f2..16e1a981fa 100644
--- a/src/platformsupport/input/evdevtouch/evdevtouch.pri
+++ b/src/platformsupport/input/evdevtouch/evdevtouch.pri
@@ -10,4 +10,4 @@ contains(QT_CONFIG, libudev) {
# DEFINES += USE_MTDEV
-contains(DEFINES, USE_MTDEV): LIBS += -lmtdev
+contains(DEFINES, USE_MTDEV): LIBS_PRIVATE += -lmtdev
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index c0d62ccc16..b1df6d816a 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -221,41 +221,6 @@ QString QAccessibleTabBar::text(QAccessible::Text t) const
return QString();
}
-/*!
- Selects the item with index \a child if \a on is true; otherwise
- unselects it. If \a extend is true and the selection mode is not
- \c Single and there is an existing selection, the selection is
- extended to include all the items from the existing selection up
- to and including the item with index \a child. Returns \c true if a
- selection was made or extended; otherwise returns \c false.
-
- \sa selection(), clearSelection()
-*/
-bool QAccessibleTabBar::setSelected(int child, bool on, bool extend)
-{
- if (!child || !on || extend || child > tabBar()->count())
- return false;
-
- if (!tabBar()->isTabEnabled(child - 1))
- return false;
- tabBar()->setCurrentIndex(child - 1);
- return true;
-}
-
-/*!
- Returns a (possibly empty) list of indexes of the items selected
- in the list box.
-
- \sa setSelected(), clearSelection()
-*/
-QVector<int> QAccessibleTabBar::selection() const
-{
- QVector<int> array;
- if (tabBar()->currentIndex() != -1)
- array +=tabBar()->currentIndex() + 1;
- return array;
-}
-
#endif // QT_NO_TABBAR
#ifndef QT_NO_COMBOBOX
diff --git a/src/plugins/accessible/widgets/complexwidgets.h b/src/plugins/accessible/widgets/complexwidgets.h
index 164bc5b6d9..00186282f3 100644
--- a/src/plugins/accessible/widgets/complexwidgets.h
+++ b/src/plugins/accessible/widgets/complexwidgets.h
@@ -105,9 +105,6 @@ public:
int childCount() const Q_DECL_OVERRIDE;
QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- bool setSelected(int child, bool on, bool extend);
- QVector<int> selection() const;
-
QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE;
int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index 459a450222..3d1b281620 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -101,7 +101,6 @@ void TableGenerator::findComposeFile()
qDebug() << "Using Compose file from: " << composeFile;
#endif
}
-
// check if user’s home directory has a file named .XCompose
if (!found && cleanState()) {
QString composeFile = qgetenv("HOME") + QStringLiteral("/.XCompose");
@@ -112,10 +111,12 @@ void TableGenerator::findComposeFile()
qDebug() << "Using Compose file from: " << composeFile;
#endif
}
-
// check for the system provided compose files
if (!found && cleanState()) {
- QString table = readLocaleMappings(locale().toUpper().toUtf8());
+ QByteArray loc = locale().toUpper().toUtf8();
+ QString table = readLocaleMappings(loc);
+ if (table.isEmpty())
+ table = readLocaleMappings(readLocaleAliases(loc));
if (cleanState()) {
if (table.isEmpty())
@@ -178,8 +179,11 @@ QString TableGenerator::locale() const
QString TableGenerator::readLocaleMappings(const QByteArray &locale)
{
- QFile mappings(systemComposeDir() + QLatin1String("/compose.dir"));
QString file;
+ if (locale.isEmpty())
+ return file;
+
+ QFile mappings(systemComposeDir() + QLatin1String("/compose.dir"));
if (mappings.open(QIODevice::ReadOnly)) {
const int localeNameLength = locale.size();
const char * const localeData = locale.constData();
@@ -209,9 +213,8 @@ QString TableGenerator::readLocaleMappings(const QByteArray &locale)
while (*line && *line != ' ' && *line != '\t' && *line != '\n')
++line;
*line = '\0';
-
if (localeNameLength == (line - lc) && !strncasecmp(lc, localeData, line - lc)) {
- file = QString::fromUtf8(l, composeFileNameEnd - l);
+ file = QString::fromLocal8Bit(l, composeFileNameEnd - l);
break;
}
}
@@ -221,6 +224,47 @@ QString TableGenerator::readLocaleMappings(const QByteArray &locale)
return file;
}
+QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale)
+{
+ QFile aliases(systemComposeDir() + QLatin1String("/locale.alias"));
+ QByteArray fullLocaleName;
+ if (aliases.exists()) {
+ aliases.open(QIODevice::ReadOnly);
+ while (!aliases.atEnd()) {
+ char l[1024];
+ int read = aliases.readLine(l, sizeof(l));
+ char *line = l;
+ if (read && ((*line >= 'a' && *line <= 'z') ||
+ (*line >= 'A' && *line <= 'Z'))) {
+ const char *alias = line;
+ while (*line && *line != ':' && *line != ' ' && *line != '\t')
+ ++line;
+ if (!*line)
+ continue;
+ *line = 0;
+ if (locale.size() == (line - alias)
+ && !strncasecmp(alias, locale.constData(), line - alias)) {
+ // found a match for alias, read the real locale name
+ ++line;
+ while (*line && (*line == ' ' || *line == '\t'))
+ ++line;
+ const char *fullName = line;
+ while (*line && *line != ' ' && *line != '\t' && *line != '\n')
+ ++line;
+ *line = 0;
+ fullLocaleName = fullName;
+#ifdef DEBUG_GENERATOR
+ qDebug() << "Alias for: " << alias << "is: " << fullLocaleName;
+ break;
+#endif
+ }
+ }
+ }
+ aliases.close();
+ }
+ return fullLocaleName;
+}
+
bool TableGenerator::processFile(QString composeFileName)
{
QFile composeFile(composeFileName);
@@ -255,7 +299,7 @@ void TableGenerator::parseComposeFile(QFile *composeFile)
if (*line == '<')
parseKeySequence(line);
else if (!strncmp(line, "include", 7))
- parseIncludeInstruction(QString::fromUtf8(line));
+ parseIncludeInstruction(QString::fromLocal8Bit(line));
}
composeFile->close();
@@ -309,7 +353,7 @@ ushort TableGenerator::keysymToUtf8(quint32 sym)
qDebug() << QString("keysym - 0x%1 : utf8 - %2").arg(QString::number(sym, 16))
.arg(codec->toUnicode(chars));
#endif
- return QString::fromUtf8(chars).at(0).unicode();
+ return QString::fromLocal8Bit(chars).at(0).unicode();
}
static inline int fromBase8(const char *s, const char *end)
@@ -378,13 +422,13 @@ void TableGenerator::parseKeySequence(char *line)
// handle direct text encoded in the locale
if (*composeValue == '\\')
++composeValue;
- elem.value = QString::fromUtf8(composeValue).at(0).unicode();
+ elem.value = QString::fromLocal8Bit(composeValue).at(0).unicode();
++composeValue;
}
#ifdef DEBUG_GENERATOR
// find the comment
- elem.comment = QString::fromUtf8(composeValueEnd + 1).trimmed();
+ elem.comment = QString::fromLocal8Bit(composeValueEnd + 1).trimmed();
#endif
// find the key sequence and convert to X11 keysym
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h
index aa65b7b895..248c09f3ea 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h
@@ -122,6 +122,7 @@ protected:
ushort keysymToUtf8(quint32 sym);
QString readLocaleMappings(const QByteArray &locale);
+ QByteArray readLocaleAliases(const QByteArray &locale);
void initPossibleLocations();
bool cleanState() const { return ((m_state & NoErrors) == NoErrors); }
QString locale() const;
diff --git a/src/plugins/platforms/android/opengl/opengl.pro b/src/plugins/platforms/android/opengl/opengl.pro
index 301c8e6e4c..ea050ca3a0 100644
--- a/src/plugins/platforms/android/opengl/opengl.pro
+++ b/src/plugins/platforms/android/opengl/opengl.pro
@@ -20,11 +20,13 @@ INCLUDEPATH += $$PWD/../src/opengl/
HEADERS += \
$$PWD/../src/opengl/qandroidopenglcontext.h \
- $$PWD/../src/opengl/qandroidopenglplatformwindow.h
+ $$PWD/../src/opengl/qandroidopenglplatformwindow.h \
+ $$PWD/../src/opengl/qandroidopenglplatformscreen.h
SOURCES += \
$$PWD/../src/opengl/qandroidopenglcontext.cpp \
- $$PWD/../src/opengl/qandroidopenglplatformwindow.cpp
+ $$PWD/../src/opengl/qandroidopenglplatformwindow.cpp \
+ $$PWD/../src/opengl/qandroidopenglplatformscreen.cpp
include($$PWD/../../eglfs/eglfs.pri)
include($$PWD/../src/src.pri)
diff --git a/src/plugins/platforms/android/src/androidjniaccessibility.cpp b/src/plugins/platforms/android/src/androidjniaccessibility.cpp
index a27d9f5aed..b987c49c9c 100644
--- a/src/plugins/platforms/android/src/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/src/androidjniaccessibility.cpp
@@ -46,7 +46,7 @@
#include "qguiapplication.h"
#include "qwindow.h"
#include "qrect.h"
-#include "private/qaccessible2_p.h"
+#include "QtGui/qaccessible.h"
#include "qdebug.h"
diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp
index 30d4e69afe..8ce95532d3 100644
--- a/src/plugins/platforms/android/src/androidjniinput.cpp
+++ b/src/plugins/platforms/android/src/androidjniinput.cpp
@@ -47,6 +47,10 @@
#include <QTouchEvent>
#include <QPointer>
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+# include <QDebug>
+#endif
+
using namespace QtAndroid;
namespace QtAndroidInput
@@ -63,12 +67,32 @@ namespace QtAndroidInput
static QPointer<QWindow> m_mouseGrabber;
+ static int m_lastCursorPos = -1;
+
void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd)
{
AttachedJNIEnv env;
if (!env.jniEnv)
return;
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd;
+#endif
+ if (candidatesStart == -1 && candidatesEnd == -1 && selStart == selEnd) {
+ // Qt only gives us position inside the block, so if we move to the
+ // same position in another block, the Android keyboard will believe
+ // we have not changed position, and be terribly confused.
+ if (selStart == m_lastCursorPos) {
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << ">>> FAKEUPDATESELECTION" << selStart+1;
+#endif
+ env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID,
+ selStart+1, selEnd+1, candidatesStart, candidatesEnd);
+ }
+ m_lastCursorPos = selStart;
+ } else {
+ m_lastCursorPos = -1;
+ }
env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID,
selStart, selEnd, candidatesStart, candidatesEnd);
}
@@ -86,6 +110,9 @@ namespace QtAndroidInput
width,
height,
inputHints);
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << "@@@ SHOWSOFTWAREKEYBOARD" << left << top << width << height << inputHints;
+#endif
}
void resetSoftwareKeyboard()
@@ -95,6 +122,9 @@ namespace QtAndroidInput
return;
env.jniEnv->CallStaticVoidMethod(applicationClass(), m_resetSoftwareKeyboardMethodID);
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << "@@@ RESETSOFTWAREKEYBOARD";
+#endif
}
void hideSoftwareKeyboard()
@@ -104,6 +134,9 @@ namespace QtAndroidInput
return;
env.jniEnv->CallStaticVoidMethod(applicationClass(), m_hideSoftwareKeyboardMethodID);
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << "@@@ HIDESOFTWAREKEYBOARD";
+#endif
}
bool isSoftwareKeyboardVisible()
@@ -112,7 +145,11 @@ namespace QtAndroidInput
if (!env.jniEnv)
return false;
- return env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_isSoftwareKeyboardVisibleMethodID);
+ bool visibility = env.jniEnv->CallStaticBooleanMethod(applicationClass(), m_isSoftwareKeyboardVisibleMethodID);
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << "@@@ ISSOFTWAREKEYBOARDVISIBLE" << visibility;
+#endif
+ return visibility;
}
@@ -511,6 +548,15 @@ namespace QtAndroidInput
false);
}
+ static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean /*visibility*/)
+ {
+ QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
+ if (inputContext)
+ inputContext->emitInputPanelVisibleChanged();
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << "@@@ KEYBOARDVISIBILITYCHANGED" << inputContext;
+#endif
+ }
static JNINativeMethod methods[] = {
{"touchBegin","(I)V",(void*)touchBegin},
@@ -521,7 +567,8 @@ namespace QtAndroidInput
{"mouseMove", "(III)V", (void *)mouseMove},
{"longPress", "(III)V", (void *)longPress},
{"keyDown", "(III)V", (void *)keyDown},
- {"keyUp", "(III)V", (void *)keyUp}
+ {"keyUp", "(III)V", (void *)keyUp},
+ {"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged}
};
#define GET_AND_CHECK_STATIC_METHOD(VAR, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp
index 5c9ca798a8..3064e5d4e2 100644
--- a/src/plugins/platforms/android/src/androidjnimain.cpp
+++ b/src/plugins/platforms/android/src/androidjnimain.cpp
@@ -40,6 +40,7 @@
**
****************************************************************************/
+#include <QtGui/private/qguiapplication_p.h>
#include <dlfcn.h>
#include <pthread.h>
@@ -59,6 +60,7 @@
#include "androidjniinput.h"
#include "androidjniclipboard.h"
#include "androidjnimenu.h"
+#include "qandroidplatformdialoghelpers.h"
#include "qandroidplatformintegration.h"
#include <QtWidgets/QApplication>
@@ -97,6 +99,9 @@ static jmethodID m_createBitmapMethodID = 0;
static jobject m_ARGB_8888_BitmapConfigValue = 0;
static jobject m_RGB_565_BitmapConfigValue = 0;
+jmethodID m_setFullScreenMethodID = 0;
+static bool m_statusBarShowing = true;
+
static jclass m_bitmapDrawableClass = 0;
static jmethodID m_bitmapDrawableConstructorMethodID = 0;
@@ -111,8 +116,6 @@ static jobject m_surface = NULL;
static EGLNativeWindowType m_nativeWindow = 0;
static QSemaphore m_waitForWindowSemaphore;
static bool m_waitForWindow = false;
-
-static jfieldID m_surfaceFieldID = 0;
#endif
@@ -247,17 +250,6 @@ namespace QtAndroid
m_surfaceMutex.unlock();
return m_nativeWindow;
}
-
- QSize nativeWindowSize()
- {
- if (m_nativeWindow == 0)
- return QAndroidPlatformIntegration::defaultDesktopSize();
-
- int width = ANativeWindow_getWidth(m_nativeWindow);
- int height = ANativeWindow_getHeight(m_nativeWindow);
-
- return QSize(width, height);
- }
#endif
void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration)
@@ -323,6 +315,36 @@ namespace QtAndroid
return m_activityObject;
}
+ void showStatusBar()
+ {
+ if (m_statusBarShowing)
+ return;
+
+ QtAndroid::AttachedJNIEnv env;
+ if (env.jniEnv == 0) {
+ qWarning("Failed to get JNI Environment.");
+ return;
+ }
+
+ env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, false);
+ m_statusBarShowing = true;
+ }
+
+ void hideStatusBar()
+ {
+ if (!m_statusBarShowing)
+ return;
+
+ QtAndroid::AttachedJNIEnv env;
+ if (env.jniEnv == 0) {
+ qWarning("Failed to get JNI Environment.");
+ return;
+ }
+
+ env.jniEnv->CallStaticVoidMethod(m_applicationClass, m_setFullScreenMethodID, true);
+ m_statusBarShowing = false;
+ }
+
void setApplicationActive()
{
if (m_activityActive)
@@ -564,12 +586,16 @@ static void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface)
m_waitForWindowSemaphore.release();
if (m_androidPlatformIntegration) {
- QSize size = QtAndroid::nativeWindowSize();
+ // Use the desktop size.
+ // On some devices, the getters for the native window size gives wrong values
+ QSize size = QAndroidPlatformIntegration::defaultDesktopSize();
QPlatformScreen *screen = m_androidPlatformIntegration->screen();
QRect geometry(QPoint(0, 0), size);
- QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry);
- QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry);
+ if (screen) {
+ QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry);
+ QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry);
+ }
if (!sameNativeWindow) {
m_surfaceMutex.unlock();
@@ -666,7 +692,7 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state
{
m_activityActive = (state == Qt::ApplicationActive);
- if (!m_androidPlatformIntegration)
+ if (!m_androidPlatformIntegration || !QGuiApplicationPrivate::platformIntegration())
return;
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state));
@@ -762,6 +788,7 @@ static int registerNatives(JNIEnv *env)
jclass clazz;
FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNative");
m_applicationClass = static_cast<jclass>(env->NewGlobalRef(clazz));
+ GET_AND_CHECK_STATIC_METHOD(m_setFullScreenMethodID, m_applicationClass, "setFullScreen", "(Z)V");
if (env->RegisterNatives(m_applicationClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
__android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed");
@@ -770,11 +797,6 @@ static int registerNatives(JNIEnv *env)
GET_AND_CHECK_STATIC_METHOD(m_redrawSurfaceMethodID, m_applicationClass, "redrawSurface", "(IIII)V");
-#ifdef ANDROID_PLUGIN_OPENGL
- FIND_AND_CHECK_CLASS("android/view/Surface");
- GET_AND_CHECK_FIELD(m_surfaceFieldID, clazz, "mNativeSurface", "I");
-#endif
-
jmethodID methodID;
GET_AND_CHECK_STATIC_METHOD(methodID, m_applicationClass, "activity", "()Landroid/app/Activity;");
jobject activityObject = env->CallStaticObjectMethod(m_applicationClass, methodID);
@@ -814,6 +836,15 @@ static int registerNatives(JNIEnv *env)
return JNI_TRUE;
}
+jint androidApiLevel(JNIEnv *env)
+{
+ jclass clazz;
+ FIND_AND_CHECK_CLASS("android/os/Build$VERSION");
+ jfieldID fieldId;
+ GET_AND_CHECK_STATIC_FIELD(fieldId, clazz, "SDK_INT", "I");
+ return env->GetStaticIntField(clazz, fieldId);
+}
+
Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
{
typedef union {
@@ -836,11 +867,18 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
|| !QtAndroidInput::registerNatives(env)
|| !QtAndroidClipboard::registerNatives(env)
|| !QtAndroidMenu::registerNatives(env)
- || !QtAndroidAccessibility::registerNatives(env)) {
+ || !QtAndroidAccessibility::registerNatives(env)
+ || !QtAndroidDialogHelpers::registerNatives(env)) {
__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
return -1;
}
+ jint apiLevel = androidApiLevel(env);
+ if (apiLevel >= 16 && !QtAndroidAccessibility::registerNatives(env)) {
+ __android_log_print(ANDROID_LOG_FATAL, "Qt A11y", "registerNatives failed");
+ return -1;
+ }
+
m_javaVM = vm;
return JNI_VERSION_1_4;
}
diff --git a/src/plugins/platforms/android/src/androidjnimain.h b/src/plugins/platforms/android/src/androidjnimain.h
index 9a3d8a9607..11d3573404 100644
--- a/src/plugins/platforms/android/src/androidjnimain.h
+++ b/src/plugins/platforms/android/src/androidjnimain.h
@@ -69,13 +69,10 @@ namespace QtAndroid
void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration);
void setQtThread(QThread *thread);
- void setFullScreen(QWidget *widget);
-
#ifndef ANDROID_PLUGIN_OPENGL
void flushImage(const QPoint &pos, const QImage &image, const QRect &rect);
#else
EGLNativeWindowType nativeWindow(bool waitToCreate = true);
- QSize nativeWindowSize();
#endif
QWindow *topLevelWindowAt(const QPoint &globalPos);
@@ -90,6 +87,9 @@ namespace QtAndroid
void setApplicationActive();
+ void showStatusBar();
+ void hideStatusBar();
+
jobject createBitmap(QImage img, JNIEnv *env = 0);
jobject createBitmapDrawable(jobject bitmap, JNIEnv *env = 0);
diff --git a/src/plugins/platforms/android/src/androidjnimenu.cpp b/src/plugins/platforms/android/src/androidjnimenu.cpp
index bb180347c1..293af2b9cd 100644
--- a/src/plugins/platforms/android/src/androidjnimenu.cpp
+++ b/src/plugins/platforms/android/src/androidjnimenu.cpp
@@ -41,13 +41,14 @@
#include "androidjnimenu.h"
#include "androidjnimain.h"
-#include <qmutex.h>
-#include <qset.h>
-#include <qqueue.h>
-#include <android/log.h>
#include "qandroidplatformmenubar.h"
#include "qandroidplatformmenu.h"
-#include <qandroidplatformmenuitem.h>
+#include "qandroidplatformmenuitem.h"
+
+#include <QMutex>
+#include <QSet>
+#include <QQueue>
+#include <QWindow>
using namespace QtAndroid;
@@ -141,18 +142,17 @@ namespace QtAndroidMenu
void setActiveTopLevelWindow(QWindow *window)
{
+ Qt::WindowFlags flags = window ? window->flags() : Qt::WindowFlags();
+ bool isNonRegularWindow = flags & (Qt::Desktop | Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
+ if (isNonRegularWindow)
+ return;
+
QMutexLocker lock(&menuBarMutex);
if (activeTopLevelWindow == window)
return;
visibleMenuBar = 0;
activeTopLevelWindow = window;
-#ifdef ANDROID_PLUGIN_OPENGL
- //only one toplevel window, so the menu bar always belongs to us
- if (menuBars.size() == 1) {
- visibleMenuBar = *menuBars.constBegin(); //since QSet doesn't have first()
- } else
-#endif
foreach (QAndroidPlatformMenuBar *menuBar, menuBars) {
if (menuBar->parentWindow() == window) {
visibleMenuBar = menuBar;
@@ -173,8 +173,10 @@ namespace QtAndroidMenu
{
QMutexLocker lock(&menuBarMutex);
menuBars.remove(menuBar);
- if (visibleMenuBar == menuBar)
+ if (visibleMenuBar == menuBar) {
+ visibleMenuBar = 0;
resetMenuBar();
+ }
}
static QString removeAmpersandEscapes(QString s)
@@ -197,16 +199,18 @@ namespace QtAndroidMenu
env->CallObjectMethod(menuItem, setCheckedMenuItemMethodID, checked);
env->CallObjectMethod(menuItem, setEnabledMenuItemMethodID, enabled);
- if (!icon.isNull()) {
+ if (!icon.isNull()) { // isNull() only checks the d pointer, not the actual image data.
int sz = qMax(36, qgetenv("QT_ANDROID_APP_ICON_SIZE").toInt());
QImage img = icon.pixmap(QSize(sz,sz),
enabled
? QIcon::Normal
: QIcon::Disabled,
QIcon::On).toImage();
- env->CallObjectMethod(menuItem,
- setIconMenuItemMethodID,
- createBitmapDrawable(createBitmap(img, env), env));
+ if (!img.isNull()) { // Make sure we have a valid image.
+ env->CallObjectMethod(menuItem,
+ setIconMenuItemMethodID,
+ createBitmapDrawable(createBitmap(img, env), env));
+ }
}
env->CallObjectMethod(menuItem, setVisibleMenuItemMethodID, visible);
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
index 9d6d4003f7..6431914812 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
@@ -71,6 +71,8 @@ void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface)
if (size.isValid()) {
QRect geometry(QPoint(0, 0), size);
window->setGeometry(geometry);
+ QWindowSystemInterface::handleGeometryChange(window->window(), geometry);
+ QWindowSystemInterface::handleExposeEvent(window->window(), QRegion(geometry));
window->scheduleResize(QSize());
}
window->unlock();
diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp
index ea7c7faace..de4075feff 100644
--- a/src/plugins/platforms/qnx/qqnxrootwindow.h
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp
@@ -1,6 +1,6 @@
-/***************************************************************************
+/****************************************************************************
**
-** Copyright (C) 2011 - 2012 Research In Motion
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -39,47 +39,23 @@
**
****************************************************************************/
-#ifndef QQNXROOTWINDOW_H
-#define QQNXROOTWINDOW_H
-
-#include <QtCore/QByteArray>
-#include <QtCore/QRect>
-
-#include <screen/screen.h>
+#include "qandroidopenglplatformscreen.h"
+#include "qandroidopenglplatformwindow.h"
+#include "androidjnimenu.h"
QT_BEGIN_NAMESPACE
-class QQnxScreen;
-
-class QQnxRootWindow
+QAndroidOpenGLPlatformScreen::QAndroidOpenGLPlatformScreen(EGLDisplay display)
+ : QEglFSScreen(display)
{
-public:
- QQnxRootWindow(const QQnxScreen *screen);
- ~QQnxRootWindow();
-
- screen_window_t nativeHandle() const { return m_window; }
-
- void post() const;
- void flush() const;
-
- void setRotation(int rotation);
-
- void resize(const QSize &size);
+}
- void makeTranslucent();
-
- QByteArray groupName() const { return m_windowGroupName; }
-
-private:
- void createWindowGroup();
-
- const QQnxScreen *m_screen;
- screen_window_t m_window;
- QByteArray m_windowGroupName;
-
- bool m_translucent;
-};
+void QAndroidOpenGLPlatformScreen::topWindowChanged(QPlatformWindow *window)
+{
+ QtAndroidMenu::setActiveTopLevelWindow(window->window());
+ QAndroidOpenGLPlatformWindow *platformWindow = static_cast<QAndroidOpenGLPlatformWindow *>(window);
+ if (platformWindow != 0)
+ platformWindow->updateStatusBarVisibility();
+}
QT_END_NAMESPACE
-
-#endif // QQNXROOTWINDOW_H
diff --git a/config.tests/unix/gstreamer/gstreamer.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h
index 3864cdcb9f..e9251592aa 100644
--- a/config.tests/unix/gstreamer/gstreamer.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** 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$
** Commercial License Usage
@@ -39,17 +39,22 @@
**
****************************************************************************/
-#include <gst/gst.h>
-#include <gst/interfaces/propertyprobe.h>
-#include <gst/interfaces/xoverlay.h>
+#ifndef QANDROIDOPENGLPLATFORMSCREEN_H
+#define QANDROIDOPENGLPLATFORMSCREEN_H
-#if !defined(GST_VERSION_MAJOR) \
- || !defined(GST_VERSION_MINOR)
-# error "No GST_VERSION_* macros"
-#elif GST_VERION_MAJOR != 0 && GST_VERSION_MINOR != 10
-# error "Incompatible version of GStreamer found (Version 0.10.x is required)."
-#endif
+#include "qeglfsscreen.h"
-int main(int argc, char **argv)
+QT_BEGIN_NAMESPACE
+
+class QAndroidOpenGLPlatformScreen : public QEglFSScreen
{
-}
+public:
+ QAndroidOpenGLPlatformScreen(EGLDisplay display);
+
+protected:
+ void topWindowChanged(QPlatformWindow *window);
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDOPENGLPLATFORMSCREEN_H
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
index 4934047af9..6ed805174b 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
@@ -41,6 +41,7 @@
#include "qandroidopenglplatformwindow.h"
#include "androidjnimain.h"
+#include "qandroidplatformintegration.h"
#include <qpa/qwindowsysteminterface.h>
QT_BEGIN_NAMESPACE
@@ -52,6 +53,7 @@ QBasicAtomicInt QAndroidOpenGLPlatformWindow::m_referenceCount = Q_BASIC_ATOMIC_
QAndroidOpenGLPlatformWindow::QAndroidOpenGLPlatformWindow(QWindow *window)
: QEglFSWindow(window)
+ , m_state(Qt::WindowNoState)
{
}
@@ -110,7 +112,9 @@ void QAndroidOpenGLPlatformWindow::resetSurface()
{
lock();
- scheduleResize(QtAndroid::nativeWindowSize());
+ // Use the desktop size.
+ // On some devices, the getters for the native window size gives wrong values
+ scheduleResize(QAndroidPlatformIntegration::defaultDesktopSize());
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
unlock();
}
@@ -128,12 +132,38 @@ void QAndroidOpenGLPlatformWindow::destroy()
}
}
+void QAndroidOpenGLPlatformWindow::updateStatusBarVisibility()
+{
+ Qt::WindowFlags flags = window()->flags();
+ bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
+ if (!isNonRegularWindow) {
+ if (m_state & Qt::WindowFullScreen)
+ QtAndroid::hideStatusBar();
+ else if (m_state & Qt::WindowMaximized)
+ QtAndroid::showStatusBar();
+ }
+}
+
void QAndroidOpenGLPlatformWindow::raise()
{
+ updateStatusBarVisibility();
+}
+
+void QAndroidOpenGLPlatformWindow::setWindowState(Qt::WindowState state)
+{
+ if (m_state == state)
+ return;
+
+ m_state = state;
+ if (window()->isVisible())
+ updateStatusBarVisibility();
}
void QAndroidOpenGLPlatformWindow::setVisible(bool visible)
{
+ if (visible)
+ updateStatusBarVisibility();
+
QEglFSWindow::setVisible(visible);
// The Android Activity is activated before Qt is initialized, causing the application state to
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
index 9a25957ccd..e4ff0444d4 100644
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
+++ b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
@@ -66,16 +66,19 @@ public:
void invalidateSurface();
void resetSurface();
+ void setWindowState(Qt::WindowState state);
void setVisible(bool visible);
void destroy();
static void updateStaticNativeWindow();
+ void updateStatusBarVisibility();
private:
QSize m_scheduledResize;
QMutex m_lock;
+ Qt::WindowState m_state;
static QReadWriteLock m_staticSurfaceLock;
static EGLSurface m_staticSurface;
diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
index 338966eb40..278cd553f4 100644
--- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
+++ b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
@@ -82,7 +82,7 @@ EGLNativeDisplayType QEglFSAndroidHooks::platformDisplay() const
QSize QEglFSAndroidHooks::screenSize() const
{
- return QtAndroid::nativeWindowSize();
+ return QAndroidPlatformIntegration::defaultDesktopSize();
}
QSizeF QEglFSAndroidHooks::physicalScreenSize() const
@@ -120,7 +120,8 @@ EGLNativeWindowType QEglFSAndroidHooks::createNativeWindow(QPlatformWindow *plat
void QEglFSAndroidHooks::destroyNativeWindow(EGLNativeWindowType window)
{
- ANativeWindow_release(window);
+ if (window != 0)
+ ANativeWindow_release(window);
}
bool QEglFSAndroidHooks::hasCapability(QPlatformIntegration::Capability capability) const
diff --git a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp
index f3cb2586cc..95844fc649 100644
--- a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp
+++ b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.cpp
@@ -43,20 +43,32 @@
#include "androidjnimain.h"
#include <QCoreApplication>
+#include <QVector>
+
+typedef QVector<QString> FilesList;
+
+struct AndroidAssetDir
+{
+ AndroidAssetDir(AAssetDir* ad)
+ {
+ const char *fileName;
+ while ((fileName = AAssetDir_getNextFileName(ad)))
+ m_items.push_back(QString::fromUtf8(fileName));
+ AAssetDir_close(ad);
+ }
+ FilesList m_items;
+};
class AndroidAbstractFileEngineIterator: public QAbstractFileEngineIterator
{
public:
AndroidAbstractFileEngineIterator(QDir::Filters filters,
const QStringList &nameFilters,
- AAssetDir *asset,
+ QSharedPointer<AndroidAssetDir> asset,
const QString &path)
: QAbstractFileEngineIterator(filters, nameFilters)
{
- AAssetDir_rewind(asset);
- const char *fileName;
- while ((fileName = AAssetDir_getNextFileName(asset)))
- m_items << fileName;
+ m_items = asset->m_items;
m_index = -1;
m_path = path;
}
@@ -93,7 +105,7 @@ public:
private:
QString m_path;
- QStringList m_items;
+ FilesList m_items;
int m_index;
};
@@ -102,12 +114,11 @@ class AndroidAbstractFileEngine: public QAbstractFileEngine
public:
explicit AndroidAbstractFileEngine(AAsset *asset, const QString &fileName)
{
- m_assetDir = 0;
m_assetFile = asset;
m_fileName = fileName;
}
- explicit AndroidAbstractFileEngine(AAssetDir *asset, const QString &fileName)
+ explicit AndroidAbstractFileEngine(QSharedPointer<AndroidAssetDir> asset, const QString &fileName)
{
m_assetFile = 0;
m_assetDir = asset;
@@ -119,8 +130,6 @@ public:
~AndroidAbstractFileEngine()
{
close();
- if (m_assetDir)
- AAssetDir_close(m_assetDir);
}
virtual bool open(QIODevice::OpenMode openMode)
@@ -188,7 +197,7 @@ public:
FileFlags flags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag);
if (m_assetFile)
flags |= FileType;
- if (m_assetDir)
+ if (!m_assetDir.isNull())
flags |= DirectoryType;
return type & flags;
@@ -233,19 +242,19 @@ public:
virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames)
{
- if (m_assetDir)
+ if (!m_assetDir.isNull())
return new AndroidAbstractFileEngineIterator(filters, filterNames, m_assetDir, m_fileName);
return 0;
}
private:
AAsset *m_assetFile;
- AAssetDir *m_assetDir;
+ QSharedPointer<AndroidAssetDir> m_assetDir;
QString m_fileName;
};
-AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler()
+AndroidAssetsFileEngineHandler::AndroidAssetsFileEngineHandler():m_assetsCache(std::max(5, qgetenv("QT_ANDROID_MAX_ASSETS_CACHE_SIZE").toInt()))
{
m_assetManager = QtAndroid::assetManager();
}
@@ -264,25 +273,37 @@ QAbstractFileEngine * AndroidAssetsFileEngineHandler::create(const QString &file
int prefixSize=8;
- m_path.clear();
+ QByteArray path;
if (!fileName.endsWith(QLatin1Char('/'))) {
- m_path = fileName.toUtf8();
+ path = fileName.toUtf8();
AAsset *asset = AAssetManager_open(m_assetManager,
- m_path.constData() + prefixSize,
+ path.constData() + prefixSize,
AASSET_MODE_BUFFER);
if (asset)
return new AndroidAbstractFileEngine(asset, fileName);
}
- if (!m_path.size())
- m_path = fileName.left(fileName.length() - 1).toUtf8();
-
- AAssetDir *assetDir = AAssetManager_openDir(m_assetManager, m_path.constData() + prefixSize);
- if (assetDir) {
- if (AAssetDir_getNextFileName(assetDir))
- return new AndroidAbstractFileEngine(assetDir, fileName);
- else
- AAssetDir_close(assetDir);
+ if (!path.size())
+ path = fileName.left(fileName.length() - 1).toUtf8();
+
+ m_assetsCacheMutext.lock();
+ QSharedPointer<AndroidAssetDir> *aad = m_assetsCache.object(path);
+ m_assetsCacheMutext.unlock();
+ if (!aad) {
+ AAssetDir *assetDir = AAssetManager_openDir(m_assetManager, path.constData() + prefixSize);
+ if (assetDir) {
+ if (AAssetDir_getNextFileName(assetDir)) {
+ aad = new QSharedPointer<AndroidAssetDir>(new AndroidAssetDir(assetDir));
+ m_assetsCacheMutext.lock();
+ m_assetsCache.insert(path, aad);
+ m_assetsCacheMutext.unlock();
+ return new AndroidAbstractFileEngine(*aad, fileName);
+ } else {
+ AAssetDir_close(assetDir);
+ }
+ }
+ } else {
+ return new AndroidAbstractFileEngine(*aad, fileName);
}
return 0;
}
diff --git a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h
index 9bff6a012e..7bd560886c 100644
--- a/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h
+++ b/src/plugins/platforms/android/src/qandroidassetsfileenginehandler.h
@@ -43,8 +43,13 @@
#define QANDROIDASSETSFILEENGINEHANDLER_H
#include <QtCore/private/qabstractfileengine_p.h>
+#include <QCache>
+#include <QMutex>
+#include <QSharedPointer>
+
#include <android/asset_manager.h>
+struct AndroidAssetDir;
class AndroidAssetsFileEngineHandler: public QAbstractFileEngineHandler
{
public:
@@ -54,7 +59,8 @@ public:
private:
AAssetManager *m_assetManager;
- mutable QByteArray m_path;
+ mutable QCache<QByteArray, QSharedPointer<AndroidAssetDir>> m_assetsCache;
+ mutable QMutex m_assetsCacheMutext;
};
#endif // QANDROIDASSETSFILEENGINEHANDLER_H
diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp
index 386c8e006a..8556e8ebf1 100644
--- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp
@@ -381,6 +381,11 @@ QAndroidInputContext::~QAndroidInputContext()
m_textFieldID = 0;
}
+QAndroidInputContext *QAndroidInputContext::androidInputContext()
+{
+ return m_androidInputContext;
+}
+
void QAndroidInputContext::reset()
{
clear();
diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.h b/src/plugins/platforms/android/src/qandroidinputcontext.h
index d19dcc384b..041bd0dc49 100644
--- a/src/plugins/platforms/android/src/qandroidinputcontext.h
+++ b/src/plugins/platforms/android/src/qandroidinputcontext.h
@@ -80,6 +80,7 @@ public:
public:
QAndroidInputContext();
~QAndroidInputContext();
+ static QAndroidInputContext * androidInputContext();
bool isValid() const { return true; }
void reset();
diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp
new file mode 100644
index 0000000000..f379402e18
--- /dev/null
+++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QStyle>
+#include "qandroidplatformdialoghelpers.h"
+#include "androidjnimain.h"
+
+namespace QtAndroidDialogHelpers {
+static jclass g_messageDialogHelperClass = 0;
+
+QAndroidPlatformMessageDialogHelper::QAndroidPlatformMessageDialogHelper()
+ :m_buttonId(-1)
+ ,m_javaMessageDialog(g_messageDialogHelperClass, "(Landroid/app/Activity;)V", QtAndroid::activity())
+ ,m_shown(false)
+{
+}
+
+void QAndroidPlatformMessageDialogHelper::exec()
+{
+ if (!m_shown)
+ show(Qt::Dialog, Qt::ApplicationModal, 0);
+ m_loop.exec();
+}
+
+static QString standardButtonText(int sbutton)
+{
+ switch (sbutton) {
+ case QMessageDialogOptions::Ok:
+ return QAndroidPlatformMessageDialogHelper::tr("OK");
+ case QMessageDialogOptions::Save:
+ return QAndroidPlatformMessageDialogHelper::tr("Save");
+ case QMessageDialogOptions::Open:
+ return QAndroidPlatformMessageDialogHelper::tr("Open");
+ case QMessageDialogOptions::Cancel:
+ return QAndroidPlatformMessageDialogHelper::tr("Cancel");
+ case QMessageDialogOptions::Close:
+ return QAndroidPlatformMessageDialogHelper::tr("Close");
+ case QMessageDialogOptions::Apply:
+ return QAndroidPlatformMessageDialogHelper::tr("Apply");
+ case QMessageDialogOptions::Reset:
+ return QAndroidPlatformMessageDialogHelper::tr("Reset");
+ case QMessageDialogOptions::Help:
+ return QAndroidPlatformMessageDialogHelper::tr("Help");
+ case QMessageDialogOptions::Discard:
+ return QAndroidPlatformMessageDialogHelper::tr("Discard");
+ case QMessageDialogOptions::Yes:
+ return QAndroidPlatformMessageDialogHelper::tr("Yes");
+ case QMessageDialogOptions::YesToAll:
+ return QAndroidPlatformMessageDialogHelper::tr("Yes to All");
+ case QMessageDialogOptions::No:
+ return QAndroidPlatformMessageDialogHelper::tr("No");
+ case QMessageDialogOptions::NoToAll:
+ return QAndroidPlatformMessageDialogHelper::tr("No to All");
+ case QMessageDialogOptions::SaveAll:
+ return QAndroidPlatformMessageDialogHelper::tr("Save All");
+ case QMessageDialogOptions::Abort:
+ return QAndroidPlatformMessageDialogHelper::tr("Abort");
+ case QMessageDialogOptions::Retry:
+ return QAndroidPlatformMessageDialogHelper::tr("Retry");
+ case QMessageDialogOptions::Ignore:
+ return QAndroidPlatformMessageDialogHelper::tr("Ignore");
+ case QMessageDialogOptions::RestoreDefaults:
+ return QAndroidPlatformMessageDialogHelper::tr("Restore Defaults");
+ } // switch
+ return QString();
+}
+
+bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags
+ , Qt::WindowModality windowModality
+ , QWindow *parent)
+{
+ Q_UNUSED(windowFlags)
+ Q_UNUSED(windowModality)
+ Q_UNUSED(parent)
+ QSharedPointer<QMessageDialogOptions> opt = options();
+ if (!opt.data())
+ return false;
+
+ m_javaMessageDialog.callMethod<void>("setIcon", "(I)V", opt->icon());
+
+ QString str = opt->windowTitle();
+ if (!str.isEmpty())
+ m_javaMessageDialog.callMethod<void>("setTile", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
+
+ str = opt->text();
+ if (!str.isEmpty())
+ m_javaMessageDialog.callMethod<void>("setText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
+
+ str = opt->informativeText();
+ if (!str.isEmpty())
+ m_javaMessageDialog.callMethod<void>("setInformativeText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
+
+ str = opt->detailedText();
+ if (!str.isEmpty())
+ m_javaMessageDialog.callMethod<void>("setDetailedText", "(Ljava/lang/String;)V", QJNIObjectPrivate::fromString(str).object());
+
+ for (int i = QMessageDialogOptions::FirstButton; i < QMessageDialogOptions::LastButton; i<<=1) {
+ if ( opt->standardButtons() & i )
+ m_javaMessageDialog.callMethod<void>("addButton", "(ILjava/lang/String;)V", i, QJNIObjectPrivate::fromString(standardButtonText(i)).object());
+ }
+
+ m_javaMessageDialog.callMethod<void>("show", "(J)V", jlong(static_cast<QObject*>(this)));
+ m_shown = true;
+ return true;
+}
+
+void QAndroidPlatformMessageDialogHelper::hide()
+{
+ m_javaMessageDialog.callMethod<void>("hide", "()V");
+ m_shown = false;
+}
+
+void QAndroidPlatformMessageDialogHelper::dialogResult(int buttonID)
+{
+ m_buttonId = buttonID;
+ if (m_loop.isRunning())
+ m_loop.exit();
+ if (m_buttonId < 0) {
+ emit reject();
+ return;
+ }
+
+ QMessageDialogOptions::StandardButton standardButton = static_cast<QMessageDialogOptions::StandardButton>(buttonID);
+ QMessageDialogOptions::ButtonRole role = QMessageDialogOptions::buttonRole(standardButton);
+ emit clicked(standardButton, role);
+}
+
+static void dialogResult(JNIEnv * /*env*/, jobject /*thiz*/, jlong handler, int buttonID)
+{
+ QObject *object = reinterpret_cast<QObject *>(handler);
+ QMetaObject::invokeMethod(object, "dialogResult", Qt::QueuedConnection, Q_ARG(int, buttonID));
+}
+
+static JNINativeMethod methods[] = {
+ {"dialogResult", "(JI)V", (void *)dialogResult}
+};
+
+
+#define FIND_AND_CHECK_CLASS(CLASS_NAME) \
+ clazz = env->FindClass(CLASS_NAME); \
+ if (!clazz) { \
+ __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt(), CLASS_NAME); \
+ return false; \
+ }
+
+bool registerNatives(JNIEnv *env)
+{
+ jclass clazz = QtAndroid::findClass("org/qtproject/qt5/android/QtMessageDialogHelper", env);
+ if (!clazz) {
+ __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt()
+ , "org/qtproject/qt5/android/QtMessageDialogHelper");
+ return false;
+ }
+ g_messageDialogHelperClass = static_cast<jclass>(env->NewGlobalRef(clazz));
+ FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/QtNativeDialogHelper");
+ jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
+
+ if (env->RegisterNatives(appClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) {
+ __android_log_print(ANDROID_LOG_FATAL, "Qt", "RegisterNatives failed");
+ return false;
+ }
+
+ return true;
+}
+}
diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h
new file mode 100644
index 0000000000..88ec91d936
--- /dev/null
+++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDPLATFORMDIALOGHELPERS_H
+#define QANDROIDPLATFORMDIALOGHELPERS_H
+#include <jni.h>
+#include <qpa/qplatformdialoghelper.h>
+#include <QEventLoop>
+#include <private/qjni_p.h>
+
+namespace QtAndroidDialogHelpers {
+
+class QAndroidPlatformMessageDialogHelper: public QPlatformMessageDialogHelper
+{
+ Q_OBJECT
+public:
+ QAndroidPlatformMessageDialogHelper();
+ void exec();
+ bool show(Qt::WindowFlags windowFlags,
+ Qt::WindowModality windowModality,
+ QWindow *parent);
+ void hide();
+
+public slots:
+ void dialogResult(int buttonID);
+
+private:
+ int m_buttonId;
+ QEventLoop m_loop;
+ QJNIObjectPrivate m_javaMessageDialog;
+ bool m_shown;
+};
+
+
+bool registerNatives(JNIEnv *env);
+
+}
+
+#endif // QANDROIDPLATFORMDIALOGHELPERS_H
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
index a3db421de9..ae3e257d3c 100644
--- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp
@@ -61,6 +61,7 @@
# include "androidjnimenu.h"
# include "qandroidopenglcontext.h"
# include "qandroidopenglplatformwindow.h"
+# include "qandroidopenglplatformscreen.h"
# include "qeglfshooks.h"
# include <QtGui/qopenglcontext.h>
#endif
@@ -123,7 +124,6 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
switch (cap) {
case ThreadedPixmaps: return true;
case ApplicationState: return true;
- case NonFullScreenWindows: return false;
case NativeWidgets: return false;
default:
#ifndef ANDROID_PLUGIN_OPENGL
@@ -142,7 +142,10 @@ QPlatformBackingStore *QAndroidPlatformIntegration::createPlatformBackingStore(Q
QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
{
- return new QAndroidPlatformWindow(window);
+ QAndroidPlatformWindow *platformWindow = new QAndroidPlatformWindow(window);
+ platformWindow->setWindowState(window->windowState());
+
+ return platformWindow;
}
QAbstractEventDispatcher *QAndroidPlatformIntegration::createEventDispatcher() const
@@ -155,6 +158,7 @@ QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *wind
QAndroidOpenGLPlatformWindow *platformWindow = new QAndroidOpenGLPlatformWindow(window);
platformWindow->create();
platformWindow->requestActivateWindow();
+ platformWindow->setWindowState(window->windowState());
QtAndroidMenu::setActiveTopLevelWindow(window);
return platformWindow;
@@ -231,13 +235,22 @@ QPlatformServices *QAndroidPlatformIntegration::services() const
QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const
{
switch (hint) {
- case ShowIsFullScreen:
+ case ShowIsMaximized:
return true;
default:
return QPlatformIntegration::styleHint(hint);
}
}
+Qt::WindowState QAndroidPlatformIntegration::defaultWindowState(Qt::WindowFlags flags) const
+{
+ // Don't maximize dialogs on Android
+ if (flags & Qt::Dialog & ~Qt::Window)
+ return Qt::WindowNoState;
+
+ return QPlatformIntegration::defaultWindowState(flags);
+}
+
static const QLatin1String androidThemeName("android");
QStringList QAndroidPlatformIntegration::themeNames() const
{
@@ -308,6 +321,11 @@ void QAndroidPlatformIntegration::setDisplayMetrics(int width, int height)
m_defaultPhysicalSizeHeight = height;
}
+QEglFSScreen *QAndroidPlatformIntegration::createScreen() const
+{
+ return new QAndroidOpenGLPlatformScreen(display());
+}
+
#endif
void QAndroidPlatformIntegration::pauseApp()
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.h b/src/plugins/platforms/android/src/qandroidplatformintegration.h
index 5ebdf9e65c..bd08ad694c 100644
--- a/src/plugins/platforms/android/src/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/src/qandroidplatformintegration.h
@@ -121,6 +121,7 @@ public:
#endif
QVariant styleHint(StyleHint hint) const;
+ Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const Q_DECL_OVERRIDE;
QStringList themeNames() const;
QPlatformTheme *createPlatformTheme(const QString &name) const;
@@ -140,6 +141,10 @@ public:
QTouchDevice *touchDevice() const { return m_touchDevice; }
void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
+#ifdef ANDROID_PLUGIN_OPENGL
+ QEglFSScreen *createScreen() const;
+#endif
+
private:
friend class QEglFSAndroidHooks;
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp b/src/plugins/platforms/android/src/qandroidplatformmenu.cpp
index 253c22a12f..1ecabb25e2 100644
--- a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp
+++ b/src/plugins/platforms/android/src/qandroidplatformmenu.cpp
@@ -141,6 +141,15 @@ bool QAndroidPlatformMenu::isVisible() const
return m_isVisible;
}
+void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item)
+{
+ Q_UNUSED(parentWindow);
+ Q_UNUSED(pos);
+ Q_UNUSED(item);
+ setVisible(true);
+ QtAndroidMenu::showContextMenu(this);
+}
+
QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const
{
if (position < m_menuItems.size())
@@ -154,7 +163,6 @@ QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const
if (menuItem->tag() == tag)
return menuItem;
}
-
return 0;
}
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.h b/src/plugins/platforms/android/src/qandroidplatformmenu.h
index 20236cb636..305b64168a 100644
--- a/src/plugins/platforms/android/src/qandroidplatformmenu.h
+++ b/src/plugins/platforms/android/src/qandroidplatformmenu.h
@@ -71,6 +71,7 @@ public:
bool isEnabled() const;
void setVisible(bool visible);
bool isVisible() const;
+ void showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item);
QPlatformMenuItem *menuItemAt(int position) const;
QPlatformMenuItem *menuItemForTag(quintptr tag) const;
diff --git a/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp b/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp
index ef1ac61356..134062fb32 100644
--- a/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp
+++ b/src/plugins/platforms/android/src/qandroidplatformmenubar.cpp
@@ -79,6 +79,8 @@ void QAndroidPlatformMenuBar::syncMenu(QPlatformMenu *menu)
void QAndroidPlatformMenuBar::handleReparent(QWindow *newParentWindow)
{
+ if (m_parentWindow == newParentWindow)
+ return;
m_parentWindow = newParentWindow;
QtAndroidMenu::setMenuBar(this, newParentWindow);
}
diff --git a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp b/src/plugins/platforms/android/src/qandroidplatformtheme.cpp
index 79fbc440fc..308bb70faf 100644
--- a/src/plugins/platforms/android/src/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/src/qandroidplatformtheme.cpp
@@ -43,6 +43,7 @@
#include "qandroidplatformmenubar.h"
#include "qandroidplatformmenu.h"
#include "qandroidplatformmenuitem.h"
+#include "qandroidplatformdialoghelpers.h"
#include <QVariant>
#include <QFileInfo>
#include <qandroidplatformintegration.h>
@@ -124,7 +125,7 @@ const QFont *QAndroidPlatformTheme::font(Font type) const
return &(it.value());
// default in case the style has not set a font
- static QFont systemFont("Roboto", 12.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi
+ static QFont systemFont("Roboto", 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi
if (type == QPlatformTheme::SystemFont)
return &systemFont;
return 0;
@@ -150,3 +151,20 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
return QPlatformTheme::themeHint(hint);
}
}
+
+bool QAndroidPlatformTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
+{
+ if (type == MessageDialog)
+ return qgetenv("QT_USE_ANDROID_NATIVE_DIALOGS").toInt() == 1;
+ return false;
+}
+
+QPlatformDialogHelper *QAndroidPlatformTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const
+{
+ switch (type) {
+ case MessageDialog:
+ return new QtAndroidDialogHelpers::QAndroidPlatformMessageDialogHelper;
+ default:
+ return 0;
+ }
+}
diff --git a/src/plugins/platforms/android/src/qandroidplatformtheme.h b/src/plugins/platforms/android/src/qandroidplatformtheme.h
index 15d2cb2000..ec259a9b0a 100644
--- a/src/plugins/platforms/android/src/qandroidplatformtheme.h
+++ b/src/plugins/platforms/android/src/qandroidplatformtheme.h
@@ -54,6 +54,9 @@ public:
virtual const QPalette *palette(Palette type = SystemPalette) const;
virtual const QFont *font(Font type = SystemFont) const;
virtual QVariant themeHint(ThemeHint hint) const;
+ virtual bool usePlatformNativeDialog(DialogType type) const;
+ virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
+
private:
QAndroidPlatformNativeInterface * m_androidPlatformNativeInterface;
diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp
index 0250a6122c..2e59c307c3 100644
--- a/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/src/raster/qandroidplatformscreen.cpp
@@ -43,6 +43,7 @@
#include "qandroidplatformintegration.h"
#include "androidjnimain.h"
#include "androidjnimenu.h"
+#include "qandroidplatformwindow.h"
QAndroidPlatformScreen::QAndroidPlatformScreen():QFbScreen()
{
@@ -57,6 +58,12 @@ QAndroidPlatformScreen::QAndroidPlatformScreen():QFbScreen()
void QAndroidPlatformScreen::topWindowChanged(QWindow *w)
{
QtAndroidMenu::setActiveTopLevelWindow(w);
+
+ if (w != 0) {
+ QAndroidPlatformWindow *platformWindow = static_cast<QAndroidPlatformWindow *>(w->handle());
+ if (platformWindow != 0)
+ platformWindow->updateStatusBarVisibility();
+ }
}
QRegion QAndroidPlatformScreen::doRedraw()
diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp
index f5fce0ae34..7ff18526d9 100644
--- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp
@@ -44,7 +44,8 @@
#include "androidjnimain.h"
#include <qpa/qwindowsysteminterface.h>
-QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window) : QFbWindow(window)
+QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window)
+ : QFbWindow(window)
{
}
@@ -58,8 +59,40 @@ void QAndroidPlatformWindow::propagateSizeHints()
//shut up warning from default implementation
}
+void QAndroidPlatformWindow::updateStatusBarVisibility()
+{
+ Qt::WindowFlags flags = window()->flags();
+ bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
+ if (!isNonRegularWindow) {
+ if (mWindowState & Qt::WindowFullScreen)
+ QtAndroid::hideStatusBar();
+ else if (mWindowState & Qt::WindowMaximized)
+ QtAndroid::showStatusBar();
+ }
+}
+
+void QAndroidPlatformWindow::raise()
+{
+ updateStatusBarVisibility();
+ QFbWindow::raise();
+}
+
+void QAndroidPlatformWindow::setWindowState(Qt::WindowState state)
+{
+ if (mWindowState == state)
+ return;
+
+ if (window()->isVisible())
+ updateStatusBarVisibility();
+
+ QFbWindow::setWindowState(state);
+}
+
void QAndroidPlatformWindow::setVisible(bool visible)
{
+ if (visible)
+ updateStatusBarVisibility();
+
QFbWindow::setVisible(visible);
// The Android Activity is activated before Qt is initialized, causing the application state to
diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h
index 58e6451ea1..9e3f203201 100644
--- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h
+++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h
@@ -52,11 +52,13 @@ public:
void propagateSizeHints();
+ void raise();
+ void setWindowState(Qt::WindowState state);
void setVisible(bool visible);
+ void updateStatusBarVisibility();
public slots:
void setGeometry(const QRect &rect);
-
};
#endif // ANDROIDPLATFORMWINDOW_H
diff --git a/src/plugins/platforms/android/src/src.pri b/src/plugins/platforms/android/src/src.pri
index 6cc41c3e68..9b64e846f7 100644
--- a/src/plugins/platforms/android/src/src.pri
+++ b/src/plugins/platforms/android/src/src.pri
@@ -21,6 +21,7 @@ SOURCES += $$PWD/androidplatformplugin.cpp \
$$PWD/qandroidinputcontext.cpp \
$$PWD/qandroidplatformaccessibility.cpp \
$$PWD/qandroidplatformfontdatabase.cpp \
+ $$PWD/qandroidplatformdialoghelpers.cpp \
$$PWD/qandroidplatformclipboard.cpp \
$$PWD/qandroidplatformtheme.cpp \
$$PWD/qandroidplatformmenubar.cpp \
@@ -41,6 +42,7 @@ HEADERS += $$PWD/qandroidplatformintegration.h \
$$PWD/qandroidplatformaccessibility.h \
$$PWD/qandroidplatformfontdatabase.h \
$$PWD/qandroidplatformclipboard.h \
+ $$PWD/qandroidplatformdialoghelpers.h \
$$PWD/qandroidplatformtheme.h \
$$PWD/qandroidplatformmenubar.h \
$$PWD/qandroidplatformmenu.h \
diff --git a/src/plugins/platforms/cocoa/images/sizeallcursor.png b/src/plugins/platforms/cocoa/images/sizeallcursor.png
new file mode 100644
index 0000000000..bb5381ba32
--- /dev/null
+++ b/src/plugins/platforms/cocoa/images/sizeallcursor.png
Binary files differ
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index e135f36e78..1371eb3658 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -40,8 +40,7 @@
****************************************************************************/
#include "qcocoaaccessibility.h"
#include "qcocoaaccessibilityelement.h"
-#include <qaccessible.h>
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#include <private/qcore_mac_p.h>
QCocoaAccessibility::QCocoaAccessibility()
@@ -56,12 +55,8 @@ QCocoaAccessibility::~QCocoaAccessibility()
void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
- QObject *object = event->object();
- if (!object)
- return;
-
- QAccessibleInterface *interface = event->accessibleInterface();
- if (!interface)
+ QAccessible::Id interfaceId = event->uniqueId();
+ if (!interfaceId)
return;
switch (event->type()) {
@@ -69,7 +64,7 @@ void QCocoaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
case QAccessible::TextInserted :
case QAccessible::TextRemoved :
case QAccessible::TextUpdated : {
- QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId : QAccessible::uniqueId(interface) parent : nil];
+ QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithId : interfaceId parent : nil];
[element autorelease];
NSAccessibilityPostNotification(element, NSAccessibilityValueChangedNotification);
break; }
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 7eae22f720..8e20a96a48 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -42,8 +42,7 @@
#include "qcocoaaccessibility.h"
#include "qcocoahelpers.h"
-#include <QAccessible>
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#import <AppKit/NSAccessibility.h>
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm
index c293f4cd52..551a59823c 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm
@@ -115,8 +115,8 @@ QT_USE_NAMESPACE
QCocoaPostMessageArgs *args = reinterpret_cast<QCocoaPostMessageArgs *>(lower | (upper << 32));
// Special case for convenience: if the argument is an NSNumber, we unbox it directly.
// Use NSValue instead if this behaviour is unwanted.
- id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1;
- id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2;
+ id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 longValue] : args->arg1;
+ id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 longValue] : args->arg2;
switch (args->argCount) {
case 0:
[args->target performSelector:args->selector];
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index d90d77ec1d..be2bab8ce7 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -82,6 +82,7 @@ static NSButton *macCreateButton(const char *text, NSView *superview)
BOOL mDialogIsExecuting;
BOOL mResultSet;
};
+- (void)restoreOriginalContentView;
- (void)relayout;
- (void)updateQtColor;
- (void)finishOffWithCode:(NSInteger)code;
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h
index dfa1fcff81..f332240724 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.h
+++ b/src/plugins/platforms/cocoa/qcocoacursor.h
@@ -55,12 +55,13 @@ public:
QCocoaCursor();
~QCocoaCursor();
- virtual void changeCursor(QCursor * widgetCursor, QWindow * widget);
+ virtual void changeCursor(QCursor *cursor, QWindow *window);
virtual QPoint pos() const;
virtual void setPos(const QPoint &position);
private:
QHash<Qt::CursorShape, NSCursor *> m_cursors;
- NSCursor *createCursorData(QCursor *);
+ NSCursor *convertCursor(QCursor *cursor);
+ NSCursor *createCursorData(QCursor * cursor);
NSCursor *createCursorFromBitmap(const QBitmap *bitmap, const QBitmap *mask, const QPoint hotspot = QPoint());
NSCursor *createCursorFromPixmap(const QPixmap pixmap, const QPoint hotspot = QPoint());
};
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index e5b41e7a88..13f6423701 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qcocoacursor.h"
+#include "qcocoawindow.h"
#include "qcocoahelpers.h"
#include "qcocoaautoreleasepool.h"
@@ -63,82 +64,90 @@ QCocoaCursor::~QCocoaCursor()
void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window)
{
- Q_UNUSED(window);
+ NSCursor * cocoaCursor = convertCursor(cursor);
+ if (QPlatformWindow * platformWindow = window->handle())
+ static_cast<QCocoaWindow *>(platformWindow)->setWindowCursor(cocoaCursor);
+}
+
+QPoint QCocoaCursor::pos() const
+{
+ return qt_mac_flipPoint([NSEvent mouseLocation]).toPoint();
+}
+
+void QCocoaCursor::setPos(const QPoint &position)
+{
+ CGPoint pos;
+ pos.x = position.x();
+ pos.y = position.y();
+
+ CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0);
+ CGEventPost(kCGHIDEventTap, e);
+ CFRelease(e);
+}
+
+NSCursor *QCocoaCursor::convertCursor(QCursor * cursor)
+{
const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor;
+ NSCursor *cocoaCursor;
+
// Check for a suitable built-in NSCursor first:
switch (newShape) {
case Qt::ArrowCursor:
- [[NSCursor arrowCursor] set];
+ cocoaCursor= [NSCursor arrowCursor];
break;
case Qt::CrossCursor:
- [[NSCursor crosshairCursor] set];
+ cocoaCursor = [NSCursor crosshairCursor];
break;
case Qt::IBeamCursor:
- [[NSCursor IBeamCursor] set];
+ cocoaCursor = [NSCursor IBeamCursor];
break;
case Qt::WhatsThisCursor: //for now just use the pointing hand
case Qt::PointingHandCursor:
- [[NSCursor pointingHandCursor] set];
+ cocoaCursor = [NSCursor pointingHandCursor];
break;
case Qt::SplitVCursor:
- [[NSCursor resizeUpDownCursor] set];
+ cocoaCursor = [NSCursor resizeUpDownCursor];
break;
case Qt::SplitHCursor:
- [[NSCursor resizeLeftRightCursor] set];
+ cocoaCursor = [NSCursor resizeLeftRightCursor];
break;
case Qt::OpenHandCursor:
- [[NSCursor openHandCursor] set];
+ cocoaCursor = [NSCursor openHandCursor];
break;
case Qt::ClosedHandCursor:
- [[NSCursor closedHandCursor] set];
+ cocoaCursor = [NSCursor closedHandCursor];
break;
case Qt::DragMoveCursor:
- [[NSCursor crosshairCursor] set];
+ cocoaCursor = [NSCursor crosshairCursor];
break;
case Qt::DragCopyCursor:
- [[NSCursor crosshairCursor] set];
+ cocoaCursor = [NSCursor crosshairCursor];
break;
case Qt::DragLinkCursor:
- [[NSCursor dragLinkCursor] set];
+ cocoaCursor = [NSCursor dragLinkCursor];
break;
default : {
// No suitable OS cursor exist, use cursors provided
// by Qt for the rest. Check for a cached cursor:
- NSCursor *cocoaCursor = m_cursors.value(newShape);
+ cocoaCursor = m_cursors.value(newShape);
if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) {
[cocoaCursor release];
cocoaCursor = 0;
}
if (cocoaCursor == 0) {
cocoaCursor = createCursorData(cursor);
- if (cocoaCursor == 0) {
- [[NSCursor arrowCursor] set];
- return;
- }
+ if (cocoaCursor == 0)
+ return [NSCursor arrowCursor];
+
m_cursors.insert(newShape, cocoaCursor);
}
- [cocoaCursor set];
break; }
}
+ return cocoaCursor;
}
-QPoint QCocoaCursor::pos() const
-{
- return qt_mac_flipPoint([NSEvent mouseLocation]).toPoint();
-}
-
-void QCocoaCursor::setPos(const QPoint &position)
-{
- CGPoint pos;
- pos.x = position.x();
- pos.y = position.y();
-
- CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0);
- CGEventPost(kCGHIDEventTap, e);
- CFRelease(e);
-}
// Creates an NSCursor for the given QCursor.
NSCursor *QCocoaCursor::createCursorData(QCursor *cursor)
@@ -218,8 +227,8 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor)
return createCursorFromPixmap(pixmap, hotspot);
break; }
case Qt::SizeAllCursor: {
- QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/pluscursor.png"));
- return createCursorFromPixmap(pixmap, hotspot);
+ QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/sizeallcursor.png"));
+ return createCursorFromPixmap(pixmap, QPoint(8, 8));
break; }
case Qt::BusyCursor: {
QPixmap pixmap = QPixmap(QLatin1String(":/qt-project.org/mac/cursors/images/waitcursor.png"));
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index b3bc4a8ebf..1ad833ee44 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -61,12 +61,12 @@
#include <stdlib.h>
#include <qabstracteventdispatcher.h>
#include "qcocoaautoreleasepool.h"
-#include <QFileSystemWatcher>
#include <QDir>
#include <qpa/qplatformnativeinterface.h>
#import <AppKit/NSSavePanel.h>
+#import <CoreFoundation/CFNumber.h>
QT_FORWARD_DECLARE_CLASS(QString)
QT_FORWARD_DECLARE_CLASS(QStringList)
@@ -74,30 +74,6 @@ QT_FORWARD_DECLARE_CLASS(QFileInfo)
QT_FORWARD_DECLARE_CLASS(QWindow)
QT_USE_NAMESPACE
-class CachedEntries: public QObject {
-public:
- CachedEntries(QDir::Filters filters) : mFilters(filters) {
- QObject::connect(&mFSWatcher, &QFileSystemWatcher::directoryChanged, this, &CachedEntries::updateDirCache);
- }
- QString directory() const {
- const QStringList &dirs = mFSWatcher.directories();
- return (dirs.count() ? dirs[0] : QString());
- }
- QStringList entries() const {
- return mQDirFilterEntryList;
- }
- void updateDirCache(const QString &path) {
- mFSWatcher.removePaths(mFSWatcher.directories());
- mFSWatcher.addPath(path);
- mQDirFilterEntryList = QDir(path).entryList(mFilters);
- }
-
-private:
- QFileSystemWatcher mFSWatcher;
- QStringList mQDirFilterEntryList;
- QDir::Filters mFilters;
-};
-
typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate);
@@ -117,7 +93,6 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
int mReturnCode;
SharedPointerFileDialogOptions mOptions;
- CachedEntries *mCachedEntries;
QString *mCurrentSelection;
QStringList *mNameFilterDropDownList;
QStringList *mSelectedNameFilter;
@@ -164,7 +139,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
[mSavePanel setDelegate:self];
mReturnCode = -1;
mHelper = helper;
- mCachedEntries = new CachedEntries(mOptions->filter());
mNameFilterDropDownList = new QStringList(mOptions->nameFilters());
QString selectedVisualNameFilter = mOptions->initiallySelectedNameFilter();
mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]);
@@ -197,7 +171,6 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
- (void)dealloc
{
- delete mCachedEntries;
delete mNameFilterDropDownList;
delete mSelectedNameFilter;
delete mCurrentSelection;
@@ -308,6 +281,22 @@ static QString strippedText(QString s)
}];
}
+- (BOOL)isHiddenFile:(NSString *)filename isDir:(BOOL)isDir
+{
+ CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)filename, kCFURLPOSIXPathStyle, isDir);
+ CFBooleanRef isHidden;
+ Boolean errorOrHidden = false;
+ if (!CFURLCopyResourcePropertyForKey(url, kCFURLIsHiddenKey, &isHidden, NULL)) {
+ errorOrHidden = true;
+ } else {
+ if (CFBooleanGetValue(isHidden))
+ errorOrHidden = true;
+ CFRelease(isHidden);
+ }
+ CFRelease(url);
+ return errorOrHidden;
+}
+
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
Q_UNUSED(sender);
@@ -316,8 +305,13 @@ static QString strippedText(QString s)
return NO;
// Always accept directories regardless of their names (unless it is a bundle):
- BOOL isDir;
- if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) {
+ NSFileManager *fm = [NSFileManager defaultManager];
+ NSDictionary *fileAttrs = [fm attributesOfItemAtPath:filename error:nil];
+ if (!fileAttrs)
+ return NO; // Error accessing the file means 'no'.
+ NSString *fileType = [fileAttrs fileType];
+ bool isDir = [fileType isEqualToString:NSFileTypeDirectory];
+ if (isDir) {
if ([mSavePanel treatsFilePackagesAsDirectories] == NO) {
if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO)
return YES;
@@ -325,24 +319,35 @@ static QString strippedText(QString s)
}
QString qtFileName = QCFString::toQString(filename);
- QFileInfo info(qtFileName.normalized(QString::NormalizationForm_C));
- QString path = info.absolutePath();
- if (mCachedEntries->directory() != path) {
- mCachedEntries->updateDirCache(path);
- }
- // Check if the QDir filter accepts the file:
- if (!mCachedEntries->entries().contains(info.fileName()))
- return NO;
-
// No filter means accept everything
- if (mSelectedNameFilter->isEmpty())
- return YES;
+ bool nameMatches = mSelectedNameFilter->isEmpty();
// Check if the current file name filter accepts the file:
- for (int i=0; i<mSelectedNameFilter->size(); ++i) {
+ for (int i = 0; !nameMatches && i < mSelectedNameFilter->size(); ++i) {
if (QDir::match(mSelectedNameFilter->at(i), qtFileName))
- return YES;
+ nameMatches = true;
+ }
+ if (!nameMatches)
+ return NO;
+
+ QDir::Filters filter = mOptions->filter();
+ if ((!(filter & (QDir::Dirs | QDir::AllDirs)) && isDir)
+ || (!(filter & QDir::Files) && [fileType isEqualToString:NSFileTypeRegular])
+ || ((filter & QDir::NoSymLinks) && [fileType isEqualToString:NSFileTypeSymbolicLink]))
+ return NO;
+
+ bool filterPermissions = ((filter & QDir::PermissionMask)
+ && (filter & QDir::PermissionMask) != QDir::PermissionMask);
+ if (filterPermissions) {
+ if ((!(filter & QDir::Readable) && [fm isReadableFileAtPath:filename])
+ || (!(filter & QDir::Writable) && [fm isWritableFileAtPath:filename])
+ || (!(filter & QDir::Executable) && [fm isExecutableFileAtPath:filename]))
+ return NO;
}
- return NO;
+ if (!(filter & QDir::Hidden)
+ && (qtFileName.startsWith(QLatin1Char('.')) || [self isHiddenFile:filename isDir:isDir]))
+ return NO;
+
+ return YES;
}
- (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag
@@ -461,7 +466,7 @@ static QString strippedText(QString s)
Q_UNUSED(sender);
if (!mHelper)
return;
- if ([path isEqualToString:mCurrentDir])
+ if (!(path && path.length) || [path isEqualToString:mCurrentDir])
return;
[mCurrentDir release];
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index 91fb52eb6d..dc22da0983 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -121,6 +121,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
BOOL mDialogIsExecuting;
BOOL mResultSet;
};
+- (void)restoreOriginalContentView;
- (void)relayout;
- (void)relayoutToContentSize:(NSSize)frameSize;
- (void)updateQtFont;
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 29affb0e4a..e1d4b602c9 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -77,6 +77,7 @@ public:
private:
void setActiveWindow(QWindow *window);
+ void updateSurfaceFormat();
NSOpenGLContext *m_context;
NSOpenGLContext *m_shareContext;
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 3dee137038..144144338f 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -48,6 +48,74 @@
#import <Cocoa/Cocoa.h>
+static inline QByteArray getGlString(GLenum param)
+{
+ if (const GLubyte *s = glGetString(param))
+ return QByteArray(reinterpret_cast<const char*>(s));
+ return QByteArray();
+}
+
+#if !defined(GL_CONTEXT_FLAGS)
+#define GL_CONTEXT_FLAGS 0x821E
+#endif
+
+#if !defined(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
+#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
+#endif
+
+#if !defined(GL_CONTEXT_PROFILE_MASK)
+#define GL_CONTEXT_PROFILE_MASK 0x9126
+#endif
+
+#if !defined(GL_CONTEXT_CORE_PROFILE_BIT)
+#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+#endif
+
+#if !defined(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
+#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+#endif
+
+static void updateFormatFromContext(QSurfaceFormat *format)
+{
+ Q_ASSERT(format);
+
+ // Update the version, profile, and context bit of the format
+ int major = 0, minor = 0;
+ QByteArray versionString(getGlString(GL_VERSION));
+ if (QPlatformOpenGLContext::parseOpenGLVersion(versionString, major, minor)) {
+ format->setMajorVersion(major);
+ format->setMinorVersion(minor);
+ }
+
+ format->setProfile(QSurfaceFormat::NoProfile);
+
+ Q_ASSERT(format->renderableType() == QSurfaceFormat::OpenGL);
+ if (format->version() < qMakePair(3, 0)) {
+ format->setOption(QSurfaceFormat::DeprecatedFunctions);
+ return;
+ }
+
+ // Version 3.0 onwards - check if it includes deprecated functionality
+ GLint value = 0;
+ glGetIntegerv(GL_CONTEXT_FLAGS, &value);
+ if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT))
+ format->setOption(QSurfaceFormat::DeprecatedFunctions);
+
+ // Debug context option not supported on OS X
+
+ if (format->version() < qMakePair(3, 2))
+ return;
+
+ // Version 3.2 and newer have a profile
+ value = 0;
+ glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value);
+
+ if (value & GL_CONTEXT_CORE_PROFILE_BIT)
+ format->setProfile(QSurfaceFormat::CoreProfile);
+ else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
+ format->setProfile(QSurfaceFormat::CompatibilityProfile);
+}
+
QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share)
: m_context(nil),
m_shareContext(nil),
@@ -82,6 +150,8 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
int zeroOpacity = 0;
[m_context setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity];
}
+
+ updateSurfaceFormat();
}
QCocoaGLContext::~QCocoaGLContext()
@@ -112,6 +182,8 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
QWindow *window = static_cast<QCocoaWindow *>(surface)->window();
setActiveWindow(window);
+ if (![m_context view])
+ return false;
[m_context makeCurrentContext];
update();
return true;
@@ -135,6 +207,74 @@ void QCocoaGLContext::setActiveWindow(QWindow *window)
[(QNSView *) cocoaWindow->contentView() setQCocoaGLContext:this];
}
+void QCocoaGLContext::updateSurfaceFormat()
+{
+ // At present it is impossible to turn an option off on a QSurfaceFormat (see
+ // https://codereview.qt-project.org/#change,70599). So we have to populate
+ // the actual surface format from scratch
+ QSurfaceFormat requestedFormat = m_format;
+ m_format = QSurfaceFormat();
+ m_format.setRenderableType(QSurfaceFormat::OpenGL);
+
+ // CoreGL doesn't require a drawable to make the context current
+ CGLContextObj oldContext = CGLGetCurrentContext();
+ CGLContextObj ctx = static_cast<CGLContextObj>([m_context CGLContextObj]);
+ CGLSetCurrentContext(ctx);
+
+ // Get the data that OpenGL provides
+ updateFormatFromContext(&m_format);
+
+ // Get the data contained within the pixel format
+ CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>(CGLGetPixelFormat(ctx));
+ NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithCGLPixelFormatObj:cglPixelFormat];
+
+ int colorSize = -1;
+ [pixelFormat getValues:&colorSize forAttribute:NSOpenGLPFAColorSize forVirtualScreen:0];
+ if (colorSize > 0) {
+ // This seems to return the total color buffer depth, including alpha
+ m_format.setRedBufferSize(colorSize / 4);
+ m_format.setGreenBufferSize(colorSize / 4);
+ m_format.setBlueBufferSize(colorSize / 4);
+ }
+
+ // The pixel format always seems to return 8 for alpha. However, the framebuffer only
+ // seems to have alpha enabled if we requested it explicitly. I can't find any other
+ // attribute to check explicitly for this so we use our best guess for alpha.
+ int alphaSize = -1;
+ [pixelFormat getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0];
+ if (alphaSize > 0 && requestedFormat.alphaBufferSize() > 0)
+ m_format.setAlphaBufferSize(alphaSize);
+
+ int depthSize = -1;
+ [pixelFormat getValues:&depthSize forAttribute:NSOpenGLPFADepthSize forVirtualScreen:0];
+ if (depthSize > 0)
+ m_format.setDepthBufferSize(depthSize);
+
+ int stencilSize = -1;
+ [pixelFormat getValues:&stencilSize forAttribute:NSOpenGLPFAStencilSize forVirtualScreen:0];
+ if (stencilSize > 0)
+ m_format.setStencilBufferSize(stencilSize);
+
+ int samples = -1;
+ [pixelFormat getValues:&samples forAttribute:NSOpenGLPFASamples forVirtualScreen:0];
+ if (samples > 0)
+ m_format.setSamples(samples);
+
+ int doubleBuffered = -1;
+ [pixelFormat getValues:&doubleBuffered forAttribute:NSOpenGLPFADoubleBuffer forVirtualScreen:0];
+ m_format.setSwapBehavior(doubleBuffered == 1 ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer);
+
+ int steroBuffers = -1;
+ [pixelFormat getValues:&steroBuffers forAttribute:NSOpenGLPFAStereo forVirtualScreen:0];
+ if (steroBuffers == 1)
+ m_format.setOption(QSurfaceFormat::StereoBuffers);
+
+ [pixelFormat release];
+
+ // Restore the original context
+ CGLSetCurrentContext(oldContext);
+}
+
void QCocoaGLContext::doneCurrent()
{
if (m_currentWindow && m_currentWindow.data()->handle())
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 197a2058af..4a5696b35e 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -599,7 +599,17 @@ NSRect qt_mac_flipRect(const QRect &rect, QWindow *window)
{
QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window);
int flippedY = onScreen->geometry().height() - (rect.y() + rect.height());
-
+ QList<QScreen *> screens = QGuiApplication::screens();
+ if (screens.size() > 1) {
+ int height = 0;
+ foreach (QScreen *scr, screens)
+ height = qMax(height, scr->size().height());
+ int difference = height - onScreen->geometry().height();
+ if (difference > 0)
+ flippedY += difference;
+ else
+ flippedY -= difference;
+ }
// In case of automatic positioning, try to put as much of the window onscreen as possible.
if (window->isTopLevel() && qt_window_private(const_cast<QWindow*>(window))->positionAutomatic && flippedY < 0)
flippedY = onScreen->geometry().height() - onScreen->availableGeometry().height() - onScreen->availableGeometry().y();
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 2e42b9acda..0af635be6f 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -63,7 +63,6 @@
static void initResources()
{
- Q_INIT_RESOURCE_EXTERN(qcocoaresources)
Q_INIT_RESOURCE(qcocoaresources);
}
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 14b8dee101..329c7a264a 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -84,6 +84,7 @@ static inline QCocoaMenuLoader *getMenuLoader()
}
- (id) initWithMenu:(QCocoaMenu*) m;
+- (BOOL)hasShortcut:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier;
@end
@@ -465,17 +466,21 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatf
nsPos.y = screen->availableVirtualSize().height() - nsPos.y;
}
- // Finally, we need to synthesize an event.
- NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown
- location:nsPos
- modifierFlags:0
- timestamp:0
- windowNumber:view ? view.window.windowNumber : 0
- context:nil
- eventNumber:0
- clickCount:1
- pressure:1.0];
- [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view];
+ if (view) {
+ // Finally, we need to synthesize an event.
+ NSEvent *menuEvent = [NSEvent mouseEventWithType:NSRightMouseDown
+ location:nsPos
+ modifierFlags:0
+ timestamp:0
+ windowNumber:view ? view.window.windowNumber : 0
+ context:nil
+ eventNumber:0
+ clickCount:1
+ pressure:1.0];
+ [NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view];
+ } else {
+ [m_nativeMenu popUpMenuPositioningItem:nsItem atLocation:nsPos inView:0];
+ }
}
// The calls above block, and also swallow any mouse release event,
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index 0fea55ac68..5a8664747e 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -175,6 +175,7 @@ void QCocoaMenuBar::handleReparent(QWindow *newParentWindow)
if (newParentWindow == NULL) {
m_window = NULL;
} else {
+ newParentWindow->create();
m_window = static_cast<QCocoaWindow*>(newParentWindow->handle());
m_window->setMenubar(this);
}
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 013f9931ff..3bba1ee1d5 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -338,6 +338,8 @@ QString QCocoaMenuItem::mergeText()
return qt_mac_applicationmenu_string(4);
} else if (m_native == [loader quitMenuItem]) {
return qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName());
+ } else if (m_text.contains('\t')) {
+ return m_text.left(m_text.indexOf('\t'));
}
return m_text;
}
@@ -349,6 +351,8 @@ QKeySequence QCocoaMenuItem::mergeAccel()
return QKeySequence(QKeySequence::Preferences);
else if (m_native == [loader quitMenuItem])
return QKeySequence(QKeySequence::Quit);
+ else if (m_text.contains('\t'))
+ return QKeySequence(m_text.mid(m_text.indexOf('\t') + 1), QKeySequence::NativeText);
return m_shortcut;
}
diff --git a/src/plugins/platforms/cocoa/qcocoaresources.qrc b/src/plugins/platforms/cocoa/qcocoaresources.qrc
index 392300bb03..9e0640db7d 100644
--- a/src/plugins/platforms/cocoa/qcocoaresources.qrc
+++ b/src/plugins/platforms/cocoa/qcocoaresources.qrc
@@ -4,7 +4,7 @@
<file>images/forbiddencursor.png</file>
<file>images/spincursor.png</file>
<file>images/waitcursor.png</file>
-<file>images/pluscursor.png</file>
+<file>images/sizeallcursor.png</file>
</qresource>
<qresource prefix="/qt-project.org/mac/style">
<file>images/leopard-unified-toolbar-on.png</file>
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 7f0f07e912..4f5a208f43 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -154,6 +154,8 @@ public:
void setMenubar(QCocoaMenuBar *mb);
QCocoaMenuBar *menubar() const;
+ void setWindowCursor(NSCursor *cursor);
+
void registerTouch(bool enable);
qreal devicePixelRatio() const;
@@ -190,11 +192,13 @@ public: // for QNSView
Qt::WindowState m_synchedWindowState;
Qt::WindowModality m_windowModality;
QPointer<QWindow> m_activePopupWindow;
- QPointer<QWindow> m_underMouseWindow;
+ QPointer<QWindow> m_enterLeaveTargetWindow;
+ bool m_windowUnderMouse;
bool m_inConstructor;
QCocoaGLContext *m_glContext;
QCocoaMenuBar *m_menubar;
+ NSCursor *m_windowCursor;
bool m_hasModalSession;
bool m_frameStrutEventsEnabled;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 845cc1202f..4da47f4f1f 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -206,9 +206,11 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_nsWindowDelegate(0)
, m_synchedWindowState(Qt::WindowActive)
, m_windowModality(Qt::NonModal)
+ , m_windowUnderMouse(false)
, m_inConstructor(true)
, m_glContext(0)
, m_menubar(0)
+ , m_windowCursor(0)
, m_hasModalSession(false)
, m_frameStrutEventsEnabled(false)
, m_isExposed(false)
@@ -463,19 +465,19 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
{
Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
NSInteger styleMask = NSBorderlessWindowMask;
+ if (flags & Qt::FramelessWindowHint)
+ return styleMask;
if ((type & Qt::Popup) == Qt::Popup) {
- if (!windowIsPopupType(type) && !(flags & Qt::FramelessWindowHint))
+ if (!windowIsPopupType(type))
styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSTitledWindowMask);
} else {
- // Filter flags for supported properties
- flags &= Qt::WindowType_Mask | Qt::FramelessWindowHint | Qt::WindowTitleHint |
- Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint;
- if (flags == Qt::Window) {
+ if (type == Qt::Window && !(flags & Qt::CustomizeWindowHint)) {
styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);
- } else if ((flags & Qt::Dialog) == Qt::Dialog) {
+ } else if (type == Qt::Dialog) {
if (flags & Qt::CustomizeWindowHint) {
- styleMask = NSResizableWindowMask;
+ if (flags & Qt::WindowMaximizeButtonHint)
+ styleMask = NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;
if (flags & Qt::WindowCloseButtonHint)
@@ -485,8 +487,8 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
} else {
styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask;
}
- } else if (!(flags & Qt::FramelessWindowHint)) {
- if ((flags & Qt::Dialog) || (flags & Qt::WindowMaximizeButtonHint))
+ } else {
+ if (flags & Qt::WindowMaximizeButtonHint)
styleMask |= NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;
@@ -711,7 +713,10 @@ WId QCocoaWindow::winId() const
void QCocoaWindow::setParent(const QPlatformWindow *parentWindow)
{
// recreate the window for compatibility
+ bool unhideAfterRecreate = parentWindow && !m_contentViewIsToBeEmbedded && ![m_contentView isHidden];
recreateWindow(parentWindow);
+ if (unhideAfterRecreate)
+ [m_contentView setHidden:NO];
setCocoaGeometry(geometry());
}
@@ -1030,6 +1035,23 @@ QCocoaMenuBar *QCocoaWindow::menubar() const
return m_menubar;
}
+void QCocoaWindow::setWindowCursor(NSCursor *cursor)
+{
+ // This function is called (via QCocoaCursor) by Qt to set
+ // the cursor for this window. It can be called for a window
+ // that is not currenly under the mouse pointer (for example
+ // for a popup window.) Qt expects the set cursor to "stick":
+ // it should be accociated with the window until a different
+ // cursor is set.
+
+ // Cocoa has different abstractions. We can set the cursor *now*:
+ if (m_windowUnderMouse)
+ [cursor set];
+ // or we can set the cursor on mouse enter/leave using tracking
+ // areas. This is done in QNSView, save the cursor:
+ m_windowCursor = cursor;
+}
+
void QCocoaWindow::registerTouch(bool enable)
{
m_registerTouchCount += enable ? 1 : -1;
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm
index 95143fd8ea..b5c50d676f 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.mm
+++ b/src/plugins/platforms/cocoa/qmacclipboard.mm
@@ -105,7 +105,8 @@ QMacPasteboard::~QMacPasteboard()
for (int i = 0; i < promises.count(); ++i) {
const Promise &promise = promises.at(i);
QCFString flavor = QCFString(promise.convertor->flavorFor(promise.mime));
- promiseKeeper(paste, (PasteboardItemID)promise.itemId, flavor, this);
+ NSInteger pbItemId = promise.itemId;
+ promiseKeeper(paste, reinterpret_cast<PasteboardItemID>(pbItemId), flavor, this);
}
if (paste)
@@ -311,9 +312,9 @@ QMacPasteboard::setMimeData(QMimeData *mime_src)
int numItems = c->count(mime_src);
for (int item = 0; item < numItems; ++item) {
- const int itemID = item+1; //id starts at 1
+ const NSInteger itemID = item+1; //id starts at 1
promises.append(QMacPasteboard::Promise(itemID, c, mimeType, mimeData, item));
- PasteboardPutItemFlavor(paste, (PasteboardItemID)itemID, QCFString(flavor), 0, kPasteboardFlavorNoFlags);
+ PasteboardPutItemFlavor(paste, reinterpret_cast<PasteboardItemID>(itemID), QCFString(flavor), 0, kPasteboardFlavorNoFlags);
#ifdef DEBUG_PASTEBOARD
qDebug(" - adding %d %s [%s] <%s> [%d]",
itemID, qPrintable(mimeType), qPrintable(flavor), qPrintable(c->convertorName()), item);
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index f90fc6b205..71c4de3b69 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -496,7 +496,7 @@ static QTouchDevice *touchDevice = 0;
return YES;
}
-- (void)convertFromEvent:(NSEvent *)event toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint
+- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint
{
// Calculate the mouse position in the QWindow and Qt screen coordinate system,
// starting from coordinates in the NSWindow coordinate system.
@@ -516,23 +516,22 @@ static QTouchDevice *touchDevice = 0;
// NSView and QWindow are equal coordinate systems: the QWindow covers the
// entire NSView, and we've set the NSView's isFlipped property to true.
- NSPoint nsWindowPoint = [event locationInWindow]; // NSWindow coordinates
-
- NSPoint nsViewPoint = [self convertPoint: nsWindowPoint fromView: nil]; // NSView/QWindow coordinates
- *qtWindowPoint = QPointF(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates
-
NSWindow *window = [self window];
+ NSPoint nsWindowPoint;
// Use convertRectToScreen if available (added in 10.7).
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if ([window respondsToSelector:@selector(convertRectToScreen:)]) {
- NSRect screenRect = [window convertRectToScreen : NSMakeRect(nsWindowPoint.x, nsWindowPoint.y, 0, 0)]; // OS X screen coordinates
- *qtScreenPoint = QPointF(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y)); // Qt screen coordinates
+ if ([window respondsToSelector:@selector(convertRectFromScreen:)]) {
+ NSRect windowRect = [window convertRectFromScreen:NSMakeRect(mouseLocation.x, mouseLocation.y, 1, 1)];
+ nsWindowPoint = windowRect.origin; // NSWindow coordinates
} else
#endif
{
- NSPoint screenPoint = [window convertBaseToScreen : NSMakePoint(nsWindowPoint.x, nsWindowPoint.y)];
- *qtScreenPoint = QPointF(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
+ nsWindowPoint = [window convertScreenToBase:mouseLocation]; // NSWindow coordinates
}
+ NSPoint nsViewPoint = [self convertPoint: nsWindowPoint fromView: nil]; // NSView/QWindow coordinates
+ *qtWindowPoint = QPointF(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates
+
+ *qtScreenPoint = QPointF(mouseLocation.x, qt_mac_flipYCoordinate(mouseLocation.y)); // Qt screen coordinates
}
- (void)resetMouseButtons
@@ -546,7 +545,7 @@ static QTouchDevice *touchDevice = 0;
QPointF qtWindowPoint;
QPointF qtScreenPoint;
- [self convertFromEvent:theEvent toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&qtWindowPoint andScreenPoint:&qtScreenPoint];
ulong timestamp = [theEvent timestamp] * 1000;
QCocoaDrag* nativeDrag = static_cast<QCocoaDrag *>(QGuiApplicationPrivate::platformIntegration()->drag());
@@ -672,7 +671,7 @@ static QTouchDevice *touchDevice = 0;
// mouse moves delivered to it (Apple recommends keeping it OFF because there
// is a performance hit). So it goes.
NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp
- | NSTrackingInVisibleRect | NSTrackingMouseMoved;
+ | NSTrackingInVisibleRect | NSTrackingMouseMoved | NSTrackingCursorUpdate;
NSTrackingArea *ta = [[[NSTrackingArea alloc] initWithRect:[self frame]
options:trackingOptions
owner:self
@@ -681,6 +680,13 @@ static QTouchDevice *touchDevice = 0;
[self addTrackingArea:ta];
}
+-(void)cursorUpdate:(NSEvent *)theEvent
+{
+ Q_UNUSED(theEvent)
+ if (m_platformWindow->m_windowCursor)
+ [m_platformWindow->m_windowCursor set];
+}
+
- (void)mouseMoved:(NSEvent *)theEvent
{
if (m_window->flags() & Qt::WindowTransparentForInput)
@@ -688,7 +694,7 @@ static QTouchDevice *touchDevice = 0;
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:theEvent toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindow *childWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
// Top-level windows generate enter-leave events for sub-windows.
@@ -697,9 +703,9 @@ static QTouchDevice *touchDevice = 0;
// handling mouseEnter and mouseLeave envents, since they are sent
// individually to different views.
if (m_platformWindow->m_nsWindow && childWindow) {
- if (childWindow != m_platformWindow->m_underMouseWindow) {
- QWindowSystemInterface::handleEnterLeaveEvent(childWindow, m_platformWindow->m_underMouseWindow, windowPoint, screenPoint);
- m_platformWindow->m_underMouseWindow = childWindow;
+ if (childWindow != m_platformWindow->m_enterLeaveTargetWindow) {
+ QWindowSystemInterface::handleEnterLeaveEvent(childWindow, m_platformWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint);
+ m_platformWindow->m_enterLeaveTargetWindow = childWindow;
}
}
@@ -713,6 +719,8 @@ static QTouchDevice *touchDevice = 0;
- (void)mouseEntered:(NSEvent *)theEvent
{
+ m_platformWindow->m_windowUnderMouse = true;
+
if (m_window->flags() & Qt::WindowTransparentForInput)
return [super mouseEntered:theEvent];
@@ -722,13 +730,15 @@ static QTouchDevice *touchDevice = 0;
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:theEvent toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
- m_platformWindow->m_underMouseWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
- QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_underMouseWindow, windowPoint, screenPoint);
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ m_platformWindow->m_enterLeaveTargetWindow = m_platformWindow->childWindowAt(windowPoint.toPoint());
+ QWindowSystemInterface::handleEnterEvent(m_platformWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint);
}
- (void)mouseExited:(NSEvent *)theEvent
{
+ m_platformWindow->m_windowUnderMouse = false;
+
if (m_window->flags() & Qt::WindowTransparentForInput)
return [super mouseExited:theEvent];
Q_UNUSED(theEvent);
@@ -737,8 +747,8 @@ static QTouchDevice *touchDevice = 0;
if (!m_platformWindow->m_nsWindow)
return;
- QWindowSystemInterface::handleLeaveEvent(m_platformWindow->m_underMouseWindow);
- m_platformWindow->m_underMouseWindow = 0;
+ QWindowSystemInterface::handleLeaveEvent(m_platformWindow->m_enterLeaveTargetWindow);
+ m_platformWindow->m_enterLeaveTargetWindow = 0;
}
- (void)rightMouseDown:(NSEvent *)theEvent
@@ -812,7 +822,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent: theEvent toWindowPoint: &windowPoint andScreenPoint: &screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint: &windowPoint andScreenPoint: &screenPoint];
uint deviceId = [theEvent deviceID];
if (!tabletDeviceDataHash->contains(deviceId)) {
@@ -985,7 +995,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::ZoomNativeGesture,
[event magnification], windowPoint, screenPoint);
}
@@ -1000,7 +1010,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::SmartZoomNativeGesture,
zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint);
zoomIn = !zoomIn;
@@ -1015,7 +1025,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEventWithRealValue(m_window, timestamp, Qt::RotateNativeGesture,
-[event rotation], windowPoint, screenPoint);
}
@@ -1028,7 +1038,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
qreal angle = 0.0f;
if ([event deltaX] == 1)
@@ -1052,7 +1062,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEvent(m_window, timestamp, Qt::BeginNativeGesture,
windowPoint, screenPoint);
}
@@ -1065,7 +1075,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
const NSTimeInterval timestamp = [event timestamp];
QPointF windowPoint;
QPointF screenPoint;
- [self convertFromEvent:event toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleGestureEvent(m_window, timestamp, Qt::EndNativeGesture,
windowPoint, screenPoint);
}
@@ -1125,7 +1135,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
QPointF qt_windowPoint;
QPointF qt_screenPoint;
- [self convertFromEvent:theEvent toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint];
+ [self convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint];
NSTimeInterval timestamp = [theEvent timestamp];
ulong qt_timestamp = timestamp * 1000;
diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
index 86e5066fbb..e8f26aa8c4 100644
--- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm
@@ -47,7 +47,7 @@
#include "qcocoaaccessibilityelement.h"
#include <qpa/qplatformintegration.h>
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#include <QtCore/QDebug>
#import <AppKit/NSAccessibility.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
index 8de8268616..03531916cf 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
@@ -113,7 +113,7 @@ void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPo
#endif
QEglFSWindow *rootWin = m_window->screen()->rootWindow();
- if (!rootWin)
+ if (!rootWin || !rootWin->isRaster())
return;
m_window->create();
@@ -132,13 +132,14 @@ void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents
Q_UNUSED(staticContents);
QEglFSWindow *rootWin = m_window->screen()->rootWindow();
- if (!rootWin)
+ if (!rootWin || !rootWin->isRaster())
return;
m_image = QImage(size, QImage::Format_RGB32);
m_window->create();
rootWin->screen()->rootContext()->makeCurrent(rootWin->window());
+ initializeOpenGLFunctions();
if (m_texture)
glDeleteTextures(1, &m_texture);
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.h b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
index 535428aac1..9af856e8e7 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.h
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.h
@@ -43,6 +43,7 @@
#define QEGLFSBACKINGSTORE_H
#include <qpa/qplatformbackingstore.h>
+#include <QtGui/QOpenGLFunctions>
#include <QImage>
#include <QRegion>
@@ -52,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLPaintDevice;
class QEglFSWindow;
-class QEglFSBackingStore : public QPlatformBackingStore
+class QEglFSBackingStore : public QPlatformBackingStore, public QOpenGLFunctions
{
public:
QEglFSBackingStore(QWindow *window);
diff --git a/src/plugins/platforms/eglfs/qeglfscompositor.cpp b/src/plugins/platforms/eglfs/qeglfscompositor.cpp
index 9db43a57a1..845bb5b3b5 100644
--- a/src/plugins/platforms/eglfs/qeglfscompositor.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscompositor.cpp
@@ -53,7 +53,8 @@ static QEglFSCompositor *compositor = 0;
QEglFSCompositor::QEglFSCompositor()
: m_screen(0),
- m_program(0)
+ m_program(0),
+ m_initialized(false)
{
Q_ASSERT(!compositor);
m_updateTimer.setSingleShot(true);
@@ -86,6 +87,10 @@ void QEglFSCompositor::renderAll()
Q_ASSERT(context);
context->makeCurrent(rootWin->window());
+ if (!m_initialized) {
+ initializeOpenGLFunctions();
+ m_initialized = true;
+ }
ensureProgram();
m_program->bind();
diff --git a/src/plugins/platforms/eglfs/qeglfscompositor.h b/src/plugins/platforms/eglfs/qeglfscompositor.h
index ade2e06031..0d5daafa2c 100644
--- a/src/plugins/platforms/eglfs/qeglfscompositor.h
+++ b/src/plugins/platforms/eglfs/qeglfscompositor.h
@@ -42,7 +42,8 @@
#ifndef QEGLFSCOMPOSITOR_H
#define QEGLFSCOMPOSITOR_H
-#include <QTimer>
+#include <QtCore/QTimer>
+#include <QtGui/QOpenGLFunctions>
QT_BEGIN_NAMESPACE
@@ -50,7 +51,7 @@ class QEglFSScreen;
class QEglFSWindow;
class QOpenGLShaderProgram;
-class QEglFSCompositor : public QObject
+class QEglFSCompositor : public QObject, public QOpenGLFunctions
{
Q_OBJECT
@@ -76,6 +77,7 @@ private:
int m_vertexCoordEntry;
int m_textureCoordEntry;
int m_isRasterEntry;
+ bool m_initialized;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/qeglfscursor.cpp
index c00e86de35..0066426769 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscursor.cpp
@@ -79,7 +79,7 @@ void QEglFSCursor::resetResources()
m_cursorAtlas.texture = 0;
}
-static GLuint createShader(GLenum shaderType, const char *program)
+GLuint QEglFSCursor::createShader(GLenum shaderType, const char *program)
{
GLuint shader = glCreateShader(shaderType);
glShaderSource(shader, 1 /* count */, &program, NULL /* lengths */);
@@ -98,7 +98,7 @@ static GLuint createShader(GLenum shaderType, const char *program)
return 0;
}
-static GLuint createProgram(GLuint vshader, GLuint fshader)
+GLuint QEglFSCursor::createProgram(GLuint vshader, GLuint fshader)
{
GLuint program = glCreateProgram();
glAttachShader(program, vshader);
@@ -286,6 +286,7 @@ void QEglFSCursor::draw(const QRectF &r)
{
if (!m_program) {
// one time initialization
+ initializeOpenGLFunctions();
createShaderPrograms();
if (!m_cursorAtlas.texture) {
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.h b/src/plugins/platforms/eglfs/qeglfscursor.h
index 51a34e041d..71ff73b8f3 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.h
+++ b/src/plugins/platforms/eglfs/qeglfscursor.h
@@ -43,15 +43,15 @@
#define QEGLFSCURSOR_H
#include <qpa/qplatformcursor.h>
+#include <QtGui/QOpenGLFunctions>
#include "qeglfsscreen.h"
-#include <GLES2/gl2.h>
QT_BEGIN_NAMESPACE
class QOpenGLShaderProgram;
class QEglFSScreen;
-class QEglFSCursor : public QPlatformCursor
+class QEglFSCursor : public QPlatformCursor, public QOpenGLFunctions
{
public:
QEglFSCursor(QEglFSScreen *screen);
@@ -78,6 +78,9 @@ protected:
void draw(const QRectF &rect);
void update(const QRegion &region);
+ GLuint createShader(GLenum shaderType, const char *program);
+ GLuint createProgram(GLuint vshader, GLuint fshader);
+
QEglFSScreen *m_screen;
// current cursor information
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 67f0c35ed7..55a822b887 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -74,35 +74,20 @@
#include <EGL/egl.h>
+static void initResources()
+{
+ Q_INIT_RESOURCE(cursor);
+}
+
QT_BEGIN_NAMESPACE
QEglFSIntegration::QEglFSIntegration()
: mFontDb(new QGenericUnixFontDatabase)
, mServices(new QGenericUnixServices)
+ , mScreen(0)
, mInputContext(0)
{
- QEglFSHooks::hooks()->platformInit();
-
- EGLint major, minor;
-
- if (!eglBindAPI(EGL_OPENGL_ES_API)) {
- qWarning("Could not bind GL_ES API\n");
- qFatal("EGL error");
- }
-
- mDisplay = eglGetDisplay(QEglFSHooks::hooks() ? QEglFSHooks::hooks()->platformDisplay() : EGL_DEFAULT_DISPLAY);
- if (mDisplay == EGL_NO_DISPLAY) {
- qWarning("Could not open egl display\n");
- qFatal("EGL error");
- }
-
- if (!eglInitialize(mDisplay, &major, &minor)) {
- qWarning("Could not initialize egl display\n");
- qFatal("EGL error");
- }
-
- mScreen = new QEglFSScreen(mDisplay);
- screenAdded(mScreen);
+ initResources();
}
QEglFSIntegration::~QEglFSIntegration()
@@ -166,10 +151,39 @@ QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const
void QEglFSIntegration::initialize()
{
+ QEglFSHooks::hooks()->platformInit();
+
+ EGLint major, minor;
+
+ if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+ qWarning("Could not bind GL_ES API\n");
+ qFatal("EGL error");
+ }
+
+ mDisplay = eglGetDisplay(QEglFSHooks::hooks() ? QEglFSHooks::hooks()->platformDisplay() : EGL_DEFAULT_DISPLAY);
+ if (mDisplay == EGL_NO_DISPLAY) {
+ qWarning("Could not open egl display\n");
+ qFatal("EGL error");
+ }
+
+ if (!eglInitialize(mDisplay, &major, &minor)) {
+ qWarning("Could not initialize egl display\n");
+ qFatal("EGL error");
+ }
+
+ mScreen = createScreen();
+ screenAdded(mScreen);
+
mInputContext = QPlatformInputContextFactory::create();
+
createInputHandlers();
}
+QEglFSScreen *QEglFSIntegration::createScreen() const
+{
+ return new QEglFSScreen(mDisplay);
+}
+
QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
{
switch (hint)
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index a6fcfc8427..f685eec2d4 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -86,6 +86,9 @@ public:
QPlatformInputContext *inputContext() const { return mInputContext; }
+protected:
+ virtual QEglFSScreen *createScreen() const;
+
private:
void createInputHandlers();
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 3f92d60aa2..758b461b3f 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -126,26 +126,34 @@ void QEglFSScreen::setPrimarySurface(EGLSurface surface)
void QEglFSScreen::addWindow(QEglFSWindow *window)
{
- if (!m_windows.contains(window))
+ if (!m_windows.contains(window)) {
m_windows.append(window);
+ topWindowChanged(window);
+ }
}
void QEglFSScreen::removeWindow(QEglFSWindow *window)
{
m_windows.removeOne(window);
+ if (!m_windows.isEmpty())
+ topWindowChanged(m_windows.last());
}
void QEglFSScreen::moveToTop(QEglFSWindow *window)
{
m_windows.removeOne(window);
m_windows.append(window);
+ topWindowChanged(window);
}
void QEglFSScreen::changeWindowIndex(QEglFSWindow *window, int newIdx)
{
int idx = m_windows.indexOf(window);
- if (idx != -1 && idx != newIdx)
+ if (idx != -1 && idx != newIdx) {
m_windows.move(idx, newIdx);
+ if (newIdx == m_windows.size() - 1)
+ topWindowChanged(m_windows.last());
+ }
}
QEglFSWindow *QEglFSScreen::rootWindow()
@@ -157,4 +165,9 @@ QEglFSWindow *QEglFSScreen::rootWindow()
return 0;
}
+void QEglFSScreen::topWindowChanged(QPlatformWindow *window)
+{
+ Q_UNUSED(window);
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h
index 578a6cf20d..11d66b7e0f 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -85,6 +85,7 @@ public:
protected:
void setPrimarySurface(EGLSurface surface);
+ virtual void topWindowChanged(QPlatformWindow *window);
private:
friend class QEglFSWindow;
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index d6f233b6c5..cc0e64a83b 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -210,15 +210,17 @@ void QEglFSWindow::setVisible(bool visible)
void QEglFSWindow::setGeometry(const QRect &r)
{
QRect rect;
- if (m_flags.testFlag(HasNativeWindow))
+ bool forceFullscreen = m_flags.testFlag(HasNativeWindow);
+ if (forceFullscreen)
rect = screen()->availableGeometry();
else
rect = r;
QPlatformWindow::setGeometry(rect);
+ // if we corrected the size, trigger a resize event
if (rect != r)
- QWindowSystemInterface::handleGeometryChange(window(), rect);
+ QWindowSystemInterface::handleGeometryChange(window(), rect, r);
}
QRect QEglFSWindow::geometry() const
diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.h b/src/plugins/platforms/ios/qiosapplicationdelegate.h
index bfe31af198..617b740d6e 100644
--- a/src/plugins/platforms/ios/qiosapplicationdelegate.h
+++ b/src/plugins/platforms/ios/qiosapplicationdelegate.h
@@ -47,6 +47,5 @@
@interface QIOSApplicationDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
-@property (strong, nonatomic) QIOSViewController *qiosViewController;
@end
diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm
index e06d2b8840..cf702c82af 100644
--- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm
+++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm
@@ -49,7 +49,6 @@
@implementation QIOSApplicationDelegate
@synthesize window;
-@synthesize qiosViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
@@ -57,21 +56,34 @@
Q_UNUSED(launchOptions);
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
- self.qiosViewController = [[[QIOSViewController alloc] init] autorelease];
- self.window.rootViewController = self.qiosViewController;
+ self.window.rootViewController = [[[QIOSViewController alloc] init] autorelease];
-#ifdef QT_DEBUG
- self.window.backgroundColor = [UIColor cyanColor];
+#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_7_0)
+ QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion;
+
+ // We prefer to keep the root viewcontroller in fullscreen layout, so that
+ // we don't have to compensate for the viewcontroller position. This also
+ // gives us the same behavior on iOS 5/6 as on iOS 7, where full screen layout
+ // is the only way.
+ if (iosVersion < QSysInfo::MV_IOS_7_0)
+ self.window.rootViewController.wantsFullScreenLayout = YES;
+
+ // Use translucent statusbar by default on iOS6 iPhones (unless the user changed
+ // the default in the Info.plist), so that windows placed under the stausbar are
+ // still visible, just like on iOS7.
+ if (iosVersion >= QSysInfo::MV_IOS_6_0 && iosVersion < QSysInfo::MV_IOS_7_0
+ && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone
+ && [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault)
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
#endif
- [self.window makeKeyAndVisible];
+ self.window.hidden = NO;
return YES;
}
- (void)dealloc
{
- [qiosViewController release];
[window release];
[super dealloc];
}
diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm
index 2dadc5672b..5ea5fbd8d1 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.mm
+++ b/src/plugins/platforms/ios/qiosbackingstore.mm
@@ -56,6 +56,9 @@ QIOSBackingStore::QIOSBackingStore(QWindow *window)
fmt.setDepthBufferSize(16);
fmt.setStencilBufferSize(8);
+ // Needed to prevent QOpenGLContext::makeCurrent() from failing
+ window->setSurfaceType(QSurface::OpenGLSurface);
+
m_context->setFormat(fmt);
m_context->setScreen(window->screen());
m_context->create();
@@ -69,9 +72,6 @@ QIOSBackingStore::~QIOSBackingStore()
void QIOSBackingStore::beginPaint(const QRegion &)
{
- // Needed to prevent QOpenGLContext::makeCurrent() from failing
- window()->setSurfaceType(QSurface::OpenGLSurface);
-
m_context->makeCurrent(window());
QIOSWindow *iosWindow = static_cast<QIOSWindow *>(window()->handle());
@@ -102,6 +102,8 @@ void QIOSBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
// the child window overlaps a sibling window that's draws using a separate QOpenGLContext.
return;
}
+
+ m_context->makeCurrent(window);
m_context->swapBuffers(window);
}
@@ -115,7 +117,7 @@ void QIOSBackingStore::resize(const QSize &size, const QRegion &staticContents)
// backing store and always keep the paint device's size in sync with the
// window size in beginPaint().
- if (size != window()->size())
+ if (size != window()->size() && !window()->inherits("QWidgetWindow"))
qWarning() << "QIOSBackingStore needs to have the same size as its window";
}
diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h
index 082ec4794c..c48a0251a9 100644
--- a/src/plugins/platforms/ios/qioscontext.h
+++ b/src/plugins/platforms/ios/qioscontext.h
@@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
+class QIOSWindow;
+
class QIOSContext : public QObject, public QPlatformOpenGLContext
{
Q_OBJECT
@@ -66,10 +68,14 @@ public:
GLuint defaultFramebufferObject(QPlatformSurface *) const;
QFunctionPointer getProcAddress(const QByteArray &procName);
+ bool isSharing() const Q_DECL_OVERRIDE;
+ bool isValid() const Q_DECL_OVERRIDE;
+
private Q_SLOTS:
void windowDestroyed(QObject *object);
private:
+ QIOSContext *m_sharedContext;
EAGLContext *m_eaglContext;
QSurfaceFormat m_format;
@@ -83,7 +89,7 @@ private:
static void deleteBuffers(const FramebufferObject &framebufferObject);
- mutable QHash<QWindow *, FramebufferObject> m_framebufferObjects;
+ mutable QHash<QIOSWindow *, FramebufferObject> m_framebufferObjects;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm
index 0c4bee1ef0..7310d2904f 100644
--- a/src/plugins/platforms/ios/qioscontext.mm
+++ b/src/plugins/platforms/ios/qioscontext.mm
@@ -51,7 +51,10 @@
QIOSContext::QIOSContext(QOpenGLContext *context)
: QPlatformOpenGLContext()
- , m_eaglContext([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2])
+ , m_sharedContext(static_cast<QIOSContext *>(context->shareHandle()))
+ , m_eaglContext([[EAGLContext alloc]
+ initWithAPI:kEAGLRenderingAPIOpenGLES2
+ sharegroup:m_sharedContext ? [m_sharedContext->m_eaglContext sharegroup] : nil])
, m_format(context->format())
{
m_format.setRenderableType(QSurfaceFormat::OpenGLES);
@@ -110,7 +113,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
{
Q_ASSERT(surface && surface->surface()->surfaceType() == QSurface::OpenGLSurface);
Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window);
- QWindow *window = static_cast<QWindow *>(surface->surface());
+ QIOSWindow *window = static_cast<QIOSWindow *>(surface);
Q_ASSERT(m_framebufferObjects.contains(window));
[EAGLContext setCurrentContext:m_eaglContext];
@@ -121,7 +124,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface)
GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
{
Q_ASSERT(surface && surface->surface()->surfaceClass() == QSurface::Window);
- QWindow *window = static_cast<QWindow *>(surface->surface());
+ QIOSWindow *window = static_cast<QIOSWindow *>(surface);
FramebufferObject &framebufferObject = m_framebufferObjects[window];
@@ -152,8 +155,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
}
// Ensure that the FBO's buffers match the size of the layer
- QIOSWindow *platformWindow = static_cast<QIOSWindow *>(surface);
- UIView *view = reinterpret_cast<UIView *>(platformWindow->winId());
+ UIView *view = reinterpret_cast<UIView *>(window->winId());
CAEAGLLayer *layer = static_cast<CAEAGLLayer *>(view.layer);
if (framebufferObject.renderbufferWidth != (layer.frame.size.width * layer.contentsScale) ||
framebufferObject.renderbufferHeight != (layer.frame.size.height * layer.contentsScale)) {
@@ -188,7 +190,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const
void QIOSContext::windowDestroyed(QObject *object)
{
- QWindow *window = static_cast<QWindow *>(object);
+ QIOSWindow *window = static_cast<QIOSWindow *>(object);
if (m_framebufferObjects.contains(window)) {
EAGLContext *originalContext = [EAGLContext currentContext];
[EAGLContext setCurrentContext:m_eaglContext];
@@ -203,5 +205,15 @@ QFunctionPointer QIOSContext::getProcAddress(const QByteArray& functionName)
return QFunctionPointer(dlsym(RTLD_DEFAULT, functionName.constData()));
}
+bool QIOSContext::isValid() const
+{
+ return m_eaglContext;
+}
+
+bool QIOSContext::isSharing() const
+{
+ return m_sharedContext;
+}
+
#include "moc_qioscontext.cpp"
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h
index f2272ecd68..5caa7f5d2d 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.h
+++ b/src/plugins/platforms/ios/qioseventdispatcher.h
@@ -54,11 +54,9 @@ public:
explicit QIOSEventDispatcher(QObject *parent = 0);
bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
- void interrupt() Q_DECL_OVERRIDE;
void handleRunLoopExit(CFRunLoopActivity activity);
- void checkIfEventLoopShouldExit();
void interruptEventLoopExec();
private:
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index 3dd9c7ad9f..51eb10d385 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -446,6 +446,8 @@ bool __attribute__((returns_twice)) QIOSEventDispatcher::processEvents(QEventLoo
if (!m_processEventCallsAfterExec && (flags & QEventLoop::EventLoopExec)) {
++m_processEventCallsAfterExec;
+ m_runLoopExitObserver.addToMode(kCFRunLoopCommonModes);
+
// We set a new jump point here that we can return to when the event loop
// is asked to exit, so that we can return from QEventLoop::exec().
switch (setjmp(processEventExitJumpPoint)) {
@@ -475,44 +477,18 @@ bool __attribute__((returns_twice)) QIOSEventDispatcher::processEvents(QEventLoo
if (m_processEventCallsAfterExec)
--m_processEventCallsAfterExec;
- // If we're running with nested event loops and the application is quit,
- // then the forwarded interrupt call will happen while our processEvent
- // counter is still 2, and we won't detect that we're about to fall down
- // to the root iOS run-loop. We do an extra check here to catch that case.
- checkIfEventLoopShouldExit();
-
return processedEvents;
}
-void QIOSEventDispatcher::interrupt()
-{
- QEventDispatcherCoreFoundation::interrupt();
-
- if (!rootLevelRunLoopIntegration())
- return;
-
- // If an interrupt happens as part of a non-nested event loop, that is,
- // by processing an event or timer in the root iOS run-loop, we'll be
- // able to detect it here.
- checkIfEventLoopShouldExit();
-}
-
-void QIOSEventDispatcher::checkIfEventLoopShouldExit()
-{
- if (m_processEventCallsAfterExec == 1) {
- qEventDispatcherDebug() << "Hit root runloop level, watching for runloop exit";
- m_runLoopExitObserver.addToMode(kCFRunLoopCommonModes);
- }
-}
-
void QIOSEventDispatcher::handleRunLoopExit(CFRunLoopActivity activity)
{
Q_UNUSED(activity);
Q_ASSERT(activity == kCFRunLoopExit);
- m_runLoopExitObserver.removeFromMode(kCFRunLoopCommonModes);
-
- interruptEventLoopExec();
+ if (m_processEventCallsAfterExec == 1 && !QThreadData::current()->eventLoops.top()->isRunning()) {
+ qEventDispatcherDebug() << "Root runloop level exited";
+ interruptEventLoopExec();
+ }
}
void QIOSEventDispatcher::interruptEventLoopExec()
@@ -521,6 +497,8 @@ void QIOSEventDispatcher::interruptEventLoopExec()
--m_processEventCallsAfterExec;
+ m_runLoopExitObserver.removeFromMode(kCFRunLoopCommonModes);
+
// We re-set applicationProcessEventsReturnPoint here so that future
// calls to QEventLoop::exec() will end up back here after entering
// processEvents, instead of back in didFinishLaunchingWithOptions.
diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h
index fd328c9171..1c76d29389 100644
--- a/src/plugins/platforms/ios/qiosglobal.h
+++ b/src/plugins/platforms/ios/qiosglobal.h
@@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE
class QPlatformScreen;
bool isQtApplication();
-QIOSViewController *qiosViewController();
-CGRect toCGRect(const QRect &rect);
-QRect fromCGRect(const CGRect &rect);
-CGPoint toCGPoint(const QPoint &point);
-QPoint fromCGPoint(const CGPoint &point);
+CGRect toCGRect(const QRectF &rect);
+QRectF fromCGRect(const CGRect &rect);
+CGPoint toCGPoint(const QPointF &point);
+QPointF fromCGPoint(const CGPoint &point);
+
Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation);
UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation);
QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen);
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index 9b8462a6cc..d749b8f514 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -58,35 +58,24 @@ bool isQtApplication()
return isQt;
}
-QIOSViewController *qiosViewController()
-{
- // If Qt controls the application, we have created a root view controller were we place top-level
- // QWindows. Note that in a mixed native application, our view controller might later be removed or
- // added as a child of another controller. To protect against that, we keep an explicit pointer to the
- // view controller in cases where this is the controller we need to access.
- static QIOSViewController *c = isQtApplication() ?
- static_cast<QIOSApplicationDelegate *>([UIApplication sharedApplication].delegate).qiosViewController : nil;
- return c;
-}
-
-CGRect toCGRect(const QRect &rect)
+CGRect toCGRect(const QRectF &rect)
{
return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
}
-QRect fromCGRect(const CGRect &rect)
+QRectF fromCGRect(const CGRect &rect)
{
- return QRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+ return QRectF(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
}
-CGPoint toCGPoint(const QPoint &point)
+CGPoint toCGPoint(const QPointF &point)
{
return CGPointMake(point.x(), point.y());
}
-QPoint fromCGPoint(const CGPoint &point)
+QPointF fromCGPoint(const CGPoint &point)
{
- return QPoint(point.x, point.y);
+ return QPointF(point.x, point.y);
}
Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation)
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h
index 78c1b260e6..533ba686e1 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.h
+++ b/src/plugins/platforms/ios/qiosinputcontext.h
@@ -44,6 +44,7 @@
#include <UIKit/UIKit.h>
+#include <QtGui/qtransform.h>
#include <qpa/qplatforminputcontext.h>
QT_BEGIN_NAMESPACE
@@ -60,13 +61,17 @@ public:
void showInputPanel();
void hideInputPanel();
bool isInputPanelVisible() const;
+ void setFocusObject(QObject *object);
- void focusViewChanged(UIView *view);
+ void focusWindowChanged(QWindow *focusWindow);
+ void scrollRootView();
private:
QIOSKeyboardListener *m_keyboardListener;
- UIView *m_focusView;
+ UIView<UIKeyInput> *m_focusView;
+ QTransform m_inputItemTransform;
bool m_hasPendingHideRequest;
+ bool m_inSetFocusObject;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index d430589037..0e43429015 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -48,7 +48,12 @@
@public
QIOSInputContext *m_context;
BOOL m_keyboardVisible;
+ BOOL m_keyboardVisibleAndDocked;
QRectF m_keyboardRect;
+ QRectF m_keyboardEndRect;
+ NSTimeInterval m_duration;
+ UIViewAnimationCurve m_curve;
+ UIViewController *m_viewController;
}
@end
@@ -60,8 +65,30 @@
if (self) {
m_context = context;
m_keyboardVisible = NO;
- // After the keyboard became undockable (iOS5), UIKeyboardWillShow/UIKeyboardWillHide
- // no longer works for all cases. So listen to keyboard frame changes instead:
+ m_keyboardVisibleAndDocked = NO;
+ m_duration = 0;
+ m_curve = UIViewAnimationCurveEaseOut;
+ m_viewController = 0;
+
+ if (isQtApplication()) {
+ // Get the root view controller that is on the same screen as the keyboard:
+ for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) {
+ if (uiWindow.screen == [UIScreen mainScreen]) {
+ m_viewController = [uiWindow.rootViewController retain];
+ break;
+ }
+ }
+ Q_ASSERT(m_viewController);
+ }
+
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(keyboardWillShow:)
+ name:@"UIKeyboardWillShowNotification" object:nil];
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(keyboardWillHide:)
+ name:@"UIKeyboardWillHideNotification" object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardDidChangeFrame:)
@@ -72,25 +99,68 @@
- (void) dealloc
{
+ [m_viewController release];
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:@"UIKeyboardWillShowNotification" object:nil];
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:@"UIKeyboardWillHideNotification" object:nil];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:@"UIKeyboardDidChangeFrameNotification" object:nil];
[super dealloc];
}
-- (void) keyboardDidChangeFrame:(NSNotification *)notification
+- (QRectF) getKeyboardRect:(NSNotification *)notification
{
- CGRect frame;
- [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&frame];
+ // For Qt applications we rotate the keyboard rect to align with the screen
+ // orientation (which is the interface orientation of the root view controller).
+ // For hybrid apps we follow native behavior, and return the rect unmodified:
+ CGRect keyboardFrame = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue];
+ if (isQtApplication()) {
+ UIView *view = m_viewController.view;
+ return fromCGRect(CGRectOffset([view convertRect:keyboardFrame fromView:view.window], 0, -view.bounds.origin.y));
+ } else {
+ return fromCGRect(keyboardFrame);
+ }
+}
- m_keyboardRect = fromPortraitToPrimary(fromCGRect(frame), QGuiApplication::primaryScreen()->handle());
+- (void) keyboardDidChangeFrame:(NSNotification *)notification
+{
+ m_keyboardRect = [self getKeyboardRect:notification];
m_context->emitKeyboardRectChanged();
- BOOL visible = CGRectIntersectsRect(frame, [UIScreen mainScreen].bounds);
+ BOOL visible = m_keyboardRect.intersects(fromCGRect([UIScreen mainScreen].bounds));
if (m_keyboardVisible != visible) {
m_keyboardVisible = visible;
m_context->emitInputPanelVisibleChanged();
}
+
+ // If the keyboard was visible and docked from before, this is just a geometry
+ // change (normally caused by an orientation change). In that case, update scroll:
+ if (m_keyboardVisibleAndDocked)
+ m_context->scrollRootView();
+}
+
+- (void) keyboardWillShow:(NSNotification *)notification
+{
+ // Note that UIKeyboardWillShowNotification is only sendt when the keyboard is docked.
+ m_keyboardVisibleAndDocked = YES;
+ m_keyboardEndRect = [self getKeyboardRect:notification];
+ if (!m_duration) {
+ m_duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
+ m_curve = [notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue] << 16;
+ }
+ m_context->scrollRootView();
+}
+
+- (void) keyboardWillHide:(NSNotification *)notification
+{
+ // Note that UIKeyboardWillHideNotification is also sendt when the keyboard is undocked.
+ m_keyboardVisibleAndDocked = NO;
+ m_keyboardEndRect = [self getKeyboardRect:notification];
+ m_context->scrollRootView();
}
@end
@@ -100,7 +170,11 @@ QIOSInputContext::QIOSInputContext()
, m_keyboardListener([[QIOSKeyboardListener alloc] initWithQIOSInputContext:this])
, m_focusView(0)
, m_hasPendingHideRequest(false)
+ , m_inSetFocusObject(false)
{
+ if (isQtApplication())
+ connect(qGuiApp->inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QIOSInputContext::scrollRootView);
+ connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSInputContext::focusWindowChanged);
}
QIOSInputContext::~QIOSInputContext()
@@ -142,10 +216,76 @@ bool QIOSInputContext::isInputPanelVisible() const
return m_keyboardListener->m_keyboardVisible;
}
-void QIOSInputContext::focusViewChanged(UIView *view)
+void QIOSInputContext::setFocusObject(QObject *)
+{
+ m_inputItemTransform = qApp->inputMethod()->inputItemTransform();
+
+ if (!m_focusView || !m_focusView.isFirstResponder)
+ return;
+
+ // Since m_focusView is the first responder, it means that the keyboard is open and we
+ // should update keyboard layout. But there seem to be no way to tell it to reread the
+ // UITextInputTraits from m_focusView. To work around that, we quickly resign first
+ // responder status just to reassign it again. To not remove the focusObject in the same
+ // go, we need to call the super implementation of resignFirstResponder. Since the call
+ // will cause a 'keyboardWillHide' notification to be sendt, we also block scrollRootView
+ // to avoid artifacts:
+ m_inSetFocusObject = true;
+ SEL sel = @selector(resignFirstResponder);
+ [[m_focusView superclass] instanceMethodForSelector:sel](m_focusView, sel);
+ m_inSetFocusObject = false;
+ [m_focusView becomeFirstResponder];
+}
+
+void QIOSInputContext::focusWindowChanged(QWindow *focusWindow)
{
+ UIView<UIKeyInput> *view = reinterpret_cast<UIView<UIKeyInput> *>(focusWindow->handle()->winId());
if ([m_focusView isFirstResponder])
[view becomeFirstResponder];
[m_focusView release];
m_focusView = [view retain];
}
+
+void QIOSInputContext::scrollRootView()
+{
+ // Scroll the root view (screen) if:
+ // - our backend controls the root view controller on the main screen (no hybrid app)
+ // - the focus object is on the same screen as the keyboard.
+ // - the first responder is a QUIView, and not some other foreign UIView.
+ // - the keyboard is docked. Otherwise the user can move the keyboard instead.
+ // - the inputItem has not been moved/scrolled
+ if (!isQtApplication() || !m_focusView || m_inSetFocusObject)
+ return;
+
+ if (m_inputItemTransform != qApp->inputMethod()->inputItemTransform()) {
+ // The inputItem has moved since the last scroll update. To avoid competing
+ // with the application where the cursor/inputItem should be, we bail:
+ return;
+ }
+
+ UIView *view = m_keyboardListener->m_viewController.view;
+ qreal scrollTo = 0;
+
+ if (m_focusView.isFirstResponder
+ && m_keyboardListener->m_keyboardVisibleAndDocked
+ && m_focusView.window == view.window) {
+ QRectF cursorRect = qGuiApp->inputMethod()->cursorRectangle();
+ cursorRect.translate(qGuiApp->focusWindow()->geometry().topLeft());
+ qreal keyboardY = m_keyboardListener->m_keyboardEndRect.y();
+ int statusBarY = qGuiApp->primaryScreen()->availableGeometry().y();
+ const int margin = 20;
+
+ if (cursorRect.bottomLeft().y() > keyboardY - margin)
+ scrollTo = qMin(view.bounds.size.height - keyboardY, cursorRect.y() - statusBarY - margin);
+ }
+
+ if (scrollTo != view.bounds.origin.y) {
+ // Scroll the view the same way a UIScrollView works: by changing bounds.origin:
+ CGRect newBounds = view.bounds;
+ newBounds.origin.y = scrollTo;
+ [UIView animateWithDuration:m_keyboardListener->m_duration delay:0
+ options:m_keyboardListener->m_curve
+ animations:^{ view.bounds = newBounds; }
+ completion:0];
+ }
+}
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index dcad6121be..5c8f67bda2 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -101,7 +101,12 @@ QIOSIntegration::~QIOSIntegration()
bool QIOSIntegration::hasCapability(Capability cap) const
{
switch (cap) {
+ case BufferQueueingOpenGL:
+ return true;
case OpenGL:
+ case ThreadedOpenGL:
+ return true;
+ case ThreadedPixmaps:
return true;
case MultipleWindows:
return true;
@@ -155,7 +160,7 @@ QPlatformServices *QIOSIntegration::services() const
QVariant QIOSIntegration::styleHint(StyleHint hint) const
{
switch (hint) {
- case ShowIsFullScreen:
+ case ShowIsMaximized:
return true;
case SetFocusOnTouchRelease:
return true;
diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h
index 40c7a3ccf7..173bd11719 100644
--- a/src/plugins/platforms/ios/qiosscreen.h
+++ b/src/plugins/platforms/ios/qiosscreen.h
@@ -50,8 +50,10 @@
QT_BEGIN_NAMESPACE
-class QIOSScreen : public QPlatformScreen
+class QIOSScreen : public QObject, public QPlatformScreen
{
+ Q_OBJECT
+
public:
QIOSScreen(unsigned int screenIndex);
~QIOSScreen();
@@ -72,13 +74,18 @@ public:
UIScreen *uiScreen() const;
- void setPrimaryOrientation(Qt::ScreenOrientation orientation);
+ void updateProperties();
+ void layoutWindows();
+
+public slots:
+ void updateStatusBarVisibility();
private:
UIScreen *m_uiScreen;
QRect m_geometry;
QRect m_availableGeometry;
int m_depth;
+ uint m_unscaledDpi;
QSizeF m_physicalSize;
QIOSOrientationListener *m_orientationListener;
};
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index c28d8881bf..57522cb1a3 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -123,8 +123,6 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex)
, m_uiScreen([[UIScreen screens] objectAtIndex:qMin(NSUInteger(screenIndex), [[UIScreen screens] count] - 1)])
, m_orientationListener(0)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
QString deviceIdentifier = deviceModelIdentifier();
if (deviceIdentifier == QStringLiteral("iPhone2,1") /* iPhone 3GS */
@@ -134,32 +132,118 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex)
m_depth = 24;
}
- int unscaledDpi = 163; // Regular iPhone DPI
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad
&& !deviceIdentifier.contains(QRegularExpression("^iPad2,[567]$")) /* excluding iPad Mini */) {
- unscaledDpi = 132;
- };
+ m_unscaledDpi = 132;
+ } else {
+ m_unscaledDpi = 163; // Regular iPhone DPI
+ }
- CGRect bounds = [m_uiScreen bounds];
- m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
+ connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSScreen::updateStatusBarVisibility);
- CGRect frame = m_uiScreen.applicationFrame;
- m_availableGeometry = QRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);
+ updateProperties();
+}
- const qreal millimetersPerInch = 25.4;
- m_physicalSize = QSizeF(m_geometry.size()) / unscaledDpi * millimetersPerInch;
+QIOSScreen::~QIOSScreen()
+{
+ [m_orientationListener release];
+}
- if (isQtApplication()) {
- // When in a non-mixed environment, let QScreen follow the current interface orientation:
- setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(qiosViewController().interfaceOrientation)));
+void QIOSScreen::updateProperties()
+{
+ UIWindow *uiWindow = 0;
+ for (uiWindow in [[UIApplication sharedApplication] windows]) {
+ if (uiWindow.screen == m_uiScreen)
+ break;
}
- [pool release];
+ bool inPortrait = UIInterfaceOrientationIsPortrait(uiWindow.rootViewController.interfaceOrientation);
+ QRect geometry = inPortrait ? fromCGRect(m_uiScreen.bounds).toRect()
+ : QRect(m_uiScreen.bounds.origin.x, m_uiScreen.bounds.origin.y,
+ m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width);
+
+ if (geometry != m_geometry) {
+ m_geometry = geometry;
+
+ const qreal millimetersPerInch = 25.4;
+ m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch;
+
+ QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry);
+ }
+
+ QRect availableGeometry = geometry;
+
+ CGSize applicationFrameSize = m_uiScreen.applicationFrame.size;
+ int statusBarHeight = geometry.height() - (inPortrait ? applicationFrameSize.height : applicationFrameSize.width);
+
+ availableGeometry.adjust(0, statusBarHeight, 0, 0);
+
+ if (availableGeometry != m_availableGeometry) {
+ m_availableGeometry = availableGeometry;
+ QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry);
+ }
+
+ if (screen())
+ layoutWindows();
}
-QIOSScreen::~QIOSScreen()
+void QIOSScreen::updateStatusBarVisibility()
{
- [m_orientationListener release];
+ QWindow *focusWindow = QGuiApplication::focusWindow();
+
+ // If we don't have a focus window we leave the status
+ // bar as is, so that the user can activate a new window
+ // with the same window state without the status bar jumping
+ // back and forth.
+ if (!focusWindow)
+ return;
+
+ UIView *view = reinterpret_cast<UIView *>(focusWindow->handle()->winId());
+#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) {
+ [view.viewController setNeedsStatusBarAppearanceUpdate];
+ } else
+#endif
+ {
+ bool wasHidden = [UIApplication sharedApplication].statusBarHidden;
+ QIOSViewController *viewController = static_cast<QIOSViewController *>(view.viewController);
+ [[UIApplication sharedApplication]
+ setStatusBarHidden:[viewController prefersStatusBarHidden]
+ withAnimation:UIStatusBarAnimationNone];
+
+ if ([UIApplication sharedApplication].statusBarHidden != wasHidden)
+ updateProperties();
+ }
+}
+
+void QIOSScreen::layoutWindows()
+{
+ QList<QWindow*> windows = QGuiApplication::topLevelWindows();
+
+ const QRect oldGeometry = screen()->geometry();
+ const QRect oldAvailableGeometry = screen()->availableGeometry();
+ const QRect newGeometry = geometry();
+ const QRect newAvailableGeometry = availableGeometry();
+
+ for (int i = 0; i < windows.size(); ++i) {
+ QWindow *window = windows.at(i);
+
+ if (platformScreenForWindow(window) != this)
+ continue;
+
+ QIOSWindow *platformWindow = static_cast<QIOSWindow *>(window->handle());
+ if (!platformWindow)
+ continue;
+
+ // FIXME: Handle more complex cases of no-state and/or child windows when rotating
+
+ if (window->windowState() & Qt::WindowFullScreen
+ || (window->windowState() & Qt::WindowNoState && window->geometry() == oldGeometry))
+ platformWindow->applyGeometry(newGeometry);
+ else if (window->windowState() & Qt::WindowMaximized
+ || (window->windowState() & Qt::WindowNoState && window->geometry() == oldAvailableGeometry))
+ platformWindow->applyGeometry(newAvailableGeometry);
+ }
}
QRect QIOSScreen::geometry() const
@@ -199,7 +283,9 @@ qreal QIOSScreen::devicePixelRatio() const
Qt::ScreenOrientation QIOSScreen::nativeOrientation() const
{
- return Qt::PortraitOrientation;
+ // A UIScreen stays in the native orientation, regardless of rotation
+ return m_uiScreen.bounds.size.width >= m_uiScreen.bounds.size.height ?
+ Qt::LandscapeOrientation : Qt::PortraitOrientation;
}
Qt::ScreenOrientation QIOSScreen::orientation() const
@@ -217,31 +303,11 @@ void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
}
}
-void QIOSScreen::setPrimaryOrientation(Qt::ScreenOrientation orientation)
-{
- // Note that UIScreen never changes orientation, but QScreen should. To work around
- // this, we let QIOSViewController call us whenever interface orientation changes, and
- // use that as primary orientation. After all, the viewcontrollers geometry is what we
- // place QWindows on top of. A problem with this approach is that QIOSViewController is
- // not in use in a mixed environment, which results in no change to primary orientation.
- // We see that as acceptable since Qt should most likely not interfere with orientation
- // for that case anyway.
- bool portrait = screen()->isPortrait(orientation);
- if (portrait && m_geometry.width() < m_geometry.height())
- return;
-
- // Switching portrait/landscape means swapping width/height (and adjusting x/y):
- m_geometry = QRect(0, 0, m_geometry.height(), m_geometry.width());
- m_physicalSize = QSizeF(m_physicalSize.height(), m_physicalSize.width());
- m_availableGeometry = fromPortraitToPrimary(fromCGRect(m_uiScreen.applicationFrame), this);
-
- QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry);
- QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry);
-}
-
UIScreen *QIOSScreen::uiScreen() const
{
return m_uiScreen;
}
+#include "moc_qiosscreen.cpp"
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h
index d5a61cb3f4..a0017808d3 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.h
+++ b/src/plugins/platforms/ios/qiosviewcontroller.h
@@ -42,5 +42,6 @@
#import <UIKit/UIKit.h>
@interface QIOSViewController : UIViewController
+- (BOOL)prefersStatusBarHidden;
@end
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index d315b49776..2e7e44d32c 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -42,20 +42,14 @@
#import "qiosviewcontroller.h"
#include <QtGui/QGuiApplication>
+#include <QtGui/QWindow>
#include <QtGui/QScreen>
#include "qiosscreen.h"
#include "qiosglobal.h"
+#include "qioswindow.h"
@implementation QIOSViewController
-- (void)viewDidLoad
-{
-#ifdef QT_DEBUG
- if (!self.nibName)
- self.view.backgroundColor = [UIColor magentaColor];
-#endif
-}
-
-(BOOL)shouldAutorotate
{
// Until a proper orientation and rotation API is in place, we always auto rotate.
@@ -63,26 +57,56 @@
return YES;
}
+#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0)
-(NSUInteger)supportedInterfaceOrientations
{
// We need to tell iOS that we support all orientations in order to set
// status bar orientation when application content orientation changes.
return UIInterfaceOrientationMaskAll;
}
+#endif
+
+#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
+-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ Q_UNUSED(interfaceOrientation);
+ return YES;
+}
+#endif
-- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
Q_UNUSED(duration);
+ Q_UNUSED(interfaceOrientation);
if (!QCoreApplication::instance())
return; // FIXME: Store orientation for later (?)
- Qt::ScreenOrientation orientation = toQtScreenOrientation(UIDeviceOrientation(toInterfaceOrientation));
- if (orientation == -1)
- return;
-
QIOSScreen *qiosScreen = static_cast<QIOSScreen *>(QGuiApplication::primaryScreen()->handle());
- qiosScreen->setPrimaryOrientation(orientation);
+ qiosScreen->updateProperties();
+}
+
+#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ // Since we don't place anything behind the status bare by default, we
+ // end up with a black area, so we have to enable the white text mode
+ // of the iOS7 statusbar.
+ return UIStatusBarStyleLightContent;
+
+ // FIXME: Try to detect the content underneath the statusbar and choose
+ // an appropriate style, and/or expose Qt APIs to control the style.
+}
+#endif
+
+- (BOOL)prefersStatusBarHidden
+{
+ QWindow *focusWindow = QGuiApplication::focusWindow();
+ if (!focusWindow)
+ return [UIApplication sharedApplication].statusBarHidden;
+
+ QIOSWindow *topLevel = static_cast<QIOSWindow *>(focusWindow->handle())->topLevelWindow();
+ return topLevel->window()->windowState() == Qt::WindowFullScreen;
}
@end
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h
index 20f0aa59b6..a5e122bda1 100644
--- a/src/plugins/platforms/ios/qioswindow.h
+++ b/src/plugins/platforms/ios/qioswindow.h
@@ -52,12 +52,17 @@ class QIOSWindow;
@interface UIView (QIOS)
@property(readonly) QWindow *qwindow;
+@property(readonly) UIViewController *viewController;
@end
QT_BEGIN_NAMESPACE
-class QIOSWindow : public QPlatformWindow
+@class QUIView;
+
+class QIOSWindow : public QObject, public QPlatformWindow
{
+ Q_OBJECT
+
public:
explicit QIOSWindow(QWindow *window);
~QIOSWindow();
@@ -74,20 +79,21 @@ public:
void requestActivateWindow();
qreal devicePixelRatio() const;
- int effectiveWidth() const;
- int effectiveHeight() const;
bool setMouseGrabEnabled(bool grab) { return grab; }
bool setKeyboardGrabEnabled(bool grab) { return grab; }
WId winId() const { return WId(m_view); };
+ QIOSWindow *topLevelWindow() const;
+
private:
- UIView *m_view;
+ void applyGeometry(const QRect &rect);
- QRect m_requestedGeometry;
+ QUIView *m_view;
+
+ QRect m_normalGeometry;
int m_windowLevel;
- qreal m_devicePixelRatio;
void raiseOrLower(bool raise);
void updateWindowLevel();
@@ -95,6 +101,8 @@ private:
inline Qt::WindowType windowType() { return static_cast<Qt::WindowType>(int(window()->flags() & Qt::WindowType_Mask)); }
inline bool windowIsPopup() { return windowType() & Qt::Popup & ~Qt::Window; }
+
+ friend class QIOSScreen;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index dbeec5f5f2..0dd810bdf6 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -48,6 +48,7 @@
#include "qiosviewcontroller.h"
#include "qiosintegration.h"
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qwindow_p.h>
#include <qpa/qplatformintegration.h>
#import <QuartzCore/CAEAGLLayer.h>
@@ -57,7 +58,7 @@
#include <QtDebug>
-@interface EAGLView : UIView <UIKeyInput>
+@interface QUIView : UIView <UIKeyInput>
{
@public
UITextAutocapitalizationType autocapitalizationType;
@@ -82,7 +83,7 @@
@end
-@implementation EAGLView
+@implementation QUIView
+ (Class)layerClass
{
@@ -107,15 +108,7 @@
[NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
- // Set up text input
- autocapitalizationType = UITextAutocapitalizationTypeNone;
- autocorrectionType = UITextAutocorrectionTypeNo;
- enablesReturnKeyAutomatically = NO;
- keyboardAppearance = UIKeyboardAppearanceDefault;
- keyboardType = UIKeyboardTypeDefault;
- returnKeyType = UIReturnKeyDone;
- secureTextEntry = NO;
- m_nextTouchId = 0;
+ [self updateTextInputTraits];
if (isQtApplication())
self.hidden = YES;
@@ -126,6 +119,41 @@
return self;
}
+- (void)willMoveToWindow:(UIWindow *)newWindow
+{
+ // UIKIt will normally set the scale factor of a view to match the corresponding
+ // screen scale factor, but views backed by CAEAGLLayers need to do this manually.
+ self.contentScaleFactor = newWindow && newWindow.screen ?
+ newWindow.screen.scale : [[UIScreen mainScreen] scale];
+
+ // FIXME: Allow the scale factor to be customized through QSurfaceFormat.
+}
+
+- (void)didAddSubview:(UIView *)subview
+{
+ if ([subview isKindOfClass:[QUIView class]])
+ self.clipsToBounds = YES;
+}
+
+- (void)willRemoveSubview:(UIView *)subview
+{
+ for (UIView *view in self.subviews) {
+ if (view != subview && [view isKindOfClass:[QUIView class]])
+ return;
+ }
+
+ self.clipsToBounds = NO;
+}
+
+- (void)setNeedsDisplay
+{
+ [super setNeedsDisplay];
+
+ // We didn't implement drawRect: so we have to manually
+ // mark the layer as needing display.
+ [self.layer setNeedsDisplay];
+}
+
- (void)layoutSubviews
{
// This method is the de facto way to know that view has been resized,
@@ -138,21 +166,67 @@
qWarning() << m_qioswindow->window()
<< "is backed by a UIView that has a transform set. This is not supported.";
- QRect geometry = fromCGRect(self.frame);
- m_qioswindow->QPlatformWindow::setGeometry(geometry);
- QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), geometry);
+ // The original geometry requested by setGeometry() might be different
+ // from what we end up with after applying window constraints.
+ QRect requestedGeometry = m_qioswindow->geometry();
+
+ QRect actualGeometry;
+ if (m_qioswindow->window()->isTopLevel()) {
+ UIWindow *uiWindow = self.window;
+ UIView *rootView = uiWindow.rootViewController.view;
+ CGRect rootViewPositionInRelationToRootViewController =
+ [rootView convertRect:uiWindow.bounds fromView:uiWindow];
+
+ actualGeometry = fromCGRect(CGRectOffset([self.superview convertRect:self.frame toView:rootView],
+ -rootViewPositionInRelationToRootViewController.origin.x,
+ -rootViewPositionInRelationToRootViewController.origin.y
+ + rootView.bounds.origin.y)).toRect();
+ } else {
+ actualGeometry = fromCGRect(self.frame).toRect();
+ }
+
+ // Persist the actual/new geometry so that QWindow::geometry() can
+ // be queried on the resize event.
+ m_qioswindow->QPlatformWindow::setGeometry(actualGeometry);
+
+ QRect previousGeometry = requestedGeometry != actualGeometry ?
+ requestedGeometry : qt_window_private(m_qioswindow->window())->geometry;
- // If we have a new size here we need to resize the FBO's corresponding buffers,
- // but we defer that to when the application calls makeCurrent.
+ QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), actualGeometry, previousGeometry);
+ QWindowSystemInterface::flushWindowSystemEvents();
+
+ if (actualGeometry.size() != previousGeometry.size()) {
+ // Trigger expose event on resize
+ [self setNeedsDisplay];
- [super layoutSubviews];
+ // A new size means we also need to resize the FBO's corresponding buffers,
+ // but we defer that to when the application calls makeCurrent.
+ }
+}
+
+- (void)displayLayer:(CALayer *)layer
+{
+ QRect geometry = fromCGRect(layer.frame).toRect();
+ Q_ASSERT(m_qioswindow->geometry() == geometry);
+ Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible());
+
+ QRegion region = self.hidden ? QRegion() : QRect(QPoint(), geometry.size());
+ QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region);
+ QWindowSystemInterface::flushWindowSystemEvents();
}
- (void)updateTouchList:(NSSet *)touches withState:(Qt::TouchPointState)state
{
- // We deliver touch events with global coordinates. But global in this respect means
- // the coordinate system where this QWindow lives. And that is our superview.
- CGSize parentSize = self.superview.frame.size;
+ // We deliver touch events in global coordinates. But global in this respect
+ // means the same coordinate system that we use for describing the geometry
+ // of the top level QWindow we're inside. And that would be the coordinate
+ // system of the superview of the UIView that backs that window:
+ QPlatformWindow *topLevel = m_qioswindow;
+ while (QPlatformWindow *topLevelParent = topLevel->parent())
+ topLevel = topLevelParent;
+ UIView *rootView = reinterpret_cast<UIView *>(topLevel->winId()).superview;
+ CGSize rootViewSize = rootView.frame.size;
+
foreach (UITouch *uiTouch, m_activeTouches.keys()) {
QWindowSystemInterface::TouchPoint &touchPoint = m_activeTouches[uiTouch];
if (![touches containsObject:uiTouch]) {
@@ -160,9 +234,9 @@
} else {
touchPoint.state = state;
touchPoint.pressure = (state == Qt::TouchPointReleased) ? 0.0 : 1.0;
- QPoint touchPos = fromCGPoint([uiTouch locationInView:self.superview]);
+ QPoint touchPos = fromCGPoint([uiTouch locationInView:rootView]).toPoint();
touchPoint.area = QRectF(touchPos, QSize(0, 0));
- touchPoint.normalPosition = QPointF(touchPos.x() / parentSize.width, touchPos.y() / parentSize.height);
+ touchPoint.normalPosition = QPointF(touchPos.x() / rootViewSize.width, touchPos.y() / rootViewSize.height);
}
}
}
@@ -218,15 +292,26 @@
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
- Q_UNUSED(touches) // ### can a subset of the active touches be cancelled?
+ if (!touches && m_activeTouches.isEmpty())
+ return;
+
+ if (!touches) {
+ m_activeTouches.clear();
+ } else {
+ for (UITouch *touch in touches)
+ m_activeTouches.remove(touch);
+
+ Q_ASSERT_X(m_activeTouches.isEmpty(), Q_FUNC_INFO,
+ "Subset of active touches cancelled by UIKit");
+ }
- // Clear current touch points
- m_activeTouches.clear();
m_nextTouchId = 0;
+ NSTimeInterval timestamp = event ? event.timestamp : [[NSProcessInfo processInfo] systemUptime];
+
// Send cancel touch event synchronously
QIOSIntegration *iosIntegration = static_cast<QIOSIntegration *>(QGuiApplicationPrivate::platformIntegration());
- QWindowSystemInterface::handleTouchCancelEvent(m_qioswindow->window(), ulong(event.timestamp * 1000), iosIntegration->touchDevice());
+ QWindowSystemInterface::handleTouchCancelEvent(m_qioswindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice());
QWindowSystemInterface::flushWindowSystemEvents();
}
@@ -250,13 +335,17 @@
// user cannot type. And since the keyboard will open when a view becomes
// the first responder, it's now a good time to inform QPA that the QWindow
// this view backs became active:
+ [self updateTextInputTraits];
QWindowSystemInterface::handleWindowActivated(m_qioswindow->window());
return [super becomeFirstResponder];
}
- (BOOL)resignFirstResponder
{
- QWindowSystemInterface::handleWindowActivated(0);
+ // Resigning first responed status means that the virtual keyboard was closed, or
+ // some other view became first responder. In either case we clear the focus object to
+ // avoid blinking cursors in line edits etc:
+ static_cast<QWindowPrivate *>(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject();
return [super resignFirstResponder];
}
@@ -269,8 +358,11 @@
{
QString string = QString::fromUtf8([text UTF8String]);
int key = 0;
- if ([text isEqualToString:@"\n"])
+ if ([text isEqualToString:@"\n"]) {
key = (int)Qt::Key_Return;
+ if (self.returnKeyType == UIReturnKeyDone)
+ [self resignFirstResponder];
+ }
// Send key event to window system interface
QWindowSystemInterface::handleKeyEvent(
@@ -288,14 +380,65 @@
0, QEvent::KeyRelease, (int)Qt::Key_Backspace, Qt::NoModifier);
}
+- (void)updateTextInputTraits
+{
+ // Ask the current focus object what kind of input it
+ // expects, and configure the keyboard appropriately:
+ QObject *focusObject = QGuiApplication::focusObject();
+ if (!focusObject)
+ return;
+ QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImHints);
+ if (!QCoreApplication::sendEvent(focusObject, &queryEvent))
+ return;
+ if (!queryEvent.value(Qt::ImEnabled).toBool())
+ return;
+
+ Qt::InputMethodHints hints = static_cast<Qt::InputMethodHints>(queryEvent.value(Qt::ImHints).toUInt());
+
+ self.returnKeyType = (hints & Qt::ImhMultiLine) ? UIReturnKeyDefault : UIReturnKeyDone;
+ self.secureTextEntry = BOOL(hints & Qt::ImhHiddenText);
+ self.autocorrectionType = (hints & Qt::ImhNoPredictiveText) ?
+ UITextAutocorrectionTypeNo : UITextAutocorrectionTypeDefault;
+
+ if (hints & Qt::ImhUppercaseOnly)
+ self.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
+ else if (hints & Qt::ImhNoAutoUppercase)
+ self.autocapitalizationType = UITextAutocapitalizationTypeNone;
+ else
+ self.autocapitalizationType = UITextAutocapitalizationTypeSentences;
+
+ if (hints & Qt::ImhUrlCharactersOnly)
+ self.keyboardType = UIKeyboardTypeURL;
+ else if (hints & Qt::ImhEmailCharactersOnly)
+ self.keyboardType = UIKeyboardTypeEmailAddress;
+ else if (hints & Qt::ImhDigitsOnly)
+ self.keyboardType = UIKeyboardTypeNumberPad;
+ else if (hints & Qt::ImhFormattedNumbersOnly)
+ self.keyboardType = UIKeyboardTypeDecimalPad;
+ else if (hints & Qt::ImhDialableCharactersOnly)
+ self.keyboardType = UIKeyboardTypeNumberPad;
+ else
+ self.keyboardType = UIKeyboardTypeDefault;
+}
+
@end
@implementation UIView (QIOS)
- (QWindow *)qwindow
{
- if ([self isKindOfClass:[EAGLView class]])
- return static_cast<EAGLView *>(self)->m_qioswindow->window();
+ if ([self isKindOfClass:[QUIView class]])
+ return static_cast<QUIView *>(self)->m_qioswindow->window();
+ return nil;
+}
+
+- (UIViewController *)viewController
+{
+ id responder = self;
+ while ((responder = [responder nextResponder])) {
+ if ([responder isKindOfClass:UIViewController.class])
+ return responder;
+ }
return nil;
}
@@ -305,26 +448,23 @@ QT_BEGIN_NAMESPACE
QIOSWindow::QIOSWindow(QWindow *window)
: QPlatformWindow(window)
- , m_view([[EAGLView alloc] initWithQIOSWindow:this])
- , m_requestedGeometry(QPlatformWindow::geometry())
+ , m_view([[QUIView alloc] initWithQIOSWindow:this])
+ , m_normalGeometry(QPlatformWindow::geometry())
, m_windowLevel(0)
- , m_devicePixelRatio(1.0)
{
- setParent(parent());
+ setParent(QPlatformWindow::parent());
setWindowState(window->windowState());
-
- // Retina support: get screen scale factor and set it in the content view.
- // This will make framebufferObject() create a 2x frame buffer on retina
- // displays. Also set m_devicePixelRatio which is used for scaling the
- // paint device.
- if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES) {
- m_devicePixelRatio = [[UIScreen mainScreen] scale];
- [m_view setContentScaleFactor: m_devicePixelRatio];
- }
}
QIOSWindow::~QIOSWindow()
{
+ // According to the UIResponder documentation, Cocoa Touch should react to system interruptions
+ // that "might cause the view to be removed from the window" by sending touchesCancelled, but in
+ // practice this doesn't seem to happen when removing the view from its superview. To ensure that
+ // Qt's internal state for touch and mouse handling is kept consistent, we therefor have to force
+ // cancellation of all touch events.
+ [m_view touchesCancelled:0 withEvent:0];
+
[m_view removeFromSuperview];
[m_view release];
}
@@ -337,8 +477,8 @@ bool QIOSWindow::blockedByModal()
void QIOSWindow::setVisible(bool visible)
{
- QPlatformWindow::setVisible(visible);
m_view.hidden = !visible;
+ [m_view setNeedsDisplay];
if (!isQtApplication())
return;
@@ -356,9 +496,13 @@ void QIOSWindow::setVisible(bool visible)
if (visible) {
requestActivateWindow();
+
+ if (window()->isTopLevel())
+ static_cast<QIOSScreen *>(screen())->updateStatusBarVisibility();
+
} else {
// Activate top-most visible QWindow:
- NSArray *subviews = qiosViewController().view.subviews;
+ NSArray *subviews = m_view.viewController.view.subviews;
for (int i = int(subviews.count) - 1; i >= 0; --i) {
UIView *view = [subviews objectAtIndex:i];
if (!view.hidden) {
@@ -373,38 +517,95 @@ void QIOSWindow::setVisible(bool visible)
void QIOSWindow::setGeometry(const QRect &rect)
{
- // If the window is in fullscreen, just bookkeep the requested
- // geometry in case the window goes into Qt::WindowNoState later:
- m_requestedGeometry = rect;
- if (window()->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen))
+ m_normalGeometry = rect;
+
+ if (window()->windowState() != Qt::WindowNoState) {
+ QPlatformWindow::setGeometry(rect);
+
+ // The layout will realize the requested geometry was not applied, and
+ // send geometry-change events that match the actual geometry.
+ [m_view setNeedsLayout];
+
+ if (window()->inherits("QWidgetWindow")) {
+ // QWidget wrongly assumes that setGeometry resets the window
+ // state back to Qt::NoWindowState, so we need to inform it that
+ // that his is not the case by re-issuing the current window state.
+ QWindowSystemInterface::handleWindowStateChanged(window(), window()->windowState());
+
+ // It also needs to be told immediately that the geometry it requested
+ // did not apply, otherwise it will continue on as if it did, instead
+ // of waiting for a resize event.
+ [m_view layoutIfNeeded];
+ }
+
return;
+ }
+
+ applyGeometry(rect);
+}
+
+void QIOSWindow::applyGeometry(const QRect &rect)
+{
+ // Geometry changes are asynchronous, but QWindow::geometry() is
+ // expected to report back the 'requested geometry' until we get
+ // a callback with the updated geometry from the window system.
+ // The baseclass takes care of persisting this for us.
+ QPlatformWindow::setGeometry(rect);
+
+ if (window()->isTopLevel()) {
+ // The QWindow is in QScreen coordinates, which maps to a possibly rotated root-view-controller.
+ // Since the root-view-controller might be translated in relation to the UIWindow, we need to
+ // check specifically for that and compensate. Also check if the root view has been scrolled
+ // as a result of the keyboard being open.
+ UIWindow *uiWindow = m_view.window;
+ UIView *rootView = uiWindow.rootViewController.view;
+ CGRect rootViewPositionInRelationToRootViewController =
+ [rootView convertRect:uiWindow.bounds fromView:uiWindow];
+
+ m_view.frame = CGRectOffset([m_view.superview convertRect:toCGRect(rect) fromView:rootView],
+ rootViewPositionInRelationToRootViewController.origin.x,
+ rootViewPositionInRelationToRootViewController.origin.y
+ + rootView.bounds.origin.y);
+ } else {
+ // Easy, in parent's coordinates
+ m_view.frame = toCGRect(rect);
+ }
+
+ // iOS will automatically trigger -[layoutSubviews:] for resize,
+ // but not for move, so we force it just in case.
+ [m_view setNeedsLayout];
- // Since we don't support transformations on the UIView, we can set the frame
- // directly and let UIKit deal with translating that into bounds and center.
- // Changing the size of the view will end up in a call to -[EAGLView layoutSubviews]
- // which will update QWindowSystemInterface with the new size.
- m_view.frame = toCGRect(rect);
+ if (window()->inherits("QWidgetWindow"))
+ [m_view layoutIfNeeded];
}
void QIOSWindow::setWindowState(Qt::WindowState state)
{
- // FIXME: Figure out where or how we should disable/enable the statusbar.
- // Perhaps setting QWindow to maximized should also mean that we'll show
- // the statusbar, and vice versa for fullscreen?
+ // Update the QWindow representation straight away, so that
+ // we can update the statusbar visibility based on the new
+ // state before applying geometry changes.
+ qt_window_private(window())->windowState = state;
+
+ if (window()->isTopLevel() && window()->isVisible() && window()->isActive())
+ static_cast<QIOSScreen *>(screen())->updateStatusBarVisibility();
switch (state) {
+ case Qt::WindowNoState:
+ applyGeometry(m_normalGeometry);
+ break;
case Qt::WindowMaximized:
- case Qt::WindowFullScreen: {
- // Since UIScreen does not take orientation into account when
- // reporting geometry, we need to look at the top view instead:
- CGSize fullscreenSize = m_view.window.rootViewController.view.bounds.size;
- m_view.frame = CGRectMake(0, 0, fullscreenSize.width, fullscreenSize.height);
- m_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- break; }
- default:
- m_view.frame = toCGRect(m_requestedGeometry);
- m_view.autoresizingMask = UIViewAutoresizingNone;
+ applyGeometry(screen()->availableGeometry());
+ break;
+ case Qt::WindowFullScreen:
+ applyGeometry(screen()->geometry());
break;
+ case Qt::WindowMinimized:
+ applyGeometry(QRect());
+ break;
+ case Qt::WindowActive:
+ Q_UNREACHABLE();
+ default:
+ Q_UNREACHABLE();
}
}
@@ -414,8 +615,30 @@ void QIOSWindow::setParent(const QPlatformWindow *parentWindow)
UIView *parentView = reinterpret_cast<UIView *>(parentWindow->winId());
[parentView addSubview:m_view];
} else if (isQtApplication()) {
- [qiosViewController().view addSubview:m_view];
+ for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) {
+ if (uiWindow.screen == static_cast<QIOSScreen *>(screen())->uiScreen()) {
+ [uiWindow.rootViewController.view addSubview:m_view];
+ break;
+ }
+ }
+ }
+}
+
+QIOSWindow *QIOSWindow::topLevelWindow() const
+{
+ QWindow *window = this->window();
+ while (window) {
+ QWindow *parent = window->parent();
+ if (!parent)
+ parent = window->transientParent();
+
+ if (!parent)
+ break;
+
+ window = parent;
}
+
+ return static_cast<QIOSWindow *>(window->handle());
}
void QIOSWindow::requestActivateWindow()
@@ -423,12 +646,15 @@ void QIOSWindow::requestActivateWindow()
// Note that several windows can be active at the same time if they exist in the same
// hierarchy (transient children). But only one window can be QGuiApplication::focusWindow().
// Dispite the name, 'requestActivateWindow' means raise and transfer focus to the window:
- if (!window()->isTopLevel() || blockedByModal())
+ if (blockedByModal())
return;
- raise();
- QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext();
- static_cast<QIOSInputContext *>(context)->focusViewChanged(m_view);
+ [m_view.window makeKeyWindow];
+
+ if (window()->isTopLevel())
+ raise();
+
+ QWindowSystemInterface::handleWindowActivated(window());
}
void QIOSWindow::raiseOrLower(bool raise)
@@ -444,7 +670,7 @@ void QIOSWindow::raiseOrLower(bool raise)
for (int i = int(subviews.count) - 1; i >= 0; --i) {
UIView *view = static_cast<UIView *>([subviews objectAtIndex:i]);
- if (view.hidden || view == m_view)
+ if (view.hidden || view == m_view || !view.qwindow)
continue;
int level = static_cast<QIOSWindow *>(view.qwindow->handle())->m_windowLevel;
if (m_windowLevel > level || (raise && m_windowLevel == level)) {
@@ -491,17 +717,9 @@ void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientatio
qreal QIOSWindow::devicePixelRatio() const
{
- return m_devicePixelRatio;
-}
-
-int QIOSWindow::effectiveWidth() const
-{
- return geometry().width() * m_devicePixelRatio;
+ return m_view.contentScaleFactor;
}
-int QIOSWindow::effectiveHeight() const
-{
- return geometry().height() * m_devicePixelRatio;
-}
+#include "moc_qioswindow.cpp"
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/kms/qkmsbackingstore.cpp b/src/plugins/platforms/kms/qkmsbackingstore.cpp
index 29395f3b4f..fa4ef847cd 100644
--- a/src/plugins/platforms/kms/qkmsbackingstore.cpp
+++ b/src/plugins/platforms/kms/qkmsbackingstore.cpp
@@ -52,6 +52,7 @@ QKmsBackingStore::QKmsBackingStore(QWindow *window)
, m_context(new QOpenGLContext)
, m_texture(0)
, m_program(0)
+ , m_initialized(false)
{
m_context->setFormat(window->requestedFormat());
m_context->setScreen(window->screen());
@@ -85,6 +86,11 @@ void QKmsBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
m_context->makeCurrent(window);
+ if (!m_initialized) {
+ initializeOpenGLFunctions();
+ m_initialized = true;
+ }
+
if (!m_program) {
static const char *textureVertexProgram =
"attribute highp vec2 vertexCoordEntry;\n"
diff --git a/src/plugins/platforms/kms/qkmsbackingstore.h b/src/plugins/platforms/kms/qkmsbackingstore.h
index 34ea49a346..c5f6c81d18 100644
--- a/src/plugins/platforms/kms/qkmsbackingstore.h
+++ b/src/plugins/platforms/kms/qkmsbackingstore.h
@@ -43,6 +43,7 @@
#define QBACKINGSTORE_KMS_H
#include <qpa/qplatformbackingstore.h>
+#include <QtGui/QOpenGLFunctions>
#include <QImage>
QT_BEGIN_NAMESPACE
@@ -50,7 +51,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLContext;
class QOpenGLShaderProgram;
-class QKmsBackingStore : public QPlatformBackingStore
+class QKmsBackingStore : public QPlatformBackingStore, public QOpenGLFunctions
{
public:
QKmsBackingStore(QWindow *window);
@@ -69,6 +70,7 @@ private:
uint m_texture;
QOpenGLShaderProgram *m_program;
QRegion m_dirty;
+ bool m_initialized;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/kms/qkmsscreen.h b/src/plugins/platforms/kms/qkmsscreen.h
index a90d6fa051..f0c49ad11c 100644
--- a/src/plugins/platforms/kms/qkmsscreen.h
+++ b/src/plugins/platforms/kms/qkmsscreen.h
@@ -55,8 +55,7 @@ extern "C" {
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
+#include <QtGui/qopengl.h>
#include <qpa/qplatformscreen.h>
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index e2c25add0b..100db54a5c 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -5,18 +5,7 @@ QT += platformsupport-private core-private gui-private
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
#CONFIG += qqnx_imf
-# Uncomment this to build with support for PPS based platform integration
-#CONFIG += qqnx_pps
-
-CONFIG(blackberry) {
- CONFIG += qqnx_pps
-
- # Uncomment following line to enable screen event
- # handling through a dedicated thread.
- # CONFIG += qqnx_screeneventthread
-} else {
- CONFIG += qqnx_screeneventthread
-}
+!blackberry:CONFIG += qqnx_screeneventthread
# Uncomment these to enable debugging output for various aspects of the plugin
#DEFINES += QQNXBPSEVENTFILTER_DEBUG
@@ -33,7 +22,6 @@ CONFIG(blackberry) {
#DEFINES += QQNXNAVIGATOREVENTNOTIFIER_DEBUG
#DEFINES += QQNXNAVIGATOR_DEBUG
#DEFINES += QQNXRASTERBACKINGSTORE_DEBUG
-#DEFINES += QQNXROOTWINDOW_DEBUG
#DEFINES += QQNXSCREENEVENTTHREAD_DEBUG
#DEFINES += QQNXSCREENEVENT_DEBUG
#DEFINES += QQNXSCREEN_DEBUG
@@ -50,7 +38,6 @@ SOURCES = main.cpp \
qqnxscreen.cpp \
qqnxwindow.cpp \
qqnxrasterbackingstore.cpp \
- qqnxrootwindow.cpp \
qqnxscreeneventhandler.cpp \
qqnxnativeinterface.cpp \
qqnxnavigatoreventhandler.cpp \
@@ -67,7 +54,6 @@ HEADERS = main.h \
qqnxscreen.h \
qqnxwindow.h \
qqnxrasterbackingstore.h \
- qqnxrootwindow.h \
qqnxscreeneventhandler.h \
qqnxnativeinterface.h \
qqnxnavigatoreventhandler.h \
@@ -144,7 +130,8 @@ CONFIG(qqnx_pps) {
qqnxclipboard.h \
qqnxbuttoneventnotifier.h
- LIBS += -lpps -lclipboard
+ LIBS += -lpps
+ !contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard
CONFIG(qqnx_imf) {
DEFINES += QQNX_IMF
diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.cpp b/src/plugins/platforms/qnx/qqnxeglwindow.cpp
index e8fcdd692b..b57227a60b 100644
--- a/src/plugins/platforms/qnx/qqnxeglwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxeglwindow.cpp
@@ -42,6 +42,7 @@
#include "qqnxeglwindow.h"
#include "qqnxscreen.h"
+#include "qqnxglcontext.h"
#include <QDebug>
@@ -55,14 +56,15 @@
QT_BEGIN_NAMESPACE
-QQnxEglWindow::QQnxEglWindow(QWindow *window, screen_context_t context) :
- QQnxWindow(window, context),
- m_requestedBufferSize(window->geometry().size()),
+QQnxEglWindow::QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow) :
+ QQnxWindow(window, context, needRootWindow),
m_platformOpenGLContext(0),
m_newSurfaceRequested(true),
m_eglSurface(EGL_NO_SURFACE)
{
initWindow();
+ m_requestedBufferSize = screen()->rootWindow() == this ?
+ screen()->geometry().size() : window->geometry().size();
}
QQnxEglWindow::~QQnxEglWindow()
@@ -98,8 +100,6 @@ void QQnxEglWindow::createEGLSurface()
QQnxGLContext::checkEGLError("eglCreateWindowSurface");
qFatal("QQNX: failed to create EGL surface, err=%d", eglGetError());
}
-
- screen()->onWindowPost(0);
}
void QQnxEglWindow::destroyEGLSurface()
@@ -146,6 +146,9 @@ EGLSurface QQnxEglWindow::getSurface()
void QQnxEglWindow::setGeometry(const QRect &rect)
{
+ //If this is the root window, it has to be shown fullscreen
+ const QRect &newGeometry = screen()->rootWindow() == this ? screen()->geometry() : rect;
+
//We need to request that the GL context updates
// the EGLsurface on which it is rendering.
{
@@ -153,11 +156,11 @@ void QQnxEglWindow::setGeometry(const QRect &rect)
// setting m_requestedBufferSize and therefore extended the scope to include
// that test.
const QMutexLocker locker(&m_mutex);
- m_requestedBufferSize = rect.size();
- if (m_platformOpenGLContext != 0 && bufferSize() != rect.size())
+ m_requestedBufferSize = newGeometry.size();
+ if (m_platformOpenGLContext != 0 && bufferSize() != newGeometry.size())
m_newSurfaceRequested.testAndSetRelease(false, true);
}
- QQnxWindow::setGeometry(rect);
+ QQnxWindow::setGeometry(newGeometry);
}
QSize QQnxEglWindow::requestedBufferSize() const
@@ -166,6 +169,13 @@ QSize QQnxEglWindow::requestedBufferSize() const
return m_requestedBufferSize;
}
+void QQnxEglWindow::adjustBufferSize()
+{
+ const QSize windowSize = window()->size();
+ if (windowSize != bufferSize())
+ setBufferSize(windowSize);
+}
+
void QQnxEglWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext)
{
// This function does not take ownership of the platform gl context.
@@ -175,6 +185,9 @@ void QQnxEglWindow::setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContex
int QQnxEglWindow::pixelFormat() const
{
+ if (!m_platformOpenGLContext) //The platform GL context was not set yet
+ return -1;
+
const QSurfaceFormat format = m_platformOpenGLContext->format();
// Extract size of color channels from window format
const int redSize = format.redBufferSize();
diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.h b/src/plugins/platforms/qnx/qqnxeglwindow.h
index e7dae6a458..fc53afcd7a 100644
--- a/src/plugins/platforms/qnx/qqnxeglwindow.h
+++ b/src/plugins/platforms/qnx/qqnxeglwindow.h
@@ -43,8 +43,6 @@
#define QQNXEGLWINDOW_H
#include "qqnxwindow.h"
-#include "qqnxglcontext.h"
-
#include <QtCore/QMutex>
QT_BEGIN_NAMESPACE
@@ -54,7 +52,7 @@ class QQnxGLContext;
class QQnxEglWindow : public QQnxWindow
{
public:
- QQnxEglWindow(QWindow *window, screen_context_t context);
+ QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow);
~QQnxEglWindow();
void createEGLSurface();
@@ -70,7 +68,7 @@ public:
// Called by QQnxGLContext::createSurface()
QSize requestedBufferSize() const;
- WindowType windowType() const Q_DECL_OVERRIDE { return EGL; }
+ void adjustBufferSize();
protected:
int pixelFormat() const;
diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h
index ff57861498..2b12657da9 100644
--- a/src/plugins/platforms/qnx/qqnxglcontext.h
+++ b/src/plugins/platforms/qnx/qqnxglcontext.h
@@ -75,6 +75,8 @@ public:
static EGLDisplay getEglDisplay();
EGLConfig getEglConfig() const { return m_eglConfig;}
+ EGLContext getEglContext() const { return m_eglContext; }
+
private:
//Can be static because different displays returne the same handle
static EGLDisplay ms_eglDisplay;
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index 09054b9eb9..5695ef433a 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -122,6 +122,17 @@ static inline QQnxIntegration::Options parseOptions(const QStringList &paramList
if (!paramList.contains(QLatin1String("no-fullscreen"))) {
options |= QQnxIntegration::FullScreenApplication;
}
+
+// On Blackberry the first window is treated as a root window
+#ifdef Q_OS_BLACKBERRY
+ if (!paramList.contains(QLatin1String("no-rootwindow"))) {
+ options |= QQnxIntegration::RootWindow;
+ }
+#else
+ if (paramList.contains(QLatin1String("rootwindow"))) {
+ options |= QQnxIntegration::RootWindow;
+ }
+#endif
return options;
}
@@ -326,9 +337,10 @@ bool QQnxIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
qIntegrationDebug() << Q_FUNC_INFO;
switch (cap) {
+ case MultipleWindows:
case ThreadedPixmaps:
return true;
-#if defined(QT_OPENGL_ES)
+#if !defined(QT_NO_OPENGL)
case OpenGL:
case ThreadedOpenGL:
case BufferQueueingOpenGL:
@@ -343,12 +355,13 @@ QPlatformWindow *QQnxIntegration::createPlatformWindow(QWindow *window) const
{
qIntegrationDebug() << Q_FUNC_INFO;
QSurface::SurfaceType surfaceType = window->surfaceType();
+ const bool needRootWindow = options() & RootWindow;
switch (surfaceType) {
case QSurface::RasterSurface:
- return new QQnxRasterWindow(window, m_screenContext);
+ return new QQnxRasterWindow(window, m_screenContext, needRootWindow);
#if !defined(QT_NO_OPENGL)
case QSurface::OpenGLSurface:
- return new QQnxEglWindow(window, m_screenContext);
+ return new QQnxEglWindow(window, m_screenContext, needRootWindow);
#endif
default:
qFatal("QQnxWindow: unsupported window API");
diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h
index ab0d6a3156..8b5614fe4f 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.h
+++ b/src/plugins/platforms/qnx/qqnxintegration.h
@@ -1,6 +1,6 @@
/***************************************************************************
**
-** Copyright (C) 2011 - 2012 Research In Motion
+** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -84,7 +84,8 @@ class QQnxIntegration : public QPlatformIntegration
public:
enum Option { // Options to be passed on command line.
NoOptions = 0x0,
- FullScreenApplication = 0x1
+ FullScreenApplication = 0x1,
+ RootWindow = 0x2
};
Q_DECLARE_FLAGS(Options, Option)
explicit QQnxIntegration(const QStringList &paramList);
diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
index 4dd3444832..6e7fc35a82 100644
--- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
+++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
@@ -41,8 +41,11 @@
#include "qqnxnativeinterface.h"
+#include "qqnxglcontext.h"
#include "qqnxscreen.h"
+#include "qqnxwindow.h"
+#include <QtGui/QOpenGLContext>
#include <QtGui/QScreen>
#include <QtGui/QWindow>
@@ -70,4 +73,20 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q
return 0;
}
+void *QQnxNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
+{
+ if (resource == "eglcontext" && context)
+ return static_cast<QQnxGLContext*>(context->handle())->getEglContext();
+
+ return 0;
+}
+
+void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value)
+{
+ if (name == QStringLiteral("mmRendererWindowName")) {
+ QQnxWindow *qnxWindow = static_cast<QQnxWindow*>(window);
+ qnxWindow->setMMRendererWindowName(value.toString());
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h
index 6692da2576..dfd386214e 100644
--- a/src/plugins/platforms/qnx/qqnxnativeinterface.h
+++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h
@@ -51,6 +51,8 @@ class QQnxNativeInterface : public QPlatformNativeInterface
public:
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen);
+ void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
+ void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
index 16ff9d7519..1f974b268d 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
@@ -54,8 +54,8 @@
QT_BEGIN_NAMESPACE
-QQnxRasterWindow::QQnxRasterWindow(QWindow *window, screen_context_t context) :
- QQnxWindow(window, context),
+QQnxRasterWindow::QQnxRasterWindow(QWindow *window, screen_context_t context, bool needRootWindow) :
+ QQnxWindow(window, context, needRootWindow),
m_currentBufferIndex(-1),
m_previousBufferIndex(-1)
{
@@ -115,9 +115,6 @@ void QQnxRasterWindow::post(const QRegion &dirty)
// Save modified region and clear scrolled region
m_previousDirty = dirty;
m_scrolled = QRegion();
- // Notify screen that window posted
- if (screen() != 0)
- screen()->onWindowPost(this);
if (m_cover)
m_cover->updateCover();
@@ -169,6 +166,15 @@ QQnxBuffer &QQnxRasterWindow::renderBuffer()
return m_buffers[m_currentBufferIndex];
}
+void QQnxRasterWindow::adjustBufferSize()
+{
+ // When having a raster window we don't need any buffers, since
+ // Qt will draw to the parent TLW backing store.
+ const QSize windowSize = m_parentWindow ? QSize(1,1) : window()->size();
+ if (windowSize != bufferSize())
+ setBufferSize(windowSize);
+}
+
int QQnxRasterWindow::pixelFormat() const
{
return screen()->nativeFormat();
diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.h b/src/plugins/platforms/qnx/qqnxrasterwindow.h
index 8bd42bc320..ad34b3ccf2 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.h
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class QQnxRasterWindow : public QQnxWindow
{
public:
- QQnxRasterWindow(QWindow *window, screen_context_t context);
+ QQnxRasterWindow(QWindow *window, screen_context_t context, bool needRootWindow);
void post(const QRegion &dirty);
@@ -60,7 +60,7 @@ public:
bool hasBuffers() const { return !bufferSize().isEmpty(); }
- WindowType windowType() const Q_DECL_OVERRIDE { return Raster; }
+ void adjustBufferSize();
protected:
int pixelFormat() const;
@@ -69,6 +69,9 @@ protected:
// Copies content from the previous buffer (back buffer) to the current buffer (front buffer)
void blitPreviousToCurrent(const QRegion &region, int dx, int dy, bool flush=false);
+ void blitHelper(QQnxBuffer &source, QQnxBuffer &target, const QPoint &sourceOffset,
+ const QPoint &targetOffset, const QRegion &region, bool flush = false);
+
private:
QRegion m_previousDirty;
QRegion m_scrolled;
diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp
deleted file mode 100644
index b3f5c87176..0000000000
--- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2011 - 2012 Research In Motion
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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, Digia gives you certain additional
-** rights. These rights are described in the Digia 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.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qqnxrootwindow.h"
-
-#include "qqnxscreen.h"
-
-#include <QtCore/QUuid>
-#include <QtCore/QDebug>
-
-#if defined(QQNXROOTWINDOW_DEBUG)
-#define qRootWindowDebug qDebug
-#else
-#define qRootWindowDebug QT_NO_QDEBUG_MACRO
-#endif
-
-#include <errno.h>
-#include <unistd.h>
-
-static const int MAGIC_ZORDER_FOR_NO_NAV = 10;
-
-QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen)
- : m_screen(screen),
- m_window(0),
- m_windowGroupName(),
- m_translucent(false)
-{
- qRootWindowDebug() << Q_FUNC_INFO;
- // 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("QQnxRootWindow: 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("QQnxRootWindow: 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("QQnxRootWindow: 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("QQnxRootWindow: 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("QQnxRootWindow: 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("QQnxRootWindow: failed to set window buffer size, errno=%d", errno);
-
- errno = 0;
- result = screen_create_window_buffers(m_window, 1);
- if (result != 0)
- qFatal("QQNX: 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("QQnxRootWindow: failed to set window size, errno=%d", errno);
-
- // Fill the window with solid black. Note that the LSB of the pixel value
- // 0x00000000 just happens to be 0x00, so if and when this root window's
- // alpha blending mode is changed from None to Source-Over, it will then
- // be interpreted as transparent.
- errno = 0;
- val[0] = 0;
- result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_COLOR, val);
- if (result != 0)
- qFatal("QQnxRootWindow: 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("QQnxRootWindow: 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("QQnxRootWindow: 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("QQnxRootWindow: failed to set window source size, errno=%d", errno);
-
- errno = 0;
- val[0] = 0;
- val[1] = 0;
- result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_POSITION, val);
- if (result != 0)
- qFatal("QQnxRootWindow: failed to set window source position, errno=%d", errno);
-
- // Optionally disable the screen power save
- bool ok = false;
- const int disablePowerSave = qgetenv("QQNX_DISABLE_POWER_SAVE").toInt(&ok);
- if (ok && disablePowerSave) {
- const int mode = SCREEN_IDLE_MODE_KEEP_AWAKE;
- result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_IDLE_MODE, &mode);
- if (result != 0)
- qWarning("QQnxRootWindow: failed to disable power saving mode");
- }
-
- createWindowGroup();
-
- // Don't post yet. This will be lazily done from QQnxScreen upon first posting of
- // a child window. Doing it now pre-emptively would create a flicker if one of
- // the QWindow's about to be created sets its Qt::WA_TranslucentBackground flag
- // and immediately triggers the buffer re-creation in makeTranslucent().
-}
-
-void QQnxRootWindow::makeTranslucent()
-{
- if (m_translucent)
- return;
-
- int result;
-
- errno = 0;
- const int val = SCREEN_TRANSPARENCY_DISCARD;
- result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val);
- if (result != 0) {
- qFatal("QQnxRootWindow: failed to set window transparency, errno=%d", errno);
- }
-
- m_translucent = true;
- post();
-}
-
-QQnxRootWindow::~QQnxRootWindow()
-{
- // Cleanup top-level QNX window
- screen_destroy_window(m_window);
-}
-
-void QQnxRootWindow::post() const
-{
- qRootWindowDebug() << Q_FUNC_INFO;
- 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("QQnxRootWindow: 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("QQNX: failed to post window buffer, errno=%d", errno);
-}
-
-void QQnxRootWindow::flush() const
-{
- qRootWindowDebug() << Q_FUNC_INFO;
- // Force immediate display update
- errno = 0;
- int result = screen_flush_context(m_screen->nativeContext(), 0);
- if (result != 0)
- qFatal("QQnxRootWindow: failed to flush context, errno=%d", errno);
-}
-
-void QQnxRootWindow::setRotation(int rotation)
-{
- qRootWindowDebug() << Q_FUNC_INFO << "angle =" << rotation;
- errno = 0;
- int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation);
- if (result != 0)
- qFatal("QQnxRootWindow: failed to set window rotation, errno=%d", errno);
-}
-
-void QQnxRootWindow::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("QQnxRootWindow: 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("QQnxRootWindow: failed to set window source size, errno=%d", errno);
-
- // NOTE: display will update when child windows relayout and repaint
-}
-
-void QQnxRootWindow::createWindowGroup()
-{
- // Generate a random window group name
- m_windowGroupName = QUuid::createUuid().toString().toLatin1();
-
- // 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("QQnxRootWindow: failed to create app window group, errno=%d", errno);
-}
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index dd8cf2131a..a09d6ce1f5 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -1,6 +1,6 @@
/***************************************************************************
**
-** Copyright (C) 2011 - 2012 Research In Motion
+** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -119,11 +119,43 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) {
#endif
}
+static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows,
+ const QByteArray &mmWindowId)
+{
+ Q_FOREACH (QQnxWindow *sibling, windows) {
+ if (sibling->mmRendererWindowName() == mmWindowId)
+ return sibling;
+
+ QQnxWindow *mmWindow = findMultimediaWindow(sibling->children(), mmWindowId);
+
+ if (mmWindow)
+ return mmWindow;
+ }
+
+ return 0;
+}
+
+static QQnxWindow *findMultimediaWindow(const QList<QQnxWindow*> windows,
+ screen_window_t mmWindowId)
+{
+ Q_FOREACH (QQnxWindow *sibling, windows) {
+ if (sibling->mmRendererWindow() == mmWindowId)
+ return sibling;
+
+ QQnxWindow *mmWindow = findMultimediaWindow(sibling->children(), mmWindowId);
+
+ if (mmWindow)
+ return mmWindow;
+ }
+
+ return 0;
+}
+
QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen)
: m_screenContext(screenContext),
m_display(display),
+ m_rootWindow(0),
m_primaryScreen(primaryScreen),
- m_posted(false),
m_keyboardHeight(0),
m_nativeOrientation(Qt::PrimaryOrientation),
m_coverWindow(0),
@@ -260,7 +292,8 @@ void QQnxScreen::setRotation(int rotation)
{
qScreenDebug() << Q_FUNC_INFO << "orientation =" << rotation;
// Check if rotation changed
- if (m_currentRotation != rotation) {
+ // We only want to rotate if we are the primary screen
+ if (m_currentRotation != rotation && isPrimaryScreen()) {
// Update rotation of root window
if (rootWindow())
rootWindow()->setRotation(rotation);
@@ -280,15 +313,13 @@ void QQnxScreen::setRotation(int rotation)
if (isOrthogonal(m_currentRotation, rotation)) {
qScreenDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size();
if (rootWindow())
- rootWindow()->resize(m_currentGeometry.size());
+ rootWindow()->setGeometry(QRect(QPoint(0,0), m_currentGeometry.size()));
- if (m_primaryScreen)
- resizeWindows(previousScreenGeometry);
+ resizeWindows(previousScreenGeometry);
} else {
// TODO: Find one global place to flush display updates
// Force immediate display update if no geometry changes required
- if (rootWindow())
- rootWindow()->flush();
+ screen_flush_context(nativeContext(), 0);
}
// Save new rotation
@@ -458,6 +489,8 @@ void QQnxScreen::removeWindow(QQnxWindow *window)
if (window != m_coverWindow) {
const int numWindowsRemoved = m_childWindows.removeAll(window);
+ if (window == m_rootWindow) //We just removed the root window
+ m_rootWindow = 0; //TODO we need a new root window ;)
if (numWindowsRemoved > 0)
updateHierarchy();
} else {
@@ -493,13 +526,15 @@ void QQnxScreen::updateHierarchy()
QList<QQnxWindow*>::const_iterator it;
int result;
- int topZorder;
+ int topZorder = 0;
errno = 0;
- if (isPrimaryScreen()) {
+ if (rootWindow()) {
result = screen_get_window_property_iv(rootWindow()->nativeHandle(), SCREEN_PROPERTY_ZORDER, &topZorder);
- if (result != 0)
- qFatal("QQnxScreen: failed to query root window z-order, errno=%d", errno);
+ if (result != 0) { //This can happen if we use winId in QWidgets
+ topZorder = 10;
+ qWarning("QQnxScreen: failed to query root window z-order, errno=%d", errno);
+ }
} else {
topZorder = 0; //We do not need z ordering on the secondary screen, because only one window
//is supported there
@@ -507,16 +542,17 @@ void QQnxScreen::updateHierarchy()
topZorder++; // root window has the lowest z-order in the windowgroup
+ int underlayZorder = -1;
// Underlays sit immediately above the root window in the z-ordering
Q_FOREACH (screen_window_t underlay, m_underlays) {
// Do nothing when this fails. This can happen if we have stale windows in m_underlays,
// which in turn can happen because a window was removed but we didn't get a notification
// yet.
- screen_set_window_property_iv(underlay, SCREEN_PROPERTY_ZORDER, &topZorder);
- topZorder++;
+ screen_set_window_property_iv(underlay, SCREEN_PROPERTY_ZORDER, &underlayZorder);
+ underlayZorder--;
}
- // Normal Qt windows come next above underlays in the z-ordering
+ // Normal Qt windows come next above the root window z-ordering
for (it = m_childWindows.constBegin(); it != m_childWindows.constEnd(); ++it)
(*it)->updateZorder(topZorder);
@@ -532,20 +568,6 @@ void QQnxScreen::updateHierarchy()
screen_flush_context( m_screenContext, 0 );
}
-void QQnxScreen::onWindowPost(QQnxWindow *window)
-{
- qScreenDebug() << Q_FUNC_INFO;
- 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 && rootWindow()) {
- rootWindow()->post();
- m_posted = true;
- }
-}
-
void QQnxScreen::adjustOrientation()
{
if (!m_primaryScreen)
@@ -585,6 +607,19 @@ void QQnxScreen::addUnderlayWindow(screen_window_t window)
updateHierarchy();
}
+void QQnxScreen::addMultimediaWindow(const QByteArray &id, screen_window_t window)
+{
+ // find the QnxWindow this mmrenderer window is related to
+ QQnxWindow *mmWindow = findMultimediaWindow(m_childWindows, id);
+
+ if (!mmWindow)
+ return;
+
+ mmWindow->setMMRendererWindow(window);
+
+ updateHierarchy();
+}
+
void QQnxScreen::removeOverlayOrUnderlayWindow(screen_window_t window)
{
const int numRemoved = m_overlays.removeAll(window) + m_underlays.removeAll(window);
@@ -610,17 +645,35 @@ void QQnxScreen::newWindowCreated(void *window)
zorder = 0;
}
+ char windowNameBuffer[256] = { 0 };
+ QByteArray windowName;
+
+ if (screen_get_window_property_cv(windowHandle, SCREEN_PROPERTY_ID_STRING,
+ sizeof(windowNameBuffer) - 1, windowNameBuffer) != 0) {
+ qWarning("QQnx: Failed to get id for window, errno=%d", errno);
+ }
+
+ windowName = QByteArray(windowNameBuffer);
+
if (display == nativeDisplay()) {
// A window was created on this screen. If we don't know about this window yet, it means
// it was not created by Qt, but by some foreign library like the multimedia renderer, which
// creates an overlay window when playing a video.
//
- // Treat all foreign windows as overlays or underlays here.
+ // Treat all foreign windows as overlays, underlays or as windows
+ // created by the BlackBerry QtMultimedia plugin.
+ //
+ // In the case of the BlackBerry QtMultimedia plugin, we need to
+ // "attach" the foreign created mmrenderer window to the correct
+ // platform window (usually the one belonging to QVideoWidget) to
+ // ensure proper z-ordering.
//
- // Assume that if a foreign window already has a Z-Order both negative and
+ // Otherwise, assume that if a foreign window already has a Z-Order both negative and
// less than the default Z-Order installed by mmrender on windows it creates,
// the windows should be treated as an underlay. Otherwise, we treat it as an overlay.
- if (!findWindow(windowHandle)) {
+ if (!windowName.isEmpty() && windowName.startsWith("BbVideoWindowControl")) {
+ addMultimediaWindow(windowName, windowHandle);
+ } else if (!findWindow(windowHandle)) {
if (zorder <= MAX_UNDERLAY_ZORDER)
addUnderlayWindow(windowHandle);
else
@@ -634,7 +687,13 @@ void QQnxScreen::windowClosed(void *window)
{
Q_ASSERT(thread() == QThread::currentThread());
const screen_window_t windowHandle = reinterpret_cast<screen_window_t>(window);
- removeOverlayOrUnderlayWindow(windowHandle);
+
+ QQnxWindow *mmWindow = findMultimediaWindow(m_childWindows, windowHandle);
+
+ if (mmWindow)
+ mmWindow->clearMMRendererWindow();
+ else
+ removeOverlayOrUnderlayWindow(windowHandle);
}
void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState state)
@@ -644,7 +703,7 @@ void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState s
if (!rootWindow() || id != rootWindow()->groupName())
return;
- QWindow * const window = topMostChildWindow();
+ QWindow * const window = rootWindow()->window();
if (!window)
return;
@@ -659,7 +718,7 @@ void QQnxScreen::activateWindowGroup(const QByteArray &id)
if (!rootWindow() || id != rootWindow()->groupName())
return;
- QWindow * const window = topMostChildWindow();
+ QWindow * const window = rootWindow()->window();
if (!window)
return;
@@ -686,18 +745,28 @@ void QQnxScreen::deactivateWindowGroup(const QByteArray &id)
Q_FOREACH (QQnxWindow *childWindow, m_childWindows)
childWindow->setExposed(false);
- QWindowSystemInterface::handleWindowActivated(0);
+ QWindowSystemInterface::handleWindowActivated(rootWindow()->window());
}
-QSharedPointer<QQnxRootWindow> QQnxScreen::rootWindow() const
+QQnxWindow *QQnxScreen::rootWindow() const
{
- // We only create the root window if we are the primary display.
- if (m_primaryScreen && !m_rootWindow)
- m_rootWindow = QSharedPointer<QQnxRootWindow>(new QQnxRootWindow(this));
-
return m_rootWindow;
}
+void QQnxScreen::setRootWindow(QQnxWindow *window)
+{
+ // Optionally disable the screen power save
+ bool ok = false;
+ const int disablePowerSave = qgetenv("QQNX_DISABLE_POWER_SAVE").toInt(&ok);
+ if (ok && disablePowerSave) {
+ const int mode = SCREEN_IDLE_MODE_KEEP_AWAKE;
+ int result = screen_set_window_property_iv(window->nativeHandle(), SCREEN_PROPERTY_IDLE_MODE, &mode);
+ if (result != 0)
+ qWarning("QQnxRootWindow: failed to disable power saving mode");
+ }
+ m_rootWindow = window;
+}
+
QWindow * QQnxScreen::topMostChildWindow() const
{
if (!m_childWindows.isEmpty()) {
diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h
index e11030ea0a..61c47e6c72 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.h
+++ b/src/plugins/platforms/qnx/qqnxscreen.h
@@ -44,7 +44,7 @@
#include <qpa/qplatformscreen.h>
-#include "qqnxrootwindow.h"
+#include "qqnxwindow.h"
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
@@ -91,10 +91,10 @@ public:
void lowerWindow(QQnxWindow *window);
void updateHierarchy();
- void onWindowPost(QQnxWindow *window);
void adjustOrientation();
- QSharedPointer<QQnxRootWindow> rootWindow() const;
+ QQnxWindow *rootWindow() const;
+ void setRootWindow(QQnxWindow*);
QPlatformCursor *cursor() const;
@@ -119,15 +119,15 @@ private:
void resizeWindows(const QRect &previousScreenGeometry);
void addOverlayWindow(screen_window_t window);
void addUnderlayWindow(screen_window_t window);
+ void addMultimediaWindow(const QByteArray &id, screen_window_t window);
void removeOverlayOrUnderlayWindow(screen_window_t window);
QWindow *topMostChildWindow() const;
screen_context_t m_screenContext;
screen_display_t m_display;
- mutable QSharedPointer<QQnxRootWindow> m_rootWindow;
+ QQnxWindow *m_rootWindow;
const bool m_primaryScreen;
- bool m_posted;
int m_initialRotation;
int m_currentRotation;
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index a5d6db0985..37071d825c 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qqnxscreeneventhandler.h"
+#if defined(QQNX_SCREENEVENTTHREAD)
+#include "qqnxscreeneventthread.h"
+#endif
#include "qqnxintegration.h"
#include "qqnxkeytranslator.h"
#include "qqnxscreen.h"
@@ -64,6 +67,9 @@ QQnxScreenEventHandler::QQnxScreenEventHandler(QQnxIntegration *integration)
, m_lastButtonState(Qt::NoButton)
, m_lastMouseWindow(0)
, m_touchDevice(0)
+#if defined(QQNX_SCREENEVENTTHREAD)
+ , m_eventThread(0)
+#endif
{
// Create a touch device
m_touchDevice = new QTouchDevice;
@@ -136,6 +142,10 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType)
handleDisplayEvent(event);
break;
+ case SCREEN_EVENT_PROPERTY:
+ handlePropertyEvent(event);
+ break;
+
default:
// event ignored
qScreenEventDebug() << Q_FUNC_INFO << "unknown event" << qnxType;
@@ -189,6 +199,43 @@ void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifie
}
}
+#if defined(QQNX_SCREENEVENTTHREAD)
+void QQnxScreenEventHandler::setScreenEventThread(QQnxScreenEventThread *eventThread)
+{
+ m_eventThread = eventThread;
+}
+
+void QQnxScreenEventHandler::processEventsFromScreenThread()
+{
+ if (!m_eventThread)
+ return;
+
+ QQnxScreenEventArray *events = m_eventThread->lock();
+
+ for (int i = 0; i < events->size(); ++i) {
+ screen_event_t event = events->at(i);
+ if (!event)
+ continue;
+ (*events)[i] = 0;
+
+ m_eventThread->unlock();
+
+ long result = 0;
+ QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance();
+ bool handled = dispatcher && dispatcher->filterNativeEvent(QByteArrayLiteral("screen_event_t"), event, &result);
+ if (!handled)
+ handleEvent(event);
+ screen_destroy_event(event);
+
+ m_eventThread->lock();
+ }
+
+ events->clear();
+
+ m_eventThread->unlock();
+}
+#endif
+
void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event)
{
// get flags of key event
@@ -412,11 +459,20 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType)
if (w) {
// get size of screen which contains window
QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w);
- QSizeF screenSize = platformScreen->physicalSize();
+ QSizeF screenSize = platformScreen->geometry().size();
// 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 );
+ m_touchPoints[touchId].normalPosition =
+ QPointF(static_cast<qreal>(pos[0]) / screenSize.width(),
+ static_cast<qreal>(pos[1]) / screenSize.height());
+
+ m_touchPoints[touchId].area = QRectF(w->geometry().left() + windowPos[0],
+ w->geometry().top() + windowPos[1], 0.0, 0.0);
+ QWindow *parent = w->parent();
+ while (parent) {
+ m_touchPoints[touchId].area.translate(parent->geometry().topLeft());
+ parent = parent->parent();
+ }
// determine event type and update state of current touch point
QEvent::Type type = QEvent::None;
@@ -451,8 +507,8 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType)
// inject event into Qt
QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList);
qScreenEventDebug() << Q_FUNC_INFO << "Qt touch, w =" << w
- << ", p=(" << pos[0] << "," << pos[1]
- << "), t=" << type;
+ << ", p=" << m_touchPoints[touchId].area.topLeft()
+ << ", t=" << type;
}
}
}
@@ -523,6 +579,48 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event)
}
}
+void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event)
+{
+ errno = 0;
+ int objectType;
+ if (screen_get_event_property_iv(event, SCREEN_PROPERTY_OBJECT_TYPE, &objectType) != 0)
+ qFatal("QQNX: failed to query object type property, errno=%d", errno);
+
+ if (objectType != SCREEN_OBJECT_TYPE_WINDOW)
+ return;
+
+ errno = 0;
+ screen_window_t window = 0;
+ if (screen_get_event_property_pv(event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0)
+ qFatal("QQnx: failed to query window property, errno=%d", errno);
+
+ errno = 0;
+ int property;
+ if (screen_get_event_property_iv(event, SCREEN_PROPERTY_NAME, &property) != 0)
+ qFatal("QQnx: failed to query window property, errno=%d", errno);
+
+ switch (property) {
+ case SCREEN_PROPERTY_KEYBOARD_FOCUS:
+ handleKeyboardFocusPropertyEvent(window);
+ break;
+ default:
+ // event ignored
+ qScreenEventDebug() << Q_FUNC_INFO << "Ignore property event for property: " << property;
+ }
+}
+
+void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t window)
+{
+ errno = 0;
+ int focus = 0;
+ if (window && screen_get_window_property_iv(window, SCREEN_PROPERTY_KEYBOARD_FOCUS, &focus) != 0)
+ qFatal("QQnx: failed to query keyboard focus property, errno=%d", errno);
+
+ QWindow *w = focus ? QQnxIntegration::window(window) : 0;
+
+ QWindowSystemInterface::handleWindowActivated(w);
+}
+
#include "moc_qqnxscreeneventhandler.cpp"
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
index af0b086eb8..a7bcd449ee 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
@@ -50,6 +50,9 @@ QT_BEGIN_NAMESPACE
class QQnxIntegration;
class QQnxScreenEventFilter;
+#if defined(QQNX_SCREENEVENTTHREAD)
+class QQnxScreenEventThread;
+#endif
class QQnxScreenEventHandler : public QObject
{
@@ -65,10 +68,19 @@ public:
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
+#if defined(QQNX_SCREENEVENTTHREAD)
+ void setScreenEventThread(QQnxScreenEventThread *eventThread);
+#endif
+
Q_SIGNALS:
void newWindowCreated(void *window);
void windowClosed(void *window);
+#if defined(QQNX_SCREENEVENTTHREAD)
+private Q_SLOTS:
+ void processEventsFromScreenThread();
+#endif
+
private:
void handleKeyboardEvent(screen_event_t event);
void handlePointerEvent(screen_event_t event);
@@ -76,6 +88,8 @@ private:
void handleCloseEvent(screen_event_t event);
void handleCreateEvent(screen_event_t event);
void handleDisplayEvent(screen_event_t event);
+ void handlePropertyEvent(screen_event_t event);
+ void handleKeyboardFocusPropertyEvent(screen_window_t window);
private:
enum {
@@ -90,6 +104,9 @@ private:
QTouchDevice *m_touchDevice;
QWindowSystemInterface::TouchPoint m_touchPoints[MaximumTouchPoints];
QList<QQnxScreenEventFilter*> m_eventFilters;
+#if defined(QQNX_SCREENEVENTTHREAD)
+ QQnxScreenEventThread *m_eventThread;
+#endif
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
index f3f660bc03..25a597bab9 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.cpp
@@ -61,6 +61,9 @@ QQnxScreenEventThread::QQnxScreenEventThread(screen_context_t context, QQnxScree
m_screenEventHandler(screenEventHandler),
m_quit(false)
{
+ screenEventHandler->setScreenEventThread(this);
+ connect(this, SIGNAL(eventPending()), screenEventHandler, SLOT(processEventsFromScreenThread()), Qt::QueuedConnection);
+ connect(this, SIGNAL(finished()), screenEventHandler, SLOT(processEventsFromScreenThread()), Qt::QueuedConnection);
}
QQnxScreenEventThread::~QQnxScreenEventThread()
@@ -74,20 +77,31 @@ void QQnxScreenEventThread::injectKeyboardEvent(int flags, int sym, int mod, int
QQnxScreenEventHandler::injectKeyboardEvent(flags, sym, mod, scan, cap);
}
-void QQnxScreenEventThread::run()
+QQnxScreenEventArray *QQnxScreenEventThread::lock()
{
- screen_event_t event;
+ m_mutex.lock();
+ return &m_events;
+}
- // create screen event
- errno = 0;
- int result = screen_create_event(&event);
- if (result)
- qFatal("QQNX: failed to create screen event, errno=%d", errno);
+void QQnxScreenEventThread::unlock()
+{
+ m_mutex.unlock();
+}
+void QQnxScreenEventThread::run()
+{
qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread started";
// loop indefinitely
while (!m_quit) {
+ screen_event_t event;
+
+ // create screen event
+ errno = 0;
+ int result = screen_create_event(&event);
+ if (result)
+ qFatal("QQNX: failed to create screen event, errno=%d", errno);
+
// block until screen event is available
errno = 0;
@@ -108,14 +122,22 @@ void QQnxScreenEventThread::run()
qScreenEventThreadDebug() << Q_FUNC_INFO << "QNX user screen event";
m_quit = true;
} else {
- m_screenEventHandler->handleEvent(event, qnxType);
+ m_mutex.lock();
+ m_events << event;
+ m_mutex.unlock();
+ emit eventPending();
}
}
qScreenEventThreadDebug() << Q_FUNC_INFO << "screen event thread stopped";
// cleanup
- screen_destroy_event(event);
+ m_mutex.lock();
+ Q_FOREACH (screen_event_t event, m_events) {
+ screen_destroy_event(event);
+ }
+ m_events.clear();
+ m_mutex.unlock();
}
void QQnxScreenEventThread::shutdown()
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.h b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
index 5e931819be..cbdb505b3b 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventthread.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
@@ -43,6 +43,7 @@
#define QQNXSCREENEVENTTHREAD_H
#include <QtCore/QThread>
+#include <QtCore/QMutex>
#include <screen/screen.h>
@@ -50,21 +51,33 @@ QT_BEGIN_NAMESPACE
class QQnxScreenEventHandler;
+typedef QVarLengthArray<screen_event_t, 64> QQnxScreenEventArray;
+
class QQnxScreenEventThread : public QThread
{
+ Q_OBJECT
+
public:
QQnxScreenEventThread(screen_context_t context, QQnxScreenEventHandler *screenEventHandler);
~QQnxScreenEventThread();
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
+ QQnxScreenEventArray *lock();
+ void unlock();
+
protected:
void run();
+Q_SIGNALS:
+ void eventPending();
+
private:
void shutdown();
screen_context_t m_screenContext;
+ QMutex m_mutex;
+ QQnxScreenEventArray m_events;
QQnxScreenEventHandler *m_screenEventHandler;
bool m_quit;
};
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 3969a09098..b25c0b5b29 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -1,6 +1,6 @@
/***************************************************************************
**
-** Copyright (C) 2011 - 2012 Research In Motion
+** Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -40,15 +40,16 @@
****************************************************************************/
#include "qqnxwindow.h"
-#if !defined(QT_NO_OPENGL)
-#include "qqnxglcontext.h"
-#endif
#include "qqnxintegration.h"
#include "qqnxscreen.h"
+#include <QUuid>
+
#include <QtGui/QWindow>
#include <qpa/qwindowsysteminterface.h>
+#include "private/qguiapplication_p.h"
+
#include <QtCore/QDebug>
#if defined(Q_OS_BLACKBERRY)
@@ -69,26 +70,36 @@
QT_BEGIN_NAMESPACE
-QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
+QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow)
: QPlatformWindow(window),
m_screenContext(context),
+ m_parentWindow(0),
m_window(0),
m_screen(0),
- m_parentWindow(0),
m_visible(false),
m_exposed(true),
- m_windowState(Qt::WindowNoState)
+ m_windowState(Qt::WindowNoState),
+ m_mmRendererWindow(0)
{
qWindowDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size();
int result;
- // Create child QNX window
+ QQnxScreen *platformScreen = static_cast<QQnxScreen *>(window->screen()->handle());
+
+ m_isTopLevel = ( needRootWindow && !platformScreen->rootWindow())
+ || (!needRootWindow && !parent())
+ || window->type() == Qt::CoverWindow;
+
errno = 0;
- if (static_cast<QQnxScreen *>(window->screen()->handle())->isPrimaryScreen()
- && window->type() != Qt::CoverWindow) {
- result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW);
+ if (m_isTopLevel) {
+ result = screen_create_window(&m_window, m_screenContext); // Creates an application window
+ if (window->type() != Qt::CoverWindow) {
+ if (needRootWindow)
+ platformScreen->setRootWindow(this);
+ createWindowGroup();
+ }
} else {
- result = screen_create_window(&m_window, m_screenContext);
+ result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW);
}
if (result != 0)
qFatal("QQnxWindow: failed to create window, errno=%d", errno);
@@ -115,20 +126,24 @@ QQnxWindow::~QQnxWindow()
void QQnxWindow::setGeometry(const QRect &rect)
{
- const QRect oldGeometry = setGeometryHelper(rect);
+ QRect newGeometry = rect;
+ if (screen()->rootWindow() == this) //If this is the root window, it has to be shown fullscreen
+ newGeometry = screen()->geometry();
+
+ const QRect oldGeometry = setGeometryHelper(newGeometry);
// Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget).
// Calling flushWindowSystemEvents() here would flush input events which
// could result in re-entering QQnxWindow::setGeometry() again.
QWindowSystemInterface::setSynchronousWindowsSystemEvents(true);
- QWindowSystemInterface::handleGeometryChange(window(), rect);
- QWindowSystemInterface::handleExposeEvent(window(), rect);
+ QWindowSystemInterface::handleGeometryChange(window(), newGeometry);
+ QWindowSystemInterface::handleExposeEvent(window(), newGeometry);
QWindowSystemInterface::setSynchronousWindowsSystemEvents(false);
// Now move all children.
if (!oldGeometry.isEmpty()) {
- const QPoint offset = rect.topLeft() - oldGeometry.topLeft();
+ const QPoint offset = newGeometry.topLeft() - oldGeometry.topLeft();
Q_FOREACH (QQnxWindow *childWindow, m_childWindows)
childWindow->setOffset(offset);
}
@@ -262,16 +277,6 @@ bool QQnxWindow::isExposed() const
return m_visible && m_exposed;
}
-void QQnxWindow::adjustBufferSize()
-{
- if (m_parentWindow)
- return;
-
- const QSize windowSize = window()->size();
- if (windowSize != bufferSize())
- setBufferSize(windowSize);
-}
-
void QQnxWindow::setBufferSize(const QSize &size)
{
qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size;
@@ -290,6 +295,8 @@ void QQnxWindow::setBufferSize(const QSize &size)
// Create window buffers if they do not exist
if (m_bufferSize.isEmpty()) {
val[0] = pixelFormat();
+ if (val[0] == -1) // The platform GL context was not set yet on the window, so we can't procede
+ return;
errno = 0;
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, val);
@@ -303,12 +310,6 @@ void QQnxWindow::setBufferSize(const QSize &size)
qFatal("QQnxWindow: failed to create window buffers, errno=%d", errno);
}
- // If the child window has been configured for transparency, lazily create
- // a full-screen buffer to back the root window.
- if (window()->requestedFormat().hasAlpha()) {
- m_screen->rootWindow()->makeTranslucent();
- }
-
// check if there are any buffers available
int bufferCount = 0;
result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount);
@@ -333,6 +334,9 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen)
if (platformScreen == 0) { // The screen has been destroyed
m_screen = 0;
+ Q_FOREACH (QQnxWindow *childWindow, m_childWindows) {
+ childWindow->setScreen(0);
+ }
return;
}
@@ -342,26 +346,36 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen)
if (m_screen) {
qWindowDebug() << Q_FUNC_INFO << "Moving window to different screen";
m_screen->removeWindow(this);
- screen_leave_window_group(m_window);
+ QQnxIntegration *platformIntegration = static_cast<QQnxIntegration*>(QGuiApplicationPrivate::platformIntegration());
+
+ if ((platformIntegration->options() & QQnxIntegration::RootWindow)) {
+ screen_leave_window_group(m_window);
+ }
}
- platformScreen->addWindow(this);
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("QQnxWindow: failed to set window display, errno=%d", errno);
-
-
- if (m_screen->isPrimaryScreen() && window()->type() != Qt::CoverWindow) {
- // Add window to display's window group
+ if (!m_parentWindow) {
+ platformScreen->addWindow(this);
+ }
+ if (m_isTopLevel) {
+ // Move window to proper screen/display
errno = 0;
- result = screen_join_window_group(m_window, platformScreen->windowGroupName());
+ screen_display_t display = platformScreen->nativeDisplay();
+ int result = screen_set_window_property_pv(m_window, SCREEN_PROPERTY_DISPLAY, (void **)&display);
if (result != 0)
- qFatal("QQnxWindow: failed to join window group, errno=%d", errno);
+ qFatal("QQnxWindow: failed to set window display, errno=%d", errno);
+ } else {
+ errno = 0;
+ int result;
+ if (!parent()) {
+ result = screen_join_window_group(m_window, platformScreen->windowGroupName());
+ if (result != 0)
+ qFatal("QQnxWindow: failed to join window group, errno=%d", errno);
+ } else {
+ result = screen_join_window_group(m_window, static_cast<QQnxWindow*>(parent())->groupName().constData());
+ if (result != 0)
+ qFatal("QQnxWindow: failed to join window group, errno=%d", errno);
+ }
Q_FOREACH (QQnxWindow *childWindow, m_childWindows) {
// Only subwindows and tooltips need necessarily be moved to another display with the window.
@@ -405,20 +419,12 @@ void QQnxWindow::setParent(const QPlatformWindow *window)
setScreen(m_parentWindow->m_screen);
m_parentWindow->m_childWindows.push_back(this);
-
- // we don't need any buffers, since
- // Qt will draw to the parent TLW
- // backing store.
- setBufferSize(QSize(1, 1));
} else {
m_screen->addWindow(this);
-
- // recreate buffers, in case the
- // window has been reparented and
- // becomes a TLW
- adjustBufferSize();
}
+ adjustBufferSize();
+
m_screen->updateHierarchy();
}
@@ -489,6 +495,22 @@ void QQnxWindow::gainedFocus()
QWindowSystemInterface::handleWindowActivated(window());
}
+void QQnxWindow::setMMRendererWindowName(const QString &name)
+{
+ m_mmRendererWindowName = name;
+}
+
+void QQnxWindow::setMMRendererWindow(screen_window_t handle)
+{
+ m_mmRendererWindow = handle;
+}
+
+void QQnxWindow::clearMMRendererWindow()
+{
+ m_mmRendererWindowName.clear();
+ m_mmRendererWindow = 0;
+}
+
QQnxWindow *QQnxWindow::findWindow(screen_window_t windowHandle)
{
if (m_window == windowHandle)
@@ -524,6 +546,15 @@ void QQnxWindow::minimize()
#endif
}
+void QQnxWindow::setRotation(int rotation)
+{
+ qWindowDebug() << Q_FUNC_INFO << "angle =" << rotation;
+ errno = 0;
+ int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &rotation);
+ if (result != 0)
+ qFatal("QQnxRootWindow: failed to set window rotation, errno=%d", errno);
+}
+
void QQnxWindow::initWindow()
{
// Alpha channel is always pre-multiplied if present
@@ -577,23 +608,48 @@ void QQnxWindow::initWindow()
setWindowState(window()->windowState());
if (window()->parent() && window()->parent()->handle())
setParent(window()->parent()->handle());
- setGeometryHelper(window()->geometry());
+
+ if (screen()->rootWindow() == this) {
+ setGeometryHelper(screen()->geometry());
+ QWindowSystemInterface::handleGeometryChange(window(), screen()->geometry());
+ } else {
+ setGeometryHelper(window()->geometry());
+ }
}
+void QQnxWindow::createWindowGroup()
+{
+ // Generate a random window group name
+ m_windowGroupName = QUuid::createUuid().toString().toLatin1();
+
+ // 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("QQnxRootWindow: failed to create app window group, errno=%d", errno);
+}
void QQnxWindow::updateZorder(int &topZorder)
{
- errno = 0;
- int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, &topZorder);
- topZorder++;
+ updateZorder(m_window, topZorder);
- if (result != 0)
- qFatal("QQnxWindow: failed to set window z-order=%d, errno=%d, mWindow=%p", topZorder, errno, m_window);
+ if (m_mmRendererWindow)
+ updateZorder(m_mmRendererWindow, topZorder);
Q_FOREACH (QQnxWindow *childWindow, m_childWindows)
childWindow->updateZorder(topZorder);
}
+void QQnxWindow::updateZorder(screen_window_t window, int &topZorder)
+{
+ errno = 0;
+ int result = screen_set_window_property_iv(window, SCREEN_PROPERTY_ZORDER, &topZorder);
+ topZorder++;
+
+ if (result != 0)
+ qFatal("QQnxWindow: failed to set window z-order=%d, errno=%d, mWindow=%p", topZorder, errno, window);
+}
+
void QQnxWindow::applyWindowState()
{
switch (m_windowState) {
diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h
index f96280848a..3c8070b0be 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.h
+++ b/src/plugins/platforms/qnx/qqnxwindow.h
@@ -66,12 +66,7 @@ class QQnxWindow : public QPlatformWindow
{
friend class QQnxScreen;
public:
- enum WindowType {
- EGL,
- Raster
- };
-
- QQnxWindow(QWindow *window, screen_context_t context);
+ QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow);
virtual ~QQnxWindow();
void setGeometry(const QRect &rect);
@@ -83,7 +78,7 @@ public:
WId winId() const { return (WId)m_window; }
screen_window_t nativeHandle() const { return m_window; }
- void adjustBufferSize();
+ virtual void adjustBufferSize() = 0;
void setBufferSize(const QSize &size);
QSize bufferSize() const { return m_bufferSize; }
@@ -99,6 +94,9 @@ public:
void propagateSizeHints();
void gainedFocus();
+ void setMMRendererWindowName(const QString &name);
+ void setMMRendererWindow(screen_window_t handle);
+ void clearMMRendererWindow();
QQnxScreen *screen() const { return m_screen; }
const QList<QQnxWindow*>& children() const { return m_childWindows; }
@@ -107,7 +105,14 @@ public:
void minimize();
- virtual WindowType windowType() const = 0;
+ QString mmRendererWindowName() const { return m_mmRendererWindowName; }
+
+ screen_window_t mmRendererWindow() const { return m_mmRendererWindow; }
+
+ void setRotation(int rotation);
+
+ QByteArray groupName() const { return m_windowGroupName; }
+
protected:
virtual int pixelFormat() const = 0;
virtual void resetBuffers() = 0;
@@ -117,12 +122,16 @@ protected:
screen_context_t m_screenContext;
QScopedPointer<QQnxAbstractCover> m_cover;
+ QQnxWindow *m_parentWindow;
+
private:
+ void createWindowGroup();
QRect setGeometryHelper(const QRect &rect);
void removeFromParent();
void setOffset(const QPoint &setOffset);
void updateVisibility(bool parentVisible);
void updateZorder(int &topZorder);
+ void updateZorder(screen_window_t window, int &zOrder);
void applyWindowState();
screen_window_t m_window;
@@ -130,11 +139,16 @@ private:
QQnxScreen *m_screen;
QList<QQnxWindow*> m_childWindows;
- QQnxWindow *m_parentWindow;
bool m_visible;
bool m_exposed;
QRect m_unmaximizedGeometry;
Qt::WindowState m_windowState;
+ QString m_mmRendererWindowName;
+ screen_window_t m_mmRendererWindow;
+
+ QByteArray m_windowGroupName;
+
+ bool m_isTopLevel;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 9170c774b4..66ed9d85dc 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -44,7 +44,7 @@
#include "iaccessible2.h"
#include "qwindowsaccessibility.h"
-#include <QtGui/private/qaccessible2_p.h>
+#include <QtGui/qaccessible.h>
#include <QtGui/qclipboard.h>
#include <QtWidgets/qapplication.h>
#include <QtCore/qdebug.h>
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
index 63b4370dc2..885bc37cff 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
@@ -51,7 +51,6 @@
#include <QtCore/qpointer.h>
#include <QtCore/qsettings.h>
#include <QtGui/qaccessible.h>
-#include <QtGui/private/qaccessible2_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformintegration.h>
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 93592eb969..8bb7646258 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -54,7 +54,6 @@
#include <QtCore/qpair.h>
#include <QtCore/qsettings.h>
#include <QtGui/qaccessible.h>
-#include <QtGui/private/qaccessible2_p.h>
#include <QtGui/qguiapplication.h>
#include <qpa/qplatformnativeinterface.h>
#include <QtGui/qwindow.h>
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index f6ed9447ef..7b574b0a56 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -93,6 +93,7 @@ enum WindowsEventType // Simplify event types
NonClientHitTest = NonClientEventFlag + 2,
KeyEvent = KeyEventFlag + 1,
KeyDownEvent = KeyEventFlag + KeyDownEventFlag + 1,
+ KeyboardLayoutChangeEvent = KeyEventFlag + 2,
InputMethodKeyEvent = InputMethodEventFlag + KeyEventFlag + 1,
InputMethodKeyDownEvent = InputMethodEventFlag + KeyEventFlag + KeyDownEventFlag + 1,
ClipboardEvent = ClipboardEventFlag + 1,
@@ -165,6 +166,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
return QtWindows::InputMethodKeyEvent;
case WM_IME_KEYDOWN:
return QtWindows::InputMethodKeyDownEvent;
+#ifdef WM_INPUTLANGCHANGE
+ case WM_INPUTLANGCHANGE:
+ return QtWindows::KeyboardLayoutChangeEvent;
+#endif // WM_INPUTLANGCHANGE
case WM_TOUCH:
return QtWindows::TouchEvent;
case WM_CHANGECBCHAIN:
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index 26205eb146..55e7b85d96 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -149,7 +149,23 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion &region)
QImage::Format format = QWindowsNativeImage::systemFormat();
if (format == QImage::Format_RGB32 && rasterWindow()->window()->format().hasAlpha())
format = QImage::Format_ARGB32_Premultiplied;
- m_image.reset(new QWindowsNativeImage(size.width(), size.height(), format));
+
+ QWindowsNativeImage *oldwni = m_image.data();
+ QWindowsNativeImage *newwni = new QWindowsNativeImage(size.width(), size.height(), format);
+
+ if (oldwni && !region.isEmpty()) {
+ const QImage &oldimg(oldwni->image());
+ QImage &newimg(newwni->image());
+ QRegion staticRegion(region);
+ staticRegion &= QRect(0, 0, oldimg.width(), oldimg.height());
+ staticRegion &= QRect(0, 0, newimg.width(), newimg.height());
+ QPainter painter(&newimg);
+ painter.setCompositionMode(QPainter::CompositionMode_Source);
+ foreach (const QRect &rect, staticRegion.rects())
+ painter.drawImage(rect, oldimg, rect);
+ }
+
+ m_image.reset(newwni);
}
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 85b03673ac..77cac647ba 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -783,9 +783,15 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::InputMethodCloseCandidateWindowEvent:
// TODO: Release/regrab mouse if a popup has mouse grab.
return false;
- case QtWindows::ClipboardEvent:
case QtWindows::DestroyEvent:
-
+ if (!platformWindow->testFlag(QWindowsWindow::WithinDestroy)) {
+ qWarning() << "External WM_DESTROY received for " << platformWindow->window()
+ << ", parent: " << platformWindow->window()->parent()
+ << ", transient parent: " << platformWindow->window()->transientParent();
+ }
+ return false;
+ case QtWindows::ClipboardEvent:
+ return false;
case QtWindows::UnknownEvent:
return false;
case QtWindows::AccessibleObjectFromWindowRequest:
@@ -842,8 +848,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::KeyEvent:
case QtWindows::InputMethodKeyEvent:
case QtWindows::InputMethodKeyDownEvent:
+ case QtWindows::KeyboardLayoutChangeEvent:
#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
- return platformSessionManager()->isInterractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
+ return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
#else
return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
#endif
@@ -867,7 +874,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::NonClientMouseEvent:
if (platformWindow->frameStrutEventsEnabled())
#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
- return platformSessionManager()->isInterractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
+ return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#endif
@@ -887,13 +894,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::MouseEvent:
case QtWindows::LeaveEvent:
#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
- return platformSessionManager()->isInterractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
+ return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#endif
case QtWindows::TouchEvent:
#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
- return platformSessionManager()->isInterractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
+ return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
#endif
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index ac57a1b396..6c928119b3 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -161,12 +161,18 @@ bool QWindowsFontEngine::hasCFFTable() const
return GetFontData(hdc, MAKE_TAG('C', 'F', 'F', ' '), 0, 0, 0) != GDI_ERROR;
}
+bool QWindowsFontEngine::hasCMapTable() const
+{
+ HDC hdc = m_fontEngineData->hdc;
+ SelectObject(hdc, hfont);
+ return GetFontData(hdc, MAKE_TAG('c', 'm', 'a', 'p'), 0, 0, 0) != GDI_ERROR;
+}
+
void QWindowsFontEngine::getCMap()
{
- ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE);
+ ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE) || hasCMapTable();
- // TMPF_TRUETYPE is not set for fonts with CFF tables
- cffTable = !ttf && hasCFFTable();
+ cffTable = hasCFFTable();
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
@@ -374,6 +380,7 @@ HGDIOBJ QWindowsFontEngine::selectDesignFont() const
{
LOGFONT f = m_logfont;
f.lfHeight = unitsPerEm;
+ f.lfWidth = 0;
HFONT designFont = CreateFontIndirect(&f);
return SelectObject(m_fontEngineData->hdc, designFont);
}
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h
index d783b6048c..acf84d270c 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.h
+++ b/src/plugins/platforms/windows/qwindowsfontengine.h
@@ -140,6 +140,7 @@ private:
QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
QImage::Format mask_format);
bool hasCFFTable() const;
+ bool hasCMapTable() const;
const QSharedPointer<QWindowsFontEngineData> m_fontEngineData;
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 47c136991a..2743ef029d 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -86,6 +86,10 @@ QWindowsKeyMapper::~QWindowsKeyMapper()
#define VK_OEM_3 0xC0
#endif
+// We not only need the scancode itself but also the extended bit of key messages. Thus we need
+// the additional bit when masking the scancode.
+enum { scancodeBitmask = 0x1ff };
+
// Key recorder ------------------------------------------------------------------------[ start ] --
struct KeyRecord {
KeyRecord(int c, int a, int s, const QString &t) : code(c), ascii(a), state(s), text(t) {}
@@ -97,6 +101,8 @@ struct KeyRecord {
QString text;
};
+// We need to record the pressed keys in order to decide, whether the key event is an autorepeat
+// event. As soon as its state changes, the chain of autorepeat events will be broken.
static const int QT_MAX_KEY_RECORDINGS = 64; // User has LOTS of fingers...
struct KeyRecorder
{
@@ -503,12 +509,6 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
return code == Qt::Key_unknown ? 0 : code;
}
-int qt_translateKeyCode(int vk)
-{
- int code = winceKeyBend((vk < 0 || vk > 255) ? 0 : vk);
- return code == Qt::Key_unknown ? 0 : code;
-}
-
static inline int asciiToKeycode(char a, int state)
{
if (a >= 'a' && a <= 'z')
@@ -554,12 +554,8 @@ void QWindowsKeyMapper::changeKeyboard()
keyboardInputDirection = bidi ? Qt::RightToLeft : Qt::LeftToRight;
}
-void QWindowsKeyMapper::clearRecordedKeys()
-{
- key_recorder.clearKeys();
-}
-
-
+// Helper function that is used when obtaining the list of characters that can be produced by one key and
+// every possible combination of modifiers
inline void setKbdState(unsigned char *kbd, bool shift, bool ctrl, bool alt)
{
kbd[VK_LSHIFT ] = (shift ? 0x80 : 0);
@@ -570,14 +566,18 @@ inline void setKbdState(unsigned char *kbd, bool shift, bool ctrl, bool alt)
kbd[VK_MENU ] = (alt ? 0x80 : 0);
}
+// Adds the msg's key to keyLayout if it is not yet present there
void QWindowsKeyMapper::updateKeyMap(const MSG &msg)
{
unsigned char kbdBuffer[256]; // Will hold the complete keyboard state
GetKeyboardState(kbdBuffer);
- quint32 scancode = (msg.lParam >> 16) & 0xfff;
+ const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask;
updatePossibleKeyCodes(kbdBuffer, scancode, msg.wParam);
}
+// Fills keyLayout for that vk_key. Values are all characters one can type using that key
+// (in connection with every combination of modifiers) and whether these "characters" are
+// dead keys.
void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode,
quint32 vk_key)
{
@@ -598,6 +598,10 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
buffer[VK_RCONTROL] = 0;
buffer[VK_LMENU ] = 0; // Use right Alt, since left Ctrl + right Alt is considered AltGraph
+ // keyLayout contains the actual characters which can be written using the vk_key together with the
+ // different modifiers. '2' together with shift will for example cause the character
+ // to be @ for a US key layout (thus keyLayout[vk_key].qtKey[1] will be @). In addition to that
+ // it stores whether the resulting key is a dead key as these keys have to be handled later.
bool isDeadKey = false;
keyLayout[vk_key].deadkeys = 0;
keyLayout[vk_key].dirty = false;
@@ -635,8 +639,9 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
}
keyLayout[vk_key].qtKey[8] = fallbackKey;
- // If this vk_key a Dead Key
- if (MapVirtualKey(vk_key, 2) & 0x80000000) {
+ // If one of the values inserted into the keyLayout above, can be considered a dead key, we have
+ // to run the workaround below.
+ if (keyLayout[vk_key].deadkeys) {
// Push a Space, then the original key through the low-level ToAscii functions.
// We do this because these functions (ToAscii / ToUnicode) will alter the internal state of
// the keyboard driver By doing the following, we set the keyboard driver state back to what
@@ -661,17 +666,6 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
}
}
-bool QWindowsKeyMapper::isADeadKey(unsigned int vk_key, unsigned int modifiers)
-{
- if ((vk_key < NumKeyboardLayoutItems) && keyLayout[vk_key].exists) {
- for (size_t i = 0; i < NumMods; ++i) {
- if (uint(ModsTbl[i]) == modifiers)
- return bool(keyLayout[vk_key].deadkeys & 1<<i);
- }
- }
- return false;
-}
-
static inline QString messageKeyText(const MSG &msg)
{
const QChar ch = QChar((ushort)msg.wParam);
@@ -742,12 +736,21 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd,
const MSG &msg, LRESULT *result)
{
*result = 0;
+
+ // Reset layout map when system keyboard layout is changed
+ if (msg.message == WM_INPUTLANGCHANGE) {
+ deleteLayouts();
+ return true;
+ }
+
+ // Add this key to the keymap if it is not present yet.
+ updateKeyMap(msg);
+
MSG peekedMsg;
// consume dead chars?(for example, typing '`','a' resulting in a-accent).
if (PeekMessage(&peekedMsg, hwnd, 0, 0, PM_NOREMOVE) && peekedMsg.message == WM_DEADCHAR)
return true;
- if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
- updateKeyMap(msg);
+
return translateKeyEventInternal(widget, msg, false);
}
@@ -755,9 +758,8 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
{
const int msgType = msg.message;
- const quint32 scancode = (msg.lParam >> 16) & 0xfff;
- const quint32 vk_key = MapVirtualKey(scancode, 1);
- const bool isNumpad = (msg.wParam >= VK_NUMPAD0 && msg.wParam <= VK_NUMPAD9);
+ const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask;
+ const quint32 vk_key = msg.wParam;
quint32 nModifiers = 0;
QWindow *receiver = m_keyGrabber ? m_keyGrabber : window;
@@ -786,10 +788,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
state |= (nModifiers & AltAny ? int(Qt::AltModifier) : 0);
state |= (nModifiers & MetaAny ? int(Qt::MetaModifier) : 0);
- // Now we know enough to either have MapVirtualKey or our own keymap tell us if it's a deadkey
- const bool isDeadKey = isADeadKey(msg.wParam, state)
- || MapVirtualKey(msg.wParam, 2) & 0x80000000;
-
// A multi-character key or a Input method character
// not found by our look-ahead
if (msgType == WM_CHAR || msgType == WM_IME_CHAR) {
@@ -849,23 +847,12 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
return true;
// Translate VK_* (native) -> Key_* (Qt) keys
- // If it's a dead key, we cannot use the toKeyOrUnicode() function, since that will change
- // the internal state of the keyboard driver, resulting in that dead keys no longer works.
- // ..also if we're typing numbers on the keypad, while holding down the Alt modifier.
- int code = 0;
- if (isNumpad && (nModifiers & AltAny)) {
- code = winceKeyBend(msg.wParam);
- } else if (!isDeadKey) {
- // QTBUG-8764, QTBUG-10032
- // Can't call toKeyOrUnicode because that would call ToUnicode, and, if a dead key
- // is pressed at the moment, Windows would NOT use it to compose a character for the next
- // WM_CHAR event.
-
- // Instead, use MapVirtualKey, which will provide adequate values.
- code = MapVirtualKey(msg.wParam, MAPVK_VK_TO_CHAR);
- if (code < 0x20 || code == 0x7f) // The same logic as in toKeyOrUnicode()
- code = winceKeyBend(msg.wParam);
- }
+ int modifiersIndex = 0;
+ modifiersIndex |= (nModifiers & ShiftAny ? 0x1 : 0);
+ modifiersIndex |= (nModifiers & ControlAny ? 0x2 : 0);
+ modifiersIndex |= (nModifiers & AltAny ? 0x4 : 0);
+
+ int code = keyLayout[vk_key].qtKey[modifiersIndex];
// Invert state logic:
// If the key actually pressed is a modifier key, then we remove its modifier key from the
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h
index ce6ca23708..f7d33758a0 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.h
+++ b/src/plugins/platforms/windows/qwindowskeymapper.h
@@ -100,9 +100,7 @@ private:
QLocale keyboardInputLocale;
Qt::LayoutDirection keyboardInputDirection;
- void clearRecordedKeys();
void updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode, quint32 vk_key);
- bool isADeadKey(unsigned int vk_key, unsigned int modifiers);
void deleteLayouts();
QWindow *m_keyGrabber;
diff --git a/src/plugins/platforms/windows/qwindowssessionmanager.cpp b/src/plugins/platforms/windows/qwindowssessionmanager.cpp
index efdbb6b279..e86722f953 100644
--- a/src/plugins/platforms/windows/qwindowssessionmanager.cpp
+++ b/src/plugins/platforms/windows/qwindowssessionmanager.cpp
@@ -52,10 +52,6 @@ QWindowsSessionManager::QWindowsSessionManager(const QString &id, const QString
{
}
-QWindowsSessionManager::~QWindowsSessionManager()
-{
-}
-
bool QWindowsSessionManager::allowsInteraction()
{
m_blockUserInput = false;
@@ -68,16 +64,6 @@ bool QWindowsSessionManager::allowsErrorInteraction()
return true;
}
-void QWindowsSessionManager::blocksInteraction()
-{
- m_blockUserInput = true;
-}
-
-bool QWindowsSessionManager::isInterractionBlocked() const
-{
- return m_blockUserInput;
-}
-
void QWindowsSessionManager::release()
{
if (m_isActive)
@@ -89,24 +75,4 @@ void QWindowsSessionManager::cancel()
m_canceled = true;
}
-void QWindowsSessionManager::clearCancellation()
-{
- m_canceled = false;
-}
-
-bool QWindowsSessionManager::wasCanceled() const
-{
- return m_canceled;
-}
-
-void QWindowsSessionManager::setActive(bool active)
-{
- m_isActive = active;
-}
-
-bool QWindowsSessionManager::isActive() const
-{
- return m_isActive;
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowssessionmanager.h b/src/plugins/platforms/windows/qwindowssessionmanager.h
index 3e21cbabec..0443635c35 100644
--- a/src/plugins/platforms/windows/qwindowssessionmanager.h
+++ b/src/plugins/platforms/windows/qwindowssessionmanager.h
@@ -60,22 +60,21 @@ class QWindowsSessionManager : public QPlatformSessionManager
{
public:
explicit QWindowsSessionManager(const QString &id, const QString &key);
- virtual ~QWindowsSessionManager();
bool allowsInteraction() Q_DECL_OVERRIDE;
bool allowsErrorInteraction() Q_DECL_OVERRIDE;
- void blocksInteraction();
- bool isInterractionBlocked() const;
+ void blocksInteraction() { m_blockUserInput = true; }
+ bool isInteractionBlocked() const { return m_blockUserInput; }
void release() Q_DECL_OVERRIDE;
void cancel() Q_DECL_OVERRIDE;
- void clearCancellation();
- bool wasCanceled() const;
+ void clearCancellation() { m_canceled = false; }
+ bool wasCanceled() const { return m_canceled; }
- void setActive(bool active);
- bool isActive() const;
+ void setActive(bool active) { m_isActive = active; }
+ bool isActive() const { return m_isActive;}
private:
bool m_isActive;
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 1909e0313b..58047124a1 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -305,7 +305,7 @@ bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool has
#endif // Q_OS_WINCE
}
-static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal level)
+static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bool openGL, qreal level)
{
#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls
Q_UNUSED(hwnd);
@@ -314,8 +314,8 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qr
Q_UNUSED(level);
#else
if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) {
- if (hasAlpha && (flags & Qt::FramelessWindowHint)) {
- // Windows with alpha: Use blend function to update.
+ if (hasAlpha && !openGL && (flags & Qt::FramelessWindowHint)) {
+ // Non-GL windows with alpha: Use blend function to update.
BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA};
QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
} else {
@@ -661,7 +661,7 @@ void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLe
EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
}
- setWindowOpacity(hwnd, flags, hasAlpha, opacityLevel);
+ setWindowOpacity(hwnd, flags, hasAlpha, isGL, opacityLevel);
} else { // child.
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags);
}
@@ -929,6 +929,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
QWindowsWindow::~QWindowsWindow()
{
+ setFlag(WithinDestroy);
#ifndef Q_OS_WINCE
if (testFlag(TouchRegistered))
QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd);
@@ -1122,6 +1123,8 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const
void QWindowsWindow::updateTransientParent() const
{
#ifndef Q_OS_WINCE
+ if (window()->type() == Qt::Popup)
+ return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow().
// Update transient parent.
const HWND oldTransientParent =
GetAncestor(m_data.hwnd, GA_PARENT) == GetDesktopWindow() ? GetAncestor(m_data.hwnd, GA_ROOTOWNER) : HWND(0);
@@ -1497,6 +1500,8 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowState state)
handleHidden();
QWindowSystemInterface::flushWindowSystemEvents(); // Tell QQuickWindow to stop rendering now.
break;
+ case Qt::WindowMaximized:
+ case Qt::WindowFullScreen:
case Qt::WindowNoState: {
// QTBUG-17548: We send expose events when receiving WM_Paint, but for
// layered windows and transient children, we won't receive any WM_Paint.
@@ -1548,7 +1553,7 @@ static const QScreen *effectiveScreen(const QWindow *w)
bool QWindowsWindow::isFullScreen_sys() const
{
- return geometry_sys() == effectiveScreen(window())->geometry();
+ return window()->isTopLevel() && geometry_sys() == effectiveScreen(window())->geometry();
}
/*!
@@ -1745,7 +1750,9 @@ void QWindowsWindow::setOpacity(qreal level)
if (m_opacity != level) {
m_opacity = level;
if (m_data.hwnd)
- setWindowOpacity(m_data.hwnd, m_data.flags, window()->format().hasAlpha(), level);
+ setWindowOpacity(m_data.hwnd, m_data.flags,
+ window()->format().hasAlpha(), testFlag(OpenGLSurface),
+ level);
}
}
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 5fc5b4ba97..3f1c53b122 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -440,6 +440,86 @@ bool QGLXContext::isValid() const
return m_context != 0;
}
+bool QGLXContext::m_queriedDummyContext = false;
+bool QGLXContext::m_supportsThreading = true;
+
+
+// If this list grows to any significant size, change it a
+// proper string table and make the implementation below use
+// binary search.
+static const char *qglx_threadedgl_blacklist_renderer[] = {
+ "Chromium", // QTBUG-32225 (initialization fails)
+ "Mesa DRI Intel(R) Sandybridge Mobile", // QTBUG-34492 (flickering in fullscreen)
+ 0
+};
+
+static const char *qglx_threadedgl_blacklist_vendor[] = {
+ "nouveau", // QTCREATORBUG-10875 (crash in creator)
+ 0
+};
+
+void QGLXContext::queryDummyContext()
+{
+ if (m_queriedDummyContext)
+ return;
+ m_queriedDummyContext = true;
+
+ static bool skip = qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK");
+ if (skip)
+ return;
+
+ QOpenGLContext *oldContext = QOpenGLContext::currentContext();
+ QSurface *oldSurface = 0;
+ if (oldContext)
+ oldSurface = oldContext->surface();
+
+ QScopedPointer<QSurface> surface;
+ const char *glxvendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR);
+ if (glxvendor && !strcmp(glxvendor, "ATI")) {
+ QWindow *window = new QWindow;
+ window->resize(64, 64);
+ window->setSurfaceType(QSurface::OpenGLSurface);
+ window->create();
+ surface.reset(window);
+ } else {
+ QOffscreenSurface *offSurface = new QOffscreenSurface;
+ offSurface->create();
+ surface.reset(offSurface);
+ }
+
+ QOpenGLContext context;
+ context.create();
+ context.makeCurrent(surface.data());
+
+ m_supportsThreading = true;
+
+ const char *renderer = (const char *) glGetString(GL_RENDERER);
+ for (int i = 0; qglx_threadedgl_blacklist_renderer[i]; ++i) {
+ if (strstr(renderer, qglx_threadedgl_blacklist_renderer[i]) != 0) {
+ m_supportsThreading = false;
+ break;
+ }
+ }
+
+ const char *vendor = (const char *) glGetString(GL_VENDOR);
+ for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) {
+ if (strstr(vendor, qglx_threadedgl_blacklist_vendor[i]) != 0) {
+ m_supportsThreading = false;
+ break;
+ }
+ }
+
+ context.doneCurrent();
+ if (oldContext && oldSurface)
+ oldContext->makeCurrent(oldSurface);
+}
+
+bool QGLXContext::supportsThreading()
+{
+ if (!m_queriedDummyContext)
+ queryDummyContext();
+ return m_supportsThreading;
+}
QGLXPbuffer::QGLXPbuffer(QOffscreenSurface *offscreenSurface)
: QPlatformOffscreenSurface(offscreenSurface)
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 1666f71060..00bba94ab3 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -72,6 +72,9 @@ public:
GLXContext glxContext() const { return m_context; }
+ static bool supportsThreading();
+ static void queryDummyContext();
+
private:
QXcbScreen *m_screen;
GLXContext m_context;
@@ -79,6 +82,8 @@ private:
QSurfaceFormat m_format;
bool m_isPBufferCurrent;
int m_swapInterval;
+ static bool m_queriedDummyContext;
+ static bool m_supportsThreading;
};
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 3f599123b9..96e6534b74 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1429,7 +1429,10 @@ static const char * xcb_atomnames = {
#if XCB_USE_MAEMO_WINDOW_PROPERTIES
"_MEEGOTOUCH_ORIENTATION_ANGLE\0"
#endif
- "_XSETTINGS_SETTINGS\0" // \0\0 terminates loop.
+ "_XSETTINGS_SETTINGS\0"
+ "_COMPIZ_DECOR_PENDING\0"
+ "_COMPIZ_DECOR_REQUEST\0"
+ "_COMPIZ_DECOR_DELETE_PIXMAP\0" // \0\0 terminates loop.
};
QXcbAtom::Atom QXcbConnection::qatom(xcb_atom_t xatom) const
@@ -1737,10 +1740,26 @@ bool QXcbConnection::xi2GetValuatorValueIfSet(void *event, int valuatorNum, doub
return true;
}
-bool QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event, int opCode)
+// Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed:
+// - "pad0" became "extension"
+// - "pad1" and "pad" became "pad0"
+// New and old version of this struct share the following fields:
+// NOTE: API might change again in the next release of xcb in which case this comment will
+// need to be updated to reflect the reality.
+typedef struct qt_xcb_ge_event_t {
+ uint8_t response_type;
+ uint8_t extension;
+ uint16_t sequence;
+ uint32_t length;
+ uint16_t event_type;
+} qt_xcb_ge_event_t;
+
+bool QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *ev, int opCode)
{
- // xGenericEvent has "extension" on the second byte, xcb_ge_event_t has "pad0".
- if (event->pad0 == opCode) {
+ qt_xcb_ge_event_t *event = (qt_xcb_ge_event_t *)ev;
+ // xGenericEvent has "extension" on the second byte, the same is true for xcb_ge_event_t starting from
+ // the xcb version 1.9.3, prior to that it was called "pad0".
+ if (event->extension == opCode) {
// xcb event structs contain stuff that wasn't on the wire, the full_sequence field
// adds an extra 4 bytes and generic events cookie data is on the wire right after the standard 32 bytes.
// Move this data back to have the same layout in memory as it was on the wire
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 3f46f1c462..3a71eb2574 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -277,6 +277,10 @@ namespace QXcbAtom {
#endif
_XSETTINGS_SETTINGS,
+ _COMPIZ_DECOR_PENDING,
+ _COMPIZ_DECOR_REQUEST,
+ _COMPIZ_DECOR_DELETE_PIXMAP,
+
NPredefinedAtoms,
_QT_SETTINGS_TIMESTAMP = NPredefinedAtoms,
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 5168bd818b..ecbf28bab9 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -278,10 +278,15 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
#else
case OpenGL: return false;
#endif
+#if defined(XCB_USE_GLX)
+ case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering() && QGLXContext::supportsThreading();
+#else
case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering();
+#endif
case WindowMasks: return true;
case MultipleWindows: return true;
case ForeignWindows: return true;
+ case SyncState: return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
@@ -458,4 +463,11 @@ QPlatformSessionManager *QXcbIntegration::createPlatformSessionManager(const QSt
}
#endif
+void QXcbIntegration::sync()
+{
+ for (int i = 0; i < m_connections.size(); i++) {
+ m_connections.at(i)->sync();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 79fb1965c4..6ae23125c8 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -106,6 +106,7 @@ public:
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE;
#endif
+ void sync();
private:
QList<QXcbConnection *> m_connections;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 832f871bb7..806f948cc2 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -154,7 +154,7 @@ enum QX11EmbedMessageType {
XEMBED_ACTIVATE_ACCELERATOR = 14
};
-const long XEMBED_VERSION = 0;
+const quint32 XEMBED_VERSION = 0;
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w
static inline bool isTransient(const QWindow *w)
@@ -403,7 +403,7 @@ void QXcbWindow::create()
}
// set the PID to let the WM kill the application if unresponsive
- long pid = getpid();
+ quint32 pid = getpid();
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
atom(QXcbAtom::_NET_WM_PID), XCB_ATOM_CARDINAL, 32,
1, &pid));
@@ -422,7 +422,7 @@ void QXcbWindow::create()
1, &leader));
/* Add XEMBED info; this operation doesn't initiate the embedding. */
- long data[] = { XEMBED_VERSION, XEMBED_MAPPED };
+ quint32 data[] = { XEMBED_VERSION, XEMBED_MAPPED };
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
atom(QXcbAtom::_XEMBED_INFO),
atom(QXcbAtom::_XEMBED_INFO),
@@ -1544,11 +1544,18 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
#endif
} else if (event->type == atom(QXcbAtom::_XEMBED)) {
handleXEmbedMessage(event);
- } else if (event->type == atom(QXcbAtom::MANAGER) || event->type == atom(QXcbAtom::_NET_ACTIVE_WINDOW)
- || event->type == atom(QXcbAtom::_NET_WM_STATE) || event->type == atom(QXcbAtom::MANAGER)
+ } else if (event->type == atom(QXcbAtom::_NET_ACTIVE_WINDOW)) {
+ connection()->setFocusWindow(this);
+ QWindowSystemInterface::handleWindowActivated(window());
+ } else if (event->type == atom(QXcbAtom::MANAGER)
+ || event->type == atom(QXcbAtom::_NET_WM_STATE)
|| event->type == atom(QXcbAtom::WM_CHANGE_STATE)) {
- // Ignore _NET_ACTIVE_WINDOW, _NET_WM_STATE, MANAGER which are relate to tray icons
+ // Ignore _NET_WM_STATE, MANAGER which are relate to tray icons
// and other messages.
+ } else if (event->type == atom(QXcbAtom::_COMPIZ_DECOR_PENDING)
+ || event->type == atom(QXcbAtom::_COMPIZ_DECOR_REQUEST)
+ || event->type == atom(QXcbAtom::_COMPIZ_DECOR_DELETE_PIXMAP)) {
+ //silence the _COMPIZ messages for now
} else {
qWarning() << "QXcbWindow: Unhandled client message:" << connection()->atomName(event->type);
}
@@ -1817,7 +1824,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
xcb_get_property_reply(xcb_connection(), get_cookie, NULL);
if (reply && reply->format == 32 && reply->type == wmStateAtom) {
- const long *data = (const long *)xcb_get_property_value(reply);
+ const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
newState = Qt::WindowMinimized;
}
@@ -1988,8 +1995,8 @@ bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner)
}
// Sends an XEmbed message.
-void QXcbWindow::sendXEmbedMessage(xcb_window_t window, long message,
- long detail, long data1, long data2)
+void QXcbWindow::sendXEmbedMessage(xcb_window_t window, quint32 message,
+ quint32 detail, quint32 data1, quint32 data2)
{
xcb_client_message_event_t event;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 5601a115e9..45d44b213f 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -169,8 +169,8 @@ private:
void updateDoesNotAcceptFocus(bool doesNotAcceptFocus);
QRect windowToWmGeometry(QRect r) const;
- void sendXEmbedMessage(xcb_window_t window, long message,
- long detail = 0, long data1 = 0, long data2 = 0);
+ void sendXEmbedMessage(xcb_window_t window, quint32 message,
+ quint32 detail = 0, quint32 data1 = 0, quint32 data2 = 0);
void handleXEmbedMessage(const xcb_client_message_event_t *event);
void create();
diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp
index f069d9f97c..812f4bc000 100644
--- a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp
+++ b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp
@@ -87,8 +87,16 @@ QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const
bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const
{
- Q_UNUSED(type);
- return true;
+ switch (type) {
+ case ColorDialog:
+ return true;
+ case FileDialog:
+ return true;
+ case FontDialog:
+ return true;
+ default:
+ return false;
+ }
}
QPlatformDialogHelper *QGtk2Theme::createPlatformDialogHelper(DialogType type) const
diff --git a/src/printsupport/dialogs/dialogs.pri b/src/printsupport/dialogs/dialogs.pri
index 9659046f60..bb07167f68 100644
--- a/src/printsupport/dialogs/dialogs.pri
+++ b/src/printsupport/dialogs/dialogs.pri
@@ -11,7 +11,7 @@ HEADERS += \
mac:!ios {
OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \
dialogs/qprintdialog_mac.mm
- LIBS += -framework Cocoa
+ LIBS_PRIVATE += -framework Cocoa
}
win32 {
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 0214c97e24..fe7e43814c 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -103,6 +103,11 @@ Print dialog class declarations
Layout in qprintpropertieswidget.ui
*/
+static void initResources()
+{
+ Q_INIT_RESOURCE(qprintdialog);
+}
+
QT_BEGIN_NAMESPACE
class QOptionTreeItem;
@@ -306,6 +311,7 @@ void QPrintPropertiesDialog::showEvent(QShowEvent* event)
QPrintDialogPrivate::QPrintDialogPrivate()
: top(0), bottom(0), buttons(0), collapseButton(0)
{
+ initResources();
}
QPrintDialogPrivate::~QPrintDialogPrivate()
diff --git a/src/printsupport/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp
index e886abbcf3..6f96a499e5 100644
--- a/src/printsupport/dialogs/qprintdialog_win.cpp
+++ b/src/printsupport/dialogs/qprintdialog_win.cpp
@@ -109,10 +109,12 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent,
if(!pdlg->isOptionEnabled(QPrintDialog::PrintToFile))
pd->Flags |= PD_DISABLEPRINTTOFILE;
- if (pdlg->printRange() == QPrintDialog::Selection)
+ if (pdlg->isOptionEnabled(QPrintDialog::PrintSelection) && pdlg->printRange() == QPrintDialog::Selection)
pd->Flags |= PD_SELECTION;
- else if (pdlg->printRange() == QPrintDialog::PageRange)
+ else if (pdlg->isOptionEnabled(QPrintDialog::PrintPageRange) && pdlg->printRange() == QPrintDialog::PageRange)
pd->Flags |= PD_PAGENUMS;
+ else if (pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage) && pdlg->printRange() == QPrintDialog::CurrentPage)
+ pd->Flags |= PD_CURRENTPAGE;
else
pd->Flags |= PD_ALLPAGES;
@@ -185,7 +187,7 @@ QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent)
Q_D(QPrintDialog);
if (!warnIfNotNative(d->printer))
return;
- d->ep = static_cast<QWin32PrintEngine *>(d->printer->paintEngine())->d_func();
+ d->ep = static_cast<QWin32PrintEngine *>(d->printer->printEngine())->d_func();
setAttribute(Qt::WA_DontShowOnScreen);
}
@@ -195,7 +197,7 @@ QPrintDialog::QPrintDialog(QWidget *parent)
Q_D(QPrintDialog);
if (!warnIfNotNative(d->printer))
return;
- d->ep = static_cast<QWin32PrintEngine *>(d->printer->paintEngine())->d_func();
+ d->ep = static_cast<QWin32PrintEngine *>(d->printer->printEngine())->d_func();
setAttribute(Qt::WA_DontShowOnScreen);
}
diff --git a/src/printsupport/doc/qtprintsupport.qdocconf b/src/printsupport/doc/qtprintsupport.qdocconf
index d5015fa46a..4d1f0c39f1 100644
--- a/src/printsupport/doc/qtprintsupport.qdocconf
+++ b/src/printsupport/doc/qtprintsupport.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtPrintSupport
description = Qt Print Support Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtprintsupport
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = printsupport
diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri
index 8bdccd0f5b..67fcc8597c 100644
--- a/src/printsupport/kernel/kernel.pri
+++ b/src/printsupport/kernel/kernel.pri
@@ -24,7 +24,7 @@ win32 {
$$PWD/qprintengine_win_p.h
SOURCES += \
$$PWD/qprintengine_win.cpp
- LIBS += -lwinspool -lcomdlg32 -lgdi32 -luser32
+ LIBS_PRIVATE += -lwinspool -lcomdlg32 -lgdi32 -luser32
}
unix:!mac:contains(QT_CONFIG, cups): {
diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp
index ce6d7a0f7e..f3e88e7cf7 100644
--- a/src/printsupport/kernel/qplatformprintplugin.cpp
+++ b/src/printsupport/kernel/qplatformprintplugin.cpp
@@ -40,7 +40,10 @@
****************************************************************************/
#include "qplatformprintplugin.h"
+#include "qplatformprintersupport.h"
+#include "qprinterinfo.h"
#include "private/qfactoryloader_p.h"
+#include <qcoreapplication.h>
QT_BEGIN_NAMESPACE
@@ -58,6 +61,16 @@ QPlatformPrinterSupportPlugin::~QPlatformPrinterSupportPlugin()
{
}
+static QPlatformPrinterSupport *printerSupport = 0;
+
+static void cleanupPrinterSupport()
+{
+#ifndef QT_NO_PRINTER
+ delete printerSupport;
+#endif
+ printerSupport = 0;
+}
+
/*!
\internal
@@ -68,13 +81,14 @@ QPlatformPrinterSupportPlugin::~QPlatformPrinterSupportPlugin()
*/
QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get()
{
- static QPlatformPrinterSupport *singleton = 0;
- if (!singleton) {
+ if (!printerSupport) {
const QMultiMap<int, QString> keyMap = loader()->keyMap();
if (!keyMap.isEmpty())
- singleton = qLoadPlugin<QPlatformPrinterSupport, QPlatformPrinterSupportPlugin>(loader(), keyMap.constBegin().value());
+ printerSupport = qLoadPlugin<QPlatformPrinterSupport, QPlatformPrinterSupportPlugin>(loader(), keyMap.constBegin().value());
+ if (printerSupport)
+ qAddPostRoutine(cleanupPrinterSupport);
}
- return singleton;
+ return printerSupport;
}
QT_END_NAMESPACE
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index acaa32304e..e2446c19b1 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -67,6 +67,8 @@ QT_BEGIN_NAMESPACE
Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0);
extern QPainterPath qt_regionToPath(const QRegion &region);
+Q_PRINTSUPPORT_EXPORT QSizeF qt_SizeFromUnitToMillimeter(const QSizeF &, QPrinter::Unit, double);
+Q_PRINTSUPPORT_EXPORT double qt_multiplierForUnit(QPrinter::Unit unit, int resolution);
// #define QT_DEBUG_DRAW
@@ -114,6 +116,52 @@ static const struct {
{ 0, QPrinter::Custom }
};
+// Return a list of printer paper sizes in millimeters with the corresponding dmPaperSize value
+static QList<QPair<QSizeF, int> > printerPaperSizes(const QString &printerName)
+{
+ QList<QPair<QSizeF, int> > result;
+ const wchar_t *name = reinterpret_cast<const wchar_t*>(printerName.utf16());
+ DWORD paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL);
+ if ((int)paperNameCount > 0) {
+ // If they are not equal, then there seems to be a problem with the driver
+ if (paperNameCount != DeviceCapabilities(name, NULL, DC_PAPERSIZE, NULL, NULL))
+ return result;
+ QScopedArrayPointer<wchar_t> papersNames(new wchar_t[paperNameCount]);
+ paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, papersNames.data(), NULL);
+ result.reserve(paperNameCount);
+ QScopedArrayPointer<POINT> paperSizes(new POINT[paperNameCount]);
+ paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL);
+ for (int i=0; i <(int)paperNameCount; i++)
+ result.push_back(qMakePair(QSizeF(paperSizes[i].x / 10, paperSizes[i].y / 10), papersNames[i]));
+ }
+ return result;
+}
+
+// Find the best-matching printer paper for size in millimeters.
+static inline int findCustomPaperSize(const QSizeF &needlePt, const QString &printerName)
+{
+ const QList<QPair<QSizeF, int> > sizes = printerPaperSizes(printerName);
+ const qreal nw = needlePt.width();
+ const qreal nh = needlePt.height();
+ for (int i = 0; i < sizes.size(); ++i) {
+ if (qAbs(nw - sizes.at(i).first.width()) <= 1 && qAbs(nh - sizes.at(i).first.height()) <= 1)
+ return sizes.at(i).second;
+ }
+ return -1;
+}
+
+static inline void setDevModePaperFlags(DEVMODE *devMode, bool custom)
+{
+ if (custom) {
+ devMode->dmPaperSize = DMPAPER_USER;
+ devMode->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH;
+ } else {
+ devMode->dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
+ devMode->dmPaperLength = 0;
+ devMode->dmPaperWidth = 0;
+ }
+}
+
QPrinter::PaperSize mapDevmodePaperSize(int s)
{
int i = 0;
@@ -1293,6 +1341,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
break;
d->devMode->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt()));
d->has_custom_paper_size = (QPrinter::PaperSize(value.toInt()) == QPrinter::Custom);
+ setDevModePaperFlags(d->devMode, d->has_custom_paper_size);
d->doReinit();
break;
case PPK_PaperName:
@@ -1320,9 +1369,19 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
wchar_t *papers = new wchar_t[size];
size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
NULL, DC_PAPERS, papers, NULL);
- d->has_custom_paper_size = false;
- d->devMode->dmPaperSize = papers[paperPos];
- d->doReinit();
+ QScopedArrayPointer<POINT> paperSizes(new POINT[size]);
+ DWORD paperNameCount = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL);
+ if (paperNameCount == size) {
+ const double multiplier = qt_multiplierForUnit(QPrinter::Millimeter, d->resolution);
+ d->paper_size = QSizeF((paperSizes[paperPos].x / 10.0) * multiplier, (paperSizes[paperPos].y / 10.0) * multiplier);
+ // Our sizes may not match the paper name's size exactly
+ // So we treat it as custom so we know the paper size is correct
+ d->has_custom_paper_size = true;
+ d->devMode->dmPaperSize = papers[paperPos];
+ setDevModePaperFlags(d->devMode, false);
+ d->doReinit();
+ }
+
delete [] papers;
}
}
@@ -1373,6 +1432,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
break;
d->has_custom_paper_size = false;
d->devMode->dmPaperSize = value.toInt();
+ setDevModePaperFlags(d->devMode, d->has_custom_paper_size);
d->doReinit();
break;
@@ -1382,30 +1442,17 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
d->paper_size = value.toSizeF();
if (!d->devMode)
break;
- int orientation = d->devMode->dmOrientation;
- DWORD needed = 0;
- DWORD returned = 0;
- if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) {
- BYTE *forms = (BYTE *) malloc(needed);
- if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) {
- for (DWORD i=0; i< returned; ++i) {
- FORM_INFO_1 *formArray = reinterpret_cast<FORM_INFO_1 *>(forms);
- // the form sizes are specified in 1000th of a mm,
- // convert the size to Points
- QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0,
- (formArray[i].Size.cy * 72/25.4)/1000.0);
- if (qAbs(d->paper_size.width() - size.width()) <= 2
- && qAbs(d->paper_size.height() - size.height()) <= 2)
- {
- d->devMode->dmPaperSize = i + 1;
- break;
- }
- }
- }
- free(forms);
+ const QSizeF sizeMM = qt_SizeFromUnitToMillimeter(d->paper_size, QPrinter::Point, d->resolution);
+ const int match = findCustomPaperSize(sizeMM, d->name);
+ setDevModePaperFlags(d->devMode, (match >= 0) ? false : true);
+ if (match >= 0) {
+ d->devMode->dmPaperSize = match;
+ if (d->devMode->dmOrientation != DMORIENT_PORTRAIT)
+ qSwap(d->paper_size.rwidth(), d->paper_size.rheight());
+ } else {
+ d->devMode->dmPaperLength = qRound(sizeMM.height() * 10.0);
+ d->devMode->dmPaperWidth = qRound(sizeMM.width() * 10.0);
}
- if (orientation != DMORIENT_PORTRAIT)
- d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width());
break;
}
@@ -1692,7 +1739,7 @@ QList<QPair<QString, QSizeF> > QWin32PrintEngine::supportedSizesWithNames(const
for (int i=0;i<(int)size;i++) {
wchar_t *paper = papers + (i * 64);
QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64));
- paperSizes << qMakePair(str, QSizeF(points[i].x / 10, points[i].y / 10));
+ paperSizes << qMakePair(str, QSizeF(points[i].x / 10.0, points[i].y / 10.0));
}
delete [] points;
}
@@ -1908,30 +1955,19 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h
SelectObject(hdc, old_font);
}
-
void QWin32PrintEnginePrivate::updateCustomPaperSize()
{
- uint paperSize = devMode->dmPaperSize;
+ const uint paperSize = devMode->dmPaperSize;
+ has_custom_paper_size = true;
if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) {
- has_custom_paper_size = true;
- DWORD needed = 0;
- DWORD returned = 0;
- if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) {
- BYTE *forms = (BYTE *) malloc(needed);
- if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) {
- if (paperSize <= returned) {
- FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms;
- int width = formArray[paperSize - 1].Size.cx; // 1/1000 of a mm
- int height = formArray[paperSize - 1].Size.cy; // 1/1000 of a mm
- paper_size = QSizeF((width * 72 /25.4) / 1000.0, (height * 72 / 25.4) / 1000.0);
- } else {
- has_custom_paper_size = false;
- }
+ const QList<QPair<QSizeF, int> > paperSizes = printerPaperSizes(name);
+ for (int i=0; i<paperSizes.size(); i++) {
+ if ((uint)paperSizes.at(i).second == paperSize) {
+ paper_size = paperSizes.at(paperSize).first;
+ has_custom_paper_size = false;
+ break;
}
- free(forms);
}
- } else {
- has_custom_paper_size = false;
}
}
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index f90fa71b0f..0905cbb59f 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -538,7 +538,7 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode)
void QPrinterPrivate::init(QPrinter::PrinterMode mode)
{
if (!QCoreApplication::instance()) {
- qFatal("QPrinter: Must construct a QApplication before a QPaintDevice");
+ qFatal("QPrinter: Must construct a QCoreApplication before a QPrinter");
return;
}
diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp
index f863b23e34..e02617fe93 100644
--- a/src/printsupport/kernel/qprinterinfo.cpp
+++ b/src/printsupport/kernel/qprinterinfo.cpp
@@ -35,8 +35,17 @@
QT_BEGIN_NAMESPACE
-QPrinterInfoPrivate QPrinterInfoPrivate::shared_null;
+Q_GLOBAL_STATIC(QPrinterInfoPrivate, shared_null);
+class QPrinterInfoPrivateDeleter
+{
+public:
+ static inline void cleanup(QPrinterInfoPrivate *d)
+ {
+ if (d != shared_null)
+ delete d;
+ }
+};
/*!
\class QPrinterInfo
@@ -83,7 +92,7 @@ QPrinterInfoPrivate QPrinterInfoPrivate::shared_null;
\sa isNull()
*/
QPrinterInfo::QPrinterInfo()
- : d_ptr(&QPrinterInfoPrivate::shared_null)
+ : d_ptr(shared_null)
{
}
@@ -91,7 +100,7 @@ QPrinterInfo::QPrinterInfo()
Constructs a copy of \a other.
*/
QPrinterInfo::QPrinterInfo(const QPrinterInfo &other)
- : d_ptr(new QPrinterInfoPrivate(*other.d_ptr))
+ : d_ptr((other.d_ptr.data() == shared_null) ? shared_null : new QPrinterInfoPrivate(*other.d_ptr))
{
}
@@ -99,12 +108,15 @@ QPrinterInfo::QPrinterInfo(const QPrinterInfo &other)
Constructs a QPrinterInfo object from \a printer.
*/
QPrinterInfo::QPrinterInfo(const QPrinter &printer)
- : d_ptr(&QPrinterInfoPrivate::shared_null)
+ : d_ptr(shared_null)
{
QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
if (ps) {
QPrinterInfo pi = ps->printerInfo(printer.printerName());
- d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr));
+ if (pi.d_ptr.data() == shared_null)
+ d_ptr.reset(shared_null);
+ else
+ d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr));
}
}
@@ -130,7 +142,10 @@ QPrinterInfo::~QPrinterInfo()
QPrinterInfo &QPrinterInfo::operator=(const QPrinterInfo &other)
{
Q_ASSERT(d_ptr);
- d_ptr.reset(new QPrinterInfoPrivate(*other.d_ptr));
+ if (other.d_ptr.data() == shared_null)
+ d_ptr.reset(shared_null);
+ else
+ d_ptr.reset(new QPrinterInfoPrivate(*other.d_ptr));
return *this;
}
@@ -191,7 +206,7 @@ QString QPrinterInfo::makeAndModel() const
bool QPrinterInfo::isNull() const
{
Q_D(const QPrinterInfo);
- return d == &QPrinterInfoPrivate::shared_null;
+ return d == shared_null || d->name.isEmpty();
}
/*!
diff --git a/src/printsupport/kernel/qprinterinfo_p.h b/src/printsupport/kernel/qprinterinfo_p.h
index d4bb08f1f5..6ae64b5653 100644
--- a/src/printsupport/kernel/qprinterinfo_p.h
+++ b/src/printsupport/kernel/qprinterinfo_p.h
@@ -72,8 +72,6 @@ public:
~QPrinterInfoPrivate()
{}
- static QPrinterInfoPrivate shared_null;
-
QString name;
QString description;
QString location;
@@ -87,17 +85,6 @@ public:
mutable QList<QPair<QString, QSizeF> > paperNames;
};
-
-class QPrinterInfoPrivateDeleter
-{
-public:
- static inline void cleanup(QPrinterInfoPrivate *d)
- {
- if (d != &QPrinterInfoPrivate::shared_null)
- delete d;
- }
-};
-
QT_END_NAMESPACE
#endif // QT_NO_PRINTER
diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf
index a2a05d7c8a..7f37904039 100644
--- a/src/sql/doc/qtsql.qdocconf
+++ b/src/sql/doc/qtsql.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtSql
description = Qt SQL Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtsql
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = sql
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 9331f5c371..fd5990f3ee 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -1253,8 +1253,8 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const
QTime tm = field.value().toDateTime().time();
// msecs need to be right aligned otherwise psql interprets them wrong
r = QLatin1Char('\'') + QString::number(dt.year()) + QLatin1Char('-')
- + QString::number(dt.month()) + QLatin1Char('-')
- + QString::number(dt.day()) + QLatin1Char(' ')
+ + QString::number(dt.month()).rightJustified(2, QLatin1Char('0')) + QLatin1Char('-')
+ + QString::number(dt.day()).rightJustified(2, QLatin1Char('0')) + QLatin1Char(' ')
+ tm.toString() + QLatin1Char('.')
+ QString::number(tm.msec()).rightJustified(3, QLatin1Char('0'))
+ QLatin1Char('\'');
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index ffeb7921b3..0a8b71aa8a 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -596,6 +596,8 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
}
if (option == QLatin1String("QSQLITE_OPEN_READONLY"))
openMode = SQLITE_OPEN_READONLY;
+ if (option == QLatin1String("QSQLITE_OPEN_URI"))
+ openMode |= SQLITE_OPEN_URI;
if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE"))
sharedCache = true;
}
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index b87a1fe1c5..f8ecabee8f 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -1264,6 +1264,7 @@ QSqlRecord QSqlDatabase::record(const QString& tablename) const
\list
\li QSQLITE_BUSY_TIMEOUT
\li QSQLITE_OPEN_READONLY
+ \li QSQLITE_OPEN_URI
\li QSQLITE_ENABLE_SHARED_CACHE
\endlist
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index 6aeef89483..2214e73658 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -671,7 +671,7 @@ void QSqlRelationalTableModel::clear()
\value InnerJoin - Inner join mode, return rows when there is at least one match in both tables.
\value LeftJoin - Left join mode, returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).
- \sa QSqlRelationalTableModel::setJoinMode
+ \sa QSqlRelationalTableModel::setJoinMode()
\since 4.8
*/
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index da9b96a625..7367f6e7f4 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -204,7 +204,7 @@ bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement,
\inmodule QtSql
QSqlTableModel is a high-level interface for reading and writing
- database records from a single table. It is build on top of the
+ database records from a single table. It is built on top of the
lower-level QSqlQuery and can be used to provide data to view
classes such as QTableView. For example:
diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf
index ab2bdc1948..426236c339 100644
--- a/src/testlib/doc/qttestlib.qdocconf
+++ b/src/testlib/doc/qttestlib.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtTestLib
description = Qt Test Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qttestlib
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = testlib
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 4abbb34986..224357dd85 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1654,14 +1654,13 @@ QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container)
if (count == 1)
return container.front();
- const int middle = count / 2;
-
QList<QBenchmarkResult> containerCopy = container;
- const QList<QBenchmarkResult>::iterator begin = containerCopy.begin(), mid = begin + middle, end = containerCopy.end();
- std::nth_element(begin, mid, end);
+ std::sort(containerCopy.begin(), containerCopy.end());
+
+ const int middle = count / 2;
// ### handle even-sized containers here by doing an aritmetic mean of the two middle items.
- return *mid;
+ return containerCopy.at(middle);
}
struct QTestDataSetter
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index d0cc3895c3..0e67335222 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -280,7 +280,6 @@ namespace QTest {
}
switch (type) {
- case QtTraceMsg:
case QtDebugMsg:
QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg);
break;
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index f2b9441ea4..6dd88824b5 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -509,10 +509,10 @@ static QString stringify(const QString &data)
return retval;
}
-static void openFile(const QString &fileName, QFile &file)
+static bool openFile(const QString &fileName, QFile &file)
{
if (fileName.isEmpty())
- return;
+ return false;
bool isOk = false;
if (fileName == QLatin1String("-")) {
@@ -525,6 +525,7 @@ static void openFile(const QString &fileName, QFile &file)
if (!isOk)
fprintf(stderr, "Unable to open '%s': %s\n", qPrintable(fileName),
qPrintable(file.errorString()));
+ return isOk;
}
static void writeProxy(const QString &filename, const QDBusIntrospection::Interfaces &interfaces)
@@ -821,15 +822,17 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
hs.flush();
QFile file;
- openFile(headerName, file);
- file.write(headerData);
+ const bool headerOpen = openFile(headerName, file);
+ if (headerOpen)
+ file.write(headerData);
if (headerName == cppName) {
- file.write(cppData);
+ if (headerOpen)
+ file.write(cppData);
} else {
QFile cppFile;
- openFile(cppName, cppFile);
- cppFile.write(cppData);
+ if (openFile(cppName, cppFile))
+ cppFile.write(cppData);
}
}
@@ -1125,15 +1128,17 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
hs.flush();
QFile file;
- openFile(headerName, file);
- file.write(headerData);
+ const bool headerOpen = openFile(headerName, file);
+ if (headerOpen)
+ file.write(headerData);
if (headerName == cppName) {
- file.write(cppData);
+ if (headerOpen)
+ file.write(cppData);
} else {
QFile cppFile;
- openFile(cppName, cppFile);
- cppFile.write(cppData);
+ if (openFile(cppName, cppFile))
+ cppFile.write(cppData);
}
}
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index cb9b8c3269..2d8e98d64c 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -703,7 +703,7 @@ QStringList Config::getAllFiles(const QString &filesVar,
const QSet<QString> &excludedDirs,
const QSet<QString> &excludedFiles)
{
- QStringList result = getStringList(filesVar);
+ QStringList result = getCanonicalPathList(filesVar);
QStringList dirs = getCanonicalPathList(dirsVar);
QString nameFilter = getString(filesVar + dot + CONFIG_FILEEXTENSIONS);
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index 24bd654238..64b11109f7 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -1111,6 +1111,10 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
while (qcn != 0) {
NodeList::ConstIterator c = qcn->childNodes().constBegin();
while (c != qcn->childNodes().constEnd()) {
+ if ((*c)->status() == Node::Internal) {
+ ++c;
+ continue;
+ }
if ((*c)->type() == Node::QmlPropertyGroup) {
insert(qmlproperties, *c, style, Okay);
}
@@ -1172,6 +1176,10 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
while (qcn != 0) {
NodeList::ConstIterator c = qcn->childNodes().constBegin();
while (c != qcn->childNodes().constEnd()) {
+ if ((*c)->status() == Node::Internal) {
+ ++c;
+ continue;
+ }
if ((*c)->type() == Node::QmlPropertyGroup) {
insert(qmlproperties,*c,style,Okay);
}
diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp
index 095e3c9d30..e3b9bdd264 100644
--- a/src/tools/qdoc/ditaxmlgenerator.cpp
+++ b/src/tools/qdoc/ditaxmlgenerator.cpp
@@ -682,7 +682,8 @@ void DitaXmlGenerator::generateTree()
qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index",
projectUrl,
projectDescription,
- this);
+ this,
+ true);
}
if (!runPrepareOnly()) {
diff --git a/src/tools/qdoc/doc/files/qtgui.qdocconf b/src/tools/qdoc/doc/files/qtgui.qdocconf
index 5073dd7f0f..7f80808bfc 100644
--- a/src/tools/qdoc/doc/files/qtgui.qdocconf
+++ b/src/tools/qdoc/doc/files/qtgui.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtGui
description = Qt GUI Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtgui
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = gui
diff --git a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc
index 97d9151e40..a713b2738d 100644
--- a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc
@@ -37,123 +37,123 @@
\list
- \li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a}
- \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract}
- \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist}
- \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)}
- \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)}
- \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief}
- \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c}
- \li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption}
- \li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter}
- \li \l {13-qdoc-commands-topics.html#class-command} {\\class}
- \li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline},
- \li \l {16-qdoc-commands-status.html#compat-command} {\\compat}
- \li \l {15-qdoc-commands-navigation.html#contentspage-command} {\\contentspage}
- \li \l {16-qdoc-commands-status.html#default-command} {\\default}
- \li \l {21-0-qdoc-creating-dita-maps.html#ditamap-command} {\\ditamap} \span {class="newStuff"} {(new 05/03/12)}
- \li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots}
- \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)}
- \li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else}
- \li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif}
- \li \l {13-qdoc-commands-topics.html#enum-command} {\\enum}
- \li \l {13-qdoc-commands-topics.html#example-command} {\\example}
- \li \l {13-qdoc-commands-topics.html#externalpage-command} {\\externalpage}
- \li \l {13-qdoc-commands-topics.html#fn-command} {\\fn}
- \li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote}
- \li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist}
- \li \l {13-qdoc-commands-topics.html#group-command} {\\group}
- \li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header}
- \li \l {13-qdoc-commands-topics.html#headerfile-command} {\\headerfile}
- \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
- \li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if}
- \li \l {09-qdoc-commands-includingimages.html#image-command} {\\image}
- \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include}
- \li \l {15-qdoc-commands-navigation.html#indexpage-command} {\\indexpage}
- \li \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup}
- \li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits}
- \li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage}
- \li \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule}
- \li \l {13-qdoc-commands-topics.html#inqmlmodule-command} {\\inqmlmodule}
- \li \l {13-qdoc-commands-topics.html#instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)}
- \li \l {16-qdoc-commands-status.html#internal-command} {\\internal}
- \li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword}
- \li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l}
- \li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese}
- \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)}
- \li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list}
- \li \l {13-qdoc-commands-topics.html#macro-command} {\\macro}
- \li \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass}
- \li \l {21-0-qdoc-creating-dita-maps.html#mapref-command} {\\mapref} \span {class="newStuff"} {(new 05/03/12)}
- \li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta}
- \li \l {13-qdoc-commands-topics.html#module-command} {\\module}
- \li \l {13-qdoc-commands-topics.html#namespace-command} {\\namespace}
- \li \l {15-qdoc-commands-navigation.html#nextpage-command} {\\nextpage}
- \li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode}
- \li \l {17-qdoc-commands-thread.html#nonreentrant-command} {\\nonreentrant}
- \li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note}
- \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
+ \li \l {a-command} {\\a}
+ \li \l {abstract-command} {\\abstract}
+ \li \l {annotatedlist-command} {\\annotatedlist}
+ \li \l {b-command} {\\b} \span {class="newStuff"}
+ \li \l {b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)}
+ \li \l {brief-command} {\\brief}
+ \li \l {c-command} {\\c}
+ \li \l {caption-command} {\\caption}
+ \li \l {chapter-command} {\\chapter}
+ \li \l {class-command} {\\class}
+ \li \l {code-command} {\\code}
+ \li \l {codeline-command} {\\codeline},
+ \li \l {compat-command} {\\compat}
+ \li \l {contentspage-command} {\\contentspage}
+ \li \l {default-command} {\\default}
+ \li \l {ditamap-command} {\\ditamap} \span {class="newStuff"}
+ \li \l {div-command} {\\div}
+ \li \l {dots-command} {\\dots}
+ \li \l {e-command} {\\e} \span {class="newStuff"}
+ \li \l {else-command} {\\else}
+ \li \l {endif-command} {\\endif}
+ \li \l {enum-command} {\\enum}
+ \li \l {example-command} {\\example}
+ \li \l {externalpage-command} {\\externalpage}
+ \li \l {fn-command} {\\fn}
+ \li \l {footnote-command} {\\footnote}
+ \li \l {generatelist-command} {\\generatelist}
+ \li \l {group-command} {\\group}
+ \li \l {header-command} {\\header}
+ \li \l {headerfile-command} {\\headerfile}
+ \li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
+ \li \l {if-command} {\\if}
+ \li \l {image-command} {\\image}
+ \li \l {include-command} {\\include}
+ \li \l {indexpage-command} {\\indexpage}
+ \li \l {ingroup-command} {\\ingroup}
+ \li \l {inherits-command}{\\inherits}
+ \li \l {inlineimage-command} {\\inlineimage}
+ \li \l {inmodule-command} {\\inmodule}
+ \li \l {inqmlmodule-command} {\\inqmlmodule}
+ \li \l {instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)}
+ \li \l {internal-command} {\\internal}
+ \li \l {keyword-command} {\\keyword}
+ \li \l {l-command} {\\l}
+ \li \l {legalese-command} {\\legalese}
+ \li \l {li-command} {\\li} \span {class="newStuff"}
+ \li \l {list-command} {\\list}
+ \li \l {macro-command} {\\macro}
+ \li \l {mainclass-command} {\\mainclass}
+ \li \l {mapref-command} {\\mapref} \span {class="newStuff"}
+ \li \l {meta-command} {\\meta}
+ \li \l {module-command} {\\module}
+ \li \l {namespace-command} {\\namespace}
+ \li \l {nextpage-command} {\\nextpage}
+ \li \l {newcode-command} {\\newcode}
+ \li \l {nonreentrant-command} {\\nonreentrant}
+ \li \l {note-command} {\\note}
+ \li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
- \li \l {16-qdoc-commands-status.html#obsolete-command} {\\obsolete}
- \li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode}
- \li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit}
- \li \l {10-qdoc-commands-tablesandlists.html#omitvalue-command} {\\omitvalue}
- \li \l {18-qdoc-commands-relating.html#overload-command} {\\overload}
- \li \l {13-qdoc-commands-topics.html#page-command} {\\page}
- \li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part}
- \li \l {16-qdoc-commands-status.html#preliminary-command} {\\preliminary}
- \li \l {15-qdoc-commands-navigation.html#previouspage-command} {\\previouspage}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil}
- \li \l {13-qdoc-commands-topics.html#property-command} {\\property}
- \li \l {13-qdoc-commands-topics.html#qmlattachedproperty-command} {\\qmlattachedproperty}
- \li \l {13-qdoc-commands-topics.html#qmlattachedsignal-command} {\\qmlattachedsignal}
- \li \l {13-qdoc-commands-topics.html#qmlbasictype-command} {\\qmlbasictype}
- \li \l {13-qdoc-commands-topics.html#qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)}
- \li \l {13-qdoc-commands-topics.html#qmltype-command} {\\qmltype} \span {class="newStuff"} {(new 27/7/2012)}
- \li \l {13-qdoc-commands-topics.html#qmlmethod-command} {\\qmlmethod}
- \li \l {13-qdoc-commands-topics.html#qmlproperty-command} {\\qmlproperty}
- \li \l {13-qdoc-commands-topics.html#qmlsignal-command} {\\qmlsignal}
- \li \l {13-qdoc-commands-topics.html#qmlmodule-command} {\\qmlmodule}
- \li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile}
- \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw} \span {class="newStuff"} {(avoid)}
- \li \l {17-qdoc-commands-thread.html#reentrant-command} {\\reentrant}
- \li \l {18-qdoc-commands-relating.html#reimp-command} {\\reimp}
- \li \l {18-qdoc-commands-relating.html#relates-command} {\\relates}
- \li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row}
- \li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa}
- \li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1}
- \li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2}
- \li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3}
- \li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4}
- \li \l {13-qdoc-commands-topics.html#service-command} {\\service}
- \li \l {16-qdoc-commands-status.html#since-command} {\\since}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet},
- \li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span}
- \li \l {15-qdoc-commands-navigation.html#startpage-command} {\\startpage}
- \li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub}
- \li \l {20-qdoc-commands-namingthings.html#subtitle-command} {\\subtitle}
- \li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup}
- \li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table}
- \li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents}
- \li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target}
- \li \l {17-qdoc-commands-thread.html#threadsafe-command} {\\threadsafe}
- \li \l {20-qdoc-commands-namingthings.html#title-command} {\\title}
- \li \l {21-0-qdoc-creating-dita-maps.html#topicref-command} {\\topicref} \span {class="newStuff"} {(new 05/03/12)}
- \li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt}
- \li \l {13-qdoc-commands-topics.html#typedef-command} {\\typedef}
- \li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)}
- \li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline}
- \li \l {13-qdoc-commands-topics.html#variable-command} {\\variable}
- \li \l {10-qdoc-commands-tablesandlists.html#value-command} {\\value}
- \li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning}
+ \li \l {obsolete-command} {\\obsolete}
+ \li \l {oldcode-command} {\\oldcode}
+ \li \l {omit-command} {\\omit}
+ \li \l {omitvalue-command} {\\omitvalue}
+ \li \l {overload-command} {\\overload}
+ \li \l {page-command} {\\page}
+ \li \l {part-command} {\\part}
+ \li \l {preliminary-command} {\\preliminary}
+ \li \l {previouspage-command} {\\previouspage}
+ \li \l {printline-command} {\\printline}
+ \li \l {printto-command} {\\printto}
+ \li \l {printuntil-command} {\\printuntil}
+ \li \l {property-command} {\\property}
+ \li \l {qmlattachedproperty-command} {\\qmlattachedproperty}
+ \li \l {qmlattachedsignal-command} {\\qmlattachedsignal}
+ \li \l {qmlbasictype-command} {\\qmlbasictype}
+ \li \l {qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)}
+ \li \l {qmltype-command} {\\qmltype} \span {class="newStuff"}
+ \li \l {qmlmethod-command} {\\qmlmethod}
+ \li \l {qmlproperty-command} {\\qmlproperty}
+ \li \l {qmlsignal-command} {\\qmlsignal}
+ \li \l {qmlmodule-command} {\\qmlmodule}
+ \li \l {quotation-command} {\\quotation}
+ \li \l {quotefile-command} {\\quotefile}
+ \li \l {quotefromfile-command} {\\quotefromfile}
+ \li \l {raw-command} {\\raw} \span {class="newStuff"} {(avoid)}
+ \li \l {reentrant-command} {\\reentrant}
+ \li \l {reimp-command} {\\reimp}
+ \li \l {relates-command} {\\relates}
+ \li \l {row-command} {\\row}
+ \li \l {sa-command} {\\sa}
+ \li \l {sectionOne-command} {\\section1}
+ \li \l {sectionTwo-command} {\\section2}
+ \li \l {sectionThree-command} {\\section3}
+ \li \l {sectionFour-command} {\\section4}
+ \li \l {service-command} {\\service}
+ \li \l {since-command} {\\since}
+ \li \l {skipline-command} {\\skipline}
+ \li \l {skipto-command} {\\skipto}
+ \li \l {skipuntil-command} {\\skipuntil}
+ \li \l {snippet-command} {\\snippet},
+ \li \l {span-command} {\\span}
+ \li \l {startpage-command} {\\startpage}
+ \li \l {sub-command} {\\sub}
+ \li \l {subtitle-command} {\\subtitle}
+ \li \l {sup-command} {\\sup}
+ \li \l {table-command} {\\table}
+ \li \l {tableofcontents-command} {\\tableofcontents}
+ \li \l {target-command} {\\target}
+ \li \l {threadsafe-command} {\\threadsafe}
+ \li \l {title-command} {\\title}
+ \li \l {topicref-command} {\\topicref} \span {class="newStuff"}
+ \li \l {tt-command} {\\tt}
+ \li \l {typedef-command} {\\typedef}
+ \li \l {uicontrol-command} {\\uicontrol}
+ \li \l {underline-command} {\\underline}
+ \li \l {variable-command} {\\variable}
+ \li \l {value-command} {\\value}
+ \li \l {warning-command} {\\warning}
\endlist
*/
diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
index 8faf4a7f0d..1f777ea441 100644
--- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
@@ -46,28 +46,28 @@
below the \l {Topic Commands} {topic} command.
\list
- \li \l {16-qdoc-commands-status.html#compat-command}{\\compat},
- \li \l {15-qdoc-commands-navigation.html#contentspage-command}{\\contentspage},
- \li \l {15-qdoc-commands-navigation.html#indexpage-command}{\\indexpage},
- \li \l {19-qdoc-commands-grouping.html#ingroup-command}{\\ingroup},
- \li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits},
- \li \l {19-qdoc-commands-grouping.html#inmodule-command}{\\inmodule},
- \li \l {16-qdoc-commands-status.html#internal-command}{\\internal},
- \li \l {19-qdoc-commands-grouping.html#mainclass-command}{\\mainclass},
- \li \l {15-qdoc-commands-navigation.html#nextpage-command}{\\nextpage},
- \li \l {17-qdoc-commands-thread.html#nonreentrant-command}{\\nonreentrant},
- \li \l {16-qdoc-commands-status.html#obsolete-command}{\\obsolete},
- \li \l {18-qdoc-commands-relating.html#overload-command}{\\overload},
- \li \l {16-qdoc-commands-status.html#preliminary-command}{\\preliminary},
- \li \l {15-qdoc-commands-navigation.html#previouspage-command}{\\previouspage},
- \li \l {17-qdoc-commands-thread.html#reentrant-command}{\\reentrant},
- \li \l {18-qdoc-commands-relating.html#reimp-command}{\\reimp},
- \li \l {18-qdoc-commands-relating.html#relates-command}{\\relates},
- \li \l {16-qdoc-commands-status.html#since-command}{\\since},
- \li \l {15-qdoc-commands-navigation.html#startpage-command}{\\startpage},
- \li \l {20-qdoc-commands-namingthings.html#subtitle-command}{\\subtitle}
- \li \l {17-qdoc-commands-thread.html#threadsafe-command}{\\threadsafe},
- \li \l {20-qdoc-commands-namingthings.html#title-command}{\\title}
+ \li \l {compat-command}{\\compat},
+ \li \l {contentspage-command}{\\contentspage},
+ \li \l {indexpage-command}{\\indexpage},
+ \li \l {ingroup-command}{\\ingroup},
+ \li \l {inherits-command}{\\inherits},
+ \li \l {inmodule-command}{\\inmodule},
+ \li \l {internal-command}{\\internal},
+ \li \l {mainclass-command}{\\mainclass},
+ \li \l {nextpage-command}{\\nextpage},
+ \li \l {nonreentrant-command}{\\nonreentrant},
+ \li \l {obsolete-command}{\\obsolete},
+ \li \l {overload-command}{\\overload},
+ \li \l {preliminary-command}{\\preliminary},
+ \li \l {previouspage-command}{\\previouspage},
+ \li \l {reentrant-command}{\\reentrant},
+ \li \l {reimp-command}{\\reimp},
+ \li \l {relates-command}{\\relates},
+ \li \l {since-command}{\\since},
+ \li \l {startpage-command}{\\startpage},
+ \li \l {subtitle-command}{\\subtitle}
+ \li \l {threadsafe-command}{\\threadsafe},
+ \li \l {title-command}{\\title}
\endlist
*/
@@ -297,7 +297,7 @@
\section1 \\default
The \\default command is for marking a QML property as the
- \l {http://qt-project.org/doc/qt-4.7/qdeclarativeintroduction.html#default-properties}
+ \l {default-properties}
{default property}. The word \span {class="newStuff"} {default} is shown in red in
the documentation of the property.
@@ -314,7 +314,7 @@
\endcode
See how QDoc renders this property on the reference page for the
- \l {http://qt-project.org/doc/qt-4.7/qml-state.html#changes-prop} {State}
+ \l {changes-prop} {State}
type.
\target obsolete-command
@@ -448,7 +448,7 @@
\list
\li ...
\li Joining
- \l {http://qt-project.org/doc/qt-5.0/qtcore/qchar.html#Joining-enum}
+ \l {Joining-enum}
{joining}()
const \c (preliminary)
\li ...
@@ -497,7 +497,7 @@
configuration variable. For that reason this reference will change
according to the current documentation project.
- See also \l {25-qdoc-configuration-derivedprojects.html#project}
+ See also \l {project}
{\c project}.
*/
@@ -794,7 +794,7 @@
</h3>
\endraw
- This function overloads \l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction} {addAction()}
+ This function overloads \l {addAction} {addAction()}
This convenience function creates a new action with an
\e icon and some \e text. The function adds the newly
@@ -802,7 +802,7 @@
returns it.
See also
- \l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction}
+ \l {addAction}
{QWidget::addAction}().
\endquotation
diff --git a/src/tools/qdoc/doc/qdoc-manual-intro.qdoc b/src/tools/qdoc/doc/qdoc-manual-intro.qdoc
index db34e2a46c..ad3779048a 100644
--- a/src/tools/qdoc/doc/qdoc-manual-intro.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-intro.qdoc
@@ -80,7 +80,7 @@
\endcode
From the QDoc comment above, QDoc generates the HTML page
- \l {http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#details}
+ \l {details}
{QObject Class Reference}.
This manual explains how to use the QDoc commands in QDoc comments
@@ -120,7 +120,7 @@
also specify \e {DITAXML} to get DITA XML output instead.
Next, QDoc uses the values of the
- \l {22-qdoc-configuration-generalvariables.html#headerdirs-variable}
+ \l {headerdirs-variable}
{headerdirs} variable and/or the \l
{22-qdoc-configuration-generalvariables.html#headers-variable}
{headers} variable to find and parse all the header files for your
diff --git a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
index b41c450748..ee0a7b41db 100644
--- a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc
@@ -37,72 +37,72 @@
appearance and logical structure.
\list
- \li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a}
- \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract}
- \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist}
- \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)}
- \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} {(deprecated, use \\b)}
- \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief}
- \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c}
- \li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption}
- \li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter}
- \li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline}
- \li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots}
- \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)}
- \li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else}
- \li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif}
- \li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote}
- \li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist}
- \li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header}
- \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
- \li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if}
- \li \l {09-qdoc-commands-includingimages.html#image-command} {\\image}
- \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include}
- \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\input}
- \li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage}
- \li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword}
- \li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l}
- \li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese}
- \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)}
- \li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list}
- \li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta}
- \li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode}
- \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
- \li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note}
- \li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode}
- \li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit}
- \li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil}
- \li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile}
- \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw}
- \li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row}
- \li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa}
- \li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1}
- \li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2}
- \li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3}
- \li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil}
- \li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet}
- \li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span}
- \li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub}
- \li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup}
- \li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table}
- \li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents}
- \li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target}
- \li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt}
- \li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)}
- \li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline}
- \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\unicode}
- \li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning}
- \li \l {04-qdoc-commands-textmarkup.html#backslash-command} {\\\\}
+ \li \l {a-command} {\\a}
+ \li \l {abstract-command} {\\abstract}
+ \li \l {annotatedlist-command} {\\annotatedlist}
+ \li \l {b-command} {\\b} \span {class="newStuff"}
+ \li \l {b-command} {\\bold} {(deprecated, use \\b)}
+ \li \l {brief-command} {\\brief}
+ \li \l {c-command} {\\c}
+ \li \l {caption-command} {\\caption}
+ \li \l {chapter-command} {\\chapter}
+ \li \l {code-command} {\\code}
+ \li \l {codeline-command} {\\codeline}
+ \li \l {div-command} {\\div}
+ \li \l {dots-command} {\\dots}
+ \li \l {e-command} {\\e} \span {class="newStuff"}
+ \li \l {else-command} {\\else}
+ \li \l {endif-command} {\\endif}
+ \li \l {footnote-command} {\\footnote}
+ \li \l {generatelist-command} {\\generatelist}
+ \li \l {header-command} {\\header}
+ \li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)}
+ \li \l {if-command} {\\if}
+ \li \l {image-command} {\\image}
+ \li \l {include-command} {\\include}
+ \li \l {include-command} {\\input}
+ \li \l {inlineimage-command} {\\inlineimage}
+ \li \l {keyword-command} {\\keyword}
+ \li \l {l-command} {\\l}
+ \li \l {legalese-command} {\\legalese}
+ \li \l {li-command} {\\li} \span {class="newStuff"}
+ \li \l {list-command} {\\list}
+ \li \l {meta-command} {\\meta}
+ \li \l {newcode-command} {\\newcode}
+ \li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)}
+ \li \l {note-command} {\\note}
+ \li \l {oldcode-command} {\\oldcode}
+ \li \l {omit-command} {\\omit}
+ \li \l {part-command} {\\part}
+ \li \l {printline-command} {\\printline}
+ \li \l {printto-command} {\\printto}
+ \li \l {printuntil-command} {\\printuntil}
+ \li \l {quotation-command} {\\quotation}
+ \li \l {quotefile-command} {\\quotefile}
+ \li \l {quotefromfile-command} {\\quotefromfile}
+ \li \l {raw-command} {\\raw}
+ \li \l {row-command} {\\row}
+ \li \l {sa-command} {\\sa}
+ \li \l {sectionOne-command} {\\section1}
+ \li \l {sectionTwo-command} {\\section2}
+ \li \l {sectionThree-command} {\\section3}
+ \li \l {sectionFour-command} {\\section4}
+ \li \l {skipline-command} {\\skipline}
+ \li \l {skipto-command} {\\skipto}
+ \li \l {skipuntil-command} {\\skipuntil}
+ \li \l {snippet-command} {\\snippet}
+ \li \l {span-command} {\\span}
+ \li \l {sub-command} {\\sub}
+ \li \l {sup-command} {\\sup}
+ \li \l {table-command} {\\table}
+ \li \l {tableofcontents-command} {\\tableofcontents}
+ \li \l {target-command} {\\target}
+ \li \l {tt-command} {\\tt}
+ \li \l {uicontrol-command} {\\uicontrol} {(new 25/3/2012)}
+ \li \l {underline-command} {\\underline}
+ \li \l {raw-command} {\\unicode}
+ \li \l {warning-command} {\\warning}
+ \li \l {backslash-command} {\\\\}
\endlist
*/
@@ -1826,7 +1826,7 @@
\endcode
For the one-parameter version, the braces can often be omitted.
- The \\l command supports several kinds of links:
+ The \\l command supports several ways of linking:
\list
@@ -1855,9 +1855,6 @@
\li \c {\l {Shared Classes}} - A keyword named in a \l
{keyword-command} {\\keyword} command.
- \li \c {\l network.html} - The file name used in a \l
- {page-command} {\\page} command.
-
\li \c {\l http://qt-project.org/} - A URL.
\endlist
@@ -1974,22 +1971,15 @@
\endcode
The target name \e{capturing parentheses} can be linked from
- within the same document containing the target in two ways:
+ within the same document containing the target in the following way:
\list
\li \c {\l {capturing parentheses}} (from within the same QDoc comment)
- \li \c {\l qregexp.html#capturing-parentheses} (from elsewhere in the same document)
\endlist
\note The brackets in the link example are required because the
target name contains spaces.
- The target name can be linked to in the following way from other documents:
-
- \list
- \li \c {\l http://qt-project.org/doc/qt-5.0/qtcore/qregexp.html#capturing-parentheses}
- \endlist
-
See also \l {l-command} {\\l}, \l {sa-command} {\\sa} and \l
{keyword-command} {\\keyword}.
@@ -2042,7 +2032,7 @@
\quotation
When a string is surrounded by slashes, it is
- interpreted as a \l {QRegExp}{regular expression}.
+ interpreted as a \l {regular expression}.
\endquotation
If the keyword text contains spaces, the brackets are required.
@@ -2961,15 +2951,16 @@
\target brief class
- When the \\brief command is used to describe a class, the brief
- text should be a complete sentence and must start like this:
+ When the \\brief command is used to describe a class, we recommend
+ using a complete sentence like this:
\code
The <classname> class is|provides|contains|specifies...
\endcode
- \warning The brief statement is used as the first paragraph of the
- detailed description. Do not repeat the sentence.
+ \warning Do not repeat your detailed description with the same sentence as
+ the brief statement will be the first paragraph of the detailed
+ description.
\code
/ *!
diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
index 74f5ad0c7b..3adcf9b213 100644
--- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc
@@ -63,7 +63,7 @@
Some configuration variables accept a list of strings as their
value, for example:
- \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable}
+ \l {sourcedirs-variable}
{\c{sourcedirs}}, while others accept only a single string. Double
quotes around a value string are optional, but including them allows
you to use special characters like '=' and ' \" ' within the value
@@ -87,39 +87,39 @@
\section1 Variable List
\list
- \li \l {22-qdoc-configuration-generalvariables.html#alias-variable} {alias}
- \li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives-variable} {Cpp.ignoredirectives}
- \li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretokens-variable} {Cpp.ignoretokens}
- \li \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines}
- \li \l {22-qdoc-configuration-generalvariables.html#edition-variable} {edition}
- \li \l {22-qdoc-configuration-generalvariables.html#exampledirs-variable} {exampledirs}
- \li \l {22-qdoc-configuration-generalvariables.html#examples-variable} {examples}
- \li \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions-variable} {examples.fileextensions}
- \li \l {22-qdoc-configuration-generalvariables.html#excludedirs-variable} {excludedirs}
- \li \l {22-qdoc-configuration-generalvariables.html#excludefiles-variable} {excludefiles}
- \li \l {22-qdoc-configuration-generalvariables.html#extraimages-variable} {extraimages}
- \li \l {22-qdoc-configuration-generalvariables.html#falsehoods-variable} {falsehoods}
- \li \l {22-qdoc-configuration-generalvariables.html#headerdirs-variable} {headerdirs}
- \li \l {22-qdoc-configuration-generalvariables.html#headers-variable} {headers}
- \li \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions-variable} {headers.fileextensions}
- \li \l {24-qdoc-configuration-htmlvariables.html#HTML.footer-variable} {HTML.footer}
- \li \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader-variable} {HTML.postheader}
- \li \l {24-qdoc-configuration-htmlvariables.html#HTML.style-variable} {HTML.style}
- \li \l {22-qdoc-configuration-generalvariables.html#imagedirs-variable} {imagedirs}
- \li \l {22-qdoc-configuration-generalvariables.html#images-variable} {images}
- \li \l {22-qdoc-configuration-generalvariables.html#images.fileextensions-variable} {images.fileextensions}
- \li \l {22-qdoc-configuration-generalvariables.html#language-variable} {language}
- \li \l {22-qdoc-configuration-generalvariables.html#macro-variable} {macro}
- \li \l {22-qdoc-configuration-generalvariables.html#manifestmeta-variable} {manifestmeta}
- \li \l {22-qdoc-configuration-generalvariables.html#outputdir-variable} {outputdir}
- \li \l {22-qdoc-configuration-generalvariables.html#outputformats-variable} {outputformats}
- \li \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable} {sourcedirs}
- \li \l {22-qdoc-configuration-generalvariables.html#sources-variable} {sources}
- \li \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions-variable} {sources.fileextensions}
- \li \l {22-qdoc-configuration-generalvariables.html#spurious-variable} {spurious}
- \li \l {22-qdoc-configuration-generalvariables.html#tabsize-variable} {tabsize}
- \li \l {22-qdoc-configuration-generalvariables.html#version-variable} {version}
- \li \l {22-qdoc-configuration-generalvariables.html#versionsym-variable} {versionsym}
+ \li \l {alias-variable} {alias}
+ \li \l {Cpp.ignoredirectives-variable} {Cpp.ignoredirectives}
+ \li \l {Cpp.ignoretokens-variable} {Cpp.ignoretokens}
+ \li \l {defines-variable} {defines}
+ \li \l {edition-variable} {edition}
+ \li \l {exampledirs-variable} {exampledirs}
+ \li \l {examples-variable} {examples}
+ \li \l {examples.fileextensions-variable} {examples.fileextensions}
+ \li \l {excludedirs-variable} {excludedirs}
+ \li \l {excludefiles-variable} {excludefiles}
+ \li \l {extraimages-variable} {extraimages}
+ \li \l {falsehoods-variable} {falsehoods}
+ \li \l {headerdirs-variable} {headerdirs}
+ \li \l {headers-variable} {headers}
+ \li \l {headers.fileextensions-variable} {headers.fileextensions}
+ \li \l {HTML.footer-variable} {HTML.footer}
+ \li \l {HTML.postheader-variable} {HTML.postheader}
+ \li \l {HTML.style-variable} {HTML.style}
+ \li \l {imagedirs-variable} {imagedirs}
+ \li \l {images-variable} {images}
+ \li \l {images.fileextensions-variable} {images.fileextensions}
+ \li \l {language-variable} {language}
+ \li \l {macro-variable} {macro}
+ \li \l {manifestmeta-variable} {manifestmeta}
+ \li \l {outputdir-variable} {outputdir}
+ \li \l {outputformats-variable} {outputformats}
+ \li \l {sourcedirs-variable} {sourcedirs}
+ \li \l {sources-variable} {sources}
+ \li \l {sources.fileextensions-variable} {sources.fileextensions}
+ \li \l {spurious-variable} {spurious}
+ \li \l {tabsize-variable} {tabsize}
+ \li \l {version-variable} {version}
+ \li \l {versionsym-variable} {versionsym}
\endlist
\section1 Categories
@@ -1574,7 +1574,7 @@
dita.metadata.default.audience = programmer
\endcode
- See the \l {12-0-qdoc-commands-miscellaneous.html#meta-command}
+ See the \l {meta-command}
{\\meta} command for more details on DITA metadata.
*/
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index e6c5ae9062..97a980a3fa 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -136,6 +136,7 @@ Generator::Generator()
inSectionHeading_(false),
inTableHeader_(false),
threeColumnEnumValueTable_(true),
+ showInternal_(false),
numTableRows_(0)
{
qdb_ = QDocDatabase::qdocDB();
@@ -350,7 +351,11 @@ QString Generator::fileBase(const Node *node) const
base.append("-module");
}
if (node->isExample() || node->isExampleFile()) {
- base.prepend(project.toLower() + QLatin1Char('-'));
+ QString modPrefix(node->moduleName());
+ if (modPrefix.isEmpty()) {
+ modPrefix = project;
+ }
+ base.prepend(modPrefix.toLower() + QLatin1Char('-'));
}
if (node->isExample()) {
base.append(QLatin1String("-example"));
@@ -964,6 +969,8 @@ void Generator::generateInnerNode(InnerNode* node)
return;
if (node->isIndexNode())
return;
+ if (node->isInternal() && !showInternal_)
+ return;
if (node->type() == Node::Document) {
DocNode* docNode = static_cast<DocNode*>(node);
@@ -1666,6 +1673,7 @@ void Generator::augmentImageDirs(QSet<QString>& moreImageDirs)
void Generator::initializeGenerator(const Config& config)
{
config_ = &config;
+ showInternal_ = config.getBool(CONFIG_SHOWINTERNAL);
}
bool Generator::matchAhead(const Atom *atom, Atom::Type expectedAtomType)
diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h
index 52d73e8dea..b464014308 100644
--- a/src/tools/qdoc/generator.h
+++ b/src/tools/qdoc/generator.h
@@ -239,6 +239,7 @@ private:
bool inSectionHeading_;
bool inTableHeader_;
bool threeColumnEnumValueTable_;
+ bool showInternal_;
int numTableRows_;
QString link_;
QString sectionNumber_;
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 2387502b8a..986b4ae261 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -279,7 +279,8 @@ void HtmlGenerator::generateTree()
qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index",
projectUrl,
projectDescription,
- this);
+ this,
+ true);
}
if (!runPrepareOnly()) {
@@ -2310,7 +2311,7 @@ QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn,
}
out() << "<ul>\n";
for (int j=0; j<keys.size(); j++) {
- if (nodes[j]->access() == Node::Private) {
+ if (nodes[j]->access() == Node::Private || nodes[j]->status() == Node::Internal) {
continue;
}
out() << "<li class=\"fn\">";
@@ -2319,7 +2320,8 @@ QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn,
prefix = keys.at(j).mid(1);
prefix = prefix.left(keys.at(j).indexOf("::")+1);
}
- generateSynopsis(nodes[j], qcn, marker, CodeMarker::Summary, false, &prefix);
+ generateQmlItem(nodes[j], qcn, marker, true);
+ //generateSynopsis(nodes[j], qcn, marker, CodeMarker::Subpage, false, &prefix);
out() << "</li>\n";
}
out() << "</ul>\n";
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index 246e4d2d82..398d188464 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -218,8 +218,15 @@ static void loadIndexFiles(Config& config)
else if (foundIndices.size() == 1) {
indexToAdd = foundIndices[0].absoluteFilePath();
}
- if (!indexToAdd.isEmpty() && !indexFiles.contains(indexToAdd))
- indexFiles << indexToAdd;
+ if (!indexToAdd.isEmpty()) {
+ if (!indexFiles.contains(indexToAdd))
+ indexFiles << indexToAdd;
+ }
+ else if (Generator::runGenerateOnly()) {
+ qDebug() << "warning:" << config.getString(CONFIG_PROJECT)
+ << "Cannot locate index file for dependency"
+ << dependModules[i];
+ }
}
}
else {
@@ -355,7 +362,7 @@ static void processQdocconfFile(const QString &fileName)
*/
QDocDatabase* qdb = QDocDatabase::qdocDB();
qdb->setVersion(config.getString(CONFIG_VERSION));
-
+ qdb->setShowInternal(config.getBool(CONFIG_SHOWINTERNAL));
/*
By default, the only output format is HTML.
*/
@@ -393,6 +400,10 @@ static void processQdocconfFile(const QString &fileName)
QMap<QString,QString> headers;
QMultiMap<QString,QString> headerFileNames;
for (int i=0; i<headerList.size(); ++i) {
+ if (headerList[i].contains(QString("doc/snippets")))
+ continue;
+ if (headers.contains(headerList[i]))
+ continue;
headers.insert(headerList[i],headerList[i]);
QString t = headerList[i].mid(headerList[i].lastIndexOf('/')+1);
headerFileNames.insert(t,t);
@@ -403,6 +414,10 @@ static void processQdocconfFile(const QString &fileName)
QMap<QString,QString> sources;
QMultiMap<QString,QString> sourceFileNames;
for (int i=0; i<sourceList.size(); ++i) {
+ if (sourceList[i].contains(QString("doc/snippets")))
+ continue;
+ if (sources.contains(sourceList[i]))
+ continue;
sources.insert(sourceList[i],sourceList[i]);
QString t = sourceList[i].mid(sourceList[i].lastIndexOf('/')+1);
sourceFileNames.insert(t,t);
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index 75896e2718..c88ebfc760 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -1867,7 +1867,10 @@ FunctionNode::FunctionNode(Type type, InnerNode *parent, const QString& name, bo
rf(0),
ap(0)
{
- // nothing.
+ if (type == QmlMethod || type == QmlSignal) {
+ if (name.startsWith("__"))
+ setStatus(Internal);
+ }
}
/*!
@@ -2326,6 +2329,8 @@ QmlPropertyNode::QmlPropertyNode(InnerNode* parent,
setPageType(ApiPage);
if (type_ == QString("alias"))
isAlias_ = true;
+ if (name.startsWith("__"))
+ setStatus(Internal);
}
/*!
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index 9e736aeba6..236b495bd0 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -195,6 +195,7 @@ public:
virtual bool isInnerNode() const = 0;
virtual bool isQmlModule() const { return false; }
+ virtual bool isQmlType() const { return false; }
virtual bool isExample() const { return false; }
virtual bool isExampleFile() const { return false; }
virtual bool isLeaf() const { return false; }
@@ -610,6 +611,7 @@ public:
QmlClassNode(InnerNode* parent, const QString& name);
virtual ~QmlClassNode();
virtual bool isQmlNode() const { return true; }
+ virtual bool isQmlType() const { return true; }
virtual bool isQtQuickNode() const { return (qmlModuleName() == QLatin1String("QtQuick")); }
virtual ClassNode* classNode() { return cnode_; }
virtual void setClassNode(ClassNode* cn) { cnode_ = cn; }
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index e371d448c6..1011a3ac97 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -62,7 +62,7 @@ QDocDatabase* QDocDatabase::qdocDB_ = NULL;
It constructs a singleton Tree object with this
qdoc database pointer.
*/
-QDocDatabase::QDocDatabase()
+QDocDatabase::QDocDatabase() : showInternal_(false)
{
tree_ = new Tree(this);
}
@@ -357,23 +357,10 @@ QmlClassNode* QDocDatabase::findQmlType(const ImportRec& import, const QString&
else
qmName = import.importUri_;
for (int i=0; i<dotSplit.size(); ++i) {
- QString qmid = qmName + import.version_;
- QString qualifiedName = qmid + "::" + dotSplit[i];
+ QString qualifiedName = qmName + "::" + dotSplit[i];
QmlClassNode* qcn = qmlTypeMap_.value(qualifiedName);
- if (qcn) {
+ if (qcn)
return qcn;
- }
- if (import.version_.size() > 1) {
- int dot = import.version_.lastIndexOf(QChar('.'));
- if (dot > 0) {
- qmid = import.name_ + import.version_.left(dot);
- qualifiedName = qmid + "::" + dotSplit[i];
- qcn = qmlTypeMap_.value(qualifiedName);
- if (qcn) {
- return qcn;
- }
- }
- }
}
}
return 0;
@@ -436,7 +423,7 @@ void QDocDatabase::findAllClasses(const InnerNode* node)
{
NodeList::const_iterator c = node->childNodes().constBegin();
while (c != node->childNodes().constEnd()) {
- if ((*c)->access() != Node::Private) {
+ if ((*c)->access() != Node::Private && (!(*c)->isInternal() || showInternal_)) {
if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) {
QString className = (*c)->name();
if ((*c)->parent() &&
@@ -1000,24 +987,6 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root)
}
}
-#if 0
-void QDocDatabase::resolveQmlInheritance(InnerNode* root)
-{
- // Dop we need recursion?
- foreach (Node* child, root->childNodes()) {
- if (child->type() == Node::Document && child->subType() == Node::QmlClass) {
- QmlClassNode* qcn = static_cast<QmlClassNode*>(child);
- if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) {
- QmlClassNode* bqcn = findQmlType(QString(), qcn->qmlBaseName());
- if (bqcn) {
- qcn->setQmlBaseNode(bqcn);
- }
- }
- }
- }
-}
-#endif
-
/*!
*/
void QDocDatabase::resolveTargets(InnerNode* root)
diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h
index 5786fa0664..4decba5f79 100644
--- a/src/tools/qdoc/qdocdatabase.h
+++ b/src/tools/qdoc/qdocdatabase.h
@@ -200,6 +200,7 @@ class QDocDatabase
void insertOpenNamespace(const QString& path) { openNamespaces_.insert(path); }
FunctionNode* findNodeInOpenNamespace(const QStringList& parentPath, const FunctionNode* clone);
Node* findNodeInOpenNamespace(QStringList& path, Node::Type type, Node::SubType subtype);
+ void setShowInternal(bool value) { showInternal_ = value; }
/* debugging functions */
void printModules() const;
@@ -220,6 +221,7 @@ class QDocDatabase
private:
static QDocDatabase* qdocDB_;
+ bool showInternal_;
QString version_;
QDocMultiMap masterMap_;
Tree* tree_;
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index 7424971b13..47e302dad6 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -196,6 +196,10 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
location = Location(indexUrl + QLatin1Char('/') + name.toLower() + ".html");
else if (!indexUrl.isNull())
location = Location(name.toLower() + ".html");
+ bool abstract = false;
+ if (element.attribute("abstract") == "true")
+ abstract = true;
+ node->setAbstract(abstract);
}
else if ((element.nodeName() == "qmlclass") ||
((element.nodeName() == "page") && (element.attribute("subtype") == "qmlclass"))) {
@@ -204,6 +208,10 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
QString qmlModuleName = element.attribute("qml-module-name");
if (!qmlModuleName.isEmpty())
qdb_->addToQmlModule(qmlModuleName, qcn);
+ bool abstract = false;
+ if (element.attribute("abstract") == "true")
+ abstract = true;
+ qcn->setAbstract(abstract);
QString qmlFullBaseName = element.attribute("qml-base-type");
if (!qmlFullBaseName.isEmpty())
qcn->setQmlBaseName(qmlFullBaseName);
@@ -464,7 +472,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
node->setAccess(Node::Public);
else if (access == "protected")
node->setAccess(Node::Protected);
- else if (access == "private")
+ else if ((access == "private") || (access == "internal"))
node->setAccess(Node::Private);
else
node->setAccess(Node::Public);
@@ -506,10 +514,12 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
QString moduleName = element.attribute("module");
if (!moduleName.isEmpty())
node->setModuleName(moduleName);
- if (node->isExternalPage())
- node->setUrl(href);
- else if (!indexUrl.isEmpty())
- node->setUrl(indexUrl + QLatin1Char('/') + href);
+ if (!href.isEmpty()) {
+ if (node->isExternalPage())
+ node->setUrl(href);
+ else if (!indexUrl.isEmpty())
+ node->setUrl(indexUrl + QLatin1Char('/') + href);
+ }
QString since = element.attribute("since");
if (!since.isEmpty()) {
@@ -708,6 +718,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
access = "protected";
break;
case Node::Private:
+#if 0
// Do not include private non-internal nodes in the index.
// (Internal public and protected nodes are marked as private
// by qdoc. We can check their internal status to determine
@@ -716,6 +727,13 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
access = "internal";
else
return false;
+#endif
+ {
+ access = "private";
+ bool b = generateInternalNodes;
+ if (b)
+ b = false;
+ }
break;
default:
return false;
@@ -729,7 +747,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
writer.writeStartElement(nodeName);
QXmlStreamAttributes attributes;
- writer.writeAttribute("access", access);
if (node->type() != Node::Document) {
QString threadSafety;
@@ -776,7 +793,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
status = "main";
break;
}
- writer.writeAttribute("status", status);
writer.writeAttribute("name", objName);
if (node->isQmlModule()) {
@@ -804,9 +820,24 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
}
else
href = node->name();
- writer.writeAttribute("href", href);
+ if (node->isQmlNode()) {
+ InnerNode* p = node->parent();
+ if (p) {
+ if (p->isQmlPropertyGroup())
+ p = p->parent();
+ if (p && p->isQmlType() && p->isAbstract())
+ href.clear();
+ }
+ }
+ if (!href.isEmpty())
+ writer.writeAttribute("href", href);
- writer.writeAttribute("location", node->location().fileName());
+ writer.writeAttribute("access", access);
+ writer.writeAttribute("status", status);
+ if (node->isAbstract())
+ writer.writeAttribute("abstract", "true");
+ if (!node->location().fileName().isEmpty())
+ writer.writeAttribute("location", node->location().fileName());
if (!node->location().filePath().isEmpty()) {
writer.writeAttribute("filepath", node->location().filePath());
writer.writeAttribute("lineno", QString("%1").arg(node->location().lineNo()));
diff --git a/src/tools/qdoc/qmlparser/qqmljs.g b/src/tools/qdoc/qmlparser/qqmljs.g
index 7ba6859534..de4fec4d56 100644
--- a/src/tools/qdoc/qmlparser/qqmljs.g
+++ b/src/tools/qdoc/qmlparser/qqmljs.g
@@ -65,6 +65,7 @@
--- context keywords.
%token T_PUBLIC "public"
%token T_IMPORT "import"
+%token T_PRAGMA "pragma"
%token T_AS "as"
%token T_ON "on"
%token T_GET "get"
@@ -253,7 +254,8 @@ public:
AST::VariableDeclarationList *VariableDeclarationList;
AST::UiProgram *UiProgram;
- AST::UiImportList *UiImportList;
+ AST::UiHeaderItemList *UiHeaderItemList;
+ AST::UiPragma *UiPragma;
AST::UiImport *UiImport;
AST::UiParameterList *UiParameterList;
AST::UiPublicMember *UiPublicMember;
@@ -266,6 +268,7 @@ public:
AST::UiObjectMemberList *UiObjectMemberList;
AST::UiArrayMemberList *UiArrayMemberList;
AST::UiQualifiedId *UiQualifiedId;
+ AST::UiQualifiedPragmaId *UiQualifiedPragmaId;
};
public:
@@ -347,6 +350,7 @@ protected:
{ return location_stack [tos + index - 1]; }
AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr);
+ AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr);
protected:
Engine *driver;
@@ -486,6 +490,19 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr)
return 0;
}
+AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr)
+{
+ if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(expr)) {
+ AST::UiQualifiedPragmaId *q = new (pool) AST::UiQualifiedPragmaId(idExpr->name);
+ q->identifierToken = idExpr->identifierToken;
+
+ return q->finish();
+ }
+
+ return 0;
+}
+
+
bool Parser::parse(int startToken)
{
Lexer *lexer = driver->lexer();
@@ -594,38 +611,62 @@ case $rule_number: {
} break;
./
-UiProgram: UiImportListOpt UiRootMember ;
+UiProgram: UiHeaderItemListOpt UiRootMember;
/.
case $rule_number: {
- sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiImportList,
+ sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList,
sym(2).UiObjectMemberList->finish());
} break;
./
-UiImportListOpt: Empty ;
-UiImportListOpt: UiImportList ;
+UiHeaderItemListOpt: Empty ;
+UiHeaderItemListOpt: UiHeaderItemList ;
/.
case $rule_number: {
- sym(1).Node = sym(1).UiImportList->finish();
+ sym(1).Node = sym(1).UiHeaderItemList->finish();
} break;
./
-UiImportList: UiImport ;
+UiHeaderItemList: UiPragma ;
/.
case $rule_number: {
- sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImport);
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma);
} break;
./
-UiImportList: UiImportList UiImport ;
+UiHeaderItemList: UiImport ;
/.
case $rule_number: {
- sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImportList, sym(2).UiImport);
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport);
} break;
./
+UiHeaderItemList: UiHeaderItemList UiPragma ;
+/.
+case $rule_number: {
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma);
+} break;
+./
+
+UiHeaderItemList: UiHeaderItemList UiImport ;
+/.
+case $rule_number: {
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport);
+} break;
+./
+
+PragmaId: MemberExpression ;
+
ImportId: MemberExpression ;
+UiPragma: UiPragmaHead T_AUTOMATIC_SEMICOLON ;
+UiPragma: UiPragmaHead T_SEMICOLON ;
+/.
+case $rule_number: {
+ sym(1).UiPragma->semicolonToken = loc(2);
+} break;
+./
+
UiImport: UiImportHead T_AUTOMATIC_SEMICOLON ;
UiImport: UiImportHead T_SEMICOLON ;
/.
@@ -666,6 +707,28 @@ case $rule_number: {
} break;
./
+UiPragmaHead: T_PRAGMA PragmaId ;
+/.
+case $rule_number: {
+ AST::UiPragma *node = 0;
+
+ if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression)) {
+ node = new (pool) AST::UiPragma(qualifiedId);
+ }
+
+ sym(1).Node = node;
+
+ if (node) {
+ node->pragmaToken = loc(1);
+ } else {
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
+ QLatin1String("Expected a qualified name id")));
+
+ return false; // ### remove me
+ }
+} break;
+./
+
UiImportHead: T_IMPORT ImportId ;
/.
@@ -1261,6 +1324,7 @@ case $rule_number: {
} break;
./
+
UiQualifiedId: MemberExpression ;
/.
case $rule_number: {
diff --git a/src/tools/qdoc/qmlparser/qqmljsast.cpp b/src/tools/qdoc/qmlparser/qqmljsast.cpp
index ea0df4a537..33b3868e66 100644
--- a/src/tools/qdoc/qmlparser/qqmljsast.cpp
+++ b/src/tools/qdoc/qmlparser/qqmljsast.cpp
@@ -821,7 +821,7 @@ void DebuggerStatement::accept0(Visitor *visitor)
void UiProgram::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
- accept(imports, visitor);
+ accept(headers, visitor);
accept(members, visitor);
}
@@ -932,16 +932,34 @@ void UiImport::accept0(Visitor *visitor)
visitor->endVisit(this);
}
-void UiImportList::accept0(Visitor *visitor)
+void UiQualifiedPragmaId::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
- accept(import, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiPragma::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ accept(pragmaType, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
+void UiHeaderItemList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ accept(headerItem, visitor);
accept(next, visitor);
}
visitor->endVisit(this);
}
+
void UiSourceElement::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
diff --git a/src/tools/qdoc/qmlparser/qqmljsast_p.h b/src/tools/qdoc/qmlparser/qqmljsast_p.h
index 01a872f1e8..6cc3b7649e 100644
--- a/src/tools/qdoc/qmlparser/qqmljsast_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsast_p.h
@@ -207,18 +207,20 @@ public:
Kind_UiArrayBinding,
Kind_UiImport,
- Kind_UiImportList,
Kind_UiObjectBinding,
Kind_UiObjectDefinition,
Kind_UiObjectInitializer,
Kind_UiObjectMemberList,
Kind_UiArrayMemberList,
+ Kind_UiPragma,
Kind_UiProgram,
Kind_UiParameterList,
Kind_UiPublicMember,
Kind_UiQualifiedId,
+ Kind_UiQualifiedPragmaId,
Kind_UiScriptBinding,
- Kind_UiSourceElement
+ Kind_UiSourceElement,
+ Kind_UiHeaderItemList
};
inline Node()
@@ -2271,27 +2273,72 @@ public:
SourceLocation semicolonToken;
};
-class QML_PARSER_EXPORT UiImportList: public Node
+class QML_PARSER_EXPORT UiObjectMember: public Node
{
public:
- QQMLJS_DECLARE_AST_NODE(UiImportList)
+ virtual SourceLocation firstSourceLocation() const = 0;
+ virtual SourceLocation lastSourceLocation() const = 0;
- UiImportList(UiImport *import)
- : import(import),
- next(this)
+ virtual UiObjectMember *uiObjectMemberCast();
+};
+
+class QML_PARSER_EXPORT UiObjectMemberList: public Node
+{
+public:
+ QQMLJS_DECLARE_AST_NODE(UiObjectMemberList)
+
+ UiObjectMemberList(UiObjectMember *member)
+ : next(this), member(member)
{ kind = K; }
- UiImportList(UiImportList *previous, UiImport *import)
- : import(import)
+ UiObjectMemberList(UiObjectMemberList *previous, UiObjectMember *member)
+ : member(member)
{
kind = K;
next = previous->next;
previous->next = this;
}
- UiImportList *finish()
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return member->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return next ? next->lastSourceLocation() : member->lastSourceLocation(); }
+
+ UiObjectMemberList *finish()
{
- UiImportList *head = next;
+ UiObjectMemberList *head = next;
+ next = 0;
+ return head;
+ }
+
+// attributes
+ UiObjectMemberList *next;
+ UiObjectMember *member;
+};
+
+class QML_PARSER_EXPORT UiQualifiedPragmaId: public Node
+{
+public:
+ QQMLJS_DECLARE_AST_NODE(UiQualifiedPragmaId)
+
+ UiQualifiedPragmaId(const QStringRef &name)
+ : next(this), name(name)
+ { kind = K; }
+
+ UiQualifiedPragmaId(UiQualifiedPragmaId *previous, const QStringRef &name)
+ : name(name)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
+
+ UiQualifiedPragmaId *finish()
+ {
+ UiQualifiedPragmaId *head = next;
next = 0;
return head;
}
@@ -2299,60 +2346,87 @@ public:
virtual void accept0(Visitor *visitor);
virtual SourceLocation firstSourceLocation() const
- { return import->firstSourceLocation(); }
+ { return identifierToken; }
virtual SourceLocation lastSourceLocation() const
- { return next ? next->lastSourceLocation() : import->lastSourceLocation(); }
+ { return next ? next->lastSourceLocation() : identifierToken; }
// attributes
- UiImport *import;
- UiImportList *next;
+ UiQualifiedPragmaId *next;
+ QStringRef name;
+ SourceLocation identifierToken;
};
-class QML_PARSER_EXPORT UiObjectMember: public Node
+class QML_PARSER_EXPORT UiPragma: public Node
{
public:
- virtual SourceLocation firstSourceLocation() const = 0;
- virtual SourceLocation lastSourceLocation() const = 0;
+ QQMLJS_DECLARE_AST_NODE(UiPragma)
- virtual UiObjectMember *uiObjectMemberCast();
+ UiPragma(UiQualifiedPragmaId *type)
+ : pragmaType(type)
+ { kind = K; }
+
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return pragmaToken; }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return semicolonToken; }
+
+// attributes
+ UiQualifiedPragmaId *pragmaType;
+ SourceLocation pragmaToken;
+ SourceLocation semicolonToken;
};
-class QML_PARSER_EXPORT UiObjectMemberList: public Node
+class QML_PARSER_EXPORT UiHeaderItemList: public Node
{
public:
- QQMLJS_DECLARE_AST_NODE(UiObjectMemberList)
+ QQMLJS_DECLARE_AST_NODE(UiHeaderItemList)
- UiObjectMemberList(UiObjectMember *member)
- : next(this), member(member)
+ UiHeaderItemList(UiImport *import)
+ : headerItem(import), next(this)
{ kind = K; }
- UiObjectMemberList(UiObjectMemberList *previous, UiObjectMember *member)
- : member(member)
+ UiHeaderItemList(UiPragma *pragma)
+ : headerItem(pragma), next(this)
+ { kind = K; }
+
+ UiHeaderItemList(UiHeaderItemList *previous, UiImport *import)
+ : headerItem(import)
{
kind = K;
next = previous->next;
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
-
- virtual SourceLocation firstSourceLocation() const
- { return member->firstSourceLocation(); }
-
- virtual SourceLocation lastSourceLocation() const
- { return next ? next->lastSourceLocation() : member->lastSourceLocation(); }
+ UiHeaderItemList(UiHeaderItemList *previous, UiPragma *pragma)
+ : headerItem(pragma)
+ {
+ kind = K;
+ next = previous->next;
+ previous->next = this;
+ }
- UiObjectMemberList *finish()
+ UiHeaderItemList *finish()
{
- UiObjectMemberList *head = next;
+ UiHeaderItemList *head = next;
next = 0;
return head;
}
+ virtual void accept0(Visitor *visitor);
+
+ virtual SourceLocation firstSourceLocation() const
+ { return headerItem->firstSourceLocation(); }
+
+ virtual SourceLocation lastSourceLocation() const
+ { return next ? next->lastSourceLocation() : headerItem->lastSourceLocation(); }
+
// attributes
- UiObjectMemberList *next;
- UiObjectMember *member;
+ Node *headerItem;
+ UiHeaderItemList *next;
};
class QML_PARSER_EXPORT UiProgram: public Node
@@ -2360,16 +2434,16 @@ class QML_PARSER_EXPORT UiProgram: public Node
public:
QQMLJS_DECLARE_AST_NODE(UiProgram)
- UiProgram(UiImportList *imports, UiObjectMemberList *members)
- : imports(imports), members(members)
+ UiProgram(UiHeaderItemList *headers, UiObjectMemberList *members)
+ : headers(headers), members(members)
{ kind = K; }
virtual void accept0(Visitor *visitor);
virtual SourceLocation firstSourceLocation() const
{
- if (imports)
- return imports->firstSourceLocation();
+ if (headers)
+ return headers->firstSourceLocation();
else if (members)
return members->firstSourceLocation();
return SourceLocation();
@@ -2379,13 +2453,13 @@ public:
{
if (members)
return members->lastSourceLocation();
- else if (imports)
- return imports->lastSourceLocation();
+ else if (headers)
+ return headers->lastSourceLocation();
return SourceLocation();
}
// attributes
- UiImportList *imports;
+ UiHeaderItemList *headers;
UiObjectMemberList *members;
};
diff --git a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h
index fe5572c4b2..f8cba4981c 100644
--- a/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsastfwd_p.h
@@ -167,7 +167,7 @@ class NestedExpression;
// ui elements
class UiProgram;
-class UiImportList;
+class UiPragma;
class UiImport;
class UiPublicMember;
class UiParameterList;
@@ -181,6 +181,8 @@ class UiObjectMember;
class UiObjectMemberList;
class UiArrayMemberList;
class UiQualifiedId;
+class UiQualifiedPragmaId;
+class UiHeaderItemList;
} } // namespace AST
diff --git a/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h b/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h
index ef022f617c..1d67d4c75d 100644
--- a/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsastvisitor_p.h
@@ -71,7 +71,8 @@ public:
// Ui
virtual bool visit(UiProgram *) { return true; }
- virtual bool visit(UiImportList *) { return true; }
+ virtual bool visit(UiHeaderItemList *) { return true; }
+ virtual bool visit(UiPragma *) { return true; }
virtual bool visit(UiImport *) { return true; }
virtual bool visit(UiPublicMember *) { return true; }
virtual bool visit(UiSourceElement *) { return true; }
@@ -84,10 +85,12 @@ public:
virtual bool visit(UiObjectMemberList *) { return true; }
virtual bool visit(UiArrayMemberList *) { return true; }
virtual bool visit(UiQualifiedId *) { return true; }
+ virtual bool visit(UiQualifiedPragmaId *) { return true; }
virtual void endVisit(UiProgram *) {}
- virtual void endVisit(UiImportList *) {}
virtual void endVisit(UiImport *) {}
+ virtual void endVisit(UiHeaderItemList *) {}
+ virtual void endVisit(UiPragma *) {}
virtual void endVisit(UiPublicMember *) {}
virtual void endVisit(UiSourceElement *) {}
virtual void endVisit(UiObjectDefinition *) {}
@@ -99,6 +102,7 @@ public:
virtual void endVisit(UiObjectMemberList *) {}
virtual void endVisit(UiArrayMemberList *) {}
virtual void endVisit(UiQualifiedId *) {}
+ virtual void endVisit(UiQualifiedPragmaId *) {}
// QQmlJS
virtual bool visit(ThisExpression *) { return true; }
diff --git a/src/tools/qdoc/qmlparser/qqmljsengine_p.h b/src/tools/qdoc/qmlparser/qqmljsengine_p.h
index 4f58e7f8ea..195b98bfd7 100644
--- a/src/tools/qdoc/qmlparser/qqmljsengine_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsengine_p.h
@@ -102,6 +102,7 @@ public:
~Engine();
void setCode(const QString &code);
+ const QString &code() const { return _code; }
void addComment(int pos, int len, int line, int col);
QList<AST::SourceLocation> comments() const;
diff --git a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h
index 3aecc863d5..c53e12ea56 100644
--- a/src/tools/qdoc/qmlparser/qqmljsglobal_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsglobal_p.h
@@ -61,8 +61,10 @@
# if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
// QmlDevTools is a static library
# define QML_PARSER_EXPORT
-# else
+# elif defined(QT_BUILD_QML_LIB)
# define QML_PARSER_EXPORT Q_AUTOTEST_EXPORT
+# else
+# define QML_PARSER_EXPORT
# endif
#endif // QT_CREATOR
diff --git a/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp b/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
index 4a5672a796..1e5f7a8c6d 100644
--- a/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
+++ b/src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
@@ -54,421 +54,427 @@ const char *const QQmlJSGrammar::spell [] = {
")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch",
"this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^",
"^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", 0,
- "public", "import", "as", "on", "get", "set", 0, 0, 0, 0,
- 0, 0, 0, 0, 0};
+ "public", "import", "pragma", "as", "on", "get", "set", 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
const short QQmlJSGrammar::lhs [] = {
- 105, 105, 105, 105, 105, 105, 106, 112, 112, 115,
- 115, 117, 116, 116, 116, 116, 116, 116, 116, 116,
- 119, 114, 113, 122, 122, 123, 123, 124, 124, 121,
- 110, 110, 110, 110, 126, 126, 126, 126, 126, 126,
- 126, 110, 134, 134, 134, 135, 135, 136, 136, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 120, 120, 120, 120,
- 120, 120, 120, 139, 139, 139, 139, 139, 139, 139,
- 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
- 139, 125, 141, 141, 141, 141, 140, 140, 145, 145,
- 145, 143, 143, 146, 146, 146, 146, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 150, 150,
- 118, 118, 118, 118, 118, 153, 153, 154, 154, 154,
- 154, 152, 152, 155, 155, 156, 156, 157, 157, 157,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 159, 159, 159, 159, 160, 160, 160, 161, 161, 161,
- 161, 162, 162, 162, 162, 162, 162, 162, 163, 163,
- 163, 163, 163, 163, 164, 164, 164, 164, 164, 165,
- 165, 165, 165, 165, 166, 166, 167, 167, 168, 168,
- 169, 169, 170, 170, 171, 171, 172, 172, 173, 173,
- 174, 174, 175, 175, 176, 176, 177, 177, 144, 144,
- 178, 178, 179, 179, 179, 179, 179, 179, 179, 179,
- 179, 179, 179, 179, 108, 108, 180, 180, 181, 181,
- 182, 182, 107, 107, 107, 107, 107, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 107, 127, 191, 191,
- 190, 190, 138, 138, 192, 192, 193, 193, 195, 195,
- 194, 196, 199, 197, 197, 200, 198, 198, 128, 129,
- 129, 130, 130, 183, 183, 183, 183, 183, 183, 183,
- 183, 184, 184, 184, 184, 185, 185, 185, 185, 186,
- 186, 131, 132, 201, 201, 204, 204, 202, 202, 205,
- 203, 187, 188, 188, 133, 133, 133, 206, 207, 189,
- 189, 208, 137, 151, 151, 209, 209, 148, 148, 147,
- 147, 210, 111, 111, 211, 211, 109, 109, 142, 142,
- 212};
+ 106, 106, 106, 106, 106, 106, 107, 113, 113, 116,
+ 116, 116, 116, 119, 121, 117, 117, 118, 118, 118,
+ 118, 118, 118, 118, 118, 122, 123, 115, 114, 126,
+ 126, 127, 127, 128, 128, 125, 111, 111, 111, 111,
+ 130, 130, 130, 130, 130, 130, 130, 111, 138, 138,
+ 138, 139, 139, 140, 140, 111, 111, 111, 111, 111,
+ 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
+ 111, 111, 124, 124, 124, 124, 124, 124, 124, 143,
+ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
+ 143, 143, 143, 143, 143, 143, 143, 129, 145, 145,
+ 145, 145, 144, 144, 149, 149, 149, 147, 147, 150,
+ 150, 150, 150, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 153, 153, 154, 154, 120, 120, 120, 120,
+ 120, 157, 157, 158, 158, 158, 158, 156, 156, 159,
+ 159, 160, 160, 161, 161, 161, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 163, 163, 163, 163,
+ 164, 164, 164, 165, 165, 165, 165, 166, 166, 166,
+ 166, 166, 166, 166, 167, 167, 167, 167, 167, 167,
+ 168, 168, 168, 168, 168, 169, 169, 169, 169, 169,
+ 170, 170, 171, 171, 172, 172, 173, 173, 174, 174,
+ 175, 175, 176, 176, 177, 177, 178, 178, 179, 179,
+ 180, 180, 181, 181, 148, 148, 182, 182, 183, 183,
+ 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
+ 109, 109, 184, 184, 185, 185, 186, 186, 108, 108,
+ 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
+ 108, 108, 108, 131, 195, 195, 194, 194, 142, 142,
+ 196, 196, 197, 197, 199, 199, 198, 200, 203, 201,
+ 201, 204, 202, 202, 132, 133, 133, 134, 134, 187,
+ 187, 187, 187, 187, 187, 187, 187, 188, 188, 188,
+ 188, 189, 189, 189, 189, 190, 190, 135, 136, 205,
+ 205, 208, 208, 206, 206, 209, 207, 191, 192, 192,
+ 137, 137, 137, 210, 211, 193, 193, 212, 141, 155,
+ 155, 213, 213, 152, 152, 151, 151, 214, 112, 112,
+ 215, 215, 110, 110, 146, 146, 216};
const short QQmlJSGrammar::rhs [] = {
2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
- 2, 1, 2, 2, 3, 3, 5, 5, 4, 4,
- 2, 0, 1, 1, 2, 1, 3, 2, 3, 2,
- 1, 5, 4, 4, 1, 1, 1, 1, 1, 1,
- 1, 3, 1, 1, 1, 0, 1, 2, 4, 6,
- 6, 3, 3, 7, 7, 4, 4, 5, 5, 5,
- 6, 6, 10, 6, 1, 1, 1, 1, 1, 1,
+ 1, 2, 2, 1, 1, 2, 2, 2, 2, 3,
+ 3, 5, 5, 4, 4, 2, 2, 0, 1, 1,
+ 2, 1, 3, 2, 3, 2, 1, 5, 4, 4,
+ 1, 1, 1, 1, 1, 1, 1, 3, 1, 1,
+ 1, 0, 1, 2, 4, 6, 6, 3, 3, 7,
+ 7, 4, 4, 5, 5, 5, 6, 6, 10, 6,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 3, 3, 4, 5, 3, 4,
- 3, 1, 1, 2, 3, 4, 1, 2, 3, 7,
- 8, 1, 3, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 3, 3, 4, 5, 3, 4, 3, 1, 1, 2,
+ 3, 4, 1, 2, 3, 7, 8, 1, 3, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 4, 3, 5, 1, 2, 4, 4, 4,
- 3, 0, 1, 1, 3, 1, 1, 1, 2, 2,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 3, 3, 3, 1, 3, 3, 1, 3, 3,
- 3, 1, 3, 3, 3, 3, 3, 3, 1, 3,
- 3, 3, 3, 3, 1, 3, 3, 3, 3, 1,
- 3, 3, 3, 3, 1, 3, 1, 3, 1, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 4, 3,
+ 5, 1, 2, 4, 4, 4, 3, 0, 1, 1,
+ 3, 1, 1, 1, 2, 2, 1, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 3, 3, 3,
+ 1, 3, 3, 1, 3, 3, 3, 1, 3, 3,
+ 3, 3, 3, 3, 1, 3, 3, 3, 3, 3,
+ 1, 3, 3, 3, 3, 1, 3, 3, 3, 3,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 5, 1, 5, 1, 3,
- 1, 3, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 3, 0, 1, 1, 3,
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
- 0, 1, 3, 3, 1, 1, 1, 3, 1, 3,
- 2, 2, 2, 0, 1, 2, 0, 1, 1, 2,
- 2, 7, 5, 7, 7, 7, 5, 9, 10, 7,
- 8, 2, 2, 3, 3, 2, 2, 3, 3, 3,
- 3, 5, 5, 3, 5, 1, 2, 0, 1, 4,
- 3, 3, 3, 3, 3, 3, 4, 5, 2, 2,
- 2, 1, 8, 8, 7, 1, 3, 0, 1, 0,
- 1, 1, 1, 1, 1, 2, 1, 1, 0, 1,
- 2};
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 5, 1, 5, 1, 3, 1, 3, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 3, 0, 1, 1, 3, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 3, 1, 2, 0, 1, 3, 3,
+ 1, 1, 1, 3, 1, 3, 2, 2, 2, 0,
+ 1, 2, 0, 1, 1, 2, 2, 7, 5, 7,
+ 7, 7, 5, 9, 10, 7, 8, 2, 2, 3,
+ 3, 2, 2, 3, 3, 3, 3, 5, 5, 3,
+ 5, 1, 2, 0, 1, 4, 3, 3, 3, 3,
+ 3, 3, 4, 5, 2, 2, 2, 1, 8, 8,
+ 7, 1, 3, 0, 1, 0, 1, 1, 1, 1,
+ 1, 2, 1, 1, 0, 1, 2};
const short QQmlJSGrammar::action_default [] = {
- 0, 0, 22, 0, 0, 0, 22, 0, 178, 245,
- 209, 217, 213, 157, 229, 205, 3, 142, 75, 158,
- 221, 225, 146, 175, 156, 161, 141, 195, 182, 0,
- 82, 83, 78, 0, 72, 67, 349, 0, 0, 0,
- 0, 80, 0, 0, 76, 79, 71, 0, 0, 68,
- 70, 73, 69, 81, 74, 0, 77, 0, 0, 171,
- 0, 0, 158, 177, 160, 159, 0, 0, 0, 173,
- 174, 172, 176, 0, 206, 0, 0, 0, 0, 196,
- 0, 0, 0, 0, 0, 0, 186, 0, 0, 0,
- 180, 181, 179, 184, 188, 187, 185, 183, 198, 197,
- 199, 0, 214, 0, 210, 0, 0, 152, 139, 151,
- 140, 108, 109, 110, 135, 111, 136, 112, 113, 114,
- 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
- 137, 125, 126, 127, 128, 129, 130, 131, 132, 133,
- 134, 138, 0, 0, 150, 246, 153, 0, 154, 0,
- 155, 149, 0, 242, 235, 233, 240, 241, 239, 238,
- 244, 237, 236, 234, 243, 230, 0, 218, 0, 0,
- 222, 0, 0, 226, 0, 0, 152, 144, 0, 143,
- 0, 148, 162, 0, 338, 338, 339, 0, 336, 0,
- 337, 0, 340, 253, 260, 259, 267, 255, 0, 256,
- 0, 341, 0, 348, 257, 258, 75, 263, 261, 345,
- 342, 347, 264, 0, 275, 0, 0, 0, 0, 332,
- 0, 349, 247, 289, 0, 0, 0, 276, 0, 0,
- 265, 266, 0, 254, 262, 290, 291, 0, 338, 0,
- 0, 340, 0, 333, 334, 0, 322, 346, 0, 306,
- 307, 308, 309, 0, 302, 303, 304, 305, 330, 331,
- 0, 0, 0, 0, 0, 294, 295, 296, 251, 249,
- 211, 219, 215, 231, 207, 252, 0, 158, 223, 227,
- 200, 189, 0, 0, 208, 0, 0, 0, 0, 201,
- 0, 0, 0, 0, 0, 193, 191, 194, 192, 190,
- 203, 202, 204, 0, 216, 0, 212, 0, 250, 158,
- 0, 232, 247, 248, 0, 247, 0, 0, 298, 0,
- 0, 0, 300, 0, 220, 0, 0, 224, 0, 0,
- 228, 287, 0, 279, 288, 282, 0, 286, 0, 247,
- 280, 0, 247, 0, 0, 299, 0, 0, 0, 301,
- 0, 0, 0, 293, 0, 292, 75, 102, 350, 0,
- 0, 107, 269, 272, 0, 108, 275, 111, 136, 113,
- 114, 78, 118, 119, 72, 120, 123, 76, 79, 247,
- 73, 81, 126, 74, 128, 77, 130, 131, 276, 133,
- 134, 138, 0, 104, 103, 106, 90, 105, 89, 0,
- 99, 270, 268, 0, 0, 0, 340, 0, 100, 146,
- 147, 152, 0, 145, 0, 310, 311, 0, 338, 0,
- 0, 340, 0, 101, 0, 0, 0, 313, 318, 316,
- 319, 0, 0, 317, 318, 0, 314, 0, 315, 271,
- 321, 0, 271, 320, 0, 323, 324, 0, 271, 325,
- 326, 0, 0, 327, 0, 0, 0, 328, 329, 164,
- 163, 0, 0, 0, 297, 0, 0, 0, 312, 284,
- 277, 0, 285, 281, 0, 283, 273, 0, 274, 278,
- 0, 0, 340, 0, 335, 93, 0, 0, 97, 84,
- 0, 86, 95, 0, 87, 96, 98, 88, 94, 85,
- 0, 91, 168, 166, 170, 167, 165, 169, 343, 6,
- 344, 4, 2, 65, 92, 0, 0, 68, 70, 69,
- 31, 5, 0, 66, 0, 45, 44, 43, 0, 0,
- 58, 0, 59, 35, 36, 37, 38, 40, 41, 62,
- 39, 0, 45, 0, 0, 0, 0, 0, 54, 0,
- 55, 0, 0, 26, 0, 0, 63, 27, 0, 30,
- 28, 24, 0, 29, 25, 0, 56, 0, 57, 146,
- 0, 60, 64, 0, 0, 0, 0, 61, 0, 52,
- 46, 53, 47, 0, 0, 0, 0, 49, 0, 50,
- 51, 48, 0, 0, 146, 271, 0, 0, 42, 75,
- 108, 275, 111, 136, 113, 114, 78, 118, 119, 120,
- 123, 76, 79, 247, 81, 126, 74, 128, 77, 130,
- 131, 276, 133, 134, 138, 0, 32, 33, 0, 34,
- 8, 0, 10, 0, 9, 0, 1, 21, 12, 0,
- 13, 0, 14, 0, 19, 20, 0, 15, 16, 0,
- 17, 18, 11, 23, 7, 351};
+ 0, 0, 28, 0, 0, 0, 28, 0, 184, 251,
+ 215, 223, 219, 163, 235, 211, 3, 148, 81, 164,
+ 227, 231, 152, 181, 162, 167, 147, 201, 188, 0,
+ 88, 89, 84, 0, 78, 73, 355, 0, 0, 0,
+ 0, 86, 0, 0, 82, 85, 77, 0, 0, 74,
+ 76, 79, 75, 87, 80, 0, 83, 0, 0, 177,
+ 0, 0, 164, 183, 166, 165, 0, 0, 0, 179,
+ 180, 178, 182, 0, 212, 0, 0, 0, 0, 202,
+ 0, 0, 0, 0, 0, 0, 192, 0, 0, 0,
+ 186, 187, 185, 190, 194, 193, 191, 189, 204, 203,
+ 205, 0, 220, 0, 216, 0, 0, 158, 145, 157,
+ 146, 114, 115, 116, 141, 117, 142, 118, 119, 120,
+ 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+ 143, 131, 132, 133, 134, 135, 136, 137, 138, 139,
+ 140, 144, 0, 0, 156, 252, 159, 0, 160, 0,
+ 161, 155, 0, 248, 241, 239, 246, 247, 245, 244,
+ 250, 243, 242, 240, 249, 236, 0, 224, 0, 0,
+ 228, 0, 0, 232, 0, 0, 158, 150, 0, 149,
+ 0, 154, 168, 0, 344, 344, 345, 0, 342, 0,
+ 343, 0, 346, 259, 266, 265, 273, 261, 0, 262,
+ 0, 347, 0, 354, 263, 264, 81, 269, 267, 351,
+ 348, 353, 270, 0, 281, 0, 0, 0, 0, 338,
+ 0, 355, 253, 295, 0, 0, 0, 282, 0, 0,
+ 271, 272, 0, 260, 268, 296, 297, 0, 344, 0,
+ 0, 346, 0, 339, 340, 0, 328, 352, 0, 312,
+ 313, 314, 315, 0, 308, 309, 310, 311, 336, 337,
+ 0, 0, 0, 0, 0, 300, 301, 302, 257, 255,
+ 217, 225, 221, 237, 213, 258, 0, 164, 229, 233,
+ 206, 195, 0, 0, 214, 0, 0, 0, 0, 207,
+ 0, 0, 0, 0, 0, 199, 197, 200, 198, 196,
+ 209, 208, 210, 0, 222, 0, 218, 0, 256, 164,
+ 0, 238, 253, 254, 0, 253, 0, 0, 304, 0,
+ 0, 0, 306, 0, 226, 0, 0, 230, 0, 0,
+ 234, 293, 0, 285, 294, 288, 0, 292, 0, 253,
+ 286, 0, 253, 0, 0, 305, 0, 0, 0, 307,
+ 0, 0, 0, 299, 0, 298, 81, 108, 356, 0,
+ 0, 113, 275, 278, 0, 114, 281, 117, 142, 119,
+ 120, 84, 124, 125, 78, 126, 129, 82, 85, 253,
+ 79, 87, 132, 80, 134, 83, 136, 137, 282, 139,
+ 140, 144, 0, 110, 109, 112, 96, 111, 95, 0,
+ 105, 276, 274, 0, 0, 0, 346, 0, 106, 152,
+ 153, 158, 0, 151, 0, 316, 317, 0, 344, 0,
+ 0, 346, 0, 107, 0, 0, 0, 319, 324, 322,
+ 325, 0, 0, 323, 324, 0, 320, 0, 321, 277,
+ 327, 0, 277, 326, 0, 329, 330, 0, 277, 331,
+ 332, 0, 0, 333, 0, 0, 0, 334, 335, 170,
+ 169, 0, 0, 0, 303, 0, 0, 0, 318, 290,
+ 283, 0, 291, 287, 0, 289, 279, 0, 280, 284,
+ 0, 0, 346, 0, 341, 99, 0, 0, 103, 90,
+ 0, 92, 101, 0, 93, 102, 104, 94, 100, 91,
+ 0, 97, 174, 172, 176, 173, 171, 175, 349, 6,
+ 350, 4, 2, 71, 98, 0, 0, 74, 76, 75,
+ 37, 5, 0, 72, 0, 51, 50, 49, 0, 0,
+ 64, 0, 65, 41, 42, 43, 44, 46, 47, 68,
+ 45, 0, 51, 0, 0, 0, 0, 0, 60, 0,
+ 61, 0, 0, 32, 0, 0, 69, 33, 0, 36,
+ 34, 30, 0, 35, 31, 0, 62, 0, 63, 152,
+ 0, 66, 70, 0, 0, 0, 0, 67, 0, 58,
+ 52, 59, 53, 0, 0, 0, 0, 55, 0, 56,
+ 57, 54, 0, 0, 152, 277, 0, 0, 48, 81,
+ 114, 281, 117, 142, 119, 120, 84, 124, 125, 126,
+ 129, 82, 85, 253, 87, 132, 80, 134, 83, 136,
+ 137, 282, 139, 140, 144, 0, 38, 39, 0, 40,
+ 8, 0, 0, 9, 0, 11, 0, 10, 0, 1,
+ 27, 15, 14, 26, 13, 12, 29, 7, 0, 18,
+ 0, 19, 0, 24, 25, 0, 20, 21, 0, 22,
+ 23, 16, 17, 357};
const short QQmlJSGrammar::goto_default [] = {
- 7, 636, 211, 198, 209, 521, 509, 635, 654, 508,
- 634, 632, 637, 22, 633, 18, 520, 562, 552, 559,
- 554, 539, 193, 197, 199, 204, 234, 212, 231, 543,
- 583, 582, 203, 233, 26, 487, 486, 359, 358, 9,
- 357, 360, 202, 480, 361, 109, 17, 147, 24, 13,
- 146, 19, 25, 59, 23, 8, 28, 27, 280, 15,
- 274, 10, 270, 12, 272, 11, 271, 20, 278, 21,
- 279, 14, 273, 269, 310, 414, 275, 276, 205, 195,
- 194, 208, 207, 230, 196, 364, 363, 232, 471, 470,
- 332, 333, 473, 335, 472, 334, 427, 431, 434, 430,
- 429, 449, 450, 200, 186, 201, 210, 0};
+ 7, 639, 211, 198, 209, 521, 509, 634, 647, 508,
+ 633, 637, 635, 643, 22, 640, 638, 636, 18, 520,
+ 562, 552, 559, 554, 539, 193, 197, 199, 204, 234,
+ 212, 231, 543, 583, 582, 203, 233, 26, 487, 486,
+ 359, 358, 9, 357, 360, 202, 480, 361, 109, 17,
+ 147, 24, 13, 146, 19, 25, 59, 23, 8, 28,
+ 27, 280, 15, 274, 10, 270, 12, 272, 11, 271,
+ 20, 278, 21, 279, 14, 273, 269, 310, 414, 275,
+ 276, 205, 195, 194, 208, 207, 230, 196, 364, 363,
+ 232, 471, 470, 332, 333, 473, 335, 472, 334, 427,
+ 431, 434, 430, 429, 449, 450, 200, 186, 201, 210,
+ 0};
const short QQmlJSGrammar::action_index [] = {
- 235, 1289, 2663, 2663, 2562, 1005, 64, 90, 103, -105,
- 88, 94, 79, 173, -105, 302, 69, -105, -105, 724,
- 65, 135, 195, 239, -105, -105, -105, 367, 278, 1289,
- -105, -105, -105, 485, -105, -105, 2360, 1772, 1289, 1289,
- 1289, -105, 817, 1289, -105, -105, -105, 1289, 1289, -105,
- -105, -105, -105, -105, -105, 1289, -105, 1289, 1289, -105,
- 1289, 1289, 95, 207, -105, -105, 1289, 1289, 1289, -105,
- -105, -105, 202, 1289, 300, 1289, 1289, 1289, 1289, 377,
- 1289, 1289, 1289, 1289, 1289, 1289, 253, 1289, 1289, 1289,
- 151, 147, 129, 196, 170, 199, 279, 270, 470, 470,
- 387, 1289, 53, 1289, 80, 2158, 1289, 1289, -105, -105,
- -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
- -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
- -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
- -105, -105, 128, 1289, -105, -105, 74, 52, -105, 1289,
- -105, -105, 1289, -105, -105, -105, -105, -105, -105, -105,
- -105, -105, -105, -105, -105, -105, 1289, 51, 1289, 1289,
- 77, 66, 1289, -105, 2158, 1289, 1289, -105, 125, -105,
- 48, -105, -105, 47, 451, 374, 83, 87, -105, 397,
- -105, 62, 2663, -105, -105, -105, -105, -105, 205, -105,
- 415, -105, 68, -105, -105, -105, 86, -105, -105, -105,
- 2663, -105, -105, 622, -105, 576, 102, 2562, 75, 89,
- 81, 2865, 1289, -105, 70, 1289, 63, -105, 92, 93,
- -105, -105, 546, -105, -105, -105, -105, 91, 546, 40,
- 45, 2663, 49, -105, -105, 2562, -105, -105, 106, -105,
- -105, -105, -105, 121, -105, -105, -105, -105, -105, -105,
- 42, 44, 1289, 114, 222, -105, -105, -105, 1481, -105,
- 84, 57, 56, -105, 388, 78, 54, 682, 82, 99,
- 357, 247, 546, 1289, 295, 1289, 1289, 1289, 1289, 334,
- 1289, 1289, 1289, 1289, 1289, 203, 217, 244, 263, 211,
- 341, 319, 351, 1289, 56, 1289, 73, 1289, -105, 724,
- 1289, -105, 1289, 67, 46, 1289, 61, 2562, -105, 1289,
- 136, 2562, -105, 1289, 76, 1289, 1289, 85, 59, 1289,
- -105, 71, 133, 72, -105, -105, 1289, -105, 546, 1289,
- -105, -53, 1289, -60, 2562, -105, 1289, 143, 2562, -105,
- 1289, 132, 2562, 8, 2562, -105, 7, -105, 12, -37,
- 107, -105, -105, 2562, -33, 622, 22, 555, 115, 1289,
- 2562, 23, -13, 502, 2259, -10, 817, 18, 6, 1387,
- 2259, 0, 9, -6, 1289, -4, -23, 1289, 5, 1289,
- -25, -27, 2461, -105, -105, -105, -105, -105, -105, 1289,
- -105, -105, -105, -3, -1, 21, 2663, 1, -105, 218,
- -105, 1289, 4, -105, 111, -105, -105, 26, 466, 16,
- 38, 2663, 39, -105, 1289, 110, 37, -105, 55, -105,
- 60, 116, 1289, -105, 58, 43, -105, -15, -105, 2562,
- -105, 123, 2562, -105, 154, -105, -105, 96, 2562, 32,
- -105, 3, 14, -105, 546, -11, 13, -105, -105, -105,
- -105, 1289, 126, 2562, -105, 1289, 130, 2562, -105, 15,
- -105, 301, -105, -105, 1289, -105, -105, 546, -105, -105,
- -45, -12, 2663, -24, -105, -105, 204, 1578, -105, -105,
- 1869, -105, -105, 1675, -105, -105, -105, -105, -105, -105,
- 101, -105, -105, -105, -105, -105, -105, -105, -105, -105,
- 2663, -105, -105, -105, 105, 2, 910, 206, -47, -2,
- -105, -105, 246, -105, 214, -105, -105, -105, 364, 232,
- -105, 1963, -105, -105, -105, -105, -105, -105, -105, -105,
- -105, 191, 24, 394, 172, -18, 384, 215, -105, -30,
- -105, 910, 149, -105, -16, 910, -105, -105, 1100, -105,
- -105, -105, 1195, -105, -105, 225, -105, 1963, -105, 316,
- -17, -105, -105, 269, 418, -5, 1963, -105, 184, -105,
- 175, -105, 20, -9, 546, 182, 469, -105, 104, -105,
- -105, -105, 2057, 910, 292, 2764, 1772, 10, -105, 35,
- 622, 34, 525, 98, 1289, 2562, 50, 17, 536, 19,
- 817, 31, 27, 1387, 28, 9, 29, 1289, 30, 11,
- 1289, 41, 1289, 33, 36, 137, -105, -105, 25, -105,
- -105, 910, -105, 268, -86, 910, -105, -105, 141, 546,
- -105, 156, -105, 117, -105, -105, 546, -105, -105, 138,
- -105, -105, -105, -105, -105, -105,
+ 239, 1406, 2692, 2692, 2794, 1119, 115, 29, 168, -106,
+ 26, -23, -60, 225, -106, 306, 33, -106, -106, 732,
+ -2, 145, 243, 223, -106, -106, -106, 379, 227, 1406,
+ -106, -106, -106, 539, -106, -106, 2488, 1698, 1406, 1406,
+ 1406, -106, 1023, 1406, -106, -106, -106, 1406, 1406, -106,
+ -106, -106, -106, -106, -106, 1406, -106, 1406, 1406, -106,
+ 1406, 1406, 114, 206, -106, -106, 1406, 1406, 1406, -106,
+ -106, -106, 211, 1406, 302, 1406, 1406, 1406, 1406, 369,
+ 1406, 1406, 1406, 1406, 1406, 1406, 226, 1406, 1406, 1406,
+ 135, 151, 110, 257, 279, 276, 256, 222, 475, 475,
+ 475, 1406, 7, 1406, 57, 2284, 1406, 1406, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, 136, 1406, -106, -106, 30, -24, -106, 1406,
+ -106, -106, 1406, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, 1406, 2, 1406, 1406,
+ 10, 97, 1406, -106, 2284, 1406, 1406, -106, 141, -106,
+ -45, -106, -106, 4, 457, 386, 89, 79, -106, 448,
+ -106, 74, 2692, -106, -106, -106, -106, -106, 164, -106,
+ 460, -106, 85, -106, -106, -106, 96, -106, -106, -106,
+ 2692, -106, -106, 547, -106, 629, 143, 2794, 62, 54,
+ 43, 2998, 1406, -106, 51, 1406, 52, -106, 47, 45,
+ -106, -106, 454, -106, -106, -106, -106, 64, 352, 31,
+ 61, 2692, 27, -106, -106, 2794, -106, -106, 139, -106,
+ -106, -106, -106, 126, -106, -106, -106, -106, -106, -106,
+ -6, 25, 1406, 130, 159, -106, -106, -106, 1600, -106,
+ 68, 65, 5, -106, 308, 60, 3, 835, 99, 105,
+ 337, 207, 408, 1406, 317, 1406, 1406, 1406, 1406, 353,
+ 1406, 1406, 1406, 1406, 1406, 186, 203, 204, 212, 219,
+ 333, 343, 359, 1406, 20, 1406, 202, 1406, -106, 732,
+ 1406, -106, 1406, 81, 72, 1406, 77, 2794, -106, 1406,
+ 149, 2794, -106, 1406, 80, 1406, 1406, 94, 88, 1406,
+ -106, -8, 128, -25, -106, -106, 1406, -106, 471, 1406,
+ -106, -53, 1406, -56, 2794, -106, 1406, 134, 2794, -106,
+ 1406, 138, 2794, -5, 2794, -106, -4, -106, 9, -9,
+ 37, -106, -106, 2794, -12, 555, 32, 629, 123, 1406,
+ 2794, 41, 18, 504, 2386, 21, 1023, 49, 46, 1505,
+ 2386, 42, 16, 44, 1406, 24, -10, 1406, 17, 1406,
+ -15, -18, 2590, -106, -106, -106, -106, -106, -106, 1406,
+ -106, -106, -106, -1, -26, -3, 2692, -27, -106, 277,
+ -106, 1406, -28, -106, 90, -106, -106, 1, 552, -40,
+ -11, 2692, -29, -106, 1406, 117, 14, -106, 50, -106,
+ 40, 119, 1406, -106, 11, 35, -106, -54, -106, 2794,
+ -106, 116, 2794, -106, 267, -106, -106, 121, 2794, -7,
+ -106, -31, -19, -106, 376, 6, 78, -106, -106, -106,
+ -106, 1406, 98, 2794, -106, 1406, 106, 2794, -106, 76,
+ -106, 254, -106, -106, 1406, -106, -106, 552, -106, -106,
+ 71, 75, 2692, 67, -106, -106, 122, 1992, -106, -106,
+ 1796, -106, -106, 1894, -106, -106, -106, -106, -106, -106,
+ 113, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ 2692, -106, -106, -106, 111, 22, 929, 152, 39, 48,
+ -106, -106, 301, -106, 147, -106, -106, -106, 468, 155,
+ -106, 2182, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, 178, -30, 463, 181, -14, 400, 229, -106, -32,
+ -106, 929, 104, -106, 0, 929, -106, -106, 1311, -106,
+ -106, -106, 1215, -106, -106, 248, -106, 2182, -106, 392,
+ 59, -106, -106, 244, 552, 73, 2182, -106, 236, -106,
+ 237, -106, 70, 15, 368, 214, 355, -106, 103, -106,
+ -106, -106, 2087, 721, 392, 2896, 1698, 34, -106, 56,
+ 598, 55, 629, 107, 1406, 2794, 53, 23, 544, 36,
+ 1023, 58, 66, 1505, 69, 38, 63, 1406, 95, 84,
+ 1406, 102, 1406, 83, 82, 124, -106, -106, 87, -106,
+ -106, 929, 813, 91, 929, -106, 271, -106, 86, -106,
+ -106, 100, 101, -106, -106, -106, -106, -106, 552, -106,
+ 209, -106, 109, -106, -106, 552, -106, -106, 92, -106,
+ -106, -106, -106, -106,
- -108, 0, 79, 128, 132, 301, 2, -108, -108, -108,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -47,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, 51,
- -108, -108, -108, -3, -108, -108, 8, -23, 12, 78,
- 106, -108, 69, 74, -108, -108, -108, 195, 204, -108,
- -108, -108, -108, -108, -108, 188, -108, 201, 200, -108,
- 127, 129, -108, -108, -108, -108, 140, 137, 133, -108,
- -108, -108, -108, 146, -108, 177, 168, 170, 167, -108,
- 144, 152, 166, 158, 160, 131, -108, 194, 187, 207,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- -108, 88, -108, 112, -108, 121, 90, -38, -108, -108,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- -108, -108, -108, 32, -108, -108, -108, -108, -108, 26,
- -108, -108, 27, -108, -108, -108, -108, -108, -108, -108,
- -108, -108, -108, -108, -108, -108, 102, -108, 103, 41,
- -108, -108, 37, -108, 250, 38, 83, -108, -108, -108,
- -108, -108, -108, -108, 42, 126, -108, -108, -108, 40,
- -108, -108, 43, -108, -108, -108, -108, -108, -108, -108,
- 39, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- 225, -108, -108, 30, -108, 24, -108, 211, -108, 55,
- -108, 77, 60, -108, -108, 66, 34, -108, -108, -108,
- -108, -108, -8, -108, -108, -108, -108, -108, 153, -108,
- -108, 164, -108, -108, -108, 241, -108, -108, -108, -108,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- -108, -108, 11, -108, -108, -108, -108, -108, 179, -108,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- -108, -108, 19, 259, -108, 255, 228, 240, 246, -108,
- 52, 63, 67, 65, 50, -108, -108, -108, -108, -108,
- -108, -108, -108, 210, -108, 256, -108, 226, -108, -108,
- 252, -108, 161, -108, -108, 268, -108, 197, -108, 5,
- -108, 218, -108, 222, -108, 213, 249, -108, -108, 236,
- -108, -108, -108, -108, -108, -108, 212, -108, 80, 87,
- -108, -108, 86, -108, 98, -108, 61, -108, 245, -108,
- 59, -108, 208, -108, 192, -108, -108, -108, -108, -108,
- -108, -108, -108, 257, -108, 33, -108, 28, -108, 73,
- 71, -108, -108, 36, 57, -108, 62, -108, -108, 46,
- 70, -108, -108, -108, 49, -108, 45, 99, -108, 84,
- -108, -108, 100, -108, -108, -108, -108, -108, -108, 21,
- -108, -108, -108, -108, -108, -108, 118, -108, -108, -108,
- -108, 81, -108, -108, -108, -108, -108, -108, 123, -108,
- -108, 134, -108, -108, 56, -108, -108, -108, -108, -108,
- -58, -108, 47, -108, -57, -108, -108, -108, -108, 265,
- -108, -108, 374, -108, -108, -108, -108, -108, 94, -66,
- -108, -108, 25, -108, 22, -108, 31, -108, -108, -108,
- -108, 58, -108, 229, -108, 35, -108, 235, -108, -108,
- -108, -108, -108, -108, 29, -108, -108, 186, -108, -108,
- -108, -108, 162, -108, -108, -108, -108, 48, -108, -108,
- 163, -108, -108, 44, -108, -108, -108, -108, -108, -108,
- -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
- 141, -108, -108, -108, -108, -108, -7, -108, -108, -108,
- -108, -108, -108, -108, -19, -108, -108, -108, -6, -108,
- -108, 334, -108, -108, -108, -108, -108, -108, -108, -108,
- -108, -108, -108, -15, -27, -108, -10, -108, -108, -108,
- -108, 159, -108, -108, -108, 176, -108, -108, 319, -108,
- -108, -108, 322, -108, -108, -108, -108, 469, -108, -108,
- 10, -108, -108, 6, 16, -108, 342, -108, -108, -108,
- 17, -108, -108, -108, 15, 3, 9, -108, -108, -108,
- -108, -108, 358, 68, -108, 82, 310, 1, -108, -108,
- -2, -108, 7, -108, 54, 76, -108, -108, 4, -108,
- 64, -108, -108, 23, -108, -108, -108, 18, -108, -5,
- 95, -108, 91, -108, -108, -108, -108, -108, -1, -108,
- -108, 20, -108, -108, 14, 142, -108, -108, -108, 13,
- -108, -108, -108, -108, -108, -108, -11, -108, -108, -108,
- -108, -108, -108, -108, -108, -108};
+ -111, 43, 59, 70, 71, 369, 40, -111, -111, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, 21,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, 79,
+ -111, -111, -111, -16, -111, -111, 5, -26, 23, 73,
+ 91, -111, 83, 61, -111, -111, -111, 88, 87, -111,
+ -111, -111, -111, -111, -111, 29, -111, 66, 39, -111,
+ 97, 193, -111, -111, -111, -111, 160, 180, 183, -111,
+ -111, -111, -111, 176, -111, 167, 151, 155, 152, -111,
+ 148, 187, 195, 197, 199, 201, -111, 186, 92, 194,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ -111, 103, -111, 108, -111, 181, -2, -42, -111, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ -111, -111, -111, 34, -111, -111, -111, -111, -111, 3,
+ -111, -111, 10, -111, -111, -111, -111, -111, -111, -111,
+ -111, -111, -111, -111, -111, -111, 127, -111, 109, 15,
+ -111, -111, 16, -111, 225, 44, 128, -111, -111, -111,
+ -111, -111, -111, -111, 25, 157, -111, -111, -111, 26,
+ -111, -111, 24, -111, -111, -111, -111, -111, -111, -111,
+ 22, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ 179, -111, -111, 45, -111, 46, -111, 107, -111, 48,
+ -111, 106, 62, -111, -111, 163, -3, -111, -111, -111,
+ -111, -111, -14, -111, -111, -111, -111, -111, 57, -111,
+ -111, 224, -111, -111, -111, 227, -111, -111, -111, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ -111, -111, 35, -111, -111, -111, -111, -111, 72, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ -111, -111, 12, 264, -111, 258, 246, 254, 209, -111,
+ 60, 51, 52, 27, 53, -111, -111, -111, -111, -111,
+ -111, -111, -111, 244, -111, 255, -111, 203, -111, -111,
+ 207, -111, 217, -111, -111, 198, -111, 208, -111, 8,
+ -111, 215, -111, 232, -111, 233, 234, -111, -111, 223,
+ -111, -111, -111, -111, -111, -111, 230, -111, 95, 113,
+ -111, -111, 153, -111, 156, -111, 2, -111, 147, -111,
+ 58, -111, 137, -111, 100, -111, -111, -111, -111, -111,
+ -111, -111, -111, 135, -111, 41, -111, 54, -111, 117,
+ 162, -111, -111, 50, 169, -111, 174, -111, -111, 32,
+ 178, -111, -111, -111, 31, -111, 7, 144, -111, 130,
+ -111, -111, 142, -111, -111, -111, -111, -111, -111, 11,
+ -111, -111, -111, -111, -111, -111, 214, -111, -111, -111,
+ -111, 140, -111, -111, -111, -111, -111, -111, 158, -111,
+ -111, 149, -111, -111, 47, -111, -111, -111, -111, -111,
+ -55, -111, 38, -111, -67, -111, -111, -111, -111, 263,
+ -111, -111, 262, -111, -111, -111, -111, -111, 190, -76,
+ -111, -111, 30, -111, 19, -111, 14, -111, -111, -111,
+ -111, 33, -111, 272, -111, 64, -111, 175, -111, -111,
+ -111, -111, -111, -111, 18, -111, -111, 69, -111, -111,
+ -111, -111, 114, -111, -111, -111, -111, 20, -111, -111,
+ 110, -111, -111, 28, -111, -111, -111, -111, -111, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+ 86, -111, -111, -111, -111, -111, 55, -111, -111, -111,
+ -111, -111, -111, -111, -7, -111, -111, -111, 1, -111,
+ -111, 329, -111, -111, -111, -111, -111, -111, -111, -111,
+ -111, -111, -111, 0, -11, -111, -10, -111, -111, -111,
+ -111, 204, -111, -111, -111, 205, -111, -111, 317, -111,
+ -111, -111, 311, -111, -111, -111, -111, 370, -111, -111,
+ -9, -111, -111, -4, -12, -111, 337, -111, -111, -111,
+ -18, -111, -111, -111, -1, -17, -6, -111, -111, -111,
+ -111, -111, 466, 78, -111, 82, 307, -13, -111, -111,
+ -8, -111, 6, -111, 74, 76, -111, -111, 9, -111,
+ 85, -111, -111, 17, -111, -111, -111, 4, -111, -22,
+ 84, -111, 67, -111, -111, -111, -111, -111, 49, -111,
+ -111, 37, 42, 68, 77, -111, -111, -111, -111, -111,
+ -111, -111, -111, -111, -111, -111, -111, -111, 13, -111,
+ -111, -111, -111, -111, -111, 36, -111, -111, -111, -111,
+ -111, -111, -111, -111};
const short QQmlJSGrammar::action_info [] = {
- 344, -127, 576, -129, 551, 631, 546, -105, 342, 465,
- 448, 461, -132, -106, 245, 481, 558, 558, 398, 573,
- 392, 482, 402, 268, 354, -124, 350, 578, 585, -135,
- -116, 484, 474, 404, -106, -105, -127, -129, -124, 454,
- 438, -135, 245, 558, 448, 424, 448, 448, -132, 456,
- 439, 588, 452, 268, 406, 350, 408, -116, 558, 405,
- 432, 544, 418, 432, 413, 432, 329, 166, 524, 461,
- 428, 421, 465, 172, 283, 143, 420, 143, 241, 166,
- 262, 73, 149, 185, 323, 283, 307, 323, 336, 73,
- 655, 189, 0, 245, 423, 192, 448, 0, 0, 101,
- 240, 0, 451, 346, 243, 303, 424, 315, 181, 143,
- 0, 268, 151, 0, 399, 312, 452, 350, 143, 261,
- 174, 317, 143, 244, 303, 184, 435, 238, 461, 465,
- 442, 143, 103, 143, 143, 305, 143, 64, 143, 175,
- 143, 338, 101, 60, 143, 555, 0, 191, 65, 325,
- 0, 143, 0, 326, 61, 631, 174, 555, 103, 259,
- 258, 501, 143, 259, 258, 590, 589, 252, 251, 60,
- 426, 436, 416, 415, 264, 175, 259, 258, 645, 644,
- 61, 179, 257, 256, 144, 168, 463, 60, 105, 169,
- 467, 60, 352, 626, 339, 87, 321, 88, 61, 651,
- 650, 525, 61, 348, 525, 556, 174, 106, 89, 107,
- 174, 525, 490, 143, 66, 446, 445, 648, 647, 66,
- 580, 87, 549, 88, 87, 175, 88, 411, 87, 175,
- 88, 176, 567, 174, 89, 542, 87, 89, 88, 531,
- 0, 89, 87, 525, 88, 581, 579, 527, 646, 89,
- 527, 66, 175, 592, 411, 89, 0, 527, 526, 67,
- 491, 526, 0, 0, 67, 68, 236, 235, 526, 87,
- 68, 88, 87, 0, 88, 0, 550, 548, 87, 558,
- 88, 527, 89, 267, 265, 89, 568, 566, 87, 527,
- 88, 89, 526, 532, 530, 87, 67, 88, 525, 0,
- 526, 89, 68, 87, 87, 88, 88, 174, 89, 477,
- 0, 266, 0, 285, 286, 641, 89, 89, 75, 76,
- 75, 76, 0, 0, 0, -92, 175, 0, 176, 642,
- 640, 174, 6, 5, 4, 1, 3, 2, 0, 593,
- 287, 288, 290, 291, 527, 77, 78, 77, 78, -92,
- 175, 292, 176, 0, 293, 526, 294, 290, 291, 0,
- 639, 0, 478, 476, 290, 291, 292, 0, 0, 293,
- 0, 294, 0, 292, 290, 291, 293, 0, 294, 0,
- 290, 291, 0, 292, 0, 0, 293, 0, 294, 292,
- 80, 81, 293, 35, 294, 0, 0, 0, 82, 83,
- 80, 81, 84, 35, 85, 0, 285, 286, 82, 83,
- 80, 81, 84, 35, 85, 0, 0, 0, 82, 83,
- 0, 0, 84, 35, 85, 0, 35, 0, 0, 0,
- 49, 52, 50, 287, 288, 0, 0, 0, 0, 0,
- 49, 52, 50, 0, 35, 0, 0, 35, 0, 0,
- 49, 52, 50, 0, 0, 0, 0, 46, 34, 51,
- 49, 52, 50, 49, 52, 50, 0, 46, 34, 51,
- 0, 0, 0, 0, 0, 0, 0, 46, 34, 51,
- 35, 49, 52, 50, 49, 52, 50, 46, 34, 51,
- 46, 34, 51, 80, 81, 35, 0, 0, 35, 0,
- 0, 82, 83, 0, 0, 84, 0, 85, 46, 34,
- 51, 46, 34, 51, 35, 0, 0, 49, 52, 50,
- 0, 184, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 35, 49, 52, 50, 49, 52, 50, 184, 0,
- 0, 0, 0, 0, 46, 34, 51, 0, 0, 0,
- 0, 49, 52, 50, 35, 0, 0, 0, 0, 46,
- 34, 51, 46, 34, 51, 35, 0, 0, 49, 52,
- 50, 0, 184, 0, 0, 35, 0, 0, 46, 34,
- 51, 0, 0, 0, 35, 0, 255, 254, 0, 0,
- 0, 49, 52, 50, 0, 46, 34, 51, 0, 0,
- 0, 0, 49, 52, 50, 35, 0, 0, 0, 0,
- 0, 0, 49, 52, 50, 0, 255, 254, 46, 34,
- 51, 49, 52, 50, 0, 0, 0, 0, 0, 46,
- 34, 51, 0, 0, 0, 0, 0, 255, 254, 46,
- 34, 51, 49, 52, 50, 0, 0, 0, 46, 34,
- 51, 35, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 46,
- 34, 51, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 250, 249, 153, 0, 0, 49, 52,
- 50, 0, 0, 0, 0, 154, 0, 0, 0, 155,
- 0, 0, 0, 0, 0, 0, 0, 0, 156, 0,
- 157, 0, 0, 319, 0, 46, 34, 51, 0, 0,
- 0, 158, 0, 159, 64, 0, 0, 153, 0, 0,
- 0, 160, 0, 0, 161, 65, 0, 154, 0, 0,
- 162, 155, 0, 0, 0, 0, 163, 0, 0, 0,
- 156, 0, 157, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 164, 158, 0, 159, 64, 0, 0, 0,
- 0, 0, 0, 160, 0, 0, 161, 65, 0, 0,
- 0, 0, 162, 0, 0, 0, 0, 0, 163, 0,
+ 166, 438, 551, 245, 344, 454, 346, 544, 342, 336,
+ 546, 354, 166, 452, 448, 181, 432, 392, 465, 103,
+ 420, 461, 421, 448, -138, 101, 423, 73, 408, 663,
+ 406, -135, 413, 558, 405, 404, 151, 418, 149, -141,
+ 185, 143, 439, 402, 399, 432, 398, 428, -122, -111,
+ 101, -133, 424, -112, 268, 432, -130, 350, 73, 268,
+ -122, 262, -141, 245, 312, -130, 456, 558, 307, 283,
+ -133, 261, 350, -112, 424, 588, -111, 578, 585, 350,
+ 576, 465, 243, 461, 305, 448, 103, 424, 524, 143,
+ 184, 240, 558, 474, 241, 329, 323, 189, 268, 305,
+ 238, 323, -135, 245, 172, 573, 143, 192, 482, -138,
+ 0, 448, 555, 303, 143, 174, 174, 448, 465, 461,
+ 558, 143, 484, 442, 143, 143, 174, 451, 303, 435,
+ 490, 481, 555, 315, 175, 175, 338, 317, 143, 191,
+ 244, 452, 143, 0, 143, 175, 143, 662, 661, 143,
+ 60, 416, 415, 660, 659, 325, 64, 143, 463, 326,
+ 556, 61, 531, 0, 590, 589, 467, 65, 259, 258,
+ 654, 653, 143, 501, 436, 60, 525, 426, 491, 0,
+ 626, 542, 631, 632, 259, 258, 61, 257, 256, 339,
+ 264, 60, 144, 174, 348, 168, 0, 179, 352, 169,
+ 252, 251, 61, 283, 259, 258, 631, 632, 60, 321,
+ 525, 87, 175, 88, 411, 0, 532, 530, 66, 61,
+ 267, 265, 527, 66, 89, 236, 235, 527, 87, 87,
+ 88, 88, 87, 526, 88, 66, 549, 87, 526, 88,
+ 105, 89, 89, 525, 87, 89, 88, 87, 266, 88,
+ 89, 87, 87, 88, 88, 567, 527, 89, 174, 106,
+ 89, 107, 477, 67, 89, 89, 525, 526, 67, 68,
+ 657, 656, 580, 525, 68, 143, 0, 175, 0, 176,
+ 67, 87, 87, 88, 88, 0, 68, 0, 0, 527,
+ 550, 548, 174, 0, 89, 89, 0, 581, 579, 0,
+ 526, 87, 655, 88, 87, 0, 88, 0, 592, 568,
+ 566, 175, 527, 411, 89, 478, 476, 89, 650, 527,
+ 75, 76, 0, 526, 75, 76, 285, 286, 446, 445,
+ 526, 0, 651, 649, 558, 285, 286, 6, 5, 4,
+ 1, 3, 2, 0, 0, 0, 0, 77, 78, 0,
+ 0, 77, 78, 287, 288, 0, 290, 291, 0, 0,
+ 290, 291, 287, 288, 648, 292, 290, 291, 293, 292,
+ 294, 0, 293, 0, 294, 292, 290, 291, 293, 0,
+ 294, 35, 290, 291, 35, 292, 0, 0, 293, 0,
+ 294, 292, 80, 81, 293, 593, 294, 35, 0, 0,
+ 82, 83, 80, 81, 84, 35, 85, 174, 0, 0,
+ 82, 83, 0, 0, 84, 35, 85, 0, 49, 52,
+ 50, 49, 52, 50, 0, -98, 175, 0, 176, 35,
+ 0, 0, 0, 0, 49, 52, 50, 35, 0, 0,
+ 0, 0, 49, 52, 50, 0, 46, 34, 51, 46,
+ 34, 51, 49, 52, 50, 0, 0, 0, 0, 0,
+ 0, 0, 46, 34, 51, 0, 49, 52, 50, 0,
+ 46, 34, 51, 0, 49, 52, 50, 35, 0, 0,
+ 46, 34, 51, 35, 0, 0, 35, 0, 0, 35,
+ 0, 0, 35, 0, 46, 34, 51, 35, 80, 81,
+ 35, 0, 46, 34, 51, 0, 82, 83, 0, 0,
+ 84, 0, 85, 0, 49, 52, 50, 0, 0, 0,
+ 49, 52, 50, 49, 52, 50, 49, 52, 50, 49,
+ 52, 50, 0, 35, 49, 52, 50, 49, 52, 50,
+ 184, 0, 46, 34, 51, 0, 0, 0, 46, 34,
+ 51, 46, 34, 51, 46, 34, 51, 46, 34, 51,
+ 0, 0, 46, 34, 51, 46, 34, 51, 35, 0,
+ 49, 52, 50, 35, 0, 184, 35, 0, 0, 0,
+ 184, 35, 0, 0, 35, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 46, 34,
+ 51, 0, 0, 0, 0, 49, 52, 50, 250, 249,
+ 49, 52, 50, 49, 52, 50, 250, 249, 49, 52,
+ 50, 49, 52, 50, 0, 0, 0, 35, 0, 0,
+ 0, 0, 0, 46, 34, 51, 0, 0, 46, 34,
+ 51, 46, 34, 51, 0, 0, 46, 34, 51, 46,
+ 34, 51, 0, 0, 0, 0, 0, 0, 35, 250,
+ 249, 0, 0, 0, 49, 52, 50, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 164, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,
- 31, 0, 0, 0, 0, 0, 0, 0, 0, 33,
- 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
- 36, 37, 0, 38, 0, 0, 0, 0, 0, 0,
- 42, 0, 0, 0, 45, 0, 0, 0, 0, 0,
+ 255, 254, 46, 34, 51, 49, 52, 50, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 53, 49, 52, 50, 0, 54, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 44, 56,
- 32, 0, 0, 0, 41, 0, 0, 0, 0, 0,
- 46, 34, 51, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 30, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 33, 0, 0, 0, 0, 0, 0, 35,
- 0, 0, 0, 36, 37, 0, 38, 0, 0, 0,
- 0, 0, 0, 516, 0, 0, 0, 45, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 53, 49, 52, 50, 0,
- 54, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 44, 56, 32, 0, 0, 0, 41, 0, 0,
0, 0, 0, 46, 34, 51, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 515, 0, 30, 31, 0,
- 0, 0, 0, 0, 0, 0, 0, 219, 0, 0,
- 0, 0, 0, 0, 35, 0, 0, 0, 36, 37,
- 0, 38, 0, 0, 0, 0, 0, 0, 516, 0,
- 0, 0, 45, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 30, 31, 153, 0, 0, 0, 0,
+ 0, 0, 0, 33, 0, 154, 0, 0, 0, 155,
+ 35, 0, 0, 0, 36, 37, 0, 38, 156, 0,
+ 157, 0, 0, 0, 516, 0, 0, 0, 45, 0,
+ 0, 158, 0, 159, 64, 0, 0, 0, 0, 0,
+ 0, 160, 0, 0, 161, 65, 53, 49, 52, 50,
+ 162, 54, 0, 0, 0, 0, 163, 0, 0, 0,
+ 0, 0, 44, 56, 32, 0, 0, 0, 41, 0,
+ 0, 0, 164, 0, 0, 46, 34, 51, 0, 0,
+ 0, 0, 0, 0, 0, 30, 31, 0, 0, 0,
+ 0, 0, 0, 0, 0, 33, 0, 0, 153, 0,
+ 0, 0, 35, 0, 0, 0, 36, 37, 154, 38,
+ 0, 0, 155, 0, 0, 0, 516, 0, 0, 0,
+ 45, 156, 0, 157, 0, 0, 319, 0, 0, 0,
+ 0, 0, 0, 0, 158, 0, 159, 64, 53, 49,
+ 52, 50, 0, 54, 160, 0, 0, 161, 65, 0,
+ 0, 0, 0, 162, 44, 56, 32, 0, 0, 163,
+ 41, 0, 0, 0, 0, 0, 0, 46, 34, 51,
+ 0, 0, 0, 0, 0, 164, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 53, 517, 519, 518, 0, 54, 0, 0, 0, 0,
- 227, 0, 0, 0, 0, 0, 44, 56, 32, 214,
- 0, 0, 41, 0, 0, 0, 0, 0, 46, 34,
- 51, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 515, 0, 30, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 219, 0, 0, 0, 0, 0, 0, 35,
- 0, 0, 0, 36, 37, 0, 38, 0, 0, 0,
- 0, 0, 0, 516, 0, 0, 0, 45, 0, 0,
- 0, 0, 0, 0, 0, 560, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 53, 517, 519, 518, 0,
- 54, 0, 0, 0, 0, 227, 0, 0, 0, 0,
- 0, 44, 56, 32, 214, 0, 0, 41, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 30, 31, 0, 0, 0, 0, 0, 0, 0,
+ 0, 33, 0, 0, 0, 0, 0, 0, 35, 0,
+ 0, 0, 36, 37, 0, 38, 0, 0, 0, 0,
+ 0, 0, 516, 0, 0, 0, 45, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 53, 49, 52, 50, 0, 54,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 44, 56, 32, 0, 0, 0, 41, 0, 0, 0,
+ 0, 0, 0, 46, 34, 51, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 30, 31, 0, 0, 0,
+ 0, 0, 0, 0, 0, 33, 0, 0, 0, 0,
+ 0, 0, 35, 0, 0, 0, 36, 37, 0, 38,
+ 0, 0, 0, 0, 0, 0, 42, 0, 0, 0,
+ 45, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 53, 49,
+ 52, 50, 0, 54, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 44, 56, 32, 0, 0, 0,
+ 41, 0, 0, 0, 0, 0, 0, 46, 34, 51,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 515,
+ 0, 30, 31, 0, 0, 0, 0, 0, 0, 0,
+ 0, 219, 0, 0, 0, 0, 0, 0, 35, 0,
+ 0, 0, 36, 37, 0, 38, 0, 0, 0, 0,
+ 0, 0, 516, 0, 0, 0, 45, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 53, 517, 519, 518, 0, 54,
+ 0, 0, 0, 0, 227, 0, 0, 0, 0, 0,
+ 44, 56, 32, 214, 0, 0, 41, 0, 0, 0,
0, 0, 0, 46, 34, 51, 0, 0, 0, 0,
0, 0, 0, 0, 0, 515, 0, 30, 31, 0,
0, 0, 0, 0, 0, 0, 0, 219, 0, 0,
@@ -478,84 +484,85 @@ const short QQmlJSGrammar::action_info [] = {
563, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53, 517, 519, 518, 0, 54, 0, 0, 0, 0,
227, 0, 0, 0, 0, 0, 44, 56, 32, 214,
- 0, 0, 41, 0, 0, 0, 0, 0, 46, 34,
- 51, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 29, 30, 31, 0, 0, 0, 0, 0, 0, 0,
- 0, 33, 0, 0, 0, 0, 0, 0, 35, 0,
- 0, 0, 36, 37, 0, 38, 0, 0, 0, 39,
- 0, 40, 42, 43, 0, 0, 45, 0, 0, 0,
- 47, 0, 48, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 53, 49, 52, 50, 0, 54,
- 0, 55, 0, 57, 0, 58, 0, 0, 0, 0,
- 44, 56, 32, 0, 0, 0, 41, 0, 0, 0,
- 0, 0, 46, 34, 51, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, -125, 0, 0, 0, 29, 30,
- 31, 0, 0, 0, 0, 0, 0, 0, 0, 33,
- 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
- 36, 37, 0, 38, 0, 0, 0, 39, 0, 40,
- 42, 43, 0, 0, 45, 0, 0, 0, 47, 0,
- 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 53, 49, 52, 50, 0, 54, 0, 55,
- 0, 57, 0, 58, 0, 0, 0, 0, 44, 56,
- 32, 0, 0, 0, 41, 0, 0, 0, 0, 0,
- 46, 34, 51, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 29, 30, 31, 0, 0, 0, 0, 0,
- 0, 0, 0, 33, 0, 0, 0, 0, 0, 0,
+ 0, 0, 41, 0, 0, 0, 0, 0, 0, 46,
+ 34, 51, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 515, 0, 30, 31, 0, 0, 0, 0, 0,
+ 0, 0, 0, 219, 0, 0, 0, 0, 0, 0,
35, 0, 0, 0, 36, 37, 0, 38, 0, 0,
- 0, 39, 0, 40, 42, 43, 0, 0, 45, 0,
- 0, 0, 47, 0, 48, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 53, 49, 52, 50,
- 0, 54, 0, 55, 0, 57, 282, 58, 0, 0,
- 0, 0, 44, 56, 32, 0, 0, 0, 41, 0,
+ 0, 0, 0, 0, 516, 0, 0, 0, 45, 0,
+ 0, 0, 0, 0, 0, 0, 560, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 53, 517, 519, 518,
+ 0, 54, 0, 0, 0, 0, 227, 0, 0, 0,
+ 0, 0, 44, 56, 32, 214, 0, 0, 41, 0,
+ 0, 0, 0, 0, 0, 46, 34, 51, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 29, 30, 31,
+ 0, 0, 0, 0, 0, 0, 0, 0, 33, 0,
+ 0, 0, 0, 0, 0, 35, 0, 0, 0, 36,
+ 37, 0, 38, 0, 0, 0, 39, 0, 40, 42,
+ 43, 0, 0, 45, 0, 0, 0, 47, 0, 48,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 53, 49, 52, 50, 0, 54, 0, 55, 0,
+ 57, 0, 58, 0, 0, 0, 0, 44, 56, 32,
+ 0, 0, 0, 41, 0, 0, 0, 0, 0, 0,
+ 46, 34, 51, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -131, 0, 0, 0, 29, 30, 31, 0,
+ 0, 0, 0, 0, 0, 0, 0, 33, 0, 0,
+ 0, 0, 0, 0, 35, 0, 0, 0, 36, 37,
+ 0, 38, 0, 0, 0, 39, 0, 40, 42, 43,
+ 0, 0, 45, 0, 0, 0, 47, 0, 48, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 53, 49, 52, 50, 0, 54, 0, 55, 0, 57,
+ 0, 58, 0, 0, 0, 0, 44, 56, 32, 0,
+ 0, 0, 41, 0, 0, 0, 0, 0, 0, 46,
+ 34, 51, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 29, 30, 31, 0, 0, 0, 0, 0, 0,
+ 0, 0, 33, 0, 0, 0, 0, 0, 0, 35,
+ 0, 0, 0, 36, 37, 0, 38, 0, 0, 0,
+ 39, 0, 40, 42, 43, 0, 0, 45, 0, 0,
+ 0, 47, 0, 48, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 53, 49, 52, 50, 0,
+ 54, 0, 55, 0, 57, 282, 58, 0, 0, 0,
+ 0, 44, 56, 32, 0, 0, 0, 41, 0, 0,
0, 0, 0, 0, 46, 34, 51, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 496, 0, 0, 29,
+ 0, 0, 0, 0, 0, 0, 488, 0, 0, 29,
30, 31, 0, 0, 0, 0, 0, 0, 0, 0,
33, 0, 0, 0, 0, 0, 0, 35, 0, 0,
0, 36, 37, 0, 38, 0, 0, 0, 39, 0,
40, 42, 43, 0, 0, 45, 0, 0, 0, 47,
- 0, 48, 0, 0, 499, 0, 0, 0, 0, 0,
+ 0, 48, 0, 0, 489, 0, 0, 0, 0, 0,
0, 0, 0, 53, 49, 52, 50, 0, 54, 0,
55, 0, 57, 0, 58, 0, 0, 0, 0, 44,
56, 32, 0, 0, 0, 41, 0, 0, 0, 0,
- 0, 46, 34, 51, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 496, 0, 0, 29, 30, 31, 0,
- 0, 0, 0, 0, 0, 0, 0, 33, 0, 0,
- 0, 0, 0, 0, 35, 0, 0, 0, 36, 37,
- 0, 38, 0, 0, 0, 39, 0, 40, 42, 43,
- 0, 0, 45, 0, 0, 0, 47, 0, 48, 0,
- 0, 497, 0, 0, 0, 0, 0, 0, 0, 0,
- 53, 49, 52, 50, 0, 54, 0, 55, 0, 57,
- 0, 58, 0, 0, 0, 0, 44, 56, 32, 0,
- 0, 0, 41, 0, 0, 0, 0, 0, 46, 34,
+ 0, 0, 46, 34, 51, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 488, 0, 0, 29, 30, 31,
+ 0, 0, 0, 0, 0, 0, 0, 0, 33, 0,
+ 0, 0, 0, 0, 0, 35, 0, 0, 0, 36,
+ 37, 0, 38, 0, 0, 0, 39, 0, 40, 42,
+ 43, 0, 0, 45, 0, 0, 0, 47, 0, 48,
+ 0, 0, 494, 0, 0, 0, 0, 0, 0, 0,
+ 0, 53, 49, 52, 50, 0, 54, 0, 55, 0,
+ 57, 0, 58, 0, 0, 0, 0, 44, 56, 32,
+ 0, 0, 0, 41, 0, 0, 0, 0, 0, 0,
+ 46, 34, 51, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 496, 0, 0, 29, 30, 31, 0, 0,
+ 0, 0, 0, 0, 0, 0, 33, 0, 0, 0,
+ 0, 0, 0, 35, 0, 0, 0, 36, 37, 0,
+ 38, 0, 0, 0, 39, 0, 40, 42, 43, 0,
+ 0, 45, 0, 0, 0, 47, 0, 48, 0, 0,
+ 497, 0, 0, 0, 0, 0, 0, 0, 0, 53,
+ 49, 52, 50, 0, 54, 0, 55, 0, 57, 0,
+ 58, 0, 0, 0, 0, 44, 56, 32, 0, 0,
+ 0, 41, 0, 0, 0, 0, 0, 0, 46, 34,
51, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 488, 0, 0, 29, 30, 31, 0, 0, 0, 0,
+ 496, 0, 0, 29, 30, 31, 0, 0, 0, 0,
0, 0, 0, 0, 33, 0, 0, 0, 0, 0,
0, 35, 0, 0, 0, 36, 37, 0, 38, 0,
0, 0, 39, 0, 40, 42, 43, 0, 0, 45,
- 0, 0, 0, 47, 0, 48, 0, 0, 489, 0,
+ 0, 0, 0, 47, 0, 48, 0, 0, 499, 0,
0, 0, 0, 0, 0, 0, 0, 53, 49, 52,
50, 0, 54, 0, 55, 0, 57, 0, 58, 0,
0, 0, 0, 44, 56, 32, 0, 0, 0, 41,
- 0, 0, 0, 0, 0, 46, 34, 51, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 488, 0, 0,
- 29, 30, 31, 0, 0, 0, 0, 0, 0, 0,
- 0, 33, 0, 0, 0, 0, 0, 0, 35, 0,
- 0, 0, 36, 37, 0, 38, 0, 0, 0, 39,
- 0, 40, 42, 43, 0, 0, 45, 0, 0, 0,
- 47, 0, 48, 0, 0, 494, 0, 0, 0, 0,
- 0, 0, 0, 0, 53, 49, 52, 50, 0, 54,
- 0, 55, 0, 57, 0, 58, 0, 0, 0, 0,
- 44, 56, 32, 0, 0, 0, 41, 0, 0, 0,
- 0, 0, 46, 34, 51, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 29, 30, 31, 0, 0, 0,
- 0, 0, 0, 0, 0, 33, 0, 0, 0, 0,
- 0, 0, 35, 220, 0, 0, 221, 37, 0, 38,
- 0, 0, 0, 39, 0, 40, 42, 43, 0, 0,
- 45, 0, 0, 0, 47, 0, 48, 0, 0, 0,
- 0, 0, 0, 0, 223, 0, 0, 0, 53, 49,
- 52, 50, 224, 54, 0, 55, 226, 57, 0, 58,
- 0, 229, 0, 0, 44, 56, 32, 0, 0, 0,
- 41, 0, 0, 0, 0, 0, 46, 34, 51, 0,
+ 0, 0, 0, 0, 0, 0, 46, 34, 51, 0,
0, 0, 0, 0, 0, 0, 0, 0, 29, 30,
31, 0, 0, 0, 0, 0, 0, 0, 0, 33,
0, 0, 0, 0, 0, 0, 35, 220, 0, 0,
@@ -565,139 +572,150 @@ const short QQmlJSGrammar::action_info [] = {
0, 0, 53, 49, 52, 50, 224, 54, 0, 55,
226, 57, 0, 58, 0, 229, 0, 0, 44, 56,
32, 0, 0, 0, 41, 0, 0, 0, 0, 0,
+ 0, 46, 34, 51, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 29, 30, 31, 0, 0, 0, 0,
+ 0, 0, 0, 0, 33, 0, 0, 0, 0, 0,
+ 0, 35, 220, 0, 0, 221, 37, 0, 38, 0,
+ 0, 0, 39, 0, 40, 42, 43, 0, 0, 45,
+ 0, 0, 0, 47, 0, 48, 0, 0, 0, 0,
+ 0, 0, 0, 223, 0, 0, 0, 53, 49, 52,
+ 50, 224, 54, 0, 55, 226, 57, 0, 58, 0,
+ 229, 0, 0, 44, 56, 32, 0, 0, 0, 41,
+ 0, 0, 0, 0, 0, 0, 46, 34, 51, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 111, 112,
+ 113, 0, 0, 115, 117, 118, 0, 0, 119, 0,
+ 120, 0, 0, 0, 122, 123, 124, 0, 0, 0,
+ 0, 0, 0, 35, 125, 126, 127, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 128, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 131, 0, 0, 0, 0, 0, 0,
+ 49, 52, 50, 132, 133, 134, 0, 136, 137, 138,
+ 139, 140, 141, 0, 0, 129, 135, 121, 114, 116,
+ 130, 0, 0, 0, 0, 0, 0, 0, 46, 34,
+ 51, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 111, 112, 113, 0, 0, 115, 117, 118, 0, 0,
+ 119, 0, 120, 0, 0, 0, 122, 123, 124, 0,
+ 0, 0, 0, 0, 0, 35, 125, 126, 127, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
+ 0, 0, 0, 395, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 131, 0, 0, 0, 0,
+ 0, 397, 49, 52, 50, 132, 133, 134, 0, 136,
+ 137, 138, 139, 140, 141, 0, 0, 129, 135, 121,
+ 114, 116, 130, 0, 0, 0, 0, 0, 0, 0,
46, 34, 51, 0, 0, 0, 0, 0, 0, 0,
0, 0, 111, 112, 113, 0, 0, 115, 117, 118,
0, 0, 119, 0, 120, 0, 0, 0, 122, 123,
124, 0, 0, 0, 0, 0, 0, 35, 125, 126,
127, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 128, 0, 0, 0, 395, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 131, 0, 0,
- 0, 0, 0, 0, 49, 52, 50, 132, 133, 134,
+ 0, 0, 0, 397, 49, 52, 50, 132, 133, 134,
0, 136, 137, 138, 139, 140, 141, 0, 0, 129,
135, 121, 114, 116, 130, 0, 0, 0, 0, 0,
- 0, 46, 34, 51, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 111, 112, 113, 0, 0, 115, 117,
- 118, 0, 0, 119, 0, 120, 0, 0, 0, 122,
- 123, 124, 0, 0, 0, 0, 0, 0, 35, 125,
- 126, 127, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 128, 0, 0, 0, 395, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 131, 0,
- 0, 0, 0, 0, 397, 49, 52, 50, 132, 133,
- 134, 0, 136, 137, 138, 139, 140, 141, 0, 0,
- 129, 135, 121, 114, 116, 130, 0, 0, 0, 0,
- 0, 0, 46, 34, 51, 0, 0, 0, 0, 0,
+ 0, 0, 46, 374, 380, 0, 0, 0, 0, 0,
0, 0, 0, 0, 111, 112, 113, 0, 0, 115,
117, 118, 0, 0, 119, 0, 120, 0, 0, 0,
122, 123, 124, 0, 0, 0, 0, 0, 0, 35,
125, 126, 127, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 128, 0, 0, 0, 395, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 131,
+ 0, 0, 0, 0, 0, 396, 0, 0, 0, 131,
0, 0, 0, 0, 0, 397, 49, 52, 50, 132,
133, 134, 0, 136, 137, 138, 139, 140, 141, 0,
0, 129, 135, 121, 114, 116, 130, 0, 0, 0,
- 0, 0, 0, 46, 374, 380, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 111, 112, 113, 0, 0,
- 115, 117, 118, 0, 0, 119, 0, 120, 0, 0,
- 0, 122, 123, 124, 0, 0, 0, 0, 0, 0,
- 35, 125, 126, 127, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 128, 0, 0, 0, 395, 0,
- 0, 0, 0, 0, 0, 0, 396, 0, 0, 0,
- 131, 0, 0, 0, 0, 0, 397, 49, 52, 50,
- 132, 133, 134, 0, 136, 137, 138, 139, 140, 141,
- 0, 0, 129, 135, 121, 114, 116, 130, 0, 0,
0, 0, 0, 0, 46, 374, 380, 0, 0, 0,
0, 0, 0, 0, 0, 0, 213, 0, 0, 0,
0, 215, 0, 29, 30, 31, 217, 0, 0, 0,
- 0, 0, 0, 218, 33, 0, 0, 0, 0, 0,
+ 0, 0, 0, 218, 219, 0, 0, 0, 0, 0,
0, 35, 220, 0, 0, 221, 37, 0, 38, 0,
0, 0, 39, 0, 40, 42, 43, 0, 0, 45,
0, 0, 0, 47, 0, 48, 0, 0, 0, 0,
0, 222, 0, 223, 0, 0, 0, 53, 49, 52,
50, 224, 54, 225, 55, 226, 57, 227, 58, 228,
229, 0, 0, 44, 56, 32, 214, 216, 0, 41,
- 0, 0, 0, 0, 0, 46, 34, 51, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 213, 0, 0,
- 0, 0, 215, 0, 29, 30, 31, 217, 0, 0,
- 0, 0, 0, 0, 218, 219, 0, 0, 0, 0,
- 0, 0, 35, 220, 0, 0, 221, 37, 0, 38,
- 0, 0, 0, 39, 0, 40, 42, 43, 0, 0,
- 45, 0, 0, 0, 47, 0, 48, 0, 0, 0,
- 0, 0, 222, 0, 223, 0, 0, 0, 53, 49,
- 52, 50, 224, 54, 225, 55, 226, 57, 227, 58,
- 228, 229, 0, 0, 44, 56, 32, 214, 216, 0,
- 41, 0, 0, 0, 0, 0, 46, 34, 51, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 600, 112,
- 113, 0, 0, 602, 117, 604, 30, 31, 605, 0,
- 120, 0, 0, 0, 122, 607, 608, 0, 0, 0,
- 0, 0, 0, 35, 609, 126, 127, 221, 37, 0,
- 38, 0, 0, 0, 39, 0, 40, 610, 43, 0,
- 0, 612, 0, 0, 0, 47, 0, 48, 0, 0,
- 0, 0, 0, 613, 0, 223, 0, 0, 0, 614,
- 49, 52, 50, 615, 616, 617, 55, 619, 620, 621,
- 622, 623, 624, 0, 0, 611, 618, 606, 601, 603,
- 130, 41, 0, 0, 0, 0, 0, 46, 374, 380,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 365,
- 112, 113, 0, 0, 367, 117, 369, 30, 31, 370,
- 0, 120, 0, 0, 0, 122, 372, 373, 0, 0,
- 0, 0, 0, 0, 35, 375, 126, 127, 221, 37,
- 0, 38, 0, 0, 0, 39, 0, 40, 376, 43,
- 0, 0, 378, 0, 0, 0, 47, 0, 48, 0,
- -271, 0, 0, 0, 379, 0, 223, 0, 0, 0,
- 381, 49, 52, 50, 382, 383, 384, 55, 386, 387,
- 388, 389, 390, 391, 0, 0, 377, 385, 371, 366,
- 368, 130, 41, 0, 0, 0, 0, 0, 46, 374,
- 380, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 46, 34, 51, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 213, 0,
+ 0, 0, 0, 215, 0, 29, 30, 31, 217, 0,
+ 0, 0, 0, 0, 0, 218, 33, 0, 0, 0,
+ 0, 0, 0, 35, 220, 0, 0, 221, 37, 0,
+ 38, 0, 0, 0, 39, 0, 40, 42, 43, 0,
+ 0, 45, 0, 0, 0, 47, 0, 48, 0, 0,
+ 0, 0, 0, 222, 0, 223, 0, 0, 0, 53,
+ 49, 52, 50, 224, 54, 225, 55, 226, 57, 227,
+ 58, 228, 229, 0, 0, 44, 56, 32, 214, 216,
+ 0, 41, 0, 0, 0, 0, 0, 0, 46, 34,
+ 51, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 600, 112, 113, 0, 0, 602, 117, 604, 30, 31,
+ 605, 0, 120, 0, 0, 0, 122, 607, 608, 0,
+ 0, 0, 0, 0, 0, 35, 609, 126, 127, 221,
+ 37, 0, 38, 0, 0, 0, 39, 0, 40, 610,
+ 43, 0, 0, 612, 0, 0, 0, 47, 0, 48,
+ 0, 0, 0, 0, 0, 613, 0, 223, 0, 0,
+ 0, 614, 49, 52, 50, 615, 616, 617, 55, 619,
+ 620, 621, 622, 623, 624, 0, 0, 611, 618, 606,
+ 601, 603, 130, 41, 0, 0, 0, 0, 0, 0,
+ 46, 374, 380, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 365, 112, 113, 0, 0, 367, 117, 369,
+ 30, 31, 370, 0, 120, 0, 0, 0, 122, 372,
+ 373, 0, 0, 0, 0, 0, 0, 35, 375, 126,
+ 127, 221, 37, 0, 38, 0, 0, 0, 39, 0,
+ 40, 376, 43, 0, 0, 378, 0, 0, 0, 47,
+ 0, 48, 0, -277, 0, 0, 0, 379, 0, 223,
+ 0, 0, 0, 381, 49, 52, 50, 382, 383, 384,
+ 55, 386, 387, 388, 389, 390, 391, 0, 0, 377,
+ 385, 371, 366, 368, 130, 41, 0, 0, 0, 0,
+ 0, 0, 46, 374, 380, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,
- 565, 148, 545, 16, 649, 547, 541, 469, 320, 529,
- 528, 630, 183, 248, 263, 500, 485, 447, 629, 183,
- 627, 444, 253, 393, 587, 652, 313, 152, 643, 572,
- 591, 575, 586, 638, 331, 574, 453, 455, 466, 253,
- 437, 178, 433, 253, 0, 248, 584, 458, 248, 313,
- 441, 183, 444, 457, 237, 190, 447, 188, 206, 425,
- 400, 462, 351, 313, 347, 150, 165, 447, 475, 444,
- 183, 145, 393, 260, 0, 409, 173, 409, 260, 362,
- 171, 514, 409, 495, 362, 393, 206, 498, 628, 313,
- 313, 206, 356, 142, 206, 331, 362, 599, 403, 0,
- 345, 62, 62, 62, 182, 62, 299, 182, 295, 206,
- 410, 417, 410, 206, 62, 393, 62, 410, 62, 296,
- 148, 298, 148, 297, 62, 62, 182, 504, 412, 62,
- 180, 502, 511, 206, 512, 62, 108, 460, 188, 62,
- 394, 188, 62, 206, 460, 247, 62, 206, 459, 206,
- 62, 102, 459, 62, 62, 514, 206, 62, 653, 503,
- 407, 343, 341, 62, 313, 110, 419, 167, 188, 187,
- 170, 340, 514, 104, 0, 553, 422, 206, 62, 206,
- 62, 63, 62, 72, 62, 510, 71, 97, 62, 514,
- 70, 62, 557, 69, 355, 62, 239, 62, 493, 318,
- 86, 469, 492, 62, 483, 74, 242, 206, 93, 62,
- 353, 62, 206, 260, 95, 0, 96, 62, 62, 62,
- 322, 62, 94, 206, 100, 98, 206, 99, 62, 247,
- 277, 464, 0, 206, 79, 281, 314, 468, 62, 62,
- 206, 507, 91, 246, 206, 62, 62, 349, 505, 90,
- 206, 62, 62, 460, 459, 62, 206, 506, 62, 401,
- 206, 62, 92, 309, 62, 108, 281, 362, 281, 281,
- 0, 313, 206, 62, 304, 479, 0, 309, 281, 62,
- 206, 327, 281, 0, 281, 337, 300, 309, 324, 0,
- 0, 62, 281, 0, 110, 177, 281, 62, 301, 308,
- 309, 0, 281, 309, 302, 281, 62, 62, 281, 330,
- 62, 281, 281, 289, 514, 281, 0, 0, 306, 284,
- 0, 522, 328, 569, 561, 311, 553, 564, 625, 0,
- 0, 0, 514, 513, 523, 514, 0, 0, 0, 522,
- 0, 0, 522, 316, 0, 0, 0, 0, 0, 485,
- 440, 513, 523, 0, 513, 523, 533, 534, 535, 536,
- 540, 537, 538, 577, 533, 534, 535, 536, 540, 537,
- 538, 594, 0, 0, 0, 0, 362, 0, 597, 598,
- 533, 534, 535, 536, 540, 537, 538, 0, 0, 206,
+ 148, 142, 183, 447, 469, 347, 575, 444, 547, 627,
+ 248, 320, 587, 572, 584, 586, 485, 591, 565, 529,
+ 313, 545, 447, 393, 253, 528, 500, 183, 574, 453,
+ 331, 652, 447, 437, 444, 313, 462, 455, 263, 457,
+ 237, 441, 206, 188, 190, 150, 16, 178, 433, 630,
+ 425, 641, 165, 400, 658, 458, 642, 171, 173, 248,
+ 475, 351, 498, 248, 253, 313, 183, 466, 183, 541,
+ 495, 629, 253, 512, 511, 188, 145, 206, 260, 645,
+ 644, 62, 0, 62, 362, 507, 298, 469, 206, 206,
+ 247, 514, 514, 62, 206, 460, 646, 409, 152, 409,
+ 599, 628, 355, 239, 206, 62, 62, 62, 362, 260,
+ 296, 297, 299, 331, 62, 62, 313, 504, 206, 295,
+ 62, 62, 459, 460, 356, 206, 277, 62, 62, 502,
+ 182, 281, 206, 62, 410, 182, 410, 401, 62, 353,
+ 459, 62, 62, 506, 505, 62, 62, 503, 493, 349,
+ 91, 62, 492, 206, 63, 206, 313, 62, 345, 483,
+ 393, 479, 62, 62, 260, 206, 444, 206, 510, 102,
+ 148, 62, 104, 182, 206, 188, 188, 468, 180, 170,
+ 206, 62, 148, 247, 62, 394, 460, 393, 409, 340,
+ 412, 341, 362, 206, 422, 167, 393, 206, 62, 108,
+ 459, 313, 62, 187, 419, 62, 62, 86, 206, 62,
+ 318, 98, 100, 403, 62, 99, 69, 322, 514, 514,
+ 313, 62, 417, 553, 557, 410, 206, 79, 110, 246,
+ 62, 343, 206, 206, 62, 0, 70, 62, 74, 71,
+ 62, 62, 206, 108, 90, 206, 93, 62, 62, 62,
+ 72, 62, 92, 62, 94, 62, 95, 309, 96, 407,
+ 97, 309, 281, 62, 362, 362, 281, 0, 281, 242,
+ 302, 0, 110, 177, 464, 0, 316, 309, 0, 308,
+ 206, 206, 281, 311, 309, 0, 62, 62, 309, 281,
+ 206, 281, 281, 281, 0, 314, 0, 0, 62, 330,
+ 62, 324, 0, 281, 327, 281, 337, 300, 62, 62,
+ 328, 304, 62, 281, 281, 301, 564, 281, 62, 289,
+ 306, 569, 561, 281, 0, 514, 553, 284, 625, 0,
+ 0, 514, 0, 0, 522, 0, 0, 0, 0, 0,
+ 522, 0, 0, 0, 0, 0, 513, 523, 0, 485,
+ 443, 440, 513, 523, 533, 534, 535, 536, 540, 537,
+ 538, 577, 533, 534, 535, 536, 540, 537, 538, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 514, 569, 0, 0, 0, 0, 0,
+ 0, 0, 522, 570, 571, 533, 534, 535, 536, 540,
+ 537, 538, 0, 0, 513, 523, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 443,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 569, 0, 0, 0, 0, 0, 0, 570,
- 571, 533, 534, 535, 536, 540, 537, 538, 0, 0,
+ 594, 0, 0, 0, 0, 0, 0, 0, 0, 597,
+ 598, 533, 534, 535, 536, 540, 537, 538, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -708,126 +726,128 @@ const short QQmlJSGrammar::action_info [] = {
0, 0, 0, 0, 0, 0, 0};
const short QQmlJSGrammar::action_check [] = {
- 60, 7, 7, 7, 34, 91, 24, 7, 61, 36,
- 33, 36, 7, 7, 7, 60, 33, 33, 55, 66,
- 8, 33, 55, 36, 16, 7, 36, 29, 8, 7,
- 7, 55, 17, 36, 7, 7, 7, 7, 7, 36,
- 55, 7, 7, 33, 33, 36, 33, 33, 7, 60,
- 7, 60, 20, 36, 33, 36, 55, 7, 33, 60,
- 5, 37, 36, 5, 60, 5, 7, 2, 66, 36,
- 33, 33, 36, 7, 1, 8, 60, 8, 33, 2,
- 36, 1, 8, 36, 2, 1, 8, 2, 17, 1,
- 0, 8, -1, 7, 55, 33, 33, -1, -1, 48,
- 60, -1, 6, 31, 55, 48, 36, 61, 60, 8,
- -1, 36, 60, -1, 7, 61, 20, 36, 8, 77,
- 15, 60, 8, 55, 48, 36, 10, 36, 36, 36,
- 7, 8, 79, 8, 8, 79, 8, 42, 8, 34,
- 8, 8, 48, 40, 8, 8, -1, 60, 53, 50,
- -1, 8, -1, 54, 51, 91, 15, 8, 79, 61,
- 62, 60, 8, 61, 62, 61, 62, 61, 62, 40,
- 60, 55, 61, 62, 60, 34, 61, 62, 61, 62,
- 51, 56, 61, 62, 56, 50, 60, 40, 15, 54,
- 60, 40, 60, 56, 61, 25, 60, 27, 51, 61,
- 62, 29, 51, 60, 29, 56, 15, 34, 38, 36,
- 15, 29, 8, 8, 12, 61, 62, 61, 62, 12,
- 36, 25, 7, 27, 25, 34, 27, 36, 25, 34,
- 27, 36, 7, 15, 38, 29, 25, 38, 27, 7,
- -1, 38, 25, 29, 27, 61, 62, 75, 92, 38,
- 75, 12, 34, 7, 36, 38, -1, 75, 86, 57,
- 56, 86, -1, -1, 57, 63, 61, 62, 86, 25,
- 63, 27, 25, -1, 27, -1, 61, 62, 25, 33,
- 27, 75, 38, 61, 62, 38, 61, 62, 25, 75,
- 27, 38, 86, 61, 62, 25, 57, 27, 29, -1,
- 86, 38, 63, 25, 25, 27, 27, 15, 38, 8,
- -1, 89, -1, 18, 19, 47, 38, 38, 18, 19,
- 18, 19, -1, -1, -1, 33, 34, -1, 36, 61,
- 62, 15, 97, 98, 99, 100, 101, 102, -1, 93,
- 45, 46, 23, 24, 75, 45, 46, 45, 46, 33,
- 34, 32, 36, -1, 35, 86, 37, 23, 24, -1,
- 92, -1, 61, 62, 23, 24, 32, -1, -1, 35,
- -1, 37, -1, 32, 23, 24, 35, -1, 37, -1,
- 23, 24, -1, 32, -1, -1, 35, -1, 37, 32,
- 23, 24, 35, 29, 37, -1, -1, -1, 31, 32,
- 23, 24, 35, 29, 37, -1, 18, 19, 31, 32,
- 23, 24, 35, 29, 37, -1, -1, -1, 31, 32,
- -1, -1, 35, 29, 37, -1, 29, -1, -1, -1,
- 66, 67, 68, 45, 46, -1, -1, -1, -1, -1,
- 66, 67, 68, -1, 29, -1, -1, 29, -1, -1,
- 66, 67, 68, -1, -1, -1, -1, 93, 94, 95,
- 66, 67, 68, 66, 67, 68, -1, 93, 94, 95,
- -1, -1, -1, -1, -1, -1, -1, 93, 94, 95,
- 29, 66, 67, 68, 66, 67, 68, 93, 94, 95,
- 93, 94, 95, 23, 24, 29, -1, -1, 29, -1,
- -1, 31, 32, -1, -1, 35, -1, 37, 93, 94,
- 95, 93, 94, 95, 29, -1, -1, 66, 67, 68,
- -1, 36, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 29, 66, 67, 68, 66, 67, 68, 36, -1,
- -1, -1, -1, -1, 93, 94, 95, -1, -1, -1,
- -1, 66, 67, 68, 29, -1, -1, -1, -1, 93,
- 94, 95, 93, 94, 95, 29, -1, -1, 66, 67,
- 68, -1, 36, -1, -1, 29, -1, -1, 93, 94,
- 95, -1, -1, -1, 29, -1, 61, 62, -1, -1,
- -1, 66, 67, 68, -1, 93, 94, 95, -1, -1,
- -1, -1, 66, 67, 68, 29, -1, -1, -1, -1,
- -1, -1, 66, 67, 68, -1, 61, 62, 93, 94,
- 95, 66, 67, 68, -1, -1, -1, -1, -1, 93,
- 94, 95, -1, -1, -1, -1, -1, 61, 62, 93,
- 94, 95, 66, 67, 68, -1, -1, -1, 93, 94,
- 95, 29, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 93,
- 94, 95, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 61, 62, 3, -1, -1, 66, 67,
- 68, -1, -1, -1, -1, 13, -1, -1, -1, 17,
- -1, -1, -1, -1, -1, -1, -1, -1, 26, -1,
- 28, -1, -1, 31, -1, 93, 94, 95, -1, -1,
- -1, 39, -1, 41, 42, -1, -1, 3, -1, -1,
- -1, 49, -1, -1, 52, 53, -1, 13, -1, -1,
- 58, 17, -1, -1, -1, -1, 64, -1, -1, -1,
- 26, -1, 28, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 80, 39, -1, 41, 42, -1, -1, -1,
- -1, -1, -1, 49, -1, -1, 52, 53, -1, -1,
- -1, -1, 58, -1, -1, -1, -1, -1, 64, -1,
+ 2, 55, 34, 7, 60, 36, 31, 37, 61, 17,
+ 24, 16, 2, 20, 33, 60, 5, 8, 36, 79,
+ 60, 36, 33, 33, 7, 48, 55, 1, 55, 0,
+ 33, 7, 60, 33, 60, 36, 60, 36, 8, 7,
+ 36, 8, 7, 55, 7, 5, 55, 33, 7, 7,
+ 48, 7, 36, 7, 36, 5, 7, 36, 1, 36,
+ 7, 36, 7, 7, 61, 7, 60, 33, 8, 1,
+ 7, 77, 36, 7, 36, 60, 7, 29, 8, 36,
+ 7, 36, 55, 36, 79, 33, 79, 36, 66, 8,
+ 36, 60, 33, 17, 33, 7, 2, 8, 36, 79,
+ 36, 2, 7, 7, 7, 66, 8, 33, 33, 7,
+ -1, 33, 8, 48, 8, 15, 15, 33, 36, 36,
+ 33, 8, 55, 7, 8, 8, 15, 6, 48, 10,
+ 8, 60, 8, 61, 34, 34, 8, 60, 8, 60,
+ 55, 20, 8, -1, 8, 34, 8, 61, 62, 8,
+ 40, 61, 62, 61, 62, 50, 42, 8, 60, 54,
+ 56, 51, 7, -1, 61, 62, 60, 53, 61, 62,
+ 61, 62, 8, 60, 55, 40, 29, 60, 56, -1,
+ 56, 29, 91, 92, 61, 62, 51, 61, 62, 61,
+ 60, 40, 56, 15, 60, 50, -1, 56, 60, 54,
+ 61, 62, 51, 1, 61, 62, 91, 92, 40, 60,
+ 29, 25, 34, 27, 36, -1, 61, 62, 12, 51,
+ 61, 62, 75, 12, 38, 61, 62, 75, 25, 25,
+ 27, 27, 25, 86, 27, 12, 7, 25, 86, 27,
+ 15, 38, 38, 29, 25, 38, 27, 25, 89, 27,
+ 38, 25, 25, 27, 27, 7, 75, 38, 15, 34,
+ 38, 36, 8, 57, 38, 38, 29, 86, 57, 63,
+ 61, 62, 36, 29, 63, 8, -1, 34, -1, 36,
+ 57, 25, 25, 27, 27, -1, 63, -1, -1, 75,
+ 61, 62, 15, -1, 38, 38, -1, 61, 62, -1,
+ 86, 25, 93, 27, 25, -1, 27, -1, 7, 61,
+ 62, 34, 75, 36, 38, 61, 62, 38, 47, 75,
+ 18, 19, -1, 86, 18, 19, 18, 19, 61, 62,
+ 86, -1, 61, 62, 33, 18, 19, 98, 99, 100,
+ 101, 102, 103, -1, -1, -1, -1, 45, 46, -1,
+ -1, 45, 46, 45, 46, -1, 23, 24, -1, -1,
+ 23, 24, 45, 46, 93, 32, 23, 24, 35, 32,
+ 37, -1, 35, -1, 37, 32, 23, 24, 35, -1,
+ 37, 29, 23, 24, 29, 32, -1, -1, 35, -1,
+ 37, 32, 23, 24, 35, 94, 37, 29, -1, -1,
+ 31, 32, 23, 24, 35, 29, 37, 15, -1, -1,
+ 31, 32, -1, -1, 35, 29, 37, -1, 66, 67,
+ 68, 66, 67, 68, -1, 33, 34, -1, 36, 29,
+ -1, -1, -1, -1, 66, 67, 68, 29, -1, -1,
+ -1, -1, 66, 67, 68, -1, 94, 95, 96, 94,
+ 95, 96, 66, 67, 68, -1, -1, -1, -1, -1,
+ -1, -1, 94, 95, 96, -1, 66, 67, 68, -1,
+ 94, 95, 96, -1, 66, 67, 68, 29, -1, -1,
+ 94, 95, 96, 29, -1, -1, 29, -1, -1, 29,
+ -1, -1, 29, -1, 94, 95, 96, 29, 23, 24,
+ 29, -1, 94, 95, 96, -1, 31, 32, -1, -1,
+ 35, -1, 37, -1, 66, 67, 68, -1, -1, -1,
+ 66, 67, 68, 66, 67, 68, 66, 67, 68, 66,
+ 67, 68, -1, 29, 66, 67, 68, 66, 67, 68,
+ 36, -1, 94, 95, 96, -1, -1, -1, 94, 95,
+ 96, 94, 95, 96, 94, 95, 96, 94, 95, 96,
+ -1, -1, 94, 95, 96, 94, 95, 96, 29, -1,
+ 66, 67, 68, 29, -1, 36, 29, -1, -1, -1,
+ 36, 29, -1, -1, 29, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 94, 95,
+ 96, -1, -1, -1, -1, 66, 67, 68, 61, 62,
+ 66, 67, 68, 66, 67, 68, 61, 62, 66, 67,
+ 68, 66, 67, 68, -1, -1, -1, 29, -1, -1,
+ -1, -1, -1, 94, 95, 96, -1, -1, 94, 95,
+ 96, 94, 95, 96, -1, -1, 94, 95, 96, 94,
+ 95, 96, -1, -1, -1, -1, -1, -1, 29, 61,
+ 62, -1, -1, -1, 66, 67, 68, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 80, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 12,
- 13, -1, -1, -1, -1, -1, -1, -1, -1, 22,
- -1, -1, -1, -1, -1, -1, 29, -1, -1, -1,
- 33, 34, -1, 36, -1, -1, -1, -1, -1, -1,
- 43, -1, -1, -1, 47, -1, -1, -1, -1, -1,
+ 61, 62, 94, 95, 96, 66, 67, 68, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 65, 66, 67, 68, -1, 70, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 81, 82,
- 83, -1, -1, -1, 87, -1, -1, -1, -1, -1,
- 93, 94, 95, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 12, 13, -1, -1, -1, -1, -1, -1,
- -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
- -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
- -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 81, 82, 83, -1, -1, -1, 87, -1, -1,
- -1, -1, -1, 93, 94, 95, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 10, -1, 12, 13, -1,
- -1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
- -1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
- -1, 36, -1, -1, -1, -1, -1, -1, 43, -1,
- -1, -1, 47, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 94, 95, 96, -1, -1, -1, -1,
+ -1, -1, -1, 12, 13, 3, -1, -1, -1, -1,
+ -1, -1, -1, 22, -1, 13, -1, -1, -1, 17,
+ 29, -1, -1, -1, 33, 34, -1, 36, 26, -1,
+ 28, -1, -1, -1, 43, -1, -1, -1, 47, -1,
+ -1, 39, -1, 41, 42, -1, -1, -1, -1, -1,
+ -1, 49, -1, -1, 52, 53, 65, 66, 67, 68,
+ 58, 70, -1, -1, -1, -1, 64, -1, -1, -1,
+ -1, -1, 81, 82, 83, -1, -1, -1, 87, -1,
+ -1, -1, 80, -1, -1, 94, 95, 96, -1, -1,
+ -1, -1, -1, -1, -1, 12, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, 22, -1, -1, 3, -1,
+ -1, -1, 29, -1, -1, -1, 33, 34, 13, 36,
+ -1, -1, 17, -1, -1, -1, 43, -1, -1, -1,
+ 47, 26, -1, 28, -1, -1, 31, -1, -1, -1,
+ -1, -1, -1, -1, 39, -1, 41, 42, 65, 66,
+ 67, 68, -1, 70, 49, -1, -1, 52, 53, -1,
+ -1, -1, -1, 58, 81, 82, 83, -1, -1, 64,
+ 87, -1, -1, -1, -1, -1, -1, 94, 95, 96,
+ -1, -1, -1, -1, -1, 80, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 65, 66, 67, 68, -1, 70, -1, -1, -1, -1,
- 75, -1, -1, -1, -1, -1, 81, 82, 83, 84,
- -1, -1, 87, -1, -1, -1, -1, -1, 93, 94,
- 95, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 10, -1, 12, 13, -1, -1, -1, -1, -1, -1,
- -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
- -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
- -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, 55, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, -1, -1, -1, -1, 75, -1, -1, -1, -1,
- -1, 81, 82, 83, 84, -1, -1, 87, -1, -1,
- -1, -1, -1, 93, 94, 95, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 12, 13, -1, -1, -1, -1, -1, -1, -1,
+ -1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
+ -1, -1, 33, 34, -1, 36, -1, -1, -1, -1,
+ -1, -1, 43, -1, -1, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 65, 66, 67, 68, -1, 70,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 81, 82, 83, -1, -1, -1, 87, -1, -1, -1,
+ -1, -1, -1, 94, 95, 96, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 12, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, 22, -1, -1, -1, -1,
+ -1, -1, 29, -1, -1, -1, 33, 34, -1, 36,
+ -1, -1, -1, -1, -1, -1, 43, -1, -1, -1,
+ 47, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 65, 66,
+ 67, 68, -1, 70, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 81, 82, 83, -1, -1, -1,
+ 87, -1, -1, -1, -1, -1, -1, 94, 95, 96,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 10,
+ -1, 12, 13, -1, -1, -1, -1, -1, -1, -1,
+ -1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
+ -1, -1, 33, 34, -1, 36, -1, -1, -1, -1,
+ -1, -1, 43, -1, -1, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 65, 66, 67, 68, -1, 70,
+ -1, -1, -1, -1, 75, -1, -1, -1, -1, -1,
+ 81, 82, 83, 84, -1, -1, 87, -1, -1, -1,
+ -1, -1, -1, 94, 95, 96, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 10, -1, 12, 13, -1,
-1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
-1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
@@ -836,36 +856,46 @@ const short QQmlJSGrammar::action_check [] = {
55, -1, -1, -1, -1, -1, -1, -1, -1, -1,
65, 66, 67, 68, -1, 70, -1, -1, -1, -1,
75, -1, -1, -1, -1, -1, 81, 82, 83, 84,
- -1, -1, 87, -1, -1, -1, -1, -1, 93, 94,
- 95, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
- -1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
- -1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
- -1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
- 51, -1, 53, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 65, 66, 67, 68, -1, 70,
- -1, 72, -1, 74, -1, 76, -1, -1, -1, -1,
- 81, 82, 83, -1, -1, -1, 87, -1, -1, -1,
- -1, -1, 93, 94, 95, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 7, -1, -1, -1, 11, 12,
- 13, -1, -1, -1, -1, -1, -1, -1, -1, 22,
- -1, -1, -1, -1, -1, -1, 29, -1, -1, -1,
- 33, 34, -1, 36, -1, -1, -1, 40, -1, 42,
- 43, 44, -1, -1, 47, -1, -1, -1, 51, -1,
- 53, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 65, 66, 67, 68, -1, 70, -1, 72,
- -1, 74, -1, 76, -1, -1, -1, -1, 81, 82,
- 83, -1, -1, -1, 87, -1, -1, -1, -1, -1,
- 93, 94, 95, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 11, 12, 13, -1, -1, -1, -1, -1,
+ -1, -1, 87, -1, -1, -1, -1, -1, -1, 94,
+ 95, 96, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 10, -1, 12, 13, -1, -1, -1, -1, -1,
-1, -1, -1, 22, -1, -1, -1, -1, -1, -1,
29, -1, -1, -1, 33, 34, -1, 36, -1, -1,
- -1, 40, -1, 42, 43, 44, -1, -1, 47, -1,
- -1, -1, 51, -1, 53, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 43, -1, -1, -1, 47, -1,
+ -1, -1, -1, -1, -1, -1, 55, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 65, 66, 67, 68,
- -1, 70, -1, 72, -1, 74, 75, 76, -1, -1,
- -1, -1, 81, 82, 83, -1, -1, -1, 87, -1,
- -1, -1, -1, -1, 93, 94, 95, -1, -1, -1,
+ -1, 70, -1, -1, -1, -1, 75, -1, -1, -1,
+ -1, -1, 81, 82, 83, 84, -1, -1, 87, -1,
+ -1, -1, -1, -1, -1, 94, 95, 96, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 11, 12, 13,
+ -1, -1, -1, -1, -1, -1, -1, -1, 22, -1,
+ -1, -1, -1, -1, -1, 29, -1, -1, -1, 33,
+ 34, -1, 36, -1, -1, -1, 40, -1, 42, 43,
+ 44, -1, -1, 47, -1, -1, -1, 51, -1, 53,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 65, 66, 67, 68, -1, 70, -1, 72, -1,
+ 74, -1, 76, -1, -1, -1, -1, 81, 82, 83,
+ -1, -1, -1, 87, -1, -1, -1, -1, -1, -1,
+ 94, 95, 96, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 7, -1, -1, -1, 11, 12, 13, -1,
+ -1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
+ -1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
+ -1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
+ -1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 65, 66, 67, 68, -1, 70, -1, 72, -1, 74,
+ -1, 76, -1, -1, -1, -1, 81, 82, 83, -1,
+ -1, -1, 87, -1, -1, -1, -1, -1, -1, 94,
+ 95, 96, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
+ -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
+ 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
+ -1, 51, -1, 53, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
+ 70, -1, 72, -1, 74, 75, 76, -1, -1, -1,
+ -1, 81, 82, 83, -1, -1, -1, 87, -1, -1,
+ -1, -1, -1, -1, 94, 95, 96, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 8, -1, -1, 11,
12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
@@ -875,17 +905,27 @@ const short QQmlJSGrammar::action_check [] = {
-1, -1, -1, 65, 66, 67, 68, -1, 70, -1,
72, -1, 74, -1, 76, -1, -1, -1, -1, 81,
82, 83, -1, -1, -1, 87, -1, -1, -1, -1,
- -1, 93, 94, 95, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 8, -1, -1, 11, 12, 13, -1,
- -1, -1, -1, -1, -1, -1, -1, 22, -1, -1,
- -1, -1, -1, -1, 29, -1, -1, -1, 33, 34,
- -1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
- -1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
- -1, 56, -1, -1, -1, -1, -1, -1, -1, -1,
- 65, 66, 67, 68, -1, 70, -1, 72, -1, 74,
- -1, 76, -1, -1, -1, -1, 81, 82, 83, -1,
- -1, -1, 87, -1, -1, -1, -1, -1, 93, 94,
- 95, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 94, 95, 96, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 8, -1, -1, 11, 12, 13,
+ -1, -1, -1, -1, -1, -1, -1, -1, 22, -1,
+ -1, -1, -1, -1, -1, 29, -1, -1, -1, 33,
+ 34, -1, 36, -1, -1, -1, 40, -1, 42, 43,
+ 44, -1, -1, 47, -1, -1, -1, 51, -1, 53,
+ -1, -1, 56, -1, -1, -1, -1, -1, -1, -1,
+ -1, 65, 66, 67, 68, -1, 70, -1, 72, -1,
+ 74, -1, 76, -1, -1, -1, -1, 81, 82, 83,
+ -1, -1, -1, 87, -1, -1, -1, -1, -1, -1,
+ 94, 95, 96, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 8, -1, -1, 11, 12, 13, -1, -1,
+ -1, -1, -1, -1, -1, -1, 22, -1, -1, -1,
+ -1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
+ 36, -1, -1, -1, 40, -1, 42, 43, 44, -1,
+ -1, 47, -1, -1, -1, 51, -1, 53, -1, -1,
+ 56, -1, -1, -1, -1, -1, -1, -1, -1, 65,
+ 66, 67, 68, -1, 70, -1, 72, -1, 74, -1,
+ 76, -1, -1, -1, -1, 81, 82, 83, -1, -1,
+ -1, 87, -1, -1, -1, -1, -1, -1, 94, 95,
+ 96, -1, -1, -1, -1, -1, -1, -1, -1, -1,
8, -1, -1, 11, 12, 13, -1, -1, -1, -1,
-1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
-1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
@@ -894,26 +934,7 @@ const short QQmlJSGrammar::action_check [] = {
-1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
68, -1, 70, -1, 72, -1, 74, -1, 76, -1,
-1, -1, -1, 81, 82, 83, -1, -1, -1, 87,
- -1, -1, -1, -1, -1, 93, 94, 95, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 8, -1, -1,
- 11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
- -1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
- -1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
- -1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
- 51, -1, 53, -1, -1, 56, -1, -1, -1, -1,
- -1, -1, -1, -1, 65, 66, 67, 68, -1, 70,
- -1, 72, -1, 74, -1, 76, -1, -1, -1, -1,
- 81, 82, 83, -1, -1, -1, 87, -1, -1, -1,
- -1, -1, 93, 94, 95, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 11, 12, 13, -1, -1, -1,
- -1, -1, -1, -1, -1, 22, -1, -1, -1, -1,
- -1, -1, 29, 30, -1, -1, 33, 34, -1, 36,
- -1, -1, -1, 40, -1, 42, 43, 44, -1, -1,
- 47, -1, -1, -1, 51, -1, 53, -1, -1, -1,
- -1, -1, -1, -1, 61, -1, -1, -1, 65, 66,
- 67, 68, 69, 70, -1, 72, 73, 74, -1, 76,
- -1, 78, -1, -1, 81, 82, 83, -1, -1, -1,
- 87, -1, -1, -1, -1, -1, 93, 94, 95, -1,
+ -1, -1, -1, -1, -1, -1, 94, 95, 96, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 11, 12,
13, -1, -1, -1, -1, -1, -1, -1, -1, 22,
-1, -1, -1, -1, -1, -1, 29, 30, -1, -1,
@@ -923,47 +944,57 @@ const short QQmlJSGrammar::action_check [] = {
-1, -1, 65, 66, 67, 68, 69, 70, -1, 72,
73, 74, -1, 76, -1, 78, -1, -1, 81, 82,
83, -1, -1, -1, 87, -1, -1, -1, -1, -1,
- 93, 94, 95, -1, -1, -1, -1, -1, -1, -1,
+ -1, 94, 95, 96, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
+ -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
+ -1, 29, 30, -1, -1, 33, 34, -1, 36, -1,
+ -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
+ -1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
+ -1, -1, -1, 61, -1, -1, -1, 65, 66, 67,
+ 68, 69, 70, -1, 72, 73, 74, -1, 76, -1,
+ 78, -1, -1, 81, 82, 83, -1, -1, -1, 87,
+ -1, -1, -1, -1, -1, -1, 94, 95, 96, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 4, 5,
+ 6, -1, -1, 9, 10, 11, -1, -1, 14, -1,
+ 16, -1, -1, -1, 20, 21, 22, -1, -1, -1,
+ -1, -1, -1, 29, 30, 31, 32, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 43, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
+ 66, 67, 68, 69, 70, 71, -1, 73, 74, 75,
+ 76, 77, 78, -1, -1, 81, 82, 83, 84, 85,
+ 86, -1, -1, -1, -1, -1, -1, -1, 94, 95,
+ 96, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 4, 5, 6, -1, -1, 9, 10, 11, -1, -1,
+ 14, -1, 16, -1, -1, -1, 20, 21, 22, -1,
+ -1, -1, -1, -1, -1, 29, 30, 31, 32, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 43,
+ -1, -1, -1, 47, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
+ -1, 65, 66, 67, 68, 69, 70, 71, -1, 73,
+ 74, 75, 76, 77, 78, -1, -1, 81, 82, 83,
+ 84, 85, 86, -1, -1, -1, -1, -1, -1, -1,
+ 94, 95, 96, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 4, 5, 6, -1, -1, 9, 10, 11,
-1, -1, 14, -1, 16, -1, -1, -1, 20, 21,
22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
32, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 43, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 43, -1, -1, -1, 47, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
- -1, -1, -1, -1, 66, 67, 68, 69, 70, 71,
+ -1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
-1, 73, 74, 75, 76, 77, 78, -1, -1, 81,
82, 83, 84, 85, 86, -1, -1, -1, -1, -1,
- -1, 93, 94, 95, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 4, 5, 6, -1, -1, 9, 10,
- 11, -1, -1, 14, -1, 16, -1, -1, -1, 20,
- 21, 22, -1, -1, -1, -1, -1, -1, 29, 30,
- 31, 32, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 43, -1, -1, -1, 47, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 59, -1,
- -1, -1, -1, -1, 65, 66, 67, 68, 69, 70,
- 71, -1, 73, 74, 75, 76, 77, 78, -1, -1,
- 81, 82, 83, 84, 85, 86, -1, -1, -1, -1,
- -1, -1, 93, 94, 95, -1, -1, -1, -1, -1,
+ -1, -1, 94, 95, 96, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 4, 5, 6, -1, -1, 9,
10, 11, -1, -1, 14, -1, 16, -1, -1, -1,
20, 21, 22, -1, -1, -1, -1, -1, -1, 29,
30, 31, 32, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 59,
+ -1, -1, -1, -1, -1, 55, -1, -1, -1, 59,
-1, -1, -1, -1, -1, 65, 66, 67, 68, 69,
70, 71, -1, 73, 74, 75, 76, 77, 78, -1,
-1, 81, 82, 83, 84, 85, 86, -1, -1, -1,
- -1, -1, -1, 93, 94, 95, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 4, 5, 6, -1, -1,
- 9, 10, 11, -1, -1, 14, -1, 16, -1, -1,
- -1, 20, 21, 22, -1, -1, -1, -1, -1, -1,
- 29, 30, 31, 32, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 43, -1, -1, -1, 47, -1,
- -1, -1, -1, -1, -1, -1, 55, -1, -1, -1,
- 59, -1, -1, -1, -1, -1, 65, 66, 67, 68,
- 69, 70, 71, -1, 73, 74, 75, 76, 77, 78,
- -1, -1, 81, 82, 83, 84, 85, 86, -1, -1,
- -1, -1, -1, -1, 93, 94, 95, -1, -1, -1,
+ -1, -1, -1, -1, 94, 95, 96, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 4, -1, -1, -1,
-1, 9, -1, 11, 12, 13, 14, -1, -1, -1,
-1, -1, -1, 21, 22, -1, -1, -1, -1, -1,
@@ -973,89 +1004,90 @@ const short QQmlJSGrammar::action_check [] = {
-1, 59, -1, 61, -1, -1, -1, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, -1, -1, 81, 82, 83, 84, 85, -1, 87,
- -1, -1, -1, -1, -1, 93, 94, 95, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 4, -1, -1,
- -1, -1, 9, -1, 11, 12, 13, 14, -1, -1,
- -1, -1, -1, -1, 21, 22, -1, -1, -1, -1,
- -1, -1, 29, 30, -1, -1, 33, 34, -1, 36,
- -1, -1, -1, 40, -1, 42, 43, 44, -1, -1,
- 47, -1, -1, -1, 51, -1, 53, -1, -1, -1,
- -1, -1, 59, -1, 61, -1, -1, -1, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- 77, 78, -1, -1, 81, 82, 83, 84, 85, -1,
- 87, -1, -1, -1, -1, -1, 93, 94, 95, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 4, 5,
- 6, -1, -1, 9, 10, 11, 12, 13, 14, -1,
- 16, -1, -1, -1, 20, 21, 22, -1, -1, -1,
- -1, -1, -1, 29, 30, 31, 32, 33, 34, -1,
+ -1, -1, -1, -1, -1, -1, 94, 95, 96, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 4, -1,
+ -1, -1, -1, 9, -1, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, -1, 21, 22, -1, -1, -1,
+ -1, -1, -1, 29, 30, -1, -1, 33, 34, -1,
36, -1, -1, -1, 40, -1, 42, 43, 44, -1,
-1, 47, -1, -1, -1, 51, -1, 53, -1, -1,
-1, -1, -1, 59, -1, 61, -1, -1, -1, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, -1, -1, 81, 82, 83, 84, 85,
- 86, 87, -1, -1, -1, -1, -1, 93, 94, 95,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 4,
- 5, 6, -1, -1, 9, 10, 11, 12, 13, 14,
- -1, 16, -1, -1, -1, 20, 21, 22, -1, -1,
- -1, -1, -1, -1, 29, 30, 31, 32, 33, 34,
- -1, 36, -1, -1, -1, 40, -1, 42, 43, 44,
- -1, -1, 47, -1, -1, -1, 51, -1, 53, -1,
- 55, -1, -1, -1, 59, -1, 61, -1, -1, -1,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 78, -1, -1, 81, 82, 83, 84,
- 85, 86, 87, -1, -1, -1, -1, -1, 93, 94,
- 95, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 87, -1, -1, -1, -1, -1, -1, 94, 95,
+ 96, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 4, 5, 6, -1, -1, 9, 10, 11, 12, 13,
+ 14, -1, 16, -1, -1, -1, 20, 21, 22, -1,
+ -1, -1, -1, -1, -1, 29, 30, 31, 32, 33,
+ 34, -1, 36, -1, -1, -1, 40, -1, 42, 43,
+ 44, -1, -1, 47, -1, -1, -1, 51, -1, 53,
+ -1, -1, -1, -1, -1, 59, -1, 61, -1, -1,
+ -1, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, -1, -1, 81, 82, 83,
+ 84, 85, 86, 87, -1, -1, -1, -1, -1, -1,
+ 94, 95, 96, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 4, 5, 6, -1, -1, 9, 10, 11,
+ 12, 13, 14, -1, 16, -1, -1, -1, 20, 21,
+ 22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
+ 32, 33, 34, -1, 36, -1, -1, -1, 40, -1,
+ 42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
+ -1, 53, -1, 55, -1, -1, -1, 59, -1, 61,
+ -1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, -1, -1, 81,
+ 82, 83, 84, 85, 86, 87, -1, -1, -1, -1,
+ -1, -1, 94, 95, 96, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
- 15, 39, 29, 3, 15, 15, 13, 15, 3, 15,
- 29, 9, 15, 15, 3, 3, 39, 22, 19, 15,
- 19, 3, 15, 15, 15, 11, 3, 74, 15, 19,
- 15, 15, 29, 13, 15, 29, 102, 15, 3, 15,
- 97, 3, 100, 15, -1, 15, 29, 22, 15, 3,
- 3, 15, 3, 22, 15, 15, 22, 15, 15, 3,
- 39, 3, 3, 3, 3, 39, 39, 22, 39, 3,
- 15, 39, 15, 2, -1, 13, 39, 13, 2, 2,
- 39, 13, 13, 39, 2, 15, 15, 39, 20, 3,
- 3, 15, 15, 3, 15, 15, 2, 15, 41, -1,
- 2, 51, 51, 51, 53, 51, 56, 53, 56, 15,
- 48, 41, 48, 15, 51, 15, 51, 48, 51, 56,
- 39, 56, 39, 56, 51, 51, 53, 53, 47, 51,
- 47, 53, 4, 15, 2, 51, 15, 53, 15, 51,
- 40, 15, 51, 15, 53, 4, 51, 15, 53, 15,
- 51, 63, 53, 51, 51, 13, 15, 51, 16, 53,
- 42, 75, 75, 51, 3, 44, 43, 65, 15, 43,
- 67, 91, 13, 61, -1, 16, 42, 15, 51, 15,
- 51, 54, 51, 54, 51, 106, 53, 56, 51, 13,
- 53, 51, 16, 53, 2, 51, 43, 51, 35, 2,
- 56, 15, 39, 51, 42, 59, 42, 15, 56, 51,
- 2, 51, 15, 2, 56, -1, 56, 51, 51, 51,
- 2, 51, 56, 15, 57, 57, 15, 57, 51, 4,
- 51, 2, -1, 15, 57, 56, 75, 2, 51, 51,
- 15, 53, 55, 2, 15, 51, 51, 2, 53, 55,
- 15, 51, 51, 53, 53, 51, 15, 53, 51, 2,
- 15, 51, 55, 51, 51, 15, 56, 2, 56, 56,
- -1, 3, 15, 51, 64, 89, -1, 51, 56, 51,
- 15, 68, 56, -1, 56, 73, 58, 51, 66, -1,
- -1, 51, 56, -1, 44, 45, 56, 51, 58, 73,
- 51, -1, 56, 51, 58, 56, 51, 51, 56, 73,
- 51, 56, 56, 58, 13, 56, -1, -1, 62, 60,
- -1, 20, 73, 13, 5, 73, 16, 5, 18, -1,
- -1, -1, 13, 32, 33, 13, -1, -1, -1, 20,
- -1, -1, 20, 75, -1, -1, -1, -1, -1, 39,
- 85, 32, 33, -1, 32, 33, 22, 23, 24, 25,
- 26, 27, 28, 21, 22, 23, 24, 25, 26, 27,
- 28, 13, -1, -1, -1, -1, 2, -1, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, -1, -1, 15,
+ 42, 3, 18, 25, 18, 3, 18, 3, 18, 22,
+ 18, 3, 18, 22, 32, 32, 42, 18, 18, 18,
+ 3, 32, 25, 18, 18, 32, 3, 18, 32, 105,
+ 18, 18, 25, 100, 3, 3, 3, 18, 3, 25,
+ 18, 3, 18, 18, 18, 42, 3, 3, 103, 9,
+ 3, 14, 42, 42, 18, 25, 14, 42, 42, 18,
+ 42, 3, 42, 18, 18, 3, 18, 3, 18, 14,
+ 42, 22, 18, 2, 4, 18, 42, 18, 2, 11,
+ 12, 54, -1, 54, 2, 56, 59, 18, 18, 18,
+ 4, 14, 14, 54, 18, 56, 19, 14, 77, 14,
+ 18, 23, 2, 46, 18, 54, 54, 54, 2, 2,
+ 59, 59, 59, 18, 54, 54, 3, 56, 18, 59,
+ 54, 54, 56, 56, 18, 18, 54, 54, 54, 56,
+ 56, 59, 18, 54, 51, 56, 51, 2, 54, 2,
+ 56, 54, 54, 56, 56, 54, 54, 56, 38, 2,
+ 58, 54, 42, 18, 57, 18, 3, 54, 2, 45,
+ 18, 92, 54, 54, 2, 18, 3, 18, 109, 66,
+ 42, 54, 64, 56, 18, 18, 18, 2, 50, 70,
+ 18, 54, 42, 4, 54, 43, 56, 18, 14, 94,
+ 50, 78, 2, 18, 45, 68, 18, 18, 54, 18,
+ 56, 3, 54, 46, 46, 54, 54, 59, 18, 54,
+ 2, 60, 60, 44, 54, 60, 56, 2, 14, 14,
+ 3, 54, 44, 19, 19, 51, 18, 60, 47, 2,
+ 54, 78, 18, 18, 54, -1, 56, 54, 62, 56,
+ 54, 54, 18, 18, 58, 18, 59, 54, 54, 54,
+ 57, 54, 58, 54, 59, 54, 59, 54, 59, 45,
+ 59, 54, 59, 54, 2, 2, 59, -1, 59, 45,
+ 61, -1, 47, 48, 2, -1, 78, 54, -1, 76,
+ 18, 18, 59, 76, 54, -1, 54, 54, 54, 59,
+ 18, 59, 59, 59, -1, 78, -1, -1, 54, 76,
+ 54, 69, -1, 59, 71, 59, 76, 61, 54, 54,
+ 76, 67, 54, 59, 59, 61, 5, 59, 54, 61,
+ 65, 14, 5, 59, -1, 14, 19, 63, 21, -1,
+ -1, 14, -1, -1, 23, -1, -1, -1, -1, -1,
+ 23, -1, -1, -1, -1, -1, 35, 36, -1, 42,
+ 88, 88, 35, 36, 25, 26, 27, 28, 29, 30,
+ 31, 24, 25, 26, 27, 28, 29, 30, 31, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 14, 14, -1, -1, -1, -1, -1,
+ -1, -1, 23, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, -1, -1, 35, 36, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 85,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 13, -1, -1, -1, -1, -1, -1, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, -1, -1,
+ 14, -1, -1, -1, -1, -1, -1, -1, -1, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
diff --git a/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h b/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h
index 9ef4695d69..054b7cc2e0 100644
--- a/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsgrammar_p.h
@@ -63,12 +63,12 @@ class QQmlJSGrammar
public:
enum VariousConstants {
EOF_SYMBOL = 0,
- REDUCE_HERE = 104,
- SHIFT_THERE = 103,
+ REDUCE_HERE = 105,
+ SHIFT_THERE = 104,
T_AND = 1,
T_AND_AND = 2,
T_AND_EQ = 3,
- T_AS = 92,
+ T_AS = 93,
T_AUTOMATIC_SEMICOLON = 62,
T_BREAK = 4,
T_CASE = 5,
@@ -90,19 +90,19 @@ public:
T_EQ = 17,
T_EQ_EQ = 18,
T_EQ_EQ_EQ = 19,
- T_ERROR = 96,
+ T_ERROR = 97,
T_FALSE = 83,
- T_FEED_JS_EXPRESSION = 100,
- T_FEED_JS_PROGRAM = 102,
- T_FEED_JS_SOURCE_ELEMENT = 101,
- T_FEED_JS_STATEMENT = 99,
- T_FEED_UI_OBJECT_MEMBER = 98,
- T_FEED_UI_PROGRAM = 97,
+ T_FEED_JS_EXPRESSION = 101,
+ T_FEED_JS_PROGRAM = 103,
+ T_FEED_JS_SOURCE_ELEMENT = 102,
+ T_FEED_JS_STATEMENT = 100,
+ T_FEED_UI_OBJECT_MEMBER = 99,
+ T_FEED_UI_PROGRAM = 98,
T_FINALLY = 20,
T_FOR = 21,
T_FUNCTION = 22,
T_GE = 23,
- T_GET = 94,
+ T_GET = 95,
T_GT = 24,
T_GT_GT = 25,
T_GT_GT_EQ = 26,
@@ -130,13 +130,14 @@ public:
T_NOT_EQ_EQ = 46,
T_NULL = 81,
T_NUMERIC_LITERAL = 47,
- T_ON = 93,
+ T_ON = 94,
T_OR = 48,
T_OR_EQ = 49,
T_OR_OR = 50,
T_PLUS = 51,
T_PLUS_EQ = 52,
T_PLUS_PLUS = 53,
+ T_PRAGMA = 92,
T_PROPERTY = 66,
T_PUBLIC = 90,
T_QUESTION = 54,
@@ -149,7 +150,7 @@ public:
T_RETURN = 59,
T_RPAREN = 60,
T_SEMICOLON = 61,
- T_SET = 95,
+ T_SET = 96,
T_SIGNAL = 67,
T_STAR = 63,
T_STAR_EQ = 64,
@@ -168,15 +169,15 @@ public:
T_XOR = 79,
T_XOR_EQ = 80,
- ACCEPT_STATE = 655,
- RULE_COUNT = 351,
- STATE_COUNT = 656,
- TERMINAL_COUNT = 105,
- NON_TERMINAL_COUNT = 108,
+ ACCEPT_STATE = 663,
+ RULE_COUNT = 357,
+ STATE_COUNT = 664,
+ TERMINAL_COUNT = 106,
+ NON_TERMINAL_COUNT = 111,
- GOTO_INDEX_OFFSET = 656,
- GOTO_INFO_OFFSET = 2970,
- GOTO_CHECK_OFFSET = 2970
+ GOTO_INDEX_OFFSET = 664,
+ GOTO_INFO_OFFSET = 3104,
+ GOTO_CHECK_OFFSET = 3104
};
static const char *const spell [];
diff --git a/src/tools/qdoc/qmlparser/qqmljskeywords_p.h b/src/tools/qdoc/qmlparser/qqmljskeywords_p.h
index 7fcf001303..c6277e0fcc 100644
--- a/src/tools/qdoc/qmlparser/qqmljskeywords_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljskeywords_p.h
@@ -436,6 +436,17 @@ static inline int classify6(const QChar *s, bool qmlMode) {
}
}
}
+ else if (s[1].unicode() == 'r') {
+ if (s[2].unicode() == 'a') {
+ if (s[3].unicode() == 'g') {
+ if (s[4].unicode() == 'm') {
+ if (s[5].unicode() == 'a') {
+ return qmlMode ? Lexer::T_PRAGMA : Lexer::T_IDENTIFIER;
+ }
+ }
+ }
+ }
+ }
}
else if (s[0].unicode() == 'r') {
if (s[1].unicode() == 'e') {
diff --git a/src/tools/qdoc/qmlparser/qqmljslexer.cpp b/src/tools/qdoc/qmlparser/qqmljslexer.cpp
index edd85ec878..8e8ed954ad 100644
--- a/src/tools/qdoc/qmlparser/qqmljslexer.cpp
+++ b/src/tools/qdoc/qmlparser/qqmljslexer.cpp
@@ -54,7 +54,7 @@ QT_END_NAMESPACE
using namespace QQmlJS;
-static int regExpFlagFromChar(const QChar &ch)
+static inline int regExpFlagFromChar(const QChar &ch)
{
switch (ch.unicode()) {
case 'g': return Lexer::RegExp_Global;
@@ -64,7 +64,7 @@ static int regExpFlagFromChar(const QChar &ch)
return 0;
}
-static unsigned char convertHex(ushort c)
+static inline unsigned char convertHex(ushort c)
{
if (c >= '0' && c <= '9')
return (c - '0');
@@ -74,12 +74,12 @@ static unsigned char convertHex(ushort c)
return (c - 'A' + 10);
}
-static QChar convertHex(QChar c1, QChar c2)
+static inline QChar convertHex(QChar c1, QChar c2)
{
return QChar((convertHex(c1.unicode()) << 4) + convertHex(c2.unicode()));
}
-static QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4)
+static inline QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4)
{
return QChar((convertHex(c3.unicode()) << 4) + convertHex(c4.unicode()),
(convertHex(c1.unicode()) << 4) + convertHex(c2.unicode()));
@@ -259,6 +259,7 @@ int Lexer::lex()
_parenthesesCount = 0;
break;
+ case T_ELSE:
case T_DO:
_parenthesesState = BalancedParentheses;
break;
@@ -287,7 +288,8 @@ int Lexer::lex()
break;
case BalancedParentheses:
- _parenthesesState = IgnoreParentheses;
+ if (_tokenKind != T_DO && _tokenKind != T_ELSE)
+ _parenthesesState = IgnoreParentheses;
break;
} // switch
@@ -329,6 +331,27 @@ QChar Lexer::decodeUnicodeEscapeCharacter(bool *ok)
return QChar();
}
+QChar Lexer::decodeHexEscapeCharacter(bool *ok)
+{
+ if (isHexDigit(_codePtr[0]) && isHexDigit(_codePtr[1])) {
+ scanChar();
+
+ const QChar c1 = _char;
+ scanChar();
+
+ const QChar c2 = _char;
+ scanChar();
+
+ if (ok)
+ *ok = true;
+
+ return convertHex(c1, c2);
+ }
+
+ *ok = false;
+ return QChar();
+}
+
static inline bool isIdentifierStart(QChar ch)
{
// fast path for ascii
@@ -705,35 +728,29 @@ again:
scanChar();
QChar u;
- bool ok = false;
switch (_char.unicode()) {
// unicode escape sequence
- case 'u':
+ case 'u': {
+ bool ok = false;
u = decodeUnicodeEscapeCharacter(&ok);
if (! ok) {
_errorCode = IllegalUnicodeEscapeSequence;
_errorMessage = QCoreApplication::translate("QQmlParser", "Illegal unicode escape sequence");
return T_ERROR;
}
- break;
+ } break;
// hex escape sequence
- case 'x':
- if (isHexDigit(_codePtr[0]) && isHexDigit(_codePtr[1])) {
- scanChar();
-
- const QChar c1 = _char;
- scanChar();
-
- const QChar c2 = _char;
- scanChar();
-
- u = convertHex(c1, c2);
- } else {
- u = _char;
+ case 'x': {
+ bool ok = false;
+ u = decodeHexEscapeCharacter(&ok);
+ if (!ok) {
+ _errorCode = IllegalHexadecimalEscapeSequence;
+ _errorMessage = QCoreApplication::translate("QQmlParser", "Illegal hexadecimal escape sequence");
+ return T_ERROR;
}
- break;
+ } break;
// single character escape sequence
case '\\': u = QLatin1Char('\\'); scanChar(); break;
@@ -767,22 +784,11 @@ again:
return T_ERROR;
case '\r':
- if (isLineTerminatorSequence() == 2) {
- _tokenText += QLatin1Char('\r');
- u = QLatin1Char('\n');
- } else {
- u = QLatin1Char('\r');
- }
- scanChar();
- break;
-
case '\n':
case 0x2028u:
case 0x2029u:
- u = _char;
scanChar();
- break;
-
+ continue;
default:
// non escape character
@@ -1033,7 +1039,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
_patternFlags = 0;
while (isIdentLetter(_char)) {
int flag = regExpFlagFromChar(_char);
- if (flag == 0) {
+ if (flag == 0 || _patternFlags & flag) {
_errorMessage = QCoreApplication::translate("QQmlParser", "Invalid regular expression flag '%0'")
.arg(QChar(_char));
return false;
diff --git a/src/tools/qdoc/qmlparser/qqmljslexer_p.h b/src/tools/qdoc/qmlparser/qqmljslexer_p.h
index e1b51da92b..23af61d650 100644
--- a/src/tools/qdoc/qmlparser/qqmljslexer_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljslexer_p.h
@@ -128,7 +128,8 @@ public:
IllegalUnicodeEscapeSequence,
UnclosedComment,
IllegalExponentIndicator,
- IllegalIdentifier
+ IllegalIdentifier,
+ IllegalHexadecimalEscapeSequence
};
enum RegExpBodyPrefix {
@@ -203,6 +204,7 @@ private:
void syncProhibitAutomaticSemicolon();
QChar decodeUnicodeEscapeCharacter(bool *ok);
+ QChar decodeHexEscapeCharacter(bool *ok);
private:
Engine *_engine;
diff --git a/src/tools/qdoc/qmlparser/qqmljsparser.cpp b/src/tools/qdoc/qmlparser/qqmljsparser.cpp
index a0fa7a4711..b86b4a987f 100644
--- a/src/tools/qdoc/qmlparser/qqmljsparser.cpp
+++ b/src/tools/qdoc/qmlparser/qqmljsparser.cpp
@@ -50,6 +50,7 @@
#include <string.h>
+
#include "qqmljsparser_p.h"
#include <QtCore/qvarlengtharray.h>
@@ -146,6 +147,19 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr)
return 0;
}
+AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr)
+{
+ if (AST::IdentifierExpression *idExpr = AST::cast<AST::IdentifierExpression *>(expr)) {
+ AST::UiQualifiedPragmaId *q = new (pool) AST::UiQualifiedPragmaId(idExpr->name);
+ q->identifierToken = idExpr->identifierToken;
+
+ return q->finish();
+ }
+
+ return 0;
+}
+
+
bool Parser::parse(int startToken)
{
Lexer *lexer = driver->lexer();
@@ -232,32 +246,44 @@ case 5: {
} break;
case 6: {
- sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiImportList,
+ sym(1).UiProgram = new (pool) AST::UiProgram(sym(1).UiHeaderItemList,
sym(2).UiObjectMemberList->finish());
} break;
case 8: {
- sym(1).Node = sym(1).UiImportList->finish();
+ sym(1).Node = sym(1).UiHeaderItemList->finish();
} break;
case 9: {
- sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImport);
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiPragma);
} break;
case 10: {
- sym(1).Node = new (pool) AST::UiImportList(sym(1).UiImportList, sym(2).UiImport);
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiImport);
} break;
-case 13: {
+case 11: {
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiPragma);
+} break;
+
+case 12: {
+ sym(1).Node = new (pool) AST::UiHeaderItemList(sym(1).UiHeaderItemList, sym(2).UiImport);
+} break;
+
+case 16: {
+ sym(1).UiPragma->semicolonToken = loc(2);
+} break;
+
+case 18: {
sym(1).UiImport->semicolonToken = loc(2);
} break;
-case 15: {
+case 20: {
sym(1).UiImport->versionToken = loc(2);
sym(1).UiImport->semicolonToken = loc(3);
} break;
-case 17: {
+case 22: {
sym(1).UiImport->versionToken = loc(2);
sym(1).UiImport->asToken = loc(3);
sym(1).UiImport->importIdToken = loc(4);
@@ -265,14 +291,33 @@ case 17: {
sym(1).UiImport->semicolonToken = loc(5);
} break;
-case 19: {
+case 24: {
sym(1).UiImport->asToken = loc(2);
sym(1).UiImport->importIdToken = loc(3);
sym(1).UiImport->importId = stringRef(3);
sym(1).UiImport->semicolonToken = loc(4);
} break;
-case 20: {
+case 25: {
+ AST::UiPragma *node = 0;
+
+ if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression)) {
+ node = new (pool) AST::UiPragma(qualifiedId);
+ }
+
+ sym(1).Node = node;
+
+ if (node) {
+ node->pragmaToken = loc(1);
+ } else {
+ diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
+ QLatin1String("Expected a qualified name id")));
+
+ return false; // ### remove me
+ }
+} break;
+
+case 26: {
AST::UiImport *node = 0;
if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) {
@@ -295,56 +340,56 @@ case 20: {
}
} break;
-case 21: {
+case 27: {
sym(1).Node = 0;
} break;
-case 22: {
+case 28: {
sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember);
} break;
-case 23: {
+case 29: {
sym(1).Node = new (pool) AST::UiObjectMemberList(sym(1).UiObjectMember);
} break;
-case 24: {
+case 30: {
AST::UiObjectMemberList *node = new (pool) AST:: UiObjectMemberList(
sym(1).UiObjectMemberList, sym(2).UiObjectMember);
sym(1).Node = node;
} break;
-case 25: {
+case 31: {
sym(1).Node = new (pool) AST::UiArrayMemberList(sym(1).UiObjectMember);
} break;
-case 26: {
+case 32: {
AST::UiArrayMemberList *node = new (pool) AST::UiArrayMemberList(
sym(1).UiArrayMemberList, sym(3).UiObjectMember);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 27: {
+case 33: {
AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0);
node->lbraceToken = loc(1);
node->rbraceToken = loc(2);
sym(1).Node = node;
} break;
-case 28: {
+case 34: {
AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer(sym(2).UiObjectMemberList->finish());
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
-case 29: {
+case 35: {
AST::UiObjectDefinition *node = new (pool) AST::UiObjectDefinition(sym(1).UiQualifiedId,
sym(2).UiObjectInitializer);
sym(1).Node = node;
} break;
-case 31: {
+case 37: {
AST::UiArrayBinding *node = new (pool) AST::UiArrayBinding(
sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish());
node->colonToken = loc(2);
@@ -353,14 +398,14 @@ case 31: {
sym(1).Node = node;
} break;
-case 32: {
+case 38: {
AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding(
sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 33: {
+case 39: {
AST::UiObjectBinding *node = new (pool) AST::UiObjectBinding(
sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer);
node->colonToken = loc(2);
@@ -368,7 +413,7 @@ case 33: {
sym(1).Node = node;
} break;
-case 41:
+case 47:
{
AST::UiScriptBinding *node = new (pool) AST::UiScriptBinding(
sym(1).UiQualifiedId, sym(3).Statement);
@@ -376,22 +421,22 @@ case 41:
sym(1).Node = node;
} break;
-case 45: {
+case 51: {
sym(1).Node = 0;
} break;
-case 46: {
+case 52: {
sym(1).Node = sym(1).UiParameterList->finish ();
} break;
-case 47: {
+case 53: {
AST::UiParameterList *node = new (pool) AST::UiParameterList(stringRef(1), stringRef(2));
node->propertyTypeToken = loc(1);
node->identifierToken = loc(2);
sym(1).Node = node;
} break;
-case 48: {
+case 54: {
AST::UiParameterList *node = new (pool) AST::UiParameterList(sym(1).UiParameterList, stringRef(3), stringRef(4));
node->propertyTypeToken = loc(3);
node->commaToken = loc(2);
@@ -399,7 +444,7 @@ case 48: {
sym(1).Node = node;
} break;
-case 50: {
+case 56: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2));
node->type = AST::UiPublicMember::Signal;
node->propertyToken = loc(1);
@@ -410,7 +455,7 @@ case 50: {
sym(1).Node = node;
} break;
-case 52: {
+case 58: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(QStringRef(), stringRef(2));
node->type = AST::UiPublicMember::Signal;
node->propertyToken = loc(1);
@@ -420,7 +465,7 @@ case 52: {
sym(1).Node = node;
} break;
-case 54: {
+case 60: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6));
node->typeModifier = stringRef(2);
node->propertyToken = loc(1);
@@ -431,7 +476,7 @@ case 54: {
sym(1).Node = node;
} break;
-case 56: {
+case 62: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3));
node->propertyToken = loc(1);
node->typeToken = loc(2);
@@ -440,7 +485,7 @@ case 56: {
sym(1).Node = node;
} break;
-case 58: {
+case 64: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4));
node->isDefaultMember = true;
node->defaultToken = loc(1);
@@ -451,7 +496,7 @@ case 58: {
sym(1).Node = node;
} break;
-case 59: {
+case 65: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3),
sym(5).Statement);
node->propertyToken = loc(1);
@@ -461,7 +506,7 @@ case 59: {
sym(1).Node = node;
} break;
-case 60: {
+case 66: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4),
sym(6).Statement);
node->isReadonlyMember = true;
@@ -473,7 +518,7 @@ case 60: {
sym(1).Node = node;
} break;
-case 61: {
+case 67: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(3), stringRef(4),
sym(6).Statement);
node->isDefaultMember = true;
@@ -485,7 +530,7 @@ case 61: {
sym(1).Node = node;
} break;
-case 62: {
+case 68: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(4), stringRef(6));
node->typeModifier = stringRef(2);
node->propertyToken = loc(1);
@@ -509,7 +554,7 @@ case 62: {
sym(1).Node = node;
} break;
-case 63: {
+case 69: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(2), stringRef(3));
node->propertyToken = loc(1);
node->typeToken = loc(2);
@@ -529,57 +574,57 @@ case 63: {
sym(1).Node = node;
} break;
-case 64: {
+case 70: {
sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node);
} break;
-case 65: {
+case 71: {
sym(1).Node = new (pool) AST::UiSourceElement(sym(1).Node);
} break;
-case 73: {
+case 79: {
AST::ThisExpression *node = new (pool) AST::ThisExpression();
node->thisToken = loc(1);
sym(1).Node = node;
} break;
-case 74: {
+case 80: {
AST::IdentifierExpression *node = new (pool) AST::IdentifierExpression(stringRef(1));
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 75: {
+case 81: {
AST::NullExpression *node = new (pool) AST::NullExpression();
node->nullToken = loc(1);
sym(1).Node = node;
} break;
-case 76: {
+case 82: {
AST::TrueLiteral *node = new (pool) AST::TrueLiteral();
node->trueToken = loc(1);
sym(1).Node = node;
} break;
-case 77: {
+case 83: {
AST::FalseLiteral *node = new (pool) AST::FalseLiteral();
node->falseToken = loc(1);
sym(1).Node = node;
} break;
-case 78: {
+case 84: {
AST::NumericLiteral *node = new (pool) AST::NumericLiteral(sym(1).dval);
node->literalToken = loc(1);
sym(1).Node = node;
} break;
-case 79:
-case 80: {
+case 85:
+case 86: {
AST::StringLiteral *node = new (pool) AST::StringLiteral(stringRef(1));
node->literalToken = loc(1);
sym(1).Node = node;
} break;
-case 81: {
+case 87: {
bool rx = lexer->scanRegExp(Lexer::NoPrefix);
if (!rx) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
@@ -595,7 +640,7 @@ case 81: {
sym(1).Node = node;
} break;
-case 82: {
+case 88: {
bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
if (!rx) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
@@ -611,28 +656,28 @@ case 82: {
sym(1).Node = node;
} break;
-case 83: {
+case 89: {
AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral((AST::Elision *) 0);
node->lbracketToken = loc(1);
node->rbracketToken = loc(2);
sym(1).Node = node;
} break;
-case 84: {
+case 90: {
AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).Elision->finish());
node->lbracketToken = loc(1);
node->rbracketToken = loc(3);
sym(1).Node = node;
} break;
-case 85: {
+case 91: {
AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish ());
node->lbracketToken = loc(1);
node->rbracketToken = loc(3);
sym(1).Node = node;
} break;
-case 86: {
+case 92: {
AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (),
(AST::Elision *) 0);
node->lbracketToken = loc(1);
@@ -641,7 +686,7 @@ case 86: {
sym(1).Node = node;
} break;
-case 87: {
+case 93: {
AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (),
sym(4).Elision->finish());
node->lbracketToken = loc(1);
@@ -650,7 +695,7 @@ case 87: {
sym(1).Node = node;
} break;
-case 88: {
+case 94: {
AST::ObjectLiteral *node = 0;
if (sym(2).Node)
node = new (pool) AST::ObjectLiteral(
@@ -662,7 +707,7 @@ case 88: {
sym(1).Node = node;
} break;
-case 89: {
+case 95: {
AST::ObjectLiteral *node = new (pool) AST::ObjectLiteral(
sym(2).PropertyAssignmentList->finish ());
node->lbraceToken = loc(1);
@@ -670,14 +715,14 @@ case 89: {
sym(1).Node = node;
} break;
-case 90: {
+case 96: {
AST::NestedExpression *node = new (pool) AST::NestedExpression(sym(2).Expression);
node->lparenToken = loc(1);
node->rparenToken = loc(3);
sym(1).Node = node;
} break;
-case 91: {
+case 97: {
if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken,
QLatin1String("Ignored annotation")));
@@ -697,48 +742,48 @@ case 91: {
}
} break;
-case 92: {
+case 98: {
sym(1).Node = new (pool) AST::ElementList((AST::Elision *) 0, sym(1).Expression);
} break;
-case 93: {
+case 99: {
sym(1).Node = new (pool) AST::ElementList(sym(1).Elision->finish(), sym(2).Expression);
} break;
-case 94: {
+case 100: {
AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList,
(AST::Elision *) 0, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 95: {
+case 101: {
AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, sym(3).Elision->finish(),
sym(4).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 96: {
+case 102: {
AST::Elision *node = new (pool) AST::Elision();
node->commaToken = loc(1);
sym(1).Node = node;
} break;
-case 97: {
+case 103: {
AST::Elision *node = new (pool) AST::Elision(sym(1).Elision);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 98: {
+case 104: {
AST::PropertyNameAndValue *node = new (pool) AST::PropertyNameAndValue(
sym(1).PropertyName, sym(3).Expression);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 99: {
+case 105: {
AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter(
sym(2).PropertyName, sym(6).FunctionBody);
node->getSetToken = loc(1);
@@ -749,7 +794,7 @@ case 99: {
sym(1).Node = node;
} break;
-case 100: {
+case 106: {
AST::PropertyGetterSetter *node = new (pool) AST::PropertyGetterSetter(
sym(2).PropertyName, sym(4).FormalParameterList, sym(7).FunctionBody);
node->getSetToken = loc(1);
@@ -760,56 +805,56 @@ case 100: {
sym(1).Node = node;
} break;
-case 101: {
+case 107: {
sym(1).Node = new (pool) AST::PropertyAssignmentList(sym(1).PropertyAssignment);
} break;
-case 102: {
+case 108: {
AST::PropertyAssignmentList *node = new (pool) AST::PropertyAssignmentList(
sym(1).PropertyAssignmentList, sym(3).PropertyAssignment);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 103: {
+case 109: {
AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1));
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 104: {
+case 110: {
AST::StringLiteralPropertyName *node = new (pool) AST::StringLiteralPropertyName(stringRef(1));
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 105: {
+case 111: {
AST::NumericLiteralPropertyName *node = new (pool) AST::NumericLiteralPropertyName(sym(1).dval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 106: {
+case 112: {
AST::IdentifierPropertyName *node = new (pool) AST::IdentifierPropertyName(stringRef(1));
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 142: {
+case 148: {
AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression);
node->lbracketToken = loc(2);
node->rbracketToken = loc(4);
sym(1).Node = node;
} break;
-case 143: {
+case 149: {
AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3));
node->dotToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 144: {
+case 150: {
AST::NewMemberExpression *node = new (pool) AST::NewMemberExpression(sym(2).Expression, sym(4).ArgumentList);
node->newToken = loc(1);
node->lparenToken = loc(3);
@@ -817,384 +862,384 @@ case 144: {
sym(1).Node = node;
} break;
-case 146: {
+case 152: {
AST::NewExpression *node = new (pool) AST::NewExpression(sym(2).Expression);
node->newToken = loc(1);
sym(1).Node = node;
} break;
-case 147: {
+case 153: {
AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList);
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
} break;
-case 148: {
+case 154: {
AST::CallExpression *node = new (pool) AST::CallExpression(sym(1).Expression, sym(3).ArgumentList);
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
} break;
-case 149: {
+case 155: {
AST::ArrayMemberExpression *node = new (pool) AST::ArrayMemberExpression(sym(1).Expression, sym(3).Expression);
node->lbracketToken = loc(2);
node->rbracketToken = loc(4);
sym(1).Node = node;
} break;
-case 150: {
+case 156: {
AST::FieldMemberExpression *node = new (pool) AST::FieldMemberExpression(sym(1).Expression, stringRef(3));
node->dotToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 151: {
+case 157: {
sym(1).Node = 0;
} break;
-case 152: {
+case 158: {
sym(1).Node = sym(1).ArgumentList->finish();
} break;
-case 153: {
+case 159: {
sym(1).Node = new (pool) AST::ArgumentList(sym(1).Expression);
} break;
-case 154: {
+case 160: {
AST::ArgumentList *node = new (pool) AST::ArgumentList(sym(1).ArgumentList, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 158: {
+case 164: {
AST::PostIncrementExpression *node = new (pool) AST::PostIncrementExpression(sym(1).Expression);
node->incrementToken = loc(2);
sym(1).Node = node;
} break;
-case 159: {
+case 165: {
AST::PostDecrementExpression *node = new (pool) AST::PostDecrementExpression(sym(1).Expression);
node->decrementToken = loc(2);
sym(1).Node = node;
} break;
-case 161: {
+case 167: {
AST::DeleteExpression *node = new (pool) AST::DeleteExpression(sym(2).Expression);
node->deleteToken = loc(1);
sym(1).Node = node;
} break;
-case 162: {
+case 168: {
AST::VoidExpression *node = new (pool) AST::VoidExpression(sym(2).Expression);
node->voidToken = loc(1);
sym(1).Node = node;
} break;
-case 163: {
+case 169: {
AST::TypeOfExpression *node = new (pool) AST::TypeOfExpression(sym(2).Expression);
node->typeofToken = loc(1);
sym(1).Node = node;
} break;
-case 164: {
+case 170: {
AST::PreIncrementExpression *node = new (pool) AST::PreIncrementExpression(sym(2).Expression);
node->incrementToken = loc(1);
sym(1).Node = node;
} break;
-case 165: {
+case 171: {
AST::PreDecrementExpression *node = new (pool) AST::PreDecrementExpression(sym(2).Expression);
node->decrementToken = loc(1);
sym(1).Node = node;
} break;
-case 166: {
+case 172: {
AST::UnaryPlusExpression *node = new (pool) AST::UnaryPlusExpression(sym(2).Expression);
node->plusToken = loc(1);
sym(1).Node = node;
} break;
-case 167: {
+case 173: {
AST::UnaryMinusExpression *node = new (pool) AST::UnaryMinusExpression(sym(2).Expression);
node->minusToken = loc(1);
sym(1).Node = node;
} break;
-case 168: {
+case 174: {
AST::TildeExpression *node = new (pool) AST::TildeExpression(sym(2).Expression);
node->tildeToken = loc(1);
sym(1).Node = node;
} break;
-case 169: {
+case 175: {
AST::NotExpression *node = new (pool) AST::NotExpression(sym(2).Expression);
node->notToken = loc(1);
sym(1).Node = node;
} break;
-case 171: {
+case 177: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Mul, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 172: {
+case 178: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Div, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 173: {
+case 179: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Mod, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 175: {
+case 181: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Add, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 176: {
+case 182: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Sub, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 178: {
+case 184: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::LShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 179: {
+case 185: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::RShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 180: {
+case 186: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::URShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 182: {
+case 188: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Lt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 183: {
+case 189: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Gt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 184: {
+case 190: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Le, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 185: {
+case 191: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Ge, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 186: {
+case 192: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::InstanceOf, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 187: {
+case 193: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::In, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 189: {
+case 195: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Lt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 190: {
+case 196: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Gt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 191: {
+case 197: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Le, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 192: {
+case 198: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Ge, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 193: {
+case 199: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::InstanceOf, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 195: {
+case 201: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Equal, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 196: {
+case 202: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::NotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 197: {
+case 203: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::StrictEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 198: {
+case 204: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::StrictNotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 200: {
+case 206: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Equal, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 201: {
+case 207: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::NotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 202: {
+case 208: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::StrictEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 203: {
+case 209: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::StrictNotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 205: {
+case 211: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::BitAnd, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 207: {
+case 213: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::BitAnd, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 209: {
+case 215: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::BitXor, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 211: {
+case 217: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::BitXor, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 213: {
+case 219: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::BitOr, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 215: {
+case 221: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::BitOr, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 217: {
+case 223: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::And, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 219: {
+case 225: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::And, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 221: {
+case 227: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Or, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 223: {
+case 229: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
QSOperator::Or, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 225: {
+case 231: {
AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression,
sym(3).Expression, sym(5).Expression);
node->questionToken = loc(2);
@@ -1202,7 +1247,7 @@ case 225: {
sym(1).Node = node;
} break;
-case 227: {
+case 233: {
AST::ConditionalExpression *node = new (pool) AST::ConditionalExpression(sym(1).Expression,
sym(3).Expression, sym(5).Expression);
node->questionToken = loc(2);
@@ -1210,112 +1255,112 @@ case 227: {
sym(1).Node = node;
} break;
-case 229: {
+case 235: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
sym(2).ival, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 231: {
+case 237: {
AST::BinaryExpression *node = new (pool) AST::BinaryExpression(sym(1).Expression,
sym(2).ival, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 232: {
+case 238: {
sym(1).ival = QSOperator::Assign;
} break;
-case 233: {
+case 239: {
sym(1).ival = QSOperator::InplaceMul;
} break;
-case 234: {
+case 240: {
sym(1).ival = QSOperator::InplaceDiv;
} break;
-case 235: {
+case 241: {
sym(1).ival = QSOperator::InplaceMod;
} break;
-case 236: {
+case 242: {
sym(1).ival = QSOperator::InplaceAdd;
} break;
-case 237: {
+case 243: {
sym(1).ival = QSOperator::InplaceSub;
} break;
-case 238: {
+case 244: {
sym(1).ival = QSOperator::InplaceLeftShift;
} break;
-case 239: {
+case 245: {
sym(1).ival = QSOperator::InplaceRightShift;
} break;
-case 240: {
+case 246: {
sym(1).ival = QSOperator::InplaceURightShift;
} break;
-case 241: {
+case 247: {
sym(1).ival = QSOperator::InplaceAnd;
} break;
-case 242: {
+case 248: {
sym(1).ival = QSOperator::InplaceXor;
} break;
-case 243: {
+case 249: {
sym(1).ival = QSOperator::InplaceOr;
} break;
-case 245: {
+case 251: {
AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 246: {
+case 252: {
sym(1).Node = 0;
} break;
-case 249: {
+case 255: {
AST::Expression *node = new (pool) AST::Expression(sym(1).Expression, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 250: {
+case 256: {
sym(1).Node = 0;
} break;
-case 267: {
+case 273: {
AST::Block *node = new (pool) AST::Block(sym(2).StatementList);
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
-case 268: {
+case 274: {
sym(1).Node = new (pool) AST::StatementList(sym(1).Statement);
} break;
-case 269: {
+case 275: {
sym(1).Node = new (pool) AST::StatementList(sym(1).StatementList, sym(2).Statement);
} break;
-case 270: {
+case 276: {
sym(1).Node = 0;
} break;
-case 271: {
+case 277: {
sym(1).Node = sym(1).StatementList->finish ();
} break;
-case 273: {
+case 279: {
AST::VariableStatement *node = new (pool) AST::VariableStatement(
sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST));
node->declarationKindToken = loc(1);
@@ -1323,76 +1368,76 @@ case 273: {
sym(1).Node = node;
} break;
-case 274: {
+case 280: {
sym(1).ival = T_CONST;
} break;
-case 275: {
+case 281: {
sym(1).ival = T_VAR;
} break;
-case 276: {
+case 282: {
sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration);
} break;
-case 277: {
+case 283: {
AST::VariableDeclarationList *node = new (pool) AST::VariableDeclarationList(
sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 278: {
+case 284: {
sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclaration);
} break;
-case 279: {
+case 285: {
sym(1).Node = new (pool) AST::VariableDeclarationList(sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
} break;
-case 280: {
+case 286: {
AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 281: {
+case 287: {
AST::VariableDeclaration *node = new (pool) AST::VariableDeclaration(stringRef(1), sym(2).Expression);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 282: {
+case 288: {
// ### TODO: AST for initializer
sym(1) = sym(2);
} break;
-case 283: {
+case 289: {
sym(1).Node = 0;
} break;
-case 285: {
+case 291: {
// ### TODO: AST for initializer
sym(1) = sym(2);
} break;
-case 286: {
+case 292: {
sym(1).Node = 0;
} break;
-case 288: {
+case 294: {
AST::EmptyStatement *node = new (pool) AST::EmptyStatement();
node->semicolonToken = loc(1);
sym(1).Node = node;
} break;
-case 290: {
+case 296: {
AST::ExpressionStatement *node = new (pool) AST::ExpressionStatement(sym(1).Expression);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 291: {
+case 297: {
AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement, sym(7).Statement);
node->ifToken = loc(1);
node->lparenToken = loc(2);
@@ -1401,7 +1446,7 @@ case 291: {
sym(1).Node = node;
} break;
-case 292: {
+case 298: {
AST::IfStatement *node = new (pool) AST::IfStatement(sym(3).Expression, sym(5).Statement);
node->ifToken = loc(1);
node->lparenToken = loc(2);
@@ -1409,7 +1454,7 @@ case 292: {
sym(1).Node = node;
} break;
-case 295: {
+case 301: {
AST::DoWhileStatement *node = new (pool) AST::DoWhileStatement(sym(2).Statement, sym(5).Expression);
node->doToken = loc(1);
node->whileToken = loc(3);
@@ -1419,7 +1464,7 @@ case 295: {
sym(1).Node = node;
} break;
-case 296: {
+case 302: {
AST::WhileStatement *node = new (pool) AST::WhileStatement(sym(3).Expression, sym(5).Statement);
node->whileToken = loc(1);
node->lparenToken = loc(2);
@@ -1427,7 +1472,7 @@ case 296: {
sym(1).Node = node;
} break;
-case 297: {
+case 303: {
AST::ForStatement *node = new (pool) AST::ForStatement(sym(3).Expression,
sym(5).Expression, sym(7).Expression, sym(9).Statement);
node->forToken = loc(1);
@@ -1438,7 +1483,7 @@ case 297: {
sym(1).Node = node;
} break;
-case 298: {
+case 304: {
AST::LocalForStatement *node = new (pool) AST::LocalForStatement(
sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression,
sym(8).Expression, sym(10).Statement);
@@ -1451,7 +1496,7 @@ case 298: {
sym(1).Node = node;
} break;
-case 299: {
+case 305: {
AST:: ForEachStatement *node = new (pool) AST::ForEachStatement(sym(3).Expression,
sym(5).Expression, sym(7).Statement);
node->forToken = loc(1);
@@ -1461,7 +1506,7 @@ case 299: {
sym(1).Node = node;
} break;
-case 300: {
+case 306: {
AST::LocalForEachStatement *node = new (pool) AST::LocalForEachStatement(
sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement);
node->forToken = loc(1);
@@ -1472,14 +1517,14 @@ case 300: {
sym(1).Node = node;
} break;
-case 302: {
+case 308: {
AST::ContinueStatement *node = new (pool) AST::ContinueStatement();
node->continueToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 304: {
+case 310: {
AST::ContinueStatement *node = new (pool) AST::ContinueStatement(stringRef(2));
node->continueToken = loc(1);
node->identifierToken = loc(2);
@@ -1487,14 +1532,14 @@ case 304: {
sym(1).Node = node;
} break;
-case 306: {
+case 312: {
AST::BreakStatement *node = new (pool) AST::BreakStatement(QStringRef());
node->breakToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 308: {
+case 314: {
AST::BreakStatement *node = new (pool) AST::BreakStatement(stringRef(2));
node->breakToken = loc(1);
node->identifierToken = loc(2);
@@ -1502,14 +1547,14 @@ case 308: {
sym(1).Node = node;
} break;
-case 310: {
+case 316: {
AST::ReturnStatement *node = new (pool) AST::ReturnStatement(sym(2).Expression);
node->returnToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
-case 311: {
+case 317: {
AST::WithStatement *node = new (pool) AST::WithStatement(sym(3).Expression, sym(5).Statement);
node->withToken = loc(1);
node->lparenToken = loc(2);
@@ -1517,7 +1562,7 @@ case 311: {
sym(1).Node = node;
} break;
-case 312: {
+case 318: {
AST::SwitchStatement *node = new (pool) AST::SwitchStatement(sym(3).Expression, sym(5).CaseBlock);
node->switchToken = loc(1);
node->lparenToken = loc(2);
@@ -1525,83 +1570,83 @@ case 312: {
sym(1).Node = node;
} break;
-case 313: {
+case 319: {
AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
-case 314: {
+case 320: {
AST::CaseBlock *node = new (pool) AST::CaseBlock(sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(5);
sym(1).Node = node;
} break;
-case 315: {
+case 321: {
sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClause);
} break;
-case 316: {
+case 322: {
sym(1).Node = new (pool) AST::CaseClauses(sym(1).CaseClauses, sym(2).CaseClause);
} break;
-case 317: {
+case 323: {
sym(1).Node = 0;
} break;
-case 318: {
+case 324: {
sym(1).Node = sym(1).CaseClauses->finish ();
} break;
-case 319: {
+case 325: {
AST::CaseClause *node = new (pool) AST::CaseClause(sym(2).Expression, sym(4).StatementList);
node->caseToken = loc(1);
node->colonToken = loc(3);
sym(1).Node = node;
} break;
-case 320: {
+case 326: {
AST::DefaultClause *node = new (pool) AST::DefaultClause(sym(3).StatementList);
node->defaultToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 321: {
+case 327: {
AST::LabelledStatement *node = new (pool) AST::LabelledStatement(stringRef(1), sym(3).Statement);
node->identifierToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 323: {
+case 329: {
AST::ThrowStatement *node = new (pool) AST::ThrowStatement(sym(2).Expression);
node->throwToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
-case 324: {
+case 330: {
AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 325: {
+case 331: {
AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 326: {
+case 332: {
AST::TryStatement *node = new (pool) AST::TryStatement(sym(2).Statement, sym(3).Catch, sym(4).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 327: {
+case 333: {
AST::Catch *node = new (pool) AST::Catch(stringRef(3), sym(5).Block);
node->catchToken = loc(1);
node->lparenToken = loc(2);
@@ -1610,20 +1655,20 @@ case 327: {
sym(1).Node = node;
} break;
-case 328: {
+case 334: {
AST::Finally *node = new (pool) AST::Finally(sym(2).Block);
node->finallyToken = loc(1);
sym(1).Node = node;
} break;
-case 330: {
+case 336: {
AST::DebuggerStatement *node = new (pool) AST::DebuggerStatement();
node->debuggerToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 332: {
+case 338: {
AST::FunctionDeclaration *node = new (pool) AST::FunctionDeclaration(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
node->identifierToken = loc(2);
@@ -1634,7 +1679,7 @@ case 332: {
sym(1).Node = node;
} break;
-case 333: {
+case 339: {
AST::FunctionExpression *node = new (pool) AST::FunctionExpression(stringRef(2), sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
if (! stringRef(2).isNull())
@@ -1646,7 +1691,7 @@ case 333: {
sym(1).Node = node;
} break;
-case 334: {
+case 340: {
AST::FunctionExpression *node = new (pool) AST::FunctionExpression(QStringRef(), sym(3).FormalParameterList, sym(6).FunctionBody);
node->functionToken = loc(1);
node->lparenToken = loc(2);
@@ -1656,56 +1701,56 @@ case 334: {
sym(1).Node = node;
} break;
-case 335: {
+case 341: {
AST::FormalParameterList *node = new (pool) AST::FormalParameterList(stringRef(1));
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 336: {
+case 342: {
AST::FormalParameterList *node = new (pool) AST::FormalParameterList(sym(1).FormalParameterList, stringRef(3));
node->commaToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 337: {
+case 343: {
sym(1).Node = 0;
} break;
-case 338: {
+case 344: {
sym(1).Node = sym(1).FormalParameterList->finish ();
} break;
-case 339: {
+case 345: {
sym(1).Node = 0;
} break;
-case 341: {
+case 347: {
sym(1).Node = new (pool) AST::FunctionBody(sym(1).SourceElements->finish ());
} break;
-case 343: {
+case 349: {
sym(1).Node = new (pool) AST::Program(sym(1).SourceElements->finish ());
} break;
-case 344: {
+case 350: {
sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElement);
} break;
-case 345: {
+case 351: {
sym(1).Node = new (pool) AST::SourceElements(sym(1).SourceElements, sym(2).SourceElement);
} break;
-case 346: {
+case 352: {
sym(1).Node = new (pool) AST::StatementSourceElement(sym(1).Statement);
} break;
-case 347: {
+case 353: {
sym(1).Node = new (pool) AST::FunctionSourceElement(sym(1).FunctionDeclaration);
} break;
-case 348: {
+case 354: {
sym(1).Node = 0;
} break;
diff --git a/src/tools/qdoc/qmlparser/qqmljsparser_p.h b/src/tools/qdoc/qmlparser/qqmljsparser_p.h
index 6edfd844d0..bf963718fb 100644
--- a/src/tools/qdoc/qmlparser/qqmljsparser_p.h
+++ b/src/tools/qdoc/qmlparser/qqmljsparser_p.h
@@ -112,7 +112,8 @@ public:
AST::VariableDeclarationList *VariableDeclarationList;
AST::UiProgram *UiProgram;
- AST::UiImportList *UiImportList;
+ AST::UiHeaderItemList *UiHeaderItemList;
+ AST::UiPragma *UiPragma;
AST::UiImport *UiImport;
AST::UiParameterList *UiParameterList;
AST::UiPublicMember *UiPublicMember;
@@ -125,6 +126,7 @@ public:
AST::UiObjectMemberList *UiObjectMemberList;
AST::UiArrayMemberList *UiArrayMemberList;
AST::UiQualifiedId *UiQualifiedId;
+ AST::UiQualifiedPragmaId *UiQualifiedPragmaId;
};
public:
@@ -206,6 +208,7 @@ protected:
{ return location_stack [tos + index - 1]; }
AST::UiQualifiedId *reparseAsQualifiedId(AST::ExpressionNode *expr);
+ AST::UiQualifiedPragmaId *reparseAsQualifiedPragmaId(AST::ExpressionNode *expr);
protected:
Engine *driver;
@@ -245,9 +248,9 @@ protected:
-#define J_SCRIPT_REGEXPLITERAL_RULE1 81
+#define J_SCRIPT_REGEXPLITERAL_RULE1 87
-#define J_SCRIPT_REGEXPLITERAL_RULE2 82
+#define J_SCRIPT_REGEXPLITERAL_RULE2 88
QT_QML_END_NAMESPACE
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp
index 323c312eb5..ec1ef41256 100644
--- a/src/tools/qdoc/qmlvisitor.cpp
+++ b/src/tools/qdoc/qmlvisitor.cpp
@@ -404,7 +404,6 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
}
}
else if (command == COMMAND_INTERNAL) {
- node->setAccess(Node::Private);
node->setStatus(Node::Internal);
}
else if (command == COMMAND_OBSOLETE) {
@@ -465,6 +464,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
QmlClassNode *component = new QmlClassNode(current, name);
component->setTitle(name);
component->setImportList(importList);
+ importList.clear();
if (applyDocumentation(definition->firstSourceLocation(), component)) {
QmlClassNode::addInheritedBy(type, component);
component->setQmlBaseName(type);
@@ -489,34 +489,21 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition)
lastEndOffset = definition->lastSourceLocation().end();
}
-/*!
- Note that the imports list can be traversed by iteration to obtain
- all the imports in the document at once, having found just one:
-
- *it = imports; it; it = it->next
-
- */
-bool QmlDocVisitor::visit(QQmlJS::AST::UiImportList *imports)
+bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import)
{
- while (imports != 0) {
- QQmlJS::AST::UiImport* imp = imports->import;
-
- QString name = document.mid(imp->fileNameToken.offset, imp->fileNameToken.length);
- if (name[0] == '\"')
- name = name.mid(1, name.length()-2);
- QString version = document.mid(imp->versionToken.offset, imp->versionToken.length);
- QString importId = document.mid(imp->importIdToken.offset, imp->importIdToken.length);
- QString importUri = getFullyQualifiedId(imp->importUri);
- importList.append(ImportRec(name, version, importId, importUri));
- imports = imports->next;
- }
+ QString name = document.mid(import->fileNameToken.offset, import->fileNameToken.length);
+ if (name[0] == '\"')
+ name = name.mid(1, name.length()-2);
+ QString version = document.mid(import->versionToken.offset, import->versionToken.length);
+ QString importId = document.mid(import->importIdToken.offset, import->importIdToken.length);
+ QString importUri = getFullyQualifiedId(import->importUri);
+ QString reconstructed = importUri + QString(" ") + version;
+ importList.append(ImportRec(name, version, importId, importUri));
+
return true;
}
-/*!
- End the visit of the imports list.
- */
-void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
+void QmlDocVisitor::endVisit(QQmlJS::AST::UiImport *definition)
{
lastEndOffset = definition->lastSourceLocation().end();
}
diff --git a/src/tools/qdoc/qmlvisitor.h b/src/tools/qdoc/qmlvisitor.h
index cdb7ae7391..feeeb13497 100644
--- a/src/tools/qdoc/qmlvisitor.h
+++ b/src/tools/qdoc/qmlvisitor.h
@@ -75,8 +75,8 @@ public:
const QSet<QString> &topics);
virtual ~QmlDocVisitor();
- bool visit(QQmlJS::AST::UiImportList *imports);
- void endVisit(QQmlJS::AST::UiImportList *definition);
+ bool visit(QQmlJS::AST::UiImport *import);
+ void endVisit(QQmlJS::AST::UiImport *definition);
bool visit(QQmlJS::AST::UiObjectDefinition *definition);
void endVisit(QQmlJS::AST::UiObjectDefinition *definition);
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 8956842493..4c5fb18766 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -427,6 +427,30 @@ void QWellArray::keyPressEvent(QKeyEvent* e)
//////////// QWellArray END
+// Event filter to be installed on the dialog while in color-picking mode.
+class QColorPickingEventFilter : public QObject {
+public:
+ explicit QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent = 0) : QObject(parent), m_dp(dp) {}
+
+ bool eventFilter(QObject *, QEvent *event) Q_DECL_OVERRIDE
+ {
+ switch (event->type()) {
+ case QEvent::MouseMove:
+ return m_dp->handleColorPickingMouseMove(static_cast<QMouseEvent *>(event));
+ case QEvent::MouseButtonRelease:
+ return m_dp->handleColorPickingMouseButtonRelease(static_cast<QMouseEvent *>(event));
+ case QEvent::KeyPress:
+ return m_dp->handleColorPickingKeyPress(static_cast<QKeyEvent *>(event));
+ default:
+ break;
+ }
+ return false;
+ }
+
+private:
+ QColorDialogPrivate *m_dp;
+};
+
/*!
Returns the number of custom colors supported by QColorDialog. All
color dialogs share the same custom colors.
@@ -1518,7 +1542,9 @@ void QColorDialogPrivate::_q_newStandard(int r, int c)
void QColorDialogPrivate::_q_pickScreenColor()
{
Q_Q(QColorDialog);
- screenColorPicking = true;
+ if (!colorPickingEventFilter)
+ colorPickingEventFilter = new QColorPickingEventFilter(this);
+ q->installEventFilter(colorPickingEventFilter);
// If user pushes Escape, the last color before picking will be restored.
beforeScreenColorPicking = cs->currentColor();
/*For some reason, q->grabMouse(Qt::CrossCursor) doesn't change
@@ -1548,7 +1574,7 @@ void QColorDialogPrivate::_q_pickScreenColor()
void QColorDialogPrivate::releaseColorPicking()
{
Q_Q(QColorDialog);
- screenColorPicking = false;
+ q->removeEventFilter(colorPickingEventFilter);
q->releaseMouse();
q->releaseKeyboard();
#ifndef QT_NO_CURSOR
@@ -1570,7 +1596,7 @@ void QColorDialogPrivate::init(const QColor &initial)
// default: use the native dialog if possible. Can be overridden in setOptions()
nativeDialogInUse = (platformColorDialogHelper() != 0);
- screenColorPicking = false;
+ colorPickingEventFilter = 0;
nextCust = 0;
if (!nativeDialogInUse)
@@ -2121,55 +2147,41 @@ void QColorDialog::changeEvent(QEvent *e)
QDialog::changeEvent(e);
}
-/*!
- \reimp
-*/
-void QColorDialog::mouseMoveEvent(QMouseEvent *e)
+bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e)
{
- Q_D(QColorDialog);
- if (d->screenColorPicking) {
- setCurrentColor(d->grabScreenColor(e->globalPos()));
- d->lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel")
- .arg(e->globalPos().x())
- .arg(e->globalPos().y())
- .arg(currentColor().name()));
- return;
- }
- QDialog::mouseMoveEvent(e);
+ Q_Q(QColorDialog);
+ const QPoint globalPos = e->globalPos();
+ const QColor color = grabScreenColor(globalPos);
+ q->setCurrentColor(color);
+ lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel")
+ .arg(globalPos.x()).arg(globalPos.y()).arg(color.name()));
+ return true;
}
-/*!
- \reimp
-*/
-void QColorDialog::mouseReleaseEvent(QMouseEvent *e)
+bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e)
{
- Q_D(QColorDialog);
- if (d->screenColorPicking) {
- setCurrentColor(d->grabScreenColor(e->globalPos()));
- d->releaseColorPicking();
- return;
- }
- QDialog::mouseReleaseEvent(e);
+ Q_Q(QColorDialog);
+ q->setCurrentColor(grabScreenColor(e->globalPos()));
+ releaseColorPicking();
+ return true;
}
-/*!
- \reimp
-*/
-void QColorDialog::keyPressEvent(QKeyEvent *e)
+bool QColorDialogPrivate::handleColorPickingKeyPress(QKeyEvent *e)
{
- Q_D(QColorDialog);
- if (d->screenColorPicking) {
- if (e->key() == Qt::Key_Escape) {
- d->releaseColorPicking();
- d->setCurrentColor(d->beforeScreenColorPicking);
- } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
- setCurrentColor(d->grabScreenColor(QCursor::pos()));
- d->releaseColorPicking();
- }
- e->accept();
- return;
+ Q_Q(QColorDialog);
+ switch (e->key()) {
+ case Qt::Key_Escape:
+ releaseColorPicking();
+ q->setCurrentColor(beforeScreenColorPicking);
+ break;
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ q->setCurrentColor(grabScreenColor(QCursor::pos()));
+ releaseColorPicking();
+ break;
}
- QDialog::keyPressEvent(e);
+ e->accept();
+ return true;
}
/*!
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index c7a1d6f400..c74ee6720a 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -112,9 +112,6 @@ Q_SIGNALS:
protected:
void changeEvent(QEvent *event);
- virtual void mouseMoveEvent(QMouseEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void keyPressEvent(QKeyEvent *);
void done(int result);
private:
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index 08199cc7c1..f58a9200db 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -70,6 +70,7 @@ class QLabel;
class QVBoxLayout;
class QPushButton;
class QWellArray;
+class QColorPickingEventFilter;
class QColorDialogPrivate : public QDialogPrivate
{
@@ -105,6 +106,9 @@ public:
void _q_newStandard(int, int);
void _q_pickScreenColor();
void releaseColorPicking();
+ bool handleColorPickingMouseMove(QMouseEvent *e);
+ bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
+ bool handleColorPickingKeyPress(QKeyEvent *e);
QWellArray *custom;
QWellArray *standard;
@@ -125,6 +129,7 @@ public:
int nextCust;
bool smallDisplay;
bool screenColorPicking;
+ QColorPickingEventFilter *colorPickingEventFilter;
QRgb beforeScreenColorPicking;
QSharedPointer<QColorDialogOptions> options;
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index af352e45c6..d498b077fc 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -52,6 +52,8 @@
#include "qwhatsthis.h"
#include "qmenu.h"
#include "qcursor.h"
+#include "qmessagebox.h"
+#include "qerrormessage.h"
#include <qpa/qplatformtheme.h>
#include "private/qdialog_p.h"
#include "private/qguiapplication_p.h"
@@ -75,6 +77,14 @@ static inline int themeDialogType(const QDialog *dialog)
if (qobject_cast<const QFontDialog *>(dialog))
return QPlatformTheme::FontDialog;
#endif
+#ifndef QT_NO_MESSAGEBOX
+ if (qobject_cast<const QMessageBox *>(dialog))
+ return QPlatformTheme::MessageDialog;
+#endif
+#ifndef QT_NO_ERRORMESSAGE
+ if (qobject_cast<const QErrorMessage *>(dialog))
+ return QPlatformTheme::MessageDialog;
+#endif
return -1;
}
@@ -100,6 +110,17 @@ QPlatformDialogHelper *QDialogPrivate::platformHelper() const
return m_platformHelper;
}
+bool QDialogPrivate::canBeNativeDialog() const
+{
+ QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
+ QDialog *dialog = ncThis->q_func();
+ const int type = themeDialogType(dialog);
+ if (type >= 0)
+ return QGuiApplicationPrivate::platformTheme()
+ ->usePlatformNativeDialog(static_cast<QPlatformTheme::DialogType>(type));
+ return false;
+}
+
QWindow *QDialogPrivate::parentWindow() const
{
if (const QWidget *parent = q_func()->nativeParentWidget())
@@ -697,6 +718,9 @@ void QDialog::closeEvent(QCloseEvent *e)
void QDialog::setVisible(bool visible)
{
Q_D(QDialog);
+ if (!testAttribute(Qt::WA_DontShowOnScreen) && d->canBeNativeDialog() && d->setNativeDialogVisible(visible))
+ return;
+
if (visible) {
if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden))
return;
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 5064efa35d..8db1b2a27c 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
class QSizeGrip;
-class QDialogPrivate : public QWidgetPrivate
+class Q_WIDGETS_EXPORT QDialogPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QDialog)
public:
@@ -113,6 +113,7 @@ public:
bool nativeDialogInUse;
QPlatformDialogHelper *platformHelper() const;
+ virtual bool canBeNativeDialog() const;
private:
virtual void initHelper(QPlatformDialogHelper *) {}
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 11ad7c7a5d..1c3a793234 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -184,6 +184,13 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_file_url_hook qt_filedialog_save_file_url_h
The \l{dialogs/standarddialogs}{Standard Dialogs} example shows
how to use QFileDialog as well as other built-in Qt dialogs.
+ By default, a platform-native file dialog will be used if the platform has
+ one. In that case, the widgets which would otherwise be used to construct the
+ dialog will not be instantiated, so related accessors such as layout() and
+ itemDelegate() will return null. You can set the \l DontUseNativeDialog option to
+ ensure that the widget-based implementation will be used instead of the
+ native dialog.
+
\sa QDir, QFileInfo, QFile, QColorDialog, QFontDialog, {Standard Dialogs Example},
{Application Example}
*/
@@ -243,7 +250,8 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_file_url_hook qt_filedialog_save_file_url_h
\value DontUseNativeDialog Don't use the native file dialog. By
default, the native file dialog is used unless you use a subclass
- of QFileDialog that contains the Q_OBJECT macro.
+ of QFileDialog that contains the Q_OBJECT macro, or the platform
+ does not have a native dialog of the type that you require.
\value ReadOnly Indicates that the model is readonly.
@@ -620,7 +628,8 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
QUrl::fromLocalFile(directory.absolutePath()) :
QUrl());
options->setInitiallySelectedNameFilter(q->selectedNameFilter());
- options->setInitiallySelectedFiles(userSelectedFiles());
+ if (options->initiallySelectedFiles().isEmpty())
+ options->setInitiallySelectedFiles(userSelectedFiles());
}
void QFileDialogPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
@@ -755,9 +764,9 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files)
emit q->fileSelected(files.first());
}
-bool QFileDialogPrivate::canBeNativeDialog()
+bool QFileDialogPrivate::canBeNativeDialog() const
{
- Q_Q(QFileDialog);
+ Q_Q(const QFileDialog);
if (nativeDialogInUse)
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))
@@ -1045,10 +1054,13 @@ void QFileDialog::selectFile(const QString &filename)
return;
if (!d->usingWidgets()) {
- d->selectFile_sys(QUrl::fromLocalFile(filename));
- QList<QUrl> i;
- i << QUrl(filename);
- d->options->setInitiallySelectedFiles(i);
+ QUrl url = QUrl::fromLocalFile(filename);
+ if (QFileInfo(filename).isRelative()) {
+ QDir dir(d->options->initialDirectory().toLocalFile());
+ url = QUrl::fromLocalFile(dir.absoluteFilePath(filename));
+ }
+ d->selectFile_sys(url);
+ d->options->setInitiallySelectedFiles(QList<QUrl>() << url);
return;
}
@@ -1675,11 +1687,8 @@ void QFileDialog::setAcceptMode(QFileDialog::AcceptMode mode)
d->options->setAcceptMode(static_cast<QFileDialogOptions::AcceptMode>(mode));
// clear WA_DontShowOnScreen so that d->canBeNativeDialog() doesn't return false incorrectly
setAttribute(Qt::WA_DontShowOnScreen, false);
- if (!d->usingWidgets()) {
- // we need to recreate the native dialog when changing the AcceptMode
- d->deletePlatformHelper();
+ if (!d->usingWidgets())
return;
- }
QDialogButtonBox::StandardButton button = (mode == AcceptOpen ? QDialogButtonBox::Open : QDialogButtonBox::Save);
d->qFileDialogUi->buttonBox->setStandardButtons(button | QDialogButtonBox::Cancel);
d->qFileDialogUi->buttonBox->button(button)->setEnabled(false);
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index 36336bdbf6..faa721572c 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -251,7 +251,7 @@ public:
// setVisible_sys returns true if it ends up showing a native
// dialog. Returning false means that a non-native dialog must be
// used instead.
- bool canBeNativeDialog();
+ bool canBeNativeDialog() const;
inline bool usingWidgets() const;
void setDirectory_sys(const QUrl &directory);
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 13aaca2f48..1b64b0ba67 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -193,7 +193,6 @@ public:
}
};
-
class QMessageBoxPrivate : public QDialogPrivate
{
Q_DECLARE_PUBLIC(QMessageBox)
@@ -204,11 +203,13 @@ public:
detailsText(0),
#endif
compatMode(false), autoAddOkButton(true),
- detectedEscapeButton(0), informativeLabel(0) { }
+ detectedEscapeButton(0), informativeLabel(0),
+ options(new QMessageDialogOptions) { }
void init(const QString &title = QString(), const QString &text = QString());
void setupLayout();
void _q_buttonClicked(QAbstractButton *);
+ void _q_clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role);
QAbstractButton *findButton(int button0, int button1, int button2, int flags);
void addOldButtons(int button0, int button1, int button2);
@@ -224,7 +225,6 @@ public:
#ifdef Q_OS_WINCE
void hideSpecial();
#endif
-
static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon,
const QString &title, const QString &text,
int button0, int button1, int button2);
@@ -262,6 +262,11 @@ public:
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
QByteArray signalToDisconnectOnClose;
+ QSharedPointer<QMessageDialogOptions> options;
+private:
+ void initHelper(QPlatformDialogHelper *);
+ void helperPrepareShow(QPlatformDialogHelper *);
+ void helperDone(QDialog::DialogCode, QPlatformDialogHelper *);
};
void QMessageBoxPrivate::init(const QString &title, const QString &text)
@@ -519,6 +524,13 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button)
}
}
+void QMessageBoxPrivate::_q_clicked(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role)
+{
+ Q_UNUSED(role);
+ Q_Q(QMessageBox);
+ q->done(button);
+}
+
/*!
\class QMessageBox
@@ -2682,6 +2694,54 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb
return QPixmap();
}
+void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)
+{
+ Q_Q(QMessageBox);
+ QObject::connect(h, SIGNAL(clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)),
+ q, SLOT(_q_clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)));
+ static_cast<QPlatformMessageDialogHelper *>(h)->setOptions(options);
+}
+
+static QMessageDialogOptions::Icon helperIcon(QMessageBox::Icon i)
+{
+ switch (i) {
+ case QMessageBox::NoIcon:
+ return QMessageDialogOptions::NoIcon;
+ case QMessageBox::Information:
+ return QMessageDialogOptions::Information;
+ case QMessageBox::Warning:
+ return QMessageDialogOptions::Warning;
+ case QMessageBox::Critical:
+ return QMessageDialogOptions::Critical;
+ case QMessageBox::Question:
+ return QMessageDialogOptions::Question;
+ }
+ return QMessageDialogOptions::NoIcon;
+}
+
+static QMessageDialogOptions::StandardButtons helperStandardButtons(QMessageBox * q)
+{
+ QMessageDialogOptions::StandardButtons buttons(int(q->standardButtons()));
+ return buttons;
+}
+
+void QMessageBoxPrivate::helperPrepareShow(QPlatformDialogHelper *)
+{
+ Q_Q(QMessageBox);
+ options->setWindowTitle(q->windowTitle());
+ options->setText(q->text());
+ options->setInformativeText(q->informativeText());
+ options->setDetailedText(q->detailedText());
+ options->setIcon(helperIcon(q->icon()));
+ options->setStandardButtons(helperStandardButtons(q));
+}
+
+void QMessageBoxPrivate::helperDone(QDialog::DialogCode code, QPlatformDialogHelper *)
+{
+ Q_Q(QMessageBox);
+ clickedButton = q->button(QMessageBox::StandardButton(code));
+}
+
/*!
\obsolete
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index 58be13426c..c5598a8f1d 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -309,6 +309,7 @@ protected:
private:
Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *))
+ Q_PRIVATE_SLOT(d_func(), void _q_clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole))
Q_DISABLE_COPY(QMessageBox)
Q_DECLARE_PRIVATE(QMessageBox)
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 02ad5a3be5..a667f299e8 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1345,6 +1345,33 @@ void QWizardPrivate::updateCurrentPage()
updateButtonTexts();
}
+static QString object_name_for_button(QWizard::WizardButton which)
+{
+ switch (which) {
+ case QWizard::CommitButton:
+ return QLatin1String("qt_wizard_") + QLatin1String("commit");
+ case QWizard::FinishButton:
+ return QLatin1String("qt_wizard_") + QLatin1String("finish");
+ case QWizard::CancelButton:
+ return QLatin1String("qt_wizard_") + QLatin1String("cancel");
+ case QWizard::BackButton:
+ case QWizard::NextButton:
+ case QWizard::HelpButton:
+ case QWizard::CustomButton1:
+ case QWizard::CustomButton2:
+ case QWizard::CustomButton3:
+ // Make navigation buttons detectable as passive interactor in designer
+ return QLatin1String("__qt__passive_wizardbutton") + QString::number(which);
+ case QWizard::Stretch:
+ case QWizard::NoButton:
+ //case QWizard::NStandardButtons:
+ //case QWizard::NButtons:
+ ;
+ }
+ Q_UNREACHABLE();
+ return QString();
+}
+
bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
{
Q_Q(const QWizard);
@@ -1356,19 +1383,7 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
QStyle *style = q->style();
if (style != QApplication::style()) // Propagate style
pushButton->setStyle(style);
- // Make navigation buttons detectable as passive interactor in designer
- switch (which) {
- case QWizard::CommitButton:
- case QWizard::FinishButton:
- case QWizard::CancelButton:
- break;
- default: {
- QString objectName = QLatin1String("__qt__passive_wizardbutton");
- objectName += QString::number(which);
- pushButton->setObjectName(objectName);
- }
- break;
- }
+ pushButton->setObjectName(object_name_for_button(which));
#ifdef Q_OS_MACX
pushButton->setAutoDefault(false);
#endif
diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf
index d3c7825bc0..b742856892 100644
--- a/src/widgets/doc/qtwidgets.qdocconf
+++ b/src/widgets/doc/qtwidgets.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtWidgets
description = Qt Widgets Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtwidgets
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = widgets
diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
index f74da2fa0a..99d512b507 100644
--- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
@@ -32,8 +32,8 @@
\brief A tour of the standard layout managers and an introduction to custom
layouts.
- \previouspage Widgets and Layouts
- \contentspage Widgets and Layouts
+ \previouspage Qt Widgets
+ \contentspage Qt Widgets
\nextpage {Styles and Style Aware Widgets}{Styles}
\ingroup frameworks-technologies
diff --git a/src/widgets/doc/src/widgets-tutorial.qdoc b/src/widgets/doc/src/widgets-tutorial.qdoc
index 985a430cba..d4cf063231 100644
--- a/src/widgets/doc/src/widgets-tutorial.qdoc
+++ b/src/widgets/doc/src/widgets-tutorial.qdoc
@@ -89,7 +89,7 @@
\section1 Real world widget examples
- In these \l{Widget examples} {more advanced examples}, the code
+ In these \l{Qt Widgets Examples} {more advanced examples}, the code
that creates the widgets and layouts is stored in other files. For
example, the GUI for a main window may be created in the
constructor of a QMainWindow subclass.
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 7cab132a2e..a4adb3d20b 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -10307,7 +10307,9 @@ void QGraphicsTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const
{
QVariant v;
- if (dd->control)
+ if (query == Qt::ImHints)
+ v = int(inputMethodHints());
+ else if (dd->control)
v = dd->control->inputMethodQuery(query);
if (v.type() == QVariant::RectF)
v = v.toRectF().translated(-dd->controlOffset());
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index ad7a82518e..41d4fc925a 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4147,8 +4147,9 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
wheelEvent->widget()));
wheelEvent->accept();
bool isPanel = item->isPanel();
- d->sendEvent(item, wheelEvent);
- if (isPanel || wheelEvent->isAccepted())
+ bool ret = d->sendEvent(item, wheelEvent);
+
+ if (ret && (isPanel || wheelEvent->isAccepted()))
break;
}
}
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index 14cd7007ba..e1dd23f177 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -90,11 +90,6 @@ qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options
{
Q_Q(const QGraphicsWidget);
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle*>(q->style())) {
- height -=4;
- }
-#endif
return (qreal)height;
}
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 726c2704c4..7edad74f54 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1042,7 +1042,7 @@ QAbstractItemView::SelectionBehavior QAbstractItemView::selectionBehavior() cons
Sets the current item to be the item at \a index.
Unless the current selection mode is
- \l{QAbstractItemView::}{NoSelection}, the item is also be selected.
+ \l{QAbstractItemView::}{NoSelection}, the item is also selected.
Note that this function also updates the starting position for any
new selections the user performs.
@@ -1391,6 +1391,15 @@ bool QAbstractItemView::showDropIndicator() const
}
/*!
+ \since 5.2
+ \reimp
+*/
+QSize QAbstractItemView::viewportSizeHint() const
+{
+ return QAbstractScrollArea::viewportSizeHint();
+}
+
+/*!
\property QAbstractItemView::dragEnabled
\brief whether the view supports dragging of its own items
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 96428515ae..4f9cd7b1c6 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -346,6 +346,8 @@ protected:
DropIndicatorPosition dropIndicatorPosition() const;
#endif
+ QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+
private:
Q_DECLARE_PRIVATE(QAbstractItemView)
Q_DISABLE_COPY(QAbstractItemView)
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 1131ef030e..75a513fb67 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1337,18 +1337,13 @@ QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const
and QTreeView::sizeHintForColumn(). Reimplementing these functions can make this
function not having an effect.
- If \a resizeSectionsNow is set to true (default) it will do adjustment of sections by calling
- resizeSections(). (regardless if the precision was changed).
-
\sa resizeContentsPrecision(), setSectionResizeMode(), resizeSections(), QTableView::sizeHintForColumn(), QTableView::sizeHintForRow(), QTreeView::sizeHintForColumn()
*/
-void QHeaderView::setResizeContentsPrecision(int precision, bool resizeSectionsNow)
+void QHeaderView::setResizeContentsPrecision(int precision)
{
Q_D(QHeaderView);
d->resizeContentsPrecision = precision;
- if (resizeSectionsNow)
- resizeSections();
}
/*!
@@ -1604,7 +1599,7 @@ int QHeaderView::minimumSectionSize() const
void QHeaderView::setMinimumSectionSize(int size)
{
Q_D(QHeaderView);
- if (size < 0 || size > maxSizeSection)
+ if (size < -1 || size > maxSizeSection)
return;
d->minimumSectionSize = size;
if (d->minimumSectionSize > maximumSectionSize())
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index b3ed666aa6..bfe36e9b19 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -135,7 +135,7 @@ public:
void setSectionResizeMode(ResizeMode mode);
void setSectionResizeMode(int logicalIndex, ResizeMode mode);
- void setResizeContentsPrecision(int precision, bool resizeNow = true);
+ void setResizeContentsPrecision(int precision);
int resizeContentsPrecision() const;
#if QT_DEPRECATED_SINCE(5, 0)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 616a832b88..0cca52daa2 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -3200,6 +3200,16 @@ int QListView::visualIndex(const QModelIndex &index) const
return visualIndex;
}
+
+/*!
+ \since 5.2
+ \reimp
+*/
+QSize QListView::viewportSizeHint() const
+{
+ return QAbstractItemView::viewportSizeHint();
+}
+
QT_END_NAMESPACE
#endif // QT_NO_LISTVIEW
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index e4ae2d03fd..a973dfb221 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -180,6 +180,8 @@ protected:
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void currentChanged(const QModelIndex &current, const QModelIndex &previous);
+ QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+
private:
int visualIndex(const QModelIndex &index) const;
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index aa1dbf1de3..5040192f31 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -1456,7 +1456,7 @@ QListWidgetItem *QListWidget::currentItem() const
Sets the current item to \a item.
Unless the selection mode is \l{QAbstractItemView::}{NoSelection},
- the item is also be selected.
+ the item is also selected.
*/
void QListWidget::setCurrentItem(QListWidgetItem *item)
{
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index db956480d6..387d24c608 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -118,8 +118,6 @@ public:
void sortByColumn(int column, Qt::SortOrder order);
- QSize viewportSizeHint() const;
-
public Q_SLOTS:
void selectRow(int row);
void selectColumn(int column);
@@ -161,6 +159,8 @@ protected:
void updateGeometries();
+ QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+
int sizeHintForRow(int row) const;
int sizeHintForColumn(int column) const;
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 43b6b62cc1..71034f6165 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -2125,7 +2125,7 @@ QTableWidgetItem *QTableWidget::currentItem() const
Sets the current item to \a item.
Unless the selection mode is \l{QAbstractItemView::}{NoSelection},
- the item is also be selected.
+ the item is also selected.
\sa currentItem(), setCurrentCell()
*/
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 792b75ac69..4d0eb5c3ad 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -2858,6 +2858,21 @@ int QTreeView::sizeHintForColumn(int column) const
int offset = 0;
int start = d->firstVisibleItem(&offset);
int end = d->lastVisibleItem(start, offset);
+ if (start < 0 || end < 0 || end == viewItems.size() - 1) {
+ end = viewItems.size() - 1;
+ if (maximumProcessRows < 0) {
+ start = 0;
+ } else if (maximumProcessRows == 0) {
+ start = qMax(0, end - 1);
+ int remainingHeight = viewport()->height();
+ while (start > 0 && remainingHeight > 0) {
+ remainingHeight -= d->itemHeight(start);
+ --start;
+ }
+ } else {
+ start = qMax(0, end - maximumProcessRows);
+ }
+ }
int rowsProcessed = 0;
@@ -3606,8 +3621,11 @@ int QTreeViewPrivate::firstVisibleItem(int *offset) const
int QTreeViewPrivate::lastVisibleItem(int firstVisual, int offset) const
{
- if (firstVisual < 0 || offset < 0)
+ if (firstVisual < 0 || offset < 0) {
firstVisual = firstVisibleItem(&offset);
+ if (firstVisual < 0)
+ return -1;
+ }
int y = - offset;
int value = viewport->height();
@@ -3888,6 +3906,14 @@ void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order)
model->sort(column, order);
}
+int QTreeViewPrivate::accessibleTree2Index(const QModelIndex &index) const
+{
+ Q_Q(const QTreeView);
+
+ // Note that this will include the header, even if its hidden.
+ return (q->visualIndex(index) + (q->header() ? 1 : 0)) * index.model()->columnCount() + index.column();
+}
+
/*!
\reimp
*/
@@ -3911,8 +3937,10 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
}
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive() && current.isValid()) {
+ Q_D(QTreeView);
+
QAccessibleEvent event(this, QAccessible::Focus);
- event.setChild(accessibleTree2Index(current));
+ event.setChild(d->accessibleTree2Index(current));
QAccessible::updateAccessibility(&event);
}
#endif
@@ -3927,10 +3955,12 @@ void QTreeView::selectionChanged(const QItemSelection &selected,
QAbstractItemView::selectionChanged(selected, deselected);
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
+ Q_D(QTreeView);
+
// ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
- int entry = accessibleTree2Index(sel);
+ int entry = d->accessibleTree2Index(sel);
Q_ASSERT(entry >= 0);
QAccessibleEvent event(this, QAccessible::Selection);
event.setChild(entry);
@@ -3938,7 +3968,7 @@ void QTreeView::selectionChanged(const QItemSelection &selected,
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
- int entry = accessibleTree2Index(desel);
+ int entry = d->accessibleTree2Index(desel);
Q_ASSERT(entry >= 0);
QAccessibleEvent event(this, QAccessible::SelectionRemove);
event.setChild(entry);
@@ -3955,13 +3985,6 @@ int QTreeView::visualIndex(const QModelIndex &index) const
return d->viewIndex(index);
}
-int QTreeView::accessibleTree2Index(const QModelIndex &index) const
-{
- // Note that this will include the header, even if its hidden.
- return (visualIndex(index) + (header() ? 1 : 0)) * index.model()->columnCount() + index.column();
-}
-
-
QT_END_NAMESPACE
#include "moc_qtreeview.cpp"
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index a29e9b64b0..429b9d3add 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -147,8 +147,6 @@ public:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
void selectAll();
- QSize viewportSizeHint() const;
-
Q_SIGNALS:
void expanded(const QModelIndex &index);
void collapsed(const QModelIndex &index);
@@ -208,6 +206,8 @@ protected:
void updateGeometries();
+ QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+
int sizeHintForColumn(int column) const;
int indexRowSizeHint(const QModelIndex &index) const;
int rowHeight(const QModelIndex &index) const;
@@ -224,7 +224,6 @@ private:
friend class QAccessibleTree;
friend class QAccessibleTableCell;
int visualIndex(const QModelIndex &index) const;
- int accessibleTree2Index(const QModelIndex &index) const;
Q_DECLARE_PRIVATE(QTreeView)
Q_DISABLE_COPY(QTreeView)
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index 89de435606..5d6333e856 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -239,6 +239,8 @@ public:
return (viewIndex(index) + (header ? 1 : 0)) * model->columnCount()+index.column();
}
+ int accessibleTree2Index(const QModelIndex &index) const;
+
// used for spanning rows
QVector<QPersistentModelIndex> spanningIndexes;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 210cb29120..57a2063b78 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -111,13 +111,10 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
static void initResources()
{
#if defined(Q_OS_WINCE)
- Q_INIT_RESOURCE_EXTERN(qstyle_wince)
Q_INIT_RESOURCE(qstyle_wince);
#else
- Q_INIT_RESOURCE_EXTERN(qstyle)
Q_INIT_RESOURCE(qstyle);
#endif
- Q_INIT_RESOURCE_EXTERN(qmessagebox)
Q_INIT_RESOURCE(qmessagebox);
}
@@ -3762,6 +3759,16 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven
}
if (focusWidget->isWindow())
break;
+
+ // find out whether this widget (or its proxy) already has focus
+ QWidget *f = focusWidget;
+ if (focusWidget->d_func()->extra && focusWidget->d_func()->extra->focus_proxy)
+ f = focusWidget->d_func()->extra->focus_proxy;
+ // if it has, stop here.
+ // otherwise a click on the focused widget would remove its focus if ClickFocus isn't set
+ if (f->hasFocus())
+ break;
+
localPos += focusWidget->pos();
focusWidget = focusWidget->parentWidget();
}
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index e1376c754f..c1d3e95e7a 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -641,7 +641,7 @@ static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing
spacing = qMax(spacing, prevItem2->geometry().top() - wid->geometry().top() );
}
}
- return spacing;
+ return qMax(spacing, 0);
}
static inline void initLayoutStruct(QLayoutStruct& sl, QFormLayoutItem* item)
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index cd2891d829..eb21a580b1 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1112,18 +1112,26 @@ bool QLayout::activate()
\since 5.2
Searches for widget \a from and replaces it with widget \a to if found.
- Returns the layout item that contains the widget \a from on success. Otherwise \c 0 is returned.
- If \a recursive is \c true, sub-layouts are searched for doing the replacement. Notice that the returned item therefore might not belong to this layout, but to a sub-layout.
+ Returns the layout item that contains the widget \a from on success.
+ Otherwise \c 0 is returned. If \a options contains \c Qt::FindChildrenRecursively
+ (the default), sub-layouts are searched for doing the replacement.
+ Any other flag in \a options is ignored.
- The returned layout item is no longer owned by the layout and should be either deleted or inserted to another layout. The widget \a from is no longer managed by the layout and may need to be deleted or hidden. The parent of widget \a from is left unchanged.
+ Notice that the returned item therefore might not belong to this layout,
+ but to a sub-layout.
- This function works for the built-in Qt layouts, but might not work for custom layouts.
+ The returned layout item is no longer owned by the layout and should be
+ either deleted or inserted to another layout. The widget \a from is no
+ longer managed by the layout and may need to be deleted or hidden. The
+ parent of widget \a from is left unchanged.
+
+ This function works for the built-in Qt layouts, but might not work for
+ custom layouts.
\sa indexOf()
*/
-//### Qt 6 make this function virtual
-QLayoutItem* QLayout::replaceWidget(QWidget *from, QWidget *to, bool recursive)
+QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options)
{
Q_D(QLayout);
if (!from || !to)
@@ -1133,12 +1141,16 @@ QLayoutItem* QLayout::replaceWidget(QWidget *from, QWidget *to, bool recursive)
QLayoutItem *item = 0;
for (int u = 0; u < count(); ++u) {
item = itemAt(u);
+ if (!item)
+ continue;
+
if (item->widget() == from) {
index = u;
break;
}
- if (item && item->layout() && recursive) {
- QLayoutItem *r = item->layout()->replaceWidget(from, to, true);
+
+ if (item->layout() && (options & Qt::FindChildrenRecursively)) {
+ QLayoutItem *r = item->layout()->replaceWidget(from, to, options);
if (r)
return r;
}
diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
index ca5f6d42ea..27d9d34b9c 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -130,7 +130,9 @@ public:
virtual int count() const = 0;
bool isEmpty() const;
QSizePolicy::ControlTypes controlTypes() const;
- QLayoutItem* replaceWidget(QWidget *from, QWidget *to, bool recursive = true);
+
+ // ### Qt 6 make this function virtual
+ QLayoutItem *replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options = Qt::FindChildrenRecursively);
int totalHeightForWidth(int w) const;
QSize totalMinimumSize() const;
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 55459ac1ac..0d8e20ca0c 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -289,7 +289,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
#endif
{
if (!qApp) {
- qFatal("QWidget: Must construct a QApplication before a QPaintDevice");
+ qFatal("QWidget: Must construct a QApplication before a QWidget");
return;
}
@@ -6999,21 +6999,23 @@ void QWidget::setUpdatesEnabled(bool enable)
}
/*!
- Shows the widget and its child widgets. This function is
- equivalent to setVisible(true) in the normal case, and equivalent
- to showFullScreen() if the QStyleHints::showIsFullScreen() hint
- is true and the window is not a popup.
+ Shows the widget and its child widgets.
- \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(),
- showNormal(), isVisible(), windowFlags()
+ This is equivalent to calling showFullScreen(), showMaximized(), or setVisible(true),
+ depending on the platform's default behavior for the window flags.
+
+ \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(),
+ showNormal(), isVisible(), windowFlags(), flags()
*/
void QWidget::show()
{
- bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window;
- if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen())
+ Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(data->window_flags);
+ if (defaultState == Qt::WindowFullScreen)
showFullScreen();
+ else if (defaultState == Qt::WindowMaximized)
+ showMaximized();
else
- setVisible(true);
+ setVisible(true); // FIXME: Why not showNormal(), like QWindow::show()?
}
/*! \internal
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index a9eeaa5470..159011b824 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -733,6 +733,7 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
+#ifndef Q_QDOC
template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
{
if (!o || !o->isWidgetType()) return 0;
@@ -743,6 +744,7 @@ template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
if (!o || !o->isWidgetType()) return 0;
return static_cast<const QWidget*>(o);
}
+#endif // !Q_QDOC
inline QWidget *QWidget::childAt(int ax, int ay) const
{ return childAt(QPoint(ax, ay)); }
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index ae8a0b25b9..93234f3958 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -53,6 +53,7 @@
#include <qpa/qplatformintegration.h>
#include "QtGui/private/qwindow_p.h"
#include "QtGui/private/qguiapplication_p.h"
+#include <private/qwindowcontainer_p.h>
#include <qpa/qplatformcursor.h>
#include <QtGui/QGuiApplication>
@@ -267,8 +268,11 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
// Reparenting toplevel to child
- if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow))
+ if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) {
+ if (extra && extra->hasWindowContainer)
+ QWindowContainer::toplevelAboutToBeDestroyed(q);
q->destroy();
+ }
adjustFlags(f, q);
data.window_flags = f;
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index 39583c8caa..b6c3e13cb0 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -240,7 +240,13 @@ private:
}
inline bool hasStaticContents() const
- { return !staticWidgets.isEmpty() && false; }
+ {
+#if defined(Q_OS_WIN)
+ return !staticWidgets.isEmpty();
+#else
+ return !staticWidgets.isEmpty() && false;
+#endif
+ }
friend QRegion qt_dirtyRegion(QWidget *);
friend class QWidgetPrivate;
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 51a0eb7d72..2e96247873 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -76,6 +76,13 @@ public:
}
return w;
}
+
+ void clearFocusObject()
+ {
+ if (QApplicationPrivate::focus_widget)
+ QApplicationPrivate::focus_widget->clearFocus();
+ }
+
};
QWidgetWindow::QWidgetWindow(QWidget *widget)
@@ -244,7 +251,9 @@ bool QWidgetWindow::event(QEvent *event)
case QEvent::Show:
case QEvent::Hide:
return QWindow::event(event);
-
+ case QEvent::WindowBlocked:
+ qt_button_down = 0;
+ break;
default:
break;
}
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index 6914f64f8e..399f089e0f 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -222,6 +222,11 @@ void QWindowContainer::focusWindowChanged(QWindow *focusWindow)
{
Q_D(QWindowContainer);
d->oldFocusWindow = focusWindow;
+ if (focusWindow == d->window) {
+ QWidget *widget = QApplication::focusWidget();
+ if (widget)
+ widget->clearFocus();
+ }
}
/*!
@@ -300,15 +305,28 @@ static void qwindowcontainer_traverse(QWidget *parent, qwindowcontainer_traverse
}
}
+void QWindowContainer::toplevelAboutToBeDestroyed(QWidget *parent)
+{
+ if (QWindowContainerPrivate *d = QWindowContainerPrivate::get(parent)) {
+ d->window->setParent(&d->fakeParent);
+ }
+ qwindowcontainer_traverse(parent, toplevelAboutToBeDestroyed);
+}
+
void QWindowContainer::parentWasChanged(QWidget *parent)
{
if (QWindowContainerPrivate *d = QWindowContainerPrivate::get(parent)) {
if (d->window->parent()) {
d->updateUsesNativeWidgets();
d->markParentChain();
- d->window->setParent(d->usesNativeWidgets
- ? parent->windowHandle()
- : parent->window()->windowHandle());
+ QWidget *toplevel = d->usesNativeWidgets ? parent : parent->window();
+ if (!toplevel->windowHandle()) {
+ QWidgetPrivate *tld = static_cast<QWidgetPrivate *>(QWidgetPrivate::get(toplevel));
+ tld->createTLExtra();
+ tld->createTLSysExtra();
+ Q_ASSERT(toplevel->windowHandle());
+ }
+ d->window->setParent(toplevel->windowHandle());
d->updateGeometry();
}
}
diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h
index e2446bef42..a21f9bd35a 100644
--- a/src/widgets/kernel/qwindowcontainer_p.h
+++ b/src/widgets/kernel/qwindowcontainer_p.h
@@ -57,6 +57,7 @@ public:
explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = 0, Qt::WindowFlags f = 0);
~QWindowContainer();
+ static void toplevelAboutToBeDestroyed(QWidget *parent);
static void parentWasChanged(QWidget *parent);
static void parentWasMoved(QWidget *parent);
static void parentWasRaised(QWidget *parent);
diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri
index 18bd692476..76bb709e2b 100644
--- a/src/widgets/kernel/win.pri
+++ b/src/widgets/kernel/win.pri
@@ -3,5 +3,5 @@
INCLUDEPATH += ../3rdparty/wintab
!wince*:!winrt {
- LIBS *= -lshell32
+ LIBS_PRIVATE *= -lshell32
}
diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp
index afd6c3024c..ceb95aa125 100644
--- a/src/widgets/styles/qandroidstyle.cpp
+++ b/src/widgets/styles/qandroidstyle.cpp
@@ -515,8 +515,15 @@ void QAndroidStyle::drawPrimitive(PrimitiveElement pe,
AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
? m_androidControlsHash.find(itemType)
: m_androidControlsHash.end();
- if (it != m_androidControlsHash.end())
- it.value()->drawControl(opt, p, w);
+ if (it != m_androidControlsHash.end()) {
+ if (itemType != QC_EditText)
+ it.value()->drawControl(opt, p, w);
+ else {
+ QStyleOption copy(*opt);
+ copy.state &= ~QStyle::State_Sunken;
+ it.value()->drawControl(&copy, p, w);
+ }
+ }
else
QFusionStyle::drawPrimitive(pe, opt, p, w);
}
@@ -696,7 +703,10 @@ int QAndroidStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option,
{
switch (hint) {
case SH_Slider_AbsoluteSetButtons:
- return 1;
+ return Qt::LeftButton;
+
+ case SH_Slider_PageSetButtons:
+ return 0;
case SH_RequestSoftwareInputPanel:
return RSIP_OnMouseClick;
@@ -1776,9 +1786,9 @@ QRect QAndroidStyle::AndroidSeekBarControl::subControlRect(const QStyleOptionCom
drawable = static_cast<const QAndroidStyle::AndroidStateDrawable *>(m_seekBarThumb)->bestAndroidStateMatch(option);
QRect r(option->rect);
- double factor = double(styleOption->sliderPosition/(styleOption->maximum-styleOption->minimum));
- int pos=(double(option->rect.width()*factor - drawable->size().width()) / 2);
- r.setX(r.x()+pos);
+ double factor = double(styleOption->sliderPosition) / (styleOption->maximum - styleOption->minimum);
+ int pos = option->rect.width() * factor - double(drawable->size().width() / 2);
+ r.setX(r.x() + pos);
r.setSize(drawable->size());
return r;
}
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 7f0813c303..a9f1c3bbbc 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -4251,7 +4251,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
if (sc == SC_GroupBoxCheckBox) {
int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget);
left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
- int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
+ int top = totalRect.top() + qMax(0, fontMetrics.height() - indicatorHeight) / 2;
totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
// Adjust for label
} else {
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 0b860450d1..5db4801c37 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2191,7 +2191,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
HIRect rect;
ptrHIShapeGetBounds(region, &rect);
ret = int(rect.size.height);
- ret += 4;
}
break;
case PM_TabBarTabVSpace:
@@ -3791,7 +3790,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} else if (!(tabOpt->state & State_Enabled)) {
tdi.style = kThemeTabNonFrontInactive;
} else if (tabOpt->state & State_Sunken) {
- tdi.style = kThemeTabFrontInactive; // (should be kThemeTabNonFrontPressed)
+ tdi.style = kThemeTabNonFrontPressed;
}
if (tabOpt->state & State_HasFocus)
tdi.adornment = kHIThemeTabAdornmentFocus;
@@ -3866,8 +3865,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
ThemeTabDirection ttd = getTabDirection(myTab.shape);
bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
bool selected = (myTab.state & QStyle::State_Selected);
+ bool usingModernOSX = QSysInfo::MacintoshVersion > QSysInfo::MV_10_6;
- if (selected && !myTab.documentMode)
+ if (usingModernOSX && selected && !myTab.documentMode)
myTab.palette.setColor(QPalette::WindowText, QColor(Qt::white));
// Check to see if we use have the same as the system font
@@ -3875,7 +3875,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// outside world, unless they read the source, in which case, it's
// their own fault).
bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem");
- if (selected || verticalTabs || nonDefaultFont || !tab->icon.isNull()
+ if ((usingModernOSX && selected) || verticalTabs || nonDefaultFont || !tab->icon.isNull()
|| !myTab.leftButtonSize.isNull() || !myTab.rightButtonSize.isNull()) {
int heightOffset = 0;
if (verticalTabs) {
@@ -3886,7 +3886,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
myTab.rect.setHeight(myTab.rect.height() + heightOffset);
- if (myTab.documentMode || selected) {
+ if (myTab.documentMode || (usingModernOSX && selected)) {
p->save();
rotateTabPainter(p, myTab.shape, myTab.rect);
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 417e092e11..ab98dfbdcf 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4821,7 +4821,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
QSize defaultUpSize = defaultSize(w, subRule.size(), spinbox->rect, PseudoElement_SpinBoxUpButton);
sz += QSize(defaultUpSize.width(), 0);
}
- if (rule.hasBox() || !rule.hasNativeBorder())
+ if (rule.hasBox() || rule.hasBorder() || !rule.hasNativeBorder())
sz = rule.boxSize(sz);
return sz;
}
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 9789c453f3..6b183d3759 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -46,6 +46,7 @@
#include <QtWidgets/qdialog.h>
#include <QtWidgets/qapplication.h>
#include <private/qwidget_p.h>
+#include <QtGui/qpa/qplatformdialoghelper.h>
#include <QtWidgets/qaction.h>
#include "qdialogbuttonbox.h"
@@ -166,46 +167,8 @@ enum {
static QDialogButtonBox::ButtonRole roleFor(QDialogButtonBox::StandardButton button)
{
- switch (button) {
- case QDialogButtonBox::Ok:
- case QDialogButtonBox::Save:
- case QDialogButtonBox::Open:
- case QDialogButtonBox::SaveAll:
- case QDialogButtonBox::Retry:
- case QDialogButtonBox::Ignore:
- return QDialogButtonBox::AcceptRole;
-
- case QDialogButtonBox::Cancel:
- case QDialogButtonBox::Close:
- case QDialogButtonBox::Abort:
- return QDialogButtonBox::RejectRole;
-
- case QDialogButtonBox::Discard:
- return QDialogButtonBox::DestructiveRole;
-
- case QDialogButtonBox::Help:
- return QDialogButtonBox::HelpRole;
-
- case QDialogButtonBox::Apply:
- return QDialogButtonBox::ApplyRole;
-
- case QDialogButtonBox::Yes:
- case QDialogButtonBox::YesToAll:
- return QDialogButtonBox::YesRole;
-
- case QDialogButtonBox::No:
- case QDialogButtonBox::NoToAll:
- return QDialogButtonBox::NoRole;
-
- case QDialogButtonBox::RestoreDefaults:
- case QDialogButtonBox::Reset:
- return QDialogButtonBox::ResetRole;
-
- case QDialogButtonBox::NoButton: // NoButton means zero buttons, not "No" button
- ;
- }
-
- return QDialogButtonBox::InvalidRole;
+ return static_cast<QDialogButtonBox::ButtonRole>(QMessageDialogOptions::buttonRole(
+ static_cast<QMessageDialogOptions::StandardButton>(button)));
}
static const uint layouts[2][5][14] =
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 8b151e65bd..46929397a0 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -455,14 +455,6 @@ int QDockWidgetLayout::titleHeight() const
perp(verticalTitleBar, floatSize));
QFontMetrics titleFontMetrics = q->fontMetrics();
-#ifdef Q_WS_MAC
- if (qobject_cast<QMacStyle *>(q->style())) {
- //### this breaks on proxy styles. (But is this code still called?)
- QFont font = qt_app_fonts_hash()->value("QToolButton", q->font());
- titleFontMetrics = QFontMetrics(font);
- }
-#endif
-
int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw);
diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp
index a1915e41ef..c056967cf7 100644
--- a/src/widgets/widgets/qkeysequenceedit.cpp
+++ b/src/widgets/widgets/qkeysequenceedit.cpp
@@ -50,11 +50,14 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_KEYSEQUENCEEDIT
+Q_STATIC_ASSERT(QKeySequencePrivate::MaxKeyCount == 4); // assumed by the code around here
+
void QKeySequenceEditPrivate::init()
{
Q_Q(QKeySequenceEdit);
lineEdit = new QLineEdit(q);
+ lineEdit->setObjectName(QStringLiteral("qt_keysequenceedit_lineedit"));
keyNum = 0;
prevKey = -1;
releaseTimer = 0;
@@ -221,15 +224,7 @@ void QKeySequenceEdit::setKeySequence(const QKeySequence &keySequence)
*/
void QKeySequenceEdit::clear()
{
- Q_D(QKeySequenceEdit);
-
- d->resetState();
-
- d->lineEdit->clear();
- d->keySequence = QKeySequence();
- d->keyNum = d->key[0] = d->key[1] = d->key[2] = d->key[3] = 0;
- d->prevKey = -1;
- emit keySequenceChanged(d->keySequence);
+ setKeySequence(QKeySequence());
}
/*!
@@ -279,7 +274,7 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
return;
}
- if (d->keyNum >= QKeySequenceEditPrivate::MaxKeyCount)
+ if (d->keyNum >= QKeySequencePrivate::MaxKeyCount)
return;
nextKey |= d->translateModifiers(e->modifiers(), e->text());
@@ -290,7 +285,7 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
QKeySequence key(d->key[0], d->key[1], d->key[2], d->key[3]);
d->keySequence = key;
QString text = key.toString(QKeySequence::NativeText);
- if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount) {
+ if (d->keyNum < QKeySequencePrivate::MaxKeyCount) {
//: This text is an "unfinished" shortcut, expands like "Ctrl+A, ..."
text = tr("%1, ...").arg(text);
}
@@ -306,7 +301,7 @@ void QKeySequenceEdit::keyReleaseEvent(QKeyEvent *e)
Q_D(QKeySequenceEdit);
if (d->prevKey == e->key()) {
- if (d->keyNum < QKeySequenceEditPrivate::MaxKeyCount)
+ if (d->keyNum < QKeySequencePrivate::MaxKeyCount)
d->releaseTimer = startTimer(1000);
else
d->finishEditing();
diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h
index 9312e98d0e..7eeff4e504 100644
--- a/src/widgets/widgets/qkeysequenceedit.h
+++ b/src/widgets/widgets/qkeysequenceedit.h
@@ -53,7 +53,7 @@ class QKeySequenceEditPrivate;
class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget
{
Q_OBJECT
- Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence RESET clear NOTIFY keySequenceChanged USER true)
+ Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence NOTIFY keySequenceChanged USER true)
public:
explicit QKeySequenceEdit(QWidget *parent = 0);
@@ -61,9 +61,9 @@ public:
~QKeySequenceEdit();
QKeySequence keySequence() const;
- void setKeySequence(const QKeySequence &keySequence);
public Q_SLOTS:
+ void setKeySequence(const QKeySequence &keySequence);
void clear();
Q_SIGNALS:
diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h
index 58c9699059..f74433bb71 100644
--- a/src/widgets/widgets/qkeysequenceedit_p.h
+++ b/src/widgets/widgets/qkeysequenceedit_p.h
@@ -46,6 +46,7 @@
#include "qkeysequenceedit.h"
#include <private/qwidget_p.h>
+#include <private/qkeysequence_p.h>
QT_BEGIN_NAMESPACE
@@ -57,8 +58,6 @@ class QKeySequenceEditPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QKeySequenceEdit)
public:
- enum { MaxKeyCount = 4 };
-
void init();
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
void resetState();
@@ -67,7 +66,7 @@ public:
QLineEdit *lineEdit;
QKeySequence keySequence;
int keyNum;
- int key[MaxKeyCount];
+ int key[QKeySequencePrivate::MaxKeyCount];
int prevKey;
int releaseTimer;
};
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index d3c37ab612..df5ae0171c 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -495,12 +495,13 @@ void QLineEdit::setClearButtonEnabled(bool enable)
return;
if (enable) {
QAction *clearAction = new QAction(d->clearButtonIcon(), QString(), this);
+ clearAction->setEnabled(!isReadOnly());
clearAction->setObjectName(QLatin1String(clearButtonActionNameC));
d->addAction(clearAction, 0, QLineEdit::TrailingPosition, QLineEditPrivate::SideWidgetClearButton | QLineEditPrivate::SideWidgetFadeInWithText);
} else {
QAction *clearAction = findChild<QAction *>(QLatin1String(clearButtonActionNameC));
Q_ASSERT(clearAction);
- removeAction(clearAction);
+ d->removeAction(clearAction);
delete clearAction;
}
}
@@ -1336,6 +1337,7 @@ void QLineEdit::setReadOnly(bool enable)
Q_D(QLineEdit);
if (d->control->isReadOnly() != enable) {
d->control->setReadOnly(enable);
+ d->setClearButtonEnabled(!enable);
setAttribute(Qt::WA_MacShowFocusRect, !enable);
setAttribute(Qt::WA_InputMethodEnabled, d->shouldEnableInputMethod());
#ifndef QT_NO_CURSOR
@@ -1439,7 +1441,7 @@ bool QLineEdit::event(QEvent * e)
d->setCursorVisible(true);
}
} else if (e->type() == QEvent::ActionRemoved) {
- d->removeAction(static_cast<QActionEvent *>(e));
+ d->removeAction(static_cast<QActionEvent *>(e)->action());
} else if (e->type() == QEvent::Resize) {
d->positionSideWidgets();
}
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 99d6d0b8d9..891839ed56 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -376,6 +376,16 @@ QIcon QLineEditPrivate::clearButtonIcon() const
return QIcon(q->style()->standardPixmap(QStyle::SP_LineEditClearButton, &styleOption, q));
}
+void QLineEditPrivate::setClearButtonEnabled(bool enabled)
+{
+ foreach (const SideWidgetEntry &e, trailingSideWidgets) {
+ if (e.flags & SideWidgetClearButton) {
+ e.action->setEnabled(enabled);
+ break;
+ }
+ }
+}
+
void QLineEditPrivate::positionSideWidgets()
{
Q_Q(QLineEdit);
@@ -445,10 +455,9 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
return w;
}
-void QLineEditPrivate::removeAction(const QActionEvent *e)
+void QLineEditPrivate::removeAction(QAction *action)
{
Q_Q(QLineEdit);
- QAction *action = e->action();
const PositionIndexPair positionIndex = findSideWidget(action);
if (positionIndex.second == -1)
return;
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 8fe45972ff..181a23449b 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -196,9 +196,10 @@ public:
QString placeholderText;
QWidget *addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition, int flags = 0);
- void removeAction(const QActionEvent *e);
+ void removeAction(QAction *action);
QSize iconSize() const;
QIcon clearButtonIcon() const;
+ void setClearButtonEnabled(bool enabled);
void positionSideWidgets();
inline bool hasSideWidgets() const { return !leadingSideWidgets.isEmpty() || !trailingSideWidgets.isEmpty(); }
inline const SideWidgetEntryList &leftSideWidgetList() const
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index ea33f40806..600d9b536f 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -354,11 +354,6 @@ void SimpleCascader::rearrange(QList<QWidget *> &widgets, const QRect &domain) c
QStyleOptionTitleBar options;
options.initFrom(widgets.at(0));
int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0));
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- // ### Remove this after the mac style has been fixed
- if (qobject_cast<QMacStyle *>(widgets.at(0)->style()))
- titleBarHeight -= 4;
-#endif
const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar"));
const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1);
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index b80eb069e2..8e1dcbee18 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -1710,11 +1710,6 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co
}
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
- // ### Fix mac style, the +4 pixels hack is not necessary anymore
- if (qobject_cast<QMacStyle *>(q->style()))
- height -= 4;
-#endif
if (hasBorder(options))
height += q->isMinimized() ? 8 : 4;
return height;
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index 70af5fbbd7..db1083f122 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -69,7 +69,6 @@ public:
void setWidgetResizable(bool resizable);
QSize sizeHint() const;
- QSize viewportSizeHint() const;
bool focusNextPrevChild(bool next);
@@ -86,6 +85,8 @@ protected:
void resizeEvent(QResizeEvent *);
void scrollContentsBy(int dx, int dy);
+ QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+
private:
Q_DECLARE_PRIVATE(QScrollArea)
Q_DISABLE_COPY(QScrollArea)
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 094e9af0de..dfd1f1022c 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1496,6 +1496,12 @@ bool QTabBar::event(QEvent *event)
}
}
#endif
+ } else if (event->type() == QEvent::MouseButtonDblClick) { // ### fixme Qt 6: move to mouseDoubleClickEvent(), here for BC reasons.
+ const QPoint pos = static_cast<const QMouseEvent *>(event)->pos();
+ const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos))
+ || (!d->rightB->isHidden() && d->rightB->geometry().contains(pos));
+ if (!isEventInCornerButtons)
+ emit tabBarDoubleClicked(tabAt(pos));
}
return QWidget::event(event);
}
@@ -1723,23 +1729,6 @@ void QTabBarPrivate::moveTab(int index, int offset)
q_func()->update();
}
-
-/*!
- \reimp
-*/
-void QTabBar::mouseDoubleClickEvent(QMouseEvent *event)
-{
- Q_D(QTabBar);
-
- const QPoint pos = event->pos();
- const bool isEventInCornerButtons = (!d->leftB->isHidden() && d->leftB->geometry().contains(pos))
- || (!d->rightB->isHidden() && d->rightB->geometry().contains(pos));
- if (!isEventInCornerButtons) {
- const int index = tabAt(pos);
- emit tabBarDoubleClicked(index);
- }
-}
-
/*!\reimp
*/
void QTabBar::mousePressEvent(QMouseEvent *event)
diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
index 1f7b8f6b03..a0e52c2f86 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -188,7 +188,6 @@ protected:
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);
void paintEvent(QPaintEvent *);
- void mouseDoubleClickEvent(QMouseEvent *);
void mousePressEvent (QMouseEvent *);
void mouseMoveEvent (QMouseEvent *);
void mouseReleaseEvent (QMouseEvent *);
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 0f61eb487f..49e05e8e14 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1513,6 +1513,14 @@ void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e)
if (layout)
layout->setViewport(QRect());
+
+ if (!placeholderText.isEmpty() && doc->isEmpty()) {
+ QColor col = control->palette().text().color();
+ col.setAlpha(128);
+ p->setPen(col);
+ const int margin = int(doc->documentMargin());
+ p->drawText(viewport->rect().adjusted(margin, margin, -margin, -margin), Qt::AlignTop | Qt::TextWordWrap, placeholderText);
+ }
}
/*! \fn void QTextEdit::paintEvent(QPaintEvent *event)
@@ -1528,13 +1536,6 @@ void QTextEdit::paintEvent(QPaintEvent *e)
Q_D(QTextEdit);
QPainter p(d->viewport);
d->paint(&p, e);
- if (!d->placeholderText.isEmpty() && d->control->document()->isEmpty()) {
- QColor col = palette().text().color();
- col.setAlpha(128);
- p.setPen(col);
- const int margin = int(document()->documentMargin());
- p.drawText(d->viewport->rect().adjusted(margin, margin, -margin, -margin), Qt::AlignTop | Qt::TextWordWrap, d->placeholderText);
- }
}
void QTextEditPrivate::_q_currentCharFormatChanged(const QTextCharFormat &fmt)
diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf
index f9c847e022..7f8fddfd11 100644
--- a/src/xml/doc/qtxml.qdocconf
+++ b/src/xml/doc/qtxml.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtXml
description = Qt XML Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtxml
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = xml
@@ -27,7 +27,7 @@ qhp.QtXml.subprojects.classes.sortPages = true
tagfile = ../../../doc/qtxml/qtxml.tags
-depends += qtcore qtnetwork
+depends += qtcore qtnetwork qtdoc
headerdirs += ..
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index 45c0f3e17b..f3a1e479f2 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -424,6 +424,12 @@ private:
int stringValueLen;
QString emptyStr;
+ // The limit to the amount of times the DTD parsing functions can be called
+ // for the DTD currently being parsed.
+ static const int dtdRecursionLimit = 2;
+ // The maximum amount of characters an entity value may contain, after expansion.
+ static const int entityCharacterLimit = 1024;
+
const QString &string();
void stringClear();
void stringAddC(QChar);
@@ -493,6 +499,8 @@ private:
void parseFailed(ParseFunction where, int state);
void pushParseState(ParseFunction function, int state);
+ bool isExpandedEntityValueTooLarge(QString *errorMessage);
+
Q_DECLARE_PUBLIC(QXmlSimpleReader)
QXmlSimpleReader *q_ptr;
@@ -5035,6 +5043,11 @@ bool QXmlSimpleReaderPrivate::parseDoctype()
}
break;
case Mup:
+ if (dtdRecursionLimit > 0 && parameterEntities.size() > dtdRecursionLimit) {
+ reportParseError(QString::fromLatin1(
+ "DTD parsing exceeded recursion limit of %1.").arg(dtdRecursionLimit));
+ return false;
+ }
if (!parseMarkupdecl()) {
parseFailed(&QXmlSimpleReaderPrivate::parseDoctype, state);
return false;
@@ -6644,6 +6657,50 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq()
return false;
}
+bool QXmlSimpleReaderPrivate::isExpandedEntityValueTooLarge(QString *errorMessage)
+{
+ QMap<QString, int> literalEntitySizes;
+ // The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times.
+ QMap<QString, QMap<QString, int> > referencesToOtherEntities;
+ QMap<QString, int> expandedSizes;
+
+ // For every entity, check how many times all entity names were referenced in its value.
+ foreach (QString toSearch, entities.keys()) {
+ // The amount of characters that weren't entity names, but literals, like 'X'.
+ QString leftOvers = entities.value(toSearch);
+ // How many times was entityName referenced by toSearch?
+ foreach (QString entityName, entities.keys()) {
+ for (int i = 0; i < leftOvers.size() && i != -1; ) {
+ i = leftOvers.indexOf(QString::fromLatin1("&%1;").arg(entityName), i);
+ if (i != -1) {
+ leftOvers.remove(i, entityName.size() + 2);
+ // The entityName we're currently trying to find was matched in this string; increase our count.
+ ++referencesToOtherEntities[toSearch][entityName];
+ }
+ }
+ }
+ literalEntitySizes[toSearch] = leftOvers.size();
+ }
+
+ foreach (QString entity, referencesToOtherEntities.keys()) {
+ expandedSizes[entity] = literalEntitySizes[entity];
+ foreach (QString referenceTo, referencesToOtherEntities.value(entity).keys()) {
+ const int references = referencesToOtherEntities.value(entity).value(referenceTo);
+ // The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size.
+ expandedSizes[entity] += expandedSizes[referenceTo] * references + literalEntitySizes[referenceTo] * references;
+ }
+
+ if (expandedSizes[entity] > entityCharacterLimit) {
+ if (errorMessage) {
+ *errorMessage = QString::fromLatin1("The XML entity \"%1\" expands too a string that is too large to process (%2 characters > %3).");
+ *errorMessage = (*errorMessage).arg(entity).arg(expandedSizes[entity]).arg(entityCharacterLimit);
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
/*
Parse a EntityDecl [70].
@@ -6738,6 +6795,12 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl()
switch (state) {
case EValue:
if ( !entityExist(name())) {
+ QString errorMessage;
+ if (isExpandedEntityValueTooLarge(&errorMessage)) {
+ reportParseError(errorMessage);
+ return false;
+ }
+
entities.insert(name(), string());
if (declHnd) {
if (!declHnd->internalEntityDecl(name(), string())) {
diff --git a/sync.profile b/sync.profile
index 74e29a7acf..7bd10b4865 100644
--- a/sync.profile
+++ b/sync.profile
@@ -59,7 +59,7 @@ my @zlib_headers = ( "zconf.h", "zlib.h" );
@ignore_headers = ( @internal_zlib_headers );
@ignore_for_include_check = ( "qsystemdetection.h", "qcompilerdetection.h", "qprocessordetection.h", @zlib_headers, @angle_headers);
@ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h", @zlib_headers, @angle_headers);
-%inject_headers = ( "$basedir/src/corelib/global" => [ "qconfig.h" ] );
+%inject_headers = ( "$basedir/src/corelib/global" => [ "qconfig.h", "qfeatures.h" ] );
# Module dependencies.
# Every module that is required to build this module should have one entry.
# Each of the module version specifiers can take one of the following values:
diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl
index d3c9a7bc11..1cc52d0495 100755
--- a/tests/auto/android/runtests_androiddeployqt.pl
+++ b/tests/auto/android/runtests_androiddeployqt.pl
@@ -53,6 +53,8 @@ use Pod::Usage;
my @stack = cwd;
my $device_serial=""; # "-s device_serial";
my $deployqt_device_serial=""; # "-device device_serial";
+my $log_out="xml";
+my $max_runtime = 5;
my $className="org.qtproject.qt5.android.bindings.QtActivity";
my $jobs = 4;
my $testsubset = "";
@@ -75,6 +77,8 @@ GetOptions('h|help' => \$help
, 't|test=s' => \$testsubset
, 'c|clean' => \$make_clean
, 'j|jobs=i' => \$jobs
+ , 'logtype=s' => \$log_out
+ , 'runtime=i' => \$max_runtime
, 'sdk=s' => \$android_sdk_dir
, 'ndk=s' => \$android_ndk_dir
, 'toolchain=s' => \$android_toolchain_version
@@ -102,7 +106,6 @@ if ($android_to_connect ne ""){
$device_serial =$android_to_connect;
}
-
system("$adb_tool devices") == 0 or die "No device found, please plug/start at least one device/emulator\n"; # make sure we have at least on device attached
$deployqt_device_serial = "--device $device_serial" if ($device_serial);
@@ -171,6 +174,8 @@ my $temp_dir=tempdir(CLEANUP => 1);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $output_dir=$stack[0]."/".(1900+$year)."-$mon-$mday-$hour:$min";
mkdir($output_dir);
+unlink("latest");
+system(" ln -s $output_dir latest");
my $sdk_api=0;
my $output = `$adb_tool $device_serial shell getprop`; # get device properties
if ($output =~ m/.*\[ro.build.version.sdk\]: \[(\d+)\]/)
@@ -186,8 +191,22 @@ sub startTest
my $packageName = "org.qtproject.example.tst_$testName";
my $intentName = "$packageName/org.qtproject.qt5.android.bindings.QtActivity";
my $output_file = shift;
+ my $get_xml= 0;
+ my $get_txt= 0;
+ my $testLib ="";
+ if ($log_out eq "xml") {
+ $testLib="-o /data/data/$packageName/output.xml,xml";
+ $get_xml = 1;
+ } elsif ($log_out eq "txt") {
+ $testLib="-o /data/data/$packageName/output.txt,txt";
+ $get_txt = 1;
+ } else {
+ $testLib="-o /data/data/$packageName/output.xml,xml -o /data/data/$packageName/output.txt,txt";
+ $get_xml = 1;
+ $get_txt = 1;
+ }
- system("$adb_tool $device_serial shell am start -e applicationArguments \"-o /data/data/$packageName/output.xml\" -n $intentName"); # start intent
+ system("$adb_tool $device_serial shell am start -e applicationArguments \"$testLib\" -n $intentName"); # start intent
#wait to start (if it has not started and quit already)
waitForProcess($packageName,1,10);
@@ -198,7 +217,8 @@ sub startTest
print "Someone should kill $packageName\n";
return 1;
}
- system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file");
+ system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file.xml") if ($get_xml);
+ system("$adb_tool $device_serial pull /data/data/$packageName/output.txt $output_dir/$output_file.txt") if ($get_txt);
return 1;
}
@@ -228,7 +248,7 @@ foreach (split("\n",$testsFiles))
$output_name =~ s/\///; # remove first "/" character
$output_name =~ s/\//_/g; # replace all "/" with "_"
$output_name=$application unless($output_name);
- $time_out=5*60/5; # 5 minutes time out for a normal test
+ $time_out=$max_runtime*60/5; # 5 minutes time out for a normal test
$applicationLibrary = `find $temp_dir -name libtst_bench_$application.so`;
@@ -248,7 +268,7 @@ foreach (split("\n",$testsFiles))
}
else
{
- startTest($application, "$output_name.xml") or warn "Can't run $application ...\n";
+ startTest($application, "$output_name") or warn "Can't run $application ...\n";
}
popd();
@@ -306,6 +326,14 @@ Android strip tool path, used to deploy qt libs.
Android readelf tool path, used to check if a test application uses qt OpenGL.
+=item B<--logtype = xml|txt|both>
+
+The format of log file, default is xml.
+
+=item B<--runtime = minutes>
+
+The timeout period before stopping individual tests from running.
+
=item B<-h --help>
Print a brief help message and exits.
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index e50a6b63fe..73a69a1309 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -99,7 +99,7 @@ void tst_QFlags::testFlagMultiBits() const
}
}
-template <int N, typename T> bool verifyConstExpr(T n) { return n == N; }
+template <unsigned int N, typename T> bool verifyConstExpr(T n) { return n == N; }
void tst_QFlags::constExpr()
{
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 4a50a45ea6..0d08e912f8 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -59,6 +59,7 @@ private slots:
void qCoreAppStartupFunctionRestart();
void isEnum();
void qAlignOf();
+ void integerForSize();
};
void tst_QGlobal::qIsNull()
@@ -566,5 +567,19 @@ void tst_QGlobal::qAlignOf()
#undef TEST_AlignOf_RValueRef
#undef TEST_AlignOf_impl
+void tst_QGlobal::integerForSize()
+{
+ // compile-only test:
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<1>::Signed) == 1);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<2>::Signed) == 2);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<4>::Signed) == 4);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<8>::Signed) == 8);
+
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<1>::Unsigned) == 1);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<2>::Unsigned) == 2);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<4>::Unsigned) == 4);
+ Q_STATIC_ASSERT(sizeof(QIntegerForSize<8>::Unsigned) == 8);
+}
+
QTEST_APPLESS_MAIN(tst_QGlobal)
#include "tst_qglobal.moc"
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test b/tests/auto/corelib/io/qfileselector/platforms/+android/test2
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+android/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 b/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+ios/test2 b/tests/auto/corelib/io/qfileselector/platforms/+ios/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+ios/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+linux/test2 b/tests/auto/corelib/io/qfileselector/platforms/+linux/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+linux/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+mac/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+mac/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test2 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+mac/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+wince/test2 b/tests/auto/corelib/io/qfileselector/platforms/+wince/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+wince/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test b/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+windows/test2 b/tests/auto/corelib/io/qfileselector/platforms/+windows/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/+windows/test2
diff --git a/tests/auto/corelib/io/qfileselector/platforms/test2 b/tests/auto/corelib/io/qfileselector/platforms/test2
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/corelib/io/qfileselector/platforms/test2
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
index c644e41107..abfead2a55 100644
--- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc
+++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
@@ -11,13 +11,27 @@
<file>extras/+custom3/+custom5/test</file>
<file>extras/+custom5/+custom3/test</file>
<file>platforms/test</file>
+ <file>platforms/+unix/+android/test</file>
+ <file>platforms/+unix/+blackberry/test</file>
+ <file>platforms/+unix/+ios/test</file>
+ <file>platforms/+unix/+mac/test</file>
+ <file>platforms/+windows/+wince/test</file>
+ <file>platforms/+windows/test</file>
+ <file>platforms/+windows/test2</file>
+ <file>platforms/+unix/+linux/test</file>
+ <file>platforms/+unix/test</file>
+ <file>platforms/test2</file>
+ <file>platforms/+android/test2</file>
+ <file>platforms/+blackberry/test2</file>
+ <file>platforms/+ios/test2</file>
+ <file>platforms/+mac/test2</file>
+ <file>platforms/+linux/test2</file>
+ <file>platforms/+wince/test2</file>
<file>platforms/+android/test</file>
<file>platforms/+blackberry/test</file>
<file>platforms/+ios/test</file>
- <file>platforms/+osx/test</file>
- <file>platforms/+wince/test</file>
- <file>platforms/+windows/test</file>
+ <file>platforms/+mac/test</file>
<file>platforms/+linux/test</file>
- <file>platforms/+generic_unix/test</file>
+ <file>platforms/+wince/test</file>
</qresource>
</RCC>
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index 2baebd0296..d6461c3aba 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -91,9 +91,33 @@ void tst_QFileSelector::basicTest_data()
QTest::addColumn<QString>("expectedPath");
QString test("/test");// '/' is here so dir string can also be selector string
- QTest::newRow("platform") << QString(":/platforms/test") << QStringList()
- << QString(":/platforms/") + QLatin1Char(selectorIndicator)
- + QFileSelectorPrivate::platformSelectors().first() + test;
+ QString test2("/test2");
+ QString expectedPlatform1File(":/platforms");
+ QString expectedPlatform2File(""); //Only the last selector
+#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_IOS) && !defined(Q_OS_LINUX) && !defined(Q_OS_MAC)
+ /* We are only aware of specific unixes, and do not have test files for any of the others.
+ However those unixes can get a selector added from the result of a uname call, so this will
+ lead to a case where we don't have that file so we can't expect the concatenation of platform
+ selectors to work. It should just find the +unix/test file.*/
+ expectedPlatform1File = QString(":/platforms/") + QLatin1Char(selectorIndicator)
+ + QString("unix/test");
+ expectedPlatform2File = QString(":/platforms/test2");
+#else
+ foreach (const QString &selector, QFileSelectorPrivate::platformSelectors()) {
+ expectedPlatform1File = expectedPlatform1File + QLatin1Char('/') + QLatin1Char(selectorIndicator)
+ + selector;
+ expectedPlatform2File = selector;
+ }
+ expectedPlatform1File += test;
+ expectedPlatform2File = QLatin1String(":/platforms/") + QLatin1Char(selectorIndicator)
+ + expectedPlatform2File + test2;
+#endif
+
+ QTest::newRow("platform1") << QString(":/platforms/test") << QStringList()
+ << expectedPlatform1File;
+
+ QTest::newRow("platform2") << QString(":/platforms/test2") << QStringList()
+ << expectedPlatform2File;
QString resourceTestPath(":/extras/test");
QString custom1("custom1");
diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
index a49793c3d4..50268f20a4 100644
--- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
+++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
@@ -69,7 +69,6 @@ QByteArray qMyMessageFormatString(QtMsgType type, const QMessageLogContext &cont
case QtWarningMsg: message.append(".warning"); break;
case QtCriticalMsg:message.append(".critical"); break;
case QtFatalMsg: message.append(".fatal"); break;
- case QtTraceMsg: message.append(".trace"); break;
}
message.append(": ");
message.append(qPrintable(str));
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index c3a1ad206d..d19f4379c7 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -56,7 +56,7 @@
#define Q_XDG_PLATFORM
#endif
-const int MaxStandardLocation = QStandardPaths::GenericCacheLocation;
+static const int MaxStandardLocation = QStandardPaths::GenericConfigLocation;
class tst_qstandardpaths : public QObject
{
@@ -127,7 +127,8 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths
"RuntimeLocation",
"ConfigLocation",
"DownloadLocation",
- "GenericCacheLocation"
+ "GenericCacheLocation",
+ "GenericConfigLocation"
};
void tst_qstandardpaths::dump()
@@ -151,9 +152,11 @@ void tst_qstandardpaths::testDefaultLocations()
const QString expectedConfHome = QDir::homePath() + QString::fromLatin1("/.config");
QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation), expectedConfHome);
+ QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation), expectedConfHome);
const QStringList confDirs = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);
QCOMPARE(confDirs.count(), 2);
QVERIFY(confDirs.contains(expectedConfHome));
+ QCOMPARE(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), confDirs);
const QStringList genericDataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
QCOMPARE(genericDataDirs.count(), 3);
@@ -178,6 +181,7 @@ void tst_qstandardpaths::testCustomLocations()
// test writableLocation()
QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation), m_localConfigDir);
+ QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation), m_localConfigDir);
// test locate()
const QString thisFileName = QString::fromLatin1("aFile");
@@ -212,6 +216,7 @@ void tst_qstandardpaths::enableTestMode()
// ConfigLocation
const QString configDir = qttestDir + QLatin1String("/config");
QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation), configDir);
+ QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation), configDir);
const QStringList confDirs = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);
QCOMPARE(confDirs, QStringList() << configDir << m_globalConfigDir);
@@ -235,6 +240,7 @@ void tst_qstandardpaths::enableTestMode()
testLocations.insert(QStandardPaths::DataLocation, QStandardPaths::writableLocation(QStandardPaths::DataLocation));
testLocations.insert(QStandardPaths::GenericDataLocation, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
testLocations.insert(QStandardPaths::ConfigLocation, QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
+ testLocations.insert(QStandardPaths::GenericConfigLocation, QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
testLocations.insert(QStandardPaths::CacheLocation, QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
testLocations.insert(QStandardPaths::GenericCacheLocation, QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
// On Windows, what should "Program Files" become, in test mode?
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 2128d68485..12b9159bf2 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -378,6 +378,14 @@ void tst_QUrl::comparison()
QVERIFY(!passUrl1.matches(passUrl2, QUrl::None));
QVERIFY(passUrl1.matches(passUrl2, QUrl::RemovePassword));
+ // RemovePassword, null vs empty
+ QUrl emptyPassUrl1("http://user:@host/");
+ QUrl emptyPassUrl2("http://user@host/");
+ QVERIFY(!(emptyPassUrl1 == emptyPassUrl2));
+ QVERIFY(emptyPassUrl1 != emptyPassUrl2);
+ QVERIFY(!emptyPassUrl1.matches(emptyPassUrl2, QUrl::None));
+ QVERIFY(emptyPassUrl1.matches(emptyPassUrl2, QUrl::RemovePassword));
+
// RemoveQuery, RemoveFragment
QUrl queryFragUrl1("http://host/file?query#fragment");
QUrl queryFragUrl2("http://host/file?q2#f2");
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 870e65f0cc..3afc2bc574 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -155,6 +155,7 @@ private slots:
void invokeCustomTypes();
void invokeMetaConstructor();
void invokeTypedefTypes();
+ void invokeException();
void qtMetaObjectInheritance();
void normalizedSignature_data();
void normalizedSignature();
@@ -301,6 +302,19 @@ void tst_QMetaObject::connectSlotsByName()
struct MyUnregisteredType { };
+static int countedStructObjectsCount = 0;
+struct CountedStruct
+{
+ CountedStruct() { ++countedStructObjectsCount; }
+ CountedStruct(const CountedStruct &) { ++countedStructObjectsCount; }
+ CountedStruct &operator=(const CountedStruct &) { return *this; }
+ ~CountedStruct() { --countedStructObjectsCount; }
+};
+
+#ifndef QT_NO_EXCEPTIONS
+class ObjectException : public std::exception { };
+#endif
+
class QtTestObject: public QObject
{
friend class tst_QMetaObject;
@@ -340,6 +354,13 @@ public slots:
void slotWithUnregisteredParameterType(MyUnregisteredType);
+ CountedStruct throwingSlot(const CountedStruct &, CountedStruct s2) {
+#ifndef QT_NO_EXCEPTIONS
+ throw ObjectException();
+#endif
+ return s2;
+ }
+
signals:
void sig0();
QString sig1(QString s1);
@@ -847,6 +868,23 @@ void tst_QMetaObject::invokeTypedefTypes()
QCOMPARE(spy.at(0).at(0), QVariant(arg));
}
+void tst_QMetaObject::invokeException()
+{
+#ifndef QT_NO_EXCEPTIONS
+ QtTestObject obj;
+ QCOMPARE(countedStructObjectsCount, 0);
+ try {
+ CountedStruct s;
+ QVERIFY(QMetaObject::invokeMethod(&obj, "throwingSlot", Q_RETURN_ARG(CountedStruct, s),
+ Q_ARG(CountedStruct, s), Q_ARG(CountedStruct, s)));
+ QFAIL("Did not throw");
+ } catch(ObjectException &) {}
+ QCOMPARE(countedStructObjectsCount, 0);
+#else
+ QSKIP("Needs exceptions");
+#endif
+}
+
void tst_QMetaObject::normalizedSignature_data()
{
QTest::addColumn<QString>("signature");
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index f429500077..e4804e6079 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -152,6 +152,7 @@ private slots:
void contextDoesNotLeakFunctor();
void connectBase();
void qmlConnect();
+ void exceptions();
};
struct QObjectCreatedOnShutdown
@@ -6185,6 +6186,102 @@ void tst_QObject::qmlConnect()
#endif
}
+#ifndef QT_NO_EXCEPTIONS
+class ObjectException : public std::exception { };
+
+struct ThrowFunctor
+{
+ CountedStruct operator()(const CountedStruct &, CountedStruct s2) const
+ {
+ throw ObjectException();
+ return s2;
+ }
+ CountedStruct s;
+};
+#endif
+
+class ExceptionThrower : public QObject
+{
+ Q_OBJECT
+public slots:
+ CountedStruct throwException(const CountedStruct &, CountedStruct s2)
+ {
+#ifndef QT_NO_EXCEPTIONS
+ throw ObjectException();
+#endif
+ return s2;
+ }
+signals:
+ CountedStruct mySignal(const CountedStruct &s1, CountedStruct s2);
+};
+
+void tst_QObject::exceptions()
+{
+#ifndef QT_NO_EXCEPTIONS
+ ReceiverObject receiver;
+
+ // String based syntax
+ {
+ QCOMPARE(countedStructObjectsCount, 0);
+ ExceptionThrower thrower;
+ receiver.reset();
+
+ connect(&thrower, SIGNAL(mySignal(CountedStruct,CountedStruct)), &receiver, SLOT(slot1()));
+ connect(&thrower, SIGNAL(mySignal(CountedStruct,CountedStruct)), &thrower, SLOT(throwException(CountedStruct,CountedStruct)));
+ connect(&thrower, SIGNAL(mySignal(CountedStruct,CountedStruct)), &receiver, SLOT(slot2()));
+ try {
+ CountedStruct s;
+ emit thrower.mySignal(s, s);
+ QFAIL("Exception not thrown?");
+ } catch (ObjectException&) {}
+ QCOMPARE(receiver.count_slot1, 1);
+ QCOMPARE(receiver.count_slot2, 0);
+ QCOMPARE(countedStructObjectsCount, 0);
+ }
+ // Pointer to member function
+ {
+ QCOMPARE(countedStructObjectsCount, 0);
+ ExceptionThrower thrower;
+ receiver.reset();
+
+ connect(&thrower, &ExceptionThrower::mySignal, &receiver, &ReceiverObject::slot1);
+ connect(&thrower, &ExceptionThrower::mySignal, &thrower, &ExceptionThrower::throwException);
+ connect(&thrower, &ExceptionThrower::mySignal, &receiver, &ReceiverObject::slot2);
+ try {
+ CountedStruct s;
+ emit thrower.mySignal(s, s);
+ QFAIL("Exception not thrown?");
+ } catch (ObjectException&) {}
+ QCOMPARE(receiver.count_slot1, 1);
+ QCOMPARE(receiver.count_slot2, 0);
+ QCOMPARE(countedStructObjectsCount, 0);
+ }
+ // Functor
+ {
+ QCOMPARE(countedStructObjectsCount, 0);
+ ExceptionThrower thrower;
+ receiver.reset();
+
+ connect(&thrower, &ExceptionThrower::mySignal, &receiver, &ReceiverObject::slot1);
+ connect(&thrower, &ExceptionThrower::mySignal, ThrowFunctor());
+ connect(&thrower, &ExceptionThrower::mySignal, &receiver, &ReceiverObject::slot2);
+ try {
+ CountedStruct s;
+ emit thrower.mySignal(s, s);
+ QFAIL("Exception not thrown?");
+ } catch (ObjectException&) {}
+ QCOMPARE(receiver.count_slot1, 1);
+ QCOMPARE(receiver.count_slot2, 0);
+ QCOMPARE(countedStructObjectsCount, 1); // the Functor
+ }
+ QCOMPARE(countedStructObjectsCount, 0);
+
+
+#else
+ QSKIP("Needs exceptions");
+#endif
+}
+
// Test for QtPrivate::HasQ_OBJECT_Macro
Q_STATIC_ASSERT(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value);
Q_STATIC_ASSERT(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value);
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 422bd63163..aef79e0c2f 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -247,6 +247,8 @@ private slots:
void iterateContainerElements();
void pairElements();
+
+ void enums();
private:
void dataStream_data(QDataStream::Version version);
void loadQVariantFromDataStream(QDataStream::Version version);
@@ -888,6 +890,17 @@ void tst_QVariant::toLongLong_data()
bytearray[3] = '0';
QTest::newRow( "QByteArray" ) << QVariant( bytearray ) << (qlonglong) 3200 << true;
QTest::newRow("QJsonValue") << QVariant(QJsonValue(321)) << (qlonglong)321 << true;
+
+ qint64 value64 = (Q_INT64_C(12) << 35) + 8;
+ QTest::newRow("qint64") << QVariant::fromValue(value64) << qlonglong(value64) << true;
+ QTest::newRow("-qint64") << QVariant::fromValue(-value64) << qlonglong(-value64) << true;
+ QTest::newRow("long") << QVariant::fromValue(long(464646)) << qlonglong(464646) << true;
+ QTest::newRow("LONG_MAX") << QVariant::fromValue( LONG_MAX ) << qlonglong(LONG_MAX) << true;
+ QTest::newRow("LONG_MIN") << QVariant::fromValue( LONG_MIN ) << qlonglong(LONG_MIN) << true;
+
+ QTest::newRow( "short" ) << QVariant(short(12)) << qlonglong(12) << true;
+ QTest::newRow( "-short" ) << QVariant(short(-24)) << qlonglong(-24) << true;
+ QTest::newRow( "ushort" ) << QVariant(ushort(15)) << qlonglong(15) << true;
}
void tst_QVariant::toLongLong()
@@ -933,6 +946,15 @@ void tst_QVariant::toULongLong_data()
bytearray[3] = '1';
QTest::newRow( "QByteArray" ) << QVariant( bytearray ) << (qulonglong) 3201 << true;
QTest::newRow("QJsonValue") << QVariant(QJsonValue(321)) << (qulonglong)321 << true;
+
+ quint64 value64 = (Q_INT64_C(12) << 35) + 8;
+ QTest::newRow("qint64") << QVariant::fromValue(value64) << qulonglong(value64) << true;
+ QTest::newRow("long") << QVariant::fromValue(long(464646)) << qulonglong(464646) << true;
+ QTest::newRow("LONG_MAX") << QVariant::fromValue( LONG_MAX ) << qulonglong(LONG_MAX) << true;
+ QTest::newRow("ULONG_MAX") << QVariant::fromValue( ULONG_MAX ) << qulonglong(ULONG_MAX) << true;
+ QTest::newRow( "short" ) << QVariant(short(12)) << qulonglong(12) << true;
+ QTest::newRow( "-short" ) << QVariant(short(-24)) << qulonglong(-24) << true;
+ QTest::newRow( "ushort" ) << QVariant(ushort(15)) << qulonglong(15) << true;
}
void tst_QVariant::toULongLong()
@@ -2895,24 +2917,27 @@ void tst_QVariant::numericalConvert()
QVariant vuint(uint(5));
QVariant vshort(short(5));
QVariant vlonglong(quint64(5));
+ QVariant vlong = QVariant::fromValue(long(5));
QVariant vstringint(QString::fromLatin1("5"));
QVariant vstring(QString::fromLatin1("5.3"));
QVector<QVariant *> vect;
- vect << &vfloat << &vdouble << &vreal << &vint << &vuint << &vshort<< &vlonglong << &vstringint << &vstring;
+ vect << &vfloat << &vdouble << &vreal << &vint << &vuint << &vshort<< &vlonglong << &vlong << &vstringint << &vstring;
for(int i = 0; i < vect.size(); i++) {
double num = 5.3;
- if (i >= 3 && i <= 7)
+ if (i >= 3 && i <= 8)
num = 5;
QVariant *v = vect.at(i);
QCOMPARE(v->toFloat() , float(num));
QCOMPARE(float(v->toReal()) , float(num));
QCOMPARE(float(v->toDouble()) , float(num));
- if(i != 8) {
+ if (i != 9) {
QCOMPARE(v->toInt() , int(num));
QCOMPARE(v->toUInt() , uint(num));
QCOMPARE(v->toULongLong() , quint64(num));
+ QCOMPARE(v->value<ulong>() , ulong(num));
+ QCOMPARE(v->value<ushort>() , ushort(num));
}
QCOMPARE(v->toString() , QString::number(num));
}
@@ -3930,5 +3955,87 @@ void tst_QVariant::pairElements()
TEST_PAIR_ELEMENT_ACCESS(std::pair, int, QVariant, 44, 15)
}
+enum EnumTest_Enum0 { EnumTest_Enum0_value = 42, ensureSignedEnum0 = -1 };
+Q_DECLARE_METATYPE(EnumTest_Enum0)
+enum EnumTest_Enum1 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 };
+Q_DECLARE_METATYPE(EnumTest_Enum1)
+
+#if defined(Q_COMPILER_CLASS_ENUM)
+enum EnumTest_Enum3 : qint64 { EnumTest_Enum3_value = -47, EnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5 };
+Q_DECLARE_METATYPE(EnumTest_Enum3)
+enum EnumTest_Enum4 : quint64 { EnumTest_Enum4_value = 47, EnumTest_Enum4_bigValue = (Q_INT64_C(1) << 52) + 45 };
+Q_DECLARE_METATYPE(EnumTest_Enum4)
+enum EnumTest_Enum5 : uint { EnumTest_Enum5_value = 47 };
+Q_DECLARE_METATYPE(EnumTest_Enum5)
+enum EnumTest_Enum6 : uchar { EnumTest_Enum6_value = 47 };
+Q_DECLARE_METATYPE(EnumTest_Enum6)
+enum class EnumTest_Enum7 { EnumTest_Enum7_value = 47, ensureSignedEnum7 = -1 };
+Q_DECLARE_METATYPE(EnumTest_Enum7)
+enum EnumTest_Enum8 : short { EnumTest_Enum8_value = 47 };
+Q_DECLARE_METATYPE(EnumTest_Enum8)
+#endif
+
+template<typename Enum> void testVariant(Enum value, bool *ok)
+{
+ *ok = false;
+ QVariant var = QVariant::fromValue(value);
+
+ QCOMPARE(var.userType(), qMetaTypeId<Enum>());
+
+ QVERIFY(var.canConvert<Enum>());
+ QVERIFY(var.canConvert<int>());
+ QVERIFY(var.canConvert<unsigned int>());
+ QVERIFY(var.canConvert<short>());
+ QVERIFY(var.canConvert<unsigned short>());
+ QVERIFY(var.canConvert<qint64>());
+ QVERIFY(var.canConvert<quint64>());
+
+
+ QCOMPARE(var.value<Enum>(), value);
+ QCOMPARE(var.value<int>(), static_cast<int>(value));
+ QCOMPARE(var.value<uint>(), static_cast<uint>(value));
+ QCOMPARE(var.value<short>(), static_cast<short>(value));
+ QCOMPARE(var.value<unsigned short>(), static_cast<unsigned short>(value));
+ QCOMPARE(var.value<qint64>(), static_cast<qint64>(value));
+ QCOMPARE(var.value<quint64>(), static_cast<quint64>(value));
+
+ QVariant var2 = var;
+ QVERIFY(var2.convert(QMetaType::Int));
+ QCOMPARE(var2.value<int>(), static_cast<int>(value));
+
+ *ok = true;
+}
+
+void tst_QVariant::enums()
+{
+ bool ok = false;
+ testVariant(EnumTest_Enum0_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum1_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum1_bigValue, &ok);
+ QVERIFY(ok);
+#if defined(Q_COMPILER_CLASS_ENUM)
+ testVariant(EnumTest_Enum3::EnumTest_Enum3_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum3::EnumTest_Enum3_bigValue, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum4::EnumTest_Enum4_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum4::EnumTest_Enum4_bigValue, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum5::EnumTest_Enum5_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum6::EnumTest_Enum6_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum7::EnumTest_Enum7_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum8::EnumTest_Enum8_value, &ok);
+ QVERIFY(ok);
+ testVariant(EnumTest_Enum3::EnumTest_Enum3_value, &ok);
+ QVERIFY(ok);
+#endif
+}
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"
diff --git a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
index 8a0ff162c6..952cb031b8 100644
--- a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
+++ b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <qwineventnotifier.h>
#include <qtimer.h>
+#include <qt_windows.h>
class tst_QWinEventNotifier : public QObject
{
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index 197d56359f..227351485d 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -64,6 +64,7 @@ private slots:
void isNull();
void equal();
void notEqual();
+ void cpp11();
// Only in Qt > 3.2.x
void generate();
@@ -245,6 +246,17 @@ void tst_QUuid::notEqual()
QVERIFY( uuidA != uuidB );
}
+void tst_QUuid::cpp11() {
+#ifdef Q_COMPILER_UNIFORM_INIT
+ // "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}" cf, initTestCase
+ Q_DECL_CONSTEXPR QUuid u1{0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
+ Q_DECL_CONSTEXPR QUuid u2 = {0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5};
+ Q_UNUSED(u1);
+ Q_UNUSED(u2);
+#else
+ QSKIP("This compiler is not in C++11 mode or it doesn't support uniform initialization");
+#endif
+}
void tst_QUuid::generate()
{
diff --git a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
index 0d51f69559..ac8d433f96 100644
--- a/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
+++ b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
@@ -49,11 +49,13 @@
#ifdef Q_OS_UNIX
#include <unistd.h>
#endif
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-#include <windows.h>
-#define sleep(X) Sleep(X)
-#elif defined(Q_OS_WINRT)
-#define sleep(X) WaitForSingleObjectEx(GetCurrentThread(), X, FALSE);
+#if defined(Q_OS_WIN)
+# include <qt_windows.h>
+# ifndef Q_OS_WINRT
+# define sleep(X) Sleep(X)
+# else
+# define sleep(X) WaitForSingleObjectEx(GetCurrentThread(), X, FALSE);
+# endif
#endif
//on solaris, threads that loop on the release bool variable
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index 144bc62b1b..64eb91b7b6 100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
@@ -1027,7 +1027,7 @@ void tst_QAlgorithms::binaryFindOnLargeContainer() const
}
// alternative implementation of qPopulationCount for comparison:
-static const uint bitsSetInNibble[] = {
+static Q_DECL_CONSTEXPR const uint bitsSetInNibble[] = {
0, 1, 1, 2, 1, 2, 2, 3,
1, 2, 2, 3, 2, 3, 3, 4,
};
diff --git a/tests/auto/corelib/tools/qcollator/qcollator.pro b/tests/auto/corelib/tools/qcollator/qcollator.pro
new file mode 100644
index 0000000000..3c5987ffa0
--- /dev/null
+++ b/tests/auto/corelib/tools/qcollator/qcollator.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qcollator
+QT = core testlib
+SOURCES = tst_qcollator.cpp
+DEFINES += QT_NO_CAST_TO_ASCII
+contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/src/gui/text/qpfutil.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
index cf955e91e5..3df8422a34 100644
--- a/src/gui/text/qpfutil.cpp
+++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,28 +39,54 @@
**
****************************************************************************/
-static const QFontEngineQPF::TagType tagTypes[QFontEngineQPF::NumTags] = {
- QFontEngineQPF::StringType, // FontName
- QFontEngineQPF::StringType, // FileName
- QFontEngineQPF::UInt32Type, // FileIndex
- QFontEngineQPF::UInt32Type, // FontRevision
- QFontEngineQPF::StringType, // FreeText
- QFontEngineQPF::FixedType, // Ascent
- QFontEngineQPF::FixedType, // Descent
- QFontEngineQPF::FixedType, // Leading
- QFontEngineQPF::FixedType, // XHeight
- QFontEngineQPF::FixedType, // AverageCharWidth
- QFontEngineQPF::FixedType, // MaxCharWidth
- QFontEngineQPF::FixedType, // LineThickness
- QFontEngineQPF::FixedType, // MinLeftBearing
- QFontEngineQPF::FixedType, // MinRightBearing
- QFontEngineQPF::FixedType, // UnderlinePosition
- QFontEngineQPF::UInt8Type, // GlyphFormat
- QFontEngineQPF::UInt8Type, // PixelSize
- QFontEngineQPF::UInt8Type, // Weight
- QFontEngineQPF::UInt8Type, // Style
- QFontEngineQPF::StringType, // EndOfHeader
- QFontEngineQPF::BitFieldType// WritingSystems
+#include <QtTest/QtTest>
+
+#include <qlocale.h>
+#include <qcollator.h>
+
+#include <cstring>
+
+class tst_QCollator : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void moveSemantics();
};
+#ifdef Q_COMPILER_RVALUE_REFS
+static bool dpointer_is_null(QCollator &c)
+{
+ char mem[sizeof c];
+ using namespace std;
+ memcpy(mem, &c, sizeof c);
+ for (size_t i = 0; i < sizeof c; ++i)
+ if (mem[i])
+ return false;
+ return true;
+}
+#endif
+
+void tst_QCollator::moveSemantics()
+{
+#ifdef Q_COMPILER_RVALUE_REFS
+ const QLocale de_AT(QLocale::German, QLocale::Austria);
+
+ QCollator c1(de_AT);
+ QCOMPARE(c1.locale(), de_AT);
+
+ QCollator c2(std::move(c1));
+ QCOMPARE(c2.locale(), de_AT);
+ QVERIFY(dpointer_is_null(c1));
+
+ c1 = std::move(c2);
+ QCOMPARE(c1.locale(), de_AT);
+ QVERIFY(dpointer_is_null(c2));
+#else
+ QSKIP("The compiler is not in C++11 mode or does not support move semantics.");
+#endif
+}
+
+QTEST_APPLESS_MAIN(tst_QCollator)
+#include "tst_qcollator.moc"
diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
index 07f8ddfc8e..2b30b0486b 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
@@ -69,9 +69,18 @@ int main(int argc, char *argv[])
// An option with a longer description, to test wrapping
QCommandLineOption noImplicitIncludesOption(QStringList() << QStringLiteral("n") << QStringLiteral("no-implicit-includes"));
- noImplicitIncludesOption.setDescription(QStringLiteral("Disable automatic generation of implicit #include-directives."));
+ noImplicitIncludesOption.setDescription(QStringLiteral("Disable magic generation of implicit #include-directives."));
parser.addOption(noImplicitIncludesOption);
+ QCommandLineOption newlineOption(QStringList() << QStringLiteral("newline"));
+ newlineOption.setDescription(QString::fromLatin1("This is an option with a rather long\n"
+ "description using explicit newline characters "
+ "(but testing automatic wrapping too). In addition, "
+ "here, we test breaking after a comma. Testing -option. "
+ "Long URL: http://qt-project.org/wiki/How_to_create_a_library_with_Qt_and_use_it_in_an_application "
+ "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"));
+ parser.addOption(newlineOption);
+
// This program supports different options depending on the "command" (first argument).
// Call parse() to find out the positional arguments.
parser.parse(QCoreApplication::arguments());
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index 1ee6cacd97..d5b3323506 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -459,27 +459,40 @@ void tst_QCommandLineParser::testVersionOption()
#endif // !QT_NO_PROCESS
}
+static const char expectedOptionsHelp[] =
+ "Options:\n"
+ " -h, --help Displays this help.\n"
+ " -v, --version Displays version information.\n"
+ " --load <url> Load file from URL.\n"
+ " -o, --output <file> Set output file.\n"
+ " -D <key=value> Define macro.\n"
+ " -n, --no-implicit-includes Disable magic generation of implicit\n"
+ " #include-directives.\n"
+ " --newline This is an option with a rather long\n"
+ " description using explicit newline characters (but\n"
+ " testing automatic wrapping too). In addition,\n"
+ " here, we test breaking after a comma. Testing\n"
+ " -option. Long URL:\n"
+ " http://qt-project.org/wiki/How_to_create_a_library\n"
+ " _with_Qt_and_use_it_in_an_application\n"
+ " abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx\n"
+ " yzabcdefghijklmnopqrstuvwxyz\n";
+
void tst_QCommandLineParser::testHelpOption_data()
{
QTest::addColumn<QCommandLineParser::SingleDashWordOptionMode>("parsingMode");
QTest::addColumn<QString>("expectedHelpOutput");
- QString expectedOutput =
+ QString expectedOutput = QString::fromLatin1(
"Usage: testhelper/qcommandlineparser_test_helper [options] parsingMode command\n"
"Test helper\n"
- "\n"
- "Options:\n"
- " -h, --help Displays this help.\n"
- " -v, --version Displays version information.\n"
- " --load <url> Load file from URL.\n"
- " -o, --output <file> Set output file.\n"
- " -D <key=value> Define macro.\n"
- " -n, --no-implicit-includes Disable automatic generation of implicit #include\n"
- " -directives.\n"
+ "\n")
+ + QString::fromLatin1(expectedOptionsHelp) +
+ QString::fromLatin1(
"\n"
"Arguments:\n"
" parsingMode The parsing mode to test.\n"
- " command The command to execute.\n";
+ " command The command to execute.\n");
#ifdef Q_OS_WIN
expectedOutput.replace(" -h, --help Displays this help.\n",
" -?, -h, --help Displays this help.\n");
@@ -510,6 +523,7 @@ void tst_QCommandLineParser::testHelpOption()
#ifdef Q_OS_WIN
output.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
#endif
+ QCOMPARE(output.split('\n'), expectedHelpOutput.split('\n')); // easier to debug than the next line, on failure
QCOMPARE(output, expectedHelpOutput);
process.start("testhelper/qcommandlineparser_test_helper", QStringList() << "0" << "resize" << "--help");
@@ -519,18 +533,11 @@ void tst_QCommandLineParser::testHelpOption()
#ifdef Q_OS_WIN
output.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
#endif
- QByteArray expectedResizeHelp =
+ QByteArray expectedResizeHelp = QByteArrayLiteral(
"Usage: testhelper/qcommandlineparser_test_helper [options] resize [resize_options]\n"
"Test helper\n"
- "\n"
- "Options:\n"
- " -h, --help Displays this help.\n"
- " -v, --version Displays version information.\n"
- " --load <url> Load file from URL.\n"
- " -o, --output <file> Set output file.\n"
- " -D <key=value> Define macro.\n"
- " -n, --no-implicit-includes Disable automatic generation of implicit #include\n"
- " -directives.\n"
+ "\n")
+ + expectedOptionsHelp +
" --size <size> New size.\n"
"\n"
"Arguments:\n"
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 8c0f32bb74..7d51696fe3 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -48,7 +48,7 @@
#include <private/qdatetime_p.h>
#ifdef Q_OS_WIN
-# include <windows.h>
+# include <qt_windows.h>
# if defined(Q_OS_WINRT)
# define tzset()
# endif
@@ -2906,6 +2906,12 @@ void tst_QDateTime::timeZones() const
// - Test 03:00:00 = 1 hour after tran
hourAfterStd = QDateTime(QDate(2013, 10, 27), QTime(3, 0, 0), cet);
QCOMPARE(hourAfterStd.toMSecsSinceEpoch(), dstToStdMSecs + 3600000);
+
+ // Test Time Zone that has transitions but no future transitions afer a given date
+ QTimeZone sgt("Asia/Singapore");
+ QDateTime future(QDate(2015, 1, 1), QTime(0, 0, 0), sgt);
+ QVERIFY(future.isValid());
+ QCOMPARE(future.offsetFromUtc(), 28800);
}
void tst_QDateTime::invalid() const
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index f11e632b2e..1bac5f39e7 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -1733,6 +1733,11 @@ void tst_QLocale::dayName()
QLocale ir("ga_IE");
QCOMPARE(ir.dayName(1, QLocale::ShortFormat), QLatin1String("Luan"));
QCOMPARE(ir.dayName(7, QLocale::ShortFormat), QLatin1String("Domh"));
+
+ QLocale gr("el_GR");
+ QCOMPARE(gr.dayName(2, QLocale::ShortFormat), QString::fromUtf8("\316\244\317\201\316\257"));
+ QCOMPARE(gr.dayName(4, QLocale::ShortFormat), QString::fromUtf8("\316\240\316\255\316\274"));
+ QCOMPARE(gr.dayName(6, QLocale::ShortFormat), QString::fromUtf8("\316\243\316\254\316\262"));
}
void tst_QLocale::standaloneDayName_data()
@@ -1903,6 +1908,10 @@ void tst_QLocale::timeFormat()
const QLocale cat("ca_ES");
QCOMPARE(cat.timeFormat(QLocale::ShortFormat), QLatin1String("H.mm"));
QCOMPARE(cat.timeFormat(QLocale::LongFormat), QLatin1String("H.mm.ss t"));
+
+ const QLocale bra("pt_BR");
+ QCOMPARE(bra.timeFormat(QLocale::ShortFormat), QLatin1String("HH:mm"));
+ QCOMPARE(bra.timeFormat(QLocale::LongFormat), QLatin1String("HH:mm:ss t"));
}
void tst_QLocale::dateTimeFormat()
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index 28245b5e6a..0a63ffeeaf 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -57,6 +57,7 @@ private slots:
void nullTest();
void dataStreamTest();
void availableTimeZoneIds();
+ void stressTest();
void windowsId();
// Backend tests
void utcTest();
@@ -75,7 +76,7 @@ private:
tst_QTimeZone::tst_QTimeZone()
{
- // Set to true to print debug output
+ // Set to true to print debug output, test Display Names and run long stress tests
debug = false;
}
@@ -367,11 +368,59 @@ void tst_QTimeZone::availableTimeZoneIds()
}
}
+void tst_QTimeZone::stressTest()
+{
+ QList<QByteArray> idList = QTimeZone::availableTimeZoneIds();
+ foreach (const QByteArray &id, idList) {
+ QTimeZone testZone = QTimeZone(id);
+ QCOMPARE(testZone.isValid(), true);
+ QCOMPARE(testZone.id(), id);
+ QDateTime testDate = QDateTime(QDate(2015, 1, 1), QTime(0, 0, 0), Qt::UTC);
+ testZone.country();
+ testZone.comment();
+ testZone.displayName(testDate);
+ testZone.displayName(QTimeZone::DaylightTime);
+ testZone.displayName(QTimeZone::StandardTime);
+ testZone.abbreviation(testDate);
+ testZone.offsetFromUtc(testDate);
+ testZone.standardTimeOffset(testDate);
+ testZone.daylightTimeOffset(testDate);
+ testZone.hasDaylightTime();
+ testZone.isDaylightTime(testDate);
+ testZone.offsetData(testDate);
+ testZone.hasTransitions();
+ testZone.nextTransition(testDate);
+ testZone.previousTransition(testDate);
+ // Dates known to be outside possible tz file pre-calculated rules range
+ QDateTime lowDate1 = QDateTime(QDate(1800, 1, 1), QTime(0, 0, 0), Qt::UTC);
+ QDateTime lowDate2 = QDateTime(QDate(1800, 6, 1), QTime(0, 0, 0), Qt::UTC);
+ QDateTime highDate1 = QDateTime(QDate(2200, 1, 1), QTime(0, 0, 0), Qt::UTC);
+ QDateTime highDate2 = QDateTime(QDate(2200, 6, 1), QTime(0, 0, 0), Qt::UTC);
+ testZone.nextTransition(lowDate1);
+ testZone.nextTransition(lowDate2);
+ testZone.previousTransition(lowDate2);
+ testZone.previousTransition(lowDate2);
+ testZone.nextTransition(highDate1);
+ testZone.nextTransition(highDate2);
+ testZone.previousTransition(highDate1);
+ testZone.previousTransition(highDate2);
+ if (debug) {
+ // This could take a long time, depending on platform and database
+ qDebug() << "Stress test calculating transistions for" << testZone.id();
+ testZone.transitions(lowDate1, highDate1);
+ }
+ testDate.setTimeZone(testZone);
+ testDate.isValid();
+ testDate.offsetFromUtc();
+ testDate.timeZoneAbbreviation();
+ }
+}
+
void tst_QTimeZone::windowsId()
{
/*
Current Windows zones for "Central Standard Time":
- Region Olsen Id(s)
+ Region IANA Id(s)
Default "America/Chicago"
Canada "America/Winnipeg America/Rainy_River America/Rankin_Inlet America/Resolute"
Mexico "America/Matamoros"
@@ -380,24 +429,24 @@ void tst_QTimeZone::windowsId()
"America/North_Dakota/New_Salem"
AnyCountry "CST6CDT"
*/
- QCOMPARE(QTimeZone::olsenIdToWindowsId("America/Chicago"),
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("America/Chicago"),
QByteArray("Central Standard Time"));
- QCOMPARE(QTimeZone::olsenIdToWindowsId("America/Resolute"),
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("America/Resolute"),
QByteArray("Central Standard Time"));
// Partials shouldn't match
- QCOMPARE(QTimeZone::olsenIdToWindowsId("America/Chi"), QByteArray());
- QCOMPARE(QTimeZone::olsenIdToWindowsId("InvalidZone"), QByteArray());
- QCOMPARE(QTimeZone::olsenIdToWindowsId(QByteArray()), QByteArray());
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("America/Chi"), QByteArray());
+ QCOMPARE(QTimeZone::ianaIdToWindowsId("InvalidZone"), QByteArray());
+ QCOMPARE(QTimeZone::ianaIdToWindowsId(QByteArray()), QByteArray());
// Check default value
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId("Central Standard Time"),
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time"),
QByteArray("America/Chicago"));
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId("Central Standard Time", QLocale::Canada),
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time", QLocale::Canada),
QByteArray("America/Winnipeg"));
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId("Central Standard Time", QLocale::AnyCountry),
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time", QLocale::AnyCountry),
QByteArray("CST6CDT"));
- QCOMPARE(QTimeZone::windowsIdToDefaultOlsenId(QByteArray()), QByteArray());
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId(QByteArray()), QByteArray());
// No country is sorted list of all zones
QList<QByteArray> list;
@@ -406,39 +455,39 @@ void tst_QTimeZone::windowsId()
<< "America/North_Dakota/Center" << "America/North_Dakota/New_Salem"
<< "America/Rainy_River" << "America/Rankin_Inlet" << "America/Resolute"
<< "America/Winnipeg" << "CST6CDT";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time"), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time"), list);
// Check country with no match returns empty list
list.clear();
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::NewZealand),
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::NewZealand),
list);
// Check valid country returns list in preference order
list.clear();
list << "America/Winnipeg" << "America/Rainy_River" << "America/Rankin_Inlet"
<< "America/Resolute";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::Canada), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::Canada), list);
list.clear();
list << "America/Matamoros";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::Mexico), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::Mexico), list);
list.clear();
list << "America/Chicago" << "America/Indiana/Knox" << "America/Indiana/Tell_City"
<< "America/Menominee" << "America/North_Dakota/Beulah" << "America/North_Dakota/Center"
<< "America/North_Dakota/New_Salem";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::UnitedStates),
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::UnitedStates),
list);
list.clear();
list << "CST6CDT";
- QCOMPARE(QTimeZone::windowsIdToOlsenIds("Central Standard Time", QLocale::AnyCountry),
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::AnyCountry),
list);
// Check no windowsId return empty
list.clear();
- QCOMPARE(QTimeZone::windowsIdToOlsenIds(QByteArray()), list);
- QCOMPARE(QTimeZone::windowsIdToOlsenIds(QByteArray(), QLocale::AnyCountry), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds(QByteArray()), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds(QByteArray(), QLocale::AnyCountry), list);
}
void tst_QTimeZone::utcTest()
@@ -639,10 +688,11 @@ void tst_QTimeZone::tzTest()
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
+ // Test previous to low value is invalid
dat = tzp.previousTransition(-9999999999999);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000);
- QCOMPARE(dat.standardTimeOffset, 3600);
- QCOMPARE(dat.daylightTimeOffset, 0);
+ QCOMPARE(dat.atMSecsSinceEpoch, std::numeric_limits<qint64>::min());
+ QCOMPARE(dat.standardTimeOffset, std::numeric_limits<int>::min());
+ QCOMPARE(dat.daylightTimeOffset, std::numeric_limits<int>::min());
dat = tzp.nextTransition(-9999999999999);
QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000);
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index e920813db2..286afdfd18 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -8,6 +8,7 @@ SUBDIRS=\
qbytedatabuffer \
qcache \
qchar \
+ qcollator \
qcommandlineparser \
qcontiguouscache \
qcryptographichash \
diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
index 1220ce3b23..efc688f0b1 100644
--- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
+++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp
@@ -118,6 +118,7 @@ private slots:
void colorInteger();
void invalidQColor();
+ void validQColor();
void debugStream_data();
void debugStream();
@@ -542,6 +543,21 @@ void tst_QGuiVariant::invalidQColor()
QVERIFY(!qvariant_cast<QColor>(va).isValid());
}
+void tst_QGuiVariant::validQColor()
+{
+ QColor col(Qt::red);
+ QVariant va(col.name());
+ QVERIFY(va.canConvert(QVariant::Color));
+
+ QVERIFY(va.convert(QVariant::Color));
+
+ QVERIFY(col.isValid());
+
+ QVERIFY(va.convert(QVariant::String));
+
+ QCOMPARE(qvariant_cast<QString>(va), col.name());
+}
+
void tst_QGuiVariant::colorInteger()
{
QVariant v = QColor(Qt::red);
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index c4983f4462..259c840ae7 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -177,7 +177,7 @@ void tst_QWindow::resizeEventAfterResize()
Window window;
window.setGeometry(geometry);
- window.show();
+ window.showNormal();
QTRY_COMPARE(window.received(QEvent::Resize), 1);
@@ -843,7 +843,10 @@ void tst_QWindow::activateAndClose()
{
for (int i = 0; i < 10; ++i) {
QWindow window;
- window.show();
+ // qWaitForWindowActive will block for the duration of
+ // of the timeout if the window is at 0,0
+ window.setGeometry(QGuiApplication::primaryScreen()->availableGeometry().adjusted(1, 1, -1, -1));
+ window.showNormal();
window.requestActivate();
QVERIFY(QTest::qWaitForWindowActive(&window));
QCOMPARE(qGuiApp->focusWindow(), &window);
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index 1abac3a28a..53aef40df0 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -187,8 +187,6 @@ private slots:
void htmlExportImportBlockCount();
void QTBUG27354_spaceAndSoftSpace();
- void cssInheritance();
-
void baseUrl_data();
void baseUrl();
@@ -2952,35 +2950,6 @@ void tst_QTextDocument::QTBUG27354_spaceAndSoftSpace()
}
}
-void tst_QTextDocument::cssInheritance()
-{
- {
- QTextDocument td;
- td.setHtml("<html><head><style type=\"text/css\">body { line-height: 200% }</style></head><body>"
- "<p>Foo</p><p>Bar</p><p>Baz</p></body></html>");
- QTextBlock block = td.begin();
- while (block.isValid()) {
- QTextBlockFormat fmt = block.blockFormat();
- QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight);
- QVERIFY(fmt.lineHeight() == 200);
- block = block.next();
- }
- }
- {
- QTextDocument td;
- td.setHtml("<html><head><style type=\"text/css\">body { line-height: 200% } p { line-height: 300% }</style></head><body>"
- "<p style=\"line-height: 40px\">Foo</p><p>Bar</p><p>Baz</p></body></html>");
- QTextBlock block = td.begin();
- QTextBlockFormat fmt = block.blockFormat();
- QVERIFY(fmt.lineHeightType() == QTextBlockFormat::FixedHeight);
- QVERIFY(fmt.lineHeight() == 40);
- block = block.next();
- fmt = block.blockFormat();
- QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight);
- QVERIFY(fmt.lineHeight() == 300);
- }
-}
-
class BaseDocument : public QTextDocument
{
public:
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 2826c497df..1837e8d665 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -6042,7 +6042,7 @@ void tst_QNetworkReply::sslSessionSharingFromPersistentSession()
QTestEventLoop::instance().enterLoop(20);
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(warmupReply->error(), QNetworkReply::NoError);
- QByteArray sslSession = warmupReply->sslConfiguration().session();
+ QByteArray sslSession = warmupReply->sslConfiguration().sessionTicket();
QCOMPARE(!sslSession.isEmpty(), sessionPersistenceEnabled);
// test server sends a life time hint of 0 (old server) or 300 (new server),
@@ -6060,7 +6060,7 @@ void tst_QNetworkReply::sslSessionSharingFromPersistentSession()
QNetworkRequest request(warmupRequest);
if (sessionPersistenceEnabled) {
QSslConfiguration configuration = request.sslConfiguration();
- configuration.setSession(sslSession);
+ configuration.setSessionTicket(sslSession);
request.setSslConfiguration(configuration);
}
QNetworkAccessManager newManager;
diff --git a/tests/auto/opengl/qgl/qgl.pro b/tests/auto/opengl/qgl/qgl.pro
index 311e41a624..35b5c6888b 100644
--- a/tests/auto/opengl/qgl/qgl.pro
+++ b/tests/auto/opengl/qgl/qgl.pro
@@ -12,3 +12,4 @@ RESOURCES = qgl.qrc
linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = lucid ]"): CONFIG+=insignificant_test # QTBUG-25293
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTQAINFRA-711
diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
index c74edab9a2..f5923764b8 100644
--- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
@@ -346,12 +346,12 @@ void renderAScene(int w, int h)
for (int i=0; i<1000; ++i) {
GLfloat pos[] = {
- (rand() % 100) / 100.,
- (rand() % 100) / 100.,
- (rand() % 100) / 100.,
- (rand() % 100) / 100.,
- (rand() % 100) / 100.,
- (rand() % 100) / 100.
+ (rand() % 100) / 100.f,
+ (rand() % 100) / 100.f,
+ (rand() % 100) / 100.f,
+ (rand() % 100) / 100.f,
+ (rand() % 100) / 100.f,
+ (rand() % 100) / 100.f
};
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos);
diff --git a/tests/auto/other/macgui/guitest.cpp b/tests/auto/other/macgui/guitest.cpp
index d7431dd88e..3359e7d935 100644
--- a/tests/auto/other/macgui/guitest.cpp
+++ b/tests/auto/other/macgui/guitest.cpp
@@ -144,22 +144,25 @@ WidgetNavigator::~WidgetNavigator()
namespace NativeEvents {
#ifdef Q_OS_MAC
- void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons, MousePosition updateMouse)
+ void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons)
{
CGPoint position;
position.x = globalPos.x();
position.y = globalPos.y();
- const bool updateMousePosition = (updateMouse == UpdatePosition);
-
- // Mouse down.
- CGPostMouseEvent(position, updateMousePosition, 3,
- (buttons & Qt::LeftButton) ? true : false,
- (buttons & Qt::MidButton/* Middlebutton! */) ? true : false,
- (buttons & Qt::RightButton) ? true : false);
-
- // Mouse up.
- CGPostMouseEvent(position, updateMousePosition, 3, false, false, false);
+ CGEventType mouseDownType = (buttons & Qt::LeftButton) ? kCGEventLeftMouseDown :
+ (buttons & Qt::RightButton) ? kCGEventRightMouseDown :
+ kCGEventOtherMouseDown;
+ CGMouseButton mouseButton = mouseDownType == kCGEventOtherMouseDown ? kCGMouseButtonCenter : kCGEventLeftMouseDown;
+ CGEventRef mouseEvent = CGEventCreateMouseEvent(NULL, mouseDownType, position, mouseButton);
+ CGEventPost(kCGHIDEventTap, mouseEvent);
+
+ CGEventType mouseUpType = (buttons & Qt::LeftButton) ? kCGEventLeftMouseUp :
+ (buttons & Qt::RightButton) ? kCGEventRightMouseUp :
+ kCGEventOtherMouseUp;
+ CGEventSetType(mouseEvent, mouseUpType);
+ CGEventPost(kCGHIDEventTap, mouseEvent);
+ CFRelease(mouseEvent);
}
#else
# error Oops, NativeEvents::mouseClick() is not implemented on this platform.
diff --git a/tests/auto/other/macgui/guitest.h b/tests/auto/other/macgui/guitest.h
index 569a67d7fe..6fc4eac59f 100644
--- a/tests/auto/other/macgui/guitest.h
+++ b/tests/auto/other/macgui/guitest.h
@@ -86,11 +86,10 @@ private:
(Implemented so far: mouseClick on Mac)
*/
namespace NativeEvents {
- enum MousePosition { UpdatePosition, DontUpdatePosition };
/*
Simulates a mouse click with button at globalPos.
*/
- void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons, MousePosition updateMouse = DontUpdatePosition);
+ void mouseClick(const QPoint &globalPos, Qt::MouseButtons buttons);
};
class ColorWidget : public QWidget
diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
index ab05c64fe5..71a90e83f7 100644
--- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
+++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp
@@ -47,6 +47,12 @@
enum { OneMinute = 60 * 1000,
TwoMinutes = OneMinute * 2 };
+
+struct Functor
+{
+ void operator()() const {};
+};
+
class tst_QObjectRace: public QObject
{
Q_OBJECT
@@ -122,11 +128,7 @@ signals:
private slots:
void checkStopWatch()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS)
- if (stopWatch.elapsed() >= OneMinute / 2)
-#else
- if (stopWatch.elapsed() >= OneMinute)
-#endif
+ if (stopWatch.elapsed() >= 5000)
quit();
QObject o;
@@ -188,16 +190,34 @@ class MyObject : public QObject
void signal7();
};
+namespace {
+const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()),
+ SLOT(slot4()) , SLOT(slot5()) , SLOT(slot6()),
+ SLOT(slot7()) };
+
+const char *_signals[] = { SIGNAL(signal1()), SIGNAL(signal2()), SIGNAL(signal3()),
+ SIGNAL(signal4()), SIGNAL(signal5()), SIGNAL(signal6()),
+ SIGNAL(signal7()) };
+typedef void (MyObject::*PMFType)();
+const PMFType _slotsPMF[] = { &MyObject::slot1, &MyObject::slot2, &MyObject::slot3,
+ &MyObject::slot4, &MyObject::slot5, &MyObject::slot6,
+ &MyObject::slot7 };
+
+const PMFType _signalsPMF[] = { &MyObject::signal1, &MyObject::signal2, &MyObject::signal3,
+ &MyObject::signal4, &MyObject::signal5, &MyObject::signal6,
+ &MyObject::signal7 };
+
+}
class DestroyThread : public QThread
{
Q_OBJECT
- QObject **objects;
+ MyObject **objects;
int number;
public:
- void setObjects(QObject **o, int n)
+ void setObjects(MyObject **o, int n)
{
objects = o;
number = n;
@@ -206,8 +226,29 @@ public:
}
void run() {
- for(int i = 0; i < number; i++)
+ for (int i = number-1; i >= 0; --i) {
+ /* Do some more connection and disconnection between object in this thread that have not been destroyed yet */
+
+ const int nAlive = i+1;
+ connect (objects[((i+1)*31) % nAlive], _signals[(12*i)%7], objects[((i+2)*37) % nAlive], _slots[(15*i+2)%7] );
+ disconnect(objects[((i+1)*31) % nAlive], _signals[(12*i)%7], objects[((i+2)*37) % nAlive], _slots[(15*i+2)%7] );
+
+ connect (objects[((i+4)*41) % nAlive], _signalsPMF[(18*i)%7], objects[((i+5)*43) % nAlive], _slotsPMF[(19*i+2)%7] );
+ disconnect(objects[((i+4)*41) % nAlive], _signalsPMF[(18*i)%7], objects[((i+5)*43) % nAlive], _slotsPMF[(19*i+2)%7] );
+
+ QMetaObject::Connection c = connect(objects[((i+5)*43) % nAlive], _signalsPMF[(9*i+1)%7], Functor());
+ disconnect(c);
+
+ disconnect(objects[i], _signalsPMF[(10*i+5)%7], 0, 0);
+ disconnect(objects[i], _signals[(11*i+6)%7], 0, 0);
+
+ disconnect(objects[i], 0, objects[(i*17+6) % nAlive], 0);
+ if (i%4 == 1) {
+ disconnect(objects[i], 0, 0, 0);
+ }
+
delete objects[i];
+ }
}
};
@@ -216,27 +257,24 @@ public:
void tst_QObjectRace::destroyRace()
{
- enum { ThreadCount = 10, ObjectCountPerThread = 733,
+ enum { ThreadCount = 10, ObjectCountPerThread = 2777,
ObjectCount = ThreadCount * ObjectCountPerThread };
- const char *_slots[] = { SLOT(slot1()) , SLOT(slot2()) , SLOT(slot3()),
- SLOT(slot4()) , SLOT(slot5()) , SLOT(slot6()),
- SLOT(slot7()) };
-
- const char *_signals[] = { SIGNAL(signal1()), SIGNAL(signal2()), SIGNAL(signal3()),
- SIGNAL(signal4()), SIGNAL(signal5()), SIGNAL(signal6()),
- SIGNAL(signal7()) };
-
- QObject *objects[ObjectCount];
+ MyObject *objects[ObjectCount];
for (int i = 0; i < ObjectCount; ++i)
objects[i] = new MyObject;
- for (int i = 0; i < ObjectCount * 11; ++i) {
+ for (int i = 0; i < ObjectCount * 17; ++i) {
connect(objects[(i*13) % ObjectCount], _signals[(2*i)%7],
objects[((i+2)*17) % ObjectCount], _slots[(3*i+2)%7] );
connect(objects[((i+6)*23) % ObjectCount], _signals[(5*i+4)%7],
objects[((i+8)*41) % ObjectCount], _slots[(i+6)%7] );
+
+ connect(objects[(i*67) % ObjectCount], _signalsPMF[(2*i)%7],
+ objects[((i+1)*71) % ObjectCount], _slotsPMF[(3*i+2)%7] );
+ connect(objects[((i+3)*73) % ObjectCount], _signalsPMF[(5*i+4)%7],
+ objects[((i+5)*79) % ObjectCount], Functor() );
}
DestroyThread *threads[ThreadCount];
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index 7251cca528..644cd33e5c 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -113,6 +113,8 @@ private slots:
void testCustomPageSizes();
void customPaperSizeAndMargins_data();
void customPaperSizeAndMargins();
+ void customPaperNameSettingBySize();
+ void customPaperNameSettingByName();
#if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG)
void printDialogCompleter();
#endif
@@ -967,6 +969,13 @@ void tst_QPrinter::errorReporting()
painter.end();
}
+static QByteArray msgSizeMismatch(const QSizeF &actual, const QSizeF &expected)
+{
+ QString result;
+ QDebug(&result) << "Paper size mismatch" << actual << "!=" << expected;
+ return result.toLocal8Bit();
+}
+
void tst_QPrinter::testCustomPageSizes()
{
QPrinter p;
@@ -975,12 +984,16 @@ void tst_QPrinter::testCustomPageSizes()
p.setPaperSize(customSize, QPrinter::Inch);
QSizeF paperSize = p.paperSize(QPrinter::Inch);
- QCOMPARE(paperSize, customSize);
+ // Due to the different calculations, the sizes may be off by a fraction so we have to check it manually
+ // instead of relying on QSizeF comparison
+ QVERIFY2(sqrt(pow(paperSize.width() - customSize.width(), 2.0) + pow(paperSize.height() - customSize.height(), 2.0)) < 0.01,
+ msgSizeMismatch(paperSize, customSize));
QPrinter p2(QPrinter::HighResolution);
p2.setPaperSize(customSize, QPrinter::Inch);
paperSize = p.paperSize(QPrinter::Inch);
- QCOMPARE(paperSize, customSize);
+ QVERIFY2(sqrt(pow(paperSize.width() - customSize.width(), 2.0) + pow(paperSize.height() - customSize.height(), 2.0)) < 0.01,
+ msgSizeMismatch(paperSize, customSize));
}
void tst_QPrinter::customPaperSizeAndMargins_data()
@@ -1193,6 +1206,68 @@ void tst_QPrinter::testPageMetrics()
QCOMPARE(printer.pageSizeMM(), QSizeF(widthMMf, heightMMf));
}
+void tst_QPrinter::customPaperNameSettingBySize()
+{
+#ifndef Q_OS_WIN
+ QSKIP("Currently this triggers a problem on non Windows platforms, this will be fixed separately - QTBUG-34521");
+#endif
+ QPrinter printer(QPrinter::HighResolution);
+ QPrinterInfo info(printer);
+ QList<QPair<QString, QSizeF> > sizes = info.supportedSizesWithNames();
+ if (sizes.size() == 0)
+ QSKIP("No printers installed on this machine");
+ for (int i=0; i<sizes.size(); i++) {
+ printer.setPaperSize(sizes.at(i).second, QPrinter::Millimeter);
+ QCOMPARE(sizes.at(i).second, printer.paperSize(QPrinter::Millimeter));
+ // Some printers have the same size under different names which can cause a problem for the test
+ // So we iterate up to the current position to check
+ QSizeF paperSize = sizes.at(i).second;
+ QString paperName = printer.paperName();
+ bool paperNameFound = (sizes.at(i).first == paperName);
+ if (!paperNameFound) {
+ for (int j=0; j<i; j++) {
+ if (sizes.at(j).second == paperSize && sizes.at(j).first == paperName) {
+ paperNameFound = true;
+ break;
+ }
+ }
+ }
+ // Fail with the original values
+ if (!paperNameFound)
+ QCOMPARE(sizes.at(i).first, printer.paperName());
+ }
+
+ // Check setting a custom size after setting a standard one works
+ QSizeF customSize(200, 200);
+ printer.setPaperSize(customSize, QPrinter::Millimeter);
+ QCOMPARE(printer.paperSize(QPrinter::Millimeter), customSize);
+ QCOMPARE(printer.paperSize(), QPrinter::Custom);
+
+ // Finally check setting a standard size after a custom one works
+ printer.setPaperSize(sizes.at(0).second, QPrinter::Millimeter);
+ QCOMPARE(printer.paperName(), sizes.at(0).first);
+ QCOMPARE(printer.paperSize(QPrinter::Millimeter), sizes.at(0).second);
+}
+
+void tst_QPrinter::customPaperNameSettingByName()
+{
+#ifndef Q_OS_WIN
+ QSKIP("Currently this triggers a problem on non Windows platforms, this will be fixed separately - QTBUG-34521");
+#endif
+ QPrinter printer(QPrinter::HighResolution);
+ QPrinterInfo info(printer);
+ QList<QPair<QString, QSizeF> > sizes = info.supportedSizesWithNames();
+ if (sizes.size() == 0)
+ QSKIP("No printers installed on this machine");
+ for (int i=0; i<sizes.size(); i++) {
+ printer.setPaperName(sizes.at(i).first);
+ QCOMPARE(sizes.at(i).first, printer.paperName());
+ QSizeF paperSize = printer.paperSize(QPrinter::Millimeter);
+ QVERIFY2(sqrt(pow(sizes.at(i).second.width() - paperSize.width(), 2.0) + pow(sizes.at(i).second.height() - paperSize.height(), 2.0)) < 0.01,
+ msgSizeMismatch(sizes.at(i).second, paperSize));
+ }
+}
+
#endif // QT_NO_PRINTER
QTEST_MAIN(tst_QPrinter)
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
index 7deb31c2c9..9416224440 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
+++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
@@ -275,6 +275,9 @@ void tst_QPrinterInfo::testConstructors()
QCOMPARE(null.printerName(), QString());
QVERIFY(null.isNull());
+ QPrinterInfo null2(null);
+ QVERIFY(null2.isNull());
+
QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
for (int i = 0; i < printers.size(); ++i) {
@@ -295,6 +298,12 @@ void tst_QPrinterInfo::testConstructors()
void tst_QPrinterInfo::testAssignment()
{
+ QPrinterInfo null;
+ QVERIFY(null.isNull());
+ QPrinterInfo null2;
+ null2 = null;
+ QVERIFY(null2.isNull());
+
QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
for (int i = 0; i < printers.size(); ++i) {
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index d77e372983..1a8e336b55 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -63,7 +63,7 @@ private slots:
void cleanup();
private:
- void doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments);
+ void doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes);
QString logName(const QString &logger) const;
QList<LoggerSet> allLoggerSets() const;
@@ -324,6 +324,7 @@ void tst_Selftests::runSubTest_data()
QTest::addColumn<QString>("subdir");
QTest::addColumn<QStringList>("loggers");
QTest::addColumn<QStringList>("arguments");
+ QTest::addColumn<bool>("crashes");
QStringList tests = QStringList()
// << "alive" // timer dependent
@@ -483,11 +484,14 @@ void tst_Selftests::runSubTest_data()
continue;
}
}
-
+ const bool crashes = subtest == QLatin1String("assert") || subtest == QLatin1String("exceptionthrow")
+ || subtest == QLatin1String("fetchbogus") || subtest == QLatin1String("crashedterminate")
+ || subtest == QLatin1String("crashes") || subtest == QLatin1String("silent");
QTest::newRow(qPrintable(QString("%1 %2").arg(subtest).arg(loggerSet.name)))
<< subtest
<< loggers
<< arguments
+ << crashes
;
}
}
@@ -495,30 +499,41 @@ void tst_Selftests::runSubTest_data()
#ifndef QT_NO_PROCESS
-static void insertEnvironmentVariable(QString const& name, QProcessEnvironment &result)
-{
- const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
- const QString value = systemEnvironment.value(name);
- if (!value.isEmpty())
- result.insert(name, value);
-}
-
-static inline QProcessEnvironment processEnvironment()
+static QProcessEnvironment processEnvironment()
{
- QProcessEnvironment result;
- insertEnvironmentVariable(QStringLiteral("PATH"), result);
- // Preserve DISPLAY for X11 as some tests use Qt GUI.
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
- insertEnvironmentVariable(QStringLiteral("DISPLAY"), result);
-#endif
- insertEnvironmentVariable(QStringLiteral("QT_QPA_PLATFORM"), result);
+ static QProcessEnvironment result;
+ if (result.isEmpty()) {
+ const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
+ foreach (const QString &key, systemEnvironment.keys()) {
+ const bool useVariable = key == QLatin1String("PATH") || key == QLatin1String("QT_QPA_PLATFORM")
+#ifdef Q_OS_UNIX
+ || key == QLatin1String("HOME") || key == QLatin1String("USER") // Required for X11 on openSUSE
+# ifndef Q_OS_MAC
+ || key == QLatin1String("DISPLAY") || key == QLatin1String("XAUTHLOCALHOSTNAME")
+ || key.startsWith(QLatin1String("XDG_"))
+# endif // !Q_OS_MAC
+#endif // Q_OS_UNIX
#ifdef __COVERAGESCANNER__
- insertEnvironmentVariable(QStringLiteral("QT_TESTCOCOON_ACTIVE"), result);
+ || key == QLatin1String("QT_TESTCOCOON_ACTIVE")
#endif
+ ;
+ if (useVariable)
+ result.insert(key, systemEnvironment.value(key));
+ }
+ }
return result;
}
-void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments)
+static inline QByteArray msgProcessError(const QString &binary, const QStringList &args,
+ const QProcessEnvironment &e, const QString &what)
+{
+ QString result;
+ QTextStream(&result) <<"Error running " << binary << ' ' << args.join(' ')
+ << " with environment " << e.toStringList().join(' ') << ": " << what;
+ return result.toLocal8Bit();
+}
+
+void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments, bool crashes)
{
#if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX)
if (arguments.contains("-callgrind")) {
@@ -536,8 +551,14 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
proc.setProcessEnvironment(environment);
const QString path = subdir + QLatin1Char('/') + subdir;
proc.start(path, arguments);
- QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString())));
- QVERIFY2(proc.waitForFinished(), qPrintable(proc.errorString()));
+ QVERIFY2(proc.waitForStarted(), msgProcessError(path, arguments, environment, QStringLiteral("Cannot start: ") + proc.errorString()));
+ QVERIFY2(proc.waitForFinished(), msgProcessError(path, arguments, environment, QStringLiteral("Timed out: ") + proc.errorString()));
+ if (!crashes) {
+ QVERIFY2(proc.exitStatus() == QProcess::NormalExit,
+ msgProcessError(path, arguments, environment,
+ QStringLiteral("Crashed: ") + proc.errorString()
+ + QStringLiteral(": ") + QString::fromLocal8Bit(proc.readAllStandardError())));
+ }
QList<QByteArray> actualOutputs;
for (int i = 0; i < loggers.count(); ++i) {
@@ -704,8 +725,9 @@ void tst_Selftests::runSubTest()
QFETCH(QString, subdir);
QFETCH(QStringList, loggers);
QFETCH(QStringList, arguments);
+ QFETCH(bool, crashes);
- doRunSubTest(subdir, loggers, arguments);
+ doRunSubTest(subdir, loggers, arguments, crashes);
#endif // !QT_NO_PROCESS
}
diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro
index 0d25131c47..779e992881 100644
--- a/tests/auto/tools/moc/moc.pro
+++ b/tests/auto/tools/moc/moc.pro
@@ -23,7 +23,8 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n
forward-declared-param.h \
parse-defines.h \
function-with-attributes.h \
- plugin_metadata.h
+ plugin_metadata.h \
+ single-quote-digit-separator-n3781.h
if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h
diff --git a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
new file mode 100644
index 0000000000..0b234011d5
--- /dev/null
+++ b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+class KDAB : public QObject
+{
+ Q_OBJECT
+public:
+ // C++1y allows use of single quote as a digit separator, useful for large
+ // numbers. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf
+ // Ensure that moc does not get confused with this.
+ enum Salaries {
+ Steve
+#ifdef Q_MOC_RUN
+ = 1'234'567
+#endif
+ };
+ Q_ENUMS(Salaries)
+};
diff --git a/tests/auto/tools/qdbuscpp2xml/test1.h b/tests/auto/tools/qdbuscpp2xml/test1.h
index d4a7d1dab3..b08115e193 100644
--- a/tests/auto/tools/qdbuscpp2xml/test1.h
+++ b/tests/auto/tools/qdbuscpp2xml/test1.h
@@ -54,7 +54,18 @@ class Test1 : public QObject
Q_CLASSINFO("D-Bus Interface", "org.qtProject.qdbuscpp2xmlTests.Test1")
Q_PROPERTY(int numProperty1 READ numProperty1 CONSTANT)
Q_PROPERTY(int numProperty2 READ numProperty2 WRITE setNumProperty2)
+ Q_ENUMS(Salaries)
public:
+ // C++1y allows use of single quote as a digit separator, useful for large
+ // numbers. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf
+ // Ensure that qdbuscpp2xml does not get confused with this appearing.
+ enum Salaries {
+ Steve
+#ifdef Q_MOC_RUN
+ = 1'234'567
+#endif
+ };
+
Test1(QObject *parent = 0) : QObject(parent) {}
int numProperty1() { return 42; }
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 816d375b97..3a1f650351 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -212,7 +212,14 @@ void tst_QFileSystemModel::rootPath()
QString oldRootPath = model->rootPath();
const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
QVERIFY(!documentPaths.isEmpty());
- const QString documentPath = documentPaths.front();
+ QString documentPath = documentPaths.front();
+ // In particular on Linux, ~/Documents (the first
+ // DocumentsLocation) may not exist, so choose ~ in that case:
+ if (!QFile::exists(documentPath)) {
+ documentPath = QDir::homePath();
+ qWarning("%s: first documentPath \"%s\" does not exist. Using ~ (\"%s\") instead.",
+ Q_FUNC_INFO, qPrintable(documentPaths.front()), qPrintable(documentPath));
+ }
root = model->setRootPath(documentPath);
QTRY_VERIFY(model->rowCount(root) >= 0);
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 68502f0d8d..060fa51293 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
@@ -57,6 +57,8 @@ public:
virtual ~tst_QProgressDialog();
private slots:
+ void autoShow_data();
+ void autoShow();
void getSetCheck();
void task198202();
void QTBUG_31046();
@@ -70,6 +72,34 @@ tst_QProgressDialog::~tst_QProgressDialog()
{
}
+void tst_QProgressDialog::autoShow_data()
+{
+ QTest::addColumn<int>("min");
+ QTest::addColumn<int>("max");
+ QTest::addColumn<int>("delay");
+ QTest::addColumn<bool>("expectedAutoShow");
+
+ QTest::newRow("50_to_100_long") << 50 << 100 << 100 << true; // 50*100ms = 5s
+ QTest::newRow("50_to_100_short") << 50 << 1 << 100 << false; // 50*1ms = 50ms
+
+ QTest::newRow("0_to_100_long") << 0 << 100 << 100 << true; // 100*100ms = 10s
+ QTest::newRow("0_to_10_short") << 0 << 10 << 100 << false; // 10*100ms = 1s
+}
+
+void tst_QProgressDialog::autoShow()
+{
+ QFETCH(int, min);
+ QFETCH(int, max);
+ QFETCH(int, delay);
+ QFETCH(bool, expectedAutoShow);
+
+ QProgressDialog dlg("", "", min, max);
+ dlg.setValue(0);
+ QThread::msleep(delay);
+ dlg.setValue(min+1);
+ QCOMPARE(dlg.isVisible(), expectedAutoShow);
+}
+
// Testing get/set functions
void tst_QProgressDialog::getSetCheck()
{
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 4506d0af14..a711bc28e3 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -52,6 +52,8 @@
#include <QWizard>
#include <QTreeWidget>
+Q_DECLARE_METATYPE(QWizard::WizardButton);
+
static QImage grabWidget(QWidget *window)
{
return window->grab().toImage();
@@ -100,6 +102,8 @@ private slots:
void setWizardStyle();
void removePage();
void sideWidget();
+ void objectNames_data();
+ void objectNames();
// task-specific tests below me:
void task177716_disableCommitButton();
@@ -2384,6 +2388,44 @@ void tst_QWizard::sideWidget()
QVERIFY(wizard.sideWidget() == 0);
}
+void tst_QWizard::objectNames_data()
+{
+ QTest::addColumn<QWizard::WizardButton>("wizardButton");
+ QTest::addColumn<QString>("buttonName");
+
+ QTest::newRow("BackButton") << QWizard::BackButton << QStringLiteral("__qt__passive_wizardbutton0");
+ QTest::newRow("NextButton") << QWizard::NextButton << QStringLiteral("__qt__passive_wizardbutton1");
+ QTest::newRow("CommitButton") << QWizard::CommitButton << QStringLiteral("qt_wizard_commit");
+ QTest::newRow("FinishButton") << QWizard::FinishButton << QStringLiteral("qt_wizard_finish");
+ QTest::newRow("CancelButton") << QWizard::CancelButton << QStringLiteral("qt_wizard_cancel");
+ QTest::newRow("HelpButton") << QWizard::HelpButton << QStringLiteral("__qt__passive_wizardbutton5");
+ QTest::newRow("CustomButton1") << QWizard::CustomButton1 << QStringLiteral("__qt__passive_wizardbutton6");
+ QTest::newRow("CustomButton2") << QWizard::CustomButton2 << QStringLiteral("__qt__passive_wizardbutton7");
+ QTest::newRow("CustomButton3") << QWizard::CustomButton3 << QStringLiteral("__qt__passive_wizardbutton8");
+}
+
+void tst_QWizard::objectNames()
+{
+ QFETCH(QWizard::WizardButton, wizardButton);
+ QFETCH(QString, buttonName);
+
+ QWizard wizard;
+ QList<QWizard::WizardButton> buttons = QList<QWizard::WizardButton>()
+ << QWizard::BackButton
+ << QWizard::NextButton
+ << QWizard::CommitButton
+ << QWizard::FinishButton
+ << QWizard::CancelButton
+ << QWizard::HelpButton
+ << QWizard::CustomButton1
+ << QWizard::CustomButton2
+ << QWizard::CustomButton3
+ ;
+ QVERIFY(buttons.contains(wizardButton));
+ QVERIFY(wizard.button(wizardButton));
+ QCOMPARE(wizard.button(wizardButton)->objectName(), buttonName);
+}
+
class task177716_CommitPage : public QWizardPage
{
Q_OBJECT
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 4f25aab32a..2798d1e22d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -6458,6 +6458,12 @@ public:
void tst_QGraphicsItem::ensureUpdateOnTextItem()
{
+#ifdef Q_OS_MAC
+ if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) {
+ QSKIP("This test is unstable on 10.7 in CI");
+ }
+#endif
+
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index b3fba29f81..dfc8465210 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -4072,6 +4072,7 @@ void tst_QGraphicsScene::isActive()
{
+ const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QWidget toplevel2;
QHBoxLayout *layout = new QHBoxLayout;
toplevel2.setLayout(layout);
@@ -4085,12 +4086,13 @@ void tst_QGraphicsScene::isActive()
QVERIFY(!scene1.hasFocus());
QVERIFY(!scene2.hasFocus());
+ toplevel2.move(availableGeometry.topLeft() + QPoint(50, 50));
toplevel2.show();
QApplication::setActiveWindow(&toplevel2);
QVERIFY(QTest::qWaitForWindowActive(&toplevel2));
QCOMPARE(QApplication::activeWindow(), &toplevel2);
- QVERIFY(scene1.isActive());
+ QTRY_VERIFY(scene1.isActive());
QVERIFY(!scene2.isActive());
QVERIFY(scene1.hasFocus());
QVERIFY(!scene2.hasFocus());
@@ -4133,6 +4135,7 @@ void tst_QGraphicsScene::isActive()
QVERIFY(!scene2.hasFocus());
QGraphicsView topLevelView;
+ topLevelView.move(availableGeometry.topLeft() + QPoint(500, 50));
topLevelView.show();
QApplication::setActiveWindow(&topLevelView);
topLevelView.setFocus();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 7a0ba50ff0..37cc6522a2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -4687,13 +4687,17 @@ public:
void tst_QGraphicsView::hoverLeave()
{
+ const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.resize(160, 160);
+ view.move(availableGeometry.center() - QPoint(80, 80));
GraphicsItemWithHover *item = new GraphicsItemWithHover;
scene.addItem(item);
// move the cursor out of the way
- QCursor::setPos(1,1);
+ const QPoint outOfWindow = view.geometry().topRight() + QPoint(50, 0);
+ QCursor::setPos(outOfWindow);
view.show();
qApp->setActiveWindow(&view);
@@ -4701,16 +4705,14 @@ void tst_QGraphicsView::hoverLeave()
QPoint pos = view.viewport()->mapToGlobal(view.mapFromScene(item->mapToScene(10, 10)));
QCursor::setPos(pos);
- QTest::qWait(200);
- QVERIFY(item->receivedEnterEvent);
+ QTRY_VERIFY(item->receivedEnterEvent);
QCOMPARE(item->enterWidget, view.viewport());
- QCursor::setPos(1,1);
- QTest::qWait(200);
+ QCursor::setPos(outOfWindow);
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-26274 - behaviour regression", Abort);
#endif
- QVERIFY(item->receivedLeaveEvent);
+ QTRY_VERIFY(item->receivedLeaveEvent);
QCOMPARE(item->leaveWidget, view.viewport());
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 2dd2089f81..3271b31692 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -53,6 +53,7 @@
#include <qwidgetaction.h>
#include <qcommonstyle.h>
#include <qstylefactory.h>
+#include <qscreen.h>
#include "../../../qtest-config.h"
@@ -1780,8 +1781,11 @@ void tst_QGraphicsWidget::verifyFocusChain()
void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
{
+ const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.resize(200, 150);
+ view.move(availableGeometry.topLeft() + QPoint(50, 50));
view.show();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -1801,6 +1805,9 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
QVERIFY(w1_1->hasFocus());
QWidget myWidget(0);
QLineEdit edit(&myWidget);
+ (new QHBoxLayout(&myWidget))->addWidget(&edit);
+ edit.setMinimumWidth(160); // Windows
+ myWidget.move(availableGeometry.topLeft() + QPoint(350, 50));
myWidget.show();
edit.setFocus();
QTRY_VERIFY(edit.hasFocus());
@@ -1809,8 +1816,9 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
w->setParentItem(parent);
//We don't crash perfect
QVERIFY(w);
- QTest::mouseMove(view.viewport());
- QTest::mouseClick(view.viewport(), Qt::LeftButton, 0);
+ const QPoint center(view.viewport()->width() / 2, view.viewport()->height() / 2);
+ QTest::mouseMove(view.viewport(), center);
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, center);
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-23699", Continue);
#endif
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 0c6d369254..36bf76564f 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -58,17 +58,8 @@
#include <qscrollbar.h>
#include <qboxlayout.h>
#include <qlineedit.h>
-
-// Will try to wait for the condition while allowing event processing
-// for a maximum of 5 seconds.
-#define TRY_COMPARE(expr, expected) \
- do { \
- const int step = 50; \
- for (int q = 0; q < 5000 && ((expr) != (expected)); q+=step) { \
- QTest::qWait(step); \
- } \
- QCOMPARE(expr, expected); \
- } while(0)
+#include <qscreen.h>
+#include <qscopedpointer.h>
static inline void setFrameless(QWidget *w)
{
@@ -78,6 +69,22 @@ static inline void setFrameless(QWidget *w)
w->setWindowFlags(flags);
}
+static inline void centerOnScreen(QWidget *w)
+{
+ const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
+ w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
+}
+
+// Move cursor out of widget area to avoid undesired interaction on Mac.
+static inline void moveCursorAway(const QWidget *topLevel)
+{
+#ifndef QT_NO_CURSOR
+ QCursor::setPos(topLevel->geometry().topRight() + QPoint(100, 0));
+#else
+ Q_UNUSED(topLevel)
+#endif
+}
+
class TestView : public QAbstractItemView
{
Q_OBJECT
@@ -374,25 +381,27 @@ void tst_QAbstractItemView::emptyModels()
{
QFETCH(QString, viewType);
- TestView *view = 0;
+ QScopedPointer<QAbstractItemView> view;
if (viewType == "QListView")
- view = reinterpret_cast<TestView*>(new QListView());
+ view.reset(new QListView());
else if (viewType == "QTableView")
- view = reinterpret_cast<TestView*>(new QTableView());
+ view.reset(new QTableView());
else if (viewType == "QTreeView")
- view = reinterpret_cast<TestView*>(new QTreeView());
+ view.reset(new QTreeView());
else if (viewType == "QHeaderView")
- view = reinterpret_cast<TestView*>(new QHeaderView(Qt::Vertical));
+ view.reset(new QHeaderView(Qt::Vertical));
else
QVERIFY(0);
+ centerOnScreen(view.data());
+ moveCursorAway(view.data());
view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
QVERIFY(!view->model());
QVERIFY(!view->selectionModel());
//QVERIFY(view->itemDelegate() != 0);
- basic_tests(view);
- delete view;
+ basic_tests(reinterpret_cast<TestView*>(view.data()));
}
void tst_QAbstractItemView::setModel_data()
@@ -408,24 +417,28 @@ void tst_QAbstractItemView::setModel_data()
void tst_QAbstractItemView::setModel()
{
QFETCH(QString, viewType);
- TestView *view = 0;
+
+ QScopedPointer<QAbstractItemView> view;
+
if (viewType == "QListView")
- view = reinterpret_cast<TestView*>(new QListView());
+ view.reset(new QListView());
else if (viewType == "QTableView")
- view = reinterpret_cast<TestView*>(new QTableView());
+ view.reset(new QTableView());
else if (viewType == "QTreeView")
- view = reinterpret_cast<TestView*>(new QTreeView());
+ view.reset(new QTreeView());
else if (viewType == "QHeaderView")
- view = reinterpret_cast<TestView*>(new QHeaderView(Qt::Vertical));
+ view.reset(new QHeaderView(Qt::Vertical));
else
QVERIFY(0);
+ centerOnScreen(view.data());
+ moveCursorAway(view.data());
view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
QStandardItemModel model(20,20);
view->setModel(0);
view->setModel(&model);
- basic_tests(view);
- delete view;
+ basic_tests(reinterpret_cast<TestView*>(view.data()));
}
void tst_QAbstractItemView::basic_tests(TestView *view)
@@ -636,7 +649,10 @@ void tst_QAbstractItemView::noModel()
view.setModel(&model);
// Make the viewport smaller than the contents, so that we can scroll
view.resize(100,100);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
// make sure that the scrollbars are not at value 0
view.scrollTo(view.model()->index(10,10));
@@ -656,7 +672,10 @@ void tst_QAbstractItemView::dragSelect()
QTableView view;
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.setVisible(true);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
const int delay = 2;
for (int i = 0; i < 2; ++i) {
@@ -677,7 +696,10 @@ void tst_QAbstractItemView::rowDelegate()
QTableView view;
view.setModel(&model);
view.setItemDelegateForRow(3, &delegate);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index = model.index(3, 0);
view.openPersistentEditor(index);
@@ -694,7 +716,10 @@ void tst_QAbstractItemView::columnDelegate()
QTableView view;
view.setModel(&model);
view.setItemDelegateForColumn(3, &delegate);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index = model.index(0, 3);
view.openPersistentEditor(index);
@@ -747,11 +772,13 @@ void tst_QAbstractItemView::persistentEditorFocus()
view.setCurrentIndex(model.index(0, 0));
QCOMPARE(view.currentIndex(), model.index(0, 0));
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTRY_VERIFY(view.isVisible());
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
for (int i = 0; i < list.count(); ++i) {
- TRY_COMPARE(list.at(i)->isVisible(), true);
+ QTRY_VERIFY(list.at(i)->isVisible());
QPoint p = QPoint(5, 5);
QMouseEvent mouseEvent(QEvent::MouseButtonPress, p, Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
@@ -1045,6 +1072,8 @@ void tst_QAbstractItemView::setItemDelegate()
}
}
}
+ centerOnScreen(&v);
+ moveCursorAway(&v);
v.show();
#ifdef Q_WS_X11
QCursor::setPos(v.geometry().center());
@@ -1056,7 +1085,7 @@ void tst_QAbstractItemView::setItemDelegate()
v.edit(index);
// This will close the editor
- TRY_COMPARE(QApplication::focusWidget() == 0, false);
+ QTRY_VERIFY(QApplication::focusWidget());
QWidget *editor = QApplication::focusWidget();
QVERIFY(editor);
editor->hide();
@@ -1122,20 +1151,25 @@ void tst_QAbstractItemView::setCurrentIndex()
QFETCH(int, itemFlags);
QFETCH(bool, result);
- TestView *view = 0;
+ QScopedPointer<QAbstractItemView> view;
+
if (viewType == "QListView")
- view = reinterpret_cast<TestView*>(new QListView());
+ view.reset(new QListView());
else if (viewType == "QTableView")
- view = reinterpret_cast<TestView*>(new QTableView());
+ view.reset(new QTableView());
else if (viewType == "QTreeView")
- view = reinterpret_cast<TestView*>(new QTreeView());
+ view.reset(new QTreeView());
else if (viewType == "QHeaderView")
- view = reinterpret_cast<TestView*>(new QHeaderView(Qt::Vertical));
+ view.reset(new QHeaderView(Qt::Vertical));
else
QVERIFY(0);
+
+ centerOnScreen(view.data());
+ moveCursorAway(view.data());
view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
- QStandardItemModel *model = new QStandardItemModel(view);
+ QStandardItemModel *model = new QStandardItemModel(view.data());
QStandardItem *item = new QStandardItem("first item");
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
model->appendRow(item);
@@ -1150,8 +1184,6 @@ void tst_QAbstractItemView::setCurrentIndex()
QVERIFY(view->currentIndex() == model->index(0,0));
view->setCurrentIndex(model->index(1,0));
QVERIFY(view->currentIndex() == model->index(result ? 1 : 0,0));
-
- delete view;
}
void tst_QAbstractItemView::task221955_selectedEditor()
@@ -1170,11 +1202,13 @@ void tst_QAbstractItemView::task221955_selectedEditor()
tree.setItemWidget(dummy, 0, button = new QPushButton("More..."));
button->setAutoFillBackground(true); // as recommended in doc
+ centerOnScreen(&tree);
+ moveCursorAway(&tree);
tree.show();
tree.setFocus();
tree.setCurrentIndex(tree.model()->index(1,0));
- QTest::qWait(100);
QApplication::setActiveWindow(&tree);
+ QVERIFY(QTest::qWaitForWindowActive(&tree));
QVERIFY(! tree.selectionModel()->selectedIndexes().contains(tree.model()->index(3,0)));
@@ -1218,9 +1252,11 @@ void tst_QAbstractItemView::task250754_fontChange()
}
tree.setModel(m);
+ w.resize(160, 240); // Minimum width for windows with frame on Windows 8
+ centerOnScreen(&w);
+ moveCursorAway(&w);
w.show();
- w.resize(150,240);
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QFont font = tree.font();
font.setPixelSize(10);
tree.setFont(font);
@@ -1244,8 +1280,10 @@ void tst_QAbstractItemView::task200665_itemEntered()
QStandardItemModel model(1000,1);
QListView view;
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QRect rect = view.visualRect(model.index(0,0));
QCursor::setPos( view.viewport()->mapToGlobal(rect.center()) );
QSignalSpy spy(&view, SIGNAL(entered(QModelIndex)));
@@ -1267,7 +1305,10 @@ void tst_QAbstractItemView::task257481_emptyEditor()
QTreeView treeView;
treeView.setRootIsDecorated(false);
treeView.setModel(&model);
+ centerOnScreen(&treeView);
+ moveCursorAway(&treeView);
treeView.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&treeView));
treeView.edit(model.index(0,0));
QList<QLineEdit *> lineEditors = treeView.viewport()->findChildren<QLineEdit *>();
@@ -1298,14 +1339,16 @@ void tst_QAbstractItemView::shiftArrowSelectionAfterScrolling()
}
QListView view;
- view.setFixedSize(150, 250);
+ view.setFixedSize(160, 250); // Minimum width for windows with frame on Windows 8
view.setFlow(QListView::LeftToRight);
view.setGridSize(QSize(100, 100));
view.setSelectionMode(QListView::ExtendedSelection);
view.setViewMode(QListView::IconMode);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index0 = model.index(0, 0);
QModelIndex index1 = model.index(1, 0);
@@ -1333,14 +1376,16 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection()
}
QListView view;
- view.setFixedSize(150, 450);
+ view.setFixedSize(160, 450); // Minimum width for windows with frame on Windows 8
view.setFlow(QListView::LeftToRight);
view.setGridSize(QSize(100, 100));
view.setSelectionMode(QListView::ExtendedSelection);
view.setViewMode(QListView::IconMode);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index0 = model.index(0, 0);
QModelIndex index1 = model.index(1, 0);
@@ -1408,14 +1453,16 @@ void tst_QAbstractItemView::ctrlRubberbandSelection()
}
QListView view;
- view.setFixedSize(150, 450);
+ view.setFixedSize(160, 450); // Minimum width for windows with frame on Windows 8
view.setFlow(QListView::LeftToRight);
view.setGridSize(QSize(100, 100));
view.setSelectionMode(QListView::ExtendedSelection);
view.setViewMode(QListView::IconMode);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
- QTest::qWait(30);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index1 = model.index(1, 0);
QModelIndex index2 = model.index(2, 0);
@@ -1454,6 +1501,8 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection()
font.setPixelSize(10);
view.setFont(font);
view.resize(200,240);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
QApplication::setActiveWindow(&view);
@@ -1493,7 +1542,11 @@ void tst_QAbstractItemView::QTBUG6753_selectOnSelection()
for (int j = 0; j < table.columnCount(); ++j)
table.setItem(i, j, new QTableWidgetItem("choo-be-doo-wah"));
+ centerOnScreen(&table);
+ moveCursorAway(&table);
table.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&table));
+
table.setSelectionMode(QAbstractItemView::ExtendedSelection);
table.selectAll();
QVERIFY(QTest::qWaitForWindowExposed(&table));
@@ -1523,6 +1576,8 @@ void tst_QAbstractItemView::testClickedSignal()
{
QTableWidget view(5, 5);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -1591,6 +1646,8 @@ void tst_QAbstractItemView::testChangeEditorState()
view.setEditTriggers(QAbstractItemView::CurrentChanged);
view.setItemDelegate(new StateChangeDelegate);
view.setModel(&model);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -1607,7 +1664,10 @@ void tst_QAbstractItemView::deselectInSingleSelection()
s.setRowCount(10);
s.setColumnCount(10);
view.setModel(&s);
+ centerOnScreen(&view);
+ moveCursorAway(&view);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.setSelectionMode(QAbstractItemView::SingleSelection);
view.setEditTriggers(QAbstractItemView::NoEditTriggers);
QApplication::setActiveWindow(&view);
@@ -1650,6 +1710,8 @@ void tst_QAbstractItemView::testNoActivateOnDisabledItem()
model.setItem(0, 0, item);
item->setFlags(Qt::NoItemFlags);
treeView.setModel(&model);
+ centerOnScreen(&treeView);
+ moveCursorAway(&treeView);
treeView.show();
QApplication::setActiveWindow(&treeView);
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 398b1b4d98..3e6df0f136 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -368,6 +368,8 @@ void tst_QHeaderView::getSetCheck()
QCOMPARE(0, obj1.minimumSectionSize());
obj1.setMinimumSectionSize(99999);
QCOMPARE(99999, obj1.minimumSectionSize());
+ obj1.setMinimumSectionSize(-1);
+ QVERIFY(obj1.minimumSectionSize() < 100);
// int QHeaderView::offset()
// void QHeaderView::setOffset(int)
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 8d31fcdf13..ccdce1fe0c 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -259,6 +259,7 @@ private slots:
void taskQTBUG_25333_adjustViewOptionsForIndex();
void taskQTBUG_18539_emitLayoutChanged();
void taskQTBUG_8176_emitOnExpandAll();
+ void taskQTBUG_34717_collapseAtBottom();
void testInitialFocus();
};
@@ -4240,6 +4241,35 @@ void tst_QTreeView::taskQTBUG_8176_emitOnExpandAll()
QCOMPARE(spy2.size(), 1); // item2 is collapsed
}
+// From QTBUG_34717 (QTreeWidget crashes when scrolling to the end
+// of an expanded tree, then collapse all)
+// The test passes simply if it doesn't crash.
+void tst_QTreeView::taskQTBUG_34717_collapseAtBottom()
+{
+ QTreeWidget treeWidget;
+ treeWidget.header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ treeWidget.setColumnCount(2);
+ QTreeWidgetItem *mainItem = new QTreeWidgetItem(&treeWidget, QStringList() << "Root");
+ for (int i = 0; i < 200; ++i) {
+ QTreeWidgetItem *item = new QTreeWidgetItem(mainItem, QStringList(QString("Item")));
+ new QTreeWidgetItem(item, QStringList() << "Child" << "1");
+ new QTreeWidgetItem(item, QStringList() << "Child" << "2");
+ new QTreeWidgetItem(item, QStringList() << "Child" << "3");
+ }
+ treeWidget.show();
+ treeWidget.expandAll();
+ treeWidget.scrollToBottom();
+ treeWidget.collapseAll();
+
+ treeWidget.setAnimated(true);
+ treeWidget.expandAll();
+ treeWidget.scrollToBottom();
+ mainItem->setExpanded(false);
+
+ PublicView *pview = (PublicView*) &treeWidget;
+ QVERIFY(pview->sizeHintForColumn(1) >= 0);
+}
+
void tst_QTreeView::testInitialFocus()
{
QTreeWidget treeWidget;
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 16bd4a6f7b..e13dfe836f 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -153,6 +153,7 @@ private slots:
void focusChanged();
void focusOut();
+ void focusMouseClick();
void execAfterExit();
@@ -1773,6 +1774,63 @@ void tst_QApplication::focusOut()
QTest::qWait(2000);
}
+class SpontaneousEvent
+{
+ Q_GADGET
+ QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
+ Q_ENUMS(Type)
+public:
+ enum Type {
+ Void
+ };
+
+ virtual ~SpontaneousEvent() {}
+
+ QEventPrivate *d;
+ ushort t;
+
+ ushort posted : 1;
+ ushort spont : 1;
+};
+
+void tst_QApplication::focusMouseClick()
+{
+ int argc = 1;
+ QApplication app(argc, &argv0);
+
+ QWidget w;
+ w.setFocusPolicy(Qt::StrongFocus);
+ QWidget w2(&w);
+ w2.setFocusPolicy(Qt::TabFocus);
+ w.show();
+ w.setFocus();
+ QTRY_COMPARE(QApplication::focusWidget(), &w);
+
+ // front most widget has Qt::TabFocus, parent widget accepts clicks as well
+ // now send a mouse button press event and check what happens with the focus
+ // it should be given to the parent widget
+ QMouseEvent ev(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QVERIFY(ev.spontaneous());
+ qApp->notify(&w2, &ev);
+ QCOMPARE(QApplication::focusWidget(), &w);
+
+ // then we give the inner widget strong focus -> it should get focus
+ w2.setFocusPolicy(Qt::StrongFocus);
+ reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QVERIFY(ev.spontaneous());
+ qApp->notify(&w2, &ev);
+ QTRY_COMPARE(QApplication::focusWidget(), &w2);
+
+ // now back to tab focus and click again (it already had focus) -> focus should stay
+ // (focus was revoked as of QTBUG-34042)
+ w2.setFocusPolicy(Qt::TabFocus);
+ reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QVERIFY(ev.spontaneous());
+ qApp->notify(&w2, &ev);
+ QCOMPARE(QApplication::focusWidget(), &w2);
+}
+
void tst_QApplication::execAfterExit()
{
int argc = 1;
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index 135605f185..d04b812878 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -47,6 +47,7 @@
#include <qproxystyle.h>
#include <qsizepolicy.h>
+#include <QtWidgets/QCheckBox>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPushButton>
@@ -347,6 +348,19 @@ void tst_QFormLayout::spacing()
style->hspacing = 20;
//QCOMPARE(fl->spacing(), 20);
+
+
+ // Do not assert if spacings are negative (QTBUG-34731)
+ style->vspacing = -1;
+ style->hspacing = -1;
+ QLabel *label = new QLabel(tr("Asserts"));
+ QCheckBox *checkBox = new QCheckBox(tr("Yes"));
+ fl->setWidget(0, QFormLayout::LabelRole, label);
+ fl->setWidget(1, QFormLayout::FieldRole, checkBox);
+ w->resize(200, 100);
+ w->show();
+ QVERIFY(QTest::qWaitForWindowExposed(w));
+
delete w;
delete style;
}
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 2da8df6116..de028aa462 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -75,6 +75,7 @@
#include <qproxystyle.h>
#include <QtWidgets/QGraphicsView>
#include <QtWidgets/QGraphicsProxyWidget>
+#include <QtGui/qwindow.h>
#include "../../../qtest-config.h"
@@ -172,6 +173,24 @@ static inline void centerOnScreen(QWidget *w)
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
}
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+static inline void setWindowsAnimationsEnabled(bool enabled)
+{
+ ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), enabled };
+ SystemParametersInfo(SPI_SETANIMATION, 0, &animation, 0);
+}
+
+static inline bool windowsAnimationsEnabled()
+{
+ ANIMATIONINFO animation = { sizeof(ANIMATIONINFO), 0 };
+ SystemParametersInfo(SPI_GETANIMATION, 0, &animation, 0);
+ return animation.iMinAnimate;
+}
+#else // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+inline void setWindowsAnimationsEnabled(bool) {}
+static inline bool windowsAnimationsEnabled() { return false; }
+#endif // !Q_OS_WIN || Q_OS_WINCE || Q_OS_WINRT
+
class tst_QWidget : public QObject
{
Q_OBJECT
@@ -427,6 +446,7 @@ private:
QWidget *testWidget;
const QString m_platform;
+ const bool m_windowsAnimationsEnabled;
};
bool tst_QWidget::ensureScreenSize(int width, int height)
@@ -581,8 +601,12 @@ void tst_QWidget::getSetCheck()
#endif
}
-tst_QWidget::tst_QWidget() : m_platform(qApp->platformName().toLower())
+tst_QWidget::tst_QWidget()
+ : m_platform(qApp->platformName().toLower())
+ , m_windowsAnimationsEnabled(windowsAnimationsEnabled())
{
+ if (m_windowsAnimationsEnabled) // Disable animations which can interfere with screen grabbing in moveChild(), showAndMoveChild()
+ setWindowsAnimationsEnabled(false);
QFont font;
font.setBold(true);
font.setPointSize(42);
@@ -598,6 +622,8 @@ tst_QWidget::tst_QWidget() : m_platform(qApp->platformName().toLower())
tst_QWidget::~tst_QWidget()
{
+ if (m_windowsAnimationsEnabled)
+ setWindowsAnimationsEnabled(m_windowsAnimationsEnabled);
}
class BezierViewer : public QWidget {
@@ -4753,8 +4779,8 @@ void tst_QWidget::windowMoveResize()
class ColorWidget : public QWidget
{
public:
- ColorWidget(QWidget *parent = 0, const QColor &c = QColor(Qt::red))
- : QWidget(parent, Qt::FramelessWindowHint), color(c), enters(0), leaves(0)
+ ColorWidget(QWidget *parent = 0, Qt::WindowFlags f = 0, const QColor &c = QColor(Qt::red))
+ : QWidget(parent, f), color(c), enters(0), leaves(0)
{
QPalette opaquePalette = palette();
opaquePalette.setColor(backgroundRole(), color);
@@ -4785,31 +4811,79 @@ public:
int leaves;
};
-#define VERIFY_COLOR(region, color) { \
+static inline QByteArray msgRgbMismatch(unsigned actual, unsigned expected)
+{
+ return QByteArrayLiteral("Color mismatch, 0x") + QByteArray::number(actual, 16) +
+ QByteArrayLiteral(" != 0x") + QByteArray::number(expected, 16);
+}
+
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+QT_BEGIN_NAMESPACE
+extern Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0);
+QT_END_NAMESPACE
+
+// grabs the window *without including any overlapping windows*
+static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height)
+{
+ const HWND hwnd = (HWND)window->winId();
+
+ // Create and setup bitmap
+ const HDC displayDc = ::GetDC(0);
+ const HDC bitmapDc = ::CreateCompatibleDC(displayDc);
+ const HBITMAP bitmap = ::CreateCompatibleBitmap(displayDc, width, height);
+ const HGDIOBJ oldBitmap = ::SelectObject(bitmapDc, bitmap);
+
+ // copy data
+ const HDC windowDc = ::GetDC(hwnd);
+ ::BitBlt(bitmapDc, 0, 0, width, height, windowDc, x, y, SRCCOPY);
+
+ // clean up all but bitmap
+ ::ReleaseDC(hwnd, windowDc);
+ ::SelectObject(bitmapDc, oldBitmap);
+ ::DeleteDC(bitmapDc);
+
+ const QPixmap pixmap = qt_pixmapFromWinHBITMAP(bitmap);
+
+ ::DeleteObject(bitmap);
+ ::ReleaseDC(0, displayDc);
+
+ return pixmap;
+}
+#else
+// fallback for other platforms.
+static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height)
+{
+ QScreen *screen = window->screen();
+ return screen ? screen->grabWindow(window->winId(), x, y, width, height) : QPixmap();
+}
+#endif //defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+
+#define VERIFY_COLOR(child, region, color) do { \
const QRegion r = QRegion(region); \
- QScreen *screen = qApp->primaryScreen(); \
- const WId desktopWinId = QDesktopWidget().winId(); \
+ QWindow *window = child.window()->windowHandle(); \
+ Q_ASSERT(window); \
+ const QPoint offset = child.mapTo(child.window(), QPoint(0,0)); \
for (int i = 0; i < r.rects().size(); ++i) { \
- const QRect rect = r.rects().at(i); \
+ const QRect rect = r.rects().at(i).translated(offset); \
for (int t = 0; t < 5; t++) { \
- const QPixmap pixmap = screen->grabWindow(desktopWinId, \
- rect.left(), rect.top(), \
- rect.width(), rect.height()); \
+ const QPixmap pixmap = grabWindow(window, \
+ rect.left(), rect.top(), \
+ rect.width(), rect.height()); \
QCOMPARE(pixmap.size(), rect.size()); \
QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \
- expectedPixmap.detach(); \
+ expectedPixmap.detach(); \
expectedPixmap.fill(color); \
- QImage image = pixmap.toImage(); \
+ QImage image = pixmap.toImage(); \
uint alphaCorrection = image.format() == QImage::Format_RGB32 ? 0xff000000 : 0; \
- uint firstPixel = image.pixel(0,0) | alphaCorrection; \
- if ( firstPixel != QColor(color).rgb() && t < 4 ) \
+ uint firstPixel = image.pixel(0,0) | alphaCorrection; \
+ if ( firstPixel != QColor(color).rgb() && t < 4 ) \
{ QTest::qWait(200); continue; } \
- QCOMPARE(firstPixel, QColor(color).rgb()); \
+ QVERIFY2(firstPixel == QColor(color).rgb(), msgRgbMismatch(firstPixel, QColor(color).rgb())); \
QCOMPARE(pixmap, expectedPixmap); \
break; \
} \
} \
-}
+} while (0)
void tst_QWidget::popupEnterLeave()
{
@@ -4817,7 +4891,7 @@ void tst_QWidget::popupEnterLeave()
parent.setWindowFlags(Qt::FramelessWindowHint);
parent.setGeometry(10, 10, 200, 100);
- ColorWidget alien(&parent, Qt::black);
+ ColorWidget alien(&parent, Qt::Widget, Qt::black);
alien.setGeometry(0, 0, 10, 10);
alien.show();
@@ -4868,34 +4942,32 @@ void tst_QWidget::moveChild_data()
void tst_QWidget::moveChild()
{
-#if defined(UBUNTU_ONEIRIC)
- QSKIP("QTBUG-30566 - Unstable auto-test");
-#endif
QFETCH(QPoint, offset);
- ColorWidget parent;
+ ColorWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
// prevent custom styles
parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
- ColorWidget child(&parent, Qt::blue);
+ ColorWidget child(&parent, Qt::Widget, Qt::blue);
#ifndef Q_OS_WINCE
- parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()),
- QSize(100, 100)));
+ parent.setGeometry(QRect(QPoint(QApplication::desktop()->availableGeometry(&parent).topLeft()) + QPoint(50, 50),
+ QSize(200, 200)));
#else
parent.setGeometry(60, 60, 150, 150);
#endif
child.setGeometry(25, 25, 50, 50);
+#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
+ QCursor::setPos(parent.geometry().topRight() + QPoint(50 , 50));
+#endif
parent.show();
QVERIFY(QTest::qWaitForWindowExposed(&parent));
QTest::qWait(30);
- const QPoint tlwOffset = parent.geometry().topLeft();
QTRY_COMPARE(parent.r, QRegion(parent.rect()) - child.geometry());
QTRY_COMPARE(child.r, QRegion(child.rect()));
- VERIFY_COLOR(child.geometry().translated(tlwOffset),
+ VERIFY_COLOR(child, child.rect(),
child.color);
- VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset),
- parent.color);
+ VERIFY_COLOR(parent, QRegion(parent.rect()) - child.geometry(), parent.color);
parent.reset();
child.reset();
@@ -4913,10 +4985,8 @@ void tst_QWidget::moveChild()
// should be scrolled in backingstore
QCOMPARE(child.r, QRegion());
#endif
- VERIFY_COLOR(child.geometry().translated(tlwOffset),
- child.color);
- VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset),
- parent.color);
+ VERIFY_COLOR(child, child.rect(), child.color);
+ VERIFY_COLOR(parent, QRegion(parent.rect()) - child.geometry(), parent.color);
}
void tst_QWidget::showAndMoveChild()
@@ -4924,7 +4994,7 @@ void tst_QWidget::showAndMoveChild()
#if defined(UBUNTU_ONEIRIC)
QSKIP("QTBUG-30566 - Unstable auto-test");
#endif
- QWidget parent(0, Qt::FramelessWindowHint);
+ QWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
// prevent custom styles
parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
@@ -4932,6 +5002,9 @@ void tst_QWidget::showAndMoveChild()
QRect desktopDimensions = desktop.availableGeometry(&parent);
desktopDimensions = desktopDimensions.adjusted(64, 64, -64, -64);
+#ifndef QT_NO_CURSOR // Try to make sure the cursor is not in a taskbar area to prevent tooltips or window highlighting
+ QCursor::setPos(desktopDimensions.topRight() + QPoint(40, 40));
+#endif
parent.setGeometry(desktopDimensions);
parent.setPalette(Qt::red);
parent.show();
@@ -4939,7 +5012,6 @@ void tst_QWidget::showAndMoveChild()
QVERIFY(QTest::qWaitForWindowActive(&parent));
QTest::qWait(10);
- const QPoint tlwOffset = parent.geometry().topLeft();
QWidget child(&parent);
child.resize(desktopDimensions.width()/2, desktopDimensions.height()/2);
child.setPalette(Qt::blue);
@@ -4951,8 +5023,8 @@ void tst_QWidget::showAndMoveChild()
child.move(desktopDimensions.width()/2, desktopDimensions.height()/2);
qApp->processEvents();
- VERIFY_COLOR(child.geometry().translated(tlwOffset), Qt::blue);
- VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red);
+ VERIFY_COLOR(child, child.rect(), Qt::blue);
+ VERIFY_COLOR(parent, QRegion(parent.rect()) - child.geometry(), Qt::red);
}
// Cocoa only has rect granularity.
@@ -4962,13 +5034,13 @@ void tst_QWidget::subtractOpaqueSiblings()
QWidget w;
w.setGeometry(50, 50, 300, 300);
- ColorWidget *large = new ColorWidget(&w, Qt::red);
+ ColorWidget *large = new ColorWidget(&w, Qt::Widget, Qt::red);
large->setGeometry(50, 50, 200, 200);
- ColorWidget *medium = new ColorWidget(large, Qt::gray);
+ ColorWidget *medium = new ColorWidget(large, Qt::Widget, Qt::gray);
medium->setGeometry(50, 50, 100, 100);
- ColorWidget *tall = new ColorWidget(&w, Qt::blue);
+ ColorWidget *tall = new ColorWidget(&w, Qt::Widget, Qt::blue);
tall->setGeometry(100, 30, 50, 100);
w.show();
@@ -7051,7 +7123,7 @@ void tst_QWidget::repaintWhenChildDeleted()
QTest::qWait(1000);
}
#endif
- ColorWidget w(0, Qt::red);
+ ColorWidget w(0, Qt::FramelessWindowHint, Qt::red);
#if !defined(Q_OS_WINCE)
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
startPoint.rx() += 50;
@@ -7067,7 +7139,7 @@ void tst_QWidget::repaintWhenChildDeleted()
w.r = QRegion();
{
- ColorWidget child(&w, Qt::blue);
+ ColorWidget child(&w, Qt::Widget, Qt::blue);
child.setGeometry(10, 10, 10, 10);
child.show();
QTest::qWait(10);
@@ -7082,7 +7154,7 @@ void tst_QWidget::repaintWhenChildDeleted()
// task 175114
void tst_QWidget::hideOpaqueChildWhileHidden()
{
- ColorWidget w(0, Qt::red);
+ ColorWidget w(0, Qt::FramelessWindowHint, Qt::red);
#if !defined(Q_OS_WINCE)
QPoint startPoint = QApplication::desktop()->availableGeometry(&w).topLeft();
startPoint.rx() += 50;
@@ -7092,10 +7164,10 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
w.setGeometry(60, 60, 110, 110);
#endif
- ColorWidget child(&w, Qt::blue);
+ ColorWidget child(&w, Qt::Widget, Qt::blue);
child.setGeometry(10, 10, 80, 80);
- ColorWidget child2(&child, Qt::white);
+ ColorWidget child2(&child, Qt::Widget, Qt::white);
child2.setGeometry(10, 10, 60, 60);
w.show();
@@ -9782,18 +9854,16 @@ void tst_QWidget::underMouse()
// Move the mouse cursor to a safe location
QCursor::setPos(0,0);
- ColorWidget topLevelWidget(0, Qt::blue);
- ColorWidget childWidget1(&topLevelWidget, Qt::yellow);
- ColorWidget childWidget2(&topLevelWidget, Qt::black);
- ColorWidget popupWidget(0, Qt::green);
+ ColorWidget topLevelWidget(0, Qt::FramelessWindowHint, Qt::blue);
+ ColorWidget childWidget1(&topLevelWidget, Qt::Widget, Qt::yellow);
+ ColorWidget childWidget2(&topLevelWidget, Qt::Widget, Qt::black);
+ ColorWidget popupWidget(0, Qt::Popup, Qt::green);
topLevelWidget.setObjectName("topLevelWidget");
childWidget1.setObjectName("childWidget1");
childWidget2.setObjectName("childWidget2");
popupWidget.setObjectName("popupWidget");
- popupWidget.setWindowFlags(Qt::Popup);
-
topLevelWidget.setGeometry(100, 100, 300, 300);
childWidget1.setGeometry(20, 20, 100, 100);
childWidget2.setGeometry(20, 120, 100, 100);
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
index c17a03e058..cd6433bbe7 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -46,6 +46,8 @@
#include <qwindow.h>
#include <qwidget.h>
+#include <qdockwidget.h>
+#include <qmainwindow.h>
class Window : public QWindow
@@ -80,6 +82,7 @@ private slots:
void testUnparenting();
void testActivation();
void testAncestorChange();
+ void testDockWidget();
};
@@ -278,6 +281,7 @@ void tst_QWindowContainer::testAncestorChange()
newRoot->setGeometry(100, 100, 200, 200);
newRoot->show();
QVERIFY(QTest::qWaitForWindowExposed(newRoot));
+ QCOMPARE(newRoot->windowHandle(), window->parent());
// newRoot
// + right
// + container
@@ -285,6 +289,31 @@ void tst_QWindowContainer::testAncestorChange()
QCOMPARE(window->geometry(), QRect(100, 0, 100, 100));
}
+
+void tst_QWindowContainer::testDockWidget()
+{
+ QMainWindow mainWindow;
+ mainWindow.resize(200, 200);
+
+ QDockWidget *dock = new QDockWidget();
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window);
+ dock->setWidget(container);
+ mainWindow.addDockWidget(Qt::RightDockWidgetArea, dock);
+
+ mainWindow.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&mainWindow));
+ QVERIFY(window->parent() == mainWindow.window()->windowHandle());
+
+ QTest::qWait(1000);
+ dock->setFloating(true);
+ QTRY_VERIFY(window->parent() != mainWindow.window()->windowHandle());
+
+ QTest::qWait(1000);
+ dock->setFloating(false);
+ QTRY_VERIFY(window->parent() == mainWindow.window()->windowHandle());
+}
+
QTEST_MAIN(tst_QWindowContainer)
#include "tst_qwindowcontainer.moc"
diff --git a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
index 8c010abfe6..1434d98e59 100644
--- a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
+++ b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp
@@ -43,6 +43,8 @@
#include <QtTest/QtTest>
#include <QKeySequenceEdit>
+#include <QLineEdit>
+#include <QString>
Q_DECLARE_METATYPE(Qt::Key)
Q_DECLARE_METATYPE(Qt::KeyboardModifiers)
@@ -55,6 +57,7 @@ private slots:
void testSetters();
void testKeys_data();
void testKeys();
+ void testLineEditContents();
};
void tst_QKeySequenceEdit::testSetters()
@@ -100,5 +103,26 @@ void tst_QKeySequenceEdit::testKeys()
QTRY_COMPARE(spy.count(), 1);
}
+void tst_QKeySequenceEdit::testLineEditContents()
+{
+ QKeySequenceEdit edit;
+ QLineEdit *le = edit.findChild<QLineEdit*>();
+ QVERIFY(le);
+
+ QCOMPARE(le->text(), QString());
+
+ edit.setKeySequence(QKeySequence::New);
+ QCOMPARE(edit.keySequence(), QKeySequence(QKeySequence::New));
+
+ edit.clear();
+ QCOMPARE(le->text(), QString());
+
+ edit.setKeySequence(QKeySequence::New);
+ QVERIFY(le->text() != QString());
+
+ edit.setKeySequence(QKeySequence());
+ QCOMPARE(le->text(), QString());
+}
+
QTEST_MAIN(tst_QKeySequenceEdit)
#include "tst_qkeysequenceedit.moc"
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 3000aad9ce..a9f5cb686c 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -4097,6 +4097,9 @@ void tst_QLineEdit::clearButton()
QTRY_COMPARE(filterModel->rowCount(), 1); // matches 'ab'
QTest::mouseClick(clearButton, Qt::LeftButton, 0, QRect(QPoint(0, 0), clearButton->size()).center());
QTRY_COMPARE(filterModel->rowCount(), 3);
+
+ filterLineEdit->setReadOnly(true); // QTBUG-34315
+ QVERIFY(!clearButton->isEnabled());
}
void tst_QLineEdit::sideWidgets()
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
index 5b146cf443..b3e50b8ba8 100644
--- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -954,9 +954,6 @@ void tst_QMdiSubWindow::mouseDoubleClick()
QStyleOptionTitleBar options;
options.initFrom(window);
int height = window->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
- // ### Remove this after mac style has been fixed
- if (window->style()->inherits("QMacStyle"))
- height -= 4;
// has border
if (!window->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, window))
height += window->isMinimized() ? 8 : 4;
@@ -1692,11 +1689,6 @@ void tst_QMdiSubWindow::fixedMinMaxSize()
QStyleOptionTitleBar options;
options.initFrom(subWindow);
int minimizedHeight = subWindow->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
- // ### Remove this after mac style has been fixed
- if (subWindow->style()->inherits("QMacStyle"))
- minimizedHeight -= 4;
-#endif
if (!subWindow->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, subWindow))
minimizedHeight += 8;
int minimizedWidth = subWindow->style()->pixelMetric(QStyle::PM_MDIMinimizedWidth, &options);
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 7c1bb957d6..81ed983d0f 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -50,6 +50,7 @@
#include <QListWidget>
#include <QWidgetAction>
#include <QDesktopWidget>
+#include <QScreen>
#include <qdialog.h>
#include <qmenu.h>
@@ -59,6 +60,17 @@
Q_DECLARE_METATYPE(Qt::Key);
Q_DECLARE_METATYPE(Qt::KeyboardModifiers);
+static inline void centerOnScreen(QWidget *w, const QSize &size)
+{
+ const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
+ w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
+}
+
+static inline void centerOnScreen(QWidget *w)
+{
+ centerOnScreen(w, w->geometry().size());
+}
+
class tst_QMenu : public QObject
{
Q_OBJECT
@@ -257,9 +269,12 @@ void tst_QMenu::addActionsAndClear()
void tst_QMenu::mouseActivation()
{
QWidget topLevel;
+ topLevel.resize(300, 200);
+ centerOnScreen(&topLevel);
QMenu menu(&topLevel);
topLevel.show();
menu.addAction("Menu Action");
+ menu.move(topLevel.geometry().topRight() + QPoint(50, 0));
menu.show();
QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center(), 300);
QVERIFY(!menu.isVisible());
@@ -275,8 +290,10 @@ void tst_QMenu::mouseActivation()
QMenu submenu("Menu");
submenu.addAction("action");
QAction *action = menubar.addMenu(&submenu);
+ menubar.move(topLevel.geometry().topRight() + QPoint(300, 0));
menubar.show();
+
QTest::mouseClick(&menubar, Qt::LeftButton, 0, menubar.actionGeometry(action).center(), 300);
QVERIFY(submenu.isVisible());
QTest::mouseClick(&submenu, Qt::LeftButton, 0, QPoint(5, 5), 300);
@@ -378,13 +395,16 @@ void tst_QMenu::focus()
#endif
QWidget window;
+ window.resize(300, 200);
QPushButton button("Push me", &window);
+ centerOnScreen(&window);
window.show();
qApp->setActiveWindow(&window);
QVERIFY(button.hasFocus());
QCOMPARE(QApplication::focusWidget(), (QWidget *)&button);
QCOMPARE(QApplication::activeWindow(), &window);
+ menu.move(window.geometry().topRight() + QPoint(50, 0));
menu.show();
QVERIFY(button.hasFocus());
QCOMPARE(QApplication::focusWidget(), (QWidget *)&button);
@@ -399,6 +419,8 @@ void tst_QMenu::overrideMenuAction()
{
//test the override menu action by first creating an action to which we set its menu
QMainWindow w;
+ w.resize(300, 200);
+ centerOnScreen(&w);
QAction *aFileMenu = new QAction("&File", &w);
w.menuBar()->addAction(aFileMenu);
@@ -442,6 +464,8 @@ void tst_QMenu::statusTip()
{
//check that the statustip of actions inserted into the menu are displayed
QMainWindow w;
+ w.resize(300, 200);
+ centerOnScreen(&w);
connect(w.statusBar(), SIGNAL(messageChanged(QString)), SLOT(onStatusMessageChanged(QString)));; //creates the status bar
QToolBar tb;
QAction a("main action", &tb);
@@ -540,10 +564,12 @@ void tst_QMenu::tearOff()
menu->addAction("bbb");
QVERIFY(menu->isTearOffEnabled());
+ widget.resize(300, 200);
+ centerOnScreen(&widget);
widget.show();
widget.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&widget));
- menu->popup(QPoint(0,0));
+ menu->popup(widget.geometry().topRight() + QPoint(50, 0));
QVERIFY(QTest::qWaitForWindowActive(menu));
QVERIFY(!menu->isTearOffMenuVisible());
@@ -568,14 +594,18 @@ void tst_QMenu::layoutDirection()
{
QMainWindow win;
win.setLayoutDirection(Qt::RightToLeft);
+ win.resize(300, 200);
+ centerOnScreen(&win);
QMenu menu(&win);
+ menu.move(win.geometry().topRight() + QPoint(50, 0));
menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu));
QCOMPARE(menu.layoutDirection(), Qt::RightToLeft);
menu.close();
menu.setParent(0);
+ menu.move(win.geometry().topRight() + QPoint(50, 0));
menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu));
QCOMPARE(menu.layoutDirection(), QApplication::layoutDirection());
@@ -702,6 +732,7 @@ void tst_QMenu::task256918_setFont()
QFont f;
f.setPointSize(30);
action->setFont(f);
+ centerOnScreen(&menu, QSize(120, 40));
menu.show(); //ensures that the actiongeometry are calculated
QVERIFY(menu.actionGeometry(action).height() > f.pointSize());
}
@@ -830,6 +861,13 @@ void PopulateOnAboutToShowTestMenu::populateMenu()
addSeparator();
}
+static inline QByteArray msgGeometryIntersects(const QRect &r1, const QRect &r2)
+{
+ QString result;
+ QDebug(&result) << r1 << "intersects" << r2;
+ return result.toLocal8Bit();
+}
+
void tst_QMenu::pushButtonPopulateOnAboutToShow()
{
QPushButton b("Test PushButton");
@@ -842,7 +880,7 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow()
const QRect screen = QApplication::desktop()->screenGeometry(scrNumber);
QRect desiredGeometry = b.geometry();
- desiredGeometry.moveTopLeft(QPoint(10, screen.bottom()-b.height()-5));
+ desiredGeometry.moveTopLeft(QPoint(screen.x() + 10, screen.bottom() - b.height() - 5));
b.setGeometry(desiredGeometry);
QVERIFY(QTest::qWaitForWindowExposed(&b));
@@ -859,13 +897,13 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow()
QTimer::singleShot(300, buttonMenu, SLOT(hide()));
QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
- QVERIFY(!buttonMenu->geometry().intersects(b.geometry()));
+ QVERIFY2(!buttonMenu->geometry().intersects(b.geometry()), msgGeometryIntersects(buttonMenu->geometry(), b.geometry()));
// note: we're assuming that, if we previously got the desired geometry, we'll get it here too
b.move(10, screen.bottom()-buttonMenu->height()-5);
QTimer::singleShot(300, buttonMenu, SLOT(hide()));
QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center());
- QVERIFY(!buttonMenu->geometry().intersects(b.geometry()));
+ QVERIFY2(!buttonMenu->geometry().intersects(b.geometry()), msgGeometryIntersects(buttonMenu->geometry(), b.geometry()));
}
void tst_QMenu::QTBUG7907_submenus_autoselect()
@@ -878,6 +916,7 @@ void tst_QMenu::QTBUG7907_submenus_autoselect()
set1.addMenu(&subset);
menu.addMenu(&set1);
menu.addMenu(&set2);
+ centerOnScreen(&menu, QSize(120, 100));
menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu));
QTest::mouseClick(&menu, Qt::LeftButton, Qt::NoModifier, QPoint(5,5) );
@@ -893,6 +932,7 @@ void tst_QMenu::QTBUG7411_submenus_activate()
sub1.addAction("foo");
sub1.setTitle("&sub1");
QAction *act1 = menu.addMenu(&sub1);
+ centerOnScreen(&menu, QSize(120, 100));
menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu));
menu.setActiveAction(act);
@@ -911,12 +951,12 @@ void tst_QMenu::QTBUG30595_rtl_submenu()
sub.addAction("bar");
sub.setTitle("&sub");
menu.addMenu(&sub);
- menu.move(200, 20);
+ centerOnScreen(&menu, QSize(120, 40));
menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu));
QTest::mouseClick(&menu, Qt::LeftButton, Qt::NoModifier, QPoint(5,5) );
QTRY_VERIFY(sub.isVisible());
- QVERIFY(sub.pos().x() < menu.pos().x());
+ QVERIFY2(sub.pos().x() < menu.pos().x(), QByteArray::number(sub.pos().x()) + QByteArrayLiteral(" not less than ") + QByteArray::number(menu.pos().x()));
}
void tst_QMenu::QTBUG20403_nested_popup_on_shortcut_trigger()
@@ -927,6 +967,7 @@ void tst_QMenu::QTBUG20403_nested_popup_on_shortcut_trigger()
subsub1.addAction("foo");
sub1.addMenu(&subsub1);
menu.addMenu(&sub1);
+ centerOnScreen(&menu, QSize(120, 100));
menu.show();
QVERIFY(QTest::qWaitForWindowExposed(&menu));
QTest::keyPress(&menu, Qt::Key_S);
diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
index f09fbff6c4..ed909946e6 100644
--- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
+++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp
@@ -160,6 +160,7 @@ class tst_QXmlSimpleReader : public QObject
void reportNamespace() const;
void reportNamespace_data() const;
void roundtripWithNamespaces() const;
+ void dtdRecursionLimit();
private:
static QDomDocument fromByteArray(const QString &title, const QByteArray &ba, bool *ok);
@@ -755,5 +756,62 @@ void tst_QXmlSimpleReader::roundtripWithNamespaces() const
}
}
+class TestHandler : public QXmlDefaultHandler
+{
+public:
+ TestHandler() :
+ recursionCount(0)
+ {
+ }
+
+ bool internalEntityDecl(const QString &name, const QString &value)
+ {
+ ++recursionCount;
+ return QXmlDefaultHandler::internalEntityDecl(name, value);
+ }
+
+ int recursionCount;
+};
+
+void tst_QXmlSimpleReader::dtdRecursionLimit()
+{
+ QFile file("xmldocs/2-levels-nested-dtd.xml");
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ QXmlSimpleReader xmlReader;
+ {
+ QXmlInputSource *source = new QXmlInputSource(&file);
+ TestHandler handler;
+ xmlReader.setDeclHandler(&handler);
+ xmlReader.setErrorHandler(&handler);
+ QVERIFY(!xmlReader.parse(source));
+ }
+
+ file.close();
+ file.setFileName("xmldocs/1-levels-nested-dtd.xml");
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ {
+ QXmlInputSource *source = new QXmlInputSource(&file);
+ TestHandler handler;
+ xmlReader.setDeclHandler(&handler);
+ xmlReader.setErrorHandler(&handler);
+ QVERIFY(!xmlReader.parse(source));
+ // The error wasn't because of the recursion limit being reached,
+ // it was because the document is not valid.
+ QVERIFY(handler.recursionCount < 2);
+ }
+
+ file.close();
+ file.setFileName("xmldocs/internal-entity-polynomial-attribute.xml");
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ {
+ QXmlInputSource *source = new QXmlInputSource(&file);
+ TestHandler handler;
+ xmlReader.setDeclHandler(&handler);
+ xmlReader.setErrorHandler(&handler);
+ QVERIFY(!xmlReader.parse(source));
+ QCOMPARE(handler.recursionCount, 2);
+ }
+}
+
QTEST_MAIN(tst_QXmlSimpleReader)
#include "tst_qxmlsimplereader.moc"
diff --git a/tests/auto/xml/sax/qxmlsimplereader/xmldocs/1-levels-nested-dtd.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/1-levels-nested-dtd.xml
new file mode 100644
index 0000000000..0dfc15b165
--- /dev/null
+++ b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/1-levels-nested-dtd.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!-- Test non-deterministic content model matching.
+
+Entity references are not part of the internal DTD subset (for good reason).
+
+-->
+<!DOCTYPE root [
+<!ELEMENT e0 EMPTY>
+<!ENTITY % e1 "(e0,e0)">
+<!ELEMENT root (%e1;)?>
+]>
+<root/> \ No newline at end of file
diff --git a/tests/auto/xml/sax/qxmlsimplereader/xmldocs/2-levels-nested-dtd.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/2-levels-nested-dtd.xml
new file mode 100644
index 0000000000..7ec06db85f
--- /dev/null
+++ b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/2-levels-nested-dtd.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Test non-deterministic content model matching.
+
+Entity references are not part of the internal DTD subset (for good reason).
+
+-->
+<!DOCTYPE root [
+<!ELEMENT e0 EMPTY>
+<!ENTITY % e1 "(e0,e0)">
+<!ENTITY % e2 "(%e1;,%e1;,%e1;,%e1;,%e1;,%e1;,%e1;,%e1;,%e1;,%e1;,%e1;,%e1;,%e1;)">
+<!ELEMENT root (%e2;)?>
+]>
+<root/>
diff --git a/tests/auto/xml/sax/qxmlsimplereader/xmldocs/internal-entity-polynomial-attribute.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/internal-entity-polynomial-attribute.xml
new file mode 100644
index 0000000000..bbb88f39f6
--- /dev/null
+++ b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/internal-entity-polynomial-attribute.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Test polynomial growth of expanded XML.
+ Expansion happens in an attribute. -->
+<!DOCTYPE root [
+<!ELEMENT root EMPTY>
+<!ATTLIST root id CDATA #IMPLIED>
+<!ENTITY e1 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX">
+<!ENTITY e2 "&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;&e1;">
+<!ENTITY e3 "&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;&e2;">
+<!ENTITY e4 "&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;&e3;">
+]>
+<root id="&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;&e4;"/>
+
diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro
index 3940ddbf98..8fd4db6b4b 100644
--- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro
+++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro
@@ -1,5 +1,6 @@
SOURCES = main.cpp
CONFIG -= qt app_bundle
CONFIG += console
+winrt: QMAKE_LFLAGS += /ENTRY:mainCRTStartup
DESTDIR = ./
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
index 37fa571f8c..52c60f9484 100644
--- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
+++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
@@ -88,7 +88,9 @@ void NativeMutexUnlock(NativeMutexType *mutex)
}
#endif
#elif defined(Q_OS_WIN)
-# define _WIN32_WINNT 0x0400
+# ifndef Q_OS_WINRT
+# define _WIN32_WINNT 0x0400
+# endif
# include <windows.h>
typedef CRITICAL_SECTION NativeMutexType;
void NativeMutexInitialize(NativeMutexType *mutex)
diff --git a/tests/manual/cocoa/qt_on_cocoa/main.mm b/tests/manual/cocoa/qt_on_cocoa/main.mm
index c9338f25f4..9a39788b02 100644
--- a/tests/manual/cocoa/qt_on_cocoa/main.mm
+++ b/tests/manual/cocoa/qt_on_cocoa/main.mm
@@ -44,7 +44,7 @@
#include <QtWidgets/QtWidgets>
#include <private/qwidgetwindow_qpa_p.h>
-#include <QtGui/qplatformnativeinterface_qpa.h>
+#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QtGui/QPixmap>
diff --git a/tests/manual/dialogs/dialogs.pro b/tests/manual/dialogs/dialogs.pro
index d19c3026d0..71c41119fe 100644
--- a/tests/manual/dialogs/dialogs.pro
+++ b/tests/manual/dialogs/dialogs.pro
@@ -1,10 +1,10 @@
QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = dialogs
TEMPLATE = app
SOURCES += main.cpp filedialogpanel.cpp colordialogpanel.cpp fontdialogpanel.cpp \
- wizardpanel.cpp messageboxpanel.cpp
+ wizardpanel.cpp messageboxpanel.cpp printdialogpanel.cpp utils.cpp
HEADERS += filedialogpanel.h colordialogpanel.h fontdialogpanel.h \
- wizardpanel.h messageboxpanel.h
+ wizardpanel.h messageboxpanel.h printdialogpanel.h utils.h
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index e234835cdb..2ae6241849 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "filedialogpanel.h"
+#include "utils.h"
#include <QGridLayout>
#include <QVBoxLayout>
@@ -48,7 +49,6 @@
#include <QFormLayout>
#include <QSpacerItem>
#include <QGroupBox>
-#include <QComboBox>
#include <QPushButton>
#include <QCheckBox>
#include <QLineEdit>
@@ -60,25 +60,19 @@
#include <QTimer>
#include <QDebug>
-struct ComboData
-{
- const char *description;
- int value;
-};
-
-const ComboData acceptModeComboData[] =
+const FlagData acceptModeComboData[] =
{
{"AcceptOpen", QFileDialog::AcceptOpen },
{"AcceptSave", QFileDialog::AcceptSave }
};
-const ComboData viewModeComboData[] =
+const FlagData viewModeComboData[] =
{
{"Detail", QFileDialog::Detail},
{"List", QFileDialog::List}
};
-const ComboData fileModeComboData[] =
+const FlagData fileModeComboData[] =
{
{"AnyFile", QFileDialog::AnyFile},
{"ExistingFile", QFileDialog::ExistingFile},
@@ -87,25 +81,6 @@ const ComboData fileModeComboData[] =
{"DirectoryOnly", QFileDialog::DirectoryOnly}
};
-static QComboBox *createCombo(QWidget *parent, const ComboData *d, size_t size)
-{
- QComboBox *c = new QComboBox(parent);
- for (size_t i = 0; i < size; ++i)
- c->addItem(QLatin1String(d[i].description), QVariant(d[i].value));
- return c;
-}
-
-template <class Enum>
-Enum comboBoxValue(const QComboBox *c)
-{
- return static_cast<Enum>(c->itemData(c->currentIndex()).toInt());
-}
-
-inline void setComboBoxValue(QComboBox *c, int v)
-{
- c->setCurrentIndex(c->findData(QVariant(v)));
-}
-
static inline QPushButton *addButton(const QString &description, QGridLayout *layout,
int &row, int column, QObject *receiver, const char *slotFunc)
{
@@ -155,9 +130,9 @@ FileDialogPanel::FileDialogPanel(QWidget *parent)
, m_resolveSymLinks(new QCheckBox(tr("Resolve symlinks")))
, m_native(new QCheckBox(tr("Use native dialog")))
, m_customDirIcons(new QCheckBox(tr("Don't use custom directory icons")))
- , m_acceptMode(createCombo(this, acceptModeComboData, sizeof(acceptModeComboData)/sizeof(ComboData)))
- , m_fileMode(createCombo(this, fileModeComboData, sizeof(fileModeComboData)/sizeof(ComboData)))
- , m_viewMode(createCombo(this, viewModeComboData, sizeof(viewModeComboData)/sizeof(ComboData)))
+ , m_acceptMode(createCombo(this, acceptModeComboData, sizeof(acceptModeComboData)/sizeof(FlagData)))
+ , m_fileMode(createCombo(this, fileModeComboData, sizeof(fileModeComboData)/sizeof(FlagData)))
+ , m_viewMode(createCombo(this, viewModeComboData, sizeof(viewModeComboData)/sizeof(FlagData)))
, m_allowedSchemes(new QLineEdit(this))
, m_defaultSuffix(new QLineEdit(this))
, m_directory(new QLineEdit(this))
@@ -355,6 +330,7 @@ void FileDialogPanel::getOpenFileNames()
void FileDialogPanel::getOpenFileUrls()
{
+#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QList<QUrl> files =
QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -367,6 +343,7 @@ void FileDialogPanel::getOpenFileUrls()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
}
+#endif // Qt 5
}
void FileDialogPanel::getOpenFileName()
@@ -386,6 +363,7 @@ void FileDialogPanel::getOpenFileName()
void FileDialogPanel::getOpenFileUrl()
{
+#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QUrl file =
QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -398,6 +376,7 @@ void FileDialogPanel::getOpenFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
}
+#endif // Qt 5
}
void FileDialogPanel::getSaveFileName()
@@ -417,6 +396,7 @@ void FileDialogPanel::getSaveFileName()
void FileDialogPanel::getSaveFileUrl()
{
+#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QUrl file =
QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -429,6 +409,7 @@ void FileDialogPanel::getSaveFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
}
+#endif // Qt 5
}
void FileDialogPanel::getExistingDirectory()
@@ -442,12 +423,14 @@ void FileDialogPanel::getExistingDirectory()
void FileDialogPanel::getExistingDirectoryUrl()
{
+#if QT_VERSION >= 0x050000
const QUrl dir =
QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
QUrl(m_directory->text()), options() | QFileDialog::ShowDirsOnly,
allowedSchemes());
if (!dir.isEmpty())
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
+#endif // Qt 5
}
void FileDialogPanel::restoreDefaults()
@@ -493,9 +476,11 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
if (!filter.isEmpty())
d->selectNameFilter(filter);
} else {
+#if QT_VERSION >= 0x050000
d->setMimeTypeFilters(filters);
if (!filter.isEmpty())
d->selectMimeTypeFilter(filter);
+#endif // Qt 5
}
foreach (LabelLineEdit *l, m_labelLineEdits)
l->apply(d);
diff --git a/tests/manual/dialogs/fontdialogpanel.cpp b/tests/manual/dialogs/fontdialogpanel.cpp
index c72bf77351..ff45402197 100644
--- a/tests/manual/dialogs/fontdialogpanel.cpp
+++ b/tests/manual/dialogs/fontdialogpanel.cpp
@@ -209,10 +209,12 @@ void FontDialogPanel::applySettings(QFontDialog *d) const
{
d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
+#if QT_VERSION >= 0x050000
d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked());
d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked());
d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked());
d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked());
+#endif // Qt 5
QFont font = m_fontFamilyBox->currentFont();
font.setPointSizeF(m_fontSizeBox->value());
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index c5f14cabef..6082727c3b 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -42,6 +42,7 @@
#include "filedialogpanel.h"
#include "colordialogpanel.h"
#include "fontdialogpanel.h"
+#include "printdialogpanel.h"
#include "wizardpanel.h"
#include "messageboxpanel.h"
@@ -75,6 +76,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
tabWidget->addTab(new FontDialogPanel, tr("QFontDialog"));
tabWidget->addTab(new WizardPanel, tr("QWizard"));
tabWidget->addTab(new MessageBoxPanel, tr("QMessageBox"));
+#ifndef QT_NO_PRINTER
+ tabWidget->addTab(new PrintDialogPanel, tr("QPrintDialog"));
+#endif
setCentralWidget(tabWidget);
}
diff --git a/tests/manual/dialogs/messageboxpanel.cpp b/tests/manual/dialogs/messageboxpanel.cpp
index 529a8251e1..ced582981e 100644
--- a/tests/manual/dialogs/messageboxpanel.cpp
+++ b/tests/manual/dialogs/messageboxpanel.cpp
@@ -149,9 +149,11 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
if (box.standardButtons() == (QMessageBox::StandardButtons) 0)
box.setStandardButtons(QMessageBox::Ok); // just to have something.
+#if QT_VERSION >= 0x050000
box.setCheckBox(0);
if (m_checkboxText->text().length() > 0)
box.setCheckBox(new QCheckBox(m_checkboxText->text()));
+#endif // Qt 5
box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex());
}
@@ -176,12 +178,14 @@ void MessageBoxPanel::doExec()
QString sres;
sres.setNum(res, 16);
m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres));
+#if QT_VERSION >= 0x050000
if (m_msgbox->checkBox()) {
if (m_msgbox->checkBox()->isChecked())
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked"));
else
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked"));
}
+#endif // Qt 5
}
void MessageBoxPanel::doShowApply()
diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp
new file mode 100644
index 0000000000..02beaa4bae
--- /dev/null
+++ b/tests/manual/dialogs/printdialogpanel.cpp
@@ -0,0 +1,417 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_NO_PRINTER
+
+#include "printdialogpanel.h"
+#include "utils.h"
+
+#include <QPrinter>
+#include <QPrintDialog>
+#include <QPrintPreviewDialog>
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QGroupBox>
+#include <QCheckBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QFormLayout>
+#include <QVBoxLayout>
+#include <QDoubleSpinBox>
+#include <QPainter>
+#include <QFont>
+#include <QFontMetrics>
+#include <QDateTime>
+#include <QDebug>
+#include <QTextStream>
+
+const FlagData modeComboData[] =
+{
+ {"ScreenResolution", QPrinter::ScreenResolution},
+ {"PrinterResolution", QPrinter::PrinterResolution},
+ {"HighResolution", QPrinter::HighResolution}
+};
+
+const FlagData orientationComboData[] =
+{
+ {"Portrait", QPrinter::Portrait},
+ {"Landscape", QPrinter::Landscape},
+};
+
+const FlagData pageSizeComboData[] =
+{
+ {"A4", QPrinter::A4},
+ {"B5", QPrinter::B5},
+ {"Letter", QPrinter::Letter},
+ {"Legal", QPrinter::Legal},
+ {"Executive", QPrinter::Executive},
+ {"A0", QPrinter::A0},
+ {"A1", QPrinter::A1},
+ {"A2", QPrinter::A2},
+ {"A3", QPrinter::A3},
+ {"A5", QPrinter::A5},
+ {"A6", QPrinter::A6},
+ {"A7", QPrinter::A7},
+ {"A8", QPrinter::A8},
+ {"A9", QPrinter::A9},
+ {"B0", QPrinter::B0},
+ {"B1", QPrinter::B1},
+ {"B10", QPrinter::B10},
+ {"B2", QPrinter::B2},
+ {"B3", QPrinter::B3},
+ {"B4", QPrinter::B4},
+ {"B6", QPrinter::B6},
+ {"B7", QPrinter::B7},
+ {"B8", QPrinter::B8},
+ {"B9", QPrinter::B9},
+ {"C5E", QPrinter::C5E},
+ {"Comm10E", QPrinter::Comm10E},
+ {"DLE", QPrinter::DLE},
+ {"Folio", QPrinter::Folio},
+ {"Ledger", QPrinter::Ledger},
+ {"Tabloid", QPrinter::Tabloid},
+ {"Custom", QPrinter::Custom}
+};
+
+const FlagData printDialogOptions[] =
+{
+ {"PrintToFile", QPrintDialog::PrintToFile},
+ {"PrintSelection", QPrintDialog::PrintSelection},
+ {"PrintPageRange", QPrintDialog::PrintPageRange},
+ {"PrintShowPageSize", QPrintDialog::PrintShowPageSize},
+ {"PrintCollateCopies", QPrintDialog::PrintCollateCopies},
+ {"PrintCurrentPage", QPrintDialog::PrintCurrentPage}
+};
+
+const FlagData printRangeOptions[] =
+{
+ {"AllPages", QPrintDialog::AllPages},
+ {"Selection", QPrintDialog::Selection},
+ {"PageRange", QPrintDialog::PageRange},
+ {"CurrentPage", QPrintDialog::CurrentPage}
+};
+
+QTextStream &operator<<(QTextStream &s, const QSizeF &size)
+{
+ s << size.width() << 'x' << size.height();
+ return s;
+}
+
+QTextStream &operator<<(QTextStream &s, const QRectF &rect)
+{
+ s << rect.width() << 'x' << rect.height() << forcesign << rect.x() << rect.y() << noforcesign;
+ return s;
+}
+
+QTextStream &operator<<(QTextStream &s, const QPrinter &printer)
+{
+ s << '"' << printer.printerName() << "\"\nPaper #" <<printer.paperSize()
+#if QT_VERSION >= 0x050000
+ << " \"" << printer.paperName() << '"'
+#endif
+ << (printer.orientation() == QPrinter::Portrait ? ", Portrait" : ", Landscape");
+ if (printer.fullPage())
+ s << ", full page";
+ s << "\nPaper size: "
+ << printer.paperSize(QPrinter::Point) << "pt "
+ << printer.paperSize(QPrinter::Millimeter) << "mm "
+ << "\n " << printer.paperSize(QPrinter::DevicePixel) << "device pt "
+ << printer.paperSize(QPrinter::Inch) << "inch "
+#if QT_VERSION >= 0x050000
+ << "\nPagedPaintDevSize: " << printer.pageSizeMM() << "mm"
+#endif
+ << "\nLogical resolution : " << printer.logicalDpiX() << ',' << printer.logicalDpiY() << "DPI"
+ << "\nPhysical resolution: " << printer.physicalDpiX() << ',' << printer.physicalDpiY() << "DPI"
+ << "\nPaperRect: " << printer.paperRect(QPrinter::Point) << "pt "
+ << printer.paperRect(QPrinter::Millimeter) << "mm "
+ << "\n " << printer.paperRect(QPrinter::DevicePixel) << "device pt"
+ << "\nPageRect: " << printer.pageRect(QPrinter::Point) << "pt "
+ << printer.pageRect(QPrinter::Millimeter) << "mm "
+ << "\n " << printer.pageRect(QPrinter::DevicePixel) << "device pt";
+ return s;
+}
+
+// Print a page with a rectangular frame, vertical / horizontal rulers in cm and printer info.
+
+static void drawHorizCmRuler(QPainter &painter, int x1, int x2, int y)
+{
+ painter.drawLine(x1, y, x2, y);
+ const int dpI = painter.device()->logicalDpiX();
+ const int dpCm = qRound(double(dpI) / 2.54);
+ const int h = dpCm / 2;
+ const QFontMetrics fm(painter.font());
+ for (int cm = 0, x = x1; x < x2; x += dpCm, ++cm) {
+ painter.drawLine(x, y, x, y - h);
+ if (cm) {
+ const QString n = QString::number(cm);
+ const QRect br = fm.boundingRect(n);
+ painter.drawText(x - br.width() / 2, y - h - 10, n);
+ }
+ }
+}
+
+static void drawVertCmRuler(QPainter &painter, int x, int y1, int y2)
+{
+ painter.drawLine(x, y1, x, y2);
+ const int dpI = painter.device()->logicalDpiY();
+ const int dpCm = qRound(double(dpI) / 2.54);
+ const int h = dpCm / 2;
+ const QFontMetrics fm(painter.font());
+ for (int cm = 0, y = y1; y < y2; y += dpCm, ++cm) {
+ painter.drawLine(x, y, x + h, y);
+ if (cm) {
+ const QString n = QString::number(cm);
+ const QRect br = fm.boundingRect(n);
+ painter.drawText(x + h + 10, y + br.height() / 2, n);
+ }
+ }
+}
+
+static void print(QPrinter *printer)
+{
+ QPainter painter(printer);
+ const QRectF pageF = printer->pageRect();
+
+ painter.drawRect(pageF);
+
+ drawHorizCmRuler(painter, pageF.x(), pageF.right(), pageF.height() /2);
+ drawVertCmRuler(painter, pageF.x() + pageF.width() / 2, pageF.top(), pageF.bottom());
+
+ QFont font = painter.font();
+ font.setFamily("Courier");
+ font.setPointSize(10);
+ painter.setFont(font);
+
+ // Format message.
+ const int charHeight = QFontMetrics(font).boundingRect('X').height();
+ QString msg;
+ QTextStream str(&msg);
+ str << "Qt "<< QT_VERSION_STR;
+#if QT_VERSION >= 0x050000
+ str << ' ' << QGuiApplication::platformName();
+#endif
+ str << ' ' << QDateTime::currentDateTime().toString()
+ << "\nFont: " << font.family() << ' ' << font.pointSize() << '\n'
+ << *printer;
+
+ QPointF textPoint = pageF.topLeft() + QPoint(10, charHeight + 10);
+ foreach (const QString &line, msg.split('\n')) {
+ painter.drawText(textPoint, line);
+ textPoint.ry() += (15 * charHeight) / 10;
+ }
+
+ painter.end();
+}
+
+class PrintPreviewDialog : public QPrintPreviewDialog {
+ Q_OBJECT
+public:
+ explicit PrintPreviewDialog(QPrinter *printer, QWidget *parent = 0) : QPrintPreviewDialog(printer, parent)
+ {
+ connect(this, SIGNAL(paintRequested(QPrinter*)), this, SLOT(slotPaintRequested(QPrinter*)));
+ }
+
+public slots:
+ void slotPaintRequested(QPrinter *p) { print(p); }
+};
+
+class PageSizeControl : public QWidget {
+public:
+ explicit PageSizeControl(QWidget *parent = 0);
+ QSizeF pageSize() const { return QSizeF(m_width->value(), m_height->value()); }
+ void setPageSize(const QSizeF &s) { m_width->setValue(s.width()); m_height->setValue(s.height()); }
+
+private:
+ QDoubleSpinBox *m_width;
+ QDoubleSpinBox *m_height;
+};
+
+PageSizeControl::PageSizeControl(QWidget *parent)
+ : QWidget(parent)
+ , m_width(new QDoubleSpinBox(this))
+ , m_height(new QDoubleSpinBox(this))
+{
+ m_width->setRange(1, 1000);
+ m_width->setSingleStep(10);
+ m_height->setRange(1, 1000);
+ m_height->setSingleStep(10);
+ QHBoxLayout *hBoxLayout = new QHBoxLayout(this);
+ hBoxLayout->addWidget(m_width);
+ hBoxLayout->addWidget(new QLabel("x", this));
+ hBoxLayout->addWidget(m_height);
+ hBoxLayout->addWidget(new QLabel("mm", this));
+}
+
+PrintDialogPanel::PrintDialogPanel(QWidget *parent)
+ : QWidget(parent)
+ , m_creationGroupBox(new QGroupBox(tr("Create"), this))
+ , m_settingsGroupBox(new QGroupBox(tr("Settings"), this))
+ , m_dialogsGroupBox(new QGroupBox(tr("Dialogs"), this))
+ , m_pageSizeCombo(new QComboBox)
+{
+ // Create with resolution
+ QHBoxLayout *hBoxLayout = new QHBoxLayout(m_creationGroupBox);
+ m_modeCombo = createCombo(m_creationGroupBox, modeComboData, sizeof(modeComboData)/sizeof(FlagData));
+ hBoxLayout->addWidget(m_modeCombo);
+ m_createButton = new QPushButton(tr("Create"), m_creationGroupBox);
+ connect(m_createButton, SIGNAL(clicked()), this, SLOT(createPrinter()));
+ hBoxLayout->addWidget(m_createButton);
+ m_deleteButton = new QPushButton(tr("Delete"), m_creationGroupBox);
+ connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(deletePrinter()));
+ hBoxLayout->addWidget(m_deleteButton);
+ hBoxLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
+
+ QFormLayout *formLayout = new QFormLayout(m_settingsGroupBox);
+ m_pageSizeCombo = createCombo(m_settingsGroupBox, pageSizeComboData, sizeof(pageSizeComboData)/sizeof(FlagData));
+ connect(m_pageSizeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(enableCustomSizeControl()));
+ formLayout->addRow(tr("Paper #:"), m_pageSizeCombo);
+ m_customPageSizeControl = new PageSizeControl;
+ formLayout->addRow(tr("Custom size:"), m_customPageSizeControl);
+ m_orientationCombo = createCombo(m_settingsGroupBox, orientationComboData, sizeof(orientationComboData)/sizeof(FlagData));
+ formLayout->addRow("Orientation:", m_orientationCombo);
+ m_fullPageCheckBox = new QCheckBox(tr("Full page"), m_settingsGroupBox);
+ formLayout->addRow(m_fullPageCheckBox);
+
+ QVBoxLayout *vBoxLayout = new QVBoxLayout(m_dialogsGroupBox);
+
+ m_printDialogOptionsControl = new OptionsControl(tr("Options"), printDialogOptions, sizeof(printDialogOptions) / sizeof(FlagData), m_dialogsGroupBox);
+ vBoxLayout->addWidget(m_printDialogOptionsControl);
+ m_printDialogRangeCombo = createCombo(m_dialogsGroupBox, printRangeOptions, sizeof(printRangeOptions) / sizeof(FlagData));
+ vBoxLayout->addWidget(m_printDialogRangeCombo);
+
+ {
+ QPrintDialog dialog;
+ m_printDialogOptionsControl->setValue(dialog.options());
+ m_printDialogRangeCombo->setCurrentIndex(dialog.printRange());
+ }
+
+ QPushButton *button = new QPushButton(tr("Print..."), m_dialogsGroupBox);
+ connect(button, SIGNAL(clicked()), this, SLOT(showPrintDialog()));
+ vBoxLayout->addWidget(button);
+ button = new QPushButton(tr("Preview..."), m_dialogsGroupBox);
+ connect(button, SIGNAL(clicked()), this, SLOT(showPreviewDialog()));
+ vBoxLayout->addWidget(button);
+
+ QGridLayout *gridLayout = new QGridLayout(this);
+ gridLayout->addWidget(m_creationGroupBox, 0, 0);
+ gridLayout->addWidget(m_settingsGroupBox, 1, 0);
+ gridLayout->addWidget(m_dialogsGroupBox, 0, 1, 2, 1);
+ gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 2, 0, 1, 2);
+
+ enablePanels();
+}
+
+PrintDialogPanel::~PrintDialogPanel()
+{
+}
+
+void PrintDialogPanel::enablePanels()
+{
+ const bool exists = !m_printer.isNull();
+ m_createButton->setEnabled(!exists);
+ m_modeCombo->setEnabled(!exists);
+ m_deleteButton->setEnabled(exists);
+ m_settingsGroupBox->setEnabled(exists);
+ m_dialogsGroupBox->setEnabled(exists);
+}
+
+void PrintDialogPanel::createPrinter()
+{
+ const QPrinter::PrinterMode mode = comboBoxValue<QPrinter::PrinterMode>(m_modeCombo);
+ m_printer.reset(new QPrinter(mode)); // Can set only once.
+ retrieveSettings(m_printer.data());
+ enablePanels();
+ enableCustomSizeControl();
+}
+
+void PrintDialogPanel::deletePrinter()
+{
+ m_printer.reset();
+ enablePanels();
+}
+
+void PrintDialogPanel::applySettings(QPrinter *printer) const
+{
+ const QPrinter::PageSize pageSize = comboBoxValue<QPrinter::PageSize>(m_pageSizeCombo);
+ if (pageSize == QPrinter::Custom)
+ printer->setPaperSize(m_customPageSizeControl->pageSize(), QPrinter::Millimeter);
+ else
+ printer->setPageSize(pageSize);
+ printer->setOrientation(comboBoxValue<QPrinter::Orientation>(m_orientationCombo));
+ printer->setFullPage(m_fullPageCheckBox->isChecked());
+}
+
+void PrintDialogPanel::retrieveSettings(const QPrinter *printer)
+{
+ setComboBoxValue(m_pageSizeCombo, printer->pageSize());
+ setComboBoxValue(m_orientationCombo, printer->orientation());
+ m_fullPageCheckBox->setChecked(printer->fullPage());
+ m_customPageSizeControl->setPageSize(m_printer->paperSize(QPrinter::Millimeter));
+}
+
+void PrintDialogPanel::enableCustomSizeControl()
+{
+ m_customPageSizeControl->setEnabled(m_pageSizeCombo->currentIndex() == QPrinter::Custom);
+}
+
+void PrintDialogPanel::showPrintDialog()
+{
+ applySettings(m_printer.data());
+ QPrintDialog dialog(m_printer.data(), this);
+ dialog.setOptions(m_printDialogOptionsControl->value<QPrintDialog::PrintDialogOptions>());
+ dialog.setPrintRange(comboBoxValue<QPrintDialog::PrintRange>(m_printDialogRangeCombo));
+ if (dialog.exec() == QDialog::Accepted)
+ retrieveSettings(m_printer.data());
+}
+
+void PrintDialogPanel::showPreviewDialog()
+{
+ applySettings(m_printer.data());
+ PrintPreviewDialog dialog(m_printer.data(), this);
+ dialog.resize(QApplication::desktop()->availableGeometry().size() * 4/ 5);
+ if (dialog.exec() == QDialog::Accepted)
+ retrieveSettings(m_printer.data());
+}
+
+#include "printdialogpanel.moc"
+
+#endif // !QT_NO_PRINTER
diff --git a/tests/manual/dialogs/printdialogpanel.h b/tests/manual/dialogs/printdialogpanel.h
new file mode 100644
index 0000000000..4999504a3c
--- /dev/null
+++ b/tests/manual/dialogs/printdialogpanel.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PRINTDIALOGPANEL_H
+#define PRINTDIALOGPANEL_H
+
+#ifndef QT_NO_PRINTER
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QPrinter;
+class QComboBox;
+class QGroupBox;
+class QPushButton;
+class QCheckBox;
+QT_END_NAMESPACE
+
+class PageSizeControl;
+class OptionsControl;
+
+class PrintDialogPanel : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit PrintDialogPanel(QWidget *parent = 0);
+ ~PrintDialogPanel();
+
+private slots:
+ void createPrinter();
+ void deletePrinter();
+ void showPrintDialog();
+ void showPreviewDialog();
+ void enableCustomSizeControl();
+
+private:
+ void applySettings(QPrinter *printer) const;
+ void retrieveSettings(const QPrinter *printer);
+ void enablePanels();
+
+ QGroupBox *m_creationGroupBox;
+ QPushButton *m_createButton;
+ QPushButton *m_deleteButton;
+ QGroupBox *m_settingsGroupBox;
+ QCheckBox *m_fullPageCheckBox;
+ QGroupBox *m_dialogsGroupBox;
+ OptionsControl *m_printDialogOptionsControl;
+ QComboBox *m_printDialogRangeCombo;
+ QComboBox *m_modeCombo;
+ QComboBox *m_orientationCombo;
+ QComboBox *m_pageSizeCombo;
+ PageSizeControl *m_customPageSizeControl;
+ QScopedPointer<QPrinter> m_printer;
+};
+
+#endif // !QT_NO_PRINTER
+#endif // PRINTDIALOGPANEL_H
diff --git a/tests/manual/dialogs/utils.cpp b/tests/manual/dialogs/utils.cpp
new file mode 100644
index 0000000000..7e0067c7f3
--- /dev/null
+++ b/tests/manual/dialogs/utils.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "utils.h"
+
+#include <QCheckBox>
+#include <QVBoxLayout>
+
+QComboBox *createCombo(QWidget *parent, const FlagData *d, size_t size)
+{
+ QComboBox *c = new QComboBox(parent);
+ for (size_t i = 0; i < size; ++i)
+ c->addItem(QLatin1String(d[i].description), QVariant(d[i].value));
+ return c;
+}
+
+void setComboBoxValue(QComboBox *c, int v)
+{
+ c->setCurrentIndex(c->findData(QVariant(v)));
+}
+
+OptionsControl::OptionsControl(const QString &title, const FlagData *data, size_t count, QWidget *parent)
+ : QGroupBox(title, parent)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ for (size_t i = 0; i < count; ++i) {
+ QCheckBox *box = new QCheckBox(QString::fromLatin1(data[i].description));
+ m_checkBoxes.push_back(CheckBoxFlagPair(box, data[i].value));
+ layout->addWidget(box);
+ }
+}
+
+void OptionsControl::setValue(int flags)
+{
+ foreach (const CheckBoxFlagPair &cf, m_checkBoxes)
+ cf.first->setChecked(cf.second & flags);
+}
+
+int OptionsControl::intValue() const
+{
+ int result = 0;
+ foreach (const CheckBoxFlagPair &cf, m_checkBoxes) {
+ if (cf.first->isChecked())
+ result |= cf.second;
+ }
+ return result;
+}
diff --git a/tests/manual/dialogs/utils.h b/tests/manual/dialogs/utils.h
new file mode 100644
index 0000000000..634795627f
--- /dev/null
+++ b/tests/manual/dialogs/utils.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <QComboBox>
+#include <QGroupBox>
+#include <QVariant>
+#include <QPair>
+#include <QList>
+
+QT_FORWARD_DECLARE_CLASS(QCheckBox)
+
+// Associate enum/flag value with a description.
+struct FlagData
+{
+ const char *description;
+ int value;
+};
+
+// Helpers for creating combo boxes representing enumeration values from flag data.
+QComboBox *createCombo(QWidget *parent, const FlagData *d, size_t size);
+
+template <class Enum>
+Enum comboBoxValue(const QComboBox *c)
+{
+ return static_cast<Enum>(c->itemData(c->currentIndex()).toInt());
+}
+
+void setComboBoxValue(QComboBox *c, int v);
+
+// A group box with check boxes for option flags.
+class OptionsControl : public QGroupBox {
+public:
+ explicit OptionsControl(const QString &title, const FlagData *data, size_t count, QWidget *parent);
+
+ void setValue(int flags);
+ template <class Enum>
+ Enum value() const { return static_cast<Enum>(intValue()); }
+
+private:
+ typedef QPair<QCheckBox *, int> CheckBoxFlagPair;
+
+ int intValue() const;
+
+ QList<CheckBoxFlagPair> m_checkBoxes;
+};
+
+#endif // UTILS_H
diff --git a/tests/manual/widgets/itemviews/autoResizePrecision/tablehorz/testtable1.cpp b/tests/manual/widgets/itemviews/autoResizePrecision/tablehorz/testtable1.cpp
index 463366433c..f4ecae83fe 100644
--- a/tests/manual/widgets/itemviews/autoResizePrecision/tablehorz/testtable1.cpp
+++ b/tests/manual/widgets/itemviews/autoResizePrecision/tablehorz/testtable1.cpp
@@ -100,7 +100,8 @@ protected:
void TableDialog::slotValueChanged(int newval)
{
- tableView->horizontalHeader()->setResizeContentsPrecision(newval, true);
+ tableView->horizontalHeader()->setResizeContentsPrecision(newval);
+ tableView->resizeColumnsToContents();
}
diff --git a/tests/manual/widgets/itemviews/autoResizePrecision/tablevert/testtable2.cpp b/tests/manual/widgets/itemviews/autoResizePrecision/tablevert/testtable2.cpp
index 027801d528..b64a4325f9 100644
--- a/tests/manual/widgets/itemviews/autoResizePrecision/tablevert/testtable2.cpp
+++ b/tests/manual/widgets/itemviews/autoResizePrecision/tablevert/testtable2.cpp
@@ -110,7 +110,8 @@ protected:
void TableDialog::slotValueChanged(int newval)
{
- tableView->verticalHeader()->setResizeContentsPrecision(newval, true);
+ tableView->verticalHeader()->setResizeContentsPrecision(newval);
+ tableView->resizeRowsToContents();
}
diff --git a/tests/manual/widgets/itemviews/autoResizePrecision/treeview/testtree.cpp b/tests/manual/widgets/itemviews/autoResizePrecision/treeview/testtree.cpp
index c48d933fcd..d9984ca8ea 100644
--- a/tests/manual/widgets/itemviews/autoResizePrecision/treeview/testtree.cpp
+++ b/tests/manual/widgets/itemviews/autoResizePrecision/treeview/testtree.cpp
@@ -118,7 +118,9 @@ protected:
void TreeDialog::slotValueChanged(int newval)
{
- treeWidget->header()->setResizeContentsPrecision(newval, true);
+ treeWidget->header()->setResizeContentsPrecision(newval);
+ for (int u = 0; u < treeWidget->header()->count(); ++u)
+ treeWidget->resizeColumnToContents(u);
}
int main(int argc, char *argv[])
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index b55f9e64cf..d237228812 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -180,10 +180,10 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "WMF_BACKEND" ] = "auto";
dictionary[ "WMSDK" ] = "auto";
dictionary[ "QML_DEBUG" ] = "yes";
- dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
+ dictionary[ "PLUGIN_MANIFESTS" ] = "no";
dictionary[ "DIRECTWRITE" ] = "no";
dictionary[ "NIS" ] = "no";
- dictionary[ "NEON" ] = "no";
+ dictionary[ "NEON" ] = "auto";
dictionary[ "LARGE_FILE" ] = "yes";
dictionary[ "FONT_CONFIG" ] = "no";
dictionary[ "POSIX_IPC" ] = "no";
@@ -195,8 +195,10 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "CFG_GCC_SYSROOT" ] = "yes";
dictionary[ "SLOG2" ] = "no";
dictionary[ "QNX_IMF" ] = "no";
+ dictionary[ "PPS" ] = "no";
dictionary[ "SYSTEM_PROXIES" ] = "no";
dictionary[ "WERROR" ] = "auto";
+ dictionary[ "QREAL" ] = "double";
//Only used when cross compiling.
dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
@@ -384,7 +386,7 @@ void Configure::parseCmdLine()
configCmdLine.clear();
reloadCmdLine();
} else {
- dictionary[ "HELP" ] = "yes";
+ dictionary[ "DONE" ] = "error";
}
i = 0;
}
@@ -419,6 +421,12 @@ void Configure::parseCmdLine()
break;
dictionary[ "QCONFIG" ] = configCmdLine.at(i);
}
+ else if (configCmdLine.at(i) == "-qreal") {
+ ++i;
+ if (i == argCount)
+ break;
+ dictionary[ "QREAL" ] = configCmdLine.at(i);
+ }
else if (configCmdLine.at(i) == "-release") {
dictionary[ "BUILD" ] = "release";
@@ -877,6 +885,10 @@ void Configure::parseCmdLine()
dictionary[ "QNX_IMF" ] = "no";
} else if (configCmdLine.at(i) == "-imf") {
dictionary[ "QNX_IMF" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-pps") {
+ dictionary[ "PPS" ] = "no";
+ } else if (configCmdLine.at(i) == "-pps") {
+ dictionary[ "PPS" ] = "yes";
} else if (configCmdLine.at(i) == "-no-system-proxies") {
dictionary[ "SYSTEM_PROXIES" ] = "no";
} else if (configCmdLine.at(i) == "-system-proxies") {
@@ -1302,7 +1314,7 @@ void Configure::parseCmdLine()
}
else {
- dictionary[ "HELP" ] = "yes";
+ dictionary[ "DONE" ] = "error";
cout << "Unknown option " << configCmdLine.at(i) << endl;
break;
}
@@ -1322,7 +1334,7 @@ void Configure::parseCmdLine()
if (dictionary["QMAKESPEC"].toLower() == "features"
|| !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
- dictionary[ "HELP" ] = "yes";
+ dictionary[ "DONE" ] = "error";
if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
} else if (dictionary ["QMAKESPEC_FROM"] == "env") {
@@ -1360,10 +1372,10 @@ void Configure::parseCmdLine()
const QStringList family = devices.filter(dictionary["XQMAKESPEC"], Qt::CaseInsensitive);
if (family.isEmpty()) {
- dictionary["HELP"] = "yes";
+ dictionary[ "DONE" ] = "error";
cout << "Error: No device matching '" << dictionary["XQMAKESPEC"] << "'." << endl;
} else if (family.size() > 1) {
- dictionary["HELP"] = "yes";
+ dictionary[ "DONE" ] = "error";
cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl;
@@ -1378,7 +1390,7 @@ void Configure::parseCmdLine()
// Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
if (dictionary.contains("XQMAKESPEC") &&
!mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
- dictionary["HELP"] = "yes";
+ dictionary[ "DONE" ] = "error";
cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
}
}
@@ -1430,27 +1442,15 @@ void Configure::parseCmdLine()
for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
qtConfig.removeAll(*it);
- if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
+ if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes")
+ && (dictionary[ "DONE" ] != "error"))
saveCmdLine();
}
void Configure::validateArgs()
{
// Validate the specified config
-
- // Get all possible configurations from the file system.
- QDir dir;
- QStringList filters;
- filters << "qconfig-*.h";
- dir.setNameFilters(filters);
- dir.setPath(sourcePath + "/src/corelib/global/");
-
- QStringList stringList = dir.entryList();
-
- QStringList::Iterator it;
- for (it = stringList.begin(); it != stringList.end(); ++it)
- allConfigs << it->remove("qconfig-").remove(".h");
- allConfigs << "full";
+ QString cfgpath = sourcePath + "/src/corelib/global/qconfig-" + dictionary["QCONFIG"] + ".h";
// Try internal configurations first.
QStringList possible_configs = QStringList()
@@ -1462,23 +1462,22 @@ void Configure::validateArgs()
int index = possible_configs.indexOf(dictionary["QCONFIG"]);
if (index >= 0) {
for (int c = 0; c <= index; c++) {
- qmakeConfig += possible_configs[c] + "-config";
+ qtConfig += possible_configs[c] + "-config";
}
+ if (dictionary["QCONFIG"] != "full")
+ dictionary["QCONFIG_PATH"] = cfgpath;
return;
}
- // If the internal configurations failed, try others.
- QStringList::Iterator config;
- for (config = allConfigs.begin(); config != allConfigs.end(); ++config) {
- if ((*config) == dictionary[ "QCONFIG" ])
- break;
- }
- if (config == allConfigs.end()) {
- dictionary[ "HELP" ] = "yes";
- cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
+ if (!QFileInfo::exists(cfgpath)) {
+ cfgpath = QFileInfo(dictionary["QCONFIG"]).absoluteFilePath();
+ if (!QFileInfo::exists(cfgpath)) {
+ dictionary[ "DONE" ] = "error";
+ cout << "No such configuration \"" << qPrintable(dictionary["QCONFIG"]) << "\"" << endl ;
+ return;
+ }
}
- else
- qmakeConfig += (*config) + "-config";
+ dictionary["QCONFIG_PATH"] = cfgpath;
}
// Output helper functions --------------------------------[ Start ]-
@@ -1653,13 +1652,17 @@ void Configure::applySpecSpecifics()
dictionary[ "QT_CUPS" ] = "no";
dictionary[ "QT_GLIB" ] = "no";
dictionary[ "QT_ICONV" ] = "no";
+ dictionary[ "FONT_CONFIG" ] = "auto";
dictionary["DECORATIONS"] = "default windows styled";
} else if ((platform() == QNX) || (platform() == BLACKBERRY)) {
dictionary["STACK_PROTECTOR_STRONG"] = "auto";
dictionary["SLOG2"] = "auto";
dictionary["QNX_IMF"] = "auto";
+ dictionary["PPS"] = "auto";
dictionary["QT_XKBCOMMON"] = "no";
+ dictionary[ "ANGLE" ] = "no";
+ dictionary[ "FONT_CONFIG" ] = "auto";
} else if (platform() == ANDROID) {
dictionary[ "REDUCE_EXPORTS" ] = "yes";
dictionary[ "BUILD" ] = "release";
@@ -1790,6 +1793,9 @@ bool Configure::displayHelp()
desc( "-sysroot <dir>", "Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.");
desc( "-no-gcc-sysroot", "When using -sysroot, it disables the passing of --sysroot to the compiler.\n");
+ desc( "-qconfig <local>", "Use src/corelib/global/qconfig-<local>.h rather than the\n"
+ "default 'full'.\n");
+
desc("NIS", "no", "-no-nis", "Do not compile NIS support.");
desc("NIS", "yes", "-nis", "Compile NIS support.\n");
@@ -1872,6 +1878,8 @@ bool Configure::displayHelp()
desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support.");
desc("QNX_IMF", "yes", "-imf", "Compile with imf support.");
desc("QNX_IMF", "no", "-no-imf", "Do not compile with imf support.");
+ desc("PPS", "yes", "-pps", "Compile with PPS support.");
+ desc("PPS", "no", "-no-pps", "Do not compile with PPS support.");
}
desc("ANGLE", "yes", "-angle", "Use the ANGLE implementation of OpenGL ES 2.0.");
@@ -1895,6 +1903,9 @@ bool Configure::displayHelp()
desc("PROCESS", "full", "-fully-process", "Generate Makefiles/Project files for the entire Qt\ntree.");
desc("PROCESS", "no", "-dont-process", "Do not generate Makefiles/Project files.\n");
+ desc( "-qreal [double|float]", "typedef qreal to the specified type. The default is double.\n"
+ "Note that changing this flag affects binary compatibility.\n");
+
desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
desc("RTTI", "yes", "-rtti", "Compile runtime type information.");
desc("STRIP", "no", "-no-strip", "Do not strip libraries and executables of debug info when installing.");
@@ -1943,13 +1954,6 @@ bool Configure::displayHelp()
desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC");
desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP).\n");
-/* We do not support -qconfig on Windows yet
-
- desc( "-qconfig <local>", "Use src/tools/qconfig-local.h rather than the default.\nPossible values for local:");
- for (int i=0; i<allConfigs.size(); ++i)
- desc( "", qPrintable(QString(" %1").arg(allConfigs.at(i))), false, ' ');
- printf("\n");
-*/
desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
desc( "-redo", "Run configure with the same parameters as last time.\n");
@@ -2111,9 +2115,7 @@ bool Configure::checkAvailability(const QString &part)
available = findFile("pcre.h");
else if (part == "ICU")
- available = findFile("unicode/utypes.h") && findFile("unicode/ucol.h") && findFile("unicode/ustring.h")
- && (findFile("icuin.lib") || findFile("sicuin.lib")
- || findFile("libicuin.lib") || findFile("libsicuin.lib")); // "lib" prefix for mingw, 's' prefix for static
+ available = tryCompileProject("unix/icu");
else if (part == "ANGLE") {
available = checkAngleAvailability();
@@ -2219,6 +2221,12 @@ bool Configure::checkAvailability(const QString &part)
available = tryCompileProject("unix/slog2");
} else if (part == "QNX_IMF") {
available = tryCompileProject("unix/qqnx_imf");
+ } else if (part == "PPS") {
+ available = (platform() == QNX || platform() == BLACKBERRY) && tryCompileProject("unix/pps");
+ } else if (part == "NEON") {
+ available = (dictionary["QT_ARCH"] == "arm") && tryCompileProject("unix/neon");
+ } else if (part == "FONT_CONFIG") {
+ available = tryCompileProject("unix/fontconfig");
}
return available;
@@ -2231,6 +2239,9 @@ void Configure::autoDetection()
{
cout << "Running configuration tests..." << endl;
+ // Auto-detect CPU architectures.
+ detectArch();
+
if (dictionary["C++11"] == "auto") {
if (!dictionary["QMAKESPEC"].contains("msvc"))
dictionary["C++11"] = tryCompileProject("common/c++11") ? "yes" : "no";
@@ -2314,6 +2325,8 @@ void Configure::autoDetection()
dictionary["AVX2"] = checkAvailability("AVX2") ? "yes" : "no";
if (dictionary["IWMMXT"] == "auto")
dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
+ if (dictionary["NEON"] == "auto")
+ dictionary["NEON"] = checkAvailability("NEON") ? "yes" : "no";
if (dictionary["OPENSSL"] == "auto")
dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
if (dictionary["DBUS"] == "auto")
@@ -2359,9 +2372,16 @@ void Configure::autoDetection()
dictionary["QNX_IMF"] = checkAvailability("QNX_IMF") ? "yes" : "no";
}
+ if (dictionary["PPS"] == "auto") {
+ dictionary["PPS"] = checkAvailability("PPS") ? "yes" : "no";
+ }
+
if (dictionary["QT_EVENTFD"] == "auto")
dictionary["QT_EVENTFD"] = checkAvailability("QT_EVENTFD") ? "yes" : "no";
+ if (dictionary["FONT_CONFIG"] == "auto")
+ dictionary["FONT_CONFIG"] = checkAvailability("FONT_CONFIG") ? "yes" : "no";
+
// Mark all unknown "auto" to the default value..
for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
if (i.value() == "auto")
@@ -2629,7 +2649,6 @@ void Configure::generateOutputVars()
if (dictionary[ "FORCEDEBUGINFO" ] == "yes")
qmakeConfig += "force_debug_info";
qmakeConfig += dictionary[ "BUILD" ];
- dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
if (buildParts.isEmpty()) {
buildParts = defaultBuildParts;
@@ -2654,9 +2673,6 @@ void Configure::generateOutputVars()
qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf('.'));
version.remove(QLatin1Char('.'));
}
- dictionary[ "QMAKE_OUTDIR" ] += "_shared";
- } else {
- dictionary[ "QMAKE_OUTDIR" ] += "_static";
}
if (dictionary[ "ACCESSIBILITY" ] == "yes")
@@ -2760,23 +2776,6 @@ void Configure::generateOutputVars()
if (dictionary[ "SYSTEM_PROXIES" ] == "yes")
qtConfig += "system-proxies";
- // Add config levels --------------------------------------------
- QStringList possible_configs = QStringList()
- << "minimal"
- << "small"
- << "medium"
- << "large"
- << "full";
-
- QString set_config = dictionary["QCONFIG"];
- if (possible_configs.contains(set_config)) {
- foreach (const QString &cfg, possible_configs) {
- qtConfig += (cfg + "-config");
- if (cfg == set_config)
- break;
- }
- }
-
if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"])) {
qmakeConfig += "cross_compile";
dictionary["CROSS_COMPILE"] = "yes";
@@ -2787,10 +2786,6 @@ void Configure::generateOutputVars()
if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
qtConfig += "rpath";
- qmakeVars += QString("OBJECTS_DIR = ") + formatPath(".obj/" + dictionary["QMAKE_OUTDIR"]);
- qmakeVars += QString("MOC_DIR = ") + formatPath(".moc/" + dictionary["QMAKE_OUTDIR"]);
- qmakeVars += QString("RCC_DIR = ") + formatPath(".rcc/" + dictionary["QMAKE_OUTDIR"]);
-
if (!qmakeDefines.isEmpty())
qmakeVars += QString("DEFINES += ") + qmakeDefines.join(' ');
if (!qmakeIncludes.isEmpty())
@@ -2859,7 +2854,6 @@ void Configure::generateOutputVars()
cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
<< "be defined as an environment variable, or specified as an" << endl
<< "argument with -platform" << endl;
- dictionary[ "HELP" ] = "yes";
QStringList winPlatforms;
QDir mkspecsDir(sourcePath + "/mkspecs");
@@ -2884,6 +2878,11 @@ void Configure::generateCachefile()
moduleStream << "QT_BUILD_PARTS += " << buildParts.join(' ') << endl;
if (!skipModules.isEmpty())
moduleStream << "QT_SKIP_MODULES += " << skipModules.join(' ') << endl;
+ QString qcpath = dictionary["QCONFIG_PATH"];
+ QString qlpath = sourcePath + "/src/corelib/global/";
+ if (qcpath.startsWith(qlpath))
+ qcpath.remove(0, qlpath.length());
+ moduleStream << "QT_QCONFIG_PATH = " << qcpath << endl;
moduleStream << endl;
moduleStream << "host_build {" << endl;
@@ -2893,6 +2892,7 @@ void Configure::generateCachefile()
moduleStream << " QT_CPU_FEATURES." << dictionary["QT_ARCH"] <<
" = " << dictionary["QT_CPU_FEATURES"] << endl;
moduleStream << "}" << endl;
+ moduleStream << "QT_COORD_TYPE += " << dictionary["QREAL"] << endl;
if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
moduleStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
@@ -3216,6 +3216,9 @@ void Configure::generateQConfigPri()
if (dictionary[ "QNX_IMF" ] == "yes")
configStream << " qqnx_imf";
+ if (dictionary[ "PPS" ] == "yes")
+ configStream << " qqnx_pps";
+
if (dictionary["DIRECTWRITE"] == "yes")
configStream << " directwrite";
@@ -3313,10 +3316,8 @@ void Configure::generateConfigfiles()
if (dictionary[ "QCONFIG" ] == "full") {
tmpStream << "/* Everything */" << endl;
} else {
- QString configName("qconfig-" + dictionary[ "QCONFIG" ] + ".h");
- tmpStream << "/* Copied from " << configName << "*/" << endl;
tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
- QFile inFile(sourcePath + "/src/corelib/global/" + configName);
+ QFile inFile(dictionary["QCONFIG_PATH"]);
if (inFile.open(QFile::ReadOnly)) {
tmpStream << QTextStream(&inFile).readAll();
inFile.close();
@@ -3368,6 +3369,8 @@ void Configure::generateConfigfiles()
if (dictionary[ "NEON" ] == "yes")
tmpStream << "#define QT_COMPILER_SUPPORTS_NEON" << endl;
+ if (dictionary["QREAL"] != "double")
+ tmpStream << "#define QT_COORD_TYPE " << dictionary["QREAL"] << endl;
tmpStream << endl << "// Compile time features" << endl;
@@ -3578,12 +3581,14 @@ void Configure::displayConfig()
sout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
sout << " PNG support............." << dictionary[ "PNG" ] << endl;
sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl;
+ sout << " Fontconfig support......" << dictionary[ "FONT_CONFIG" ] << endl;
sout << " HarfBuzz-NG support....." << dictionary[ "HARFBUZZ" ] << endl;
sout << " PCRE support............" << dictionary[ "PCRE" ] << endl;
sout << " ICU support............." << dictionary[ "ICU" ] << endl;
if ((platform() == QNX) || (platform() == BLACKBERRY)) {
sout << " SLOG2 support..........." << dictionary[ "SLOG2" ] << endl;
sout << " IMF support............." << dictionary[ "QNX_IMF" ] << endl;
+ sout << " PPS support............." << dictionary[ "PPS" ] << endl;
}
sout << " ANGLE..................." << dictionary[ "ANGLE" ] << endl;
sout << endl;
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index 8a22cea6ec..bf0f61639f 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -113,7 +113,6 @@ private:
QStringList skipModules;
QStringList licensedModules;
QStringList allSqlDrivers;
- QStringList allConfigs;
QStringList disabledModules;
QStringList enabledModules;
QStringList modules;
diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp
index fb815b287e..1e6aa3f298 100644
--- a/tools/configure/main.cpp
+++ b/tools/configure/main.cpp
@@ -94,9 +94,6 @@ int runConfigure( int argc, char** argv )
// Auto-detect modules and settings.
app.autoDetection();
- // ... and the CPU architectures.
- app.detectArch();
-
// After reading all command-line arguments, and doing all the
// auto-detection, it's time to do some last minute validation.
// If the validation fails, we cannot continue.
diff --git a/util/accessibilityinspector/screenreader.cpp b/util/accessibilityinspector/screenreader.cpp
index 5dcf52ef09..e5953637a1 100644
--- a/util/accessibilityinspector/screenreader.cpp
+++ b/util/accessibilityinspector/screenreader.cpp
@@ -42,7 +42,6 @@
#include "screenreader.h"
#include "optionswidget.h"
#include "accessibilityscenemanager.h"
-#include <private/qaccessible2_p.h>
#include <QtGui>
ScreenReader::ScreenReader(QObject *parent) :
diff --git a/util/scripts/make_qfeatures_dot_h b/util/scripts/make_qfeatures_dot_h
deleted file mode 100755
index 20999a239b..0000000000
--- a/util/scripts/make_qfeatures_dot_h
+++ /dev/null
@@ -1,198 +0,0 @@
-#!/usr/bin/perl
-#############################################################################
-##
-## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-## Contact: http://www.qt-project.org/legal
-##
-## This file is part of the test suite of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and Digia. For licensing terms and
-## conditions see http://qt.digia.com/licensing. For further information
-## use the contact form at http://qt.digia.com/contact-us.
-##
-## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 2.1 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, Digia gives you certain additional
-## rights. These rights are described in the Digia 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.
-##
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-#
-# Usage: make_qfeatures_dot_h
-#
-# Generates src/corelib/global/qfeatures.h from src/corelib/global/qfeatures.txt.
-#
-# The qfeatures.txt file can contain redundancies, and this program
-# will show them.
-#
-
-if ($ENV{QTSRCDIR} ne '') {
- $qtbase=$ENV{QTSRCDIR};
-} else {
- $qtbase=$ENV{QTDIR};
-}
-
-open FL, "$qtbase/src/corelib/global/qfeatures.txt"
- or die "Cannot open $qtbase/src/corelib/global/qfeatures.txt";
-
-while (<FL>) {
- if ( /^Feature: (\S*)/ ) {
- print STDERR "Duplicate: $1\n" if $macro{$1};
- $macro{$macro=$1}=1;
- } elsif ( /^Requires: (.*?)\s*$/ ) {
- $deps{$macro}=$1;
- map { $dep{"$macro $_"}=1 } split /\s+/, $1;
- } elsif ( /^Name: (.*?)\s*$/ ) {
- $label{$macro}=$1;
- }
-}
-
-close FL;
-
-sub depends {
- my($x,$y) = @_;
- return 1 if $dep{"$x $y"};
- return 0 if $dep{"$y $x"};
- return 0 if $x eq $y;
- my $d;
- for $d (split /\s+/, $deps{$x}) {
- return 1 if depends($d,$y);
- }
- return 0;
-}
-sub dependants_rec {
- my($x) = @_;
- my $n = 0;
- my $d = 0;
- $dependants_rec_count++;
- if ( $dependants_rec_count > $dependants_rec_limit ) {
- if ( $circularity_start eq $x ) {
- print STDERR "Circular dependency: $circularity\n";
- exit;
- }
- $circularity_start=$x if !$circularity_start;
- $circularity="$x $circularity";
- }
- for $d (split /\s+/, $deps{$x}) {
- $n += 1 + dependants_rec($d);
- }
- $dependants_rec_count--;
- return $n;
-}
-sub dependants {
- $dependants_rec_limit=keys %macro if !$dependants_rec_limit;
- $dependants_rec_count=0;
- return dependants_rec @_;
-}
-sub dependencysort {
- my($x, $y) = @_;
- my $xd = dependants($x);
- my $yd = dependants($y);
- return $xd-$yd if $xd != $yd;
- return $x cmp $y;
-}
-
-@macros = sort { dependencysort($a,$b) } keys %macro;
-
-for $macro ( @macros ) {
- for $d1 (split /\s+/, $deps{$macro} ) {
- for $d2 (split /\s+/, $deps{$macro} ) {
- print STDERR "Redundancy in $macro - $d1 depends on $d2\n" if depends($d1,$d2);
- }
- print STDERR "Unknown in $macro - $d1\n" if !$macro{$d1};
- }
-}
-
-open OUT, ">$qtbase/src/corelib/global/qfeatures.h"
- or die "Cannot open $qtbase/src/corelib/global/qfeatures.h for writing";
-
-print OUT
-'/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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, Digia gives you certain additional
-** rights. These rights are described in the Digia 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.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- * All features and their dependencies.
- *
- * This list is generated from $QTDIR/src/corelib/global/qfeatures.txt
- * by $QTSRCDIR/util/scripts/make_qfeatures_dot_h
- */
-
-';
-
-
-for $macro ( @macros ) {
- print OUT "// $label{$macro}\n";
- if ( $deps{$macro} ) {
- print OUT "#if !defined(QT_NO_$macro)";
- print OUT " && (", (join " || ", map { "defined(QT_NO_$_)" } split /\s+/, $deps{$macro}), ")";
- print OUT "\n";
- print OUT "#define QT_NO_$macro\n";
- print OUT "#endif\n";
- } else {
- print OUT "//#define QT_NO_$macro\n";
- }
- print OUT "\n";
-}
-
-close OUT;
diff --git a/util/scripts/unix_to_dos b/util/scripts/unix_to_dos
deleted file mode 100755
index 510037c2f7..0000000000
--- a/util/scripts/unix_to_dos
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/perl
-
-undef $/;
-
-foreach $f ( @ARGV ) {
- if ( open( F, "< $f" ) ) {
- $i = <F>;
- close F;
- $i =~ s/\n/\r\n/g;
- $i =~ s/\r+/\r/g;
- if ( open( F, "> $f" ) ) {
- print F $i;
- close F;
- }
- }
-}